predict.bsamdpm: Predict method for a bsamdpm object

predict.bsamdpmR 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-α)% credible intervals.

HPD

a logical variable indicating whether the 100(1-α)% Highest Posterior Density (HPD) intervals are calculated. If HPD=FALSE, the 100(1-α)% 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-α)% 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)

bsamGP documentation built on March 18, 2022, 7:35 p.m.