1
$\begingroup$

I want to weight observations for a regression. I'm worink in R and I'm using the method lmrob from the package robust.

As I saw in the description of the method, there is a parameter for the weights. I don't really know haw to define this array.

What I want is that the first 25% of the date should be more weightend and the last 25% should be less weighted.

Can someboe give me a hint?

Thank you!

$\endgroup$

1 Answer 1

3
$\begingroup$

The description of weights parameter in lmrob states that it is

vector of observation weights; if supplied, the algorithm fits to minimize the sum of a function of the square root of the weights multiplied into the residuals. The length of weights must be the same as the number of observations. The weights must be nonnegative and it is strongly recommended that they be strictly positive, since zero weights are ambiguous, compared to use of the subset argument.

and so it is defined as in other methods (e.g. lm), what means that it is used to provide some external weights such as survey weights. You use such weights to tell your function that some observations are "more important" than others in your data (e.g. they appear in your data less frequent than in population of interest). It is not connected anyhow to the robustness of this method and you do not have to provide this parameter - in most cases you leave it empty.

So if you want the first 25% of sample to have greater weight and the last 25% to have lower weight you define such weights that have this property and sum to 1. For example, if you have 4 observations, then the weights could be: $3/8, 2/8, 2/8, 1/8$. However generally, you do not use some arbitrary weights but you base them on some external criteria e.g. on how much undersampled some values are comparing to the population.

$\endgroup$
4
  • $\begingroup$ I know that it is optional, but I needed in order to tell the importance of the observations. The first 25% are important and the last 25% of the data are less important. $\endgroup$
    – Paul
    Commented Apr 23, 2015 at 10:03
  • $\begingroup$ Then you provide such weights that sum to 1, with greater values for some observations and smaller for others. $\endgroup$
    – Tim
    Commented Apr 23, 2015 at 10:05
  • $\begingroup$ one more question, how should they sum up to 1? In you're example all together don't sum up to 1, but only the first with the last and the second with the third. $\endgroup$
    – Paul
    Commented Apr 23, 2015 at 11:55
  • $\begingroup$ @Paul yes, thanks! I changed the example and forgot to change values. Not it is ok. If you take all the values of weights they have to sum to 1 and neither of the values should be equal to 0 - that are the constraints. $\endgroup$
    – Tim
    Commented Apr 23, 2015 at 11:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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