# Is it possible to put weights on clusters in MixedModels.jl?

**URL:** <https://discourse.julialang.org/t/is-it-possible-to-put-weights-on-clusters-in-mixedmodels-jl/32216>\
**Category:** Statistics\
**Created:** [December 13, 2019, 12:00am UTC](https://discourse.julialang.org/t/is-it-possible-to-put-weights-on-clusters-in-mixedmodels-jl/32216 "2019-12-13T00:00:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kai](https://avatars.discourse-cdn.com/v4/letter/k/cc9497/32.png) [@kai](https://discourse.julialang.org/u/kai)\
**Post date:** [December 13, 2019, 12:00am UTC](https://discourse.julialang.org/t/is-it-possible-to-put-weights-on-clusters-in-mixedmodels-jl/32216/1 "2019-12-13T00:00:25Z")

</div>

The package currently supports “case weights” - weights on individual observations. I wonder if there is a way to tweak the code so that I can put weights on clusters?

Specifically, the package currently can take a vector of observation weights `w` , and calculate the total log-likelihood as `\sum log(w_ij * P(y_ij))` , where `w_ij` and `y_ij` are the weight and response for observation `j` from cluster `i` .

However, instead of weighting the probabilities on the observation level, I want to weight the log-likelihood on the cluster level, i.e., I want to calculate `\sum w_i l_i` ? Here `w_i` and `l_i` are the weight and the log-likelihood for cluster `i` .

Can anyone give a pointer on where I should get started? Thank you.
