fitModel: Fit models

View source: R/modelfitting.R

fitModelR Documentation

Fit models

Description

Wrapper function for 'lm', 'glm', and 'svyglm'.

Usage

fitModel(
  y,
  x,
  data,
  family = "gaussian",
  link = switch(family, gaussian = "gaussian", binomial = "logit", poisson = "log",
    negbin = "log"),
  design = "simple",
  svydes = NA,
  surv_params = NULL,
  ...
)

Arguments

y

character string representing the response,

x

character string of the explanatory variables,

data

name of the object containing the data.

family

gaussian, binomial, poisson (so far, no others will be added)

link

the link function to use

design

data design specification. one of 'simple', 'survey' or 'experiment'

svydes

a vector of arguments to be passed to the svydesign function, excluding data (defined above)

surv_params

a vector containing arguments for survival::Surv()

...

further arguments to be passed to lm, glm, svyglm, such as offset, etc.

Value

A model call formula (using lm, glm, or svyglm)

Author(s)

Tom Elliott


iNZightVIT/iNZightTools documentation built on April 8, 2024, 10:25 a.m.