# ARpMMEC.sim: Generating Censored Autoregressive Dataset with Mixed... In ARpLMEC: Censored Mixed-Effects Models with Different Correlation Structures

 ARpMMEC.sim R Documentation

## Generating Censored Autoregressive Dataset with Mixed Effects, for normal distribution.

### 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,
struc = "ARp",
order = 1,
typeModel = "Normal",
p.cens = NULL,
n.cens = NULL,
cens.type = "left",
nu = NULL
)
```

### 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 order`n 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. `struc` Correlation structure. This must be one of `UNC`,`ARp`,`DEC`,`SYM` or `DEC(AR)`. `order` Order of the autoregressive process. Must be a positive integer value. `typeModel` `Normal` for Normal distribution and `Student` for t-Student distribution. Default is `Normal` `p.cens` Censoring percentage for the process. Default is `NULL` `n.cens` Censoring level for the process. Default is `NULL` `cens.type` `left` for left censoring, `right` for right censoring and `interval` for intervalar censoring. Default is `left` `nu` degrees of freedom for t-Student distibution (nu > 0, maybe non-integer).

### Value

returns list:

 `cc` Vector of censoring indicators. `y_cc` Vector of responses censoring.

### Examples

```## Not run:
p.cens   = 0.1
m           = 10
D = matrix(c(0.049,0.001,0.001,0.002),2,2)
sigma2 = 0.30
phi    = 0.6
beta   = c(1,2,1)
nj=rep(4,10)
tt=rep(1:4,length(nj))
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,struc="ARp",typeModel="Normal",p.cens=p.cens)
y<-data\$y_cc
cc<-data\$cc

## End(Not run)
```

ARpLMEC documentation built on June 27, 2022, 1:06 a.m.