Calculate mode

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

Calculate mode

Gustavo García
Hi,

I need some help.
My set has more than 100 job categories (jobcat) with a frequency of income (freq) in range 1-8.
Some cases has missing in frec.
I want to assign to the frec mode of each jobcat to the missing data.
How i can calculate all frec mode for each jobcat?.

Thanks.
--
Gustavo Garcia

===================== 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: Calculate mode

David Marso
Administrator
I have absolutely no idea what the following means.
"I want to assign to the frec mode of each jobcat to the missing data.
How i can calculate all frec mode for each jobcat?."

Maybe post an example of what you actually want with some simple data mockup?

Gustavo García wrote
Hi,

I need some help.
My set has more than 100 job categories (*jobcat*) with a frequency of
income (*freq*) in range 1-8.
Some cases has missing in *frec*.
I want to assign to the *frec* mode of each *jobcat *to the missing data.
How i can calculate all *frec *mode for each *jobcat*?.

Thanks.
--
Gustavo Garcia

=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"
Reply | Threaded
Open this post in threaded view
|

Re: Calculate mode

Bruce Weaver
Administrator
In reply to this post by Gustavo García
Disclaimer:  This is untested.  And I assume your income variable is called income, not freq or frec.  ;-)

SORT CASES by jobcat.
SPLIT FILE BY jobcat.
FREQUENCIES VARIABLES = income /STATS=MODE /FORMAT=NOTABLE.
SPLIT FILE OFF.

As the FM says, "If there is more than one mode, only the first mode is displayed."

HTH.

Gustavo García wrote
Hi,

I need some help.
My set has more than 100 job categories (*jobcat*) with a frequency of
income (*freq*) in range 1-8.
Some cases has missing in *frec*.
I want to assign to the *frec* mode of each *jobcat *to the missing data.
How i can calculate all *frec *mode for each *jobcat*?.

Thanks.
--
Gustavo Garcia

=====================
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
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: Calculate mode

Rich Ulrich
In reply to this post by David Marso
David -
He wants to impute a value when "frec" is missing (good values: 1-8).
He wants to use the mode of "frec" for the other cases where "jobcat"
is the same (categorical with 100+ values).

Ex.  ID 4 has jobcat=52 ; mode of frec is 5 for other cases with jobcat=52;
replace Missing with 5 for this case.   Does imputation allow modes?

You can calculate the mode by sorting on jobcat, frec  and counting with
AGGREGATE  to get N; sort (descending) jobcat, frec, N;  use

Match files = */by jobcat frec/ first= maxN .
select if    maxN.

to pick up the first of each set, which is the max.
The file then has all the replacement values.

Putting them in?  The easiest way might be to put the possible replacement
value into every record with the same Jobcat  and then do a test
IF miss(frec)  frec= maxN.

Is there a better way?

--
Rich Ulrich

> Date: Thu, 8 Sep 2016 15:36:30 -0700

> From: [hidden email]
> Subject: Re: Calculate mode
> To: [hidden email]
>
> I have absolutely no idea what the following means.
> "I want to assign to the frec mode of each jobcat to the missing data.
> How i can calculate all frec mode for each jobcat?."
>
> Maybe post an example of what you actually want with some simple data
> mockup?
>
>
> Gustavo García wrote
> > Hi,
> >
> > I need some help.
> > My set has more than 100 job categories (*jobcat*) with a frequency of
> > income (*freq*) in range 1-8.
> > Some cases has missing in *frec*.
> > I want to assign to the *frec* mode of each *jobcat *to the missing data.
> > How i can calculate all *frec *mode for each *jobcat*?.
> >
> > Thanks.
> > --
> > Gustavo Garcia
> >
===================== 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: Calculate mode

Bruce Weaver
Administrator
If that's what he wants to do, I completely misunderstood, and my earlier post should be ignored!  ;-)


Rich Ulrich wrote
David -
He wants to impute a value when "frec" is missing (good values: 1-8).
He wants to use the mode of "frec" for the other cases where "jobcat"
is the same (categorical with 100+ values).

Ex.  ID 4 has jobcat=52 ; mode of frec is 5 for other cases with jobcat=52;
replace Missing with 5 for this case.   Does imputation allow modes?

You can calculate the mode by sorting on jobcat, frec  and counting with
AGGREGATE  to get N; sort (descending) jobcat, frec, N;  use

Match files = */by jobcat frec/ first= maxN .
select if    maxN.

to pick up the first of each set, which is the max.
The file then has all the replacement values.

Putting them in?  The easiest way might be to put the possible replacement
value into every record with the same Jobcat  and then do a test
IF miss(frec)  frec= maxN.

Is there a better way?

--
Rich Ulrich

> Date: Thu, 8 Sep 2016 15:36:30 -0700
> From: [hidden email]
> Subject: Re: Calculate mode
> To: [hidden email]
>
> I have absolutely no idea what the following means.
> "I want to assign to the frec mode of each jobcat to the missing data.
> How i can calculate all frec mode for each jobcat?."
>
> Maybe post an example of what you actually want with some simple data
> mockup?
>
>
> Gustavo García wrote
> > Hi,
> >
> > I need some help.
> > My set has more than 100 job categories (*jobcat*) with a frequency of
> > income (*freq*) in range 1-8.
> > Some cases has missing in *frec*.
> > I want to assign to the *frec* mode of each *jobcat *to the missing data.
> > How i can calculate all *frec *mode for each *jobcat*?.
> >
> > Thanks.
> > --
> > Gustavo Garcia
> >
     
=====================
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
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: Calculate mode

David Marso
Administrator
This post was updated on .
Rich's eSPSS is running on steroids.
Could use Bruce's SPLIT/FREQ with OMS then MATCH and grab.
OP:  Next time proofread your post and see what happens when you google translate your mangled English back to Espanol.
--
Bruce Weaver wrote
If that's what he wants to do, I completely misunderstood, and my earlier post should be ignored!  ;-)


Rich Ulrich wrote
David -
He wants to impute a value when "frec" is missing (good values: 1-8).
He wants to use the mode of "frec" for the other cases where "jobcat"
is the same (categorical with 100+ values).

Ex.  ID 4 has jobcat=52 ; mode of frec is 5 for other cases with jobcat=52;
replace Missing with 5 for this case.   Does imputation allow modes?

You can calculate the mode by sorting on jobcat, frec  and counting with
AGGREGATE  to get N; sort (descending) jobcat, frec, N;  use

Match files = */by jobcat frec/ first= maxN .
select if    maxN.

to pick up the first of each set, which is the max.
The file then has all the replacement values.

Putting them in?  The easiest way might be to put the possible replacement
value into every record with the same Jobcat  and then do a test
IF miss(frec)  frec= maxN.

Is there a better way?

--
Rich Ulrich

> Date: Thu, 8 Sep 2016 15:36:30 -0700
> From: [hidden email]
> Subject: Re: Calculate mode
> To: [hidden email]
>
> I have absolutely no idea what the following means.
> "I want to assign to the frec mode of each jobcat to the missing data.
> How i can calculate all frec mode for each jobcat?."
>
> Maybe post an example of what you actually want with some simple data
> mockup?
>
>
> Gustavo García wrote
> > Hi,
> >
> > I need some help.
> > My set has more than 100 job categories (*jobcat*) with a frequency of
> > income (*freq*) in range 1-8.
> > Some cases has missing in *frec*.
> > I want to assign to the *frec* mode of each *jobcat *to the missing data.
> > How i can calculate all *frec *mode for each *jobcat*?.
> >
> > Thanks.
> > --
> > Gustavo Garcia
> >
     
=====================
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
Please reply to the list and not to my personal email.
Those desiring my consulting or training services please feel free to email me.
---
"Nolite dare sanctum canibus neque mittatis margaritas vestras ante porcos ne forte conculcent eas pedibus suis."
Cum es damnatorum possederunt porcos iens ut salire off sanguinum cliff in abyssum?"