Description Usage Arguments Details Value Author(s) References See Also Examples
Provide a way to calculate predictions at any specified values for any combinations of elements in the fitted model. Posterior standard deviations may be used to construct Bayesian confidence intervals.
1 2 3 |
object |
a fitted |
newdata |
an optional data frame containing the values at which predictions are required. Default is NULL, where predictions are made at the same values used to compute the object. Note that if scale=T, the newdata is on the original scale before transformation. |
terms |
an optional vector of 0's and 1's collecting a combination of components, or a matrix of 0's and 1's collecting several combinations of components, in a fitted ssr object. All components include bases on the right side of ~ in the formula and reproducing kernels in the rk list. Note that the first component is usually a constant function if it is not specifically excluded in the formula. A value "1" at a particular position means that the component at that position is collected. Default is a vector of 1's, representing the overall fit. |
pstd |
an optional logic value. If TRUE (the default), the posterior standard deviations are calculated. Otherwise, only the predictions are calculated. Computation required for posterior standard deviations could be intensive. |
... |
other arguments, but currently unused. |
This function is a method for the generic function predict for class ssr
.
It can be used to construct Bayesian confidence intervals for any combinations
of components in the fitted model.
an object of class bCI
is returned, which is a list of length 2. Its first element is a matrix which contains predictions for combinations specified by terms
, and second element is a matrix which contains corresponding posterior standard deviations.
Chunlei Ke chunlei\_ke@yahoo.com and Yuedong Wang yuedong@pstat.ucsb.edu.
Wahba, G. (1990). Spline Models for Observational Data. SIAM, Vol. 59.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Not run:
data(acid)
# tp.pseudo calculates the pseudo kernel
acid.fit<- ssr( ph ~ t1 + x1 + x2, rk = list(tp.pseudo(t1),
tp.pseudo(list(x1, x2))), spar = "m", data=acid)
# extract the main effect of t1
grid <- seq(min(acid$t1),max(acid$t1),length=100)
p <- predict(acid.fit,data.frame(t1=grid,x1=0,x2=0),
terms=c(0,1,0,0,1,0))
# extract the main effect of (x1,x2)
grid <- expand.grid(x1=seq(min(acid$x1),max(acid$x1),length=20),
x2=seq(min(acid$x2),max(acid$x2),length=20))
p <- predict(acid.fit,data.frame(t1=0,x1=grid$x1,x2=grid$x2),
terms=c(0,0,1,1,0,1),pstd=FALSE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.