- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Is there a method in SAS to create bias corrected bootstrap confidence intervals for spearman correlation coefficients?
I tried to follow this blog - Compute a bootstrap confidence interval in SAS - The DO Loop
However, this doesn't seem to work for the proc corr procedure.
Thanks in advance
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The OP asked about the Spearman correlation, so change the OUTP= option to the OUTS= option.
The OP asked about a bias-corrected and adjusted confidence interval, whereas my blog post (and PGStat's modification) provides a percentile CI. You can read about ways to obtain a BCa interval in the article "The bias-corrected and accelerated (BCa) bootstrap interval."
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
However, this doesn't seem to work for the proc corr procedure.
Why not? Seems like it would work as far as I can tell. Use PROC CORR where the example in the blog uses PROC MEANS.
Paige Miller
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
> However, this doesn't seem to work for the proc corr procedure.
That is a bit of a vague statement.
Can you tell us why you do conclude that the approach would not work for PROC CORR?
Or do you maybe get errors / warnings in the LOG?
Thanks,
Koen
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
Rick Wicklin's code can be adapted for proc CORR:
data sample(keep=x y);
set Sashelp.Iris(where=(Species="Virginica") rename=(SepalWidth=x PetalWidth=y));
run;
proc corr data=Sample Pearson;
var x;
with y;
run;
%let NumSamples = 500; /* number of bootstrap resamples */
/* 2. Generate many bootstrap samples */
proc surveyselect data=sample NOPRINT seed=18558
out=BootSetForCorr(rename=(Replicate=SampleID))
method=urs /* resample with replacement */
samprate=1 /* each bootstrap sample has N observations */
/* OUTHITS option to suppress the frequency var */
reps=&NumSamples; /* generate NumSamples bootstrap resamples */
run;
proc corr data=BootSetForCorr outp=BootPearsonCorr(where=(_TYPE_="CORR")) noprint;
by SampleId;
freq NumberHits;
var x;
with y;
run;
proc univariate data=BootPearsonCorr noprint;
var x; /* Variable x in proc CORR output contains the correlation */
output out=BootPctl mean=Boot_Mean_Corr pctlpre =Boot_CI95_
pctlpts = 2.5 97.5 /* compute 95% bootstrap confidence interval */
pctlname=Lower Upper;
run;
proc print data=BootPctl noobs; run;
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
The OP asked about the Spearman correlation, so change the OUTP= option to the OUTS= option.
The OP asked about a bias-corrected and adjusted confidence interval, whereas my blog post (and PGStat's modification) provides a percentile CI. You can read about ways to obtain a BCa interval in the article "The bias-corrected and accelerated (BCa) bootstrap interval."
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
I should mention that you will need an extra step if you want to bootstrap the correlation among more than two variables. In PGStat's program, the program works for a single correlation coefficient. However, when bootstrapping k > 2 variables, the OUTP= data set puts the correlation coefficients into a matrix. You then need to use an extra step to prepare the bootstrap distribution for analysis. For details and an example, see "Bootstrap correlation coefficients in SAS."
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content