Note that there are several ways of how to write qqplot
code. Just keep in mind that you always need to specify the data you want to plot, the aesthetic / mapping (aes()
) and geometry (geom_
) and that you need to separate different layers by +
Here are same examples, all are leading to the same result:
Also box and whisker plot, displays five-number summary.
A statistic describing a relationship between two continuous variables.
To what degree is a variable y explained by x?
Correlation coefficient r, from -1 to +1.
Correlation does not imply causation!
r = 1 – strong positive correlation
r = 0.5 – moderately strong positive correlation
r = 0 – variables are not correlated
r = -0.2 – weak negative correlation
r = -1 – strong negative correlation
We already know scatterplot from the last part:
geom_smooth()
to better see the trend that the points are formingmethod = "lm"
you can plot the linear modelse = FALSE
will turn off the confidence bandtheme_
:ggplot(data = df_dartpoints) +
aes(x = Weight, y = Length) +
geom_point(size = 3, alpha = 0.5, color = "steelblue") +
geom_smooth(method = "lm", se = FALSE)+
scale_x_continuous(breaks = seq(0, 40, by = 5))+
scale_y_continuous(breaks = seq(0, 120, by = 10))+
labs(x = "Weight (g)", y = "Length (mm)",
title = "Relationship of weight and length of dart points") +
theme_linedraw()
ggplot(data = df_dartpoints) +
aes(x = Weight, y = Length) +
geom_point(size = 3, alpha = 0.5, color = "steelblue") +
geom_smooth(method = "lm", se = FALSE)+
scale_x_continuous(breaks = seq(0, 40, by = 5))+
scale_y_continuous(breaks = seq(0, 120, by = 10))+
labs(x = "Weight (g)", y = "Length (mm)",
title = "Relationship of weight and length of dart points") +
theme_linedraw()+
facet_wrap(~Name)
H
).Phase
).H
) and rim diameter (RD
).Phase
) by differently. Hints:
read.csv()
,
str()
,
colnames()
,
summary()
,
cor()
,
ggplot() +
aes() +
geom_* +
stat_*
AES_707 Statistics seminar for archaeologists | Relationships