model_diff.Rd
The model-based sinlge-arm comparison addresses the fundamental question of whether the current treatment provides a clinically significant improvement over prior treatments in the population. The proposed test statistic computes the difference between the observed outcome from the current treatment and the covariate-specific predicted outcome based on a model of the historical data. Thus, the difference between the observed and predicted quantities is attributed to the current treatment.
model_diff( data, outcome, covars, model, cov, coef, type = "logistic", output.details = FALSE )
data | a data frame containing the outcome and the outcome predictions. |
---|---|
outcome | the outcome, or response variable name. Must be a variable contained within the data frame specified in data=. |
covars | vector of covariate/predictor variable(s) names. Must be a variable(s) contained within the data frame specified in data=. If model includes an intercept, user must include the column of ones in the covars vector |
model | glm object of the predictive model estimated on historical cohort. If specified, the outcome, covars, cov, and coef objects will be extracted from object. |
cov | Variance-covaraince matrix of the beta coefficients from predictive model. |
coef | Vector of the beta coefficients from predictive model. If model includes an intercept, a vector of ones must appear in data. |
type | Type of predictive model used. logistic is currently the only valid input. |
output.details | Save additional information. Default is FALSE. |
Returns a list of results from analysis.
Heller, Glenn, Michael W. Kattan, and Howard I. Scher. "Improving the decision to pursue a phase 3 clinical trial by adjusting for patient-specific factors in evaluating phase 2 treatment efficacy data." Medical Decision Making 27.4 (2007): 380-386.
set.seed(23432) #simulating historic dataset and creating prediction model. marker=rnorm(500, sd = 2) respond=runif(500)<plogis(marker) historic.data=data.frame(respond,marker) model.fit=glm(data=historic.data, formula = respond ~ marker, family = binomial(logit)) #simulating new data, with higher response rate new.data = marker=rnorm(50, sd = 2) respond=runif(50)<plogis(marker + 1) new.data=data.frame(respond,marker) #comparing outcomes in new data to those predicted in historic data # z-statistic = 2.412611 indicates signficant difference model_diff(data = new.data, model = model.fit)#> $var.tot #> [1] 7.43516 #> #> $V1 #> [1] 0.1484824 #> #> $V2 #> (Intercept) marker #> (Intercept) 0.0131073611 -0.0004169665 #> marker -0.0004169665 0.0082095646 #> #> $d #> (Intercept) marker #> 0.1297715107 -0.0006504912 #> #> $z #> [1] 2.412611 #>#comparing model based difference with binomial test #p-value of 0.3222 indicates we fail to reject null hypothesis binom.test(x=sum(new.data$respond), n=nrow(new.data), p = 0.5, alternative = c("two.sided"))#> #> Exact binomial test #> #> data: sum(new.data$respond) and nrow(new.data) #> number of successes = 29, number of trials = 50, p-value = 0.3222 #> alternative hypothesis: true probability of success is not equal to 0.5 #> 95 percent confidence interval: #> 0.4320604 0.7181178 #> sample estimates: #> probability of success #> 0.58 #>