IPI Student assistant tasks

Instructions

1 Interpretation (10 mins)

term estimate std.error statistic p.value conf.low conf.high df outcome
(Intercept) 0.000 0.000 3.536 0.001 0.000 0.000 96 Y
X1 0.231 0.084 2.739 0.007 0.064 0.398 96 Y
X2 0.000 0.000 -0.707 0.481 0.000 0.000 96 Y
X1:X2 0.449 0.127 3.533 0.001 0.197 0.702 96 Y

Half the units are assigned to X1 = 0 and half to X1 = 1; half o each of these are assigned to X2=0 and half to X2 = 1.

Using the the coefficients from this regression please indicate:

  1. The estimated effect of X1 on Y when X2 = 0
  2. The estimated effect of X1 on Y when X2 = 1
  3. The average effect of X1 on Y

2 Editing (10 mins)

Please read this text and suggest improvements.

“In the last twelve month’s (See Masters 2022) there have been
less protests about the conflict then any time before 1968
this has lead some to wonder what affect that
might have on future stability.”

3 Data management (40 mins)

You have been given 2 datasets.

  • Dataset A (“A_CSES.csv”) is a short version of the Comparative Study of Electoral Systems (CSES) survey wave 2. Each observation in this dataset refers to an individual in a certain year in a specific country.

  • Dataset B (“B_QoG.xlsx”) is a short version of the Quality of Government (QoG) data. Each observation in this dataset refers to a certain year in a specific country.

Dataset A includes the following variables:

Variable name Variable label
B1004 Country-year code
B1006_NAM Country name
B1008 Year
B2001 Age (number of years)
B2002 Gender (1=male; 2=female)
B2005 Union membership (1=is a member; 2=is not a member)
B2020 Income in household (1=low, 5=high)
B3014 It matters who people vote for (1 = it doesn’t matter; 5 = it matters a lot)

Dataset B includes the following variables:

Variable name Variable label
cname Country name
year Year of measurement
gle_cgdpc GDP per capita (in current prices)
p_polity2 Polity score (measure of democracy)
undp_hdi UNDP’s Human Development Index

3.1 Read data

Read both datasets using the needed functions for their format. Note that dataset A is a .csv (Comma-Separated Value) file, while dataset B is an .xlsx (Excel) file.

3.2 Clean data

Compare the list of unique countries that are present in datasets A and B. There are 5 countries that are named differently between these 2 datasets. Find these countries and then rename those in dataset B so that they match the names used in dataset A.

3.3 Merge data

Merge dataset B into dataset A using country and year to match observations. The dataset resulting from the merging procedure can be called merged_df. Please perform the merging so that the resulting dataset, has the same number of rows as dataset A.

4 Descriptive statistics

From this point onward, please continue your work only with the merged dataset merged_df. (We also provide this dataset here in case you have not merged properly)

4.1 Summary statistics

For each country-year pair in the merged dataset, please compute the percentage of respondents who report being members of a union, as well as the GDP per capita recorded in that country-year.

Store this resulting country-year data as a data frame in a new object called summary_df.

4.2 Display table

Display the first rows of summary_df as a table.

5 Analysis

The next questions use summary_df. If you did not create summary_df successfully you can access it here.

5.1 Scatterplot

Please produce a scatterplot of the relationship between union membership and GDP per capita. Plot union membership on the X-axis, and GDP per capita on the Y-axis.

Note: you may not be able to finish everything; that’s OK. If stuck for time indicate briefly the steps you would take.