sim_panel_logit: Simulate data from the dynamic logit model

Description Usage Arguments Value Author(s) Examples

View source: R/sim_panel_logit.R

Description

Simulate data from the dynamic logit model given a set of covariates and a vector of parameters.

Usage

1
sim_panel_logit(id, al, X = NULL, eta, dyn = FALSE)

Arguments

id

list of the reference unit of each observation

al

list of individual specific effects

X

corresponding matrix of covariates (optional)

eta

vector of parameters

dyn

TRUE if in the dynamic version; FALSE for the static version (by default)

Value

yv

simulated vector of binary response variables

pv

vector of probabilities of "success"

Author(s)

Francesco Bartolucci (University of Perugia), Claudia Pigini (University of Ancona "Politecnica delle Marche")

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# simulate data from the static logit model
n = 1000; TT = 5                 # sample size, number of time occasions
id = (1:n)%x%rep(1,TT)           # vector of indices
al = rnorm(n)                    # simulate alpha
X = matrix(rnorm(2*n*TT),n*TT,2) # simulate two covariates
eta1 = c(1,-1)                 # vector of parameters
out = sim_panel_logit(id,al,X,eta1)
y1 = out$yv

# simulate data from the dynamic logit model
eta2 = c(1,-1,2)            # vector of parameters including state dependence
out = sim_panel_logit(id,al,X,eta2,dyn=TRUE)
y2 = out$yv

cquad documentation built on Oct. 23, 2020, 7:55 p.m.