Repository navigation
Description
(issue with just some notes, see weights isssues: ....)
frequency weights version variance weights.
GLM in R, and aweights in Stata have the interpretation that the observation is the mean of a group of samples with the same exog.
Property 11.3.7 (Taking sample means)
Let Y1,...,Ym be a sample of m independent copies of the random variable Y, and
let Y=(Y1+···+Ym)/m be the sample mean. If Y is a member of an exponential dispersion
subfamily with fixed functions b(·) and c(·;·) and with parameters θ and ψ, then Y is in the
same exponential dispersion subfamily with parameters θ and ψ/m, if this pair of
parameters is allowed.
page 303: "Modern Actuarial Risk Theory - Using R" Springer
Similar results apply for Poisson, similar for Binomial but that has a limitation.
Difference in use case, but can be largely equivalent
frequency weights: this is just to save memory and computation where we combine observations with identical exog and identical endog.
This does not impose any assumption, as long as we combine "full" observations, e.g. identical clusters or panel units if there is within correlation.
var_weights for mean: we are combining observations with identical exog, but with non-identical endog, under some assumptions on the individual realisations. Standard assumption is i.i.d. And based on above we stay in the same exponential subfamily.
weights in this case are just given by how many i.i.d. observations are used in calculating the mean.
AFAICS, mean is just a special case, another version would be aggregating the samples as in Poisson or Binomial with person-years.
The main application is for life-tables or similar tables that publish only average or aggregate results for prespecified "strata", i.e. groups of observations with identical exog.
Given the strong assumptions in this case, we can get different results if we don't impose these assumptions, e.g. by using robust covariance matrix.
related to #2835 and #2831 about cov_type HC with exposure versus freq_weights.
Activity
thequackdaddy commentedon Feb 25, 2016
Josef,
First, thanks again for your help on this. You've made me think about these problems more.
Oooh... this clears up that confusion a bit.
So for property and casualty actuaries the common the common things we use GLM's for are:
In all 3 cases, you can easily have multiple records with the same exog but the endog is different.
So when modeling frequency or loss costs, it still seems to me that freq_weights are more correct. We often have policies in force for different lengths of time. Sometimes this might be a function of an insured making a minor change to a policy (like he might switch his phone number) or he might forget to pay one month, have the policy cancelled, and reinstate later. In both cases, our system will create new records for the new observations. So I like the fact that you get the same loglikelihood/deviance/covariance parameters with freq_weights with duplicated and weighted data.
I think what you are saying is that var_weights will contribute to heteroskedasticity and freq_weights will not?
josef-pkt commentedon Feb 25, 2016
In your 3 cases the main difference is in the normalization. AFAICS, under assumed correct specification, freq_weights, var_weights, exposure/offset are all equivalent under appropriate scaling of the endog. (exposure/offset is only for log link where it's multiplicative as needed for these cases.)
for example:
We can have counts as endog and total person/years as exposure in Poisson (that's standard)
Using the average count/exposure with weights is equivalent.
under partial misspecification:
GLM in general only requires a correctly specified mean function. Like in OLS, the parameter estimates are consistent even if heteroscedasticity/variance is misspecified (but it's not efficient, estimates are noisier than with correctly misspecified variance function)
If the variance function is not correctly specified, then we need to use heteroscedasticity robust covariance matrices for the standard errors and inference.
The standard theory for robust covariances is that we have individual observations.
So far it's relatively clear, the aggregation issue is the sticky point. I'm still not sure about #2831 because the aggregation effect looked to large to me. Standard errors 10 times the unaggregated version.
In the above quote and in the standard derivation of Poisson and Binomial counts is that it aggregates identical units. If there is unaccounted for heterogeneity, then the distribution does not stay in the same subfamily, e.g. Poisson with gamma heterogeneity becomes Negative Binomial. Binomial with Beta heterogeneity becomes Beta-Binomial (conjugate prior pairs).
A similar problem shows up if the aggregated observations are correlated instead of independent.
(A finance analogy: Gaussian copula doesn't have any or maybe not enough tail dependence, and some investors on Wall Street got surprised when their pricing formulas where "a bit" off.)
Given that GLM/LEF only requires correct mean specification, we can most likely still get good parameter estimates in any of the aggregated versions, but the distribution if we want to know other probabilities, standard errors and inference might be fragile or not very robust and dependent on the details.
For the implementation in GLM, I think for most parts our freq_weights will work in the same way as R, Stata var_weights, and we should be able to reuse it. However, there will still be tricky parts in the Quasi-Maximum Likelihood interpretation, and robust standard errors.
(A related case that also made me suspicious without understanding the details or finding an explanation in the textbooks:
In the context of contingency tables that have similar aggregated data, the interpretation of the deviance is in my opinion ambiguous. It's used as goodness of fit statistic relative to the fully parameterized, saturated model, but it is also a measure of dispersion which should be 1 in Poisson, and a measure of over or under dispersion under QMLE assumptions. So what's the "true" model?
)
josef-pkt commentedon Feb 26, 2016
another thought:
when scaling endog to for example means, then this scales the implied variance, i.e. sigma * weights (or sigma^2 / weights ? check).
in Poisson sigma or scale = 1, so the rescaled scale is also fully parametric defined by weights and the endog scaling.
I think this means we have to watch out when we try to reuse freq_weights in the sense of var_weights when we calculate the
nonrobustcovariance.Similar would apply if we allow for GLM/QMLE type dispersion.
If scale is estimated like in WLS or if we use a robust cov_type, then there is no prior assumption on the scaling of the scale, i.e. it doesn't affect the calculation of the cov_params as in WLS.
(Getting these implications correctly will be simpler when we have reference unit tests against R or Stata.)
josef-pkt commentedon Jun 16, 2018
random thought for aggregation and exposure issue:
using the mixture of poisson interpretation of negative binomial and similar distribution and thinking of the underlying distribution of panel data with individual unobserved heterogeneity that is constant over time:
If we look at one individual over time, then the distribution is Poisson (fixed heterogeneity), and aggregating over time is just increasing poisson exposure (i.e. additive without change in scale).
If we look at the cross section, then the (empirical) distribution of heterogeneity (individual unobserved constants) stays the same.
If we increase the number of cross-sectional units, then we get new individuals with new draws from the distribution of unobserved heterogeneity. The time that each individual is observed (individual exposure) stays the same.
I think this should have different effects on the dispersion function when we aggregate over individuals and time. The same type of effects would apply if individual heterogeneity changes over time and we have small dispersion across individuals. (i.e. time random effects dominate)