Question
IN R analysis of the titanic_train data set. Continue your script from the Week 4 homework assignment. 1. Fit a linear regression model to predict
IN R analysis of the titanic_train data set. Continue your script
from the Week 4 homework assignment.
1. Fit a linear regression model to predict with the ticket fare (Fare) using passenger
class (Pclass), Sex, Age, the number of siblings / spouses aboard (SibSp), and the port
of embarkation (Embarked). Obtain a summary of your model and include it in your
homework document. Also, answer the following questions:
a. Which variables appear to be statistically significant?
b. Why are there two variables for Pclass in the model?
c. Why are there two variables for Embarked in the model?
2. Fit a logistic regression model with Survived as the response and passenger class
(Pclass), Sex, and Age as predictors. Obtain a summary of your model and include it
in your homework document.
3. Using your model from Exercise 2, predict the probability of survival for an
individual that was: in passenger class 1, a female, and 25 years old. Remember
from the learning video that you will need to define a data frame with the new
values of Pclass, Sex, and Age. Make sure that you treat Pclass and Sex as factors in
your new data frame (also, make sure you use the correct names for the factor
levels!). Report the predicted probability of survival (Remember: a probability
should be somewhere between 0 and 1!) in your homework document.
Hint: You will need to include the argument type="response" in the predict()
function to return a probability.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started