SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
  • 1.  Mean of Mean Calculation

    Posted 24 days ago

    We're calculating the mean of 29 attributes for 5720 (to be precise) respondents. In SPSS, the overall average comes out to 6.58, but in Excel, it's 6.69. This difference is because SPSS calculates the mean at the respondent level, while in Excel, we average the 29 attribute means to get a grand average. Can SPSS be set up to calculate the mean the same way as Excel?



    ------------------------------
    Vinod Kumar
    ------------------------------


  • 2.  RE: Mean of Mean Calculation

    Posted 24 days ago
    An average of averages is not the overall average in general, but if you sum the attributes, say 
    COMPUTE Z = SUM(x1 to x29)/29
    the mean of that will be the overall mean.



    --





  • 3.  RE: Mean of Mean Calculation

    Posted 23 days ago

    Hello @Vinod Kumar.  You said you want a "grand average".  I gather you mean that you want to add up all raw scores and divide by the number of raw scores.  If so, and if you want other statistics besides the mean (e.g., the SD of all raw scores), you might find it convenient to restructure the file from WIDE to LONG (assuming it is currently a wide file).  If your variables are called x1 to x29, for example, and assuming you have a numeric ID variable called ID, you could do this:

    * Restructure from WIDE to LONG.
    VARSTOCASES
      /MAKE X FROM x1 TO x29
      /INDEX=i(29) 
      /KEEP=ID 
      /NULL=KEEP.
    * Now the mean of X will be the grand mean of all X-scores.
    DESCRIPTIVES X.

    I hope this helps.



    ------------------------------
    Bruce Weaver
    ------------------------------



  • 4.  RE: Mean of Mean Calculation

    Posted 23 days ago

    Thanks for the solution, Bruce.

    Yes, stacking the data would give me the same results, the issue is that I have 600 other variables. The mean of the means needs to be included in further calculations, so I can't simply stack my entire dataset. Doing so would make it too long and would require me to revise the entire syntax for other data tables, which have already been set up.

    Thanks again!



    ------------------------------
    Vinod Kumar
    ------------------------------



  • 5.  RE: Mean of Mean Calculation

    Posted 23 days ago
    But what about the other solutions posted?


    --





  • 6.  RE: Mean of Mean Calculation

    Posted 23 days ago

    Hi Jon - That also doesn't gives me correct result.



    ------------------------------
    Vinod Kumar
    ------------------------------



  • 7.  RE: Mean of Mean Calculation

    Posted 23 days ago
    Why not?  






  • 8.  RE: Mean of Mean Calculation

    Posted 23 days ago

    The main difference seems to lie in how we're calculating the values in Excel versus SPSS. In Excel, we calculate the average for each of the 29 variables individually, and then take the average of those 29 average scores. So, the sum of those 29 average scores divided by 29 gives me a slightly different result. In contrast, in SPSS, we're summing the data for all respondents and dividing it by the total number of respondents. This is the key difference. While stacking the data might work, I can't stack the entire 5270-record database, as doing so would disrupt the syntax I've already set up for tabulation.



    ------------------------------
    Vinod Kumar
    ------------------------------



  • 9.  RE: Mean of Mean Calculation

    Posted 22 days ago
    Unless there are missing values in the data, the results should be identical.  Using the SUM function for the casewise calculation and then summing the results should be mathematically the same.


    --





  • 10.  RE: Mean of Mean Calculation

    Posted 22 days ago

    Jon makes a good point about missing data.  If there are missing data, then you need to compute N for each item, or for each ID, as the number of valid data points in that column or row.  In Excel, that probably requires using some variation on the COUNT function--e.g., COUNTA or COUNTIF.  I'll leave it to you to figure out those details.  But in SPSS, you could use the NVALID function to get a count of valid (non-missing) values for each subject.  Here is a small example (using only 5 variables rather than your 29 variables).

    * Create some fake data to illustrate.
    NEW FILE.
    DATASET CLOSE ALL. 
    DATA LIST LIST / ID x1 to x5 (6F5.0).
    BEGIN DATA    
    1 2 4 6 3 7
    2 1 4 7 -9 5
    3 5 4 2 7 8
    4 -9 7 6 5 4
    END DATA.
    DATASET NAME raw.
    MISSING VALUES x1 to x5 (-9).
    COMPUTE IDsum = SUM(x1 to x5).
    COMPUTE IDn = NVALID(x1 to x5).
    FORMATS IDn (F5.0).
    LIST.

    * Now get the Grand Sum and Grand N.
    DATASET ACTIVATE raw.
    AGGREGATE
      /OUTFILE=* MODE=ADDVARIABLES
      /BREAK=
      /GrandSum 'Sum of item sums'=SUM(IDsum) 
      /GrandN 'Total # of items'=SUM(IDn).

    * Finally, compute the Grand Mean.
    COMPUTE GrandMean = GrandSum / GrandN.
    FORMATS GrandN (F8.0) / GrandMean (F8.3).
    TEMPORARY.
    SELECT IF $CASENUM EQ 1.
    DESCRIPTIVES GrandSum GrandN GrandMean /STATISTICS=MEAN.

    Had I included the MIN and MAX cells in the table above, they would show the same values as the MEAN cells (but they would show fewer decimal places).  And notice that the grand mean = the sum of the item sums divided by the total number of items:  87/18 = 4.83333.

    You could do the same thing using the sums and valid counts for each variable rather than each ID (or row), but you'd end up with the same result.  And that method--or at least the way I tackled it--is a bit messier.  

    I hope this helps. 



    ------------------------------
    Bruce Weaver
    ------------------------------