[R] mgcv package, problems with NAs in gam

Simon Wood s.wood at bath.ac.uk
Sat Aug 25 16:15:11 CEST 2012


'gam' doesn't know what to do with the model formula '1 ~ 1' (i.e. "one 
tilde one"). What is it supposed to mean? 'glm'  also does nothing 
meaningful in this case...

## code to load you data file into 'dat' omitted
 > model<-glm(1~1, data=dat)
 > model

Call:  glm(formula = 1 ~ 1, data = dat)

Coefficients:
(Intercept)
           1

Degrees of Freedom: 0 Total (i.e. Null);  0 Residual
Null Deviance:        0
Residual Deviance: 0     AIC: -Inf

What model are you trying to fit?

best,
Simon


On 08/24/2012 10:36 PM, grace wrote:
> Hi there,
>
> I'm using presence-absence data in a gam (i.e. 0 or 1 as values)
> I am trying to run a gam with 'dummy covariates' i.e. 1~1
> unfortunately my model:
> *
> model<-gam(1~1, data=bats, family=negbin)*
>
> keeps putting out:
>
> *
> Error in gam(1 ~ 1, data = bats, family = negbin) :
>    Not enough (non-NA) data to do anything meaningful*
>
> Is there a specific reason it would do this? I have tried using various
> actions on NAs, na.pass etc, as well as asking it to turn all NAs to 0 but
> to no avail.
>
> I would post the data here but its rather long, basically 28x104 matrix of
> 0/1 with headers 'v1:v28' .The summary for the data comes up fine, it's just
> the model that isn't working.
> However if I run using:
>
> *model<-gam(v1~v2, data=bats, family=negbin)
> *
>
> it tends to work.
>
> Any help is seriously appreciated as I have a deadline and have been trying
> this for days,
>
> Thanks!
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/mgcv-package-problems-with-NAs-in-gam-tp4641253.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.




More information about the R-help mailing list