Lab 11

Rmd

School

Missouri University of Science & Technology *

*We aren’t endorsed by this school

Course

3420

Subject

Electrical Engineering

Date

Dec 6, 2023

Type

Rmd

Pages

2

Uploaded by DeaconStarSquid34

Report
--- title: "Lab 11" output: html_document date: "2022-12-01" editor_options: "Rylee Miller" chunk_output_type: console --- ```{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE) ``` # Clean the environment ```{r} rm(list = ls()) ``` #1. Show the structure and head of 'mtcars' dataset. ```{r} str(mtcars) head(mtcars) ``` #2. Boxplot of 'mpg' grouped by transmission type. ```{r} boxplot(mpg~am,data=mtcars, main="Car Milage Data", xlab="Type of Transmission", ylab="Miles Per Gallon") ``` 3. What conclusion do you get from the above box plot? The box plot above shows that cars with manual transmission overall have more miles per gallon. The spread for manual transmission cars is also much larger than that of automatic. Based off this data we can infer that manual transmission cars have better fuel economy. 4. Test if manual transmission cars have better mpg than automatic transmission cars through hypothesis testing. Specify your null and alternative hypothesis. H0: mean(mpg) of automatic transmission (am = 0) >= mean(mpg) of manual transmission cars (am = 1) Ha: mean(mpg) of automatic transmission (am = 0) < mean(mpg) of manual transmission cars (am = 1) 5. What is the appropriate hypothesis testing method: one-sample or two-sample? Paired or unpaired? Why? The appropriate hypothesis test method is a two-sample unpaired t-test. The appropriate test is two-sample because we are comparing the mpg of two different types of transmission. The testing is unpaired because the two separate groups of transmission we are testing are independent of each other. #6. Use the appropriate hypothesis testing method to test the hypothesis. ```{r} mpgautomatic <- mtcars$mpg[mtcars$am == 0] mpgmanual <- mtcars$mpg[mtcars$am == 1] t.test(mpgautomatic, mpgmanual, alternative = "two.sided", mu = 0, paired = FALSE)
``` 7. Explain the hypothesis result. The hypothesis testing from the data above reveals the p-value is ( 0.001 < p < 0.01 ). This indicates that the null hypothesis of the average mpg of automatic transmission cars being greater than or equal to that of manual transmission cars is rejected. The alternative hypothesis of the average mpg of automatic transmission being less than that of the average mpg of manual transmission is in favor to be accepted. #8. Knit into an HTML file.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help