[R] pglm package: fitted values and residuals

Paul Johnson pauljohn32 at gmail.com
Thu Apr 25 21:14:25 CEST 2013


On Wed, Apr 24, 2013 at 4:37 PM, Achim Zeileis <Achim.Zeileis at uibk.ac.at> wrote:
> On Wed, 24 Apr 2013, Paul Johnson wrote:
>
>> On Wed, Apr 24, 2013 at 3:11 AM,  <alfonso.carfora at uniparthenope.it>
>> wrote:
>>
>>> I'm using the package pglm and I'have estimated a "random probit model".
>>> I need to save in a vector the fitted values and the residuals of the model
>>> but I can not do it.
>>>
>>> I tried with the command fitted.values using the following procedure
>>> without results:
>>>
>> This is one of those "ask the pglm authors" questions. You should take it
>> up with the authors of the package.  There is a specialized email list
>> R-sig-mixed where you will find more people working on this exact same
>> thing.
>>
>> pglm looks like fun to me, but it is not quite done, so far as I can tell.
>
> I'm sure that there are many. One of my attempts to write up a list is in
> Table 1 of vignette("betareg", package = "betareg").

Yes! That's exactly the list I was thinking of.  It was driving me
crazy I could not find it.

Thanks for the explanation.  I don't think I should have implied that
the pglm author must actually implement all the methods, it is
certainly acceptable to leverage the methods that exist.  It just
happened that the ones I tested were not implemented by any of the
affiliated packages.

But this thread leads me to one question I've wondered about recently.

Suppose I run somebody's regression function and out comes an object.

Do we have a way to ask that object "what are all of the methods that
might apply to you?"  Here's why I wondered. You've noticed that
predict.lm has the interval="confidence" argument, but predict.glm
does not. So if I receive a regression model, I'd like to say to it
"do you have a predict method" and if I could get that predict method,
I could check to see if there is a formal argument interval. If it
does not, maybe I'd craft one for them.

pj



> Personally, I don't write anova() methods for my model objects because I can
> leverage lrtest() and waldtest() from "lmtest" and linearHypothesis() and
> deltaMethod() from "car" as long as certain standard methods are available,
> including coef(), vcov(), logLik(), etc.
>
> Similarly, an AIC() method is typically not needed as long as logLik() is
> available. And BIC() works if nobs() is available in addition.
>
> Best,
> Z
>
>>
>> pj
>>
>>> library(pglm)
>>>
>>> m1_S<-pglm(Feed ~ Cons_PC_1 + imp_gen_1 + LGDP_PC_1 + lnEI_1 +
>>>
>>> SH_Ren_1,data,family=binomial(probit),model="random",method="bfgs",index=c("Year","IDCountry"))
>>>
>>> m1_S$fitted.values
>>> residuals(m1)
>>>
>>>
>>> Can someone help me about it?
>>>
>>> Thanks
>>>
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>



--
Paul E. Johnson
Professor, Political Science      Assoc. Director
1541 Lilac Lane, Room 504      Center for Research Methods
University of Kansas                 University of Kansas
http://pj.freefaculty.org               http://quant.ku.edu



More information about the R-help mailing list