This function performs analysis using a generalized additive model taking into account all trial data until the arm under study leaves the trial and smoothing over the patient entry index.
gam_cont(
data,
arm,
alpha = 0.025,
ci = FALSE,
smoothing_basis = "tp",
basis_dim = -1,
gam_method = "GCV.Cp",
check = TRUE,
...
)List containing the following elements regarding the results of comparing arm to control:
p-val - p-value (one-sided)
treat_effect - estimated treatment effect in terms of the difference in means
lower_ci - lower limit of the (1-2*alpha)*100% confidence interval
upper_ci - upper limit of the (1-2*alpha)*100% confidence interval
reject_h0 - indicator of whether the null hypothesis was rejected or not (p_val < alpha)
model - fitted model
Data frame with trial data, e.g. result from the datasim_cont() function. Must contain columns named 'treatment', 'response', 'period' and 'j'.
Integer. Index of the treatment arm under study to perform inference on (vector of length 1). This arm is compared to the control group.
Double. Significance level (one-sided). Default=0.025.
Logical. Indicates whether confidence intervals should be computed. Default=FALSE.
String indicating the (penalized) smoothing basis to use. Default="tp" for thin plate regression spline. Available strings are 'tp', 'ts', 'ds', 'cr', 'cs', 'cc', 'sos', 'ps', 'cp', 're', 'mrf', 'gp', and 'so'. For more information see https://stat.ethz.ch/R-manual/R-devel/library/mgcv/html/smooth.terms.html.
Integer. The dimension of the basis used to represent the smooth term. The default depends on the number of variables that the smooth is a function of. Default=-1. For more information see the description of the parameter 'k' in https://stat.ethz.ch/R-manual/R-devel/library/mgcv/html/s.html.
String indicating the smoothing parameter estimation method. Default="GCV.Cp". Available strings are 'GCV.Cp', 'GACV.Cp', 'REML', 'P-REML', 'ML', and 'P-ML'. For more information see the description of the parameter 'method' in https://stat.ethz.ch/R-manual/R-devel/library/mgcv/html/gam.html.
Logical. Indicates whether the input parameters should be checked by the function. Default=TRUE, unless the function is called by a simulation function, where the default is FALSE.
Further arguments passed by wrapper functions when running simulations.
Pavla Krotka
trial_data <- datasim_cont(num_arms = 3, n_arm = 100, d = c(0, 100, 250),
theta = rep(0.25, 3), lambda = rep(0.15, 4), sigma = 1, trend = "linear")
gam_cont(data = trial_data, arm = 3, ci = TRUE)
Run the code above in your browser using DataLab