Skip to content

keep theta_start, mu and sigma2 aligned with respm after dropping persons - #3

Open
kevinushey wants to merge 1 commit into
jansteinfeld:masterfrom
kevinushey:rcpp-sugar-lengths
Open

kevinushey wants to merge 1 commit into
jansteinfeld:masterfrom
kevinushey:rcpp-sugar-lengths

Conversation

@kevinushey

Copy link
Copy Markdown

Background

The next Rcpp release (see RcppCore/Rcpp#1513) checks that the operands of a sugar expression, and a vector assigned into a matrix row, column or Range subset, have matching lengths. Previously a longer operand was silently truncated to the length of the left-hand side or target. With that check, PP fails its CRAN checks with:

Error: sugar operands have different lengths (13 and 11)

For type = "mle" and "robust", PP_4pl(), PP_gpcm() and PPall() drop persons with a full or zero score from respm before estimation, and killdupli = TRUE drops duplicated patterns. theta_start, mu and sigma2 are not subset along with it, so the C++ side receives start values for 13 persons and a response matrix for 11, and l1l2M(_, 3) = THETA - l1l2M(_, 2) fails. Old Rcpp used the first 11 start values, so after removing persons from the middle the start values were shifted relative to the remaining persons. With the default start values this only affected the starting point of the Newton-Raphson iterations; with killdupli = TRUE and per-person mu/sigma2 it paired persons with the wrong prior.

Change

Subset theta_start, and mu/sigma2 when they are per-person vectors, with the same index as respm in both places, in all three estimation functions.

Testing

R CMD check on the patched package passes against both the current Rcpp branch and released Rcpp 1.1.2. Results with the default start values are unchanged.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant