Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matrix operations with blocks of 2 MVs in get_weights_nonmetric() #1

Open
guilhemchalancon opened this issue Mar 17, 2014 · 1 comment

Comments

@guilhemchalancon
Copy link

Dear Gaston,
I run into a bug when specifying the scaling argument in plpsm() for models that contain formative blocks (mode B) with 2 manifest variables (MVs).

The reason for this is comes from get_weights_nonmetric(), which is called whenever scaling is specified (even if all MVs are specified to be numerical).

In this function, the computation of X* when mode B is used is given by:

X.star[, p] <- (1/Beta[p]) * (Z[, q] - (QQ[[q]][, -p] %*% Beta[-p]))

Where q refers to the LV, p to the MV.

The problem is that when block_sizes[q] == 2, then QQ[[q]][,-p] won't be a matrix object, but a numeric vector, which causes the %*% operation to fail.

The fix is very simple: QQ[[q]][ -p, drop = FALSE ] should be used in the definition of X.star[,p]

Best regards,
G

@guilhemchalancon
Copy link
Author

I forgot to mention that this is relevant for the development version of the package (30aaec0).

@guilhemchalancon guilhemchalancon changed the title matrix operations with blocks of 2 MVs in get_weight_nonmetric() matrix operations with blocks of 2 MVs in get_weights_nonmetric() Mar 17, 2014
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

No branches or pull requests

1 participant