Learn R Programming

adelie (version 1.0.7)

glm.multinomial: 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)

Value

Multinomial GLM object.

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.

Author

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

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

Run the code above in your browser using DataLab