Git Product home page Git Product logo

panelreg's Introduction

Panel Regressions in R

Overview

This package simulates and estimates a class of panel regression models of the form, $y_{it} = x_{it}' \beta + w_{it}' \gamma + \epsilon_{it} + \nu_{it}$. The parameter of interest is $\beta$, $x_{it}$ is the vector of endogenous regressors, $w_{it}$ is the vector of exogenous covariates, $\epsilon_{it}$ is the endogenous unobservable, and $\nu_{it}$ is the exogenous unobservable (i.e. measurement error).

The purpose of this package is to provide a convenient estimator of $\beta$ given the most common time-series process assumptions on $\epsilon_{it}$, which are:

  1. Fixed Effects (“FE”): $\epsilon_{it} = \bar\epsilon_i, \forall t$.
  2. Serially Independent (“iid”): $\epsilon_{it} = \eta_{it}$.
  3. Moving Average of Order 1 (“MA1”): $\epsilon_{it} = \eta_{it} + \theta \eta_{it-1}$.
  4. First Order Autoregressive (“AR1”): $\epsilon_{it} = \rho \epsilon_{it-1} + \eta_{it}$.

There are only 2 functions in this package:

  1. PanelReg(): This function estimates the panel regression model. Documentation is available here or by running ?PanelReg in R.
  2. PanelRegSim(): This function simulates data from a panel regression model. Documentation is available here or by running ?PanelRegSim in R.

Basic Usage

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.

Installation

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)

panelreg's People

Contributors

setzler avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.