predict.bsamdpm {bsamGP}R Documentation

Predict method for a bsamdpm object

Description

Computes the predicted values of Bayesian spectral analysis models with Dirichlet process mixture errors.

Usage

## S3 method for class 'bsamdpm'
predict(object, newp, newnp, alpha = 0.05, HPD = TRUE, ...)

Arguments

object

a bsamdpm object

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 100(1-\alpha)% credible intervals.

HPD

a logical variable indicating whether the 100(1-\alpha)% Highest Posterior Density (HPD) intervals are calculated. If HPD=FALSE, the 100(1-\alpha)% equal-tail credible intervals are calculated. The default is TRUE.

...

not used

Details

None.

Value

A list object of class predict.bsamdpm 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 response.

See Also

bsaqdpm, bsardpm

Examples

## Not run: 

#####################
# Increasing-convex #
#####################

# Simulate data
set.seed(1)

n <- 200
x <- runif(n)
e <- c(rnorm(n/2, sd = 0.5), rnorm(n/2, sd = 3))
y <- exp(6*x - 3) + e

# Number of cosine basis functions
nbasis <- 50

# Fit the model with default priors and mcmc parameters
fout <- bsardpm(y ~ fs(x), nbasis = nbasis, shape = 'IncreasingConvex')

# Prediction
xnew <- runif(n)
predict(fout, newnp = xnew)


## End(Not run)

[Package bsamGP version 1.2.5 Index]