[R] is this a bug? [was Re: again with polr]

Luca Braglia lbraglia at gmail.com
Sat Mar 15 15:21:55 CET 2008


Hello everybody

as I said, i'm not a ordered probit guru, but what happened seems
to me a little strange.

Here I put my dataset

http://bragliozzo.altervista.org/asd.dta

this is the code you can try

# -------------------
library(foreign)
library(MASS)
asd <- read.dta("asd.dta",
                convert.underscore = F)

base.op <- polr(
                as.ordered(lz2_1) ~
                ly +
                lnfiglimin +
                lnfiglimagg +
                lnadulti +
                eta +
                eta2 +
                uomo +
                laurea +
                saluteno +
                extra
                ,
                ##                 weights = w,
                data = asd,
                method = "probit",
                Hess = T
                )

summary(base.op)

# -------------------

The problem is: you can try _any_ combination of the explaining
variables, but when you insert eta2 (eta == age in years, eta2 ==
age^2) you can't do the summary. I don't see why: it's a variable
like others with no strange problems (at least it seems to me to
be so).

If I'm wrong please tell me, otherwise I'll submit a bug report

ok





On 15/03/08 -  10:29, Luca Braglia wrote:
> hello everybody
> 
> solved the problem with summary, now I have another one
> 
> eg I estimate
> 
> > try.op <- polr(
> >                as.ordered(sod.sit.ec.fam) ~
> >                log(y) +
> >                log(1 + nfiglimin) +
> >                log(1 + nfiglimagg) +
> >                log(ncomp - nfiglitot) +
> 
> >                eta +
> >                I(eta^2) +
> >                uomo +
> >                elem +
> >                laurea +
> >                saluteno +
> >                extra
> >                ,
> 
> >                data = dfscale,
> >                method = "probit",
> >                Hess = T
> >                )
> 
> 
> now I've putted Hess=T in order to perform a summary on the
> estimate. I missed this option last time
> 
> > try.op
> > Call:
> > polr(formula = as.ordered(sod.sit.ec.fam) ~ log(y) + log(1 + 
> >     nfiglimin) + log(1 + nfiglimagg) + log(ncomp - nfiglitot) + 
> >     eta + I(eta^2) + uomo + elem + laurea + saluteno + extra, 
> >     data = dfscale, Hess = T, method = "probit")
> 
> > Coefficients:
> >                 log(y)     log(1 + nfiglimin) 
> >             0.76200482            -0.17791762 
> >    log(1 + nfiglimagg) log(ncomp - nfiglitot) 
> >            -0.33306775            -0.22487707 
> >                    eta               I(eta^2) 
> >            -0.03177126             0.00030204 
> >            uomomaschio                   elem 
> >            -0.02737021             0.05259243 
> >                 laurea               saluteno 
> >             0.19143184            -0.23067414 
> >                  extra 
> >            -0.27810954 
> 
> > Intercepts:
> >     0|1     1|2     2|3     3|4     4|5     5|6     6|7     7|8 
> > 5.22647 5.42504 5.76277 6.03395 6.31709 6.88459 7.27907 7.82273 
> >     8|9    9|10 
> > 8.50723 8.83105 
> 
> > Residual Deviance: 16325.59 
> > AIC: 16367.59 
> > (58 observations deleted due to missingness)
> 
> 
> unfortunately when I do 
> 
> > summary(try.op)
> 
> I get 
> 
> > summary(try.op)
> > Errore in svd(X) : valori infiniti o mancanti in 'x'
> 
> ... infinite  or missing values. 
> 
> If I exclude I(eta^2) from the estimation I can do summaries: but
> I need also I(eta^2) in order to compare this model with the same
> specification estimated with Ols
> 
> Can you please help me or give me an hint?
> 
> If it can be useful, i hereby put an estimation with stata's
> oprobit function (varnames are a little bit different) 
> 
> > . oprobit lz2_1 ly lnfiglimin lnfiglimagg lnadulti eta eta2 uomo elem laurea saluteno extra
> 
> > Iteration 0:   log likelihood = -7877.9258
> > Iteration 1:   log likelihood = -7633.4001
> > Iteration 2:   log likelihood = -7633.3455
> 
> > Ordered probit estimates                          Number of obs   =       3747
> >                                                   LR chi2(11)     =     489.16
> >                                                   Prob > chi2     =     0.0000
> > Log likelihood = -7633.3455                       Pseudo R2       =     0.0310
> 
> > ------------------------------------------------------------------------------
> >        lz2_1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
> > -------------+----------------------------------------------------------------
> >           ly |   .6998939   .0369605    18.94   0.000     .6274526    .7723351
> >   lnfiglimin |  -.1177089   .0467595    -2.52   0.012     -.209356   -.0260619
> >  lnfiglimagg |  -.3195756   .0475709    -6.72   0.000    -.4128128   -.2263383
> >     lnadulti |  -.2644527   .0588268    -4.50   0.000     -.379751   -.1491544
> >          eta |  -.0245736   .0048287    -5.09   0.000    -.0340376   -.0151096
> >         eta2 |    .000236   .0000485     4.87   0.000     .0001409     .000331
> >         uomo |  -.0226491     .03348    -0.68   0.499    -.0882686    .0429705
> >         elem |  -.0072757   .0524754    -0.14   0.890    -.1101257    .0955743
> >       laurea |    .119691   .0527058     2.27   0.023     .0163895    .2229925
> >     saluteno |  -.1299579   .0724971    -1.79   0.073    -.2720495    .0121337
> >        extra |  -.3077715   .0963483    -3.19   0.001    -.4966107   -.1189323
> > -------------+----------------------------------------------------------------
> >        _cut1 |   4.403418   .3797857          (Ancillary parameters)
> >        _cut2 |   5.018157   .3793925 
> >        _cut3 |   5.372828   .3796109 
> >        _cut4 |   5.705886   .3800993 
> >        _cut5 |   6.314861   .3814847 
> >        _cut6 |   6.723659   .3826026 
> >        _cut7 |   7.278588   .3842792 
> >        _cut8 |   7.963981    .386254 
> >        _cut9 |   8.288727   .3871242 
> > ------------------------------------------------------------------------------
> 
> > . log close
> >        log:  z:/home/luca/stata_oprob.log
> >   log type:  text
> >  closed on:  15 Mar 2008, 10:13:50
> > --------------------------------------------------------------------------------------------------------
> 
> 
> 
> thank you
>    Luca
> 
> -- 
>              Luca Braglia, aka Bragliozzo
>            http://bragliozzo.altervista.org

-- 
             Luca Braglia, aka Bragliozzo
           http://bragliozzo.altervista.org



More information about the R-help mailing list