Type: Package
Title: Poisson Fixed Effects Robust
Version: 2.0.0
Date: 2020-02-17
Description: Computation of robust standard errors of Poisson fixed effects models, following Wooldridge (1999).
License: MIT + file LICENSE
Depends: R (≥ 3.1.0)
Imports: data.table (≥ 1.9.6), glmmML (≥ 1.0)
URL: https://bitbucket.org/ew-btb/poisson-fe-robust
NeedsCompilation: no
RoxygenNote: 6.0.1
Suggests: testthat
LazyData: true
Packaged: 2020-02-17 20:28:47 UTC; evan
Author: Evan Wright [aut, cre]
Maintainer: Evan Wright <enwright@umich.edu>
Repository: CRAN
Date/Publication: 2020-02-17 21:40:06 UTC

Poisson Fixed Effects Robust

Description

Computation of robust standard errors of Poisson fixed effects models, following Wooldridge (1999).

Details

The DESCRIPTION file:

Package: poisFErobust
Type: Package
Title: Poisson Fixed Effects Robust
Version: 2.0.0
Date: 2020-02-17
Authors@R: person("Evan", "Wright", email = "enwright@umich.edu", role = c("aut", "cre"))
Description: Computation of robust standard errors of Poisson fixed effects models, following Wooldridge (1999).
License: MIT + file LICENSE
Depends: R (>= 3.1.0)
Imports: data.table (>= 1.9.6), glmmML (>= 1.0)
URL: https://bitbucket.org/ew-btb/poisson-fe-robust
NeedsCompilation: no
RoxygenNote: 6.0.1
Suggests: testthat
LazyData: true
Author: Evan Wright [aut, cre]
Maintainer: Evan Wright <enwright@umich.edu>

Index of help topics:

ex.dt.bad               Poisson data violating conditional mean
                        assumption
ex.dt.good              Poisson data satisfying conditional mean
                        assumption
pois.fe.robust          Robust standard errors of Poisson fixed effects
                        regression
poisFErobust-package    Poisson Fixed Effects Robust

Author(s)

NA

Maintainer: NA

References

Wooldridge, Jeffrey M. (1999): "Distribution-free estimation of some nonlinear panel data models," Journal of Econometrics, 90, 77-97.

Examples

# ex.dt.good satisfies the conditional mean assumption
data("ex.dt.good")
pois.fe.robust(outcome = "y", xvars = c("x1", "x2"), group.name = "id",
               index.name = "day", data = ex.dt.good)
               
# ex.dt.bad violates the conditional mean assumption
data("ex.dt.bad")
pois.fe.robust(outcome = "y", xvars = c("x1", "x2"), group.name = "id",
               index.name = "day", data = ex.dt.bad)

Poisson data violating conditional mean assumption

Description

A data.table containing id by day observations of Poisson random variables which violate the conditional mean assumption of Wooldridge (1999).

Usage

data("ex.dt.bad")

Format

A data.table with 450 observations on the following 7 variables.

id

a factor with levels 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

day

a numeric vector

fe

a numeric vector

x1

a numeric vector

x2

a numeric vector

y

a numeric vector

x1.lead

a numeric vector

Details

The data were simulated like y <- rpois(1, exp(fe + x1 + x2 + 2.5*x1.lead)) where fe, x1, and x2 are standard normal random variables. fe varies only across id. x1.lead is a one period lead of x1 which causes the violation of the conditional mean assumption.

References

Wooldridge, Jeffrey M. (1999): "Distribution-free estimation of some nonlinear panel data models," Journal of Econometrics, 90, 77-97.

Examples

data("ex.dt.bad")
str(ex.dt.bad)

Poisson data satisfying conditional mean assumption

Description

A data.table containing id by day observations of Poisson random variables which satisfy the conditional mean assumption of Wooldridge (1999).

Usage

data("ex.dt.good")

Format

A data frame with 500 observations on the following 6 variables.

id

a factor with levels 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

day

a numeric vector

fe

a numeric vector

x1

a numeric vector

x2

a numeric vector

y

a numeric vector

Details

The data were simulated like y <- rpois(1, exp(fe + x1 + x2)) where fe, x1, and x2 are standard normal random variables. fe varies only across id.

References

Wooldridge, Jeffrey M. (1999): "Distribution-free estimation of some nonlinear panel data models," Journal of Econometrics, 90, 77-97.

Examples

data("ex.dt.good")
str(ex.dt.good)

Robust standard errors of Poisson fixed effects regression

Description

Compute standard errors following Wooldridge (1999) for Poisson regression with fixed effects, and a hypothesis test of the conditional mean assumption (3.1).

Usage

pois.fe.robust(outcome, xvars, group.name, data, 
               qcmle.coefs = NULL, allow.set.key = FALSE,
               index.name = NULL)

Arguments

outcome

character string of the name of the dependent variable.

xvars

vector of character strings of the names of the independent variables.

group.name

character string of the name of the grouping variable.

data

data.table which contains the variables named in other arguments. See details for variable type requirements.

qcmle.coefs

an optional numeric vector of coefficients in the same order as xvars. If NULL, coefficients are estimated using glmmML::glmmboot.

allow.set.key

logical. When TRUE (recommended), data will have its key set to group.name, so it may be reordered. This should reduce memory usage.

index.name

DEPRECATED (leave as NULL).

Details

data must be a data.table containing the following:

No observation in data may contain a missing value.

Setting allow.set.key to TRUE is recommended to reduce memory usage; however, it will allow data to be modified (sorted in-place).

pois.fe.robust also returns the p-value of the hypothesis test of the conditional mean assumption (3.1) as described in Wooldridge (1999) section 3.3.

Value

A list containing

Author(s)

Evan Wright

References

Wooldridge, Jeffrey M. (1999): "Distribution-free estimation of some nonlinear panel data models," Journal of Econometrics, 90, 77-97.

See Also

glmmboot

Examples

# ex.dt.good satisfies the conditional mean assumption
data("ex.dt.good")
pois.fe.robust(outcome = "y", xvars = c("x1", "x2"), group.name = "id",
               index.name = "day", data = ex.dt.good)
               
# ex.dt.bad violates the conditional mean assumption
data("ex.dt.bad")
pois.fe.robust(outcome = "y", xvars = c("x1", "x2"), group.name = "id",
               index.name = "day", data = ex.dt.bad)