ARpMMEC.sim {ARpLMEC}R Documentation

Generating Censored Autoregressive Dataset with 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

ARpMMEC.sim(
  m,
  x = NULL,
  z = NULL,
  tt = NULL,
  nj,
  beta,
  sigmae,
  D,
  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.

tt

Vector 1 x n with the time the measurements were made, where n is the total number of measurements for all individuals.

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.

D

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 intervalar censoring. Default is left

Value

returns list:

cc

Vector of censoring indicators.

y_cc

Vector of responses censoring.

Examples

## 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) 
 tt=rep(seq(1: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=ARpMMEC.sim(m,x,z,tt,nj,beta,sigma2,D,phi,p.cens)
 y<-data$y_cc
 cc<-data$cc

## End(Not run)

[Package ARpLMEC version 1.1 Index]