SMNlmec.est {SMNlmec}R Documentation

Bayesian Censored Mixed-Effects Models with Damped Exponential Correlation Structures for Scale Mixture of Normal distributions error

Description

This function fits left, right censored mixed-effects linear model, with scale mixture of normal distribution errors, using the Stan. It returns estimates, standard errors and LPML, AIC, BIC and DIC.

Usage

SMNlmec.est(
  ID,
  x_set,
  z_set,
  tt,
  y_complete,
  censor_vector,
  dist = "Normal",
  struc = "UNC",
  direction = "left",
  thin_num = 1,
  chains_num = 1,
  iter_num = 3000,
  burn_percen = 0.1,
  seed_set = NULL,
  adapt_delta_set = 0.8
)

Arguments

ID

Vector N x 1 of the ID of the data set, specifying the ID for each measurement.

x_set

Design matrix of the fixed effects of order N x p.

z_set

Design matrix of the random effects of order N x d.

tt

Vector N x 1 with the time the measurements were made, where N is the total number of measurements for all individuals. Default it's considered regular times.

y_complete

Vector N x 1 of the complete responses.

censor_vector

Vector N x 1 of the indicator vector of censored responses.

dist

Distribution of the random effects and random error. Available options are Normal, Student and Slash.

struc

Structure of the correlation structure. Available options are UNC, DEC, CAR.

direction

Direction of censoring type. Available options are left and right.

thin_num

A positive integer specifying the period for saving samples. The default is 5. See more details in rstan::stan().

chains_num

A positive integer specifying the number of chains generating by rstan::stan(). The default is 3.

iter_num

A positive integer specifying the number of iterations for each chain (including warmup). The default is 5000.

burn_percen

A percentage of the warm-up iterations in each chain the Stan. The default is 0.1.

seed_set

A random seed. The default is NULL.

adapt_delta_set

A parameter to control the sampler's behavior. The default is 0.8. See rstan::stan() for more details.

Value

Return a S4 class SMNlmecfit object. Using function SMNlmec.summary() to obtain the estimation of parameters and model selection criteria. The SMNlmecfit include:

stan_object

A stanfit object from rstan::stan().

model_criteria

A list includes LPML, DIC, EAIC, EBIC, K-L divergence.

dist_set

The setting of distribution of the stan model.

struc_set

The setting of correlation structure of the stan model.

References

Kelin Zhong, Fernanda L. Schumacher, Luis M. Castro and Victor H. Lachos. Bayesian analysis of censored linear mixed-effects models for heavy-tailed irregularly observed repeated measures. Statistics in Medicine, 2025. doi:10.1002/sim.10295

Examples


require(rstan)
require(StanHeaders)
require(MASS)
require(tmvtnorm)
require(mvtnorm)
require(mnormt)

data("UTIdata_sub")
data1 <- UTIdata_sub
y1 <- c(log10(data1$RNA))
cc <- (data1$RNAcens==1)+0
y_com<-as.numeric(y1)
rho_com<-as.numeric(cc)
x <- cbind(
 (data1$Fup==0)+0,
 (data1$Fup==1)+0,
 (data1$Fup==3)+0,
 (data1$Fup==6)+0,
 (data1$Fup==9)+0,
 (data1$Fup==12)+0,
 (data1$Fup==18)+0,
 (data1$Fup==24)+0
 )
z <- matrix(rep(1, length(y1)), ncol=1)

UTI_T_DEC <- SMNlmec.est(ID = data1$Patid, x_set = x, z_set = z,
                         tt = data1$Fup, y_complete = y_com,
                         censor_vector = rho_com, dist = "Student",
                         struc = "DEC", direction = "left",
                         thin_num = 1, chains_num = 1, iter_num = 3000,
                         burn_percen = 0.1, seed_set = 9955,
                         adapt_delta_set = 0.8)

SMNlmec.summary(UTI_T_DEC)



[Package SMNlmec version 1.0.0 Index]