Learn R Programming

psycModel (version 0.5.0)

glm_model: Generalized Linear Regression

Description

[Experimental]
Fit a generalized linear regression using glm(). This function is still in early development stage.

Usage

glm_model(
  data,
  response_variable,
  predictor_variable,
  two_way_interaction_factor = NULL,
  three_way_interaction_factor = NULL,
  family,
  quite = FALSE
)

Value

an object class of glm representing the linear regression fit

Arguments

data

data.frame

response_variable

response variable. Support dplyr::select() syntax.

predictor_variable

predictor variable. Support dplyr::select() syntax.

two_way_interaction_factor

two-way interaction factors. You need to pass 2+ factor. Support dplyr::select() syntax.

three_way_interaction_factor

three-way interaction factor. You need to pass exactly 3 factors. Specifying three-way interaction factors automatically included all two-way interactions, so please do not specify the two_way_interaction_factor argument. Support dplyr::select() syntax.

family

a GLM family. It will passed to the family argument in glmer. See ?glmer for possible options.

quite

suppress printing output

Examples

Run this code
fit <- glm_model(
  response_variable = incidence,
  predictor_variable = period,
  family = "poisson", # or you can enter as poisson(link = 'log'),
  data = lme4::cbpp
)

Run the code above in your browser using DataLab