Load libraries/data

library(haven)
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.2     ✓ purrr   0.3.4
## ✓ tibble  3.1.0     ✓ dplyr   1.0.2
## ✓ tidyr   1.1.2     ✓ stringr 1.4.0
## ✓ readr   1.3.1     ✓ forcats 0.5.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(nnet)
## Warning: package 'nnet' was built under R version 4.0.5
TEDS_2016 <- read_dta("TEDS_2016.dta")

Use the TEDS2016 dataset to run a multiple regression model. Select only relevant variables to create a subset of the dataset (Tondu, female, DPP, age, income, edu, Taiwanese and Econ_worse). Make sure the dependent variable Tondu is coded with right labels:

TEDS_2016$Tondu<-as.numeric(TEDS_2016$Tondu,labels=c("Unification now”, “Status quo, unif. in future”, “Status quo, decide later", "Status quo forever", "Status quo, indep. in future", "Independence now”, “No response"))

subset1 <- subset(TEDS_2016, select = c("Tondu", "female", "DPP", "age", "income", "edu", "Taiwanese", "Econ_worse"))

Run a regplot on the dependent variable using: a. Age b. Education c. Income

model1 <- lm(Tondu ~ age + edu + income, subset1)
summary(model1)
## 
## Call:
## lm(formula = Tondu ~ age + edu + income, data = subset1)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3.7780 -1.1841 -0.4322  1.1079  5.4157 
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  5.302529   0.257369  20.603  < 2e-16 ***
## age         -0.004205   0.003194  -1.316   0.1882    
## edu         -0.244608   0.037579  -6.509 9.96e-11 ***
## income      -0.031855   0.016357  -1.948   0.0516 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 1.725 on 1676 degrees of freedom
##   (10 observations deleted due to missingness)
## Multiple R-squared:  0.04287,    Adjusted R-squared:  0.04115 
## F-statistic: 25.02 on 3 and 1676 DF,  p-value: 7.771e-16
predict(model1)
##        1        2        3        4        5        6        7        8 
## 3.821161 3.692507 3.559733 4.422764 4.563141 4.257498 4.710694 3.533867 
##        9       10       11       12       13       14       15       16 
## 4.725094 4.634625 4.684828 4.532985 4.495862 3.620387 3.807949 4.533706 
##       17       18       19       20       21       22       23       24 
## 4.179048 3.749041 3.739398 3.607772 3.905260 4.250532 4.291689 3.989445 
##       25       26       27       28       29       30       31       32 
## 4.651825 4.223262 4.777974 4.120434 3.996621 3.934098 4.127060 3.719521 
##       33       34       35       36       37       38       39       40 
## 4.490679 4.632460 4.154710 4.214216 4.230399 4.541775 3.886656 3.795846 
##       41       42       43       44       45       46       47       48 
## 4.678839 4.107819 4.212943 3.512842 4.309781 4.195867 4.497902 4.563141 
##       49       50       51       52       53       54       55       56 
## 4.391459 3.593373 3.900458 4.124639 4.353615 4.132413 4.748539 4.545980 
##       57       58       59       60       61       62       63       64 
## 4.794793 4.295894 4.579961 4.116229 4.262891 3.960561 3.825366 4.377060 
##       65       66       67       68       69       70       71       72 
## 4.281495 4.596780 3.825917 3.764627 4.503930 4.289268 4.188350 4.647240 
##       73       74       75       76       77       78       79       80 
## 3.994837 4.313986 3.853568 4.740129 4.231672 4.211795 4.257413 4.307361 
##       81       82       83       84       85       86       87       88 
## 3.782339 4.609395 4.533706 3.997513 3.790749 4.027289 4.208482 3.809097 
##       89       90       91       92       93       94       95       96 
## 4.554731 3.905004 4.779758 4.664440 4.807408 4.761154 4.273085 3.985790 
##       97       98       99      100      101      102      103      104 
## 3.972284 4.474496 3.846942 3.738761 4.406836 4.267095 3.651606 4.588371 
##      105      106      107      108      109      110      111      112 
## 4.689670 4.596780 4.735924 4.527337 4.615129 4.195867 4.419110 3.643832 
##      113      114      115      116      117      118      119      120 
## 3.993308 3.764627 4.638830 4.504272 4.300735 4.543559 3.804892 3.895617 
##      121      122      123      124      125      126      127      128 
## 4.680623 4.156494 4.806772 4.773769 4.271300 4.232820 3.732136 4.249639 
##      129      130      131      132      133      134      135      136 
## 4.642694 4.258049 4.351831 3.802472 4.648768 4.579961 4.226830 3.811774 
##      137      138      139      140      141      142      143      144 
## 4.423315 4.693875 4.714263 4.271937 4.300735 4.330806 4.124042 3.681676 
##      145      146      147      148      149      150      151      152 
## 4.660235 4.680623 4.183252 4.714899 4.514125 4.698080 4.125275 4.683044 
##      153      154      156      157      158      159      160      161 
## 4.579961 3.799159 4.558595 4.343421 4.385470 4.651445 4.266459 3.688938 
##      162      163      164      165      166      167      168      169 
## 3.786544 3.815172 4.681260 3.819928 4.761154 4.236388 4.702285 3.743052 
##      170      171      172      173      174      175      176      177 
## 3.631217 4.605190 3.736341 3.743603 4.142095 3.751376 4.605190 3.500228 
##      178      179      180      181      182      183      184      185 
## 3.756854 4.528609 4.642143 3.726147 4.720889 4.251424 3.605351 3.589168 
##      186      187      188      189      190      191      192      193 
## 3.616182 4.505164 4.024908 3.863211 3.766412 4.529160 3.971391 4.461881 
##      194      195      196      197      198      199      200      201 
## 4.125275 3.609556 3.890861 3.533867 3.713532 4.173950 4.289905 3.649821 
##      202      203      204      205      206      207      208      209 
## 3.989103 4.541775 3.734556 4.497305 4.596525 3.794954 3.685881 4.052558 
##      210      211      212      213      214      215      216      217 
## 4.664440 3.862614 3.500228 3.719265 3.668425 3.642048 3.973005 4.478701 
##      218      219      220      221      222      223      224      225 
## 4.225682 4.322993 4.330806 4.054342 4.146936 4.714899 3.827702 4.773769 
##      226      227      228      229      230      231      232      233 
## 3.807313 4.211795 3.789857 3.709327 4.256265 4.322396 4.347626 3.799159 
##      234      235      236      237      238      239      240      241 
## 4.288757 4.735544 3.714804 4.212431 4.330806 4.298951 4.279710 4.514722 
##      242      243      244      245      246      247      248      249 
## 4.546321 4.390016 3.811774 3.802472 4.267732 4.133685 4.318788 4.124383 
##      250      251      252      253      254      255      256      257 
## 4.304940 3.660015 3.765520 3.940172 4.609395 3.633638 3.649821 4.777974 
##      258      259      260      261      262      263      264      265 
## 4.082590 3.892390 4.484054 4.542116 3.651094 4.643415 4.230399 4.609395 
##      266      267      268      269      270      271      272      273 
## 3.643832 4.286336 4.651445 4.010128 4.246327 4.415246 4.229507 4.601878 
##      274      275      276      277      278      279      280      281 
## 3.508637 4.322993 3.972284 3.657083 3.647781 4.122855 4.466086 3.592736 
##      282      283      284      285      286      287      288      289 
## 4.232820 4.786383 3.874592 3.731880 3.975045 4.168473 3.713532 4.589263 
##      290      291      292      293      294      295      296      297 
## 3.679892 4.223262 3.671482 4.484054 4.304940 3.854801 4.085010 4.216000 
##      298      299      300      301      302      303      304      305 
## 3.869836 3.831906 3.777879 3.769724 4.145027 4.067554 4.116866 3.787436 
##      306      307      308      309      310      311      312      313 
## 3.491818 4.005031 3.567507 3.652242 3.773929 3.954572 3.827151 3.664220 
##      314      315      316      317      318      319      320      321 
## 3.948582 4.031494 3.551323 4.723309 3.599362 3.626376 4.241230 4.729299 
##      322      323      324      325      326      327      328      329 
## 4.332590 3.919062 4.184145 4.567602 3.719521 4.537570 4.343421 4.617805 
##      330      331      332      333      334      335      336      337 
## 4.386704 4.567346 4.643035 4.273085 4.325414 4.251424 3.968334 4.221989 
##      338      339      340      341      342      343      344      345 
## 4.550526 3.580121 4.773769 4.300099 4.119798 4.112024 4.461245 3.777242 
##      346      347      348      349      350      351      352      353 
## 3.932911 3.892645 3.730988 3.664857 4.514722 3.706906 3.815723 4.107183 
##      354      355      356      357      358      359      360      361 
## 3.736341 4.007452 3.779026 4.277290 4.520114 4.613600 3.704485 4.149272 
##      362      363      364      365      366      367      368      369 
## 3.968971 4.271300 4.504527 3.715316 4.249088 3.863211 3.884236 4.078129 
##      370      371      372      373      374      375      376      377 
## 3.838532 3.997513 3.690723 3.727931 4.561612 4.634625 3.550687 3.655810 
##      378      379      380      381      382      383      384      385 
## 3.670846 4.246327 3.938303 4.211795 4.642143 4.678839 3.651606 4.592575 
##      386      387      388      389      390      391      392      393 
## 4.300735 4.157131 3.713532 4.111427 3.768832 4.327198 3.768196 4.497305 
##      394      395      396      397      398      399      400      401 
## 4.748539 4.217273 3.914857 4.756949 4.789952 3.658231 4.179940 3.773037 
##      402      403      404      405      406      407      408      409 
## 3.800051 4.031494 4.216636 4.102381 3.796483 4.689670 4.754528 4.756949 
##      410      411      412      413      414      415      416      417 
## 4.116866 4.284552 4.002059 4.141203 4.744334 3.856585 4.592575 4.243014 
##      418      419      420      421      422      423      424      425 
## 4.428753 4.018879 3.990632 3.747808 4.495862 4.756949 4.479849 4.521091 
##      426      427      428      429      430      431      432      433 
## 3.703338 4.134833 4.183252 4.204277 3.683461 3.973176 4.554731 4.626596 
##      434      435      436      437      438      439      440      441 
## 3.626756 4.229507 4.503550 4.280688 4.041727 4.748539 4.393880 4.436651 
##      442      443      444      445      446      447      448      449 
## 4.222625 4.481082 3.823497 4.399869 4.093420 3.721942 4.415587 4.609395 
##      450      451      452      453      454      455      456      457 
## 4.298314 4.402973 4.092187 3.658231 4.103614 4.718724 3.942849 4.355399 
##      458      459      460      461      462      463      464      465 
## 3.892390 3.651606 4.452198 4.574778 3.785652 4.018879 4.798998 4.094568 
##      466      467      468      469      470      471      472      473 
## 4.737708 3.696712 4.398085 4.544156 3.595157 4.141203 3.786544 3.919062 
##      474      475      476      477      478      479      480      481 
## 4.487708 4.273085 3.728567 3.645616 3.883002 3.959327 3.507489 3.687666 
##      483      484      485      486      487      488      489      490 
## 4.264675 4.723309 3.923267 4.305576 4.277926 3.643196 3.655810 3.732772 
##      491      492      493      494      495      496      497      498 
## 4.216000 4.136998 4.845253 3.803364 4.432407 4.436271 3.666641 4.141459 
##      500      501      502      503      504      505      506      507 
## 3.638991 4.136106 4.563141 3.914306 4.431174 3.779026 4.078385 3.748700 
##      508      509      510      511      512      513      514      515 
## 4.141203 3.939536 3.662436 3.938644 4.093971 3.791641 4.427861 3.634786 
##      516      517      518      519      520      521      522      523 
## 4.651445 3.898038 3.800051 4.301371 3.666129 4.204618 3.794062 4.179048 
##      524      525      526      527      528      529      530      531 
## 4.554731 4.243014 4.368650 4.676674 4.592575 4.621033 4.634625 3.955122 
##      532      533      534      535      536      537      538      539 
## 4.537570 4.316918 4.706489 4.411933 4.586842 4.432407 4.393880 3.899271 
##      540      541      542      543      544      545      546      547 
## 4.294746 3.815979 3.618347 3.694291 3.951600 4.490679 4.094568 3.848175 
##      548      549      550      551      552      553      554      555 
## 3.638991 4.191918 4.330806 4.558936 4.630420 4.191662 3.630581 3.700281 
##      556      557      558      559      560      561      562      563 
## 4.596780 3.722578 4.418559 4.439584 4.208482 4.415246 4.360241 4.495140 
##      564      565      566      567      568      569      570      571 
## 4.546321 4.613600 4.220841 4.596780 4.153818 3.836111 3.798267 4.758733 
##      572      573      574      575      576      577      578      579 
## 4.681260 3.781447 3.837345 4.642143 4.525296 4.035102 3.815979 4.050734 
##      580      581      582      583      584      585      586      587 
## 4.228615 4.184145 4.412484 4.554731 4.207590 4.668645 4.571551 3.769724 
##      588      589      590      591      592      593      594      595 
## 4.248491 3.914857 4.659855 4.255117 4.613600 4.348774 4.478064 4.229507 
##      596      597      598      599      600      601      602      603 
## 3.702445 4.290541 3.771889 4.157642 4.013441 4.331403 4.103359 4.200072 
##      604      605      606      607      608      609      610      611 
## 4.248491 4.702285 4.501510 4.168598 4.744334 4.794793 3.996621 4.647240 
##      612      613      614      615      616      617      618      619 
## 4.078129 4.390909 4.239445 4.853662 4.794793 4.204658 4.756949 4.463029 
##      620      621      622      623      624      625      626      627 
## 4.714899 4.744334 4.351831 3.914857 4.389675 4.754528 3.811774 4.183252 
##      628      629      630      631      632      633      634      635 
## 4.229251 4.258686 4.591598 4.756949 3.697985 4.541139 3.779026 3.668425 
##      636      637      638      639      640      641      642      643 
## 4.719104 4.563141 4.098812 4.726242 3.869836 4.009236 3.821161 3.773929 
##      644      645      646      647      648      649      650      651 
## 3.853568 3.962981 3.690723 3.677472 3.667914 3.616182 3.989445 3.904663 
##      652      653      654      655      656      657      658      659 
## 4.325965 4.595888 3.730988 3.833776 3.759786 3.617966 3.605987 3.749592 
##      660      661      662      663      664      665      666      667 
## 3.765520 4.428202 3.686518 3.596941 3.585599 4.094607 4.577199 3.733408 
##      668      669      670      671      672      673      674      675 
## 3.730351 4.124639 4.067554 4.437799 4.622902 3.932911 3.841550 4.723309 
##      676      677      678      679      680      681      682      683 
## 4.470291 4.223773 3.553108 3.599362 3.909209 4.006264 3.512842 3.551323 
##      684      685      686      687      688      689      690      691 
## 3.803364 4.190770 3.736341 4.414354 3.807569 4.407177 3.794954 3.617966 
##      692      693      694      695      696      697      698      699 
## 4.286336 4.279710 4.723309 4.185929 4.148721 4.474496 3.542277 3.789857 
##      700      701      702      703      704      705      706      707 
## 4.345205 3.767048 4.318191 3.724362 4.411041 3.631853 4.120178 4.271556 
##      708      709      710      711      712      713      714      715 
## 3.580758 3.763991 4.335608 3.949730 4.220205 3.779026 4.141203 4.099409 
##      716      717      718      719      720      721      722      723 
## 4.609395 4.040284 4.311566 3.659504 3.950367 3.900799 4.183252 3.692507 
##      724      725      726      727      728      729      730      731 
## 4.744334 4.446209 3.838532 3.713532 4.044745 4.115973 4.010469 4.225302 
##      732      733      734      735      736      737      738      739 
## 3.727931 3.836748 4.605190 3.863211 4.769564 4.181724 4.387255 4.537911 
##      740      741      742      743      744      745      746      747 
## 3.668806 3.757110 3.664601 4.436271 3.512842 4.287484 3.691871 4.164268 
##      748      749      750      751      752      753      754      755 
## 4.163120 3.914857 3.681676 3.660015 3.836748 4.352979 4.307361 3.855437 
##      756      757      758      759      760      761      762      763 
## 4.630420 4.622010 4.287569 3.580758 4.134833 4.297763 4.343382 4.777974 
##      764      765      766      767      768      769      770      771 
## 3.799159 3.893833 3.466588 3.711111 3.807569 4.232820 3.715952 4.156494 
##      772      773      774      775      776      777      778      779 
## 3.727931 3.609556 3.568143 4.155346 3.704485 3.738761 3.778134 3.703338 
##      780      781      782      783      784      785      786      787 
## 4.154074 4.207590 4.190134 3.742966 4.163756 4.204533 4.487452 4.416689 
##      788      789      790      791      792      793      794      795 
## 4.221097 3.722578 3.713532 4.345205 4.031494 4.289905 3.730351 4.284552 
##      796      797      798      799      800      801      802      803 
## 4.533706 4.280688 3.803705 3.726147 3.774651 3.679892 3.730351 4.634625 
##      804      805      806      807      808      809      810      811 
## 4.735924 3.777242 3.942849 4.285700 3.893833 3.586747 3.751376 4.276739 
##      812      813      814      815      816      817      818      819 
## 3.746023 3.830758 4.550185 4.188350 3.854545 3.913670 4.163120 3.711747 
##      820      821      822      823      824      825      826      827 
## 3.851147 3.626756 3.895617 4.243650 3.638991 3.658867 3.500228 3.798903 
##      828      829      830      831      832      833      834      835 
## 3.593117 3.630581 4.262891 3.821712 3.699769 4.285700 4.559192 3.613761 
##      836      837      838      839      840      841      842      843 
## 3.761315 4.249003 4.347967 4.232820 3.828974 4.179940 3.584963 4.182997 
##      844      845      846      847      848      849      850      851 
## 3.605351 4.340449 3.958777 4.006264 3.717737 4.216636 4.467234 3.809097 
##      852      853      854      855      856      857      858      859 
## 4.051922 3.912522 3.846942 4.508477 4.319975 4.467234 4.009236 3.800051 
##      860      861      862      863      864      865      866      867 
## 3.875826 4.461756 3.997894 3.976488 4.758733 4.115973 4.689670 3.747171 
##      868      869      870      871      872      873      874      875 
## 3.943741 3.660652 3.802472 3.791090 4.704069 4.541775 4.681260 4.203385 
##      876      877      878      879      880      881      882      883 
## 4.107222 4.364787 3.840953 3.646889 4.203385 4.402973 4.545980 4.617805 
##      884      885      886      887      888      889      890      891 
## 4.514125 3.811774 3.624592 4.392693 4.544156 4.304940 4.176371 4.175735 
##      892      893      894      895      896      897      898      899 
## 4.309781 3.870387 3.717737 4.356036 4.605190 4.193191 4.689670 4.227467 
##      900      901      902      903      904      905      906      907 
## 4.572357 4.315771 3.677472 4.537911 3.857222 3.839168 4.634625 3.582542 
##      908      909      910      911      912      913      914      915 
## 4.655394 3.699769 3.979801 3.699769 4.526103 3.665493 3.982222 4.588371 
##      916      917      918      919      920      921      922      923 
## 4.567346 4.184145 3.700281 4.128588 4.185929 3.750228 3.690086 3.846135 
##      924      925      926      927      928      929      930      931 
## 3.892048 4.228064 4.163671 3.762843 4.039904 4.208482 3.649821 3.679256 
##      932      933      934      935      936      937      938      939 
## 4.667372 4.254736 4.377060 3.651606 3.698240 4.677055 3.815979 3.862574 
##      940      941      942      943      944      945      946      947 
## 4.428753 4.719104 4.521347 4.186565 4.141203 4.096392 4.154710 4.190770 
##      948      949      950      951      952      953      954      955 
## 3.891412 4.484054 4.042324 4.303156 3.891412 4.550526 4.029710 4.146300 
##      956      957      958      959      960      961      962      963 
## 4.342784 4.693238 3.914857 4.163120 3.696076 4.554731 4.476280 4.221097 
##      964      965      966      967      968      969      970      971 
## 4.474496 3.886020 4.612708 4.770712 3.557312 3.607772 4.338580 4.710058 
##      972      973      974      975      976      977      978      979 
## 4.157642 3.770066 4.288717 3.813388 3.715316 3.807949 3.763991 4.267732 
##      980      981      982      983      984      985      986      987 
## 4.196759 3.794954 4.088579 4.115081 4.411382 3.508637 3.792278 4.613600 
##      988      989      990      991      992      993      994      995 
## 4.693875 4.256901 4.512340 3.812115 4.242122 4.773769 3.490033 4.193191 
##      996      997      998      999     1000     1001     1002     1003 
## 3.885423 3.949094 4.221097 3.769469 4.710058 4.678839 4.521091 4.423656 
##     1004     1005     1006     1007     1008     1009     1010     1011 
## 3.838532 4.626215 4.562249 4.666736 4.406836 4.232820 3.683461 4.432066 
##     1012     1013     1014     1015     1016     1017     1018     1019 
## 4.630420 4.485838 4.128208 4.558936 4.720889 3.889628 3.730988 4.372855 
##     1020     1021     1022     1023     1024     1025     1026     1027 
## 4.521091 4.187457 4.404074 4.691454 4.348223 4.752744 4.116866 4.402290 
##     1028     1029     1030     1031     1032     1033     1034     1035 
## 4.389675 4.280688 3.842737 4.676674 4.318191 4.685465 4.752744 4.296530 
##     1036     1037     1038     1039     1040     1041     1042     1043 
## 3.624592 3.973176 4.714899 3.746023 3.622551 3.862955 3.786544 3.834327 
##     1044     1045     1046     1047     1048     1049     1050     1051 
## 3.934439 3.891412 3.907681 4.600093 4.216636 4.389675 4.317555 3.807569 
##     1052     1053     1054     1055     1056     1057     1058     1059 
## 3.803364 3.582542 4.204658 4.060587 3.542277 3.840953 3.732136 3.757110 
##     1060     1061     1062     1063     1064     1065     1066     1067 
## 3.596941 4.400591 3.934780 4.193191 4.449863 4.325414 3.723726 4.633733 
##     1068     1069     1070     1071     1072     1073     1074     1075 
## 3.526094 3.744239 4.748539 3.508637 3.622171 3.774271 3.719521 4.186565 
##     1076     1077     1078     1079     1080     1081     1082     1083 
## 3.837345 3.787436 4.537570 4.529501 4.572994 3.738250 3.902243 3.807910 
##     1084     1085     1086     1087     1088     1089     1090     1091 
## 3.987575 3.839254 4.588371 4.188986 4.488259 3.914306 3.675687 4.689670 
##     1092     1093     1094     1095     1096     1097     1098     1099 
## 3.688938 3.674539 3.700281 3.630961 3.638991 3.815979 4.754528 4.179048 
##     1100     1101     1102     1103     1104     1105     1106     1107 
## 3.637843 3.806677 3.800137 3.816359 3.893833 4.468467 3.649821 3.521252 
##     1108     1109     1110     1111     1112     1113     1114     1115 
## 3.587383 3.698240 4.294109 4.735924 3.919148 4.375873 4.378294 4.116866 
##     1116     1117     1118     1119     1120     1121     1122     1123 
## 3.751376 4.782178 4.231672 4.200072 4.735288 4.217784 3.921483 3.669062 
##     1124     1125     1126     1127     1128     1129     1130     1132 
## 4.161336 4.395750 4.704069 3.827702 4.018282 4.247855 4.754528 4.643035 
##     1133     1134     1135     1136     1137     1138     1139     1140 
## 4.529501 4.634625 3.723470 4.600985 3.815979 4.289268 4.575756 4.204277 
##     1141     1142     1143     1144     1145     1146     1147     1148 
## 3.702701 4.761154 3.669062 4.199816 3.649821 4.129480 4.448544 4.752744 
##     1149     1150     1151     1152     1153     1154     1155     1156 
## 4.277290 4.609395 4.148084 3.814536 3.788073 4.340364 3.820525 4.719104 
##     1157     1158     1159     1160     1161     1162     1163     1164 
## 3.733408 3.569927 3.584963 4.116229 3.699133 4.262254 3.760422 3.664220 
##     1165     1166     1167     1168     1169     1170     1171     1172 
## 4.173950 4.121070 4.277926 3.960010 3.575917 3.875826 3.550687 3.754433 
##     1173     1174     1175     1176     1177     1178     1179     1180 
## 4.150505 4.440817 3.885423 3.834327 4.152289 4.010469 4.069338 4.143879 
##     1181     1182     1183     1184     1185     1186     1187     1188 
## 4.600985 4.086539 3.647401 3.626376 3.989103 4.402631 3.845243 4.048950 
##     1189     1190     1191     1192     1193     1194     1195     1197 
## 3.609556 4.145408 4.322396 4.012804 3.583178 3.634786 3.926285 4.617805 
##     1198     1199     1200     1201     1202     1203     1204     1205 
## 4.549804 3.706906 3.723470 3.651986 3.842737 3.872808 3.891412 4.080169 
##     1206     1207     1208     1209     1210     1211     1212     1213 
## 3.694035 3.630581 4.178155 4.267351 4.609395 4.384834 3.575917 4.324180 
##     1214     1215     1216     1217     1218     1219     1220     1221 
## 4.166091 4.769564 4.179048 3.655810 4.640358 4.249639 4.484054 3.721942 
##     1222     1223     1224     1225     1226     1227     1228     1229 
## 4.120178 4.241866 4.339216 3.823497 3.660015 4.153437 4.613600 3.622807 
##     1230     1231     1232     1233     1234     1235     1236     1237 
## 4.301371 3.757110 4.324180 4.059781 3.751376 4.205806 3.827702 4.698080 
##     1238     1239     1240     1241     1242     1243     1244     1245 
## 4.460057 4.381265 4.184145 3.620387 3.795846 4.053706 4.558044 4.297166 
##     1246     1247     1248     1249     1250     1251     1252     1253 
## 4.478661 4.593468 4.461500 4.870482 3.786544 3.773037 4.225046 4.367463 
##     1254     1255     1256     1257     1258     1259     1260     1261 
## 4.600985 3.993308 4.035738 4.567346 4.184145 3.814536 4.116229 3.896850 
##     1262     1263     1264     1265     1266     1267     1268     1269 
## 4.352172 3.803364 3.752905 4.183252 3.871109 4.249003 4.786383 4.588371 
##     1270     1271     1272     1273     1274     1275     1276     1277 
## 4.254481 4.392693 3.719521 4.367463 3.988211 4.415246 3.913670 4.137254 
##     1278     1279     1280     1281     1282     1283     1284     1285 
## 4.194339 4.074180 4.637938 4.116866 4.269516 4.266459 3.910652 4.729299 
##     1286     1287     1288     1289     1290     1291     1292     1293 
## 4.194975 4.404074 4.575756 4.782178 4.402290 3.842737 3.783868 3.663709 
##     1294     1295     1296     1297     1298     1299     1300     1301 
## 3.751376 3.931126 3.624592 4.418559 4.143243 3.979801 3.670846 3.871621 
##     1302     1303     1304     1305     1306     1307     1308     1309 
## 4.250532 4.405393 4.412484 4.402631 3.819292 4.625874 4.393880 4.588371 
##     1310     1311     1312     1313     1314     1315     1316     1317 
## 4.217273 4.353615 4.478661 4.286336 3.807949 4.579961 3.837981 4.347586 
##     1318     1319     1320     1321     1322     1323     1324     1325 
## 4.408279 3.711747 3.580121 4.449227 4.153818 4.294109 4.014333 3.616182 
##     1326     1327     1328     1329     1330     1331     1332     1333 
## 3.857222 4.781798 3.589168 3.679892 4.664440 3.865631 4.579961 4.427605 
##     1334     1335     1336     1337     1338     1339     1340     1341 
## 4.154710 3.863847 4.773769 3.652878 4.272278 3.833179 4.143368 4.211795 
##     1342     1343     1344     1345     1346     1347     1348     1349 
## 3.870387 3.824133 3.946713 3.745387 3.598214 4.296786 3.859557 4.495140 
##     1350     1351     1352     1353     1354     1355     1356     1357 
## 4.292581 3.984898 4.230399 3.667277 4.061309 3.569927 3.749592 3.774271 
##     1358     1359     1360     1361     1362     1363     1364     1365 
## 3.690086 3.679892 4.450414 3.889628 3.821712 4.488895 3.559097 3.867416 
##     1366     1367     1368     1369     1370     1371     1372     1373 
## 3.565722 4.252060 3.790749 4.579961 4.731719 4.239445 4.392693 3.713532 
##     1374     1375     1376     1377     1378     1379     1380     1381 
## 3.861977 4.710694 4.769564 3.815979 3.707542 4.395114 4.484054 3.801324 
##     1382     1383     1384     1385     1386     1387     1388     1389 
## 4.756949 4.571551 3.803745 4.719104 4.069378 3.710855 3.778134 3.916727 
##     1390     1391     1392     1393     1394     1395     1396     1397 
## 3.648037 4.306173 3.811518 4.609395 3.844607 4.571210 4.615765 4.319975 
##     1398     1399     1400     1401     1402     1403     1404     1405 
## 4.356377 3.755581 4.439584 3.828338 3.561517 4.137254 3.672630 3.761695 
##     1406     1407     1408     1409     1410     1411     1412     1413 
## 4.798998 4.174843 3.794954 4.557407 4.212687 4.584166 4.297166 3.696076 
##     1414     1415     1416     1417     1418     1419     1420     1421 
## 3.637206 4.480485 4.475644 4.384919 3.567507 3.802472 4.124383 4.226194 
##     1422     1423     1424     1425     1426     1427     1428     1429 
## 3.846942 3.830122 3.790749 4.349495 3.694291 3.736977 3.795295 3.787436 
##     1430     1431     1432     1433     1434     1435     1436     1437 
## 3.720157 4.235240 3.867967 3.778134 3.544698 3.496023 3.618602 3.634786 
##     1438     1439     1440     1441     1442     1443     1444     1445 
## 3.999042 4.529501 4.657178 3.630581 4.798998 4.705853 3.605987 4.284171 
##     1446     1447     1448     1449     1450     1451     1452     1453 
## 3.698496 4.006264 3.586747 3.715316 4.059781 4.524955 3.668425 3.715316 
##     1454     1455     1456     1457     1458     1459     1460     1461 
## 4.044745 4.062752 4.076600 4.562800 3.542913 4.092187 3.773929 4.133685 
##     1462     1463     1464     1465     1466     1467     1468     1469 
## 3.893282 3.824133 4.296530 4.740129 4.112024 3.684097 4.614492 4.748539 
##     1470     1471     1472     1473     1474     1475     1476     1477 
## 4.048694 3.719265 3.700281 4.140225 4.509920 4.338580 4.761154 4.107819 
##     1478     1479     1480     1481     1482     1483     1484     1485 
## 3.533867 4.685465 4.487071 4.630420 4.132793 4.237025 4.464262 3.798267 
##     1486     1487     1488     1489     1490     1491     1492     1493 
## 4.645200 3.646253 3.500228 3.753882 3.818741 3.611977 4.021851 3.840953 
##     1494     1495     1496     1497     1499     1500     1501     1502 
## 4.082590 4.706489 3.792278 3.660396 3.993308 4.242463 3.965402 4.331147 
##     1503     1504     1505     1506     1507     1508     1509     1510 
## 3.884236 3.561517 3.598214 3.474998 3.770617 3.584326 3.645616 3.803364 
##     1511     1512     1513     1514     1515     1516     1517     1518 
## 4.503930 4.275505 4.202749 3.611977 4.262891 3.594009 3.747808 4.748539 
##     1519     1520     1521     1522     1523     1524     1525     1526 
## 3.726147 3.643196 4.706489 4.518330 4.752744 4.109604 4.414905 4.158915 
##     1527     1528     1529     1530     1531     1533     1534     1535 
## 4.558936 3.715316 4.485287 4.790588 3.875826 3.698240 4.023084 4.351831 
##     1536     1537     1538     1539     1540     1541     1542     1543 
## 4.116229 3.811774 3.618602 3.633001 3.811774 3.732221 3.719521 4.382499 
##     1544     1545     1546     1547     1548     1549     1550     1552 
## 4.605190 4.381607 3.816359 4.217784 4.261703 3.699133 4.511704 3.858750 
##     1553     1554     1555     1556     1557     1558     1559     1560 
## 4.154710 3.679892 4.368100 3.800051 4.505715 4.698080 3.943741 3.761315 
##     1561     1562     1563     1564     1565     1566     1567     1568 
## 4.197396 4.073924 4.233456 3.538072 3.713020 3.972028 4.600985 3.651730 
##     1569     1570     1571     1572     1573     1574     1575     1576 
## 3.836748 3.837345 3.553108 4.160699 4.542116 3.978653 4.294746 4.678203 
##     1577     1578     1579     1580     1581     1582     1583     1584 
## 3.559097 3.741182 4.144516 3.706906 4.142732 3.871365 3.634786 3.606624 
##     1585     1586     1587     1588     1589     1590     1591     1592 
## 3.637206 3.704485 4.617805 3.715952 3.789306 4.412570 4.239445 4.712479 
##     1593     1594     1595     1596     1597     1598     1599     1600 
## 4.575414 3.831356 3.655810 3.574769 3.837345 3.638991 4.366315 4.585694 
##     1601     1602     1603     1604     1605     1606     1607     1608 
## 4.469655 4.359053 4.740129 3.922080 3.808547 4.039904 3.521252 3.807569 
##     1609     1610     1611     1612     1613     1614     1615     1616 
## 3.596941 4.506863 3.691871 4.229251 3.763991 3.718373 4.133049 3.523673 
##     1617     1618     1619     1620     1621     1622     1623     1624 
## 3.679256 4.005031 3.778134 3.997513 3.605351 3.742966 4.352172 3.905260 
##     1625     1626     1627     1628     1629     1630     1631     1632 
## 3.646253 3.846942 3.997257 4.136618 4.368992 4.207590 4.646984 3.996621 
##     1633     1634     1635     1636     1637     1638     1639     1640 
## 3.596941 4.522535 4.170638 4.461842 4.702285 4.182360 3.844607 4.257413 
##     1641     1642     1643     1644     1645     1646     1647     1648 
## 4.145408 4.347626 3.664857 3.580121 3.578337 4.680623 4.740129 3.791641 
##     1650     1651     1652     1653     1654     1655     1656     1657 
## 3.828338 3.734556 4.292581 4.612708 4.665588 4.284552 4.070526 4.069338 
##     1659     1660     1661     1662     1663     1664     1665     1666 
## 4.633733 3.750865 3.673267 3.897487 4.208738 3.732772 3.816956 3.649821 
##     1667     1668     1669     1670     1671     1672     1673     1674 
## 4.470291 3.821161 3.778476 3.886656 4.276142 3.607772 4.297166 4.650553 
##     1675     1676     1677     1678     1679     1680     1681     1682 
## 4.254481 3.601146 3.719521 4.044109 4.326601 3.841550 3.705122 3.811774 
##     1683     1684     1685     1686     1687     1688     1689     1690 
## 3.883088 4.309781 4.685465 4.267095 4.600985 4.368650 4.503930 4.349410

What is the problem? Why? (hint: how many categories in the DV?) The dependent variable has 6 factor levels which are not ordinal which makes a linear regression impossible to do accurately. If you examine the predictions, they are continuous values which do not fall in the numerical categories set in the variable.

What can be done to improve prediction of the dependent variable?

TEDS_2016$Tondu<-factor(TEDS_2016$Tondu,labels=c("Unification now","Status quo, unif. in future","Status quo, decide later","Status quo forever", "Status quo, indep. in future", "Independence now","No response"))
subset2 <- subset(TEDS_2016, select = c("Tondu", "female", "DPP", "age", "income", "edu", "Taiwanese", "Econ_worse"))

Model2 doesn’t work when Tondu is treated correctly as a factor variable

model2 <- lm(Tondu ~ age + edu + income, subset2) summary(model2)

Use nnet package to allow for multinomial logistic regression https://stats.oarc.ucla.edu/r/dae/multinomial-logistic-regression/ “First, we need to choose the level of our outcome that we wish to use as our baseline and specify this in the relevel function. Then, we run our model using multinom. The multinom package does not include p-value calculation for the regression coefficients, so we calculate p-values using Wald tests (here z-tests).”

subset2$Tondu2 <- relevel(subset2$Tondu, ref = "Unification now")
model3 <- multinom(Tondu2 ~ age + edu + income, subset2)
## # weights:  35 (24 variable)
## initial  value 3269.129050 
## iter  10 value 2862.327758
## iter  20 value 2719.038514
## iter  30 value 2652.095289
## final  value 2651.908647 
## converged

Get model coefficients and then run z-test to calculate p-values

summary(model3)
## Call:
## multinom(formula = Tondu2 ~ age + edu + income, data = subset2)
## 
## Coefficients:
##                              (Intercept)          age         edu       income
## Status quo, unif. in future    -0.698701  0.015056992  0.48214997  0.087870013
## Status quo, decide later        3.135378 -0.029543248  0.37177638  0.073352836
## Status quo forever              2.155079 -0.010113129  0.23946974  0.063161195
## Status quo, indep. in future    3.077561 -0.041132676  0.43822387  0.066499389
## Independence now                4.129241 -0.046893568 -0.04872328 -0.014283116
## No response                     1.615135  0.008656457 -0.32097630 -0.002354623
## 
## Std. Errors:
##                              (Intercept)        age       edu     income
## Status quo, unif. in future     1.360753 0.01681289 0.1949910 0.08190317
## Status quo, decide later        1.306012 0.01625564 0.1890092 0.07874757
## Status quo forever              1.320301 0.01640358 0.1907294 0.07947759
## Status quo, indep. in future    1.321098 0.01647317 0.1916608 0.07981157
## Independence now                1.405475 0.01768059 0.2056549 0.08564493
## No response                     1.431107 0.01772215 0.2119361 0.08455384
## 
## Residual Deviance: 5303.817 
## AIC: 5351.817
z <- summary(model3)$coefficients/summary(model3)$standard.errors
p <- (1 - pnorm(abs(z), 0, 1)) * 2
p
##                              (Intercept)         age        edu    income
## Status quo, unif. in future  0.607625202 0.370486413 0.01341051 0.2833373
## Status quo, decide later     0.016362538 0.069153552 0.04918607 0.3515984
## Status quo forever           0.102623945 0.537551721 0.20928030 0.4267855
## Status quo, indep. in future 0.019830059 0.012526677 0.02222760 0.4047292
## Independence now             0.003303712 0.007995444 0.81272065 0.8675500
## No response                  0.259070116 0.625228274 0.12990014 0.9777837