RStudio and the Earth Package

R ASSIGNMENT

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

R : Assignment 1

Due: 02/25/2022 @ 6 pm

Open RStudio and run the following lines of code. You may need to install the earth package before

running the code.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

library(earth)
data(etitanic)
summary(etitanic)
?etitanic

Questions:

1. How many male passengers were on the Titanic? Female passengers? Please show the R code.

2. What was the survival rate for male passengers? Female passengers? Please show the R code.

3. Visualize survival rates by gender. Please show the R code.

4. Run the following code in RStudio:

### Data
library(earth)
data(etitanic)

set.seed(123)
train.index <- sample(1:nrow(etitanic), size=0.7*nrow(etitanic)) train.data <- etitanic[train.index,] test.data <- etitanic[-train.index,] ### Two Competing Models mod.1 <- glm(survived ~ ., data=train.data, family=binomial) mod.2 <- glm(survived ~ sex, data=train.data, family=binomial)

The above are two competing models, without any test data can you comment on which model is

better? Use model params/output metrics to support.

Order a unique copy of this paper

600 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
Top Academic Writers Ready to Help
with Your Research Proposal

Order your essay today and save 25% with the discount code GREEN