Description Usage Arguments Value Examples

View source: R/casecohort_secondary.R

`secondary_casecohort`

performs the secondary analysis which describes
the association between a continuous secondary outcome and the expensive
exposure for case-cohort data.

1 | ```
secondary_casecohort(SRS, CCH, NVsample, Z1.dim, Z2.dim, Z3.dim)
``` |

`SRS` |
A data frame for subjects in the simple random sample. The first column is T: observation time for time-to-event outcome. The second column is Delta: the event indicator. The thid column is Y2: the continuous scale secondary outcome. The fourth column is X: the expensive exposure. Starting from the fifth column to the end are Z1, Z2 and Z3. Z1 is the set of covariates that are included in the linear regression model of the secondary outcome. Z2 is the set of covariates that are included in the Cox model (the proportional hazards model which relates the primary failure time to covariates). Z3 is the set of covariates that are related to the conditional distribution of X given other covariates. |

`CCH` |
A data frame for subjects in the case-cohort sample. The case-cohort sample includes the simple random sample (SRS) and the supplemental cases. The data structure is the same as SRS. |

`NVsample` |
A data frame for subjects in the non-validation sample. Subjects in the non-validation sample don't have the expensive exposure X measured. The data structure is the following: The first column is T. The second column is Delta. The thid column is Y2. Starting from the fourth column to the end are Z1, Z2 and Z3. |

`Z1.dim` |
Dimension of Z1. |

`Z2.dim` |
Dimension of Z2. |

`Z3.dim` |
Dimension of Z3. Note here that the algorithm requires Z3 to be discrete and not high-dimensional, because we use the SRS sample to estimate the conditional distribution of X given other covariates. |

A list which contains parameter estimates, estimated standard error for the primary outcome model:

*lambda(t)=lambda0(t)exp{gamma1*Y2+gamma2*X+gamma3*Z2}*

and the secondary outcome model:

*Y2 = beta0 + beta1*X +
beta2*Z1.*

The list contains the following components:

`gamma_paramEst` |
parameter estimates for gamma in the primary outcome model |

`gamma_stdErr` |
estimated standard error for gamma in the primary outcome model |

`beta_paramEst` |
parameter estimates for beta in the secondary outcome model |

`beta_stdErr` |
estimated standard error for beta in the secondary outcome model |

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ```
library(ODS)
# take the example data from the ODS package
# please see the documentation for details about the data set casecohort_data_secondary
data <- casecohort_data_secondary
# obtain SRS, CCH and NVsample from the original cohort data based on subj_ind
SRS <- data[data[,1]==1, 2:ncol(data)]
CCH <- data[data[,1]==1 | data[,1]==2, 2:ncol(data)]
NVsample <- data[data[,1]==0, 2:ncol(data)]
# delete the fourth column (columns for X) from the non-validation sample
NVsample <- NVsample[,-4]
Z1.dim <- 4
Z2.dim <- 3
Z3.dim <- 3
secondary_casecohort(SRS, CCH, NVsample, Z1.dim, Z2.dim, Z3.dim)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.