Replace the mean() command in your code for Question 3 with sd(), and calculate the difference in standard deviations between treatment and control groups in wave 0 and in wave 1.

Question
Let’s look at the distribution of tolerance in the first wave, and how it differs between those
who were supposed to receive treatment and those who were not (treat_ind).
boxplot
(tolerance.t1~treat_ind,data=transphobia) The mean seems to be higher in the treatment group than the control group. mean(transphobia$tolerance.t1[transphobia$treat_ind == 0],na.rm=TRUE)
 [1] 0.009213218
mean(transphobia$tolerance.t1[transphobia$treat_ind == 1],na.rm=TRUE [1] 0.1535359
1.
Check whether the means between the treatment and control group were already different in the baseline survey before the treatment was delivered (hint: you will need to use the tolerance.t0 variable).
2.
Calculate the difference in means between treatment and control groups for all waves of the survey.

Question
One possibility is that the treatment could have been
polarising, which is to say that it
might not just change the average level of tolerance but also change the degree of

dispersion in tolerance. Put differently, even if some people responded positively, others
might have responded negatively. If we look at the histograms for tolerance.t1 among those assigned to treatment (treat_ind == 1) versus those who were not (treat_ind == 0), we see some evidence that this could be the case: par(mfrow=c(2,1)) hist(transphobia$tolerance.t1[transphobia$treat_ind == 0])
hist
(transphobia$tolerance.t1[transphobia$treat_ind == 1])
par
(mfrow=c(1,1)) Note that the par() command above is used to set graphical parameters, in this case to put two plots in a 2 row x 1 column grid (mfrow=c(2,1)), and then to return to the original single plot setting (mfrow=c(1,1)). The par() command has a bewildering array of options which you can look up in its help file.
The command
sd() calculates the standard deviation for set of values in R.
1.
Replace the mean() command in your code for Question 3 with sd(), and calculate the difference in standard deviations between treatment and control groups in wave 0 and in wave 1.

Question
How similar are individuals’ tolerance scores across different waves?

We can look at the relationship between the two waves visually by using a scatter plot with
the tolerance score for one wave on the x-axis, and the tolerance score for another wave on the y-axis:plot(transphobia$tolerance.t0,transphobia$tolerance.t1) Clearly these are positively correlated. We can calculate the correlation coefficient ρ with the command: cor(transphobia$tolerance.t0,transphobia$tolerance.t1,use=“pairwise.co
mplete.obs”
)
## [1] 0.8290495

1.
Create scatter plots to look at the relationship between subsequent waves.
2.
What is the correlation coefficient between the waves?