Last data update: 2014.03.03
|
R: Panel Estimators for Generalized Linear Models
Panel Estimators for Generalized Linear Models
Description
Estimation by maximum likelihood of glm (binomial and Poisson) and
'glm-like' models (Negbin and ordered) on longitudinal data
Usage
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
## 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 (logit) example
data('Unions', package = 'pglm')
anb <- pglm(union ~ wage + exper + rural, Unions, 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("PatsRD", package="pglm")
la <- pglm(pat ~ lag(logr, 0:5) + scisect + logk + factor(year), PatsRD,
family = negbin, model = "within", print.level=3, method="nr",
index=c('cusip', 'year'))
la <- pglm(pat ~ lag(logr, 0:5) + scisect + logk + factor(year), PatsRD,
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)
Results
|