[R] smooth spline with R

Simon Wood s.wood at bath.ac.uk
Mon Mar 17 14:43:31 CET 2014


e.g...

b <- gam(Y~s(X)) ## fit
gam.check(b) ## check
fitted(b) ## fitted values
predict(b,newdata=data.frame(X=c(15,16))) ## predictions at new X

.... see ?predict.gam


On 14/03/14 23:24, Parviz Zare wrote:
>
>
>
> Dear Sir,
>
>
>
> How I can obtain the predicted values of Y variable with fitting smooth spline regressions (in GAMs) using R software?
> in my research, temperature (X variable) is as smoother and fish catch values (Y variable) is as response
> variable.
>
>
> I would be grateful if you could help me.
>
> Yours sincerely Parviz
>
>
>
>
>
>
> ________________________________
>   From: Douglas Bates <bates at stat.wisc.edu>
>
> Sent: Saturday, 15 March 2014, 0:23:03
> Subject: Re: smooth spline
>
>
>
> A question such as this should be sent to the R-help at R-project.org mailing list, but first I would advise you to clarify your question and, most helpfully, include information on the version of R and of any R packages you are using.  This can be obtained by entering
>
> sessionInfo()
>
> after you have fit your model.  You could cut-and-paste the results that are shown as the result of that statement.
>
>
>
>
>
>
> Dear Douglas,
>>
>> I am going to fit smooth spline regressions between
> an environmental variable (as a smoother) and CPUA (fish catch value) as a response
> variable using R software. Then, the regressions were used to calculate Suitability
> index (SI):
>>
>> Where,  is the predicted value of CPUA;  and  are the minimum and maximum values of the
> predicted CPUA values, respectively.
>> I have an R code for thin regression, but there
> is one problem. When I run it, there is in output only graph. But I need to the
> predicted value of CPUA () to to
> calculate Suitability index (SI).
>>   Please look at the attached file.
>>
>> I would be grateful if you could help me.
>>
>> Yours sincerely
>> Parviz
> 	[[alternative HTML version deleted]]
>
>
>
> ______________________________________________
> 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.
>


-- 
Simon Wood, Mathematical Science, University of Bath BA2 7AY UK
+44 (0)1225 386603               http://people.bath.ac.uk/sw283




More information about the R-help mailing list