xpose.gam: Stepwise GAM search for covariates on a parameter (Xpose 4)

View source: R/xpose.gam.R

xpose.gamR Documentation

Stepwise GAM search for covariates on a parameter (Xpose 4)

Description

Function takes an Xpose object and performs a generalized additive model (GAM) stepwise search for influential covariates on a single model parameter.

Usage

xpose.gam(
  object,
  parnam = xvardef("parms", object)[1],
  covnams = xvardef("covariates", object),
  trace = TRUE,
  scope = NULL,
  disp = object@Prefs@Gam.prefs$disp,
  start.mod = object@Prefs@Gam.prefs$start.mod,
  family = "gaussian",
  wts.data = object@Data.firstonly,
  wts.col = NULL,
  steppit = object@Prefs@Gam.prefs$steppit,
  subset = xsubset(object),
  onlyfirst = object@Prefs@Gam.prefs$onlyfirst,
  medianNorm = object@Prefs@Gam.prefs$medianNorm,
  nmods = object@Prefs@Gam.prefs$nmods,
  smoother1 = object@Prefs@Gam.prefs$smoother1,
  smoother2 = object@Prefs@Gam.prefs$smoother2,
  smoother3 = object@Prefs@Gam.prefs$smoother3,
  smoother4 = object@Prefs@Gam.prefs$smoother4,
  arg1 = object@Prefs@Gam.prefs$arg1,
  arg2 = object@Prefs@Gam.prefs$arg2,
  arg3 = object@Prefs@Gam.prefs$arg3,
  arg4 = object@Prefs@Gam.prefs$arg4,
  excl1 = object@Prefs@Gam.prefs$excl1,
  excl2 = object@Prefs@Gam.prefs$excl2,
  excl3 = object@Prefs@Gam.prefs$excl3,
  excl4 = object@Prefs@Gam.prefs$excl4,
  extra = object@Prefs@Gam.prefs$extra,
  ...
)

Arguments

object

An xpose.data object.

parnam

ONE (and only one) model parameter name.

covnams

Covariate names to test on parameter.

trace

TRUE if you want GAM output to screen.

scope

Scope of the GAM search.

disp

If dispersion should be used in the GAM object.

start.mod

Starting model.

family

Assumption for the parameter distribution.

wts.data

Weights on the least squares fitting of parameter vs. covariate. Often one can use the variances of the individual parameter values as weights. This data frame must have column with name ID and any subset variable as well as the variable defined by the wts.col.

wts.col

Which column in the wts.data to use.

steppit

TRUE for stepwise search, false for no search.

subset

Subset on data.

onlyfirst

TRUE if only the first row of each individual's data is to be used.

medianNorm

Normalize to the median of parameter and covariates.

nmods

Number of models to examine.

smoother1

Smoother for each model.

smoother2

Smoother for each model.

smoother3

Smoother for each model.

smoother4

Smoother for each model.

arg1

Argument for model 1.

arg2

Argument for model 2.

arg3

Argument for model 3.

arg4

Argument for model 4.

excl1

Covariate exclusion from model 1.

excl2

Covariate exclusion from model 2.

excl3

Covariate exclusion from model 3.

excl4

Covariate exclusion from model 4.

extra

Extra exclusion criteria.

...

Used to pass arguments to more basic functions.

Value

Returned is a step.Gam object. In this object the step-wise-selected model is returned, with up to two additional components. There is an "anova" component corresponding to the steps taken in the search, as well as a "keep" component if the "keep=" argument was supplied in the call.

Author(s)

E. Niclas Jonsson, Mats Karlsson, Andrew Hooker & Justin Wilkins

See Also

step.gam

Other GAM functions: GAM_summary_and_plot, xp.get.disp(), xp.scope3(), xpose.bootgam(), xpose4-package

Examples

## Run a GAM using the example xpose database 
gam_ka <- xpose.gam(simpraz.xpdb, parnam="KA")

## Summarize GAM
xp.summary(gam_ka)

## GAM residuals of base model vs. covariates
xp.plot(gam_ka)

## An Akaike plot of the results
xp.akaike.plot(gam_ka)

## Studentized residuals
xp.ind.stud.res(gam_ka)

## Individual influence on GAM fit
xp.ind.inf.fit(gam_ka)

## Individual influence on GAM terms
xp.ind.inf.terms(gam_ka)

## Individual parameters to GAM fit
xp.cook(gam_ka)


xpose4 documentation built on May 31, 2022, 5:07 p.m.