The Human Freedom Index is a report that attempts to summarize the idea of “freedom” through a bunch of different variables for many countries around the globe. It serves as a rough objective measure for the relationships between the different types of freedom - whether it’s political, religious, economical or personal freedom - and other social and economic circumstances. The Human Freedom Index is an annually co-published report by the Cato Institute, the Fraser Institute, and the Liberales Institut at the Friedrich Naumann Foundation for Freedom.
In this lab, you’ll be analysing data from the Human Freedom Index reports. Your aim will be to summarize a few of the relationships within the data both graphically and numerically in order to find which variables can help tell a story about freedom.
The data we’re working with is here,
and it’s called hfi, short for Human Freedom Index.
Information about the variables can be seen here.
If you are using Jamovi cloud, please use this version of the data set found at the link https://drive.google.com/file/d/10HS48scnD4TK153OXzQQPMUZyJASlbZ7/. You may have to copy and paste the link into your browser. To answer quesion one, please use the second link above that tells you information about the variables.
How many rows and columns are there in the data set? What does each row represent?
The dataset spans a lot of years, but we are only interested in
data from year 2016. Filter the data hfi data frame for
year 2016. To show your work, write down the function you used to filter
the data.
What type of plot would you use to display the relationship
between the personal freedom score, pf_score, and
pf_expression_control? Plot this relationship using the
variable pf_expression_control as the predictor. Does the
relationship look linear? If you knew a country’s
pf_expression_control, or its score out of 10, with 0 being
the most, of political pressures and controls on media content, would
you be comfortable using a linear model to predict the personal freedom
score?
If the relationship looks linear, we can quantify the strength of the
relationship with the correlation coefficient. Click
Regression, then Correlation Matrix. Add
pf_score, and pf_expression_control as
variables. You will see the correlation next to the
Pearson's r in the table. (There are two rows with
Pearson’s r, but the second one tells us the correlation between our two
variables.)
Think back to the way that we described the distribution of a single
variable. Recall that we discussed characteristics such as center,
spread, and shape. It’s also useful to be able to describe the
relationship of two numerical variables, such as
pf_expression_control and pf_score above.
Just as you’ve used the mean and standard deviation to summarize a single variable, you can summarize the relationship between these two variables by finding the line that best follows their association.
Recall that the residuals are the difference between the observed values and the values predicted by the line:
\[ e_i = y_i - \hat{y}_i \]
In the scatter plot, the residual for a point is given by the distance between the y-value of a point and the y-value of the line. For example, for one possible regression line, the plot below shows the line in back and the residuals in blue.
The most common way to do linear regression is to select the line that minimizes the sum of squared residuals.
It is rather cumbersome to try to get the correct least squares line, i.e. the line that minimizes the sum of squared residuals, through trial and error.
Instead, you can use jamovi to fit the linear model (a.k.a.
regression line). Click Regression, then
Linear Regression. For the dependent variable, select
pf_score and for covariates, select
pf_expression_control.
We’re going to focus on the table with the title
Model Coefficients for this analysis.
The Estimate column gives us the value of the linear
model’s y-intercept and the coefficient of
pf_expression_control. With this table, we can write down
the least squares regression line for the linear model:
\[ \hat{y} = 4.284 + 0.542 \times pf\_expression\_control \]
This equation tells us two things:
pf_expression_control of 0 (those
with the largest amount of political pressure on media content), we
expect their mean personal freedom score to be 4.284.pf_expression_control, we
expect a country’s mean personal freedom score to increase 0.542
units.We can assess model fit using \(R^2\), the proportion of variability in the
response variable that is explained by the explanatory variable. We can
look in the first table in the Linear Regression analysis, labeled
Model Fit Measures for this information.
For this model, 71.4% of the variability in pf_score is
explained by pf_expression_control.
pf_expression_control to
predict hf_score, or the total human freedom score. Using
the estimates from the output, write the equation of the regression
line. What does the slope tell us in the context of the relationship
between human freedom and the amount of political pressure on media
content?Look at a scatter plot for these variables, and make sure the
regression line option is set to Linear and not
Smooth to ensure that jamovi is using a line to estimate
the relationship and not a curved line.
This line can be used to predict \(y\) at any value of \(x\). When predictions are made for values of \(x\) that are beyond the range of the observed data, it is referred to as extrapolation and is not usually recommended. However, predictions made within the range of the data are more reliable. They’re also used to compute the residuals.
pf_expression_control? Is this an
overestimate or an underestimate, and by how much? In other words, what
is the residual for this prediction?To assess whether the linear model is reliable, we need to check for (1) linearity, (2) nearly normal residuals, and (3) constant variability.
Linearity: You already checked if the relationship
between pf_score and pf_expression_control is
linear using a scatterplot.
We should also verify this condition with a plot of the residuals
vs. fitted (predicted) values. Go back to the Linear Regression
analysis, and open the Assumption Checks submenu. Check the
Residual plots box and look at the plots that are created.
We will focus on the first one, Residuals vs Fitted.
Nearly normal residuals: To check this condition, we
can look at a Q-Q plot to inspect the normality of the residuals. Check
the Q-Q plot of residuals box to create this plot.
Constant variability:
This
work is licensed under a
Creative
Commons Attribution-ShareAlike 4.0 International License.