SPSS syntax for CI for correlation

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

SPSS syntax for CI for correlation

Moshe Marko
Hi,

I would like to include CI for a correlation analysis anyone knows the
syntax?

This is what i have so far:

compute WMOD = (TotalMod >= 5).
filter by WMOD.
CORRELATIONS
/VARIABLES=TotalMod CombISOMOD HKAcombkin60 HKAcombpwr60 HKAcombkin180
HKAcombpwr180
  /PRINT=TWOTAIL NOSIG
  /MISSING=PAIRWISE.
Filter off.
compute WOMOD = (TotalMod < 5).
filter by WOMOD.
CORRELATIONS
/VARIABLES=TotalMod CombISOMOD HKAcombkin60 HKAcombpwr60 HKAcombkin180
HKAcombpwr180
  /PRINT=TWOTAIL NOSIG
  /MISSING=PAIRWISE.
Filter off.

Thanks
Moshe

Moshe Marko, PT, DPT, MHS, OCS, CSCS
Assistant Professor
Department of Physical Therapy Education
College of Health Professions
SUNY Upstate Medical University
Room 2232  Silverman Hall
750 Adams Street
Syracuse, NY 13210-1834
315 464 6577
FAX 315 464 6887
[hidden email]

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSS syntax for CI for correlation

Bruce Weaver
Administrator
Moshe Marko wrote
Hi,

I would like to include CI for a correlation analysis anyone knows the
syntax?

This is what i have so far:

compute WMOD = (TotalMod >= 5).
filter by WMOD.
CORRELATIONS
/VARIABLES=TotalMod CombISOMOD HKAcombkin60 HKAcombpwr60 HKAcombkin180
HKAcombpwr180
  /PRINT=TWOTAIL NOSIG
  /MISSING=PAIRWISE.
Filter off.
compute WOMOD = (TotalMod < 5).
filter by WOMOD.
CORRELATIONS
/VARIABLES=TotalMod CombISOMOD HKAcombkin60 HKAcombpwr60 HKAcombkin180
HKAcombpwr180
  /PRINT=TWOTAIL NOSIG
  /MISSING=PAIRWISE.
Filter off.

Thanks
Moshe
I'm not aware of any nice neat way to do that in SPSS.  But here's an ugly way.  (I'm hoping that I, or someone else, will think of a neater method.)

* Use the Employee data that ships with SPSS to illustrate.
* Other users may have to modify the path to the file below.

* [1] Apply Fisher's r-to-z transformation.
* [2] Compute the 95% CI on that scale.
* [3] Transform the lower & upper limits back to the original scale.

new file.
dataset close all.

GET FILE='C:\Program Files\SPSSInc\PASWStatistics17\Samples\Employee data.sav'.
dataset name rawdat.

* Use /MATRIX OUT to write the correlations out to a dataset.

dataset declare corrmat.

CORRELATIONS
  /VARIABLES=salary salbegin jobtime prevexp
  /PRINT=TWOTAIL NOSIG
  /MISSING=PAIRWISE
  /MATRIX=OUT('corrmat').

dataset activate corrmat window = front.
select if any(rowtype_,"N","CORR").
exe.

dataset copy N_mat window = front.

dataset activate N_mat.
select if any(rowtype_,"N").
exe.
rename var ( salary salbegin jobtime prevexp = n1 n2 n3 n4).

dataset activate corrmat.
select if any(rowtype_,"CORR").
exe.
rename var ( salary salbegin jobtime prevexp = r1 r2 r3 r4).

dataset activate corrmat.
match files
 file = * /
 file = 'N_mat' .
exe.

dataset close N_mat.
dataset close rawdat.

* Apply r-to-z transform, compute CI, and back-transform.

do repeat r = r1 to r4 / n = n1 to n4 / LL = LL1 to LL4 / UL = UL1 to UL4 .
- do if (r GT -1) and (r LT 1).
-   compute #z = 0.5*ln((1+r)/(1-r)).
-   compute #se = 1 / SQRT(n-3).
-   compute #lower = #z - 1.96 * #se .
-   compute #upper = #z + 1.96 * #se .
-   compute LL = ((exp(2 * #lower)) - 1) / ((exp(2 * #lower)) + 1) .
-   compute UL = ((exp(2 * #upper)) - 1) / ((exp(2 * #upper)) + 1) .
-   if (LL LT -1) LL = -1 .
-   if (UL GT  1) UL =  1 .
- end if.
end repeat.
exe.
format r1 to r4 LL1 to UL4 (f5.2) / n1 to n4 (f5.0).

VARSTOCASES
  /ID=col
  /MAKE r FROM r1 r2 r3 r4
  /MAKE LL FROM LL1 LL2 LL3 LL4
  /MAKE UL FROM UL1 UL2 UL3 UL4
  /MAKE n FROM n1 n2 n3 n4
  /INDEX= row(4)
  /KEEP=
  /NULL=KEEP.

list.

Hey...I warned you it would be ugly!  

HTH.

--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: SPSS syntax for CI for correlation

Ryan
In reply to this post by Moshe Marko
Here's one solution:
 
 
On Fri, May 21, 2010 at 1:40 PM, Moshe Marko <[hidden email]> wrote:
Hi,

I would like to include CI for a correlation analysis anyone knows the
syntax?

This is what i have so far:

compute WMOD = (TotalMod >= 5).
filter by WMOD.
CORRELATIONS
/VARIABLES=TotalMod CombISOMOD HKAcombkin60 HKAcombpwr60 HKAcombkin180
HKAcombpwr180
 /PRINT=TWOTAIL NOSIG
 /MISSING=PAIRWISE.
Filter off.
compute WOMOD = (TotalMod < 5).
filter by WOMOD.
CORRELATIONS
/VARIABLES=TotalMod CombISOMOD HKAcombkin60 HKAcombpwr60 HKAcombkin180
HKAcombpwr180
 /PRINT=TWOTAIL NOSIG
 /MISSING=PAIRWISE.
Filter off.

Thanks
Moshe

Moshe Marko, PT, DPT, MHS, OCS, CSCS
Assistant Professor
Department of Physical Therapy Education
College of Health Professions
SUNY Upstate Medical University
Room 2232  Silverman Hall
750 Adams Street
Syracuse, NY 13210-1834
315 464 6577
FAX 315 464 6887
[hidden email]

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

Reply | Threaded
Open this post in threaded view
|

Re: SPSS syntax for CI for correlation

Ryan
In reply to this post by Moshe Marko
Come to think of it, running separate linear regression analyses using the standardized variables might just do the trick:
 
DESCRIPTIVES VARIABLES=x y
  /SAVE.
 
REGRESSION
  /STATISTICS COEFF CI(95)
  /CRITERIA=PIN(.05) POUT(.10)
  /DEPENDENT Zy
  /METHOD=ENTER Zx.
Ryan
On Fri, May 21, 2010 at 1:40 PM, Moshe Marko <[hidden email]> wrote:
Hi,

I would like to include CI for a correlation analysis anyone knows the
syntax?

This is what i have so far:

compute WMOD = (TotalMod >= 5).
filter by WMOD.
CORRELATIONS
/VARIABLES=TotalMod CombISOMOD HKAcombkin60 HKAcombpwr60 HKAcombkin180
HKAcombpwr180
 /PRINT=TWOTAIL NOSIG
 /MISSING=PAIRWISE.
Filter off.
compute WOMOD = (TotalMod < 5).
filter by WOMOD.
CORRELATIONS
/VARIABLES=TotalMod CombISOMOD HKAcombkin60 HKAcombpwr60 HKAcombkin180
HKAcombpwr180
 /PRINT=TWOTAIL NOSIG
 /MISSING=PAIRWISE.
Filter off.

Thanks
Moshe

Moshe Marko, PT, DPT, MHS, OCS, CSCS
Assistant Professor
Department of Physical Therapy Education
College of Health Professions
SUNY Upstate Medical University
Room 2232  Silverman Hall
750 Adams Street
Syracuse, NY 13210-1834
315 464 6577
FAX 315 464 6887
[hidden email]

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD

Reply | Threaded
Open this post in threaded view
|

Re: SPSS syntax for CI for correlation

Bruce Weaver
Administrator
In reply to this post by Ryan
Good find, Ryan.  I just tried this on the Employee data, and it gives the same results as the butt-ugly code I posted earlier.  But obviously, the Hayes macro is MUCH neater.  (I figured there must be a way to do it with MATRIX.)

I also tried the REGRESSION method Ryan suggested in another post, and it does not always give exactly the same results for the limits on the 95% CI.  That doesn't surprise me, as it's not using the r-to-z transformation approach.

So my advice is to use the Hayes macro.



rblack wrote
Here's one solution:

http://www.comm.ohio-state.edu/ahayes/SPSS%20programs/rci.htm

Ryan

On Fri, May 21, 2010 at 1:40 PM, Moshe Marko <MarkoM@upstate.edu> wrote:

> Hi,
>
> I would like to include CI for a correlation analysis anyone knows the
> syntax?
>
> This is what i have so far:
>
> compute WMOD = (TotalMod >= 5).
> filter by WMOD.
> CORRELATIONS
> /VARIABLES=TotalMod CombISOMOD HKAcombkin60 HKAcombpwr60 HKAcombkin180
> HKAcombpwr180
>  /PRINT=TWOTAIL NOSIG
>  /MISSING=PAIRWISE.
> Filter off.
> compute WOMOD = (TotalMod < 5).
> filter by WOMOD.
> CORRELATIONS
> /VARIABLES=TotalMod CombISOMOD HKAcombkin60 HKAcombpwr60 HKAcombkin180
> HKAcombpwr180
>  /PRINT=TWOTAIL NOSIG
>  /MISSING=PAIRWISE.
> Filter off.
>
> Thanks
> Moshe
>
> Moshe Marko, PT, DPT, MHS, OCS, CSCS
> Assistant Professor
> Department of Physical Therapy Education
> College of Health Professions
> SUNY Upstate Medical University
> Room 2232  Silverman Hall
> 750 Adams Street
> Syracuse, NY 13210-1834
> 315 464 6577
> FAX 315 464 6887
> markom@upstate.edu
>
> =====================
> To manage your subscription to SPSSX-L, send a message to
> LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Automatic reply: SPSS syntax for CI for correlation

Genevieve Odoom
Hello,
Thank you for your email. I will be out of the office on Tuesday, May 25th, returning on Wednesday, May 26th and will respond to your email upon my return.

Thanks!
Genevieve Odoom
Policy and Program Analyst
OANHSS
Suite 700 - 7050 Weston Rd. Woodbridge,
ON L4L 8G7
Tel: (905) 851-8821 x 241 Fax: (905) 851-0744
[hidden email]
www.oanhss.org<https://mail.oanhss.org/ecp/Organize/www.oanhss.org>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: SPSS syntax for CI for correlation

Ryan
In reply to this post by Bruce Weaver
I'd like to provide additional confirmation that the REGRESSION method I suggested does not yield identical results to Haye's macro. I also suggest Haye's macro be used instead. Apologies if this has caused any confusion.

Ryan
 
On Fri, May 21, 2010 at 5:07 PM, Bruce Weaver <[hidden email]> wrote:
Good find, Ryan.  I just tried this on the Employee data, and it gives the
same results as the butt-ugly code I posted earlier.  But obviously, the
Hayes macro is MUCH neater.  (I figured there must be a way to do it with
MATRIX.)

I also tried the REGRESSION method Ryan suggested in another post, and it
does not always give exactly the same results for the limits on the 95% CI.
That doesn't surprise me, as it's not using the r-to-z transformation
approach.

So my advice is to use the Hayes macro.




rblack wrote:
>
> Here's one solution:
>
> http://www.comm.ohio-state.edu/ahayes/SPSS%20programs/rci.htm
>
> Ryan
>
> On Fri, May 21, 2010 at 1:40 PM, Moshe Marko <[hidden email]> wrote:
>
>> Hi,
>>
>> I would like to include CI for a correlation analysis anyone knows the
>> syntax?
>>
>> This is what i have so far:
>>
>> compute WMOD = (TotalMod >= 5).
>> filter by WMOD.
>> CORRELATIONS
>> /VARIABLES=TotalMod CombISOMOD HKAcombkin60 HKAcombpwr60 HKAcombkin180
>> HKAcombpwr180
>>  /PRINT=TWOTAIL NOSIG
>>  /MISSING=PAIRWISE.
>> Filter off.
>> compute WOMOD = (TotalMod < 5).
>> filter by WOMOD.
>> CORRELATIONS
>> /VARIABLES=TotalMod CombISOMOD HKAcombkin60 HKAcombpwr60 HKAcombkin180
>> HKAcombpwr180
>>  /PRINT=TWOTAIL NOSIG
>>  /MISSING=PAIRWISE.
>> Filter off.
>>
>> Thanks
>> Moshe
>>
>> Moshe Marko, PT, DPT, MHS, OCS, CSCS
>> Assistant Professor
>> Department of Physical Therapy Education
>> College of Health Professions
>> SUNY Upstate Medical University
>> Room 2232  Silverman Hall
>> 750 Adams Street
>> Syracuse, NY 13210-1834
>> 315 464 6577
>> FAX 315 464 6887
>> [hidden email]
>>
>> =====================
>> To manage your subscription to SPSSX-L, send a message to
>> [hidden email] (not to SPSSX-L), with no body text except the
>> command. To leave the list, send the command
>> SIGNOFF SPSSX-L
>> For a list of commands to manage subscriptions, send the command
>> INFO REFCARD
>>
>
>


-----
--
Bruce Weaver
[hidden email]
http://sites.google.com/a/lakeheadu.ca/bweaver/
"When all else fails, RTFM."

NOTE:  My Hotmail account is not monitored regularly.
To send me an e-mail, please use the address shown above.
--
View this message in context: http://old.nabble.com/SPSS-syntax-for-CI-for-correlation-tp28636974p28638708.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD