Description Usage Arguments Value Author(s) Examples
Estimation by maximum likelihood of glm (binomial and Poisson) and 'glm-like' models (Negbin and ordered) on longitudinal data
1 2 3 4 |
formula |
a symbolic description of the model to be estimated, |
data |
the data: a |
subset |
an optional vector specifying a subset of observations, |
na.action |
a function which indicates what should happen when
the data contains ' |
effect |
the effects introduced in the model, one of
|
model |
one of |
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. |
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 |
expanded.formula |
the formula (a |
model |
the model frame used, |
index |
the index of the choice and of the alternatives. |
Yves Croissant
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 (logit) 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)
|
Loading required package: maxLik
Loading required package: miscTools
Please cite the 'maxLik' package as:
Henningsen, Arne and Toomet, Ott (2011). maxLik: A package for maximum likelihood estimation in R. Computational Statistics 26(3), 443-458. DOI 10.1007/s00180-010-0217-1.
If you have questions, suggestions, or comments regarding the 'maxLik' package, please use a forum or 'tracker' at maxLik's R-Forge site:
https://r-forge.r-project.org/projects/maxlik/
Loading required package: plm
Loading required package: Formula
Initial function value: -92.30774
Initial gradient value:
(Intercept) educationno ruleadmin rulelottery
-1.6698694 -1.1968543 -1.1575383 -1.1621267
ruleaddsupply rulequeuing rulemoral rulecompensation
-0.5112532 0.5484853 1.1969414 0.7505818
mu_1 mu_2 sigma
0.3279938 2.5086961 -4.7761127
initial value 92.307736
iter 2 value 91.435879
iter 3 value 91.231157
iter 4 value 91.092405
iter 5 value 90.945023
iter 6 value 90.935860
iter 7 value 90.796381
iter 8 value 90.719380
iter 9 value 90.669391
iter 10 value 90.648223
iter 11 value 90.646011
iter 12 value 90.645785
iter 13 value 90.643443
iter 14 value 90.641762
iter 15 value 90.641645
iter 16 value 90.641377
iter 17 value 90.641365
iter 17 value 90.641365
iter 17 value 90.641365
final value 90.641365
converged
Initial function value: -2422.802
Initial gradient value:
(Intercept) wage exper ruralyes
5.684342e-14 2.451840e+02 1.026742e+02 -6.714318e+00
initial value 2422.801633
iter 2 value 2422.139675
iter 3 value 2403.731724
iter 4 value 2379.712980
iter 5 value 2378.086129
iter 6 value 2373.508560
iter 7 value 2373.493851
iter 7 value 2373.493840
iter 7 value 2373.493840
final value 2373.493840
converged
Initial function value: 93.59609
Initial gradient value:
(Intercept) crim zn indus nox age
19.49834 5957.92854 -266.90563 553.22733 -1649.77585 -2965.39124
rm gmu geps
-2786.95328 -59.81343 550.80502
----- Initial parameters: -----
fcn value: 93.59609
parameter initial gradient free
(Intercept) 9.3647962399 19.49834 1
crim -0.0150066380 5957.92854 1
zn -0.0001258546 -266.90563 1
indus -0.0049446812 553.22733 1
nox -0.0027039032 -1649.77585 1
age -0.0017230058 -2965.39124 1
rm 0.0223352319 -2786.95328 1
sd.mu 0.1946247016 -59.81343 1
sd.eps 0.1562653104 550.80502 1
Condition number of the (active) hessian: 148161.3
-----Iteration 1 -----
lambda 0 step 1 fcn value: 127.25176348
amount new param new gradient active
(Intercept) -0.3888493915 9.7536456314 -0.3778355 1
crim -0.0099503219 -0.0050563160 -1625.8389288 1
zn 0.0003698159 -0.0004956705 30.6820361 1
indus -0.0090463726 0.0041016914 -18.8116375 1
nox 0.0069581506 -0.0096620539 588.4635143 1
age 0.0014654679 -0.0031884737 1082.6446172 1
rm 0.0049172467 0.0174179852 871.2858791 1
sd.mu 0.0004001895 0.1942245121 60.1635352 1
sd.eps 0.0177318119 0.1385334986 715.4806049 1
Condition number of the hessian: 90390.25
-----Iteration 2 -----
lambda 0 step 1 fcn value: 134.37130726
amount new param new gradient active
(Intercept) 6.436266e-02 9.6892829671 -0.02710596 1
crim 1.531464e-03 -0.0065877804 -226.85082945 1
zn -8.593012e-05 -0.0004097404 3.24039688 1
indus 7.744532e-04 0.0033272382 -1.40311729 1
nox -1.054653e-03 -0.0086074009 76.18360578 1
age -2.259256e-04 -0.0029625481 136.82220408 1
rm -7.654740e-04 0.0181834592 116.32238577 1
sd.mu -5.401005e-03 0.1996255171 7.84913032 1
sd.eps -1.146639e-02 0.1499998921 150.73552227 1
Condition number of the hessian: 90941.78
-----Iteration 3 -----
lambda 0 step 1 fcn value: 134.72893428
amount new param new gradient active
(Intercept) 1.314867e-02 9.6761342947 -0.001145608 1
crim 2.925887e-04 -0.0068803691 -10.751674181 1
zn -1.608162e-05 -0.0003936588 0.134902321 1
indus 1.627028e-04 0.0031645354 -0.047436257 1
nox -2.124239e-04 -0.0083949770 3.067755720 1
age -4.755575e-05 -0.0029149924 5.255533182 1
rm -1.577152e-04 0.0183411744 5.062648446 1
sd.mu -4.358364e-04 0.2000613535 0.173665882 1
sd.eps -3.761278e-03 0.1537611702 11.922966791 1
Condition number of the hessian: 93005.27
-----Iteration 4 -----
lambda 0 step 1 fcn value: 134.73112075
amount new param new gradient active
(Intercept) 8.352523e-04 9.6752990424 -8.294926e-06 1
crim 1.612165e-05 -0.0068964907 -4.818881e-02 1
zn -8.233736e-07 -0.0003928354 6.986522e-04 1
indus 1.302456e-05 0.0031515108 -4.004619e-04 1
nox -1.347190e-05 -0.0083815051 1.119156e-02 1
age -3.257215e-06 -0.0029117351 1.857734e-02 1
rm -1.026121e-05 0.0183514356 2.065886e-02 1
sd.mu 7.530552e-05 0.1999860480 -1.148648e-05 1
sd.eps -3.363883e-04 0.1540975586 2.863144e-01 1
Condition number of the hessian: 93119.22
-----Iteration 5 -----
lambda 0 step 1 fcn value: 134.73112193
amount new param new gradient active
(Intercept) 1.137074e-05 9.6752876716 -3.631340e-09 1
crim 1.049083e-07 -0.0068965957 -6.706624e-06 1
zn -5.789710e-09 -0.0003928296 2.825092e-07 1
indus 2.891373e-07 0.0031512217 -2.071974e-07 1
nox -1.859022e-07 -0.0083813192 1.057182e-06 1
age -5.325693e-08 -0.0029116819 1.942220e-06 1
rm -1.461899e-07 0.0183515818 2.411757e-06 1
sd.mu 2.226920e-06 0.1999838211 -4.265945e-08 1
sd.eps -8.071997e-06 0.1541056306 5.333056e-03 1
Condition number of the hessian: 93120.23
--------------
successive function values within tolerance limit
5 iterations
estimate: 9.675288 -0.006896596 -0.0003928296 0.003151222 -0.008381319 -0.002911682 0.01835158 0.1999838 0.1541056
Function value: 134.7311
Initial function value: -3270.463
Initial gradient value:
(Intercept) lag(log(rd), 0:5)0 lag(log(rd), 0:5)1 lag(log(rd), 0:5)2
-56.66794 -320.90821 -327.26150 -331.85994
lag(log(rd), 0:5)3 lag(log(rd), 0:5)4 lag(log(rd), 0:5)5 scisectyes
-381.58139 -431.24999 -468.26002 -57.22812
log(capital72) factor(year)1976 factor(year)1977 factor(year)1978
-435.63253 12.23849 -18.53424 -27.95151
factor(year)1979
-15.60544
----- Initial parameters: -----
fcn value: -3270.463
parameter initial gradient free
(Intercept) 0.809909894 -56.66794 1
lag(log(rd), 0:5)0 0.134524577 -320.90821 1
lag(log(rd), 0:5)1 -0.052944368 -327.26150 1
lag(log(rd), 0:5)2 0.008229465 -331.85994 1
lag(log(rd), 0:5)3 0.066096918 -381.58139 1
lag(log(rd), 0:5)4 0.090181342 -431.24999 1
lag(log(rd), 0:5)5 0.239538388 -468.26002 1
scisectyes 0.454309575 -57.22812 1
log(capital72) 0.252862548 -435.63253 1
factor(year)1976 -0.043515208 12.23849 1
factor(year)1977 -0.052441295 -18.53424 1
factor(year)1978 -0.170242204 -27.95151 1
factor(year)1979 -0.201878694 -15.60544 1
Condition number of the (active) hessian: 1175.977
-----Iteration 1 -----
lambda 0 step 1 fcn value: -3210.08422611
amount new param new gradient active
(Intercept) -0.936278970 1.74618886 32.158127 1
lag(log(rd), 0:5)0 -0.102173461 0.23669804 104.615511 1
lag(log(rd), 0:5)1 0.054922582 -0.10786695 101.348761 1
lag(log(rd), 0:5)2 -0.007804525 0.01603399 100.613420 1
lag(log(rd), 0:5)3 0.087237454 -0.02114054 90.742550 1
lag(log(rd), 0:5)4 0.030164328 0.06001701 73.330707 1
lag(log(rd), 0:5)5 0.160073872 0.07946452 57.662278 1
scisectyes 0.641296712 -0.18698714 23.039932 1
log(capital72) 0.120869315 0.13199323 181.008265 1
factor(year)1976 -0.003141228 -0.04037398 20.150690 1
factor(year)1977 -0.006820921 -0.04562037 5.770931 1
factor(year)1978 -0.019184437 -0.15105777 8.784257 1
factor(year)1979 -0.008526285 -0.19335241 -13.997391 1
Condition number of the hessian: 800.2728
-----Iteration 2 -----
lambda 0 step 1 fcn value: -3203.10330632
amount new param new gradient active
(Intercept) 0.101497857 1.64469101 -0.5874328 1
lag(log(rd), 0:5)0 -0.041945795 0.27864383 -4.7212319 1
lag(log(rd), 0:5)1 -0.013333551 -0.09453340 -4.9881453 1
lag(log(rd), 0:5)2 -0.019601012 0.03563500 -5.2780089 1
lag(log(rd), 0:5)3 -0.002682237 -0.01845830 -4.1443998 1
lag(log(rd), 0:5)4 0.049043125 0.01097389 -1.4861052 1
lag(log(rd), 0:5)5 0.095682162 -0.01621765 -0.1324931 1
scisectyes -0.201994296 0.01500716 -0.3764209 1
log(capital72) -0.077586780 0.20958001 -5.4246360 1
factor(year)1976 -0.002007270 -0.03836671 -2.4767739 1
factor(year)1977 -0.005557592 -0.04006278 -0.8415721 1
factor(year)1978 -0.006325644 -0.14473212 -0.2287670 1
factor(year)1979 0.004990280 -0.19834269 4.8489683 1
Condition number of the hessian: 944.1021
-----Iteration 3 -----
lambda 0 step 1 fcn value: -3203.06443548
amount new param new gradient active
(Intercept) -1.663775e-02 1.661328761 -0.012963205 1
lag(log(rd), 0:5)0 5.973731e-03 0.272670102 -0.045937716 1
lag(log(rd), 0:5)1 3.336338e-03 -0.097869738 -0.052826180 1
lag(log(rd), 0:5)2 3.539209e-03 0.032095792 -0.057890047 1
lag(log(rd), 0:5)3 1.918413e-03 -0.020376712 -0.054308117 1
lag(log(rd), 0:5)4 -5.220934e-03 0.016194823 -0.042199396 1
lag(log(rd), 0:5)5 -6.486471e-03 -0.009731176 -0.041497943 1
scisectyes -2.653281e-03 0.017660440 -0.008276576 1
log(capital72) 2.410423e-03 0.207169591 -0.083360312 1
factor(year)1976 2.791447e-05 -0.038394625 -0.014222831 1
factor(year)1977 -1.205286e-04 -0.039942253 -0.004920317 1
factor(year)1978 -3.997298e-04 -0.144332393 0.003284180 1
factor(year)1979 -2.578718e-03 -0.195763971 0.025245724 1
Condition number of the hessian: 947.6325
-----Iteration 4 -----
lambda 0 step 1 fcn value: -3203.06443419
amount new param new gradient active
(Intercept) -6.314482e-05 1.661391906 -1.563937e-07 1
lag(log(rd), 0:5)0 -8.895994e-06 0.272678998 -2.476127e-07 1
lag(log(rd), 0:5)1 1.687559e-05 -0.097886613 -7.861871e-07 1
lag(log(rd), 0:5)2 1.957598e-05 0.032076216 -1.182896e-06 1
lag(log(rd), 0:5)3 1.561405e-05 -0.020392326 -9.993114e-07 1
lag(log(rd), 0:5)4 -2.659692e-05 0.016221420 -2.069415e-07 1
lag(log(rd), 0:5)5 -3.183134e-06 -0.009727993 -1.111653e-07 1
scisectyes 2.066219e-05 0.017639777 -1.335492e-07 1
log(capital72) 2.075313e-05 0.207148837 -1.111449e-06 1
factor(year)1976 -1.956715e-06 -0.038392668 -8.582007e-07 1
factor(year)1977 -1.926712e-06 -0.039940327 -2.839490e-07 1
factor(year)1978 -4.591077e-06 -0.144327802 5.772805e-07 1
factor(year)1979 -1.214495e-05 -0.195751826 2.152313e-06 1
Condition number of the hessian: 947.583
--------------
successive function values within tolerance limit
4 iterations
estimate: 1.661392 0.272679 -0.09788661 0.03207622 -0.02039233 0.01622142 -0.009727993 0.01763978 0.2071488 -0.03839267 -0.03994033 -0.1443278 -0.1957518
Function value: -3203.064
There were 50 or more warnings (use warnings() to see the first 50)
(Intercept) mdu disease age sd.eps sd.mu
-655.92250 77.42462 13.61527 12.00930 1216.17096 1676.02854
There were 16 warnings (use warnings() to see them)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.