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

get_boots() and handling of missing values #5

Open
guilhemchalancon opened this issue May 19, 2014 · 0 comments
Open

get_boots() and handling of missing values #5

guilhemchalancon opened this issue May 19, 2014 · 0 comments

Comments

@guilhemchalancon
Copy link

version: 7881086

I ran into a bug when using models that include missing values in the input data. The bug only appears when boot.val = T, so I looked into the get_boots() function.

To see the bug, you might simply run the toy data example with boot.val = TRUE:

# let's add missing values to russa
russNA = russa
russNA[1,1] = NA
russNA[4,4] = NA
russNA[6,6] = NA

# PLS-PM using data set 'russa'
rus_pls6 = plspm(russNA, rus_path, rus_blocks, scaling = rus_scaling, 
    modes = rus_modes, scheme = "centroid", plscomp = c(1,1,1), boot.val = TRUE)

I found out that the problem appears when the cross-loadings are computed. These are obtained with the function cor:
xloads = cor(X, Y.lvs)

Incidentally, the default behaviour of cor is not great: it doesn't handle missing values by default, and thus creates rows full of NAs in xloads whenever a column in X contains NAs.

Solution:
xloads = cor(X, Y.lvs, use="complete.obs")

Where (in the get_boots.r source file) :
both in the initiation of all values (line 54) and in the while loop (line 105).

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