As mentioned when working on #754, it might make sense to split AnalyticWeights into two separate types of weights:
PrecisionWeights, which represent observations with a known variance. The weight for each observation should be equal to 1/σ^2.
BatchWeights, which represent observations that are themselves averages of several observations (as used in e.g. meta-analysis). Each weight should be an integer equal to the number of observations in the batch.
It's possible to break these down further -- BatchWeights might be broken down based on whether they're homogenous (identical means) or heterogenous (differing means), and PrecisionWeights could be broken down based on whether each observation has a variance that is completely known or known only up to a constant.
This would solve the current problem where the ambiguity of AnalyticWeights can result in nonsense answers -- for instance, var currently returns an estimate that assumes a sample size equal to length(weights), which is incorrect if each observation is actually an average of several sub-observations (the way the docstring for AnalyticWeights says they should be used).
As mentioned when working on #754, it might make sense to split
AnalyticWeightsinto two separate types of weights:PrecisionWeights, which represent observations with a known variance. The weight for each observation should be equal to1/σ^2.BatchWeights, which represent observations that are themselves averages of several observations (as used in e.g. meta-analysis). Each weight should be an integer equal to the number of observations in the batch.It's possible to break these down further --
BatchWeightsmight be broken down based on whether they're homogenous (identical means) or heterogenous (differing means), andPrecisionWeightscould be broken down based on whether each observation has a variance that is completely known or known only up to a constant.This would solve the current problem where the ambiguity of
AnalyticWeightscan result in nonsense answers -- for instance,varcurrently returns an estimate that assumes a sample size equal tolength(weights), which is incorrect if each observation is actually an average of several sub-observations (the way the docstring forAnalyticWeightssays they should be used).