# creating 100 random numbers that are normally distributed # mean is 0, standard deviation is 0 a = rnorm(100,0,1) # the same for 1000 random numbers with normal distribution a = rnorm(1000,0,1) # plot histogram hist(a) # plot density plot(density(a)) # creating both images on top of each other # second image does not contain axes and labels # label size of first image are larger than standard for better readability hist(a,cex.axis=1.3) par(new=T) plot(density(a),xaxt="n",yaxt="n",col=2,lwd=2,main="",xlab="",ylab="") # save image as pdf dev.print("image.pdf",device=pdf) # looking up t-value, p=0.95, df = 59 qt(0.95,59) # calv example calv.male = c(46,37,39,37,33,48,35) calv.female = c(27,37,35,41,35,34,43,38,40) plot(density(calv.male)) plot(density(calv.female)) # boxplot boxplot(calv.male,calv.female,col=2) # F-test var.test(calv.male,calv.female) # t-test with equal variances t.test(calv.male,calv.female,var.equal=T) # t-test with non-equal variances t.test(calv.male,calv.female) # non-equality is the default