gam_predict: Generalized additive model fitting

View source: R/gam_predict.R

gam_predictR Documentation

Generalized additive model fitting

Description

This function fits a GAM to the data

Usage

gam_predict(
  wdata,
  outcome = NA,
  exposure = NA,
  linear_covariates = NA,
  smooth_covariates = NA,
  rnt_outcome = FALSE,
  return_prediction_only = TRUE,
  prediction_n = 25,
  outlier_cutoff = 5,
  outlier_method = "iqr",
  new_pred_data_frame = NA,
  messages = FALSE
)

Arguments

wdata

a data frame passed to function containing necessary data for analysis.

outcome

a single string character of the column name for the dependent or response variable.

exposure

a single string character of the column name for the independent or explanatory variable.

linear_covariates

a vector of string(s) that are also column names used to define variables that will be set as parametric (linear) covariates.

smooth_covariates

a vector of string(s) that are also column names used to define variables that will be set as non-linear (smooth, s()) covariates.

return_prediction_only

binary TRUE or FALSE, defaulted to TRUE, asking if only a vector of exposure predicted values should be returned or a data frame of predicted values and the variable data used in the prediction.

prediction_n

how many values should be predicted across the range of the exposure? Default is 25.

new_pred_data_frame

a data matrix containing the model independent and covariates from which exposure values should be predicted. If left as NA, an equal distant range of dependent values of length 25, and the mean of each numeric and max of each factor will be used in the prediction matrix.

messages

should verbose messages be printed to screen

rnt_dependent

binary TRUE or FALSE if the dependent or response variable should be rank normal transformed.

Value

returns a list object containing two objects, (1) 'fit' which holds the gam() model and (2) 'summary' which is a vector of summary statistics derived from the model.

Examples

gam_predict()

hughesevoanth/glsmr documentation built on May 14, 2023, 3:41 p.m.