Learn R Programming

simglm (version 0.8.0)

data_glm_nested3: Simulates three level nested data with a single third level random effect

Description

Takes simulation parameter arguments and returns simulated data for two different probability distributions. One is logistic (0/1) outcome and the second being poisson (count) outcomes.

Usage

data_glm_nested3(
  Xmat,
  Zmat,
  Zmat3,
  beta,
  rand_eff,
  rand_eff3,
  k,
  n,
  p,
  outcome_type
)

Arguments

Xmat

A matrix of covariates.

Zmat

Design matrix for random effects.

Zmat3

Design matrix for level 3 random effects.

beta

A vector of regression parameters.

rand_eff

A vector of random effects, must be stacked.

rand_eff3

A vector of level 3 random effects, must be stacked.

k

Number of third level clusters.

n

Number of clusters.

p

Number of units within each cluster.

outcome_type

A vector specifying the type of outcome, must be either logistic or poisson. Logitstic outcome will be 0/1 and poisson outcome will be counts.