Group_specific_Var_Delta_AUC_estimation: Variance of the Difference of AUC of Two Group-Specific...

Description Usage Arguments Value See Also Examples

View source: R/Group_specific_Var_Delta_AUC_estimation.R

Description

\loadmathjax

This function calculates the variance of the difference of area under the curve of two marginal dynamics modeled by group-structured polynomials or B-spline curve in Mixed-Effects models.

Usage

1
2
3
4
5
6
Group_specific_Var_Delta_AUC_estimation(
  MEM_Pol_group,Group1,Group2,
  time.G1,time.G2,common.interval = TRUE,
  method = "trapezoid",Group.dependence = TRUE,
  Averaged = FALSE
)

Arguments

MEM_Pol_group

A list with similar structure than the output provided by the function MEM_Polynomial_Group_structure.

A list containing:

  • Model_estimation: a list containing at least 2 elements:

    1. the vector of the marginal (fixed) parameters estimates (at least for the groups whose AUC is to estimate), labeled 'beta'.

    2. the variance-covariance matrix of these parameters, labeled 'varFix' (see MEM_Polynomial_Group_structure for details about the parameter order).

  • Model_features: a list of at least 2 elements:

    1. Groups: a vector indicating the names of the groups whose fixed parameters are given.

    2. Marginal.dyn.feature: a list summarizing the features of the marginal dynamics defined in the model:

      • dynamic.type: a character scalar indicating the chosen type of marginal dynamics. Options are 'polynomial' or 'spline'.

      • intercept: a logical vector summarizing choices about global and group-specific intercepts (Number of groups + 1) elements whose elements are named as ('global.intercept','group.intercept1', ..., 'group.interceptG') if G Groups are defined in MEM_Pol_group. For each element of the vector, if TRUE, the considered intercept is considered as included in the model (see Examples).

      If dynamic.type is defined as 'polynomial':

      • polynomial.degree: an integer vector indicating the degree of polynomial functions, one value for each group.

      If dynamic.type is defined as 'spline':

      • spline.degree: an integer vector indicating the degree of B-spline curves, one for each group.

      • knots: a list of group-specific internal knots used to build B-spline basis (one numerical vector for each group) (see bs for more details).

      • df: a numerical vector of group-specific degrees of freedom used to build B-spline basis, (one for each group).

      • boundary.knots: a list of group-specific boundary knots used to build B-spline basis (one vector for each group) (see bs for more details).

Group1

a character scalar indicating the name of the first group whose marginal dynamics must be considered. This group name must belong to the set of groups involved in the MEM (see Groups vector in MEM_Pol_group).

Group2

a character scalar indicating the name of the second group whose marginal dynamics must be considered. This group name must belong to the set of groups involved in the MEM (see Groups vector in MEM_Pol_group).

time.G1

a numerical vector of time points (x-axis coordinates) to use for the variance of the Group1 AUC calculation.

time.G2

a numerical vector of time points (x-axis coordinates) to use for the variance of the Group2 AUC calculation.

common.interval

a logical scalar. If FALSE, the variance of difference of AUC is calculated as the variance of the difference of AUCs where the AUC of each group is calculated on its specific interval of time. If TRUE (default), the variance is estimated on a common interval of time defined as the intersect of the two group-specific interval (see Group_specific_Delta_AUC_estimation for more details about calculation.).

method

a character scalar indicating the interpolation method to use to estimate the AUC. Options are 'trapezoid' (default), 'lagrange' and 'spline'. In this version, the 'spline' interpolation is implemented with "not-a-knot" spline boundary conditions.

Group.dependence

a logical scalar indicating whether the two groups, whose the difference of AUC (\mjteqn\Delta AUC\Delta AUC\Delta AUC) is studied, are considered as dependent. By default, this variable is defined as TRUE.

Averaged

a logical scalar. If TRUE, the function return the difference of normalized AUC (nAUC) where nAUC is computed as the AUC divided by the range of time of calculation. If FALSE (default), the classic AUC is calculated.

Value

A numerical scalar corresponding to the variance of the difference of AUC (\mjteqn\Delta AUC\Delta AUC\Delta AUC) between the Group1 and the Group2. If the two groups are considered as dependent (Group.dependence=TRUE), the variance of \mjteqn\Delta AUC\Delta AUC\Delta AUC is calculated as \mjteqnVar(AUC_1) + Var(AUC_2) - 2Cov(AUC_1,AUC_2)Var(AUC_1) + Var(AUC_2) - 2Cov(AUC_1,AUC_2)Var(AUC_1) + Var(AUC_2) - 2Cov(AUC_1,AUC_2). Otherwise, only the sum of the two variance is used.

See Also

bs, Group_specific_Var_AUC_estimation, MEM_Polynomial_Group_structure

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Download of data
data("HIV_Simu_Dataset_Delta01_cens")
data <- HIV_Simu_Dataset_Delta01_cens

# Change factors in character vectors
data$id <- as.character(data$id) ; data$Group <- as.character(data$Group)

# Example 1: We consider the variable \code{MEM_Pol_Group} as the output of our function 
# \link[AUCcomparison]{MEM_Polynomial_Group_structure}
MEM_estimation <- MEM_Polynomial_Group_structure(y=data$VL,x=data$time,Group=data$Group,
                                                 Id=data$id,Cens=data$cens)

time_group1 <- unique(data$time[which(data$Group=="Group1")])
time_group2 <- unique(data$time[which(data$Group=="Group2")])

Var_Delta_AUC_estimation <- Group_specific_Var_Delta_AUC_estimation(
                                              MEM_Pol_group=MEM_estimation,
                                              Group1="Group1",Group2="Group2",
                                              time.G1=time_group1,time.G2=time_group2)
                                                                    
# Example 2: We consider results of MEM estimation from another source. 
# We have to give build the variable 'MEM_Pol_group' with the good structure
# We build the variable 'MEM_Pol_group.1' with the results of MEM estimation obtained for 2 groups 
# Generation of random matrix
Covariance_Matrix_1 <- matrix(rnorm(7*7,mean=0,sd=0.01),ncol=7,nrow=7) 
# Transform the matrix into symmetric one
Covariance_Matrix_1 <- Covariance_Matrix_1 %*% t(Covariance_Matrix_1) 
MEM_Pol_group.1 <- list(Model_estimation=Covariance_Matrix_1,
                       Model_features=list(Groups=c("Group1","Group2"),
                              Marginal.dyn.feature=list(dynamic.type="polynomial",
                                              intercept=c(global.intercept=TRUE,
                                              group.intercept1=FALSE,group.intercept2=FALSE),
                                              polynomial.degree=c(3,3))))
                                           
Var_Delta_AUC_estimation_2 <- Group_specific_Var_Delta_AUC_estimation(
                                              MEM_Pol_group=MEM_Pol_group.1,
                                              Group1="Group1",Group2="Group2",
                                              time.G1=time_group1,time.G2=time_group2)
                                                                    

marie-alexandre/AUCcomparison documentation built on Dec. 21, 2021, 1:52 p.m.