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.
Grace: Confession: I loved that error message! -- and it seems pretty clear to me. What does "to no avail" mean -- in particular, what happened when you changed your NA's to 0? Presumably you did not get the same error message, again, but something else, right? What else? Modulo the above vagueness, I would guess you're stuck -- you can't do what you'd like with your data. If so, John Tukey's remark from decades ago seems apropos: "The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data." American Statistician 40 (1986) But if you post with greater clarity -- or get a response from someone with a greater brain -- maybe there's hope. Cheers, Bert On Fri, Aug 24, 2012 at 2:36 PM, grace <sololorox at hotmail.com> 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.-- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
I've attached the data to this message. http://r.789695.n4.nabble.com/file/n4641291/2005pip.csv 2005pip.csv -- View this message in context: http://r.789695.n4.nabble.com/mgcv-package-problems-with-NAs-in-gam-tp4641253p4641291.html Sent from the R help mailing list archive at Nabble.com.
'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.