Skip to content

Instantly share code, notes, and snippets.

@mick001
Created August 28, 2015 19:24
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 mick001/ab4076bf4b9803efc1b5 to your computer and use it in GitHub Desktop.
Save mick001/ab4076bf4b9803efc1b5 to your computer and use it in GitHub Desktop.
Hypothesis testing on normally distributed data in R (part 2). Full article at: http://www.firsttimeprogrammer.blogspot.com/2015/07/hypothesis-testing-on-normally.html
# Plot of the Student distribution
dfs <- length(data_vector)-1
x_ <- seq(-8,8,0.1)
y <- dt(x_,dfs)
t.val <- qt(1-0.05,df=dfs)
plot(x_,y,type='l',lwd=3,col='blue',xlab='x',ylab='Density',main='Student distribution 9 dof')
abline(v=0)
abline(v=t.val,lwd=2,col='red')
points(t.val,dt(t.val,dfs),lwd=3,col='red')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment