ARpLMEC (version 1.0)

ARpLMEC.sim: Generating Censored Autoregressive Dataset with Linear Mixed Effects.

Description

This function simulates a censored response variable with autoregressive errors of order p, with mixed effect and a established censoring rate. This function returns the censoring vector and censored response vector.

Usage

ARpLMEC.sim(m, x = NULL, z = NULL, nj, beta, sigmae, D1, phi,
  p.cens = 0, cens.type = "left")

Arguments

m

Number of individuals

x

Design matrix of the fixed effects of order n x s, corresponding to vector of fixed effects.

z

Design matrix of the random effects of ordern x b, corresponding to vector of random effects.

nj

Vector 1 x m with the number of observations for each subject, where m is the total number of individuals.

beta

Vector of values fixed effects.

sigmae

It's the value for sigma.

D1

Covariance Matrix for the random effects.

phi

Vector of length Arp, of values for autoregressive parameters.

p.cens

Censoring level for the process. Default is 0

cens.type

left for left censoring, right for right censoring and interval for interval censoring. Default is left

Value

returns list:

cc

Vector of censoring indicators.

y_cc

Vector of responses censoring.

References

Schumacher FL, Lachos VH, Dey DK (2017). Censored regression models with autoregressive errors: A likelihood-based perspective. Canadian Journal of Statistics. https://doi.org/10.1002/cjs.11338

Garay AM, Castro LM, Leskow J, Lachos VH (2017). Censored linear regression models for irregularly observed longitudinal data using the multivariate-t distribution. Statistical Methods in Medical Research. https://doi.org/10.1177/0962280214551191

Examples

Run this code
# NOT RUN {
p.cens   = 0.1
m           = 50
D = matrix(c(0.049,0.001,0.001,0.002),2,2)
sigma2 = 0.30
phi    = c(0.48,-0.2)
beta   = c(1,2,1)
nj=rep(6,m) 
x<-matrix(runif(sum(nj)*length(beta),-1,1),sum(nj),length(beta))
z<-matrix(runif(sum(nj)*dim(D)[1],-1,1),sum(nj),dim(D)[1])
data=ARpLMEC.sim(m,x,z,nj,beta,sigma2,D,phi,p.cens)
y<-data$y_cc
cc<-data$cc

# }

Run the code above in your browser using DataCamp Workspace