Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

hey i need help with an R-studio assignment: Student ID : 1330 please let me know need anymore info Question 1 Gapminder is an independent

hey i need help with an R-studio assignment: Student ID : 1330

please let me know need anymore info

Question 1

Gapminder is an independent educational non-profit organisation that collects world data. In this question, you will need to conduct cluster analyses using Gapminder data. This data is stored in the gapminder R package (Bryan 2017). The variables in this data set include:

  • country:
  • The country
  • continent: The continent in which the country is situated
  • year: The year the data was recorded
  • lifeexp: The average life expectancy of citizens
  • pop: The population size
  • gdpPercap: The GDP (gross domestic product) per capita

1.1

Run the following R code to install and load the cluster, dplyr, factoextra and gapminder R packages (you may have one or more of these packages installed already, but please run this code regardless).

install.packages(setdiff(c("cluster", "dplyr", "factoextra", "gapminder"), ro wnames(installed.packages())))

library(cluster)

library(dplyr)

library(factoextra)

library(gapminder)

1.2

Suppose we are only interested in data from the year 1992.

In the R code below, replace the ... in the set.seed(...) command with the last 4 digits of student ID. For example, if your student ID ended in 5050, you would write set.seed(5050).

Once you have made this replacement, run the code below. You will now have an object gapminder_sample, which contains data on 120 countries, recorded in 1992.

set.seed(...)

gapminder_1992 <- filter(gapminder, gapminder$year == 1992)

gapminder_sample <- rbind(gapminder_1992[1:60, ], gapminder_1992[sample(61:nrow(gapminder_1992), 60), ])

Note: For all the following questions, you must use the data stored in your gapminder_sample object, unless otherwise specified. You will lose marks if you carry out any analyses using any other data set (for example, you will lose marks if you use the full gapminder data set).

1.3

Scale the numeric variables in your gapminder_sample object, and store this scaled data in a new object with an appropriate name.

1.4

Perform PAM clustering on your scaled data, using the values (k) = 2,3,4, and 5, and store results for each value of (k) in a separate object. Include your R code for this question, but do not include your R output yet.

1.5

wss plot to determine the optimal number of PAM clusters to use for your data, and note down your results.

Based on your result, what value of(k) would you recommend, and why?

As part of your answer, include the R output from the PAM clustering you performed in question 1.4, for your chosen value of (k) only.

1.6

Visualise the PAM clusters for your chosen (k) value, using the fviz_cluster function. Comment on your output, noting key features. Do you notice anything interesting?

1.7

Add a column named cluster to your gapminder_sample object, containing the cluster ID for that country, as determined by your chosen PAM clustering (k) value from 1.5.

Hint: The R code below outlines an approach you could use.

example_data$cluster <- results$cluster

# Note you will need to replace `example_data` and `results` with your relevant object names.

1.8

You may have noticed that one cluster is very different to the other clusters. Use your previous results to determine the countries in this cluster. What are these two countries? Can you think of a reason why these countries have been grouped in their own cluster?

Question 2

2.1

In a field of study that is of interest to you, plot and write your own Relational research question. For full marks, ensure that any relevant POCI elements can be identified by reading the question only. Referring to the research question you wrote above, answer the following questions.

2.2 Identify POCI.

2.3 What operational definition(s) would be needed?

2.4 What information must be collected from each individual or subject to answer the research question?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Infinity Properads And Infinity Wheeled Properads

Authors: Philip Hackney, Marcy Robertson, Donald Yau

1st Edition

3319205471, 9783319205472

More Books

Students also viewed these Mathematics questions

Question

13. Give four examples of psychological Maginot lines.

Answered: 1 week ago