Below is a number of exercises to play around with data structures in R. Some of them can be "solved" using the material we have just discussed in the last tutorial session. For others, explore! Ways to learn and find out about useful R commands are using the inbuilt help function, but also using internet search to find tutorials and help from the R community.
Exercises II
- Load the usedcars data set we just discussed in the tutorial. What are the three most frequent colors of cars found in the data set? Produce a scatter plot of price vs. mileage in which you indicate black cars by black dots, red cars by red dots, and silver cars by blue dots.
- Design some R experiments to "verify" the central limit theorem. Specifically, run experiments sampling 10000 instances of constructing the sample mean of 10, 100, and 1000 random numbers drawn from the uniform distribution between [0:1]. Construct the distribution of sample means and compare the distributions of sample means for sample size 10, 100, and 1000 in one histogram.
- Continuing the exercise from above, for sample sizes between size 1 and size 100 plot the dependence of the standard deviation of the distribution of sample means on the sample size. Indicate the expected theoretical relationship in the same graph and compare.
- In the tutorial we discussed there might be an influence of the type of transmission on price. What other factors matter? Produce plots to illustrate the relationships you find.