Re: [R] A question on modeling brain growth using GAM

2017-04-07 Thread Leon Lee
Simon I wonder whether I can take advantage of this thread and ask you another related question. Now, I want to get the 95%CI of the fit and their derivatives as well. For the original fitted curves, It is straightforward as the option "type=terms" can be used to get the CI for the fixed effect. N

Re: [R] A question on modeling brain growth using GAM

2017-04-07 Thread Leon Lee
Hi, Simon Thank you for your explanation! I followed the instructions and successfully get the predicted values with both fixed and random effects incorporated: pred.new=predict.gam(gamm1$gam,newdata,type="response"). Also, what I meant to say was "plot(gamm1$gam, pages=1)" for left and right fig

Re: [R] A question on modeling brain growth using GAM

2017-04-06 Thread Simon Wood
> > gamObj=gam(brainVolume~ s(correctedAge) + s(subjIndexF, bs="re") + > s(subjIndexF, correctedAge, bs="re"), method="REML", data=mydata), > where subjIndexF is a factor for each subject. I was thrown an error > saying "more coefficients than data". > --- I'm not sure exactly how many scans a

Re: [R] A question on modeling brain growth using GAM

2017-04-06 Thread Simon Wood
If 'subjIndexF' is a factor for subject, then s(subjIndexF, bs="re") will produce a random effect for subject. i.e. each subject will be given its own random intercept term, which is a way that repeated measures data like this are often handled. The reason for the s(subjIndexF, bs="re") syntax

Re: [R] A question on modeling brain growth using GAM

2017-03-30 Thread David Winsemius
> On Mar 30, 2017, at 6:56 AM, Leon Lee wrote: > > David > > Thank you for your reply. I apologize if I posted in the wrong forum, as I > really couldn't decide which forum is the best place for my question and I > saw similar questions asked before in this forum. > > I agree that a sample

Re: [R] A question on modeling brain growth using GAM

2017-03-30 Thread Leon Lee
David Thank you for your reply. I apologize if I posted in the wrong forum, as I really couldn't decide which forum is the best place for my question and I saw similar questions asked before in this forum. I agree that a sample of ~30 subjects (70 scans in total), the model can be too complicated

Re: [R] A question on modeling brain growth using GAM

2017-03-28 Thread David Winsemius
> On Mar 28, 2017, at 9:32 AM, Leon Lee wrote: > > Hi, R experts > > I am new to R & GAM toolbox and would like to get inputs from you all on my > models. The question I have is as follows: > I have 30 subjects with each subject being scanned from one to three times > in the first year of life.

[R] A question on modeling brain growth using GAM

2017-03-28 Thread Leon Lee
Hi, R experts I am new to R & GAM toolbox and would like to get inputs from you all on my models. The question I have is as follows: I have 30 subjects with each subject being scanned from one to three times in the first year of life. The brain volume from each scan was measured. The scan time was