Kendall's partial tau and BCa confidence interval

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

Kendall's partial tau and BCa confidence interval

Sergej Kornev
Hello!
Does anyone have a tip where I can found a syntax or a module that will
enable SPSS to produce a Bias Corrected CI for a Kendall's partial
correlation?

Stata has a module for doing it:
http://fmwww.bc.edu/RePEc/bocode/p/parttau.html

Is there a possibility to do the same in SPSS v25?

I try unsuccessfully with the syntax below. The code works without the
Bootstrap part. Maybe there is a little thing to be added or changed so the
Bootstrap comes trough.

I include a small dataset.

Thanks a lot!

BOOTSTRAP
/SAMPLING METHOD=SIMPLE
/VARIABLES INPUT=X Y Z
/CRITERIA CILEVEL=95 CITYPE=BCA NSAMPLES=1000
/MISSING USERMISSING=EXCLUDE.
NONPAR CORR X Y Z
/PRINT=KENDALL ONETAIL NOSIG
/MISSING = LISTWISE
/MATRIX OUT(*).
RECODE rowtype_('TAUB'='CORR').
PARTIAL CORR X Y BY Z
/significance = onetail
/MISSING = LISTWISE
/MATRIX IN(*). test.sav
<http://spssx-discussion.1045642.n5.nabble.com/file/t341500/test.sav>  



--
Sent from: http://spssx-discussion.1045642.n5.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
Reply | Threaded
Open this post in threaded view
|

Re: Kendall's partial tau and BCa confidence interval

Jon Peck
This worked for me, but with V25 you may need to install fixpack1.

BOOTSTRAP
  /SAMPLING METHOD=SIMPLE
  /VARIABLES INPUT=r01 r02 agegroup 
  /CRITERIA CILEVEL=95 CITYPE=BCA  NSAMPLES=1000
  /MISSING USERMISSING=EXCLUDE.
PARTIAL CORR
  /VARIABLES=r01 r02 BY agegroup
  /SIGNIFICANCE=TWOTAIL
  /MISSING=LISTWISE.

On Thu, Aug 30, 2018 at 12:34 PM Sergej Kornev <[hidden email]> wrote:
Hello!
Does anyone have a tip where I can found a syntax or a module that will
enable SPSS to produce a Bias Corrected CI for a Kendall's partial
correlation?

Stata has a module for doing it:
http://fmwww.bc.edu/RePEc/bocode/p/parttau.html

Is there a possibility to do the same in SPSS v25?

I try unsuccessfully with the syntax below. The code works without the
Bootstrap part. Maybe there is a little thing to be added or changed so the
Bootstrap comes trough.

I include a small dataset.

Thanks a lot!

BOOTSTRAP
/SAMPLING METHOD=SIMPLE
/VARIABLES INPUT=X Y Z
/CRITERIA CILEVEL=95 CITYPE=BCA NSAMPLES=1000
/MISSING USERMISSING=EXCLUDE.
NONPAR CORR X Y Z
/PRINT=KENDALL ONETAIL NOSIG
/MISSING = LISTWISE
/MATRIX OUT(*).
RECODE rowtype_('TAUB'='CORR').
PARTIAL CORR X Y BY Z
/significance = onetail
/MISSING = LISTWISE
/MATRIX IN(*). test.sav
<http://spssx-discussion.1045642.n5.nabble.com/file/t341500/test.sav



--
Sent from: http://spssx-discussion.1045642.n5.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


--
Jon K Peck
[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: Kendall's partial tau and BCa confidence interval

Sergej Kornev
Thank you Jon for your response. My knowledge of SPSS syntax is very limited,
but it's look like it produces /Spearman/ partial correlation with CI BCa.

Basically I try to find out if there is a way to make SPSS to produce an
analysis with 3 feature:
1. Kendalls Tau-b
2. Partial correlation
3. Bias Corrected Accelerated Confidence Interval



--
Sent from: http://spssx-discussion.1045642.n5.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
Reply | Threaded
Open this post in threaded view
|

Re: Kendall's partial tau and BCa confidence interval

Jon Peck
Why do you think you are getting a Spearman corr from this syntax?  The NONPAR CORR syntax specifies Kendall, and the output is labelled Kendal.

On Mon, Sep 3, 2018 at 9:37 AM Sergej Kornev <[hidden email]> wrote:
Thank you Jon for your response. My knowledge of SPSS syntax is very limited,
but it's look like it produces /Spearman/ partial correlation with CI BCa.

Basically I try to find out if there is a way to make SPSS to produce an
analysis with 3 feature:
1. Kendalls Tau-b
2. Partial correlation
3. Bias Corrected Accelerated Confidence Interval



--
Sent from: http://spssx-discussion.1045642.n5.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


--
Jon K Peck
[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: Kendall's partial tau and BCa confidence interval

Sergej Kornev
<http://spssx-discussion.1045642.n5.nabble.com/file/t341500/partial_correlation.jpg>
Unfortunately, I can't see no label for Kendall when entering:

PARTIAL CORR
  /VARIABLES=x y BY z  
 /SIGNIFICANCE=TWOTAIL
 /MISSING=LISTWISE.



--
Sent from: http://spssx-discussion.1045642.n5.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
Reply | Threaded
Open this post in threaded view
|

Re: Kendall's partial tau and BCa confidence interval

Kirill Orlov
Sergei, Does partial Kendall correlation ever exist?

===================== 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: Kendall's partial tau and BCa confidence interval

Sergej Kornev
Hello Kirill,
Yes, it does.

The problem itself is not the partial version of Kendall (the syntax below),
but how to get the confidence intervals.
The question is how to integrate the BOOTSTRAP...

*NONPAR CORR X Y Z
/PRINT=KENDALL ONETAIL NOSIG
/MISSING = LISTWISE
/MATRIX OUT(*).
RECODE rowtype_('TAUB'='CORR').
PARTIAL CORR X Y BY Z
/significance = onetail
/MISSING = LISTWISE
/MATRIX IN(*).*



--
Sent from: http://spssx-discussion.1045642.n5.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
Reply | Threaded
Open this post in threaded view
|

Re: Kendall's partial tau and BCa confidence interval

Kirill Orlov
RECODE rowtype_('TAUB'='CORR').
That twist looks silly. You CANNOT use PARTIAL CORR command to compute partial version of Kendall correlation (even if such exists in statistics). PARTIAL CORR algorithm is tethered only to Pearson correlation.


04.09.2018 13:26, Sergej Kornev пишет:
Hello Kirill, 
Yes, it does.

The problem itself is not the partial version of Kendall (the syntax below),
but how to get the confidence intervals.
The question is how to integrate the BOOTSTRAP...

*NONPAR CORR X Y Z
/PRINT=KENDALL ONETAIL NOSIG
/MISSING = LISTWISE
/MATRIX OUT(*).
RECODE rowtype_('TAUB'='CORR').
PARTIAL CORR X Y BY Z
/significance = onetail
/MISSING = LISTWISE
/MATRIX IN(*).*



--
Sent from: http://spssx-discussion.1045642.n5.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



===================== 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: Kendall's partial tau and BCa confidence interval

Kirill Orlov
In reply to this post by Sergej Kornev
If you want some form of "partial association" for nominal variables please consider Cochrans and Mantel-Haenszel conditional independence tests\statistics in CROSSTAB procedure. ===================== 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: Kendall's partial tau and BCa confidence interval

Sergej Kornev
In reply to this post by Kirill Orlov
From IBM Support: https://www-01.ibm.com/support/docview.wss?uid=swg21474822 


> Although the PARTIAL CORR procedure in SPSS does not have a way of
> specifying rank correlations, there is a way to work around this problem,
> as follows:
>
> Use the /MATRIX OUT subcommand in NONPAR CORR (Nonparametric correlation)
> procedure to save a matrix of Spearman Rho correlations as the current
> data set. The PARTIAL CORR procedure can read this matrix as the input
> data by using the /MATRIX IN subcommand, so that the partial correlations
> computed are based on Spearman rhos. The NONPAR CORR and PARTIAL CORR
> procedures must be run from a syntax window in order to use the /MATRIX
> subcommands. An example follows:
>
> NONPAR CORR salbeg time edlevel age
> /MISSING = LISTWISE
> /MATRIX OUT(*).
> RECODE rowtype_ ('RHO'='CORR') .
> PARTIAL CORR salbeg time edlevel BY age
> /MISSING = LISTWISE
> /MATRIX IN(*).

The attached screenshot is from IBM SPSS Statistics 25 Command Syntax
Reference
<http://spssx-discussion.1045642.n5.nabble.com/file/t341500/reference.png>



--
Sent from: http://spssx-discussion.1045642.n5.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
Reply | Threaded
Open this post in threaded view
|

Re: Kendall's partial tau and BCa confidence interval

Kirill Orlov
That's correct. Spearman rho is Pearson r computed on ranks. Therefore there is no formal mistake in calculating partial correlations out of Spearman rho matrix. That simply will mean you are dismissing the idea of your initial data and has completely turned onto the rails of ranks as your data.

Kendall tau corr is very different from both Pearson and Spearman. There is no direct homology with it to the idea of "partial correlation", and so you may not tuck tau matrix into PARTIAL CORR procedure - it is a silly pass.


04.09.2018 13:54, Sergej Kornev пишет:
>From IBM Support: https://www-01.ibm.com/support/docview.wss?uid=swg21474822 


Although the PARTIAL CORR procedure in SPSS does not have a way of
specifying rank correlations, there is a way to work around this problem,
as follows:

Use the /MATRIX OUT subcommand in NONPAR CORR (Nonparametric correlation)
procedure to save a matrix of Spearman Rho correlations as the current
data set. The PARTIAL CORR procedure can read this matrix as the input
data by using the /MATRIX IN subcommand, so that the partial correlations
computed are based on Spearman rhos. The NONPAR CORR and PARTIAL CORR
procedures must be run from a syntax window in order to use the /MATRIX
subcommands. An example follows:

NONPAR CORR salbeg time edlevel age
/MISSING = LISTWISE
/MATRIX OUT(*).
RECODE rowtype_ ('RHO'='CORR') .
PARTIAL CORR salbeg time edlevel BY age
/MISSING = LISTWISE
/MATRIX IN(*).
The attached screenshot is from IBM SPSS Statistics 25 Command Syntax
Reference
<http://spssx-discussion.1045642.n5.nabble.com/file/t341500/reference.png> 



--
Sent from: http://spssx-discussion.1045642.n5.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



===================== 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: Kendall's partial tau and BCa confidence interval

Kirill Orlov
In reply to this post by Sergej Kornev
https://stats.stackexchange.com/a/41580/3277


04.09.2018 13:54, Sergej Kornev пишет:
>From IBM Support: https://www-01.ibm.com/support/docview.wss?uid=swg21474822 


Although the PARTIAL CORR procedure in SPSS does not have a way of
specifying rank correlations, there is a way to work around this problem,
as follows:

Use the /MATRIX OUT subcommand in NONPAR CORR (Nonparametric correlation)
procedure to save a matrix of Spearman Rho correlations as the current
data set. The PARTIAL CORR procedure can read this matrix as the input
data by using the /MATRIX IN subcommand, so that the partial correlations
computed are based on Spearman rhos. The NONPAR CORR and PARTIAL CORR
procedures must be run from a syntax window in order to use the /MATRIX
subcommands. An example follows:

NONPAR CORR salbeg time edlevel age
/MISSING = LISTWISE
/MATRIX OUT(*).
RECODE rowtype_ ('RHO'='CORR') .
PARTIAL CORR salbeg time edlevel BY age
/MISSING = LISTWISE
/MATRIX IN(*).
The attached screenshot is from IBM SPSS Statistics 25 Command Syntax
Reference
<http://spssx-discussion.1045642.n5.nabble.com/file/t341500/reference.png> 



--
Sent from: http://spssx-discussion.1045642.n5.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



===================== 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: Kendall's partial tau and BCa confidence interval

Kirill Orlov
In reply to this post by Sergej Kornev
https://www.omicsonline.org/a-nonparametric-method-for-estimating-partial-correlation-coefficient-2155-6180.1000156.pdf
A Nonparametric Method for Estimating Partial Correlation Coefficient
Ebuh GU* and Oyeka ICA


===================== 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: Kendall's partial tau and BCa confidence interval

Sergej Kornev
Now I see.
Thank you a lot for the explanations and help!



--
Sent from: http://spssx-discussion.1045642.n5.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
Reply | Threaded
Open this post in threaded view
|

Re: Kendall's partial tau and BCa confidence interval

Jon Peck
In reply to this post by Sergej Kornev
The original request, if I have this right was for nonparametric (Kendall) partial corr with a bca bootstrap confidence interval.  That's a lot!  NONPAR CORR doesn't do partial, and PARTIAL CORR doesn't do nonparametric.

Now you can easily compute the nonparametric partial corr from the nonparametric corr statistics.  For corr(x,y|z), the formula is
tau(x,y|z) = (tau(x,y) - tau(x,z) * tau(y,z)) / sqrt((1-tau(1,3)**2 * (1 - tau(2,3) **2))

but that can't be bootstrapped.

Here is an R program to run in Statistics to get the bootstrapped results and the bca ci.  This was not easy to work out as the R boot package is very unfriendly and reluctant to explain the many error messages you might get (like a lot of R).  The bca ci might fail numerically depending on your data.

First you need to install an R module like this.
begin program r.
install.packages("ppcor")
end program.

This will ask you to pick a site from a popup list, so just pick one near you.

Then, here is a program to do the computations (plain text output).  Substitute your variable names in the GetDataFromSPSS call, where the third variable is for the partialing.  You can change the number of bootstrap replications by setting a different value of R below.

begin program r.
library(boot)
library(ppcor)
dta = spssdata.GetDataFromSPSS(c("salary", "salbegin", "educ"), missingValueToNA=TRUE)

pcorstat <- function(data, indices) {
  d <- data[indices,]
  result <- pcor.test(d[1], d[2], d[3], method="kendall")[[1]]
  return(result)
}  

b <- boot(data=dta, statistic=pcorstat,R=999, stype="i", simple=TRUE)
print(b)
plot(b)
bca <- boot.ci(b, type="bca", index=1)
print(bca)
end program.

Here is the output for this example minus the plot.
ORDINARY NONPARAMETRIC BOOTSTRAP 
 
 
Call: 
boot(data = dta, statistic = pcorstat, R = 999, stype = "i", 
    simple = TRUE) 
 
 
Bootstrap Statistics : 
     original       bias    std. error 
t1* 0.4984127 0.0007568195  0.02561298 
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS 
Based on 999 bootstrap replicates 
 
CALL : 
boot.ci(boot.out = b, type = "bca", index = 1) 
 
Intervals : 
Level       BCa 
95%   ( 0.4402,  0.5421 ) 
Calculations and Intervals on Original Scale


On Mon, Sep 3, 2018 at 3:52 PM Sergej Kornev <[hidden email]> wrote:
<http://spssx-discussion.1045642.n5.nabble.com/file/t341500/partial_correlation.jpg>
Unfortunately, I can't see no label for Kendall when entering:

PARTIAL CORR
  /VARIABLES=x y BY z 
 /SIGNIFICANCE=TWOTAIL
 /MISSING=LISTWISE.



--
Sent from: http://spssx-discussion.1045642.n5.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


--
Jon K Peck
[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