Dear list, I am trying to aggregate some variables measured at the individual level to the group level of analysis. Say I have satisfaction of person X and I want to aggregate the satisfaction of all N persons in group j to obtain the group level satisfaction. This, of course, is straightforward in SPSS. But I want to calculate this group score minus the score of the person for which the aggregation is conducted. So, person X will be assigned the group average score obtained by aggregating the score of all the persons in the group minus the score of the focal person X. I'd appreciate some syntax code to carry out this aggregation. |
I assume you mean the mean score when you say aggregate? If so, create the sum for each group and the N for each group
(NG) using the aggregate command, then for each person, subtract
their score from the sum and divide that by (NG - 1). aggregate outfile = * mode = addvariable /break = groupid /sumsat = sum(jobsat) /NG = N. compute aggsat = (sumsat - jobsat)/(NG - 1). exe. On 07/03/2017 11:21, Andra Th wrote:
-- -- Dr Chris Stride, C. Stat, Statistician, Institute of Work Psychology, University of Sheffield Telephone: 0114 2223262 Fax: 0114 2727206 "Figure It Out" Statistical Consultancy and Training Service for Social Scientists Visit www.figureitout.org.uk for details of my consultancy services, and forthcoming training courses, which are also available on an in-house basis: - Data management using SPSS syntax - Advanced SPSS syntax and SPSS macros - Testing for Mediation and Moderation using SPSS - Multi-level Modelling using SPSS - Introduction to Structural Equation Modelling using Mplus - Testing for Mediation and Moderation using Mplus - Multi-level Modelling using Mplus - Latent Growth Curve Modelling using Mplus===================== 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 |
Thank you, yes, I meant the mean and that worked perfectly! On Tuesday, March 7, 2017 1:32 PM, Dr Chris Stride <[hidden email]> wrote: I assume you mean the mean score when you say aggregate?
If so, create the sum for each group and the N for each group
(NG) using the aggregate command, then for each person, subtract
their score from the sum and divide that by (NG - 1).
aggregate outfile = * mode = addvariable /break = groupid /sumsat = sum(jobsat) /NG = N. compute aggsat = (sumsat - jobsat)/(NG - 1). exe. On 07/03/2017 11:21, Andra Th wrote:
-- -- Dr Chris Stride, C. Stat, Statistician, Institute of Work Psychology, University of Sheffield Telephone: 0114 2223262 Fax: 0114 2727206 "Figure It Out" Statistical Consultancy and Training Service for Social Scientists Visit www.figureitout.org.uk for details of my consultancy services, and forthcoming training courses, which are also available on an in-house basis: - Data management using SPSS syntax - Advanced SPSS syntax and SPSS macros - Testing for Mediation and Moderation using SPSS - Multi-level Modelling using SPSS - Introduction to Structural Equation Modelling using Mplus - Testing for Mediation and Moderation using Mplus - Multi-level Modelling using Mplus - Latent Growth Curve Modelling using Mplus
=====================
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 |