Description Usage Arguments Value See Also Examples

Reconstruct data into a regular longitudinal format as a refined dataset and do joint modelling for this refined data with continuous outcome.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 |

`long_data` |
Data matrix for longitudinal in long form. The time variable should be labeled 'time'. |

`surv_data` |
Data matrix for competing risks data. Each subject has one row of observation (as opposed to the long_data). First and second column should be the observed event time and censoring indicator, respectively. The coding for the censoring indicator is as follows: 0 - censored events, 1 - risk 1, 2 - risk 2. Two competing risks are assumed. |

`out` |
Column name for outcome variable in long_data. |

`FE` |
Vector of column names that correspond to the fixed effects in long_data. If missing, then all columns except for the outcome and ID columns will be considered. |

`RE` |
Types/Vector of random effects in long_data. The available type are "intercept", "linear", "quadratic" (time-related random effect specification) or other covariates in the input dataset. If specify other covariates, then they to be numerical vectors. |

`ID` |
Column name for subject ID number in long_data. |

`cate` |
Vector of categorical variables in long_data. Default is NULL. |

`intcpt` |
Specify either 0 or 1. Default is set as 1. 0 means no intercept in random effect. |

`quad.points` |
Number of quadrature points used in the EM procedure. Default is 20. Must be an even number. Larger values means higher accuracy but more time-consuming. |

`max.iter` |
Max iterations. Default is 10000. |

`quiet` |
Logical. Print progress of function. Default is TRUE. |

`do.trace` |
Logical. Print the parameter estimates during the iterations. Default is FALSE. |

Object of class `JMcmprsk`

with elements

`vcmatrix` | The variance-covariance matrix for all the parameters. The parameters are in the order: β, σ^2, γ, ν, and Σ. The elements in Σ are output in the order along the main diagonal line, then the second main diagonal line, and so on. |

`betas` | The point estimates of β. |

`se_betas` | The standard error estimate of β. |

`gamma_matrix` | The point estimate of γ. |

`se_gamma_matrix` | The standard error estimate of γ. |

`v_estimate` | The point estimate of ν. |

`se_v_estimate` | The standard error estimate of ν. |

`sigma2_val` | The point estimate of σ^2. |

`se_sigma2_val` | The standard error estimate of σ^2. |

`sigma_matrix` | The point estimate of Σ (only the upper triangle portion of the matrix is output). |

`se_sigma` | The standard error estimate of Σ.The standard errors are given in this order: main diagonal, the second main diagonal, and so on. |

`loglike` | Log Likelihood. |

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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | ```
require(JMcmprsk)
set.seed(123)
data(lung)
yread <- lung[, c(1,2:11)]
cread <- unique(lung[, c(1, 12, 13, 6:10)])
#Please note only those variables that will appear in the model can be included
res <- jmc(long_data = yread, surv_data = cread, out = "FVC",
FE = c("time", "FVC0", "FIB0", "CYC", "FVC0.CYC",
"FIB0.CYC", "time.CYC"),
RE = "linear", ID = "ID",cate = NULL, intcpt = 0,
quad.points = 8, quiet = FALSE)
#make up two categorical variables and add them into yread
sex <- sample(c("Female", "Male"), nrow(cread), replace = TRUE)
race <- sample(c("White", "Black", "Asian", "Hispanic"),
nrow(cread), replace = TRUE)
ID <- cread$ID
cate_var <- data.frame(ID, sex, race)
if (require(dplyr)) {
yread <- dplyr::left_join(yread, cate_var, by = "ID")
}
# run jmc function again for yread file with two added categorical variables
res2 <- jmc(long_data = yread, surv_data = cread,
out = "FVC", cate = c("sex", "race"),
FE = c("time", "FVC0", "FIB0", "CYC", "FVC0.CYC",
"FIB0.CYC", "time.CYC"),
RE = "time", ID = "ID", intcpt = 0,
quad.points = 8, quiet = FALSE)
res2
# Extract the parameter estimates of longitudinal sub-model fixed effects
beta <- coef(res2, coeff = "beta")
beta
## Linear hypothesis of testing all coefficients of beta's equal 0
linearTest(res2, coeff="beta")
## Linear hypothesis of testing beta1=beta2
## create a linear contrast for beta1=beta2 (intercept not included in Lb)
Lb <- matrix(c(1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0), ncol = length(beta)-1, nrow = 1)
linearTest(res2, coeff="beta", Lb = Lb)
# Extract the parameter estimates of survival sub-model fixed effects
gamma <- coef(res2, coeff = "gamma")
gamma
## Linear hypothesis of testing all coefficients of gamma's equal 0
linearTest(res2, coeff="gamma")
## Linear hypothesis of testing gamma11=gamma21
## (the coefficients of first covariate from
## both risk functions are equal)
Lg <- matrix(c(1, 0, 0, 0, 0, -1, 0, 0, 0, 0), ncol = length(gamma), nrow = 1)
linearTest(res2, coeff="gamma", Lg = Lg)
## Extract the standard errors for the longitudinal portion
summary(res2, coeff = "longitudinal", digits = 4)
## Extract the standard errors for the survival portion
summary(res2, coeff = "survival", digits = 4)
``` |

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.