stay R In the software, the dependent variable of ordered classification is analyzed Logistics perhaps Probit regression , It can be used MASS It's in the bag polr Function , The position structure model is used in this function . The format of this function is as follows ：
plor(formula, data, weights, method=c("logistic", "probit", "loglog",
"cloglog", "cauchit"))

This example uses MASS In the bag housing data set , The data set is a survey of housing in Copenhagen . These include 5 Variables , They are ： Homeowners' satisfaction with their current home （ high , in , low ）, Recorded as Sat It's an ordered variable ; The degree to which homeowners consider the impact of property management （ high , in , low ）, Recorded as Infl; Types of rental housing （ Tower style , Stalls , apartment , Sleeping out ）, Recorded as Type; Communication with other residents （ low , high ）, Recorded as Cont; Number of residents per group , Recorded as Freq, Among them, a total of
3 ∗ 3 ∗ 4 ∗ 2 = 72 3*3*4*2=723∗3∗4∗2=72
Groups . with Sat Is the dependent variable ,Infl,Type,Cont Is an independent variable , establish Logistics regression model , among Freq For weight .

The code implementation of regression is as follows ：
library(MASS) house.plr<-polr(Sat~Infl+Type+Cont,weights=Freq,data=housing)
summary(house.plr)
The output is ：

The output results are given InflLow,TypeTower,ContLow Corresponding coefficient , Because their coefficients are 0, With the above regression coefficient, you can write the corresponding regression model .
in addition , We can use functions predict(house.plr) Output the predicted value of the ordered variable p ^ \hat{p} p^​
, And compared with the real value Sat Compare , In order to analyze the probability of making correct judgment . The results are shown in the table below .

In the table 1 Indicates low ,2 In expression ,3 High , Comparing the predicted value with the real value, it is easy to see that the probability of correct judgment is 1 / 3 1/3 1/3
, It shows that the model is not ideal , It may be that the influence of independent variables on dependent variables is not significant enough , For better results , Important independent variables need to be considered .

Ordered data contains more information than classified data , Theoretically, the effect of ordinal data dependent variable regression should be better than that of categorical data dependent variable regression . But from the practical application effect , The effect of ordinal data dependent variable regression is often unsatisfactory , Its regression model is also under research and development .

Technology
Daily Recommendation