rsmsn.clmm: Generate data from SMSN-CLMM with censored responses

View source: R/smnCens_prin.R

rsmsn.clmmR Documentation

Generate data from SMSN-CLMM with censored responses

Description

It creates a simulated data set from SMSN-CLMM with several possible dependence structures, with an established censoring rate or a fixed limit of detectation (LOD).

Usage

  rsmsn.clmm(time, ind, x, z, sigma2, D, beta, lambda=rep(0, nrow(D)),
             depStruct="UNC", phi=NULL, distr="norm", nu=NULL, type="left",
             pcens=0.10, LOD=NULL)

Arguments

time

Vector of length N containing times that should be used in data generation, where N indicates the total number of observations.

ind

Vector of length N containing the variable which represents the subjects or groups.

x

Design matrix for fixed effects of dimension N\times p.

z

Design matrix for random effects of dimension N \times q.

sigma2

Common variance parameter, such that \Sigma=\sigma^2*R.

D

Variance matrix for random effects.

beta

Vector of fixed effects parameter.

lambda

Skewness parameter of random effects.

depStruct

Dependence structure. "UNC" for conditionally uncorrelated ("CI" is also accepted), "ARp" for AR(p) – p is length(phi)–, "CS" for compound symmetry, "DEC" for DEC, "CAR1" for continuous-time AR(1), and "MA1" for moving average of order 1.

phi

Parameter vector indexing the dependence structure.

distr

Distribution that should be used. "norm" for normal, "t" for Student-t, "sn" for skew-normal, and "st" for skew-t.

nu

Degrees of freedom for Student-t and skew-t distributions. It must be greater than 2.

type

left for left censoring and right for right censoring.

pcens

Desired censoring rate.

LOD

Desired limit of detectation. If LOD is provided, then pcens will be discarded.

Value

A data frame containing time, the variable indicating groups (ind), the generated response variable (y), the censoring indicator variable (ci), the lower censoring limit (lcl), the upper censoring limit (ucl), and possible covariates.

Author(s)

Fernanda L. Schumacher, Larissa A. Matos, Victor H. Lachos and Katherine L. Valeriano

References

Matos, L. A., Prates, M. O., Chen, M. H., and Lachos, V. H. (2013). Likelihood-based inference for mixed-effects models with censored response using the multivariate-t distribution. Statistica Sinica 23(3), 1323-1345.

Lachos, V. H., A. Matos, L., Castro, L. M., and Chen, M. H. (2019). Flexible longitudinal linear mixed models for multiple censored responses data. Statistics in medicine, 38(6), 1074-1102.

See Also

smn.clmm

Examples

library(ggplot2)

# Generating a sample for m=25 individuals with 5 times
nj1 = 5
m = 25
time = rep(1:nj1, times=m)
groups = as.factor(rep(1:m, each=nj1))

# Considering 10% of right censoring responses and normal distribution
dat1 = rsmsn.clmm(time, groups, cbind(1,time), rep(1,m*nj1), sigma2=.25,
                  D=0.5*diag(1), beta=c(1,2), depStruct="ARp", phi=0.5,
                  type="right")
head(dat1)
ggplot(dat1, aes(x=x, y=y, group=ind)) + geom_line() +
  stat_summary(aes(group=1), geom="line", fun=mean, col="blue", size=1.5) +
  geom_line(aes(x=x,y=lcl), color="red", linetype="dashed")

# Considering LOD=4, left censoring, and Student-t distribution
dat2 = rsmsn.clmm(time, groups, cbind(1,time), rep(1,m*nj1), sigma2=.25,
                  D=0.5*diag(1), beta=c(1,2), depStruct="CS", phi=0.2,
                  distr="t", nu=4, LOD=4)
mean(dat2$ci) #censoring rate
ggplot(dat2, aes(x=x, y=y, group=ind)) + geom_line() +
  stat_summary(aes(group=1), geom="line", fun=mean, col="blue", size=1.5) +
  geom_line(aes(x=x,y=ucl), color="red", linetype="dashed")

skewlmm documentation built on July 9, 2023, 7:29 p.m.