Title: | Dose Response Signal Detection under Model Uncertainty |
---|---|
Description: | Provides functions for calculating test statistics, simulating quantiles and simulating p-values of likelihood ratio contrast tests in regression models with a lack of identifiability. |
Authors: | Kevin Kokot |
Maintainer: | Kevin Kokot <[email protected]> |
License: | GPL-3 |
Version: | 1.0 |
Built: | 2024-11-26 06:43:26 UTC |
Source: | CRAN |
Provides functions for calculating test statistics, simulating quantiles and simulating p-values of likelihood ratio contrast tests in regression models with a lack of identifiability.
Package: | LRcontrast |
Type: | Package |
Version: | 1.0 |
Date: | 2015-06-21 |
License: | GPL-3 |
The main functions are:
qLRcontrast: Simulates quantiles of likelihood ratio contrast tests
sLRcontrast: Calculates test statistics of likelihood ratio contrast tests
pLRcontrast: Simulates p-values of likelihood ratio contrast tests
Kevin Kokot
Maintainer: Kevin Kokot <[email protected]>
Dette, H., Titoff, S., Volgushev, S. and Bretz, F. (2015), Dose response signal detection under model uncertainty. Biometrics. doi: 10.1111/biom.12357
# Simulate the 90%, 95% and 99% quantiles of the LR contrast tests where the specified # models are competing against each other. # The size of each dose group is equal in this case. qLRcontrast(dose = c(0, 0.05, 0.2, 0.6, 1), probs = c(0.9, 0.95, 0.99), weight = c(0.2, 0.2, 0.2, 0.2, 0.2), models = c("linear", "emax", "exponential", "linlog"), nsim = 10) # Calculate the LR test statistics with the same underlying models. # In this case the data is generated by the constant model, i.e. the # null hypothesis of no dose response is true. resp <- rnorm(n = 50, mean = 0.2) dose <- c(rep(0, 10), rep(0.05, 10), rep(0.2, 10), rep(0.6, 10), rep(1, 10)) sLRcontrast(dose = dose, resp = resp, models = c("linear", "emax", "exponential", "linlog")) # Calculate the p-values in this scenario pLRcontrast(dose = dose, resp = resp, models = c("linear", "emax", "exponential", "linlog"), nsim = 10)
# Simulate the 90%, 95% and 99% quantiles of the LR contrast tests where the specified # models are competing against each other. # The size of each dose group is equal in this case. qLRcontrast(dose = c(0, 0.05, 0.2, 0.6, 1), probs = c(0.9, 0.95, 0.99), weight = c(0.2, 0.2, 0.2, 0.2, 0.2), models = c("linear", "emax", "exponential", "linlog"), nsim = 10) # Calculate the LR test statistics with the same underlying models. # In this case the data is generated by the constant model, i.e. the # null hypothesis of no dose response is true. resp <- rnorm(n = 50, mean = 0.2) dose <- c(rep(0, 10), rep(0.05, 10), rep(0.2, 10), rep(0.6, 10), rep(1, 10)) sLRcontrast(dose = dose, resp = resp, models = c("linear", "emax", "exponential", "linlog")) # Calculate the p-values in this scenario pLRcontrast(dose = dose, resp = resp, models = c("linear", "emax", "exponential", "linlog"), nsim = 10)
The function simulates p-values for LR contrast tests. The competing models can be specified by the argument 'models'
(see drmodels
) and by 'nsim' you can specify how many simulations should be done. It is
recommended to do about 10000 but notice that the simulation can take some time. If the parameter 'info' is set
'TRUE', information of the progress will be shown.
pLRcontrast(dose, resp, models, off = 0.01 * max(dose), scal = 1.2 * max(dose), nsim = 1000, info = TRUE)
pLRcontrast(dose, resp, models, off = 0.01 * max(dose), scal = 1.2 * max(dose), nsim = 1000, info = TRUE)
dose , resp
|
Vectors of equal length specifying dose and response values. |
models |
A subvector of c("linear", "emax", "exponential", "linlog", "sigEmax", "quadratic", "betaMod", "logistic") (see |
off |
Positive and fixed offset parameter in the 'linlog' model (see |
scal |
Positive and fixed dose scaling parameter in the 'betaMod' with ' |
nsim |
A positive integer which specifies the number of simulations that should be done. |
info |
Logical value which indicates whether progress information should be shown. |
A matrix containing the unadjusted and adjusted p-value for one model in each row.
Kevin Kokot
Dette, H., Titoff, S., Volgushev, S. and Bretz, F. (2015), Dose response signal detection under model uncertainty. Biometrics. doi: 10.1111/biom.12357
# In this case the data is generated by the constant model, i.e. the # null hypothesis of no dose response is true. resp <- rnorm(n = 50, mean = 0.2) dose <- c(rep(0, 10), rep(0.05, 10), rep(0.2, 10), rep(0.6, 10), rep(1, 10)) # Calculate the p-values in this scenario pLRcontrast(dose = dose, resp = resp, models = c("linear", "emax", "exponential", "linlog"), nsim = 10)
# In this case the data is generated by the constant model, i.e. the # null hypothesis of no dose response is true. resp <- rnorm(n = 50, mean = 0.2) dose <- c(rep(0, 10), rep(0.05, 10), rep(0.2, 10), rep(0.6, 10), rep(1, 10)) # Calculate the p-values in this scenario pLRcontrast(dose = dose, resp = resp, models = c("linear", "emax", "exponential", "linlog"), nsim = 10)
The function simulates the desired quantiles of the distribution of LR contrast tests. The competing models can be specified
by the argument 'models' (see drmodels
). The argument 'dose' is the vector of the different unique
dose-levels and 'weight' specifies the weight proportion of each dose group. By 'nsim' you can specify how many simulation should
be done. It is recommended to do about 10000 but notice that the simulation can take some time. If the parameter 'info' is set
'TRUE', information of the progress will be shown.
qLRcontrast(dose, probs, models, weight = rep(1/length(dose), length(dose)), off = 0.01 * max(dose), scal = 1.2 * max(dose), nsim = 10000, info = TRUE)
qLRcontrast(dose, probs, models, weight = rep(1/length(dose), length(dose)), off = 0.01 * max(dose), scal = 1.2 * max(dose), nsim = 10000, info = TRUE)
dose |
A vector which contains the unique dose-levels. |
probs |
A vector of probabilities with values in |
models |
A subvector of c("linear", "emax", "exponential", "linlog", "sigEmax", "quadratic", "betaMod", "logistic") (see |
weight |
A vector with values in |
off |
Positive and fixed offset parameter in the 'linlog' model (see |
scal |
Positive and fixed dose scaling parameter in the 'betaMod' with ' |
nsim |
A positive integer which specifies the number of simulations that should be done. |
info |
Logical value which indicates whether progress information should be shown. |
A matrix containing the different quantiles for one model in each row. The last row contains the quantiles of the maximum statistic.
Kevin Kokot
Dette, H., Titoff, S., Volgushev, S. and Bretz, F. (2015), Dose response signal detection under model uncertainty. Biometrics. doi: 10.1111/biom.12357
# Simulate the 90%, 95% and 99% quantiles of the LR contrast tests where the specified # models are competing against each other. # The size of each dose group is equal in this case. qLRcontrast(dose = c(0, 0.05, 0.2, 0.6, 1), probs = c(0.9, 0.95, 0.99), weight = c(0.2, 0.2, 0.2, 0.2, 0.2), models = c("linear", "emax", "exponential", "linlog"), nsim = 10)
# Simulate the 90%, 95% and 99% quantiles of the LR contrast tests where the specified # models are competing against each other. # The size of each dose group is equal in this case. qLRcontrast(dose = c(0, 0.05, 0.2, 0.6, 1), probs = c(0.9, 0.95, 0.99), weight = c(0.2, 0.2, 0.2, 0.2, 0.2), models = c("linear", "emax", "exponential", "linlog"), nsim = 10)
The function calculates LR test statistics for the competing models which are defined by the argument 'models'
(see drmodels
).
sLRcontrast(dose, resp, models, off = 0.01 * max(dose), scal = 1.2 * max(dose))
sLRcontrast(dose, resp, models, off = 0.01 * max(dose), scal = 1.2 * max(dose))
dose , resp
|
Vectors of equal length specifying dose and response values. |
models |
A subvector of c("linear", "emax", "exponential", "linlog", "sigEmax", "quadratic", "betaMod", "logistic") (see |
off |
Positive and fixed offset parameter in the 'linlog' model (see |
scal |
Positive and fixed dose scaling parameter in the 'betaMod' with ' |
A matrix containing the LR test statistic for one model in each row. The last row contains the value of the maximum statistic.
Kevin Kokot
Dette, H., Titoff, S., Volgushev, S. and Bretz, F. (2015), Dose response signal detection under model uncertainty. Biometrics. doi: 10.1111/biom.12357
## Simulate the power of the LR contrast test # five dose levels will be used doselvl <- c(0, 0.05, 0.2, 0.6, 1) dose <- c(rep(0, 10), rep(0.05, 10), rep(0.2, 10), rep(0.6, 10), rep(1, 10)) # each row of 'resp' will contain one sample of size 50 resp <- matrix(nrow=100, ncol=50) # the linear model will serve as the data generating model linear <- function(dose, e0, delta){e0 + delta * dose} # now 'resp' is generated: for (i in 1:100) {for(j in 1:5) {resp[i,(j*10-9):(10*j)]<-rnorm(10, mean=linear(doselvl[j], 0.2, 0.6), sd=1.478)}} # the simulated 95% quantile in this case: quantile <- 4.349362 # now the power is simulated count <- 0 for (i in 1:100) {if(sLRcontrast(dose = dose, resp = resp[i,], models = c("linear", "emax", "exponential", "linlog"))[5] > quantile) {count <- count + 1}} #power: count/100
## Simulate the power of the LR contrast test # five dose levels will be used doselvl <- c(0, 0.05, 0.2, 0.6, 1) dose <- c(rep(0, 10), rep(0.05, 10), rep(0.2, 10), rep(0.6, 10), rep(1, 10)) # each row of 'resp' will contain one sample of size 50 resp <- matrix(nrow=100, ncol=50) # the linear model will serve as the data generating model linear <- function(dose, e0, delta){e0 + delta * dose} # now 'resp' is generated: for (i in 1:100) {for(j in 1:5) {resp[i,(j*10-9):(10*j)]<-rnorm(10, mean=linear(doselvl[j], 0.2, 0.6), sd=1.478)}} # the simulated 95% quantile in this case: quantile <- 4.349362 # now the power is simulated count <- 0 for (i in 1:100) {if(sLRcontrast(dose = dose, resp = resp[i,], models = c("linear", "emax", "exponential", "linlog"))[5] > quantile) {count <- count + 1}} #power: count/100