This package simulates and estimates a class of panel regression models
of the form,
The purpose of this package is to provide a convenient estimator of
- Fixed Effects (“FE”):
$\epsilon_{it} = \bar\epsilon_i, \forall t$ . - Serially Independent (“iid”):
$\epsilon_{it} = \eta_{it}$ . - Moving Average of Order 1 (“MA1”):
$\epsilon_{it} = \eta_{it} + \theta \eta_{it-1}$ . - First Order Autoregressive (“AR1”):
$\epsilon_{it} = \rho \epsilon_{it-1} + \eta_{it}$ .
There are only 2 functions in this package:
PanelReg()
: This function estimates the panel regression model. Documentation is available here or by running?PanelReg
in R.PanelRegSim()
: This function simulates data from a panel regression model. Documentation is available here or by running?PanelRegSim
in R.
Before estimation, set up a variable list with the names of your variables:
varnames = list(
id_name = "ID",
time_name = "Year",
outcome_name = "Y",
endogenous_names = c("X1", "X2"),
covariate_names = c("W1"),
fixedeffect_names = c("Group")
)
To estimate the panel regression, the syntax is as follows:
reg = PanelReg(panel_data, panel_model = "MA1", varnames)
The argument panel_model
must be one of "exogenous"
, "FE"
,
"iid"
, "MA1"
, or "AR1"
.
For complete examples and details on the estimators and simulators, see the Get Started page.
To install the package from Github:
devtools::install_github("setzler/PanelReg")
To use the package after it is installed:
library(PanelReg)
Make sure these packages have been installed as well:
library(data.table)
library(fixest)