Instructions

In this technical assignment, you will have the opportunity to apply the statistical knowledge that you’ve learned so far. The assignment will require you to use R Studio and import data. We recognize that doing both of these things may be new to you, so please make sure to ask your Lab TA, lecture TA, or Dr. Woodward any questions that may come up. Though the assignment is not due until Sunday, it is strongly recommended that you start the assignment before then.

You are allowed to work in groups of up to 3 students. However, you need to write the names of the people that you’ve worked with and you must hand in your own copy of the work.

You are expected to use the code that we teach you. If you use code from the internet or another source, you must cite the source appropriately and explain what the code is doing. Failure to do so will result in 0 points awarded and may be considered academic dishonesty.

AI can be a powerful tool used to complete tasks. For this assignment, you may use AI to help you troubleshoot R code. You may not, however, use AI generated answers for the rest of the assignment. This is because we are assessing your ability to meet the learning goals of this assignment:

  1. Understand how research questions and available data relate to the statistics you can calculate

  2. Interpreting statistics in context of the scenario

If you are confused or unsure how to complete the assignment, you should come to office hours. You may also use AI as a tutor, to either generate hypothesis testing walkthroughs or additional practice problems. Examples and cautions for this approach were discussed in class.

Assignment

  1. Please write the names of the classmates you’ve worked with. If you worked by yourself, please write “I worked by myself”

I WORKED BY MYSELF

About the data

For this assignment, we’ll be using the world happiness report data 2024. It is provided by Jaina on Kaggle.com, a website with different types of data.

  1. Download the worldHappinessReport2024.csv file from Canvas. Open this data in R Studio (Hint: Select “Import Data” from the Global Environment and choose “From Text Base.” It will be helpful for you to know where your downloaded data went on your computer). Make sure you copy the import code into your R Markdown file.
worldHappinessReport2024_edited <- read.csv("C:/Users/willz/Downloads/worldHappinessReport2024_edited.csv")
  1. How can you view your dataset in R Studio?
#View (worldHappinessReport2024_edited)
  1. Print(output) the values in the country name column. (Hint: you will know you were successful if the values saved in this column are visible).
worldHappinessReport2024_edited$countryName
##   [1] "Finland"                   "Denmark"                  
##   [3] "Iceland"                   "Sweden"                   
##   [5] "Israel"                    "Netherlands"              
##   [7] "Norway"                    "Luxembourg"               
##   [9] "Switzerland"               "Australia"                
##  [11] "New Zealand"               "Costa Rica"               
##  [13] "Kuwait"                    "Austria"                  
##  [15] "Canada"                    "Belgium"                  
##  [17] "Ireland"                   "Czechia"                  
##  [19] "Lithuania"                 "United Kingdom"           
##  [21] "Slovenia"                  "United Arab Emirates"     
##  [23] "United States"             "Germany"                  
##  [25] "Mexico"                    "Uruguay"                  
##  [27] "France"                    "Saudi Arabia"             
##  [29] "Kosovo"                    "Singapore"                
##  [31] "Taiwan Province of China"  "Romania"                  
##  [33] "El Salvador"               "Estonia"                  
##  [35] "Poland"                    "Spain"                    
##  [37] "Serbia"                    "Chile"                    
##  [39] "Panama"                    "Malta"                    
##  [41] "Italy"                     "Guatemala"                
##  [43] "Nicaragua"                 "Brazil"                   
##  [45] "Slovakia"                  "Latvia"                   
##  [47] "Uzbekistan"                "Argentina"                
##  [49] "Kazakhstan"                "Cyprus"                   
##  [51] "Japan"                     "South Korea"              
##  [53] "Philippines"               "Vietnam"                  
##  [55] "Portugal"                  "Hungary"                  
##  [57] "Paraguay"                  "Thailand"                 
##  [59] "Malaysia"                  "China"                    
##  [61] "Honduras"                  "Croatia"                  
##  [63] "Greece"                    "Bosnia and Herzegovina"   
##  [65] "Libya"                     "Jamaica"                  
##  [67] "Peru"                      "Dominican Republic"       
##  [69] "Mauritius"                 "Moldova"                  
##  [71] "Russia"                    "Bolivia"                  
##  [73] "Ecuador"                   "Kyrgyzstan"               
##  [75] "Montenegro"                "Mongolia"                 
##  [77] "Colombia"                  "Venezuela"                
##  [79] "Indonesia"                 "Bulgaria"                 
##  [81] "Armenia"                   "South Africa"             
##  [83] "North Macedonia"           "Algeria"                  
##  [85] "Hong Kong S.A.R. of China" "Albania"                  
##  [87] "Congo (Brazzaville)"       "Mozambique"               
##  [89] "Georgia"                   "Iraq"                     
##  [91] "Nepal"                     "Laos"                     
##  [93] "Gabon"                     "Ivory Coast"              
##  [95] "Guinea"                    "Turkiye"                  
##  [97] "Senegal"                   "Iran"                     
##  [99] "Azerbaijan"                "Nigeria"                  
## [101] "Cameroon"                  "Ukraine"                  
## [103] "Namibia"                   "Morocco"                  
## [105] "Pakistan"                  "Niger"                    
## [107] "Burkina Faso"              "Mauritania"               
## [109] "Gambia"                    "Chad"                     
## [111] "Kenya"                     "Tunisia"                  
## [113] "Benin"                     "Uganda"                   
## [115] "Myanmar"                   "Cambodia"                 
## [117] "Ghana"                     "Liberia"                  
## [119] "Mali"                      "Madagascar"               
## [121] "Togo"                      "Jordan"                   
## [123] "India"                     "Egypt"                    
## [125] "Sri Lanka"                 "Bangladesh"               
## [127] "Ethiopia"                  "Tanzania"                 
## [129] "Comoros"                   "Yemen"                    
## [131] "Zambia"                    "Eswatini"                 
## [133] "Malawi"                    "Botswana"                 
## [135] "Zimbabwe"                  "Congo (Kinshasa)"         
## [137] "Sierra Leone"              "Lesotho"                  
## [139] "Lebanon"                   "Afghanistan"
  1. What level of measurement was used to collect this data? Explain how you know.

Ladderscore was used to rank these countries. This is not alaphebitical cause Afghanistan is last, but it’s ladderscore one of the lowest on the list.

  1. ladderScore is the happiness score for each country. It represents where people think their country lands on a ladder, with 0 being the worst life and 10 being the best life. Print the ladderScore column.
worldHappinessReport2024_edited$ladderScore
##   [1] 7.741 7.583 7.525 7.344 7.341 7.319 7.302 7.122 7.060 7.057 7.029 6.955
##  [13] 6.951 6.905 6.900 6.894 6.838 6.822 6.818 6.749 6.743 6.733 6.725 6.719
##  [25] 6.678 6.611 6.609 6.594 6.561 6.523 6.503 6.491 6.469 6.448 6.442 6.421
##  [37] 6.411 6.360 6.358 6.346 6.324 6.287 6.284 6.272 6.257 6.234 6.195 6.188
##  [49] 6.188 6.068 6.060 6.058 6.048 6.043 6.030 6.017 5.977 5.976 5.975 5.973
##  [61] 5.968 5.942 5.934 5.877 5.866 5.842 5.841 5.823 5.816 5.816 5.785 5.784
##  [73] 5.725 5.714 5.707 5.696 5.695 5.607 5.568 5.463 5.455 5.422 5.369 5.364
##  [85] 5.316 5.304 5.221 5.216 5.185 5.166 5.158 5.139 5.106 5.080 5.023 4.975
##  [97] 4.969 4.923 4.893 4.881 4.874 4.873 4.832 4.795 4.657 4.556 4.548 4.505
## [109] 4.485 4.471 4.470 4.422 4.377 4.372 4.354 4.341 4.289 4.269 4.232 4.228
## [121] 4.214 4.186 4.054 3.977 3.898 3.886 3.861 3.781 3.566 3.561 3.502 3.502
## [133] 3.421 3.383 3.341 3.295 3.245 3.186 2.707 1.721
  1. What level of measurement was used to collect the ladderScore data? Explain how you know

its at the interval/ratio level because it uses a numerical 0-10 scale where equal differences are important

  1. Print the corruption column
worldHappinessReport2024_edited$corruption
##   [1] 0.546 0.548 0.182 0.524 0.193 0.372 0.484 0.432 0.498 0.323 0.480 0.123
##  [13] 0.172 0.305 0.368 0.311 0.418 0.068 0.116 0.351 0.131 0.258 0.169 0.368
##  [25] 0.127 0.220 0.281 0.188 0.073 0.575 0.202 0.006 0.253 0.401 0.175 0.177
##  [37] 0.101 0.075 0.043 0.125 0.074 0.078 0.251 0.142 0.058 0.078 0.215 0.080
##  [49] 0.120 0.049 0.219 0.158 0.136 0.160 0.035 0.067 0.065 0.024 0.119 0.164
##  [61] 0.081 0.043 0.093 0.000 0.204 0.028 0.029 0.196 0.118 0.044 0.121 0.061
##  [73] 0.078 0.030 0.132 0.055 0.059 0.086 0.055 0.006 0.173 0.034 0.015 0.200
##  [85] 0.402 0.049 0.138 0.196 0.174 0.048 0.115 0.167 0.100 0.164 0.107 0.115
##  [97] 0.069 0.123 0.199 0.019 0.060 0.025 0.061 0.082 0.074 0.147 0.179 0.198
## [109] 0.048 0.113 0.069 0.018 0.252 0.054 0.174 0.071 0.028 0.075 0.090 0.123
## [121] 0.156 0.189 0.122 0.259 0.031 0.167 0.101 0.257 0.160 0.113 0.109 0.116
## [133] 0.136 0.082 0.131 0.072 0.053 0.085 0.029 0.088
  1. Describe what you think the corruption variable means( there is no one correct answer- I haven’t given you the definition and you did not collect the data. We just want to see that you’re able to think about the data we provide)

I would say if the corruption value is lower, then the ladder score will most likely be lower. This means I believe the lower the value of corruption is, the more corruption people perceive the government to commit.

  1. What level of measurement do you think was used to collect the corruption data? Explain why you think so

Definitely a survey to the people of said country. It would be hard to measure corruption, because how would you? Have a percentage of legal government actions verse corrupt ones. Plus the government is usually in control of info, so if corruption occurs, it will most likely go under the radar