PLN_RE: A Poisson Lognormal Model with Random Effects

View source: R/PLN_RE.R

PLN_RER Documentation

A Poisson Lognormal Model with Random Effects

Description

Estimate a Poisson model with random effects at the individual and individual-time levels.

E[y_{it}|x_{it},v_i,\epsilon_{it}] = exp(\boldsymbol{\beta}\mathbf{x_{it}}' + \sigma v_i + \gamma \epsilon_{it})

Notations:

  • x_{it}: variables influencing the selection decision y_{it}, which could be a mixture of time-variant variables, time-invariant variables, and time dummies

  • v_i: individual level random effect

  • \epsilon_{it}: individual-time level random effect

v_i and \epsilon_{it} can both account for overdispersion.

Usage

PLN_RE(
  formula,
  data,
  id.name,
  par = NULL,
  sigma = NULL,
  gamma = NULL,
  method = "BFGS",
  adaptiveLL = TRUE,
  stopUpdate = FALSE,
  se_type = c("BHHH", "Hessian")[1],
  H = 12,
  psnH = 12,
  reltol = sqrt(.Machine$double.eps),
  verbose = 0
)

Arguments

formula

Formula of the model

data

Input data, a data.frame object

id.name

The name of the column representing id. Data will be sorted by id to improve estimation speed.

par

Starting values for estimates. Default to estimates of Poisson RE model.

sigma

Starting value for sigma. Defaults to 1 and will be ignored if par is provided.

gamma

Starting value for gamma. Defaults to 1 and will be ignored if par is provided.

method

Optimization method used by optim. Defaults to 'BFGS'.

adaptiveLL

Whether to use Adaptive Gaussian Quadrature. Defaults to TRUE because it is more reliable (though slower) for long panels.

stopUpdate

Whether to disable update of Adaptive Gaussian Quadrature parameters. Defaults to FALSE.

se_type

Report Hessian or BHHH standard errors. Defaults to BHHH.

H

Number of Quadrature points used for numerical integration using the Gaussian-Hermite Quadrature method. Defaults to 20.

psnH

Number of Quadrature points for Poisson RE model

reltol

Relative convergence tolerance. The algorithm stops if it is unable to reduce the value by a factor of reltol * (abs(val) + reltol) at a step. Defaults to sqrt(.Machine$double.eps), typically about 1e-8.

verbose

A integer indicating how much output to display during the estimation process.

  • <0 - No ouput

  • 0 - Basic output (model estimates)

  • 1 - Moderate output, basic ouput + parameter and likelihood in each iteration

  • 2 - Extensive output, moderate output + gradient values on each call

Value

A list containing the results of the estimated model, some of which are inherited from the return of optim

  • estimates: Model estimates with 95% confidence intervals

  • par: Point estimates

  • var_bhhh: BHHH covariance matrix, inverse of the outer product of gradient at the maximum

  • var_hessian: Inverse of negative Hessian matrix (the second order derivative of likelihood at the maximum)

  • se_bhhh: BHHH standard errors

  • g: Gradient function at maximum

  • gtHg: g'H^-1g, where H^-1 is approximated by var_bhhh. A value close to zero (e.g., <1e-3 or 1e-6) indicates good convergence.

  • LL: Likelihood

  • AIC: AIC

  • BIC: BIC

  • n_obs: Number of observations

  • time: Time takes to estimate the model

  • partial: Average partial effect at the population level

  • paritalAvgObs: Partial effect for an individual with average characteristics

  • predict: A list with predicted participation probability (prob), predicted potential outcome (outcome), and predicted actual outcome (actual_outcome).

  • counts: From optim. A two-element integer vector giving the number of calls to fn and gr respectively. This excludes those calls needed to compute the Hessian, if requested, and any calls to fn to compute a finite-difference approximation to the gradient.

  • message: From optim. A character string giving any additional information returned by the optimizer, or NULL.

  • convergence: From optim. An integer code. 0 indicates successful completion. Note that the list inherits all the complements in the output of optim. See the documentation of optim for more details.

References

  1. Peng, J., & Van den Bulte, C. (2023). Participation vs. Effectiveness in Sponsored Tweet Campaigns: A Quality-Quantity Conundrum. Management Science (forthcoming). Available at SSRN: https://www.ssrn.com/abstract=2702053

  2. Peng, J., & Van den Bulte, C. (2015). How to Better Target and Incent Paid Endorsers in Social Advertising Campaigns: A Field Experiment. 2015 International Conference on Information Systems. https://aisel.aisnet.org/icis2015/proceedings/SocialMedia/24/

See Also

Other PanelCount: PoissonRE(), ProbitRE_PLNRE(), ProbitRE_PoissonRE(), ProbitRE()

Examples


# Use the simulated dataset, in which the true coefficient of x is 1.
# Estimated coefficient is biased due to omission of self-selection
data(sim)
res = PLN_RE(y~x, data=sim[!is.na(sim$y), ], id.name='id', verbose=-1)
res$estimates


PanelCount documentation built on Aug. 21, 2023, 9:09 a.m.