Ptypes and conditional statistics

I think you are running into the same problem I noted in the post PType Weights--the new `units` error!

That you are trying to compute a variance based on age and not on PType may not be relevant. What is likely relevant is how you compute your AggVars (the sum of evaluations of a function). What I found is that the per-PType AggVars have their values divided by their PType weights, anticipating that they will ultimately be summed to produce a correct result. But if you use the AggVar by itself (asking what is the Income of one of the PTypes), it will give you a weight-factored answer, which is not what you want.

I solved the simple problem of computing the conditional mean across PTypes. I think the problem you have identified, which I also note in the above thread, remains to be solved. I could give it a crack later today, in which case I’ll post to this thread a link to the commits that will get you there.

1 Like