gamfit: Generalized additive model fitting

View source: R/gamfit.R

gamfitR Documentation

Generalized additive model fitting

Description

This function fits a GAM to the data

Usage

gamfit(
  wdata,
  dependent = NA,
  independent = NA,
  linear_covariates = NA,
  smooth_covariates = NA,
  rnt_dependent = FALSE,
  return_prediction = FALSE,
  new_prediction_data = NA,
  exposure_trait = NA
)

Arguments

wdata

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

dependent

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

independent

a single string character of the column name for the independent or explanatory variable that will be modeled as a smooth. This can be left NA, and you can instead add the exposure trait to the list of "linear_covariates", to define a null model where the exposure is modeled as a parametric term.

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.

rnt_dependent

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

exposure_trait

a single string character of the column name with the focus exposure trait of interest. If the "dependent" is set to NA, the string defined here will be used to estimate exposure summary stats (n, mean, min, max, sd) for your model.

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

gamfit()

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