The paper argues that—even in an intensely nationalized, polarized moment—Americans retain some nuanced awareness of their state‐level political environment. The four multivariate tools below extend that argument in complementary ways, letting us (i) isolate the partisan signature in respondents’ expectations, (ii) test whether state competitiveness moderates that signature, (iii) discover naturally occurring “belief profiles,” and (iv) visualise the geometry of those profiles in a low-dimensional space.
https://thehill.com/homenews/campaign/361607-how-dem-insiders-rank-the-2020-contenders/ citation for swing states
| scale_state | scale_biden | pop_biden_scale | pid7_num | income | educ | age | gender | state_fixed | biden_state | swing_state | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 2 | 0.25 | 0.00 | 1.00 | 1 | 4 | 4-year | 37 | Female | 31 | 1 | TRUE |
| 3 | 1.00 | 0.75 | 0.50 | -1 | 6 | Some college | 30 | Male | 46 | 1 | FALSE |
| 4 | 0.75 | 0.25 | 0.50 | 1 | 7 | High school graduate | 50 | Female | 45 | 1 | FALSE |
| 5 | 0.75 | 0.75 | 0.75 | 0 | 7 | 4-year | 66 | Female | 43 | 1 | FALSE |
| 6 | 0.00 | 0.00 | 0.50 | 1 | 3 | 4-year | 50 | Female | 4 | 0 | TRUE |
| 8 | 0.25 | 0.25 | 0.25 | 3 | 9 | 4-year | 64 | Female | 16 | 0 | FALSE |
## Warning in par(usr): argument 1 does not name a graphical parameter
## Warning in par(usr): argument 1 does not name a graphical parameter
## Warning in par(usr): argument 1 does not name a graphical parameter
## PC1 PC2 PC3
## Eigenvals (Variance) 2.075 0.545 0.380
## Proportion of Variance 0.692 0.182 0.127
## Cumulative Proportion 0.692 0.873 1.000
## pcompnum longman allen permutation
## 1 1 1.01 0.72 1.10
## 2 2 0.97 NA 1.02
## 3 3 0.94 NA 0.98
##
## Box's M-test for Homogeneity of Covariance Matrices
##
## data: df_da2[, c("PC1", "PC2", "income", "age")]
## Chi-Sq (approx.) = 44.415, df = 10, p-value = 2.772e-06
## Warning: The dot-dot notation (`..level..`) was deprecated in ggplot2 3.4.0.
## ℹ Please use `after_stat(level)` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## Predicted
## True Dem Rep
## Dem 401 53
## Rep 114 294
## [1] 0.806
## `stepwise classification', using 862-fold cross-validated correctness rate of method qda'.
## 862 observations of 4 variables in 2 classes; direction: both
## stop criterion: improvement less than 5%.
## correctness rate: 0.79466; in: "PC1"; variables (1): PC1
##
## hr.elapsed min.elapsed sec.elapsed
## 0.00 0.00 22.89
## method : qda
## final model : pid_bin ~ PC1
## <environment: 0x0000025d39656938>
##
## correctness rate = 0.7947
PC1 by itself does a pretty good job (≈80% accuracy) of predicting whether someone is a Democrat or Republican based solely on how positively they view Biden’s standing. The dashed line at –0.208 is the QDA‐derived threshold: to the right of it you’d predict a respondent is a Democrat, to the left a Republican.
MANOVA / Multivariate GLM Research question: Do state competitiveness (swing vs safe) and partisanship jointly shift the three belief variables?
##
## Type II MANOVA Tests:
##
## Sum of squares and products for error:
## scale_state scale_biden pop_biden_scale
## scale_state 93.47160 25.62760 27.81929
## scale_biden 25.62760 59.76309 26.60903
## pop_biden_scale 27.81929 26.60903 59.75766
##
## ------------------------------------------
##
## Term: pid7_num
##
## Sum of squares and products for the hypothesis:
## scale_state scale_biden pop_biden_scale
## scale_state 17.09066 20.09572 22.95805
## scale_biden 20.09572 23.62917 26.99478
## pop_biden_scale 22.95805 26.99478 30.83978
##
## Multivariate Tests: pid7_num
## Df test stat approx F num Df den Df Pr(>F)
## Pillai 1 0.3922422 182.646 3 849 < 2.22e-16 ***
## Wilks 1 0.6077578 182.646 3 849 < 2.22e-16 ***
## Hotelling-Lawley 1 0.6453924 182.646 3 849 < 2.22e-16 ***
## Roy 1 0.6453924 182.646 3 849 < 2.22e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## ------------------------------------------
##
## Term: swing_state
##
## Sum of squares and products for the hypothesis:
## scale_state scale_biden pop_biden_scale
## scale_state 0.81968459 0.059511840 -0.032916247
## scale_biden 0.05951184 0.004320758 -0.002389830
## pop_biden_scale -0.03291625 -0.002389830 0.001321825
##
## Multivariate Tests: swing_state
## Df test stat approx F num Df den Df Pr(>F)
## Pillai 1 0.0105793 3.025949 3 849 0.02883 *
## Wilks 1 0.9894207 3.025949 3 849 0.02883 *
## Hotelling-Lawley 1 0.0106924 3.025949 3 849 0.02883 *
## Roy 1 0.0106924 3.025949 3 849 0.02883 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## ------------------------------------------
##
## Term: educ
##
## Sum of squares and products for the hypothesis:
## scale_state scale_biden pop_biden_scale
## scale_state 0.63062083 -0.02135466 0.64084478
## scale_biden -0.02135466 0.49239859 -0.01327359
## pop_biden_scale 0.64084478 -0.01327359 1.01319479
##
## Multivariate Tests: educ
## Df test stat approx F num Df den Df Pr(>F)
## Pillai 5 0.0355802 2.042812 15 2553.000 0.01012529 *
## Wilks 5 0.9646909 2.048284 15 2344.117 0.00990493 **
## Hotelling-Lawley 5 0.0363208 2.052531 15 2543.000 0.00968888 **
## Roy 5 0.0264669 4.504670 5 851.000 0.00046529 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## ------------------------------------------
##
## Term: age
##
## Sum of squares and products for the hypothesis:
## scale_state scale_biden pop_biden_scale
## scale_state 0.0052045694 0.0050126669 -3.211061e-04
## scale_biden 0.0050126669 0.0048278402 -3.092663e-04
## pop_biden_scale -0.0003211061 -0.0003092663 1.981127e-05
##
## Multivariate Tests: age
## Df test stat approx F num Df den Df Pr(>F)
## Pillai 1 0.0001455 0.04118167 3 849 0.98886
## Wilks 1 0.9998545 0.04118167 3 849 0.98886
## Hotelling-Lawley 1 0.0001455 0.04118167 3 849 0.98886
## Roy 1 0.0001455 0.04118167 3 849 0.98886
##
## ------------------------------------------
##
## Term: income
##
## Sum of squares and products for the hypothesis:
## scale_state scale_biden pop_biden_scale
## scale_state 1.0411768 0.4239187 0.8405034
## scale_biden 0.4239187 0.1725999 0.3422138
## pop_biden_scale 0.8405034 0.3422138 0.6785071
##
## Multivariate Tests: income
## Df test stat approx F num Df den Df Pr(>F)
## Pillai 1 0.0161944 4.65845 3 849 0.003088 **
## Wilks 1 0.9838056 4.65845 3 849 0.003088 **
## Hotelling-Lawley 1 0.0164610 4.65845 3 849 0.003088 **
## Roy 1 0.0164610 4.65845 3 849 0.003088 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## ------------------------------------------
##
## Term: pid7_num:swing_state
##
## Sum of squares and products for the hypothesis:
## scale_state scale_biden pop_biden_scale
## scale_state 0.02883955 0.03308062 -0.02026285
## scale_biden 0.03308062 0.03794537 -0.02324265
## pop_biden_scale -0.02026285 -0.02324265 0.01423681
##
## Multivariate Tests: pid7_num:swing_state
## Df test stat approx F num Df den Df Pr(>F)
## Pillai 1 0.0018378 0.5210634 3 849 0.66788
## Wilks 1 0.9981622 0.5210634 3 849 0.66788
## Hotelling-Lawley 1 0.0018412 0.5210634 3 849 0.66788
## Roy 1 0.0018412 0.5210634 3 849 0.66788
##
## Type II Sums of Squares
## df scale_state scale_biden pop_biden_scale
## pid7_num 1 17.0906611 23.6291680 3.0840e+01
## swing_state 1 0.8196846 0.0043208 1.3218e-03
## educ 5 0.6306208 0.4923986 1.0132e+00
## age 1 0.0052046 0.0048278 1.9811e-05
## income 1 1.0411768 0.1725999 6.7851e-01
## pid7_num:swing_state 1 0.0288395 0.0379454 1.4237e-02
## residuals 851 93.4716039 59.7630892 5.9758e+01
##
## F-tests
## scale_state scale_biden pop_biden_scale
## pid7_num 155.60 336.47 87.84
## swing_state 7.46 0.06 0.02
## educ 5.74 7.01 2.89
## age 0.05 0.07 0.00
## income 9.48 2.46 1.93
## pid7_num:swing_state 0.26 0.54 0.20
##
## p-values
## scale_state scale_biden pop_biden_scale
## pid7_num < 2.22e-16 < 2.22e-16 < 2.22e-16
## swing_state 0.0064295 0.8041604 0.8909050
## educ 0.0167845 0.0082485 0.0136271
## age 0.8277311 0.7932344 0.9866027
## income 0.0021448 0.1173182 0.0865858
## pid7_num:swing_state 0.6084958 0.4625005 0.6526295
##
## p-values adjusted (by term) for simultaneous inference by hochberg method
## scale_state scale_biden pop_biden_scale
## pid7_num < 2.22e-16 < 2.22e-16 < 2.22e-16
## swing_state 0.0192884 0.8909050 0.8909050
## educ 0.0167845 0.0167845 0.0167845
## age 0.9866027 0.9866027 0.9866027
## income 0.0064343 0.1173182 0.1173182
## pid7_num:swing_state 0.6526295 0.6526295 0.6526295
## 219 214
## 189 184
## 754 273
## 649 233
## 219 991
## 189 854
##
## Call:
## mrpp(dat = df_clean[, c("scale_state", "scale_biden", "pop_biden_scale")], grouping = df_clean$swing_state, permutations = 999, distance = "euclidean")
##
## Dissimilarity index: euclidean
## Weights for groups: n
##
## Class means and counts:
##
## FALSE TRUE
## delta 0.7486 0.7363
## n 617 245
##
## Chance corrected within-group agreement A: 0.0005542
## Based on observed delta 0.7451 and expected delta 0.7456
##
## Significance of delta: 0.141
## Permutation: free
## Number of permutations: 999
##
library(vegan)
# ---- build the “species” matrix of beliefs ----
bel <- df_clean[, c("scale_state","scale_biden","pop_biden_scale")]
rownames(bel) <- paste0("ID", seq_len(nrow(bel))) # or use your respondent IDs
# ---- build the “environmental” matrix of predictors ----
env <- df_clean[, c("pid7_num","swing_state","educ")]
# 1) set up
nperm <- 5
dims <- 1:5
results <- matrix(NA,
nrow = nperm + 1,
ncol = length(dims),
dimnames = list(
c(paste0("perm", 1:nperm), "orig"),
paste0("k", dims)
))
# 2) loop over dimensions & permutations
for (idx in seq_along(dims)) {
k <- dims[idx]
# permute columns and record stress
for (i in 1:nperm) {
temp <- apply(bel, 2, function(col) col[sample(length(col))])
results[i, idx] <- metaMDS(temp,
k = k,
distance = "euclidean",
trymax = 5,
autotransform = FALSE)$stress
}
# original data
results[nperm + 1, idx] <- metaMDS(bel,
k = k,
distance = "euclidean",
trymax = 5,
autotransform = FALSE)$stress
}
## Run 0 stress 0.3781137
## Run 1 stress 0.5220312
## Run 2 stress 0.5068211
## Run 3 stress 0.479476
## Run 4 stress 0.4990492
## Run 5 stress 0.4599561
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Run 0 stress 0.37727
## Run 1 stress 0.5313794
## Run 2 stress 0.5119034
## Run 3 stress 0.4688227
## Run 4 stress 0.4590761
## Run 5 stress 0.5048245
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 1: stress ratio > sratmax
## 4: scale factor of the gradient < sfgrmin
## Run 0 stress 0.3806856
## Run 1 stress 0.5100026
## Run 2 stress 0.5197509
## Run 3 stress 0.5006303
## Run 4 stress 0.4832524
## Run 5 stress 0.5141659
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Run 0 stress 0.3839463
## Run 1 stress 0.5096254
## Run 2 stress 0.5132264
## Run 3 stress 0.486561
## Run 4 stress 0.5070623
## Run 5 stress 0.5190849
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Run 0 stress 0.3757326
## Run 1 stress 0.461189
## Run 2 stress 0.485537
## Run 3 stress 0.5150906
## Run 4 stress 0.5289598
## Run 5 stress 0.5011374
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Run 0 stress 0.2254009
## Run 1 stress 0.3988642
## Run 2 stress 0.524337
## Run 3 stress 0.5200879
## Run 4 stress 0.4055017
## Run 5 stress 0.4781623
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Run 0 stress 0.1799624
## Run 1 stress 0.1801277
## ... Procrustes: rmse 0.001389301 max resid 0.01663394
## Run 2 stress 0.1801278
## ... Procrustes: rmse 0.00139356 max resid 0.01663739
## Run 3 stress 0.1801278
## ... Procrustes: rmse 0.001394914 max resid 0.01668925
## Run 4 stress 0.1801278
## ... Procrustes: rmse 0.001392573 max resid 0.01663615
## Run 5 stress 0.1954966
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Run 0 stress 0.1798802
## Run 1 stress 0.1870991
## Run 2 stress 0.1938367
## Run 3 stress 0.2067865
## Run 4 stress 0.1825309
## Run 5 stress 0.1865936
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Run 0 stress 0.1794002
## Run 1 stress 0.1805344
## Run 2 stress 0.1819429
## Run 3 stress 0.1930459
## Run 4 stress 0.1927472
## Run 5 stress 0.1815347
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 1: no. of iterations >= maxit
## 4: scale factor of the gradient < sfgrmin
## Run 0 stress 0.176293
## Run 1 stress 0.1762462
## ... New best solution
## ... Procrustes: rmse 0.0009739099 max resid 0.006315577
## ... Similar to previous best
## Run 2 stress 0.1803416
## Run 3 stress 0.176293
## ... Procrustes: rmse 0.0009718275 max resid 0.006310359
## ... Similar to previous best
## Run 4 stress 0.1780647
## Run 5 stress 0.1762463
## ... Procrustes: rmse 4.578074e-05 max resid 0.0004817162
## ... Similar to previous best
## *** Best solution repeated 3 times
## Run 0 stress 0.1798874
## Run 1 stress 0.187305
## Run 2 stress 0.18032
## ... Procrustes: rmse 0.003815929 max resid 0.02360817
## Run 3 stress 0.1888901
## Run 4 stress 0.1808547
## Run 5 stress 0.1798874
## ... Procrustes: rmse 3.090898e-05 max resid 0.0003833579
## ... Similar to previous best
## *** Best solution repeated 1 times
## Run 0 stress 0.07737919
## Run 1 stress 0.1100475
## Run 2 stress 0.09316826
## Run 3 stress 0.09399238
## Run 4 stress 0.1150418
## Run 5 stress 0.1170735
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Run 0 stress 4.096271e-14
## Run 1 stress 7.073755e-05
## ... Procrustes: rmse 0.0007651723 max resid 0.001425361
## ... Similar to previous best
## Run 2 stress 0.0003854572
## ... Procrustes: rmse 0.0008640254 max resid 0.001987028
## ... Similar to previous best
## Run 3 stress 0.0001604861
## ... Procrustes: rmse 0.0007692889 max resid 0.00141984
## ... Similar to previous best
## Run 4 stress 0.000217523
## ... Procrustes: rmse 0.0008202272 max resid 0.001627012
## ... Similar to previous best
## Run 5 stress 0.000273685
## ... Procrustes: rmse 0.0008298992 max resid 0.002030239
## ... Similar to previous best
## *** Best solution repeated 5 times
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 3.727511e-14
## Run 1 stress 0.0002633829
## ... Procrustes: rmse 0.0007430061 max resid 0.001440375
## ... Similar to previous best
## Run 2 stress 0.0003096283
## ... Procrustes: rmse 0.0008209411 max resid 0.001726362
## ... Similar to previous best
## Run 3 stress 0.0002539002
## ... Procrustes: rmse 0.0008243203 max resid 0.001695682
## ... Similar to previous best
## Run 4 stress 0.0004085601
## ... Procrustes: rmse 0.0007234007 max resid 0.001826281
## ... Similar to previous best
## Run 5 stress 0.0001727075
## ... Procrustes: rmse 0.0007531815 max resid 0.001357716
## ... Similar to previous best
## *** Best solution repeated 5 times
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 5.309199e-14
## Run 1 stress 0.0002613196
## ... Procrustes: rmse 0.0007167447 max resid 0.00159459
## ... Similar to previous best
## Run 2 stress 0.0003326345
## ... Procrustes: rmse 0.0008378796 max resid 0.001890745
## ... Similar to previous best
## Run 3 stress 0.000467031
## ... Procrustes: rmse 0.0008530371 max resid 0.001770561
## ... Similar to previous best
## Run 4 stress 0.00012689
## ... Procrustes: rmse 0.0006840682 max resid 0.001334598
## ... Similar to previous best
## Run 5 stress 0.0002535996
## ... Procrustes: rmse 0.0006938756 max resid 0.001973288
## ... Similar to previous best
## *** Best solution repeated 5 times
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 3.880968e-14
## Run 1 stress 0.0003495718
## ... Procrustes: rmse 0.0007935961 max resid 0.001536861
## ... Similar to previous best
## Run 2 stress 0.0002838123
## ... Procrustes: rmse 0.0007304075 max resid 0.001376445
## ... Similar to previous best
## Run 3 stress 0.0002107992
## ... Procrustes: rmse 0.0008216244 max resid 0.001668674
## ... Similar to previous best
## Run 4 stress 0.0004184061
## ... Procrustes: rmse 0.0007902487 max resid 0.00161546
## ... Similar to previous best
## Run 5 stress 0.0001303675
## ... Procrustes: rmse 0.0007278223 max resid 0.00129671
## ... Similar to previous best
## *** Best solution repeated 5 times
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 5.402309e-15
## Run 1 stress 0.0004717162
## ... Procrustes: rmse 0.0007849989 max resid 0.001663559
## ... Similar to previous best
## Run 2 stress 0.0001934891
## ... Procrustes: rmse 0.0008259237 max resid 0.001581108
## ... Similar to previous best
## Run 3 stress 0.0001927997
## ... Procrustes: rmse 0.0007769446 max resid 0.001543484
## ... Similar to previous best
## Run 4 stress 6.995998e-05
## ... Procrustes: rmse 0.0007487574 max resid 0.001521704
## ... Similar to previous best
## Run 5 stress 0.000354347
## ... Procrustes: rmse 0.0007486636 max resid 0.001894549
## ... Similar to previous best
## *** Best solution repeated 5 times
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 4.084263e-15
## Run 1 stress 0.0004353479
## ... Procrustes: rmse 0.001069249 max resid 0.002038547
## ... Similar to previous best
## Run 2 stress 0.01612059
## Run 3 stress 0.0004877376
## ... Procrustes: rmse 0.0009667481 max resid 0.002085086
## ... Similar to previous best
## Run 4 stress 0.0002209511
## ... Procrustes: rmse 0.000758433 max resid 0.001193359
## ... Similar to previous best
## Run 5 stress 0.02666851
## *** Best solution repeated 3 times
## Warning in metaMDS(bel, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 4.88071e-14
## Run 1 stress 0.0006217559
## Run 2 stress 0.0006068136
## Run 3 stress 0.0007202189
## Run 4 stress 0.0006034166
## Run 5 stress 0.000733853
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 3.753823e-14
## Run 1 stress 0.0007488114
## Run 2 stress 0.0007355708
## Run 3 stress 0.0005281284
## Run 4 stress 0.0007386064
## Run 5 stress 0.0007434377
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 2.979728e-14
## Run 1 stress 0.0006936971
## Run 2 stress 0.0007280372
## Run 3 stress 0.0006230883
## Run 4 stress 0.0007406525
## Run 5 stress 0.0007476149
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 3.349749e-14
## Run 1 stress 0.0006121471
## Run 2 stress 0.0006677022
## Run 3 stress 0.0007350612
## Run 4 stress 0.0006304142
## Run 5 stress 0.0008594262
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 1.883699e-14
## Run 1 stress 0.0005235965
## Run 2 stress 0.0005810633
## Run 3 stress 0.0007150412
## Run 4 stress 0.00061623
## Run 5 stress 0.0006003411
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 1.573097e-14
## Run 1 stress 0.0009279003
## Run 2 stress 0.0006655982
## Run 3 stress 0.000977791
## Run 4 stress 0.0009139696
## Run 5 stress 0.0009255626
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Warning in metaMDS(bel, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 2.776399e-14
## Run 1 stress 0.0004960568
## ... Procrustes: rmse 0.0065365 max resid 0.009307863
## Run 2 stress 0.0007630547
## Run 3 stress 0.0007807246
## Run 4 stress 0.0007338992
## Run 5 stress 0.0007895464
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 1.540388e-14
## Run 1 stress 0.0007128752
## Run 2 stress 0.0007730309
## Run 3 stress 0.000692888
## Run 4 stress 0.0006886274
## Run 5 stress 0.0006601584
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 2.14997e-14
## Run 1 stress 0.0007941158
## Run 2 stress 0.0007176493
## Run 3 stress 0.0004235637
## ... Procrustes: rmse 0.006485093 max resid 0.00909863
## Run 4 stress 0.0006651826
## Run 5 stress 0.0007756006
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 2.957193e-14
## Run 1 stress 0.0008543132
## Run 2 stress 0.0006578298
## Run 3 stress 0.0005595892
## Run 4 stress 0.0007410144
## Run 5 stress 0.000757235
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 3.018249e-14
## Run 1 stress 0.0006317088
## Run 2 stress 0.0009336204
## Run 3 stress 0.0007608894
## Run 4 stress 0.0004914056
## ... Procrustes: rmse 0.006475274 max resid 0.009649472
## Run 5 stress 0.0005385021
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Warning in metaMDS(temp, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
## Run 0 stress 4.275847e-15
## Run 1 stress 0.001077104
## Run 2 stress 0.0008456816
## Run 3 stress 0.000903339
## Run 4 stress 0.0008406346
## Run 5 stress 0.0009647098
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 5: scale factor of the gradient < sfgrmin
## Warning in metaMDS(bel, k = k, distance = "euclidean", trymax = 5,
## autotransform = FALSE): stress is (nearly) zero: you may have insufficient data
# 3) extract summaries
orig <- results["orig", ]
mins <- apply(results[1:nperm, ], 2, min)
meds <- apply(results[1:nperm, ], 2, median)
maxs <- apply(results[1:nperm, ], 2, max)
# 4) plot stress vs. dimensions
ylim <- c(0, max(results, na.rm = TRUE))
plot(dims, orig,
type = "b", pch = 19, col = "blue", lwd = 2,
xlab = "Dimensions (k)",
ylab = "NMDS Stress",
main = "Stress vs. Dimensions",
ylim = ylim)
# add permuted min/med/max in red
points(rep(dims, 3),
c(mins, meds, maxs),
type = "b", pch = 19, col = "red", lwd = 2)
legend("topright",
legend = c("Original data", "Permuted (min, med, max)"),
col = c("blue", "red"),
pch = 19,
lwd = 2)
We can see a clear elbow around k = 2 with stress dropping form 0.21 in 1D, to 0.08 in 2D,and to around 0.01 in 3D suggesting that two dimensions are sufficient to capture the structure of the belief data. Thus, a planar solution could adequate enough for interpretation. I will consider 2-D and 3-D solutions 89 for further analysis.
## Run 0 stress 0.07737919
## Run 1 stress 0.1113592
## Run 2 stress 0.1137898
## Run 3 stress 0.1180254
## Run 4 stress 0.1160665
## Run 5 stress 0.1105361
## Run 6 stress 0.1135283
## Run 7 stress 0.1157099
## Run 8 stress 0.1105384
## Run 9 stress 0.1096518
## Run 10 stress 0.1144933
## Run 11 stress 0.1191683
## Run 12 stress 0.1199381
## Run 13 stress 0.1258679
## Run 14 stress 0.123383
## Run 15 stress 0.1170004
## Run 16 stress 0.1177455
## Run 17 stress 0.1202778
## Run 18 stress 0.1226666
## Run 19 stress 0.08724171
## Run 20 stress 0.1554541
## *** Best solution was not repeated -- monoMDS stopping criteria:
## 20: scale factor of the gradient < sfgrmin
##
## Family: gaussian
## Link function: identity
##
## Formula:
## y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
##
## Estimated degrees of freedom:
## 3.11 total = 4.11
##
## REML score: 3679.304
##
## Family: gaussian
## Link function: identity
##
## Formula:
## y ~ s(x1, x2, k = 10, bs = "tp", fx = FALSE)
##
## Estimated degrees of freedom:
## 4.76 total = 5.76
##
## REML score: 2286.894
## Run 0 stress 4.084263e-15
## Run 1 stress 0.0007451855
## Run 2 stress 0.01604284
## Run 3 stress 0.0006640364
## Run 4 stress 0.0150076
## Run 5 stress 0.0003879674
## ... Procrustes: rmse 0.0009253436 max resid 0.003525959
## ... Similar to previous best
## Run 6 stress 0.0005824192
## Run 7 stress 0.0005037631
## Run 8 stress 0.0005324852
## Run 9 stress 0.0001886916
## ... Procrustes: rmse 0.001014936 max resid 0.001556869
## ... Similar to previous best
## Run 10 stress 0.0007567922
## Run 11 stress 0.0006161759
## Run 12 stress 0.0005386996
## Run 13 stress 0.0002822227
## ... Procrustes: rmse 0.001066935 max resid 0.001972435
## ... Similar to previous best
## Run 14 stress 0.0005522833
## Run 15 stress 0.0007254182
## Run 16 stress 0.0006947021
## Run 17 stress 0.0004985305
## ... Procrustes: rmse 0.001220067 max resid 0.002131
## ... Similar to previous best
## Run 18 stress 0.000323251
## ... Procrustes: rmse 0.0008997487 max resid 0.003148315
## ... Similar to previous best
## Run 19 stress 0.0005669693
## Run 20 stress 0.01949326
## *** Best solution repeated 5 times
## Warning in metaMDS(bel, k = 3, distance = "euclidean"): stress is (nearly)
## zero: you may have insufficient data
## Warning: package 'vegan3d' was built under R version 4.3.3
##
## Attaching package: 'vegan3d'
## The following object is masked from 'package:vegan':
##
## orditkplot