fit_models: Fit many regression models based on a vector of formulas

Description Usage Arguments Details Value See Also Examples

View source: R/fit_models.R

Description

Fit many regression models based on a vector of formulas

Usage

1
2
3
4
5
6
7
8
fit_models(
  formulas,
  fitter = lm,
  ...,
  output = FALSE,
  print = TRUE,
  texreg = list()
)

Arguments

formulas

A vector of formulas.

fitter

fitting function or vector of fitting functions (default: lm).

...

other arguments passed to fitting function.

output

Return estimated models in a list?

print

Print a regression table?

texreg

A named list with arguments passed to screenreg if print=TRUE.

Details

This simple function estimates a series of regression models based on a vector of formulas. The argument fitter allows to call any formula-based fitting function in R (e.g., lm, glm). The function provides options to summarize the regressions in a regression table and/or to store the fit objects in a named list which can passed on.

Value

either NULL or the list of fitted model objects.

See Also

screenreg

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
data(mtcars)

f_lm <- c(
	mpg ~ vs, 
	hp ~ vs, 
	disp ~ vs * am)

fit_models(f_lm, fitter=lm, data=mtcars, 
	output=FALSE, print=TRUE)

f_glm <- c(
	vs ~ mpg, 
	am ~ mpg)

mods <- fit_models(f_glm, fitter=glm, data=mtcars, 
	family=binomial('logit'), 
	output=TRUE, print=TRUE, 
	texreg=list(stars=NULL))

lapply(mods, nobs)

sumtxt/saltr documentation built on Dec. 31, 2020, 7:36 a.m.