Weighting with Panel Data

From Q
Jump to: navigation, search

Weights can be applied from either of the databases. A weight from the transactional database can be applied to a crosstab using only data from household database and vice versa. For example, the left side of the table below shows lifestage with an expansion weight applied whereby the sample of 1,000 people is weighted up to a population of 10 million people. Thus, the interpretation of this table is that 22 people in the sample are Independents, which makes up 4% of the population and it is estimated that the entire population contains 431,664 households in this lifestage.


The right side of the table above shows the same household data but weighted by both the same expansion weight as applied on the left but also by the quantity of products purchased (the construction of this type of weight is discussed shortly). Thus, its interpretation is:

  • 3% of all purchases were by Independents.
  • 37 purchase situations involved Independents. Note that it is the number of purchase situations (i.e., rows in the situation database) and not the number of purchases.
  • Independents are estimated as having purchased a total of 1,154,491 of the products.

Where a weight from the transactional database is applied to a table in the household database, the weight is computed by summing together the values of the weight in the transactional database. For example, if ID 233 has six observations in the transactional database with weights of 1.0, 1.0, 1.0, 2.0, 1.0 and 0.9, the weight applied in the household database is 6.9.

Where variables have been constructed in the household database using data from the transactional database, the decision of which database to use for the weight fundamentally alters the interpretation of any analyses. Consider penetration (the computation of which is discussed below). The left side of the table below shows weights penetration by an expansion weight in the household database. The interpretation is that 67% of households have purchased (i.e., the penetration is 67%). The right side of the table below shows the same table but where the weight has been taken from the transactional database. It shows that 100% have purchased, which is because anybody who has not purchased has no data in the transactional database and consequently they end up with a weight of 0.


Creating weights by combining individual-level and situational variables

The weight used on the right side of the two examples above combine both an expansion weight from the household data with a measure of quantity purchased from the transactional database. The following describes how such a weight can be created (using c:\Program Files\Q\Examples\Panel.Q):

  • In the Variables and Questions tab for the transactional database, right-click and select Insert Variable(s) > JavaScript Variable > Numeric.
  • The following Expression then computes the weight: quantity * Q.GetValue('Weight', 'Households.sav'), where:
    • quantity is the name of the variable in the transactional database which indicates the quantity purchased (i.e., each row in the transactional database represents a purchase; the quantity is the number of items purchased in a given transaction).
    • Q.GetValue('Weight', 'Households.sav') takes the expansion weight from the household database and matches it to the appropriate observation in the transactional database, where Weight is the Name of the weight variable and Households.sav is the name of the household database (unless it has been modified using File > Data Sets > Edit Names).
    • * multiplies the expansion weight by the quantity purchased to compute the new weight.
  • The JavaScript variable then needs to be tagged as a weight and selected in the Weight drop-down.