predict.bgnlm_model {FBMS}R Documentation

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 class 'bgnlm_model'
predict(
  object,
  x,
  link = function(x) {
     x
 },
  ...
)

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.

...

Additional arguments to pass to prediction function.

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.

Examples

## Not run: 
# Example with simulated data
set.seed(123)
x_train <- data.frame(PlanetaryMassJpt = rnorm(100), RadiusJpt = rnorm(100))
model <- list(
  coefs = c(Intercept = -0.5, PlanetaryMassJpt = 0.2, RadiusJpt = -0.1),
  class = "bgnlm_model"
)
class(model) <- "bgnlm_model"

# New data for prediction
x_new <- data.frame(PlanetaryMassJpt = c(0.1, -0.3), RadiusJpt = c(0.2, -0.1))

# Predict using the identity link (default)
preds <- predict.bgnlm_model(model, x_new)

## End(Not run)


[Package FBMS version 1.1 Index]