tw_sim | R Documentation |
Use this function to run your own Monte Carlo experiments on panel data.
tw_sim(
iter = 1000,
cores = 1,
parallel = FALSE,
arg = "cross.eff.mean",
range1 = c(-1, 1),
range2 = NULL,
models = c("randomfx", "wfe"),
...
)
iter |
The number of Monte Carlo simulations to run. This effects the precision of the estimates. |
cores |
The number of cores to run the simulations in parallel. |
parallel |
whether to use parallel processing if |
arg |
A character value of which model parameter from |
models |
A list of additional models besides fixed effects models to fit to the data. |
... |
All additional parameters to pass on to |
at |
A numeric sequence giving the range of values of the |
The tw_sim
function acts as a frontend to the link{tw_data}
function that
generates panel data given a set of parameters. The arguments are fairly self-explanatory, and
any underlying panel data parameters are passed on to link{tw_data}
, so review that help
site for more information. The simulation works by passing a character value of one of the
parameters from the link{tw_data}
function to the arg
option, such as cross.eff.mean
for varying cross-sectional effects. The at
option must take a numeric vector giving the range of
values to iterate over, such as seq(-1,1,by=.1)
to test values of cross.eff.mean
from
-1 to 1 in increments of .1.
This function returns a data.frame
with the two-way fixed effects coefficient,
both case (over-time) and cross-sectional 1-way fixed effects estimates, pooled OLS model
estimates, and a random-effects estimate. Each row of the data.frame
represents
one sample of panel data drawn from link{tw_data}
. This data can then be plotted with the
tw_plot
function to see results of the simulation.
## Not run:
ex_sim <- tw_sim(iter=150,arg='case.eff.mean',at=seq(-5,5,by=.1))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.