[R] Are fitted.values available in pglm?

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Fri Apr 12 19:12:27 CEST 2019


?fitted   Read and follow.

As I said, you appear to need to spend time with a tutorial. I do not
provide this service, though others may.

-- Bert


On Fri, Apr 12, 2019 at 10:07 AM Simon Berrebi <simon using berrebi.net> wrote:

> Thank you Bert,
>
> I wasn’t aware of ?str. The only mention of fitted-values is:
>
>  $ maximum    : atomic [1:1] -9824
>   ..- attr(*, "fitted.values")= num [1:3460] 1.39 1.3 1.3 1.32 1.27 ...
>
> When I try attr(mymodel$maximum,  ”fitted.values”), I get the same results
> as  attr(AIC(mymodel),  ”fitted.values”), which is a list of number
> starting with (1.39 1.3 1.3 1.32 1.27 …). I don’t see how these can be
> fitted values for the response variable, patents, which are larger numbers
> (30, 3, 48, 1, 2, 32, …). Is this output not supped to represent the fitted
> values for patents?
>
> Another way to obtain fitted values would be using residuals.?pglm also
> includes residuals in its list of elements. However, str(mymodel) does not
> mention residuals. Does that mean it’s just not there?
>
> - Simon
>
> On Apr 12, 2019, at 10:44 AM, Bert Gunter <bgunter.4567 using gmail.com> wrote:
>
> ?fitted
> ?predict
> ## This is what one usually does, but I have not checked pglm.
>
> You also need to get friendly with ?str
>
> ... and probably also spend time with an R tutorial or two to become
> familiar with R modeling conventions.
>
> Bert Gunter
>
> "The trouble with having an open mind is that people keep coming along and
> sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Fri, Apr 12, 2019 at 7:35 AM Simon Berrebi <simon using berrebi.net> wrote:
>
>> Hello everyone,
>>
>> I am using the pglm function in R to fit a Poisson fixed-effects model.
>> According to the documentation <
>> https://cran.r-project.org/web/packages/pglm/pglm.pdf>, the pglm object
>> should have fitted.values. However, fitted.values(mymodel) returns "NULL".
>>
>> When I run AIC(mymodel) the AIC is followed by "attr(,"fitted.values")"
>> and a long list of number. I have included an example below and attached a
>> text file with the output.
>>
>> Are these fitted values? If so, is there a way to obtain them directly?
>> Can I also get fitted-values based on a synthetic dataset (i.e. predict())?
>>
>> install.packages("pglm")
>> library(pglm)
>>
>> data("PatentsRDUS", package="pglm")
>>
>>
>>      mymodel <- pglm(patents ~   log(rd)  + as.numeric(year)+
>> I(log(capital72)*as.numeric(year)) , PatentsRDUS,
>>      family = poisson(link=log), model = "within", index = c("cusip",
>> "year"))
>>
>>      fitted.values(mymodel)
>>      AIC(mymodel)
>>
>> Cordially,
>>>> Dr. Simon J Berrebi
>> Postdoctoral Fellow
>> Civil and Environmental Engineering
>> Georgia Institute of Technology
>>
>>
>>
>>
>>
>>
>>
>>
>> ______________________________________________
>> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> <http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list