What can I do if i need to carry out partial correlation between one continuous variable (Intelligence) and one dichotomous variable (gender- m/f) while controlling for a third continuous variable (age)? Partial correlation does not allow me to do it with gender, as it is not a continuous variable.
I will be grateful for any guidance on this issue. My sample size is 405. I have SPSS ver 14. Raj.
|
Administrator
|
The following worked for me using v19:
GET FILE='C:\SPSSdata\1991 U.S. General Social Survey.sav'. PARTIAL CORR /VARIABLES=prestg80 sex BY age /SIGNIFICANCE=TWOTAIL /MISSING=LISTWISE. This suggests to me that "gender" variable is a string variable with values 'm' and 'f'. Recode it to a numeric variable and try again. Options for recoding include AUTORECODE, RECODE, or a simple COMPUTE, like this: COMPUTE male = UPCASE(gender) EQ "M". But if it is possible to have missing values (and lower and uppercase letters), RECODE might be safer. RECODE gender ('m' 'M' = 1) ('f' 'F' = 0) into Male. FORMATS Male (f1). 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/). |
Don't forget the easier AUTORECODE command.
It was born for situations just like this.
Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: Bruce Weaver <[hidden email]> To: [hidden email] Date: 07/24/2012 01:52 PM Subject: Re: [SPSSX-L] My query Sent by: "SPSSX(r) Discussion" <[hidden email]> The following worked for me using v19: GET FILE='C:\SPSSdata\1991 U.S. General Social Survey.sav'. PARTIAL CORR /VARIABLES=prestg80 sex BY age /SIGNIFICANCE=TWOTAIL /MISSING=LISTWISE. This suggests to me that "gender" variable is a string variable with values 'm' and 'f'. Recode it to a numeric variable and try again. Options for recoding include AUTORECODE, RECODE, or a simple COMPUTE, like this: COMPUTE male = UPCASE(gender) EQ "M". But if it is possible to have missing values (and lower and uppercase letters), RECODE might be safer. RECODE gender ('m' 'M' = 1) ('f' 'F' = 0) into Male. FORMATS Male (f1). HTH. rajeshratnakar wrote > > What can I do if i need to carry out partial correlation between > one continuous variable (Intelligence) and one dichotomous variable > (gender- m/f) while controlling for a third continuous variable > (age)? > > Partial correlation does not allow me to do it with gender, as it is > not a continuous variable. > > I will be grateful for any guidance on this issue. My sample size is > 405. I have SPSS ver 14. Raj. > ----- -- 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://spssx-discussion.1045642.n5.nabble.com/My-query-tp5714424p5714425.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 |
Administrator
|
Hi Jon. I did *mention* AUTORECODE as an option, but chose RECODE because I wanted to ensure that the new variable had only two values. If the string variable GENDER has both lower and uppercase values, AUTORECODE will give more than 2 values, *I think*--or have I missed an option? E.g.,
DATA LIST free / gender(a1). BEGIN DATA f F m M END DATA. AUTORECODE VARIABLES=gender / INTO gender_A . RECODE gender ('f' 'F' = 1) ('m' 'M' = 2) into gender_R. FORMATS gender_A gender_R (f1). LIST. OUTPUT: gender gender_A gender_R f 1 1 F 2 1 m 3 2 M 4 2 Number of cases read: 4 Number of cases listed: 4 One could recode the variable with 4 values, but it seemed easier to just use RECODE in the first place.
--
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/). |
OTOH, the RECODE specification will map
any other values into SYSMIS while AUTORECODE will preserve them, which
might make any problems more obvious. Also, AUTORECODE automatically
generates appropriate value labels and displays a table of the mapping
it generated.
Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: Bruce Weaver <[hidden email]> To: [hidden email] Date: 07/24/2012 02:59 PM Subject: Re: [SPSSX-L] My query Sent by: "SPSSX(r) Discussion" <[hidden email]> Hi Jon. I did *mention* AUTORECODE as an option, but chose RECODE because I wanted to ensure that the new variable had only two values. If the string variable GENDER has both lower and uppercase values, AUTORECODE will give more than 2 values, *I think*--or have I missed an option? E.g., DATA LIST free / gender(a1). BEGIN DATA f F m M END DATA. AUTORECODE VARIABLES=gender / INTO gender_A . RECODE gender ('f' 'F' = 1) ('m' 'M' = 2) into gender_R. FORMATS gender_A gender_R (f1). LIST. OUTPUT: gender gender_A gender_R f 1 1 F 2 1 m 3 2 M 4 2 Number of cases read: 4 Number of cases listed: 4 One could recode the variable with 4 values, but it seemed easier to just use RECODE in the first place. Jon K Peck wrote > > Don't forget the easier AUTORECODE command. It was born for situations > just like this. > > Jon Peck (no "h") aka Kim > Senior Software Engineer, IBM > peck@.ibm > new phone: 720-342-5621 > > > > > From: Bruce Weaver <bruce.weaver@> > To: SPSSX-L@.uga > Date: 07/24/2012 01:52 PM > Subject: Re: [SPSSX-L] My query > Sent by: "SPSSX(r) Discussion" <SPSSX-L@.uga> > > > > The following worked for me using v19: > > GET FILE='C:\SPSSdata\1991 U.S. General Social Survey.sav'. > > PARTIAL CORR > /VARIABLES=prestg80 sex BY age > /SIGNIFICANCE=TWOTAIL > /MISSING=LISTWISE. > > This suggests to me that "gender" variable is a string variable with > values > 'm' and 'f'. Recode it to a numeric variable and try again. Options for > recoding include AUTORECODE, RECODE, or a simple COMPUTE, like this: > > COMPUTE male = UPCASE(gender) EQ "M". > > But if it is possible to have missing values (and lower and uppercase > letters), RECODE might be safer. > > RECODE gender > ('m' 'M' = 1) > ('f' 'F' = 0) into Male. > FORMATS Male (f1). > > HTH. > > > > rajeshratnakar wrote >> >> What can I do if i need to carry out partial correlation between >> one continuous variable (Intelligence) and one dichotomous variable >> (gender- m/f) while controlling for a third continuous variable >> (age)? >> >> Partial correlation does not allow me to do it with gender, as it is >> not a continuous variable. >> >> I will be grateful for any guidance on this issue. My sample size > is >> 405. I have SPSS ver 14. Raj. >> > > > > > ----- > -- > Bruce Weaver > bweaver@ > 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://spssx-discussion.1045642.n5.nabble.com/My-query-tp5714424p5714425.html > > Sent from the SPSSX Discussion mailing list archive at Nabble.com. > > ===================== > To manage your subscription to SPSSX-L, send a message to > LISTSERV@.UGA (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://spssx-discussion.1045642.n5.nabble.com/My-query-tp5714424p5714429.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 |
In reply to this post by rajeshratnakar
What do you mean you
"cannot"? The syntax below seems to work.
However, iq _roughly_ means (mental_age/age) standardized to 100,15. In other words it relates #correct answers for an individual to the number of correct answers for than a typical person that age. new file. set seed = 20120724. input program. loop id = 1 to 405. compute IQ = rv.normal(100,15). compute age = rv.normal (50,20). compute gender = rv.bernoulli(.5). end case. end loop. end file. end input program. CORRELATIONS /VARIABLES=IQ age gender /PRINT=TWOTAIL NOSIG /MISSING=PAIRWISE. PARTIAL CORR /VARIABLES=IQ gender BY age /SIGNIFICANCE=TWOTAIL /MISSING=LISTWISE. Art Kendall Social Research ConsultantsOn 7/24/2012 3:32 PM, rajeshratnakar wrote:
===================== 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
Art Kendall
Social Research Consultants |
In reply to this post by Jon K Peck
At 05:18 PM 7/24/2012, Jon K Peck wrote:
>OTOH, the RECODE specification will map any other values into SYSMIS >while AUTORECODE will preserve them, which might make any problems >more obvious. My own taste is RECODE because I can tell from the code all possible values it can generate. But I always use an ELSE= clause, more or less like this: RECODE gender ('m' 'M' = 1) ('f' 'F' = 0) (' ' = 8) (ELSE = 9) into Male. FORMATS Male (f2). MISSING VALUES Male (8,9). VALUE LABELS Male 0 'Female' 1 'Male' 8 'Missing' 9 'Miscode'. That's considerably more code, and I can see why one might prefer AUTORECODE. I like the RECODE logic because it makes explicit what codes are expected, makes clear how they're all handled, and clearly flags exceptions. ===================== 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 |
No doubt, both commands are useful. In
this situation I prefer autorecode for three reasons
- it's simpler to write - less code is required, since it generates the value labels automatically (and guaranteed to be correct) - many is the time I have read code and thought I knew what it was doing only to be proved wrong by the output. With autorecode, you get a clear report on what the code actually did. Autorecode also has a nice template feature, although that isn't relevant in this case. Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] new phone: 720-342-5621 From: Richard Ristow <[hidden email]> To: [hidden email] Date: 07/24/2012 08:47 PM Subject: Re: [SPSSX-L] My query Sent by: "SPSSX(r) Discussion" <[hidden email]> At 05:18 PM 7/24/2012, Jon K Peck wrote: >OTOH, the RECODE specification will map any other values into SYSMIS >while AUTORECODE will preserve them, which might make any problems >more obvious. My own taste is RECODE because I can tell from the code all possible values it can generate. But I always use an ELSE= clause, more or less like this: RECODE gender ('m' 'M' = 1) ('f' 'F' = 0) (' ' = 8) (ELSE = 9) into Male. FORMATS Male (f2). MISSING VALUES Male (8,9). VALUE LABELS Male 0 'Female' 1 'Male' 8 'Missing' 9 'Miscode'. That's considerably more code, and I can see why one might prefer AUTORECODE. I like the RECODE logic because it makes explicit what codes are expected, makes clear how they're all handled, and clearly flags exceptions. ===================== 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 |
Free forum by Nabble | Edit this page |