[R] error with polr()
Bill.Venables@csiro.au
Bill.Venables at csiro.au
Tue Mar 22 07:24:42 CET 2005
This is always tricky. Here is a work-around.
Try asking for the Hessian with the original fit:
> fm <- polr(factor(y) ~ lx, data = ord.dat, Hess=T)
> summary(fm)
Call:
polr(formula = factor(y) ~ lx, data = ord.dat, Hess = T)
Coefficients:
Value Std. Error t value
lx 2.420614 0.8146359 2.971406
Intercepts:
Value Std. Error t value
0|1 0.5865 0.8118 0.7224
1|2 4.8966 1.7422 2.8106
Residual Deviance: 20.43286
AIC: 26.43286
---
[I have no idea if this is "the same as SAS" but if not, please report
the problem to SAS Inc.]
Bill Venables.
-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Chaehyung Ahn
Sent: Tuesday, 22 March 2005 11:44 AM
To: r-help at stat.math.ethz.ch
Subject: [R] error with polr()
Dear Sir,
I get an error message when I use polr() in MASS package.
My data is "ord.dat". I made "y" a factor.
y y1 y2 x lx
1 0 0 0 3.2e-02 -1.49485
2 0 0 0 3.2e-02 -1.49485
3 0 0 0 1.0e-01 -1.00000
4 0 0 0 1.0e-01 -1.00000
5 0 0 0 3.2e-01 -0.49485
6 0 0 0 3.2e-01 -0.49485
7 1 1 0 1.0e+00 0.00000
8 0 0 0 1.0e+00 0.00000
9 1 1 0 3.2e+00 0.50515
10 1 1 0 3.2e+00 0.50515
11 0 0 0 1.0e+01 1.00000
12 1 1 0 1.0e+01 1.00000
13 1 1 0 3.2e+01 1.50515
14 2 1 1 3.2e+01 1.50515
15 2 1 1 1.0e+02 2.00000
16 1 1 0 1.0e+02 2.00000
17 2 1 1 3.2e+02 2.50515
18 1 1 0 3.2e+02 2.50515
19 2 1 1 1.0e+03 3.00000
20 2 1 1 1.0e+03 3.00000
When I try,
> polr(y~lx,data=ord.dat)
I gives me a output, which is the same as that from SAS.
But when I try,
> summary(polr(y~lx,data=ord.dat))
Re-fitting to get Hessian
Error in optim(start, fmin, gmin, method = "BFGS", hessian = Hess, ...)
:
initial value in vmmin is not finite
And the weird thing is that it's fine if I use "x" instead of
"lx", where lx=log10(x).
thanks
Sincerely,
cahn
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list