Professional Documents
Culture Documents
FINAL EXAM
SUMMER 2018
DUE DATE: 8/3/18 AT MIDNIGHT
Question 1: Plotting
Read in the attached Titanic dataset, which only consists of the variable Age for the passengers
on the Titanic. Replicate the following plot. Please be sure to submit both your R code and the
resulting plot.
Question 2: Matrices
Please create a matrix that has the values 1, 2, 3, …., 20 in the first row; 2, 3, 4, …, 21 in the
second row; and 3, 4, 5, …, 22 in the third row.
Write the necessary code needed to extract out the values in the sixth row and assign it to a
variable called ‘six_col’.
Write the code that will calculate the sum for 1) each row and 2) each column in the matrix
(hint… a for/while loop is not needed).
1
Question 3: Linear Regression
a) Which variable(s) is/are the independent variables and which is/are the dependent
variables?
b) How many rows of data can be found in this dataset and how many variables?
d) The first residual is 0.214839668. Show how one can manually obtain this residual using
the fact that the residual = observed minus expected.
f) Does the code above reflect Simple Linear Regression or Multiple Linear Regression?
Please explain briefly.
2
Short Answers
2) What is the sum of TRUE, TRUE, FALSE, FALSE, FALSE, and TRUE? Can this even be done?
If it can, how is it able to be done?
8) I have the following string: “314-362-0000”. What code can be used to split the string on
the dashes?