Hello everyone, this is Trol Satigas.
Objective of this video lecture is to obtain scatterplot for
a bivariate data in R.
In R, I'm going to generate some data set which simulates
some test scores in order you and me to get the same data set.
From these random generators, in other words random generators.
I'm going to set.seed=2016.
In that way, you and I both would get the same, quote unquote,
random data from these random generators.
And I'm going to call Test_1_scores.
And I will say rnorm,
let's say I'm going to generate some data from normal distribution.
Let's say 50 data points
with average of 78.
And with the standard deviation being 10.
And I am going to round them so that I would get whole integers.
And then I will go back and generate some simulates and test scores for
the second test for the same students.
Again, I have 50 students let's say this time the average was 70, right?
So there was some decrease in the average.
But the standard deviation, let's say was 14 this time.
Okay, for example, if I just look at test 1 scores,
let's say this is my test 1 score.
Somebody got a 101.
Let's say there was some extra credit problem and he or
she get at some point out of some extra credit problem.
And if I do test 2 scores, and I would have this data set, all right.
So I am assuming that this is paired data, or bivariate data.
In other words, student 1 got 66 in test 1, but he or
she got 72 in the second exam, and so forth, right.
So what I would like to do, is basically obtain a scatter plot.
How do I do it?
I just do plot, and I do my y axis, x axis.
So if I plot now, I will get a scatter plot like the following.
So here you see, we have x label by default is the name of the data set,
the name of the data set without any title.
So this is very bad, we would like to have some title,
and we would like to have some nicer some nice x label and y label.
So now, to do that, I will go back and
say that my title should be, let's say,
my test scores for two exams.
And I will just write 50 students in parentheses.
And the x label, let's say I'm going to write Test 1 scores.
In the y label we'll write Test 2 scores.
If I do that I will get my title here, Test 2 scores,
Test 1 scores, and this is basically the scatter plot in R.
We could play with the colors of this point as well.
For example, if I just write color = blue here,
I might get a scatter plot with blue dot points on it.
What have you learned in this lecture?
You have learned how to plot bivariate data.
Which is called scatterplotting, you learn how to add titles and labels and
colors to that scatterplot.