### Confidence interval for Cohen's d of .5
### from a sample of 200 participants, also
### showing this visually: this clearly shows
### how wildly our Cohen's d value can vary
### from sample to sample.
ufs::cohensdCI(.5, n=200, plot=TRUE);
### How many participants would we need if we
### would want a more accurate estimate, say
### with a maximum confidence interval width
### of .2?
ufs::pwr.cohensdCI(.5, w=.1);
### Show that 'sampling distribution':
ufs::cohensdCI(.5,
n=pwr.cohensdCI(.5, w=.1),
plot=TRUE);
### Generate 10 random Cohen's d values
ufs::rCohensd(10, 20, populationD = .5);
### Probability of findings a Cohen's d smaller than
### .5 if it's 0 in the population (i.e. under the
### null hypothesis)
ufs::pCohensd(.5, 64);
### Probability of findings a Cohen's d larger than
### .5 if it's 0 in the population (i.e. under the
### null hypothesis)
1 - ufs::pCohensd(.5, 64);
### Probability of findings a Cohen's d more extreme
### than .5 if it's 0 in the population (i.e. under
### the null hypothesis)
ufs::pdExtreme(.5, 64);
### Probability of findings a Cohen's d more extreme
### than .5 if it's 0.2 in the population.
ufs::pdExtreme(.5, 64, populationD = .2);
Run the code above in your browser using DataLab