Transforming variable

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

Transforming variable

Johnny Amora
Hi all,
 
The syntax below invokes spss to transform ENGLISH into "percentile rank based on normal curve".  This syntax is not good if I have many variables to transform because I need to compute first the sample mean and standard deviation for each variable before I could run the compute command.  Can we modify the syntax such that it automatically tranforms the variable and does not need manual insertion of mean and standard deviation?
 
COMPUTE English_prNorm = (CDFNORM((ENGLISH-39.80)/8.135))*100.
EXECUTE .
 
Thank you.
Johnny


      Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com.
http://mail.promotions.yahoo.com/newdomains/ph/

====================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: Transforming variable

Marta Garcia-Granero
Johnny Amora wrote:
> The syntax below invokes spss to transform ENGLISH into "percentile rank based on normal curve".  This syntax is not good if I have many variables to transform because I need to compute first the sample mean and standard deviation for each variable before I could run the compute command.  Can we modify the syntax such that it automatically tranforms the variable and does not need manual insertion of mean and standard deviation?
>
> COMPUTE English_prNorm = (CDFNORM((ENGLISH-39.80)/8.135))*100.
> EXECUTE .
You can use aggregate to get the mean and SD for each variable you want
to transform:

COMPUTE K=1.
AGGREGATE
  /OUTFILE=*
  MODE=ADDVARIABLES
  /BREAK=K
  /Mean = MEAN(ENGLISH)
  /SD= SD(ENGLISH).
COMPUTE English_prNorm = (CDFNORM((ENGLISH-Mean)/SD))*100.
EXE.
DELETE VARIABLES Mean SD K.

If you need to use it for several variables, the code can be easily
transformed in a list processing macro. Ask for help (to the whole list,
not privately, please)  if you want to do it and don't know how.

HTH,
Marta Garcia-Granero

--
For miscellaneous statistical stuff, visit:
http://gjyp.nl/marta/

=====================
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: Transforming variable

Marta Garcia-Granero
Hi

I finally turned the code into a macro (sometimes the need to write code
is too compelling and I just have to do it). It's a nice little macro,
very useful. I think some researchers at my University will find it useful.

DEFINE PERCNORM(list=!CMDEND).
COMPUTE K=1.
!DO !i !IN (!list).
AGGREGATE
  /OUTFILE=*
  MODE=ADDVARIABLES
  /BREAK=K
  /Mean = MEAN(!i)
  /SD= SD(!i).
!LET !newvar=!CONCAT(!i,'_prNorm').
COMPUTE !newvar = (CDFNORM((!i-Mean)/SD))*100.
EXE.
DELETE VARIABLES Mean SD.
!DOEND.
DELETE VARIABLES K.
!ENDDEFINE.

* MACRO call: assuming the variables to be transformed are ENGLISH
FRENCH GERMAN *.
PERCNORM list=ENGLISH FRENCH GERMAN.

> Johnny Amora wrote:
>> The syntax below invokes spss to transform ENGLISH into "percentile
>> rank based on normal curve".  This syntax is not good if I have many
>> variables to transform because I need to compute first the sample
>> mean and standard deviation for each variable before I could run the
>> compute command.  Can we modify the syntax such that it automatically
>> tranforms the variable and does not need manual insertion of mean and
>> standard deviation?
>>
>> COMPUTE English_prNorm = (CDFNORM((ENGLISH-39.80)/8.135))*100.
>> EXECUTE .
> You can use aggregate to get the mean and SD for each variable you
> want to transform:
>
> COMPUTE K=1.
> AGGREGATE
>  /OUTFILE=*
>  MODE=ADDVARIABLES
>  /BREAK=K
>  /Mean = MEAN(ENGLISH)
>  /SD= SD(ENGLISH).
> COMPUTE English_prNorm = (CDFNORM((ENGLISH-Mean)/SD))*100.
> EXE.
> DELETE VARIABLES Mean SD K.
>
> If you need to use it for several variables, the code can be easily
> transformed in a list processing macro. Ask for help (to the whole
> list, not privately, please)  if you want to do it and don't know how.
>
> HTH,
> Marta Garcia-Granero
>


--
For miscellaneous statistical stuff, visit:
http://gjyp.nl/marta/

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

Rotation

Hortensia Carrillo
In a factor Analisys if you change the rotation: equamax, varimax... does it changes all the other parts of the analisys? I mean all the other matrix: variance, correlations... that you have made previously? Or are they independent of the rotation mode?

> Date: Wed, 22 Oct 2008 10:26:40 +0200> From: [hidden email]> Subject: Re: Transforming variable> To: [hidden email]> > Hi> > I finally turned the code into a macro (sometimes the need to write code> is too compelling and I just have to do it). It's a nice little macro,> very useful. I think some researchers at my University will find it useful.> > DEFINE PERCNORM(list=!CMDEND).> COMPUTE K=1.> !DO !i !IN (!list).> AGGREGATE> /OUTFILE=*> MODE=ADDVARIABLES> /BREAK=K> /Mean = MEAN(!i)> /SD= SD(!i).> !LET !newvar=!CONCAT(!i,'_prNorm').> COMPUTE !newvar = (CDFNORM((!i-Mean)/SD))*100.> EXE.> DELETE VARIABLES Mean SD.> !DOEND.> DELETE VARIABLES K.> !ENDDEFINE.> > * MACRO call: assuming the variables to be transformed are ENGLISH> FRENCH GERMAN *.> PERCNORM list=ENGLISH FRENCH GERMAN.> > > Johnny Amora wrote:> >> The syntax below invokes spss to transform ENGLISH into "percentile> >> rank based on normal curve". This syntax is not good if I have many> >> variables to transform because I need to compute first the sample> >> mean and standard deviation for each variable before I could run the> >> compute command. Can we modify the syntax such that it automatically> >> tranforms the variable and does not need manual insertion of mean and> >> standard deviation?> >>> >> COMPUTE English_prNorm = (CDFNORM((ENGLISH-39.80)/8.135))*100.> >> EXECUTE .> > You can use aggregate to get the mean and SD for each variable you> > want to transform:> >> > COMPUTE K=1.> > AGGREGATE> > /OUTFILE=*> > MODE=ADDVARIABLES> > /BREAK=K> > /Mean = MEAN(ENGLISH)> > /SD= SD(ENGLISH).> > COMPUTE English_prNorm = (CDFNORM((ENGLISH-Mean)/SD))*100.> > EXE.> > DELETE VARIABLES Mean SD K.> >> > If you need to use it for several variables, the code can be easily> > transformed in a list processing macro. Ask for help (to the whole> > list, not privately, please) if you want to do it and don't know how.> >> > HTH,> > Marta Garcia-Granero> >> > > --> For miscellaneous statistical stuff, visit:> http://gjyp.nl/marta/> > =====================> 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
_________________________________________________________________
Connect to the next generation of MSN Messenger 
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
====================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: Transforming variable

Art Kendall
In reply to this post by Johnny Amora
try something like this untested syntax.

rank variables= English math spelling science /print=no
 /normal into English_prNorm math_prNorm spelling_prNorm science_prNorm.

Art Kendall
Social Research Consultants


Johnny Amora wrote:

> Hi all,
>
> The syntax below invokes spss to transform ENGLISH into "percentile rank based on normal curve".  This syntax is not good if I have many variables to transform because I need to compute first the sample mean and standard deviation for each variable before I could run the compute command.  Can we modify the syntax such that it automatically tranforms the variable and does not need manual insertion of mean and standard deviation?
>
> COMPUTE English_prNorm = (CDFNORM((ENGLISH-39.80)/8.135))*100.
> EXECUTE .
>
> Thank you.
> Johnny
>
>
>       Get your preferred Email name!
> Now you can @ymail.com and @rocketmail.com.
> http://mail.promotions.yahoo.com/newdomains/ph/
>
> ===================
> 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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: Rotation

Swank, Paul R
In reply to this post by Hortensia Carrillo
Depends on the rotation method and what you mean by all other parts of the analysis. Obviously, an orthogonal rotation has no correlation among the factors so it doesn't matter which one, the correlations will still be zero. However, the factor variances can differ. If you have an oblique rotation, then different methods can lead to different estimates of the variances and correlations among factors.

Paul R. Swank, Ph.D
Professor and Director of Research
Children's Learning Institute
University of Texas Health Science Center
Houston, TX 77038


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Hortensia Carrillo
Sent: Wednesday, October 22, 2008 5:33 AM
To: [hidden email]
Subject: Rotation

In a factor Analisys if you change the rotation: equamax, varimax... does it changes all the other parts of the analisys? I mean all the other matrix: variance, correlations... that you have made previously? Or are they independent of the rotation mode?

> Date: Wed, 22 Oct 2008 10:26:40 +0200> From: [hidden email]> Subject: Re: Transforming variable> To: [hidden email]> > Hi> > I finally turned the code into a macro (sometimes the need to write code> is too compelling and I just have to do it). It's a nice little macro,> very useful. I think some researchers at my University will find it useful.> > DEFINE PERCNORM(list=!CMDEND).> COMPUTE K=1.> !DO !i !IN (!list).> AGGREGATE> /OUTFILE=*> MODE=ADDVARIABLES> /BREAK=K> /Mean = MEAN(!i)> /SD= SD(!i).> !LET !newvar=!CONCAT(!i,'_prNorm').> COMPUTE !newvar = (CDFNORM((!i-Mean)/SD))*100.> EXE.> DELETE VARIABLES Mean SD.> !DOEND.> DELETE VARIABLES K.> !ENDDEFINE.> > * MACRO call: assuming the variables to be transformed are ENGLISH> FRENCH GERMAN *.> PERCNORM list=ENGLISH FRENCH GERMAN.> > > Johnny Amora wrote:> >> The syntax below invokes spss to transform ENGLISH into "percentile> >> rank based on normal curve". This syntax is not good if I have many> >> variabl!
 es to transform because I need to compute first the sample> >> mean and standard deviation for each variable before I could run the> >> compute command. Can we modify the syntax such that it automatically> >> tranforms the variable and does not need manual insertion of mean and> >> standard deviation?> >>> >> COMPUTE English_prNorm = (CDFNORM((ENGLISH-39.80)/8.135))*100.> >> EXECUTE .> > You can use aggregate to get the mean and SD for each variable you> > want to transform:> >> > COMPUTE K=1.> > AGGREGATE> > /OUTFILE=*> > MODE=ADDVARIABLES> > /BREAK=K> > /Mean = MEAN(ENGLISH)> > /SD= SD(ENGLISH).> > COMPUTE English_prNorm = (CDFNORM((ENGLISH-Mean)/SD))*100.> > EXE.> > DELETE VARIABLES Mean SD K.> >> > If you need to use it for several variables, the code can be easily> > transformed in a list processing macro. Ask for help (to the whole> > list, not privately, please) if you want to do it and don't know how.> >> > HTH,> > Marta Garcia-Granero> >> > > --> For miscellaneous !
 statistical stuff, visit:> http://gjyp.nl/marta/> > ==================
===> 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
_________________________________________________________________
Connect to the next generation of MSN Messenger
http://imagine-msn.com/messenger/launch80/default.aspx?locale=en-us&source=wlmailtagline
=======
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
|

comparing a sample with a total population by a number of categories

bgreen
>Hello,

I was hoping for some advice on how I might compare a sample with a
total population by a number of categories. The sample consists of
all persons who went before a special court over a 20 yearperiod.
There were three court outcomes, I'll call them A, B and C. Persons
could be charged with one of 10 types of offences.

I want to (1)  determine whether the offending of groups A, B and
C  were similar to persons who did not go to the special court
(e.g  are there any category of offences that is over-represented in
special court hearings).  I had considered performing 10 chi-square
but wondered if there was a more efficient or better way of doing
this and (2)  to adjust offending numbers for overall population
change (to determine if increases in the number of people going to
the special court is proportional to overall population increases in
the general community, of persons who have not committed offences).

Any assistance is much appreciated,

regards

Bob

=====================
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: comparing a sample with a total population by a number of categories

Maguin, Eugene
Bob,

I'm not sure that you actually have a 'population'. Seems to me that it
would be easier to think of the non-special court people as a sample. Since
each person can be charged with only one type of offense, I think that
either a chi-square or a logistic regression would work. If you want to
compare the A, B, and C groups to the general court group, I think a
logistic regression will give you more flexibility because you can build in
the specific contrasts, e.g., A vs general, B vs general, C vs general.

With respect to 2), I'm not sure you need to adjust for population. It seems
to me that if the percentage of persons assigned to special court relative
to the current population number remains the same over time, you then have
evidence that special court is keeping up.

Gene Maguin


>>I was hoping for some advice on how I might compare a sample with a total
population by a number of categories. The sample consists of all persons who
went before a special court over a 20 year period. There were three court
outcomes, I'll call them A, B and C. Persons could be charged with one of 10
types of offences.

>>I want to (1) determine whether the offending of groups A, B and C were
similar to persons who did not go to the special court (e.g  are there any
category of offences that is over-represented in special court hearings). I
had considered performing 10 chi-square but wondered if there was a more
efficient or better way of doing this and (2) to adjust offending numbers
for overall population change (to determine if increases in the number of
people going to the special court is proportional to overall population
increases in the general community, of persons who have not committed
offences).

=====================
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: comparing a sample with a total population by a number of categories

bgreen
>Gene,

Thanks for your reply. You are right that both groups with offences
are samples from the total population. Why I had considered
individual chi-square analyses might be necessary is that in both
instances a person could have committed offences from more than one category.

Regarding point 2, we had been considering whether offending was
really increasing, or was this just a function of overall population growth.


regards

Bob



 >Bob,

 >I'm not sure that you actually have a 'population'. Seems to me that it
 >would be easier to think of the non-special court people as a sample. Since
 >each person can be charged with only one type of offense, I think that
 >either a chi-square or a logistic regression would work. If you want to
 >compare the A, B, and C groups to the general court group, I think a
 >logistic regression will give you more flexibility because you can build in
 >the specific contrasts, e.g., A vs general, B vs general, C vs general.

 >With respect to 2), I'm not sure you need to adjust for population. It seems
 >to me that if the percentage of persons assigned to special court relative
 >to the current population number remains the same over time, you then have
 >evidence that special court is keeping up.

 >Gene Maguin


 >>I was hoping for some advice on how I might compare a sample with a total
 >>population by a number of categories. The sample consists of all persons who
 >>went before a special court over a 20 year period. There were three court
 >>outcomes, I'll call them A, B and C. Persons could be charged with one of 10
 >>types of offences.

 >>I want to (1) determine whether the offending of groups A, B and C were
 >>Gene,

similar to persons who did not go to the special court (e.g  are there any
 >>category of offences that is over-represented in special court hearings). I
 >>had considered performing 10 chi-square but wondered if there was a more
 >>efficient or better way of doing this and (2) to adjust offending numbers
 >>for overall population change (to determine if increases in the number of
 >>people going to the special court is proportional to overall population
 >>increases in the general community, of persons who have not committed
 >>offences).

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