[R] glm.fit when family argument is not a "family" object

Mathew McLean mmclean at stat.tamu.edu
Sun Feb 22 22:55:34 CET 2015


The documentation for glm/glm.fit indicates that the family argument "can
be a character string naming a family function, a family function or the
result of a call to a family function".

glm.fit(1, 1, family = "gaussian")

## Error: $ operator is invalid for atomic vectors

glm.fit(1, 1, family = gaussian)

​## Error: object of type 'closure' is not subsettable

glm.fit(1, 1, family = gaussian())  # works​, results omitted

sessionInfo()

## R version 3.1.2 Patched (2015-02-20 r67856)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 7 x64 (build 7601) Service Pack 1

## locale:
## [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United
States.1252
## [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C

## [5] LC_TIME=English_United States.1252

## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base

## loaded via a namespace (and not attached):
## [1] tools_3.1.2


-- 
Mathew W. McLean
Research Assistant Professor
462 Blocker Building
Texas A&M University
www.stat.tamu.edu/~mmclean

	[[alternative HTML version deleted]]



More information about the R-help mailing list