zibr: Fit zero-inflated beta regression with random effects

View source: R/zibr.R

zibrR Documentation

Fit zero-inflated beta regression with random effects

Description

Fit zero-inflated beta regression with random effects

Usage

zibr(
  logistic_cov,
  beta_cov,
  Y,
  subject_ind,
  time_ind,
  component_wise_test = TRUE,
  quad_n = 30,
  verbose = FALSE
)

Arguments

logistic_cov

the covariates in logistic component

beta_cov

the covariates in beta component

Y

the response variable in the regression model

subject_ind

the variable for subject IDs

time_ind

the variable for time points

component_wise_test

whether to perform component wise test. If true, ZIBR will calculate p-values for logistic and beta component respectively.

quad_n

Gaussian quadrature points

verbose

print the fitting process

Value

a named list

  • logistic_est_table - the estimated coefficients for logistic component.

  • logistic_s1_est - the estimated standard deviation for the random effect in the logistic component.

  • beta_est_table - the estimated coefficients for logistic component.

  • beta_s2_est - the estimated standard deviation for the random effect in the beta component.

  • beta_v_est - the estimated dispersion parameter in the beta component.

  • loglikelihood - the log likelihood of fitting ZIBR model on the data.

  • joint_p - the p-values for jointly testing each covariate in both logistic and beta component.

Examples

## simulate some data
sim <- simulate_zero_inflated_beta_random_effect_data(
  subject_n = 100, time_n = 5,
  X = as.matrix(c(rep(0, 50 * 5), rep(1, 50 * 5))),
  Z = as.matrix(c(rep(0, 50 * 5), rep(1, 50 * 5))),
  alpha = as.matrix(c(-0.5, 1)),
  beta = as.matrix(c(-0.5, 0.5)),
  s1 = 1, s2 = 0.8,
  v = 5,
  sim_seed = 100
)

## run zibr on the simulated data
zibr_fit <- zibr(
  logistic_cov = sim$X, beta_cov = sim$Z, Y = sim$Y,
  subject_ind = sim$subject_ind, time_ind = sim$time_ind
)

zibr_fit

chvlyl/ZIBR documentation built on Oct. 22, 2023, 1:06 p.m.