predict.frfast: Prediction from fitted 'frfast' model

View source: R/predict.frfast.R

predict.frfastR Documentation

Prediction from fitted frfast model

Description

Takes a fitted frfast object and produces predictions (with their 95% confidence intervals) from a fitted model with interactions or without interactions.

Usage

## S3 method for class 'frfast'
predict(object = model, newdata, fac = NULL, der = NULL, seed = NULL, ...)

Arguments

object

A fitted frfast object as produced by frfast().

newdata

A data frame containing the values of the model covariates at which predictions are required. If newdata is provided, then it should contain all the variables needed for prediction: a warning is generated if not.

fac

Factor's level to take into account. By default is NULL.

der

Number which determines any inference process. By default der is NULL. If this term is 0, the function returns the initial estimate. If it is 1 or 2, it is designed for the first or second derivative, respectively.

seed

Seed to be used in the bootstrap procedure.

...

Other options.

Value

predict.frfast computes and returns a list containing predictions of the estimates, first and second derivative, with their 95% confidence intervals.

Author(s)

Marta Sestelo, Nora M. Villanueva and Javier Roca-Pardinas.

Examples

library(npregfast)
data(barnacle)

# Nonparametric regression without interactions
fit <- frfast(DW ~ RC, data = barnacle, nboot = 100)
nd <- data.frame(RC = c(10, 14, 18))
predict(fit, newdata = nd)

# Nonparametric regression with interactions
# fit2 <- frfast(DW ~ RC : F, data = barnacle, nboot = 100)
# nd2 <- data.frame(RC = c(10, 15, 20))
# predict(fit2, newdata = nd2)
# predict(fit2, newdata = nd2, der = 0, fac = "barca")
 

npregfast documentation built on Sept. 2, 2022, 5:07 p.m.