Re: [R] Are fitted.values available in pglm?

2019-04-14 Thread Simon Berrebi
Thank you both for your responses!

Bert - Are there specific tutorials you recommend on the subject?

William - I first contacted the pglm maintainer before posting here (and also 
Stack Exchange 
).
 Haven’t heard back.

- Simon

> On Apr 12, 2019, at 2:44 PM, William Dunlap  wrote:
> 
> You should ask the maintainer of the package about this: 
> bug.report(package="pglm") or maintainer("pglm") should give you contact 
> information.
> 
> The help file for pglm seems all wrong - it says pglm's output has class 
> "pglm" with components like "fitted.values", but the the example calls to 
> pglm return things of class c("maxLik", "maxim", "list").
> 
> Bill Dunlap
> TIBCO Software
> wdunlap tibco.com 
> 
> On Fri, Apr 12, 2019 at 11:09 AM Simon Berrebi  > 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  > > 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  >   > >> wrote:
> > Hello everyone,
> > 
> > I am using the pglm function in R to fit a Poisson fixed-effects model. 
> > According to the documentation 
> >  >  
> >  > >>, 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@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 
> >  
> >  > >
> > and provide commented, minimal, self-contained, reproducible code.
> 
> 
> [[alternative HTML version deleted]]
> 
> __
> R-help@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 
> 

Re: [R] Are fitted.values available in pglm?

2019-04-12 Thread William Dunlap via R-help
You should ask the maintainer of the package about this:
bug.report(package="pglm") or maintainer("pglm") should give you contact
information.

The help file for pglm seems all wrong - it says pglm's output has class
"pglm" with components like "fitted.values", but the the example calls to
pglm return things of class c("maxLik", "maxim", "list").

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Fri, Apr 12, 2019 at 11:09 AM Simon Berrebi  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 
> 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  > 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 <
> 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@r-project.org  mailing list -- To
> UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help <
> 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]]
>
> __
> R-help@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
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Are fitted.values available in pglm?

2019-04-12 Thread Simon Berrebi
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  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  > wrote:
> Hello everyone,
> 
> I am using the pglm function in R to fit a Poisson fixed-effects model. 
> According to the documentation 
>  >, 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@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 
> 
> and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Are fitted.values available in pglm?

2019-04-12 Thread Bert Gunter
?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  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  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  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@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
>> 
>> and provide commented, minimal, self-contained, reproducible code.
>
>
>

[[alternative HTML version deleted]]

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Are fitted.values available in pglm?

2019-04-12 Thread Bert Gunter
?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  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@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
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@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
and provide commented, minimal, self-contained, reproducible code.


[R] Are fitted.values available in pglm?

2019-04-12 Thread Simon Berrebi
Hello everyone,

I am using the pglm function in R to fit a Poisson fixed-effects model. 
According to the documentation 
, 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@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
and provide commented, minimal, self-contained, reproducible code.