Plot the simulated data
Now create a scatterplot of the simulated observations to explore the direction and strength of the linear association.
With plot(x, y)
, you can create a scatterplot with the values of x
on the
x-axis and the values of y
on the y-axis. You can customize the plot in many
ways through additional arguments
(see the documentation):
pch
to specify a plot symbol, cex
to set the symbol size, col
to set the
color, main
to add a title, or xlab
and ylab
to set axis labels.
This exercise is part of the course
Intro to Computational Finance with R
Exercise instructions
- Create a scatterplot of the simulated observations
- Customize the plot in the following way: specify the plot symbol with
pch = 16
, set the symbol size to2
, set the color to"blue"
, use the title"Bivariate normal: rho = 0.9"
, and use the axis labels"x"
and"y"
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# The simulated values (xy_vals) are still in your workspace
# Create scatterplot