predict.bsam {bsamGP} | R Documentation |
Predict method for a bsam object
Description
Computes the predicted values of Bayesian spectral analysis models.
Usage
## S3 method for class 'bsam'
predict(object, newp, newnp, alpha = 0.05, HPD = TRUE, type = "response", ...)
Arguments
object |
a |
newp |
an optional data of parametric components with which to predict. If omitted, the fitted values are returned. |
newnp |
an optional data of nonparametric components with which to predict. If omitted, the fitted values are returned. |
alpha |
a numeric scalar in the interval (0,1) giving the |
HPD |
a logical variable indicating whether the |
type |
the type of prediction required. |
... |
not used |
Details
None.
Value
A list object of class predict.bsam
containing posterior means and 100(1-\alpha)
% credible intervals.
The output list includes the following objects:
fxobs |
posterior estimates for unknown functions over observation. |
wbeta |
posterior estimates for parametric part. |
yhat |
posterior estimates for fitted values of either response or expectation of response.
For |
fxResid |
posterior estimates for fitted parametric residuals. Not applicable for |
See Also
Examples
## Not run:
##########################################
# Increasing Convex to Concave (S-shape) #
##########################################
# simulate data
f <- function(x) 5*exp(-10*(x - 1)^4) + 5*x^2
set.seed(1)
n <- 100
x <- runif(n)
y <- f(x) + rnorm(n, sd = 1)
# Number of cosine basis functions
nbasis <- 50
# Fit the model with default priors and mcmc parameters
fout <- bsar(y ~ fs(x), nbasis = nbasis, shape = 'IncreasingConvex',
spm.adequacy = TRUE)
# Prediction
xnew <- runif(n)
predict(fout, newnp = xnew)
## End(Not run)