Skip to content

Instantly share code, notes, and snippets.

@smc77
Created October 28, 2011 03:28
Show Gist options
  • Save smc77/1321556 to your computer and use it in GitHub Desktop.
Save smc77/1321556 to your computer and use it in GitHub Desktop.
Multiclass Logistic Regression
# Plot the data
pairs(iris[1:4], main = "Anderson's Iris Data -- 3 species", pch = 21, bg = c("red", "green3", "blue")[unclass(iris$Species)])
# Use linear discriminant analysis
iris.lda <- lda(Species ~ ., data = iris)
summary(iris.lda)
# Use a multinomial logistic regression model
library(VGAM)
iris.vglm <- glm(Species ~ , family=multinomial, data=iris)
summary(iris.vglm)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment