Satisfaction of life in own city dataset


res <- ordinal_regression_simplex(
  xdata,
  ydata,
  weights = weights_orig,
  weights_product = list(a,b),
  return_tensor_index = TRUE,
  lambda1_grid = 0,
  compute_opi = TRUE,
  compute_R2 = TRUE,
  compute_OCC = TRUE
)

cat("Estimated A_hat\n")
## Estimated A_hat
A<-res$A_hat
colnames(A) <- apply(res$tensor_index, 1, function(v) paste0("(", v[1], ",", v[2], ")"))
print(round(A, 4))
##       (1,1)  (1,2)  (2,1)  (1,3)  (3,1)  (2,2)  (1,4)  (2,3)  (3,2)  (4,1)
## [1,] 0.9718 0.8998 0.8139 0.7280 0.6421 0.5563 0.4704 0.3845 0.2986 0.2128
## [2,] 0.0000 0.0047 0.0415 0.1311 0.2817 0.4324 0.5239 0.6155 0.7014 0.7872
## [3,] 0.0000 0.0725 0.1268 0.1283 0.0687 0.0092 0.0046 0.0000 0.0000 0.0000
## [4,] 0.0282 0.0230 0.0178 0.0126 0.0074 0.0022 0.0011 0.0000 0.0000 0.0000
##       (3,3)  (2,4)  (4,2)  (3,4)  (4,3)  (4,4)
## [1,] 0.1702 0.1277 0.0852 0.0568 0.0284 0.0000
## [2,] 0.8298 0.7699 0.5880 0.3920 0.1960 0.0000
## [3,] 0.0000 0.1024 0.2574 0.4124 0.4049 0.3973
## [4,] 0.0000 0.0000 0.0694 0.1387 0.3707 0.6027
cat("Wasserstein R2\n")
## Wasserstein R2
print(res$R2)
## [1] 0.4737661
cat("Ordinal Preservation Index (OPI)\n")
## Ordinal Preservation Index (OPI)
print(res$OPI)
## [1] 0.8245666
cat("Ordinal Compositional Correlation (OCC)\n")
## Ordinal Compositional Correlation (OCC)
print(res$OCC)
## [1] 0.8220268