SPSS Statistics

 View Only
  • 1.  WEIGHT algorithm

    Posted Fri October 06, 2023 09:32 AM

    Greetings and salutations!

    I am looking for the algorithm behind the WEIGHT function.

    Three simple analogies to what I'm looking for are:

    SUM(numexpr1, numexpr2, numexpr3, ... numexprX) = numexpr1+numexpr2+numexpr3+ ... +numexprX

    AVERAGE(numexpr1, numexpr2, numexpr3, ... numexprX) = (numexpr1+numexpr2+numexpr3+ ... +numexprX)/X

    AVERAGE(numexpr1, numexpr2, numexpr3, ... numexprX) = SUM(numexpr1, numexpr2, numexpr3, ... numexprX)/X

    I've submitted a support request on this (Case number TSXXXXXX962) , but was told to ask the good folks here.

    I am looking for a "general case" description. I was able to figure out and implement a "special case," algorithm but the algorithm I used only seems to work with the specific question type I was working on. I'm not looking for any proprietary information. I would be extremely surprised if the WEIGHT algorithm was not available publicly since people have been weighting data since (I would imagine) long before computers were a thing.

    I've looked in IBM_SPSS_Statistics_Algorithms.pdf (from IBM SPSS Statistics 29 Documentation) and Numerical Recipes in Fortran 77 Second Edition.

    Could some charitable soul direct me to a reference source (webpage, book, etc.) or provide pseudocode here?

    Thank you in advance!



    Paul Lee

  • 2.  RE: WEIGHT algorithm

    IBM Champion
    Posted Fri October 06, 2023 10:09 AM
    There is no WEIGHT algorithm.  The weight is a property of each case, but how it is used depends on the particular statistical procedure.  In general, you can think of the weight as the equivalent of replicating a case that many times, but if the weight is fractional, that is only an approximation.  If a weight is set but the value is missing for a case, the case will not be seen by statistical procedures, but transformation functions such as SUM or AVERAGE would still do their normal computation, since those results do not involve the weight.

    Exactly how the weight is treated in statistical procedures is documented in the Algorithms doc for each procedure, but note that there are several different kinds of weights.   Besides the simple replication weight, which is what the WEIGHT command sets, there are complex sample weights used in the complex samples procedures, and effective base weights that can be used in CTABLES as an approximation to the CS treatment.


  • 3.  RE: WEIGHT algorithm

    Posted Fri October 06, 2023 10:46 AM

    Hello, Jon!

    Thank you for the information!


    Paul Lee