Hello all,
I am working on graphing my proc means data points but the confidence limits that my proc means is calculating doesn't seem to be right according to my calculations?
I am calculating the confidence limit as MEAN +/- 1.96*Standard Error.
If someone could elucidate how SAS calculates the "LCLM" and "UCLM" and how it is different from my calculation, that would be much appreciated.
proc means data=wide_merged_file_sans_pooled n mean stddev stderr lclm uclm median min max STACKODS;
var itac_fuvisit_f0 itac_fuvisit_f1 itac_fuvisit_f2 itac_fuvisit_f3 itac_fuvisit_f5
itac_fuvisit_f6 itac_fuvisit_f7 itac_fuvisit_f8;
ods output summary = summaryStats; run;
The formulas are here:
SAS uses the t-distribution, not normal so it varies very slightly based on the number of observations. If you only have a few observations you'll see differences from the z-score calculations.
Here's an example that illustrates the issue. I would have expected it to be closer as well.
proc means data=sashelp.class N MEAN STDDEV STDERR UCLM LCLM alpha=0.05 STACKODS;
var weight height;
ods output summary = summaryStats;
run;
data check_calcs;
set summaryStats;
*19 for the number of observations;
p=quantile('T', .975, 19);
manual_UCLM = mean + p*stderr;
manual_LCLM = mean - p*stderr;
diff_UCLM = UCLM - manual_UCLM;
diff_LCLM = LCLM - manual_LCLM;
format diff: 8.4;
run;
proc print data=check_calcs;
run;
The formulas are here:
SAS uses the t-distribution, not normal so it varies very slightly based on the number of observations. If you only have a few observations you'll see differences from the z-score calculations.
Here's an example that illustrates the issue. I would have expected it to be closer as well.
proc means data=sashelp.class N MEAN STDDEV STDERR UCLM LCLM alpha=0.05 STACKODS;
var weight height;
ods output summary = summaryStats;
run;
data check_calcs;
set summaryStats;
*19 for the number of observations;
p=quantile('T', .975, 19);
manual_UCLM = mean + p*stderr;
manual_LCLM = mean - p*stderr;
diff_UCLM = UCLM - manual_UCLM;
diff_LCLM = LCLM - manual_LCLM;
format diff: 8.4;
run;
proc print data=check_calcs;
run;
HI:
Suggest you refer to the PROC MEANS doc: https://go.documentation.sas.com/?docsetId=proc&docsetTarget=n1qnc9bddfvhzqn105kqitnf29cp.htm&docset... you can control the ALPHA using the ALPHA= option. The default ALPHA is .05, giving a confidence limit of 95%.
The doc says:
" ALPHA=value ... specifies the confidence level to compute the confidence limits for the mean. The percentage for the confidence limits is (1−value)×100. An example is (ALPHA=.05 results in a 95% confidence limit)."
Cynthia
You might also find this older article helpful: Confidence in the 95% Confidence Interval of Mean
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
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.