Add observation-level sample weights to poLCA - #29
Conversation
|
Have you written this commit yourself? |
Is there a chance you could instead modify the |
reply by claude Fable 5:
|
Adds a weights argument to poLCA() (numeric vector or column name of data) implementing weighted pseudo-maximum-likelihood estimation: - weighted log-likelihood sum_i w_i log f(y_i) - weighted M-step response probabilities via row-scaled posteriors passed to the existing probhat C routine - weighted mixing proportions (no-covariate case) and a weighted pure-R Newton step poLCA.dLL2dBeta.w for latent class regression, matching the C layout of d2lldbeta2 exactly at unit weights - pseudo-ML sandwich standard errors in poLCA.se (A^-1 B A^-1 with A = sum w s s', B = sum w^2 s s'), reducing to the original ginv(t(s) s) at unit weights - weighted cell frequencies in poLCA.compress for Chisq/Gsq weights=NULL or all-1 weights reproduce the original estimator exactly; integer weights match row-replicated data to fp accumulation error. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
a1e5c31 to
67418e2
Compare
a new push and pull request is presented.
|
Adds a weights argument to poLCA() (numeric vector or column name of data) implementing weighted pseudo-maximum-likelihood estimation:
weights=NULL or all-1 weights reproduce the original estimator exactly; integer weights match row-replicated data to fp accumulation error.