# Step By Step guide 8: Running paired-samples t test in JASP (Gosset’s data)

In this step-by-step guide i’m going to reproduce william gossett or student students data published in the article the probable error of the mean and he presented this study of with drugs drug one drug two and then and then the the variable was um how many hours of sleep the the taking the drug increases so if it is positive it means more hours of sleep if it is

Negative is less hours of sleep and and they apply two drugs to the same to the same same patients so we’ve got one column for drag one one two column four drag two and then one column for the difference we actually don’t need the column for the difference to run the analysis but it’s useful to have it now first thing because when you replicate these old studies

You always have surprises and the first surprise is that we need to make a correction to to the analysis look at the data of gosset look at patient number five we drag one minus or negative one hours or one hour less of sleep in rock tube 0.1 hours less of sleep difference zero okay that’s just a mistake so obviously for having a difference of zero this this

Has to be 0.1 in fact well i could have corrected this but i did the by putting this 0.1 then you get this mean and this standard deviation in fact the other surprise is the standard deviation so when i show you the standard deviation um analysis you’ll see a difference and i’m going to explain why because it’s quite interesting so let’s go to the paired sample

T-test pair samples t-test so we’ve got drug one and then so just asks us to pre present the pairs one is the a pair samples t test or repeated measures t test so remember that is different for the independent samples t-test okay so we put drug 1 and drug 2 and immediately just calculates the t t test now let’s go to descriptives we take descriptives here and

Then we get for drag one the mean and the standard deviation and the standard error for track 2 mean standard deviation and standard error okay let’s compare with the because it’s paper so mean 0.75 for drag 1 and drag 2’s 2.33 mean 0.75 and mean 2.33 so that’s correct now what about the standard deviation we’ve got 1.79 for drag 1 and 2 for drug two let’s

See what we get started equation 170 and standard deviation 190. so why is it different well in fact what gossip did here or we presented here is correct and what jasp is doing is incorrect but is incorrect in a way that is um everybody all software including r spss all of them they do this and what do they do so i i reconstructed how to cam how how in gossip

Got the result and we get this result and it is what i suspected basically remember that when we calculate the mean we sum all the values and we divide the values by the number of values divided by n so that’s an average and for the standard deviation then what you do is you subtract the mean from all the values that gives you a measure of the distance from the

Mean but then you square those values to avoid the negatives and then so we obtain the variance first and what do we divide we divide by n minus one and i always was curious why do we divide by n minus one and no divide by n so we could get an average of the the distance between each value between all the values and and the mean so that would be nice well um

I found this the solution in one one r one book in statistics by navarro and in that book it shows the what’s the what’s the issue there the issue is that the correct way of calculating the standard deviation of the sample is divided by dividing by n but we rarely are interested in the standard deviation of the sample we always use the standard deviation as an

Estimate of the standard deviation of the population and and statisticians found out that when you calculate standard deviation divided by n that’s not a very good or reset rather than not very good it’s a biased estimate of this standard deviation of the population so the what they did is to divide by n minus 1 and by dividing by n minus 1 that is an unbiased

Estimate of the standard deviation so then people started calculating standard deviation by divided by n minus 1 and reported that as descriptive statistics so to me the correct thing is to do the standard deviation divided by by n and that’s the descriptives and when you want to do estimation you do by n minus 1. but nobody does that 99.999 percent of people

Or articles would calculate by divided by n minus 1 and all the software including r which is tends to be more um progressive in in changes they do calculate the standard deviation divided dividing by n minus 1. so that is the difference and it’s interesting to see the historical papers because you you find these differences that are that that help you understand

What the the types of analysis that they were doing so let’s continue let’s assume that uh we will continue with the modern way of of of doing the standard deviation now because of the standard this change in the standard deviation my t-score with jasp is slightly different so we’ve got minus 4.06 and in the in the uh paper uh sorry i calculated the tip using

The standard deviation and student doesn’t doesn’t provide the the t test as i mentioned before it provides the the just divided by the standard deviation not not using this this component and so it didn’t provide the t score so i cannot say that that my t score that the t score calculated here is the one that uh students provided it’s not but so the one that

I did based on this standard deviation published here and was as i mentioned here 4.89 and the one calculating with jasp is 4.06 in both cases these are these are our values that are far from from the the mean of the distribution and the p value in this case is 0.0028 so it’s a bit a bit lower than than the one calculated using the standard deviation that uh

Students provided okay so basically this is it we’ve got these um and the descriptive statistics this mean standard deviation this is the standard error of the mean and we’ve got the t-test the degrees of freedom and the p-value and we can have more information location parameter it shows the mean difference okay so we’ve got the the mean the mean uh difference

Is minus 1.58 and the standard error of the difference is 0.389 and we can have a confidence interval over that for the difference so that if the the confidence interval for the difference is minus 2.45 or 4 6 and that’s the lower bound and the upper bounds minus 0.7 okay um we can have descriptive plots that shows us track one track two and and some measurement of variability here

Transcribed from video
Step By Step guide 8: Running paired-samples t test in JASP (Gosset's data) By Guillermo Campitelli