polychoric correlation R program

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

polychoric correlation R program

Kylie
Hi all,

A colleague has been using the polychor R program for SPSS below to get
polychoric correlations of ordinal variables. She received the program at a
training course and I am not sure who the original author is. She would like
to get the standard error of the correlation printed out as well. Does
anyone know if this is possible?

They have already tried setting the std.err parameter in the 'hetor' command
to TRUE, but I think the corresponding res$ field may have to be added to
the spsspivottable.Display command? I have only basic knowledge of R and
none of the R/SPSS interface, so any suggestions would be appreciated.

BEGIN PROGRAM R.
library(polycor)
casedata <-spssdata.GetDataFromSPSS()
test1 <-as.factor(casedata$test1)
retest1 <-as.factor(casedata$retest1)
res <- hetcor(test1, retest1, ML = FALSE,std.err = FALSE,
bins=2)
spsspivottable.Display(res$correlations,
                            title="Correlation Matrix",
                            rowdim=" ",
                            coldim="col",
                            format=formatSpec.Correlation)
END PROGRAM.

Thanks,
Kylie.

=====================
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: polychoric correlation R program

Michael Pearmain-2
Hi Kylie,

You will need to change you code to std.errors = TRUE,
then print
>> names(res)
In the R manual it looks like you should be returned res$std.errors if std.errors = TRUE

In your output you are only asking for res$correlations, so input res$std.errors, and with any luck this should solve the problem

HtH

Mike

On Wed, Sep 9, 2009 at 8:05 AM, Kylie Lange <[hidden email]> wrote:
Hi all,

A colleague has been using the polychor R program for SPSS below to get
polychoric correlations of ordinal variables. She received the program at a
training course and I am not sure who the original author is. She would like
to get the standard error of the correlation printed out as well. Does
anyone know if this is possible?

They have already tried setting the std.err parameter in the 'hetor' command
to TRUE, but I think the corresponding res$ field may have to be added to
the spsspivottable.Display command? I have only basic knowledge of R and
none of the R/SPSS interface, so any suggestions would be appreciated.

BEGIN PROGRAM R.
library(polycor)
casedata <-spssdata.GetDataFromSPSS()
test1 <-as.factor(casedata$test1)
retest1 <-as.factor(casedata$retest1)
res <- hetcor(test1, retest1, ML = FALSE,std.err = FALSE,
bins=2)
spsspivottable.Display(res$correlations,
                           title="Correlation Matrix",
                           rowdim=" ",
                           coldim="col",
                           format=formatSpec.Correlation)
END PROGRAM.

Thanks,
Kylie.

=====================
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



--
Michael Pearmain
Senior Analytics Research Specialist

"I abhor averages.  I like the individual case.  A man may have six meals one day and none the next, making an average of three meals per day, but that is not a good way to live.  ~Louis D. Brandeis"

Google UK Ltd
Belgrave House
76 Buckingham Palace Road
London SW1W 9TQ
United Kingdom
t +44 (0) 2032191684  
[hidden email]

If you received this communication by mistake, please don't forward it to anyone else (it may contain confidential or privileged information), please erase all copies of it, including all attachments, and please let the sender know it went to the wrong person. Thanks.