predict.modeler | R Documentation |
modeler
Generate model predictions from an object of class modeler
.
This function allows for flexible prediction types, including point predictions,
area under the curve (AUC), first or second order derivatives, and functions
of the parameters.
## S3 method for class 'modeler'
predict(
object,
x = NULL,
id = NULL,
type = c("point", "auc", "fd", "sd"),
se_interval = c("confidence", "prediction"),
n_points = 1000,
formula = NULL,
metadata = FALSE,
parallel = FALSE,
workers = NULL,
...
)
object |
An object of class |
x |
A numeric value or vector specifying the points at which predictions
are made. For |
id |
Optional unique identifier to filter predictions by a specific group. Default is |
type |
A character string specifying the type of prediction. Default is "point".
|
se_interval |
A character string specifying the type of interval for
standard error calculation. Options are |
n_points |
An integer specifying the number of points used to approximate
the area under the curve (AUC) when |
formula |
A formula specifying a function of the parameters to be estimated (e.g., |
metadata |
Logical. If |
parallel |
Logical. If |
workers |
The number of parallel processes to use. |
... |
Additional parameters for future functionality. |
A data.frame
containing the predicted values,
their associated standard errors, and optionally the metadata.
Johan Aparicio [aut]
library(flexFitR)
data(dt_potato)
mod_1 <- dt_potato |>
modeler(
x = DAP,
y = Canopy,
grp = Plot,
fn = "fn_lin_plat",
parameters = c(t1 = 45, t2 = 80, k = 0.9),
subset = c(15, 2, 45)
)
print(mod_1)
# Point Prediction
predict(mod_1, x = 45, type = "point", id = 2)
# AUC Prediction
predict(mod_1, x = c(0, 108), type = "auc", id = 2)
# First Derivative
predict(mod_1, x = 45, type = "fd", id = 2)
# Second Derivative
predict(mod_1, x = 45, type = "sd", id = 2)
# Function of the parameters
predict(mod_1, formula = ~ t2 - t1, id = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.