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

Possible bug in get_weights_nonmetric() for factorial scheme #4

Open
guilhemchalancon opened this issue Mar 23, 2014 · 0 comments
Open

Comments

@guilhemchalancon
Copy link

Hi Gaston,

In get_weights_nonmetric() [as of 30aaec0], the computation of inner weights seems to fail when using the factorial scheme. I have pasted an example code at the end for you to reproduce the error.

Straight to the point, the reason is that the label for factorial is wrong in get_weights_nonmetric().

    # =============================================================
    # updating inner weights
    # =============================================================
    E <- switch(specs$scheme, 
                "centroid" = sign(cor(Y) * link),
                "factor" = cov(Y) * link,
                "path" = get_path_scheme(path_matrix, Y))
    # internal estimation of LVs 'Z'
    Z = Y %*% E

Here, switch is used to choose between the 3 possible schemes, expect it searches for factor rather than factorial.

The corrected line should thus be:

switch(specs$scheme, 
"centroid" = sign(cor(Y) * link), 
"factorial" = cov(Y) * link,
"path" = get_path_scheme(path_matrix, Y))

And here is an example code:

data(russa)
rus_path = rbind(c(0, 0, 0), c(0, 0, 0), c(1, 1, 0))
rownames(rus_path) = c("AGRI", "IND", "POLINS")
colnames(rus_path) = c("AGRI", "IND", "POLINS")
rus_blocks = list(1:3, 4:5, 6:9)
rus_scaling = list(c("NUM", "NUM", "NUM"),
                   c("NUM", "NUM"),
                   c("NUM", "NUM", "NUM", "NUM"))
rus_modes = rep("A", 3)
example = plspm(russa, rus_path, rus_blocks, scaling = rus_scaling, modes = rep("PLSCOW",3), scheme = "factorial")

which gives 'Error during wrapup: requires numeric/complex matrix/vector arguments'

Cheers,
G

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