glm.multinomial: Creates a Multinomial GLM family object.

View source: R/glm.R

glm.multinomialR Documentation

Creates a Multinomial GLM family object.

Description

A GLM family object specifies the type of model fit, provides the appropriate response object and makes sure it is represented in the right form for the model family, and allows for optional parameters such as a weight vector.

Usage

glm.multinomial(y, weights = NULL)

Arguments

y

Response matrix with K>1 columns, and row sums equal to 1. This can either be a "one-hot" encoded version of a K-category factor variable, or else a matrix of proportions. This is useful for grouped multinomial data, where column y[i, k] represents the proportion of outcomes in category k in n[i] trials. Then the corresponding element of the weight vector is w[i]=n[i].

weights

Observation weights.

Value

Multinomial GLM object.

Author(s)

James Yang, Trevor Hastie, and Balasubramanian Narasimhan
Maintainer: Trevor Hastie hastie@stanford.edu

See Also

glm.gaussian, glm.binomial, glm.poisson, glm.multinomial, glm.multigaussian, glm.cox.

Examples

n <- 100
K <- 5
y <- t(rmultinom(n, 1, rep(1/K, K)))
obj <- glm.multinomial(y)

adelie documentation built on Sept. 11, 2024, 6:36 p.m.