FW: need to calculate a single weighted total, off frequencies/counts, repeatedly [Sec: UNCLASSIFIED]

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

FW: need to calculate a single weighted total, off frequencies/counts, repeatedly [Sec: UNCLASSIFIED]

Gosse, Michelle

Greetings all,

 

I have a dataset of iron intakes for children of varying ages.  I have already gone through and computed iron intake categories for each age group, for each sex separately.  There are a total of 14 iron intake categories, which correspond to the descending probability that of iron insufficiency in the diet.

 

There are different numbers of children in each category, and for some children/age combinations there are “missing” categories as no children fell into the relevant iron intake range.

 

What I need to do,

1.       for each age-sex group, and

2.       for each iron intake category within that age-sex group,

is to multiple the frequency/count of children by the probability for that iron intake category, to produce a single figure.  Then I need to sum all those single figures to end up with one (weighted) total.  This can be print to the output window.

 

I don’t need any of the probabilities or frequencies data saved, just that end weighted total for each age-sex combination in the data.

 

I was thinking that I need to use the matrix/end matrix with some type of loop inside.

 

For example, here is the frequency output table for females aged 2-3 years:

                                OBSERVED IRON 2-3 YEARS FEMALE

                                                Frequency                          Percent                                Valid Percent                    Cumulative Percent

Valid                                    3966                                       88.4                                        88.4                                        88.4

                Category 10        2                                              .0                                            .0                                            88.4

                Category 11        30                                           .7                                            .7                                            89.1

                Category 12        92                                           2.1                                          2.1                                          91.2

                Category 13        120                                         2.7                                          2.7                                          93.8

                Category 14        277                                         6.2                                          6.2                                          100.0

                Total                      4487                                       100.0                                     100.0    

 

 

As you can see, there are no females aged 2-3 years who fall into the first 9 iron intake categories.  Basically, how can I calculate those frequency numbers (in the example above, for Categories 10 through 14), which I can then weight each one by its relevant probability, then sum them all to get the weighted total (and print that weighted total to the output window)?

 

Note 1: the “Valid” count relates to other children in the dataset, who are different age/sex combination to that shown above.

Note 2: the string variable “IRON2TO3F” contains the “Category 10”…”Category 14” values used in the frequency table above. In case it helps, the syntax used to create the table was:

FREQUENCIES VARIABLES=IRONGROUP

  /ORDER=ANALYSIS.

 

Each age/sex combination has a different variable storing the frequencies so I could get around DO statements. For example, males aged 2-3 years have their category data stored in the variable “IRON2TO3M”.  And I need to calculate their single weighted total as well, along with another 8 age-sex combinations.

 

Cheers

Michelle

**********************************************************************

This email and any files transmitted with it are confidential and

intended solely for the use of the individual or entity to whom they

are addressed. If you have received this email in error please notify

the system manager.

This footnote also confirms that this email message has been swept by

MIMEsweeper for the presence of computer viruses.

www.clearswift.com

**********************************************************************

Reply | Threaded
Open this post in threaded view
|

Re: need to calculate a single weighted total of frequencies/counts, repeatedly [Sec: UNCLASSIFIED]

Maguin, Eugene
MIchelle,
 
I'm not sure i understand your problem but, to the extent that i do understand it, i think that you might use the Aggregate command. You define your age-sex combinations and iron consumption categories. Then (i assume your file is unweighted)
 
aggregate outfile=*/break=age_sex iron_category/cases=nu.
 
Then divde each count value (cases variable) by 4487, which appears to be your total N. I don't know that this does everything that you want done but i don't understand all the pieces.
 
Gene Maguin
 
 
 
 


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Gosse, Michelle
Sent: Thursday, November 11, 2010 9:37 PM
To: [hidden email]
Subject: FW: need to calculate a single weighted total, off frequencies/counts, repeatedly [Sec: UNCLASSIFIED]

Greetings all,

 

I have a dataset of iron intakes for children of varying ages.  I have already gone through and computed iron intake categories for each age group, for each sex separately.  There are a total of 14 iron intake categories, which correspond to the descending probability that of iron insufficiency in the diet.

 

There are different numbers of children in each category, and for some children/age combinations there are “missing” categories as no children fell into the relevant iron intake range.

 

What I need to do,

1.       for each age-sex group, and

2.       for each iron intake category within that age-sex group,

is to multiple the frequency/count of children by the probability for that iron intake category, to produce a single figure.  Then I need to sum all those single figures to end up with one (weighted) total.  This can be print to the output window.

 

I don’t need any of the probabilities or frequencies data saved, just that end weighted total for each age-sex combination in the data.

 

I was thinking that I need to use the matrix/end matrix with some type of loop inside.

 

For example, here is the frequency output table for females aged 2-3 years:

                                OBSERVED IRON 2-3 YEARS FEMALE

                                                Frequency                          Percent                                Valid Percent                    Cumulative Percent

Valid                                    3966                                       88.4                                        88.4                                        88.4

                Category 10        2                                              .0                                            .0                                            88.4

                Category 11        30                                           .7                                            .7                                            89.1

                Category 12        92                                           2.1                                          2.1                                          91.2

                Category 13        120                                         2.7                                          2.7                                          93.8

                Category 14        277                                         6.2                                          6.2                                          100.0

                Total                      4487                                       100.0                                     100.0    

 

 

As you can see, there are no females aged 2-3 years who fall into the first 9 iron intake categories.  Basically, how can I calculate those frequency numbers (in the example above, for Categories 10 through 14), which I can then weight each one by its relevant probability, then sum them all to get the weighted total (and print that weighted total to the output window)?

 

Note 1: the “Valid” count relates to other children in the dataset, who are different age/sex combination to that shown above.

Note 2: the string variable “IRON2TO3F” contains the “Category 10”…”Category 14” values used in the frequency table above. In case it helps, the syntax used to create the table was:

FREQUENCIES VARIABLES=IRONGROUP

  /ORDER=ANALYSIS.

 

Each age/sex combination has a different variable storing the frequencies so I could get around DO statements. For example, males aged 2-3 years have their category data stored in the variable “IRON2TO3M”.  And I need to calculate their single weighted total as well, along with another 8 age-sex combinations.

 

Cheers

Michelle

**********************************************************************

This email and any files transmitted with it are confidential and

intended solely for the use of the individual or entity to whom they

are addressed. If you have received this email in error please notify

the system manager.

This footnote also confirms that this email message has been swept by

MIMEsweeper for the presence of computer viruses.

www.clearswift.com

**********************************************************************

Reply | Threaded
Open this post in threaded view
|

Re: need to calculate a single weighted total of frequencies/counts, repeatedly [Sec: UNCLASSIFIED]

Gosse, Michelle

Hi Gene,

 

Thanks to your tip, I have read up on the Aggregate command and it seems to be exactly what I need, using the NU function as you suggest below.

 

This will be so much easier than the Matrix/End matrix iteration I thought I was going to be doing.

 

Thanks for your help. J

 

Michelle

 

From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Gene Maguin
Sent: Saturday, 13 November 2010 3:55 a.m.
To: [hidden email]
Subject: Re: need to calculate a single weighted total of frequencies/counts, repeatedly [Sec: UNCLASSIFIED]

 

MIchelle,

 

I'm not sure i understand your problem but, to the extent that i do understand it, i think that you might use the Aggregate command. You define your age-sex combinations and iron consumption categories. Then (i assume your file is unweighted)

 

aggregate outfile=*/break=age_sex iron_category/cases=nu.

 

Then divde each count value (cases variable) by 4487, which appears to be your total N. I don't know that this does everything that you want done but i don't understand all the pieces.

 

Gene Maguin

 

 

 

 

 


From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Gosse, Michelle
Sent: Thursday, November 11, 2010 9:37 PM
To: [hidden email]
Subject: FW: need to calculate a single weighted total, off frequencies/counts, repeatedly [Sec: UNCLASSIFIED]

Greetings all,

 

I have a dataset of iron intakes for children of varying ages.  I have already gone through and computed iron intake categories for each age group, for each sex separately.  There are a total of 14 iron intake categories, which correspond to the descending probability that of iron insufficiency in the diet.

 

There are different numbers of children in each category, and for some children/age combinations there are “missing” categories as no children fell into the relevant iron intake range.

 

What I need to do,

1.       for each age-sex group, and

2.       for each iron intake category within that age-sex group,

is to multiple the frequency/count of children by the probability for that iron intake category, to produce a single figure.  Then I need to sum all those single figures to end up with one (weighted) total.  This can be print to the output window.

 

I don’t need any of the probabilities or frequencies data saved, just that end weighted total for each age-sex combination in the data.

 

I was thinking that I need to use the matrix/end matrix with some type of loop inside.

 

For example, here is the frequency output table for females aged 2-3 years:

                                OBSERVED IRON 2-3 YEARS FEMALE

                                                Frequency                          Percent                                Valid Percent                    Cumulative Percent

Valid                                    3966                                       88.4                                        88.4                                        88.4

                Category 10        2                                              .0                                            .0                                            88.4

                Category 11        30                                           .7                                            .7                                            89.1

                Category 12        92                                           2.1                                          2.1                                          91.2

                Category 13        120                                         2.7                                          2.7                                          93.8

                Category 14        277                                         6.2                                          6.2                                          100.0

                Total                      4487                                       100.0                                     100.0    

 

 

As you can see, there are no females aged 2-3 years who fall into the first 9 iron intake categories.  Basically, how can I calculate those frequency numbers (in the example above, for Categories 10 through 14), which I can then weight each one by its relevant probability, then sum them all to get the weighted total (and print that weighted total to the output window)?

 

Note 1: the “Valid” count relates to other children in the dataset, who are different age/sex combination to that shown above.

Note 2: the string variable “IRON2TO3F” contains the “Category 10”…”Category 14” values used in the frequency table above. In case it helps, the syntax used to create the table was:

FREQUENCIES VARIABLES=IRONGROUP

  /ORDER=ANALYSIS.

 

Each age/sex combination has a different variable storing the frequencies so I could get around DO statements. For example, males aged 2-3 years have their category data stored in the variable “IRON2TO3M”.  And I need to calculate their single weighted total as well, along with another 8 age-sex combinations.

 

Cheers

Michelle

**********************************************************************

This email and any files transmitted with it are confidential and

intended solely for the use of the individual or entity to whom they

are addressed. If you have received this email in error please notify

the system manager.

This footnote also confirms that this email message has been swept by

MIMEsweeper for the presence of computer viruses.

www.clearswift.com

**********************************************************************