Description Usage Arguments Details Value Author(s) References See Also Examples
Takes a fitted spm
object produced by
spm()
and obtains predictions at new data values.
1 2 |
object |
a fitted |
newdata |
a data frame containing the values of the predictors at which predictions are required. The columns should have the same name as the predictors. |
se |
when this is TRUE standard error estimates are returned for each prediction. The default is FALSE. |
... |
other arguments. |
Takes a fitted spm
object produced by
spm()
and obtains predictions at new data values
as specified by the ‘newdata’ argument. If ‘se=TRUE’ then
standard error estimates are also obtained.
If se=FALSE then a vector of predictions at ‘newdata’ is returned. If se=TRUE then a list with components named ‘fit’ and ‘se’ is returned. The ‘fit’ component contains the predictions. The ‘se’ component contains standard error estimates.
M.P. Wand mwand@uow.edu.au (other contributors listed in SemiPar Users' Manual).
Ruppert, D., Wand, M.P. and Carroll, R.J. (2003)
Semiparametric Regression Cambridge University Press.
http://stat.tamu.edu/~carroll/semiregbook/
Ganguli, B. and Wand, M.P. (2005)
SemiPar 1.0 Users' Manual.
http://matt-wand.utsacademics.info/SPmanu.pdf
spm
lines.spm
plot.spm
summary.spm
1 2 3 4 5 6 7 8 9 10 11 12 | library(SemiPar)
data(fossil)
attach(fossil)
fit <- spm(strontium.ratio~f(age))
newdata.age <- data.frame(age=c(90,100,110,120,130))
preds <- predict(fit,newdata=newdata.age,se=TRUE)
print(preds)
plot(fit,xlim=c(90,130))
points(unlist(newdata.age),preds$fit,col="red")
points(unlist(newdata.age),preds$fit+2*preds$se,col="blue")
points(unlist(newdata.age),preds$fit-2*preds$se,col="green")
|
$fit
[1] 0.7072402 0.7074085 0.7073363 0.7074190 0.7073855
$se
[1] 4.352894e-05 1.241325e-05 6.764931e-06 8.208830e-06 1.818757e-04
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.