3
$\begingroup$

Suppose I have the following database where I have, for each age, the average years of experience and income of the group and the number of individuals observed for such age (but not the income/experience of each individual):

----------------------------------------------------------------------------
| Average income | Age | Average years of experience | number of individuals 
----------------------------------------------------------------------------
|     105.40     | 18  |            2.1              |          23          
----------------------------------------------------------------------------
|     205.50     | 19  |            3.4              |          12         
----------------------------------------------------------------------------
|     465.40     | 20  |            4.5              |          33         
----------------------------------------------------------------------------
|     678.40     | 21  |            5.1              |          57          
----------------------------------------------------------------------------
|     815.40     | 22  |            6.6              |          11          
----------------------------------------------------------------------------
|     902.56     | 23  |            6.7              |          20          
----------------------------------------------------------------------------
|     997.13     | 24  |            7.3              |          13         

I want to get a regression [not necessarily a linear one] of the form:

$(Avg\_income) = \beta_0 + \beta_1 * (age) + \beta_2 * (Avg\_years\_xp)$

or

$(Income) = \beta_0 + \beta_1 * (age) + \beta_2 * (Years\_xp)$

The first approach I thought of was ignoring the "number of individuals" column and doing the regression as if I had only 7 observations, but this seems to be a waste of information, right?

The second was replicating each row by "number of individuals", but is this approach really correct? Also, I'd like to have this work in a more generalized way such that I can work a non-integer "number of individuals" (ok, doesn't make any sense in this example, but it does in my real problem).

Obs.: I'm planning doing a Bayesian inference, but Frequentist approaches are welcomed too. R syntax is good too.

$\endgroup$
  • 1
    $\begingroup$ averages of more points will tend to be more precise. If the variance of individual observations is constant, the variance of averages will be proportional to $1/n_i$. You need to weight the averages so the more precise ones get more weight. $\endgroup$ – Glen_b Jan 31 '14 at 11:20
  • $\begingroup$ @Glen_b thanks, do you know how one can use weights in other regression models like generalized linear models that don't have a variance parameter? (maybe this is subject to another question...) $\endgroup$ – random_user Feb 2 '14 at 23:59
  • $\begingroup$ GLM functions will usually let you supply a vector of weights or some equivalent. $\endgroup$ – Glen_b Feb 3 '14 at 0:01
2
$\begingroup$

Starting from your first approach: If you treat the data as if it had only 7 observations, you need to weight them with the size of the group.

Refer to this question for how to do regression with weights in R.

If you multiply every line by the number of individuals, you would assume that all individuals of an age group have the same income and experience, which will substantially bias your standard errors downwards.

Theoretically, if you expand the table and treat that as 23, 12 … number of observations, you have stochastic variables as regressors. Unfortunately, you do not know their variances, so you cannot use methods that account for that. See for example the wikipedia page for errors-in-variables.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.