Hello,
I am trying to calculate the minimum detectable effect size of my main exposure variable with 80% power for my multivariable linear regression model using proc power. My model includes 6 predictor variables and a sample size of 500. When I run the below code to obtain the partialcorr (smallest detectable effect size), I am getting an error. Is someone able to provide help with my code? Thank you for your time and consideration!
proc power;
multreg
model = random
nfullpredictors = 6
ntestpredictors = 1
partialcorr = .
ntotal = 500
power = 0.8
alpha = 0.05;
run;
When your question is about an error, please post the log including the error message.
Below is the log I get from running your code. It looks like partialcorr=. is an invalid value.
1 proc power; 2 multreg 3 model = random 4 nfullpredictors = 6 5 ntestpredictors = 1 6 partialcorr = . - 22 200 ERROR 22-322: Syntax error, expecting one of the following: a numeric constant, a datetime constant. ERROR 200-322: The symbol is not recognized and will be ignored. 7 ntotal = 500 8 power = 0.8 9 alpha = 0.05; 10 run; NOTE: The SAS System stopped processing this step because of errors.
Is that the error you get?
Hello @Quentin,
Yes, that is the error that I am getting. Thank you for sharing it - I will be sure to post in future.
Hello @Adele3,
In cases like this you can set NTOTAL to missing, compute the sample size for a suitable range of PARTIALCORR values (using a small step size) and then select the value which returns your planned sample size:
ods select none; ods output output=want; proc power; multreg model = random nfullpredictors = 6 ntestpredictors = 1 partialcorr = 0.1 to 0.2 by 0.0001 ntotal = . power = 0.8 alpha = 0.05; run; ods select all; proc print data=want; where abs(ntotal-500)<5; var power partialcorr ntotal; format _all_; run;
Result:
Partial Obs Power Corr NTotal 252 0.80058 0.1251 504 253 0.80042 0.1252 503 254 0.80026 0.1253 502 255 0.80010 0.1254 501 256 0.80073 0.1255 501 257 0.80057 0.1256 500 258 0.80040 0.1257 499 259 0.80024 0.1258 498 260 0.80007 0.1259 497 261 0.80070 0.1260 497 262 0.80052 0.1261 496
Hello @FreelanceReinh ,
This is wonderful, thank you very much for sharing your code! I greatly appreciate you taking the time to provide your help.
In follow-up, I have run my multivariable model using PROC GLM with the EFFECTSIZE option to calculate the observed partial correlation for my exposure of interest, by taking the square root of the partial eta-squared for my exposure variable (r = √ 0.0001 = 0.01; output below). Given my observed partial correlation (r = 0.01) is smaller than the a prior partial correlation (r = 0.1256), could this suggest that:
no meaningful effect exists between my exposure and outcome, or
my model lacks sufficient power to detect a subtle true effect, if one exists
Thank you again for your help.
You're welcome.
So, you're using PROC POWER not in the planning phase of your study, but rather for a "post-hoc calculation" ...
@Adele3 wrote:
Given my observed partial correlation (r = 0.01) is smaller than the a prior partial correlation (r = 0.1256), could this suggest that:
no meaningful effect exists between my exposure and outcome, or
my model lacks sufficient power to detect a subtle true effect, if one exists
Possibly, but I can't give a definitive answer off the top of my head. Therefore, I suggest that you start a new thread with this follow-up question in the Statistical Procedures forum, where it is more likely to get the attention of the linear models experts. (The "SAS Procedures" forum is rather about Base SAS procedures.) You can provide a link to the current thread to show where the "0.1256" comes from.
In parallel, I will take a look into my statistics book collection regarding your question and perhaps run a simulation.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.