Determine required sample size for a paired t-test using power analysis

17 views (last 30 days)
I have two sets of measurements that I'm comparing with each other; x1, x2. The data are paired such that x1(n) corresponds to x2(n) (similar to a before and after scenario, for example x1 might be a group of people's weight before a diet, x2 is their weight after 3 weeks on the diet). I'm trying to determine if there is a statistically significant difference between x1 and x2. I've decided that a paired t-test is appropriate.
I would like to perform a power analysis to make sure that my sample size is sufficient to detect a difference. I am a little shaky on this type of analysis, but, I know that I need the mean difference between x1 and x2 ( mean(x1-x2) ), the standard deviation of the difference ( std(x1-x2) ), the significance level (alpha=.05), and the desired power (0.90).
Could someone point me in the right direction? Does MATLAB have a function that can tell me the sample size needed to achieve the desired power at a given significance level, mean difference, and std of difference?
Thanks in advance for any insight.
  1 Comment
Padma Naveena Ganapam
Padma Naveena Ganapam on 20 Mar 2021
Hey,
I am facing the same issue and I am not sure if the matlab function 'samplesizepwr' work for a paired ttest. Did you have any luck with it?
Please let me know.
Thanks in advance

Sign in to comment.

Answers (1)

Katharina Krösl
Katharina Krösl on 9 Feb 2019
I think this source should answer the question: https://www.mathworks.com/help/stats/sampsizepwr.html

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!