Re: [R] AIC for tweedie glm

2010-09-30 Thread eleadbeater

Many thanks! Using a fresh session didn't work, but I upgraded to R.2.11.1
and it runs fine now.


bbolker wrote:
> 
> eleadbeater  sussex.ac.uk> writes:
> 
>> Dear R-users,
>> 
>> I'm trying to model some data using a tweedie GLM approach. My response
>> variable is the number of pupae that are the offspring of a subordinate
>> wasp
>> on a wasp's nest. However, they're not count data- for each nest, I only
>> know the mean number of pupae per subordinate, which is continous. The
>> data
>> also contain a high proportion of zeros.
>> 
>> This worked fine, and gave results I expected, but I don't know what the
>> best method is to evaluate the fit of the model. I am used to using AIC
>> to
>> compare models. A site search turned up AICtweedie, within the tweedie
>> package, but I get the following message: Error: could not find function
>> "AICtweedie" when I try to use this command, even though "tweedie" and
>> "statmod" are both loaded. I've also read that AIC can be calculated
>> using
>> dtweedie, but I'm a beginner and so, despite lots of searching, I'm not
>> sure
>> how. I'm sorry to ask a basic statistics rather than programming
>> question,
>> but I'm really stuck. Could anyone advise me on the best way to assess
>> goodness-of-fit for this type of model, in order to compare models?
> 
>   Everything you're saying sounds sensible.  The only (!) problem is
> that your problem isn't reproducible (for me at least).
>   What happens if you run 
> 
> library(tweedie)
> example(AICtweedie)
> 
> from a fresh R session (possibly using R --vanilla)?
> 
> What are the results of sessionInfo()  ?
> 
>   Works for me.
> 
>   Ben Bolker
> 
> __
> R-help@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.
> 
> 

-- 
View this message in context: 
http://r.789695.n4.nabble.com/AIC-for-tweedie-glm-tp2720813p2720934.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] AIC for tweedie glm

2010-09-30 Thread Ben Bolker
eleadbeater  sussex.ac.uk> writes:

> Dear R-users,
> 
> I'm trying to model some data using a tweedie GLM approach. My response
> variable is the number of pupae that are the offspring of a subordinate wasp
> on a wasp's nest. However, they're not count data- for each nest, I only
> know the mean number of pupae per subordinate, which is continous. The data
> also contain a high proportion of zeros.
> 
> This worked fine, and gave results I expected, but I don't know what the
> best method is to evaluate the fit of the model. I am used to using AIC to
> compare models. A site search turned up AICtweedie, within the tweedie
> package, but I get the following message: Error: could not find function
> "AICtweedie" when I try to use this command, even though "tweedie" and
> "statmod" are both loaded. I've also read that AIC can be calculated using
> dtweedie, but I'm a beginner and so, despite lots of searching, I'm not sure
> how. I'm sorry to ask a basic statistics rather than programming question,
> but I'm really stuck. Could anyone advise me on the best way to assess
> goodness-of-fit for this type of model, in order to compare models?

  Everything you're saying sounds sensible.  The only (!) problem is
that your problem isn't reproducible (for me at least).
  What happens if you run 

library(tweedie)
example(AICtweedie)

from a fresh R session (possibly using R --vanilla)?

What are the results of sessionInfo()  ?

  Works for me.

  Ben Bolker

__
R-help@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.


[R] AIC for tweedie glm

2010-09-30 Thread eleadbeater

Dear R-users,

I'm trying to model some data using a tweedie GLM approach. My response
variable is the number of pupae that are the offspring of a subordinate wasp
on a wasp's nest. However, they're not count data- for each nest, I only
know the mean number of pupae per subordinate, which is continous. The data
also contain a high proportion of zeros.

I'm not very experienced at statistical modelling, but from reading previous
posts, it seems that my data would suit a tweedie approach. I can't use a
zero-inflated Poisson model, because my data are not counts. Many of my
values are between 0 and 1, so if I rounded to the nearest integer, I'd lose
a lot of the variation.

Here's my code:
out<-tweedie.profile(PUPAE_PER_SUB~1,p.vec=seq(1.1,1.9,length=9),method="interpolation",do.ci=TRUE,do.smooth=TRUE,do.plot=TRUE)
tweedie1<-glm(GSA_TOTAL_DF_PERSUB~GROUP_SIZE+PERIOD+SITE+PERIOD*GROUP_SIZE,family=tweedie(var.power=out$p.max,link.power=0))

This worked fine, and gave results I expected, but I don't know what the
best method is to evaluate the fit of the model. I am used to using AIC to
compare models. A site search turned up AICtweedie, within the tweedie
package, but I get the following message: Error: could not find function
"AICtweedie" when I try to use this command, even though "tweedie" and
"statmod" are both loaded. I've also read that AIC can be calculated using
dtweedie, but I'm a beginner and so, despite lots of searching, I'm not sure
how. I'm sorry to ask a basic statistics rather than programming question,
but I'm really stuck. Could anyone advise me on the best way to assess
goodness-of-fit for this type of model, in order to compare models?

Thanks
-- 
View this message in context: 
http://r.789695.n4.nabble.com/AIC-for-tweedie-glm-tp2720813p2720813.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.