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 |
x |
A |
link |
A link function to apply to the linear predictor.
By default, it is the identity function |
... |
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)