Skip to content

Instantly share code, notes, and snippets.

@nashutoing
Created March 20, 2019 09:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nashutoing/c8ce0601a06ec69a79fd7f5569002ade to your computer and use it in GitHub Desktop.
Save nashutoing/c8ce0601a06ec69a79fd7f5569002ade to your computer and use it in GitHub Desktop.
Q-Qplot as for the number of hit at(BAT) 2018MLB
MB18<- read.csv("2018MLB_batter.csv")
MB18$H
hist(MB18$H) #distorted, not simillar with normal distribution
MB18lim<- MB18[MB18$H>20,] #linit the player: under 20Hits are deleted
hist(MB18lim$H)
MB18O<- MB18[order(MB18$H),] # aort by ascending order as hit number
MMM<- MB18lim[order(MB18lim$H),] #〃
plot(MB18O$H) #index,so didn't use,so
x<- ecdf(MB18$H)
plot(x) #make cumlative function
plot(MMM$H) #index,didn't use,so
y<- ecdf(MB18lim$H)
plot(y) #make cumlative function (limited ver)
par(mfrow=c(1,3))
plot(x)
curve(pnorm(x,0,1),xlim=c(-3,3))
qqnorm(MB18$H)
par(mfrow=c(1,3))
plot(y)
curve(pnorm(x,0,1),xlim=c(-3,3))
qqnorm(MB18lim$H)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment