View source: R/sim_panel_logit.R
sim_panel_logit | R Documentation |
Simulate data from the dynamic logit model given a set of covariates and a vector of parameters.
sim_panel_logit(id, al, X = NULL, eta, dyn = FALSE)
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) |
yv |
simulated vector of binary response variables |
pv |
vector of probabilities of "success" |
Francesco Bartolucci (University of Perugia), Claudia Pigini (University of Ancona "Politecnica delle Marche")
# 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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.