gdat_cd.Rd
Generate panel data with cross-sectional dependence for classes of models viz. Generate data for model with a single weight delta
gdat_cd(pars, N, Tp, ncXm = 0, seed, fun, sder = NULL, eta = NULL, modclass = "lmcd")
pars | vector of parameters to generate the data. |
---|---|
N | number of units in the panel |
Tp | number of time periods |
ncXm | number of other control variables to include |
seed | seed for random number generation |
fun | function that models cross-sectional dependence function \(\phi(.,.)\) |
sder | standard deviation for the error term. this option is applicable to the class "lmcd" |
eta | additional parameter, like \(\theta\) in the negative binomial class "nbcd" and seed for simulating the outcome for MLE methods. see c_out_dep |
modclass | the class of model; see ncd_gen for models supported |
A data frame of Y,X,psID,tpID, where psID and tpID are unit and time IDs, Xm of ncXm columns if ncXm is specified
pars = c(1.0,0.5,0.8); pars2=pars = c(1.0,0.5,0.8,0.1,-0.1); N = 10; Tp = 16 fnp<- function(x,y) {-(0.5*y^4 + (x-y)^4)^.25} #poisson model datpois = gdat_cd(pars=pars,N=N,Tp=Tp,seed=2,fun=fnp,eta = 200,modclass="poiscd") datpois2 = gdat_cd(pars=pars2,N=N,Tp=Tp,ncXm=2,seed=2,fun=fnp,eta = 200,modclass="poiscd") summary(datpois); summary(datpois2);#NA's in first period for Y due to lag#> Y X psID tpID #> Min. :3.000 Min. :-1.4517 Min. : 1.0 Min. : 1.00 #> 1st Qu.:4.000 1st Qu.: 0.1932 1st Qu.: 3.0 1st Qu.: 4.75 #> Median :4.000 Median : 1.0600 Median : 5.5 Median : 8.50 #> Mean :4.593 Mean : 1.0540 Mean : 5.5 Mean : 8.50 #> 3rd Qu.:5.000 3rd Qu.: 1.8730 3rd Qu.: 8.0 3rd Qu.:12.25 #> Max. :8.000 Max. : 3.1101 Max. :10.0 Max. :16.00 #> NA's :10#> Y X X1 X2 #> Min. : 3.00 Min. :-1.4517 Min. :-2.720168 Min. :-2.7218 #> 1st Qu.: 4.00 1st Qu.: 0.1932 1st Qu.:-0.621542 1st Qu.:-0.4540 #> Median : 4.00 Median : 1.0600 Median : 0.005458 Median : 0.1334 #> Mean : 4.68 Mean : 1.0540 Mean : 0.036044 Mean : 0.1380 #> 3rd Qu.: 5.00 3rd Qu.: 1.8730 3rd Qu.: 0.662281 3rd Qu.: 0.8786 #> Max. :10.00 Max. : 3.1101 Max. : 2.888418 Max. : 2.5331 #> NA's :10 #> psID tpID #> Min. : 1.0 Min. : 1.00 #> 1st Qu.: 3.0 1st Qu.: 4.75 #> Median : 5.5 Median : 8.50 #> Mean : 5.5 Mean : 8.50 #> 3rd Qu.: 8.0 3rd Qu.:12.25 #> Max. :10.0 Max. :16.00 #>