Data Respon Multinomial-Ordinal

## GLM Multinom-Ordinal: Agresti (2015), hlm: 219, "Mental-Impairment"
## Data: https://users.stat.ufl.edu/~aa/glm/data/ 
## library(VGAM)

Data.Mental <- read.table(file="Mental.txt", header = TRUE)
Data.Mental
## Model Proportional Odd : parallel=TRUE

model_ordinal <- vglm(impair ~ life + ses, family=cumulative(parallel=TRUE), 
                      data = Data.Mental) 

summary(model_ordinal)
## Call:
## vglm(formula = impair ~ life + ses, family = cumulative(parallel = TRUE), 
##     data = Data.Mental)
## 
## Coefficients: 
##               Estimate Std. Error z value Pr(>|z|)   
## (Intercept):1  -0.2819     0.6231  -0.452  0.65096   
## (Intercept):2   1.2128     0.6511   1.863  0.06251 . 
## (Intercept):3   2.2094     0.7171   3.081  0.00206 **
## life           -0.3189     0.1194  -2.670  0.00759 **
## ses             1.1112     0.6143   1.809  0.07045 . 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Names of linear predictors: logitlink(P[Y<=1]), logitlink(P[Y<=2]), 
## logitlink(P[Y<=3])
## 
## Residual deviance: 99.0979 on 115 degrees of freedom
## 
## Log-likelihood: -49.5489 on 115 degrees of freedom
## 
## Number of Fisher scoring iterations: 5 
## 
## No Hauck-Donner effect found in any of the estimates
## 
## 
## Exponentiated coefficients:
##      life       ses 
## 0.7269742 3.0380707
predict(model_ordinal)
##    logitlink(P[Y<=1]) logitlink(P[Y<=2]) logitlink(P[Y<=3])
## 1           0.5104714         2.00516276          3.0017401
## 2          -2.0404427        -0.54575132          0.4508261
## 3           0.8293356         2.32402702          3.3206044
## 4          -0.4461214         1.04856998          2.0451474
## 5          -0.1272572         1.36743424          2.3640116
## 6          -0.9196156         0.57507583          1.5716532
## 7          -0.6007513         0.89394009          1.8905175
## 8          -0.1272572         1.36743424          2.3640116
## 9          -0.1272572         1.36743424          2.3640116
## 10         -1.4027142         0.09197720          1.0885546
## 11         -0.6007513         0.89394009          1.8905175
## 12         -0.9196156         0.57507583          1.5716532
## 13         -0.7649857         0.72970572          1.7262831
## 14         -2.1950726        -0.70038121          0.2961962
## 15         -0.1272572         1.36743424          2.3640116
## 16         -0.6007513         0.89394009          1.8905175
## 17         -1.7215785        -0.22688706          0.7696903
## 18          0.1916071         1.68629850          2.6828759
## 19         -1.8762084        -0.38151695          0.6150604
## 20         -0.7649857         0.72970572          1.7262831
## 21         -2.0404427        -0.54575132          0.4508261
## 22         -1.2384798         0.25621157          1.2527889
## 23         -0.1272572         1.36743424          2.3640116
## 24          0.5104714         2.00516276          3.0017401
## 25         -0.2818871         1.21280435          2.2093817
## 26         -0.4461214         1.04856998          2.0451474
## 27         -1.2384798         0.25621157          1.2527889
## 28         -3.1516654        -1.65697399         -0.6603966
## 29         -1.0838499         0.41084146          1.4074188
## 30         -1.5573441        -0.06265269          0.9339247
## 31         -1.2384798         0.25621157          1.2527889
## 32         -1.7215785        -0.22688706          0.7696903
## 33          0.1916071         1.68629850          2.6828759
## 34         -1.4027142         0.09197720          1.0885546
## 35         -1.8762084        -0.38151695          0.6150604
## 36         -1.5573441        -0.06265269          0.9339247
## 37         -1.5573441        -0.06265269          0.9339247
## 38         -1.7215785        -0.22688706          0.7696903
## 39         -2.8328011        -1.33810973         -0.3415324
## 40         -3.1516654        -1.65697399         -0.6603966
## Prediksi nilai peluang untuk tiap kategori respon ordinal

fitted(model_ordinal)
##             1         2          3          4
## 1  0.62491696 0.2564211 0.07131461 0.04734732
## 2  0.11502166 0.2518290 0.24398492 0.38916438
## 3  0.69621443 0.2146331 0.05428144 0.03487106
## 4  0.39028333 0.3502169 0.14495617 0.11454363
## 5  0.46822857 0.3287367 0.11707622 0.08595848
## 6  0.28503623 0.3548973 0.18808559 0.17198084
## 7  0.35417182 0.3555308 0.15911192 0.13118548
## 8  0.46822857 0.3287367 0.11707622 0.08595848
## 9  0.46822857 0.3287367 0.11707622 0.08595848
## 10 0.19738576 0.3255923 0.22513134 0.25189056
## 11 0.35417182 0.3555308 0.15911192 0.13118548
## 12 0.28503623 0.3548973 0.18808559 0.17198084
## 13 0.31756480 0.3571759 0.17419568 0.15106363
## 14 0.10019384 0.2315339 0.24178466 0.42648762
## 15 0.46822857 0.3287367 0.11707622 0.08595848
## 16 0.35417182 0.3555308 0.15911192 0.13118548
## 17 0.15166796 0.2918524 0.23993358 0.31654610
## 18 0.54775576 0.2959810 0.09227184 0.06399141
## 19 0.13282500 0.2729361 0.24333321 0.35090571
## 20 0.31756480 0.3571759 0.17419568 0.15106363
## 21 0.11502166 0.2518290 0.24398492 0.38916438
## 22 0.22470070 0.3390041 0.21407748 0.22221773
## 23 0.46822857 0.3287367 0.11707622 0.08595848
## 24 0.62491696 0.2564211 0.07131461 0.04734732
## 25 0.42999120 0.3408036 0.13029406 0.09891116
## 26 0.39028333 0.3502169 0.14495617 0.11454363
## 27 0.22470070 0.3390041 0.21407748 0.22221773
## 28 0.04102571 0.1191429 0.18048190 0.65934948
## 29 0.25277814 0.3485115 0.20206888 0.19664149
## 30 0.17402808 0.3103139 0.23352889 0.28212916
## 31 0.22470070 0.3390041 0.21407748 0.22221773
## 32 0.15166796 0.2918524 0.23993358 0.31654610
## 33 0.54775576 0.2959810 0.09227184 0.06399141
## 34 0.19738576 0.3255923 0.22513134 0.25189056
## 35 0.13282500 0.2729361 0.24333321 0.35090571
## 36 0.17402808 0.3103139 0.23352889 0.28212916
## 37 0.17402808 0.3103139 0.23352889 0.28212916
## 38 0.15166796 0.2918524 0.23993358 0.31654610
## 39 0.05557719 0.1522439 0.20761621 0.58456270
## 40 0.04102571 0.1191429 0.18048190 0.65934948
## Prediksi nilai peluang untuk nilai x tertentu

baru <- data.frame(life = 4.3, ses = 1)
predict(model_ordinal, newdata = baru, type = "response")
##           1         2         3         4
## 1 0.3677734 0.3539267 0.1536906 0.1246092