View source: R/FederatedApproachStage2.R
FederatedApproachStage2 | R Documentation |
The function 'FederatedApproachStage2()' fits the second stage model of the two-stage federated data analysis approach to assess surrogacy.
FederatedApproachStage2(
Dataset,
Intercept.S,
alpha,
Intercept.T,
beta,
sigma.SS,
sigma.ST,
sigma.TT,
Obs.per.trial,
Trial.ID,
R.list,
Alpha = 0.05
)
Dataset |
A data frame with the correct columns (See Data Format). |
Intercept.S |
Estimated intercepts for the surrogate endpoint. |
alpha |
Estimated treatment effects for the surrogate endpoint. |
Intercept.T |
Estimated intercepts for the true endpoint. |
beta |
Estimated treatment effects for the true endpoint. |
sigma.SS |
Estimated variance of the error terms for the surrogate endpoint. |
sigma.ST |
Estimated covariance between the error terms of the surrogate and true endpoint. |
sigma.TT |
Estimated variance of the error terms for the true endpoint. |
Obs.per.trial |
Number of subjects in the trial. |
Trial.ID |
Trial indicator. |
R.list |
List of the variance-covariance matrices of the fixed effects. |
Alpha |
The |
Returns an object of class "FederatedApproachStage2()" that can be used to evaluate surrogacy.
Indiv.R2: a data frame that contains the R^2_{indiv}
and 95% confidence interval to evaluate surrogacy at the trial level.
Trial.R2: a data frame that contains the R^2_{trial}
and 95% confidence interval to evaluate surrogacy at the trial level.
Fixed.Effects: a data frame that contains the average of the estimated fixed effects.
D: estimated D
matrix.
Obs.Per.Trial: number of observations in each trial.
The two-stage federated data analysis approach developed by XXX can be used to assess surrogacy in the meta-analytic multiple-trial setting
(Continuous-continuous case), but without the need of sharing data. Instead, each organization conducts separate analyses on their data set
using the so-called "first stage" model. The results of these analyses are then aggregated at a central analysis hub,
where the aggregated results are analyzed using a "second stage" model and the necessary metrics (R^2_{trial}
and R^2_{indiv}
)
for the validation of the surrogate endpoint are obtained. This function fits the second stage model, where a method-of-moments estimator is
used to obtain the variance-covariance matrix D
from which the R^2_{trial}
can be derived. The R^2_{indiv}
is obtained with
a weighted average of the elements in \Sigma_i
.
A data frame that combines the results of the first stage models and contains:
a column with the trial indicator
a column with the number of subjects in the trial
a column with the estimated intercepts for the surrogate
a column with the estimated treatment effects for the surrogate
a column with the estimated intercepts for the true endpoint
a column with the estimated treatment effects for the true endpoint
a column with the variances of the error term for the surrogate endpoint
a column with the covariances between the error terms of the surrogate and true endpoint
a column with the variances of the error term for the true endpoint
A list that combines all the variance-covariance matrices of the fixed effects obtained using the first stage model
Dries De Witte
Florez, A. J., Molenberghs G, Verbeke G, Alonso, A. (2019). A closed-form estimator for metaanalysis and surrogate markers evaluation. Journal of Biopharmaceutical Statistics, 29(2) 318-332.
## Not run:
#As an example, the federated data analysis approach can be applied to the Schizo data set
data(Schizo)
Schizo <- Schizo[order(Schizo$InvestId, Schizo$Id),]
#Create separate datasets for each investigator
Schizo_datasets <- list()
for (invest_id in 1:198) {
Schizo_datasets[[invest_id]] <- Schizo[Schizo$InvestId == invest_id, ]
assign(paste0("Schizo", invest_id), Schizo_datasets[[invest_id]])
}
#Fit the first stage model for each dataset separately
results_stage1 <- list()
invest_ids <- list()
i <- 1
for (invest_id in 1:198) {
dataset <- Schizo_datasets[[invest_id]]
skip_to_next <- FALSE
tryCatch(FederatedApproachStage1(dataset, Surr=CGI, True=PANSS, Treat=Treat, Trial.ID = InvestId,
Min.Treat.Size = 5, Alpha = 0.05),
error = function(e) { skip_to_next <<- TRUE})
#if the trial does not have the minimum required number, skip to the next
if(skip_to_next) { next }
results_stage1[[invest_id]] <- FederatedApproachStage1(dataset, Surr=CGI, True=PANSS, Treat=Treat,
Trial.ID = InvestId, Min.Treat.Size = 5,
Alpha = 0.05)
assign(paste0("stage1_invest", invest_id), results_stage1[[invest_id]])
invest_ids[[i]] <- invest_id #keep a list of ids with datasets with required number of patients
i <- i+1
}
invest_ids <- unlist(invest_ids)
invest_ids
#Combine the results of the first stage models
for (invest_id in invest_ids) {
dataset <- results_stage1[[invest_id]]$Results.Stage.1
if (invest_id == invest_ids[1]) {
all_results_stage1<- dataset
} else {
all_results_stage1 <- rbind(all_results_stage1,dataset)
}
}
all_results_stage1 #that combines the results of the first stage models
R.list <- list()
i <- 1
for (invest_id in invest_ids) {
R <- results_stage1[[invest_id]]$R.i
R.list[[i]] <- as.matrix(R[1:4,1:4])
i <- i+1
}
R.list #list that combines all the variance-covariance matrices of the fixed effects
fit <- FederatedApproachStage2(Dataset = all_results_stage1, Intercept.S = Intercept.S,
alpha = alpha, Intercept.T = Intercept.T, beta = beta,
sigma.SS = sigma.SS, sigma.ST = sigma.ST,
sigma.TT = sigma.TT, Obs.per.trial = n,
Trial.ID = Trial.ID, R.list = R.list)
summary(fit)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.