BookmarkSubscribeRSS Feed
AsthmaticRunner
Calcite | Level 5

I am trying to determine confidence intervals for a correlation, but without using Fisher's Z as the Ho=0 and Ha(do not) equal 0.  So no Fisher Z required.  

1 REPLY 1
mkeintz
PROC Star

Why you wouldn't accept the probability under H0: rho=0 produced by PROC CORR, I have no idea.  Even if it uses the z transform, wouldn't it produce the correct probability?

 

However, if you must.  Using the "testing rho=0" section of Estimation and Confidence Intervals in notes for Introduction to Statistics at Andrews.edu, it looks like you can calculate t=r•sqrt((n-2)/(1-r2)), where r is your sample correlation.  You can compare your value ot t against the critical values for n-2 degrees of freedom and alpha level of your choice.

 

Assuming you know your N and r in, say, dataset mycorrs, you can do this:

 

data want;
  set mycorrs;
  df=n-2;
  alpha=0.05;
  sample_t=r*sqrt(df)/(1-r**2);

  prob_abs_t=probt(abs(sample_t),df);
  prob_abs_r_eq_0=2*(1-prob_abs_t);

  lower_critval=tinv(alpha/2,df);
  upper_critval=-1*lower_critval;

  put 'Sample stats: ' r= n= sample_t=  ' Prob >|r| under H0: ' prob_abs_r_eq_0;

  if lower_critval <= sample_t <= upper_critval then put "H0: rho=0 is not rejected at " alpha=;
  else put "H0: rho=0 is rejected at " alpha=;
run;

 

 

Lots of extra stuff in this program, but it is not clear what precisely you want.

 

Added two minutes later: you really might want to put this question in the Analytics section, sub-section IML.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 865 views
  • 2 likes
  • 2 in conversation