"R polr()"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-<source +<syntaxhighlight , -</source> +</syntaxhighlight>))
 
3번째 줄: 3번째 줄:
* "Ordered Logistic Or Probit Regression"
* "Ordered Logistic Or Probit Regression"


<source lang='r' notebook>
<syntaxhighlight lang='r' notebook>
library(MASS)
library(MASS)
options(contrasts = c("contr.treatment", "contr.poly"))
options(contrasts = c("contr.treatment", "contr.poly"))
house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
house.plr
house.plr
</source>
</syntaxhighlight>
<source lang='r' notebook>
<syntaxhighlight lang='r' notebook>
summary(house.plr, digits = 3)
summary(house.plr, digits = 3)
</source>
</syntaxhighlight>
<source lang='r' notebook>
<syntaxhighlight lang='r' notebook>
summary(update(house.plr, method = "probit", Hess = TRUE), digits = 3)
summary(update(house.plr, method = "probit", Hess = TRUE), digits = 3)
</source>
</syntaxhighlight>
<source lang='r' notebook>
<syntaxhighlight lang='r' notebook>
summary(update(house.plr, method = "loglog", Hess = TRUE), digits = 3)
summary(update(house.plr, method = "loglog", Hess = TRUE), digits = 3)
</source>
</syntaxhighlight>
<source lang='r' notebook>
<syntaxhighlight lang='r' notebook>
summary(update(house.plr, method = "cloglog", Hess = TRUE), digits = 3)
summary(update(house.plr, method = "cloglog", Hess = TRUE), digits = 3)
</source>
</syntaxhighlight>
<source lang='r' notebook>
<syntaxhighlight lang='r' notebook>
predict(house.plr, housing, type = "p")
predict(house.plr, housing, type = "p")
</source>
</syntaxhighlight>
<source lang='r' notebook>
<syntaxhighlight lang='r' notebook>
addterm(house.plr, ~.^2, test = "Chisq")
addterm(house.plr, ~.^2, test = "Chisq")
</source>
</syntaxhighlight>
<source lang='r' notebook>
<syntaxhighlight lang='r' notebook>
house.plr2 <- stepAIC(house.plr, ~.^2)
house.plr2 <- stepAIC(house.plr, ~.^2)
</source>
</syntaxhighlight>
<source lang='r' notebook>
<syntaxhighlight lang='r' notebook>
house.plr2$anova
house.plr2$anova
</source>
</syntaxhighlight>
<source lang='r' notebook>
<syntaxhighlight lang='r' notebook>
anova(house.plr, house.plr2)
anova(house.plr, house.plr2)
</source>
</syntaxhighlight>
<source lang='r' notebook>
<syntaxhighlight lang='r' notebook>
house.plr <- update(house.plr, Hess=TRUE)
house.plr <- update(house.plr, Hess=TRUE)
pr <- profile(house.plr)
pr <- profile(house.plr)
confint(pr)
confint(pr)
</source>
</syntaxhighlight>
<source lang='r' notebook>
<syntaxhighlight lang='r' notebook>
plot(pr)
plot(pr)
</source>
</syntaxhighlight>
<source lang='r' notebook>
<syntaxhighlight lang='r' notebook>
pairs(pr)
pairs(pr)
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2021년 5월 7일 (금) 19:30 기준 최신판

1 개요[ | ]

R polr()
  • "Ordered Logistic Or Probit Regression"
R
Reload
Copy
library(MASS)
options(contrasts = c("contr.treatment", "contr.poly"))
house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
house.plr
Loading
Copy
summary(house.plr, digits = 3)
Loading
Copy
summary(update(house.plr, method = "probit", Hess = TRUE), digits = 3)
Loading
Copy
summary(update(house.plr, method = "loglog", Hess = TRUE), digits = 3)
Loading
Copy
summary(update(house.plr, method = "cloglog", Hess = TRUE), digits = 3)
Loading
Copy
predict(house.plr, housing, type = "p")
Loading
Copy
addterm(house.plr, ~.^2, test = "Chisq")
Loading
Copy
house.plr2 <- stepAIC(house.plr, ~.^2)
Loading
Copy
house.plr2$anova
Loading
Copy
anova(house.plr, house.plr2)
Loading
Copy
house.plr <- update(house.plr, Hess=TRUE)
pr <- profile(house.plr)
confint(pr)
Loading
Copy
plot(pr)
Loading
Copy
pairs(pr)
Loading

2 같이 보기[ | ]

3 참고[ | ]