-
Notifications
You must be signed in to change notification settings - Fork 4
/
dhaka.R
25 lines (22 loc) · 834 Bytes
/
dhaka.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
library(nnet)
dhaka=read.csv("data/dhaka.csv")
colnames(dhaka)
attach(dhaka)
dehyd = factor(dehyd)
mod.null = multinom(dehyd~1,data=dhaka)
summary(mod.null)
mod.eyes = multinom(dehyd~factor(eyes),data=dhaka)
summary(mod.eyes)
mod.eyesage = multinom(dehyd~factor(eyes)+agemonths,data=dhaka)
summary(mod.eyesage)
anova(mod.null,mod.eyes,mod.eyesage)
head(cbind(dehyd,eyes,agemonths,fitted(mod.eyesage)))
dehyd2 = relevel(dehyd,ref="1")
mod.eyesage2 = multinom(dehyd2 ~ factor(eyes)+agemonths,data=dhaka)
summary(mod.eyesage2)
head(cbind(dehyd,eyes,agemonths,fitted(mod.eyesage2)))
library(VGAM)
vglm(ordered(dehyd) ~ factor(eyes)+agemonths,family=cumulative,data=dhaka)
vglm(ordered(dehyd) ~ factor(eyes)+agemonths,family=cumulative(parallel=TRUE),data=dhaka)
library(ordinal)
clm(ordered(dehyd) ~ factor(eyes)+agemonths,data=dhaka)