Hola! I have some problems with gam in mgcv. Firts a detail: it would be nice igf gam would accept an na.action argument, but that not the main point. I want to have a smooth term for time over a year, the same pattern repeating in succesive years. It would be natural then to impose the condition s(0)=s(12). Is this possible within mgcv? I tried to obtain this with trigonometric terms, aca:> Rot.gam2 <- gam(cbind(Rotavirus,Total)~ s( I(sin((MesN/12)*2*pi)),bs="cr" )+ + s( I(cos((MesN/12)*2*pi)), bs="cr" ), data=na.omit(Rot), + family=binomial) Warning messages: 1: Termwise estimate degrees of freedom are unreliable but this does not seem to be wholy satisfactory. Especially, the result of plot.gam shows smooths with confidence bounds which cannot be discriminated visually from the smooth itself!, and the warning messages about unreliable estimated degrees of freedom. I would be happy if you could comment some about this. Thanks, Kjetil Halvorsen
> I have some problems with gam in mgcv. Firts a detail: it would > be nice igf gam would accept an na.action argument, but that not the > main point.- I find it hard to think of a sensible action except dropping the associated data, but if you've a concrete suggestion I'm happy to add it to the "to do" list.> I want to have a smooth term for time over a year, the same pattern > repeating in succesive years. It would be natural then to impose > the condition s(0)=s(12). Is this possible within mgcv?- It's possible, but not entirely straightforward - you could impose the constraint using the pcls() routine, but it means digging around inside the code a bit - see the ?pcls examples to get an idea of the sort of thing required. - It's probably worth checking out whether gss can do this more simply for you.> I tried to obtain this with trigonometric terms, aca: > > > Rot.gam2 <- gam(cbind(Rotavirus,Total)~ s( I(sin((MesN/12)*2*pi)), > bs="cr" )+ > + s( I(cos((MesN/12)*2*pi)), bs="cr" ), > data=na.omit(Rot), > + family=binomial) > Warning messages: > 1: Termwise estimate degrees of freedom are unreliable >The problem here is basically that you have " a smooth function of a smooth function of MesN " and " a smooth function of another smooth function of MesN ", i.e. two smooth functions of MesN and hence some identifiability problems. The error message reflects the numerical difficulties resulting from these problems (which also explain the lack of confidence intervals). best, Simon _____________________________________________________________________> Simon Wood simon at stats.gla.ac.uk www.ruwpa.st-and.ac.uk/simon.html >> Department of Statistics, University of Glasgow, Glasgow, G12 8QQ >>> Direct telephone: (0)141 330 4530 Fax: (0)141 330 4814
On 31 Jan 2003 at 10:40, Simon Wood wrote: Thanks for the help. I will try out your suggestions. Some specific comments:> > I have some problems with gam in mgcv. Firts a detail: it would > > be nice igf gam would accept an na.action argument, but that not the > > main point. > - I find it hard to think of a sensible action except dropping the > associated data, but if you've a concrete suggestion I'm happy to add it > to the "to do" list.One other usefull action would be to add the possibility of using na.exclude, which makes it necessary to rewrite (slightly) the residuals and predict methods using naresid and napredict. And one other thing, of interest only for Simon Wood: I tried to reply privately, but had the following problem: My mail bounced, with the following explication: The original message was received at Thu, 30 Jan 2003 10:07:13 +0400 (GMT) from s250r.entelnet.bo [166.114.10.19] ----- The following addresses had permanent fatal errors ----- <spam_manager at mcs.st-and.ac.uk> (reason: 550 5.7.1 Mail from 166.114.10.32 refused by blackhole site blackholes.five-ten-sg.com as suspected spam. If this e-mail is not spam please e-mail spam_manager at mcs.st-and.ac.uk quoting this message.) ----- Transcript of session follows ----- ... while talking to twopi.mcs.st-and.ac.uk.:>>> MAIL From:<kjetil at entelnet.bo><<< 550 5.7.1 Mail from 166.114.10.32 refused by blackhole site blackholes.five-ten-sg.com as suspected spam. If this e-mail is not spam please e-mail spam_manager at mcs.st-and.ac.uk quoting this message. 554 5.0.0 Service unavailable Trying to write to spam_manager at etc then produced the same type of response! I cannot understand why this should be filtered as spam! Thanks, Kjetil Halvorsen