in that case error message turns out to ...
...
##path matrix for model 5 constructs
library(plspm)
library(matrixpls)
library(plsdepot) ## For hierarchical latent models of the two-step(patch) approach
library(ggplot2)
library(reshape2)
cores <- getOption("mc.cores")
options(mc.cores=2)
autonomy1 = c(0,0,0,0,0)
competence1 = c(0,0,0,0,0)
relatedness1 = c(0,0,0,0,0)
enjoyment1 = c(1,1,1,0,0) ## second order construct
future_play1 = c(0,0,0,1,0)
# data for inner model
switch_inner1 <- rbind(autonomy1, competence1, relatedness1, enjoyment1, future_play1)
colnames(switch_inner1) <- rownames(switch_inner1)
innerplot(switch_inner1)
# data for outer model
switch_outer1 <- list(18:20, 21:23, 24:26, 18:26, c(37, 38))
sw_modes1 <- rep("A", 5) ## all latent variables are measured in a reflective way
sw_pls1 <- plspm.res <- plspm(switch_data, switch_inner1, switch_outer1, modes = sw_modes1, boot.val = T, br = 200)
sw_pls1$unidim
sw_pls1$outer_model
sw_pls1$inner_summary
sw_pls1$gof
##
# data for factor scores
s1_pca.autonomy = nipals(switch_data[,18:20])
s1_pca.competence = nipals(switch_data[,21:23])
s1_pca.relatedness = nipals(switch_data[,24:26])
s1.autonomy.Score = s1_pca.autonomy$scores[,1]
s1.competence.Score = s1_pca.competence$scores[,1]
s1.relatedness.Score = s1_pca.relatedness$scores[,1]
s1_pca.enjoyment = cbind(s1.autonomy.Score, s1.competence.Score, s1.relatedness.Score)
# second step, inner model
s2.inner_model = rbind(autonomy1, competence1, relatedness1, enjoyment1, future_play1)
colnames(s2.inner_model) <- rownames(s2.inner_model)
#innerplot(s2.inner_model)
# second step outer model, blocks
# sw_blocks_2step = list(1:3, 4:6, 7:9, 22:24, 10:12, 13:15, 16:17, 25:27, 20:21)
s2.switch_data = cbind(switch_data[,18:38], s1_pca.enjoyment)
s2.outer_model = list(1:3, 4:6, 7:9, 22:24, 20:21)
# all latent variables are measured in a reflective way
sw_modes = rep(c("A"), 5)
plspm.res <- plspm(s2.switch_data, s2.inner_model, s2.outer_model, sw_modes, boot.val = T, br = 200)
summary(plspm.res)
#matrixpls with interim data of plspm style
matrixpls.res <- matrixpls.plspm(s2.switch_data, s2.inner_model, s2.outer_model, sw_modes, scaled = FALSE, boot.val = FALSE)
Last line is the error code line, above 5 lines from that is a no-problem plspm function applying.
Now if possible, I want to use matrixpls-type cfa model to use antecedent plspm model.
You experienced and experts! Pls help me.