Learn R Programming

FBMS (version 1.3)

predict.bgnlm_model: Predict Responses from a BGNLM Model

Description

This function generates predictions from a fitted bgnlm_model object given a new dataset.

Usage

# S3 method for bgnlm_model
predict(
  object,
  x,
  link = function(x) {
     x
 },
  x_train = NULL,
  ...
)

Value

A numeric vector of predicted values for the given data x. These predictions are calculated as \(\hat{y} = \text{link}(X \beta)\), where \(X\) is the design matrix and \(\beta\) are the model coefficients.

Arguments

object

A fitted bgnlm_model object obtained from the BGNLM fitting procedure. It should contain the estimated coefficients in model$coefs.

x

A data.frame containing the new data for which predictions are to be made. The variables in x must match the features used in the model.

link

A link function to apply to the linear predictor. By default, it is the identity function function(x){x}, but it can be any function such as plogis for logistic regression models.

x_train

Training design matrix to be provided when imputations are to be made from them

...

Additional arguments to pass to prediction function.

Examples

Run this code
data(exoplanet)
model <- fbms(semimajoraxis ~ ., data = exoplanet)
preds <- predict(get.best.model(model), exoplanet[,-1])

Run the code above in your browser using DataLab