pglm: Panel Estimators for Generalized Linear Models

Description Usage Arguments Value Author(s) Examples

View source: R/pglm.R

Description

Estimation by maximum likelihood of glm (binomial and Poisson) and 'glm-like' models (Negbin and ordered) on longitudinal data

Usage

1
2
3
4
pglm(formula, data, subset, na.action,
     effect = c("individual", "time", "twoways"),
     model = c("random", "pooling", "within", "between"),
     family, other = NULL, index = NULL, start = NULL, R = 20,  ...) 

Arguments

formula

a symbolic description of the model to be estimated,

data

the data: a pdata.frame object or an ordinary data.frame,

subset

an optional vector specifying a subset of observations,

na.action

a function which indicates what should happen when the data contains 'NA's,

effect

the effects introduced in the model, one of "individual", "time" or "twoways",

model

one of "pooling", "within", "between", "random",,

family

the distribution to be used,

other

for developper's use only,

index

the index,

start

a vector of starting values,

R

the number of function evaluation for the gaussian quadrature method used,

...

further arguments.

Value

An object of class "pglm", a list with elements:

coefficients

the named vector of coefficients,

logLik

the value of the log-likelihood,

hessian

the hessian of the log-likelihood at convergence,

gradient

the gradient of the log-likelihood at convergence,

call

the matched call,

est.stat

some information about the estimation (time used, optimisation method),

freq

the frequency of choice,

residuals

the residuals,

fitted.values

the fitted values,

formula

the formula (a mFormula object),

expanded.formula

the formula (a formula object),

model

the model frame used,

index

the index of the choice and of the alternatives.

Author(s)

Yves Croissant

Examples

 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
## an ordered probit example
data('Fairness', package = 'pglm')
Parking <- subset(Fairness, good == 'parking')
op <- pglm(as.numeric(answer) ~ education + rule,
           Parking[1:105, ],
           family = ordinal('probit'), R = 5, print.level = 3,
           method = 'bfgs', index = 'id',  model = "random")

## a binomial (probit) example
data('UnionWage', package = 'pglm')
anb <- pglm(union ~ wage + exper + rural, UnionWage, family = binomial('probit'),
            model = "pooling",  method = "bfgs", print.level = 3, R = 5)

## a gaussian example on unbalanced panel data
data(Hedonic, package = "plm")
ra <- pglm(mv ~ crim + zn + indus + nox + age + rm, Hedonic, family = gaussian,
           model = "random", print.level = 3, method = "nr", index = "townid")

## some count data models
data("PatentsRDUS", package="pglm")
la <- pglm(patents ~ lag(log(rd), 0:5) + scisect + log(capital72) + factor(year), PatentsRDUS,
           family = negbin, model = "within", print.level = 3, method = "nr",
           index = c('cusip', 'year'))
la <- pglm(patents ~ lag(log(rd), 0:5) + scisect + log(capital72) + factor(year), PatentsRDUS,
           family = poisson, model = "pooling", index = c("cusip", "year"),
           print.level = 0, method="nr")

## a tobit example
data("HealthIns", package="pglm")
HealthIns$med2 <- HealthIns$med / 1000
HealthIns2 <- HealthIns[-2209, ]
set.seed(2)
subs <- sample(1:20186, 200, replace = FALSE)
HealthIns2 <- HealthIns2[subs, ]
la <- pglm(med ~ mdu + disease + age, HealthIns2,
           model = 'random', family = 'tobit', print.level = 0,
           method = 'nr', R = 5)

pglm documentation built on July 20, 2021, 1:06 a.m.

Related to pglm in pglm...