You are on page 1of 2

Golf_code.

R
Sravanthiammu

2019-05-24

#+eval = FALSE
## Seeting up working directory and getting working directory

setwd("D:/College Data/Statistical Methods for Decision Making/Project")

getwd()

## installing readr package

install.packages("readr")

library(readr)

##installing readxl package

install.packages("readxl")

library(readxl)

##import data

Golf <- read_excel("Golf.xls")

dim(Golf) ##dimentions of dataset

str(Golf)

head(Golf,10)

tail(Golf,10)

colSums(Golf,na.rm = FALSE,dims = 1L)

colMeans(Golf,na.rm = FALSE,dims = 1L)

summary(Golf)

## Apply t test
t.test(Golf$Current, Golf$New, paired = FALSE, conf.level = 0.95, alternative
= "t")

##install ggplot2 package

install.packages("ggplot2")

library(ggplot2)

## statistical summaries of the data for each model.

hist(Golf$Current,main = "Current Balls", xlab = "Driving distance", border


="pink", col = "Blue")

boxplot(Golf$Current,main = "Current Balls", xlab = "Driving distance",


border ="Red", col = "Blue", horizontal = TRUE)

hist(Golf$New,main = "New Balls", xlab = "Driving distance", border ="Green",


col = "Blue")

boxplot(Golf$New,main = "New Balls", xlab = "Driving distance", border


="Orange", col = "Blue", horizontal = TRUE)

## 95% confidence interval for the population mean of each model Current and
New

#Current

x1bar = mean(Golf$Current)

s1 = sd(Golf$Current)
n = 40
z = 1.960

ULC = xbar+z*s/sqrt(n)

LLC = xbar-z*s/sqrt(n)

#New

x2bar = mean(Golf$New)

S2 = sd(Golf$New)

ULN = Nxbar+z*NS/sqrt(n)

LLN = Nxbar-z*NS/sqrt(n)

You might also like