sim_panel_logit {cquad} | R Documentation |
Simulate data from the dynamic logit model
Description
Simulate data from the dynamic logit model given a set of covariates and a vector of parameters.
Usage
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
# 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
[Package cquad version 2.3 Index]