2
$\begingroup$

I want to know whether my interpretation of GLM weights is correct.

On R documentation of GLM it says that

Non-NULL weights can be used to indicate that different observations have different dispersions (with the values in weights being inversely proportional to the dispersions); or equivalently, when the elements of weights are positive integers , that each response is the mean of unit-weight observations.

I would like to know if I could therefore say that using weights changes the log-likelihood function which is minimized in the following way \begin{align*} \sum_{i} \log f(X_i) \to \sum_{i} w_i \log f(X_i) \end{align*}

If yes does this only hold if the weights are positive integers?

EDIT: If not how can I modify the log likelihood such that this holds? \begin{align*} \sum_{i} \log f(X_i) \to \sum_{i} w_i \log f(X_i) \end{align*}

$\endgroup$

1 Answer 1

2
$\begingroup$

As described in detail here, you can think of the weights as of pseudo-counts of observations (hence they need to be positive). If your likelihood function is

$$ \mathcal{L}(\theta|x_1,x_2,\dots,x_N) = f_\theta(x_1) f_\theta(x_2) \dots f_\theta(x_N) $$

then if you had your data recorded as tuples $(x_i, n_i)$ where $x_i$ is the value and $n_i$ is the number of times this value was observed, then the likelihood becomes

$$\begin{align} \mathcal{L}(\theta|x_1,x_2,\dots,x_n) &= \underbrace{f_\theta(x_1) \dots f_\theta(x_1)}_{n_1\,\text{times}} \underbrace{f_\theta(x_2) \dots f_\theta(x_2)}_{n_2\,\text{times}} \dots \underbrace{f_\theta(x_n) \dots f_\theta(x_n)}_{n_N\,\text{times}} \\ &= f_\theta(x_1)^{n_1} f_\theta(x_2)^{n_2} \dots f_\theta(x_N)^{n_N} \end{align}$$

with log-likelihood, by the properties of logarithms, this is just

$$ \log \mathcal{L}(\theta|x_1,x_2,\dots,x_N) = n_1 \log f_\theta(x_1) + n_2 \log f_\theta(x_2) + \dots + n_N \log f_\theta(x_N) $$

It is the same if the weights are not counts, but are non-negative and proportional to the counts.

$\endgroup$
7
  • $\begingroup$ Thank you very much! $\endgroup$ Commented Jan 9, 2023 at 9:07
  • $\begingroup$ @AnjaKrause if this answers your question, you can mark the answer as accepted so others know it is "done". $\endgroup$
    – Tim
    Commented Jan 9, 2023 at 9:10
  • 1
    $\begingroup$ Did it. Thanks for reminding me! $\endgroup$ Commented Jan 9, 2023 at 10:36
  • $\begingroup$ In addition, you can upvote it! An answer which can be accepted also deserves an upvote! $\endgroup$ Commented Jan 9, 2023 at 15:39
  • $\begingroup$ See stats.stackexchange.com/questions/369611/… for an example with negative weights $\endgroup$ Commented Jan 9, 2023 at 15:42

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.