Package 'matrixpls'
Transcription
Package 'matrixpls'
Package ‘matrixpls’ January 27, 2015 Encoding UTF-8 Type Package Title Matrix-based Partial Least Squares estimation Version 0.5.0 Date 2014-10-23 Maintainer Mikko Rönkkö <[email protected]> Description matrixpls is implements Partial Least Squares Path Modeling algorithm and related algorithms. The algorithm implementations aim for computational efficiency using matrix algebra and covariance data. The package is designed toward Monte Carlo simulations and includes functions to perform simple Monte Carlo simulations. URL https://github.com/mronkko/matrixpls BugReports https://github.com/mronkko/matrixpls/issues ByteCompile TRUE Imports assertive, matrixcalc, lavaan, psych, MASS Suggests plspm, simsem, RUnit, parallel, semPLS, boot, ASGSCA, RGCCA, Matrix License GPL-3 LazyLoad yes Author Mikko Rönkkö [aut, cre] NeedsCompilation no Repository CRAN Date/Publication 2014-11-29 07:59:50 R topics documented: matrixpls-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . AVE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . convCheck.absolute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 3 4 5 R topics documented: 2 convCheck.relative . . . . convCheck.square . . . . . CR . . . . . . . . . . . . . effects.matrixpls . . . . . . fitSummary . . . . . . . . GoF . . . . . . . . . . . . inner.centroid . . . . . . . inner.factor . . . . . . . . inner.GSCA . . . . . . . . inner.Horst . . . . . . . . inner.identity . . . . . . . inner.path . . . . . . . . . loadings . . . . . . . . . . matrixpls . . . . . . . . . matrixpls.boot . . . . . . . matrixpls.plspm . . . . . . matrixpls.sempls . . . . . matrixpls.sim . . . . . . . optim.GCCA . . . . . . . optim.GSCA . . . . . . . optim.maximizeInnerR2 . optim.maximizePrediction outer.factor . . . . . . . . outer.fixedWeights . . . . outer.GSCA . . . . . . . . outer.modeA . . . . . . . . outer.modeB . . . . . . . . outer.RGCCA . . . . . . . params.plsc . . . . . . . . params.plsregression . . . params.regression . . . . . params.tsls . . . . . . . . predict.matrixpls . . . . . R2 . . . . . . . . . . . . . residuals.matrixpls . . . . signChange.construct . . . signChange.individual . . weight.fixed . . . . . . . . weight.optim . . . . . . . weight.pls . . . . . . . . . Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 6 7 8 8 9 10 11 12 15 16 17 18 18 20 21 23 26 29 30 31 31 32 33 33 36 37 38 39 42 43 44 45 45 46 47 47 48 49 52 55 matrixpls-package 3 matrixpls-package Matrix-based Partial Least Squares estimation Description Matrixpls estimates composite variable models using Partial Least Squares estimation and related methods. The algorithms are based on matrix multiplication and equation group solving (using the solve function). Details Package: Type: Version: Date: License: matrixpls Package 0.4.0 2014-10-23 GPL-3 Matrixpls estimates models where sets of indicator variables are combined as weighted composites. These composites are then used to estimate a statistical model describing the relationships between the composites and composites and indicators. The most typical use for these method is approximating structural equation models with latent variables. The estimation algoritm consists of two steps. In the first step the indicators are combined as weighted composites and in the second step the composites are used to estimate a statistical model. The indicator weights are determined with the following iterative algorithm. Inner estimation Inner estimation function is applied to the data covariance matrix S, weight matrix W, and composite variable model matrix inner.mod. The function returns an inner weight matrix E. Outer estimation Outer estimation function is applied to the data covariance matrix S, weight matrix W, inner weight matrix W, and weight model matrix W.mod. The function returns a weight matrix W. Convergence check Convergence check function is applied to the weight matrix W before and after outer estimation. This function returns a scalar that is compared against the tolerance value. If the scalar is smaller than the tolerance value, the algorithm converges. Otherwise, a new iteration is started. After the weights have been calculated, the parameter estimator function is applied to the data covariance matrix S, the weight matrix W, and model object. The parameter matrices are constructed in such a way that they can be interpreted either as a set of multiple regression equations where the variables on rows are regressed on variables on columns or 4 AVE as covariance matrices. Matrix Order Description S kxk Covariance matrix of the observed variables. W lxk Outer weight matrix. Returned by outer estimator. E lxl Inner weight matrix. Returned by inner estimator. C lxl Covariance matrix of the composites formed by combining the observed variables into weighted composites using the weight matrix W. Calculated as W %*% S %*% t(W). IC lxk Covariance matrix between composites and indicators. Calculated as W %*% S after outer estimation or as IC <- E %*% W %*% S after inner estimation. Where k is the number of observed variables and l is the number of composites. References Wold, H. (1982). Soft modeling - The Basic Design And Some Extensions. In K. G. Jöreskog & S. Wold (Eds.),Systems under indirect observation: causality, structure, prediction (pp. 1–54). Amsterdam: North-Holland. Dijkstra, T. K. (1983). Some comments on maximum likelihood and partial least squares methods. Journal of Econometrics, 22(1-2), 67–90. Lohmöller, J. B. (1989). Latent variable path modeling with partial least squares. Physica-Verlag. Hwang, H., & Takane, Y. (2004). Generalized structured component analysis. Psychometrika, 69(1), 81–99. doi:10.1007/BF02295841 Rönkkö, M., & Evermann, J. (2013). A Critical Examination of Common Beliefs About Partial Least Squares Path Modeling. Organizational Research Methods, 16(3), 425–448. doi:10.1177/1094428112474693 See Also plspm, sempls, sim AVE Average Variance Extracted indices for matrixpls results Description The matrixpls method for the generic function AVE computes Average Variance Extracted indices for the model using the formula presented by Fornell and Larcker (1981). convCheck.absolute 5 Usage AVE(object, ...) Arguments object matrixpls estimation result object produced by the matrixpls function. ... All other arguments are ignored. Value A list containing the Average Variance Extracted indices in the first position and the differences between AVEs and largest squared correlations with other composites in the second position. References Fornell, C., & Larcker, D. F. (1981). Evaluating structural equation models with unobservable variables and measurement error. Journal of marketing research, 18(1), 39–50. See Also Other post-estimation functions: CR; GoF; R2; effects.matrixpls; loadings; predict.matrixpls; residuals.matrixpls convCheck.absolute Absolute difference convergence check criterion Description Compares two weight matrices and returns the value of the absolute difference convergence criterion. Usage convCheck.absolute(Wnew, Wold) Arguments Wnew Current weight matrix Wold Weight matrix from the previous iteration Details Absolute difference convergence criterion is the maximum of absolute differences between weights from two iterations Value Scalar value of the convergence criterion 6 convCheck.square See Also Other Convergence checks: convCheck.relative; convCheck.square convCheck.relative Relative difference convergence check criterion Description Compares two weight matrices and returns the value of the relative difference convergence criterion. Usage convCheck.relative(Wnew, Wold) Arguments Wnew Current weight matrix Wold Weight matrix from the previous iteration Details Relative difference convergence criterion is the maximum of relative differences between weights from two iterations Value Scalar value of the convergence criterion See Also Other Convergence checks: convCheck.absolute; convCheck.square convCheck.square Squared difference convergence check criterion Description Compares two weight matrices and returns the value of the square difference convergence criterion. Usage convCheck.square(Wnew, Wold) CR 7 Arguments Wnew Current weight matrix Wold Weight matrix from the previous iteration Details Squared difference convergence criterion is the maximum of squared absolute differences between weights from two iterations Value Scalar value of the convergence criterion See Also Other Convergence checks: convCheck.absolute; convCheck.relative CR Composite Reliability indices for matrixpls results Description The matrixpls method for the generic function CR computes Composite Reliability indices for the model using the formula presented by Fornell and Larcker (1981). Usage CR(object, ...) Arguments object matrixpls estimation result object produced by the matrixpls function. ... All other arguments are ignored. Value A named numeric vector containing the Composite Reliability indices. References Fornell, C., & Larcker, D. F. (1981). Evaluating structural equation models with unobservable variables and measurement error. Journal of marketing research, 18(1), 39–50. See Also Other post-estimation functions: AVE; GoF; R2; effects.matrixpls; loadings; predict.matrixpls; residuals.matrixpls 8 fitSummary effects.matrixpls Total, Direct, and Indirect Effects for matrixpls results Description The matrixpls method for the standard generic function effects computes total, direct, and indirect effects for a matrixpls results according to the method described in Fox (1980). Adapted from the effects function of the sem package Usage ## S3 method for class 'matrixpls' effects(object, ...) Arguments object matrixpls estimation result object produced by the matrixpls function. ... All other arguments are ignored. Value A list with Total, Direct, and Indirect elements. References Fox, J. (1980) Effect analysis in structural equation models: Extensions and simplified methods of computation. Sociological Methods and Research 9, 3–28. See Also Other post-estimation functions: AVE; CR; GoF; R2; loadings; predict.matrixpls; residuals.matrixpls fitSummary Summary of model fit of PLS model Description fitSummary computes a list of statistics that are commonly used to access the overall fit of the PLS model. Usage fitSummary(object) GoF 9 Arguments object PLS estimation result object produced by the matrixpls function. Value A list containing a selection of fit indices. GoF Goodness of Fit indices for matrixpls results Description The matrixpls method for the generic function GoF computes the Goodness of Fit index for matrixpls results. Usage GoF(object, ...) Arguments object matrixpls estimation result object produced by the matrixpls function. ... All other arguments are ignored. Value A list with Total, Direct, and Indirect elements. References Henseler, J., & Sarstedt, M. (2013). Goodness-of-fit indices for partial least squares path modeling. Computational Statistics, 28(2), 565–580. doi:10.1007/s00180-012-0317-1 See Also Other post-estimation functions: AVE; CR; R2; effects.matrixpls; loadings; predict.matrixpls; residuals.matrixpls 10 inner.centroid inner.centroid PLS inner estimation with the centroid scheme Description Calculates a set of inner weights based on the centroid scheme. Usage inner.centroid(S, W, inner.mod, ignoreInnerModel = FALSE, ...) Arguments S Covariance matrix of the data. W Weight matrix, where the indicators are on colums and composites are on the rows. inner.mod A square matrix specifying the relationships of the composites in the model. ignoreInnerModel Should the inner model be ignored and all correlations be used. ... Other parameters are ignored Details In the centroid scheme, inner weights are set to the signs (1 or -1) of correlations between composites that are connected in the model specified in inner.mod and zero otherwise. Falls back to to identity scheme for composites that are not connected to any other composites. Value A matrix of unscaled inner weights E with the same dimesions as inner.mod. References Lohmöller J.-B. (1989) Latent variable path modeling with partial least squares. Heidelberg: Physica-Verlag. See Also Other inner estimators: inner.GSCA; inner.Horst; inner.factor; inner.identity; inner.path inner.factor inner.factor 11 PLS inner estimation with the factor scheme Description Calculates a set of inner weights based on the factor scheme. Usage inner.factor(S, W, inner.mod, ignoreInnerModel = FALSE, ...) Arguments S Covariance matrix of the data. W Weight matrix, where the indicators are on colums and composites are on the rows. inner.mod A square matrix specifying the relationships of the composites in the model. ignoreInnerModel Should the inner model be ignored and all correlations be used. ... Other parameters are ignored Details In the factor scheme, inner weights are set to the correlations between composites that are connected in the model specified in inner.mod and zero otherwise. Falls back to to identity scheme for composites that are not connected to any other composites. Value A matrix of unscaled inner weights E with the same dimesions as inner.mod. References Lohmöller J.-B. (1989) Latent variable path modeling with partial least squares. Heidelberg: Physica-Verlag. See Also Other inner estimators: inner.GSCA; inner.Horst; inner.centroid; inner.identity; inner.path 12 inner.GSCA inner.GSCA GSCA inner estimation Description First step of the GSCA algorithm Usage inner.GSCA(S, W, inner.mod, ...) Arguments S Covariance matrix of the data. W Weight matrix, where the indicators are on colums and composites are on the rows. inner.mod A square matrix specifying the relationships of the composites in the model. ... Other parameters are ignored Details The two step GSCA algorithm is designed to minimize. SS(ZV-ZWA) The parameter matrix A contains all model parameters including inner, reflective inner, and formative. The weight matrices V and W, which can contain duplicate elements, contain the indicator weights. The first step of GSCA estimation method is calculation of regressions coefficients A given weights W and V. The function inner.GSCA update the part of A corresponding to regressions between the composites, corresponding to E matrix in matrixpls. The regressions between composites and indicators are estimated in outer.GSCA. This algorithm for estimating the relationships between the composites is therefore identical to the PLS path weighting scheme with the exception that correlations are not used for inverse relationships and there is no falling back to identity scheme for composites that are not connected to other composites The second step of GSCA is calculating a new set of weights conditional on the regression coeffcients A to minimize the sum of error terms in the regressions. This step is implemented in outer.GSCA after updating the regresions between indicators and composites. The implementation of GSCA in matrixpls differs from the Hwang & Takane (2004) version in that during the first step, only regressions between composites are estimated. The regressions between composites and indicators are estimated by the second stage the indicators and compositess. Since these covariances need to be calculated in the second step, it is more efficient to not calculate them during the first step. The matrixpls implementation of the GSCA algorithm extends the criterion presented by Hwang and Takane (2004) by including also the minimization of the residual variances of the formative part of the model. The formative regressions in a model are typically specified to be identical to the weight pattern W.mod resulting zero residual variances by definition. However, it is possible inner.GSCA 13 to specify a formative model that does not completely overlap with the weight pattern leading to non-zero residuals that can be optimized. Value A matrix of unscaled inner weights E with the same dimesions as inner.mod. References Hwang, H., & Takane, Y. (2004). Generalized structured component analysis. Psychometrika, 69(1), 81–99. doi:10.1007/BF02295841 See Also Other GSCA functions: optim.GSCA; outer.GSCA Other inner estimators: inner.Horst; inner.centroid; inner.factor; inner.identity; inner.path Examples # Run the example from ASGSCA package using GSCA estimation if(require(ASGSCA)) { # Run the GSCA example from the ASGSCA package #Scenario (g) in Romdhani et al. (2014): 4 SNPs mapped to 2 genes and 4 #traits involved in 2 clinical pathways #In total: 8 observed variables and 4 latent variables. #One of the traits is involved in both clinical pathways. #One gene is connected to one of the clinical pathways and #the other to both of them. data(GenPhen) W0 <- matrix(c(rep(1,2),rep(0,8),rep(1,2),rep(0,8),rep(1,3),rep(0,7),rep(1,2)),nrow=8,ncol=4) B0 <- matrix(c(rep(0,8),rep(1,2),rep(0,3),1,rep(0,2)),nrow=4,ncol=4) #Estimation only GSCA.res <- GSCA(GenPhen,W0, B0,estim=TRUE,path.test=FALSE, latent.names=c("Gene1","Gene2","Clinical pathway 1","Clinical pathway 2")) # Setup matrixpls to estimate the same model. Note GSCA places dependent variables # on columns but matrixpls uses rows for dependent variables inner <- t(B0) reflective <- matrix(0,8,4) formative <- t(W0) colnames(formative) <- rownames(reflective) <- names(GenPhen) colnames(inner) <- rownames(inner) <- rownames(formative) <- colnames(reflective) <c("Gene1","Gene2","Clinical pathway 1","Clinical pathway 2") model <- list(inner = inner, 14 inner.GSCA reflective = reflective, formative = formative) # Estimate using alternating least squares matrixpls.res1 <- matrixpls(cov(GenPhen), model, outerEstimators = outer.GSCA, innerEstimator = inner.GSCA, tol = 0.000000000001) print("Comparing alternating least squares estimates to original estimats") # Compare thw weights print(GSCA.res$Weight) print(t(attr(matrixpls.res1,"W"))) print(GSCA.res$Weight - t(attr(matrixpls.res1,"W"))) # Compare the paths print(GSCA.res$Path) print(t(attr(matrixpls.res1,"beta"))) print(GSCA.res$Path-t(attr(matrixpls.res1,"beta"))) # Estimate using direct minimization of the estimation criterion matrixpls.res2 <- matrixpls(cov(GenPhen), model, weightFunction = weight.optim, optimCriterion = optim.GSCA) print("Comparing numeric minimization estimates to original estimats") # Compare thw weights print(GSCA.res$Weight) print(t(attr(matrixpls.res2,"W"))) print(GSCA.res$Weight - t(attr(matrixpls.res2,"W"))) # Compare the paths print(GSCA.res$Path) print(t(attr(matrixpls.res2,"beta"))) print(GSCA.res$Path-t(attr(matrixpls.res2,"beta"))) # Check the criterion function values print(optim.GSCA(matrixpls.res1)) print(optim.GSCA(matrixpls.res2)) } else{ print("This example requires the ASGSCA package") } inner.Horst inner.Horst 15 PLS inner estimation with the Horst scheme Description Calculates a set of inner weights based on the Horst scheme. Usage inner.Horst(S, W, inner.mod, ignoreInnerModel = FALSE, ...) Arguments S Covariance matrix of the data. W Weight matrix, where the indicators are on colums and composites are on the rows. inner.mod A square matrix specifying the relationships of the composites in the model. ignoreInnerModel Should the inner model be ignored and all correlations be used. ... Other parameters are ignored Details In the Hosrt scheme, inner weights are unit weights for composites that are connected in the model specified in inner.mod and zero otherwise. Falls back to to identity scheme for composites that are not connected to any other composites. Value A matrix of unscaled inner weights E with the same dimesions as inner.mod. References Tenenhaus, A., & Tenenhaus, M. (2011). Regularized Generalized Canonical Correlation Analysis. Psychometrika, 76(2), 257–284. doi:10.1007/s11336-011-9206-8 See Also Other inner estimators: inner.GSCA; inner.centroid; inner.factor; inner.identity; inner.path 16 inner.identity inner.identity PLS inner estimation with the identity scheme Description Returns a set of inner weights using the identity scheme. Usage inner.identity(S, W, inner.mod, ...) Arguments S Covariance matrix of the data. W Weight matrix, where the indicators are on colums and composites are on the rows. inner.mod A square matrix specifying the relationships of the composites in the model. ... Other parameters are ignored Details This scheme is not commonly discussed in the current PLS literature, but it is a special case that is analyzed in the early PLS literature and currently implemented in at least the WarpPLS software. In the identity scheme identity matrix is used as the inner weight matrix E. The identity scheme with Mode A outer estimation converges toward the first principal component of each indicator block. Value A matrix of unscaled inner weights E with the same dimesions as inner.mod. References Wold, H. (1966). Nonlinear estimation by iterative least squares procedures. Research Papers in Statistics: Festschrift for J. Neyman, 411–444. Wold, H. (1982). Soft modeling - The Basic Design And Some Extensions. In K. G. Jöreskog & S. Wold (Eds.), Systems under indirect observation: causality, structure, prediction (pp. 1–54). Amsterdam: North-Holland. See Also Other inner estimators: inner.GSCA; inner.Horst; inner.centroid; inner.factor; inner.path inner.path inner.path 17 PLS inner estimation with the path scheme Description Calculates a set of inner weights based on the path scheme. Usage inner.path(S, W, inner.mod, ...) Arguments S Covariance matrix of the data. W Weight matrix, where the indicators are on colums and composites are on the rows. inner.mod A square matrix specifying the relationships of the composites in the model. ... Other parameters are ignored Details In the path scheme, inner weights are based on regression estimates of the relationships between composites that are connected in the model specified in inner.mod, and correlations for the inverse relationships. If a relationship is reciprocal, regression is used for both directions. Falls back to to identity scheme for composites that are not connected to any other composites. References Lohmöller J.-B. (1989) Latent variable path modeling with partial least squares. Heidelberg: Physica-Verlag. See Also Other inner estimators: inner.GSCA; inner.Horst; inner.centroid; inner.factor; inner.identity 18 matrixpls loadings Factor loadings matrix from matrixpls results Description The matrixpls method for the generic function loadings computes standardized factor loading matrix from the model results. Usage loadings(x, ...) Arguments x An object of class matrixpls ... All other arguments are ignored. Value A matrix of factor loadings. See Also Other post-estimation functions: AVE; CR; GoF; R2; effects.matrixpls; predict.matrixpls; residuals.matrixpls matrixpls Partial Least Squares and other composite variable models. Description Estimates a weight matrix using Partial Least Squares or a related algorithm and then uses the weights to estimate the parameters of a statistical model. Usage matrixpls(S, model, W.mod = NULL, weightFunction = weight.pls, parameterEstimator = params.regression, ..., validateInput = TRUE, standardize = TRUE) matrixpls 19 Arguments S Covariance matrix of the data. model There are two options for this argument: 1. lavaan script or lavaan parameter table, or 2. a list containing three matrices inner, reflective, and formative defining the free regression paths in the model. W.mod An optional numeric matrix representing the weight patter and starting weights (i.e. the how the indicators are combined to form the composite variables). If this argument is not specified, the weight patter is defined based on the relationships in the reflective and formative elements of model. weightFunction A function that takes three or more arguments, the data covariance matrix S, a model specification model, and a weight pattern W.mod and returns a named vector of parameter estimates. The default is weight.pls parameterEstimator A function that takes three or more arguments, the data covariance matrix S, model specification model, and weights W and returns a named vector of parameter estimates. The default is params.regression ... All other arguments are passed through to weightFunction and parameterEstimator. validateInput A boolean indicating whether the arguments should be validated. standardize TRUE (default) or FALSE indicating whether S should be converted to a correlation matrix. Details matrixpls is the main function of the matrixpls package. This function parses a model object and then uses the results to call weightFunction to to calculate indicator weight. After this the parameterEstimator function is applied to the indicator weights, the data covariance matrix, and the model object and the resulting parameter estimates are returned. Model can be specified in the lavaan format or the native matrixpls format. The native model format is a list of three binary matrices, inner, reflective, and formative specifying the free parameters of a model: inner (l x l) specifies the regressions between composites, reflective (k x l) specifies the regressions of observed data on composites, and formative (l x k) specifies the regressions of composites on the observed data. Here k is the number of observed variables and l is the number of composites. If the model is specified in lavaan format, the native format model is derived from this model by assigning all regressions between latent variables to inner, all factor loadings to reflective, and all regressions of latent variables on observed variables to formative. Regressions between observed variables and all free covariances are ignored. All parameters that are specified in the model will be treated as free parameters. If model is specified in lavaan syntax, the model that is passed to the parameterEstimator will be that model and not the native format model. The original papers about Partial Least Squares, as well as many of the current PLS implementations, impose restrictions on the matrices inner, reflective, and formative: inner must be a lower triangular matrix, reflective must have exactly one non-zero value on each row and must have at least one non-zero value on each column, and formative must only contain zeros. Some PLS implementations allow formative to contain non-zero values, but impose a restriction that the sum of reflective and t(formative) must satisfy the original restrictions of reflective. The 20 matrixpls.boot only restrictions that matrixpls imposes on inner, reflective, and formative is that these must be binary matrices and that the diagonal of inner must be zeros. The argument W.mod is a (l x k) matrix that indicates how the indicators are combined to form the composites. The original papers about Partial Least Squares as well as all current PLS implementations define this as t(reflective) | formative, which means that the weight patter must match the model specified in reflective and formative. Matrixpls does not require that W.mod needs to match reflective and formative, but accepts any numeric matrix. If this argument is not specified, W.mod is defined as t(reflective) | formative. Value A named numeric vector of class matrixpls containing parameter estimates followed by weight. References Rosseel, Y. (2012). lavaan: An R Package for Structural Equation Modeling. Journal of Statistical Software, 48(2), 1–36. Retrieved from http://www.jstatsoft.org/v48/i02 Wold, H. (1982). Soft modeling - The Basic Design And Some Extensions. In K. G. Jöreskog & S. Wold (Eds.),Systems under indirect observation: causality, structure, prediction (pp. 1–54). Amsterdam: North-Holland. See Also Weight algorithms: weight.pls; weight.fixed; weight.optim Parameter estimators: params.regression; params.plsregression; params.plsc; params.tsls matrixpls.boot Bootstrapping of matrixpls function Description matrixpls.boot is a convenience method that implements bootstrapping of matrixpls with boot method of the boot package. Usage matrixpls.boot(data, R = 500, ..., signChangeCorrection = NULL, parallel = c("no", "multicore", "snow"), ncpus = getOption("boot.ncpus", 1L), stopOnError = FALSE) Arguments data Matrix or data frame containing the raw data. R Number of bootstrap samples to draw. ... All other parameters are passed through to matrixpls. matrixpls.plspm 21 signChangeCorrection Sign change correction function. parallel The type of parallel operation to be used (if any). If missing, the default is taken from the option "boot.parallel" (and if that is not set, "no"). ncpus integer: number of processes to be used in parallel operation: typically one would chose this to the number of available CPUs. stopOnError A logical indicating whether boostrapping should be continued when error occurs in a replication. Value An object of class boot. See Also boot Sign change corrections: signChange.individual; signChange.construct matrixpls.plspm A plspm compatibility wrapper for matrixpls Description matrixpls.plspm mimics plspm function of the plspm package. The arguments and their default values and the output of the function are identical with plspm function, but internally the function uses matrixpls estimation. Usage matrixpls.plspm(Data, path_matrix, blocks, modes = NULL, scheme = "centroid", scaled = TRUE, tol = 1e-06, maxiter = 100, boot.val = FALSE, br = NULL, dataset = TRUE) Arguments Data matrix or data frame containing the manifest variables. path_matrix A square (lower triangular) boolean matrix representing the inner model (i.e. the path relationships between latent variables). blocks list of vectors with column indices or column names from Data indicating the sets of manifest variables forming each block (i.e. which manifest variables correspond to each block). modes character vector indicating the type of measurement for each block. Possible values are: "A", "B", "newA", "PLScore", "PLScow". The length of modes must be equal to the length of blocks. scheme string indicating the type of inner weighting scheme. Possible values are "centroid", "factorial", or "path". 22 matrixpls.plspm scaled whether manifest variables should be standardized. Only used when scaling = NULL. When (TRUE, data is scaled to standardized values (mean=0 and variance=1). The variance is calculated dividing by N instead of N-1). tol decimal value indicating the tolerance criterion for the iterations (tol=0.000001). Can be specified between 0 and 0.001. maxiter integer indicating the maximum number of iterations (maxiter=100 by default). The minimum value of maxiter is 100. boot.val whether bootstrap validation should be performed. (FALSE by default). br number bootstrap resamples. Used only when boot.val=TRUE. When boot.val=TRUE, the default number of re-samples is 100, but it can be specified in a range from 100 to 1000. dataset whether the data matrix used in the computations should be retrieved (TRUE by default). Details The function matrixpls.plspm calculates indicator weights and estimates a model identically to the plspm function. In contrast to the matrixpls function that provides only weights and parameter estimates, this function also reports multiple post-estimation statistics. Because of this matrixpls.plspm is substantially less efficient than the matrixpls function. The argument path_matrix is a matrix of zeros and ones that indicates the structural relationships between composites. This must be a lower triangular matrix. path_matrix will contain a 1 when column j affects row i, 0 otherwise. Value An object of class plspm. References Sanchez, G. (2013). PLS Path Modeling with R. Retrieved from http://www.gastonsanchez.com/PLS Path Modeling with R.pdf See Also plspm Examples if(require(plspm) & packageVersion("plspm")>=0.4) { cores <- getOption("mc.cores") options(mc.cores=2) # Run the example from plspm package # load dataset satisfaction matrixpls.sempls 23 data(satisfaction) # inner model matrix IMAG = c(0,0,0,0,0,0) EXPE = c(1,0,0,0,0,0) QUAL = c(0,1,0,0,0,0) VAL = c(0,1,1,0,0,0) SAT = c(1,1,1,1,0,0) LOY = c(1,0,0,0,1,0) sat_inner = rbind(IMAG, EXPE, QUAL, VAL, SAT, LOY) # outer model list sat_outer = list(1:5, 6:10, 11:15, 16:19, 20:23, 24:27) # vector of modes (reflective indicators) sat_mod = rep("A", 6) # apply plspm plspm.res <- plspm(satisfaction, sat_inner, sat_outer, sat_mod, scaled=FALSE, boot.val=FALSE) # apply matrixpls matrixpls.res <- matrixpls.plspm(satisfaction, sat_inner, sat_outer, sat_mod, scaled=FALSE, boot.val=FALSE) # If RUnit is installed check that the results are identical if(is.element("RUnit", installed.packages()[,1])){ library(RUnit) checkEquals(plspm.res, matrixpls.res, tol = 0.001) } # print the resuls print(summary(plspm.res)) print(summary(matrixpls.res)) options(mc.cores=cores) } else{ print("This example requires the plspm package, version 0.4 or greater") } matrixpls.sempls A semPLS compatibility wrapper for matrixpls Description matrixpls.sempls mimics sempls function of the semPLS package. The arguments and their default values and the output of the function are identical with sempls function, but internally the function uses matrixpls estimation. 24 matrixpls.sempls Usage matrixpls.sempls(model, data, maxit = 20, tol = 1e-07, scaled = TRUE, sum1 = FALSE, wscheme = "centroid", pairwise = FALSE, method = c("pearson", "kendall", "spearman"), convCrit = c("relative", "square"), verbose = TRUE, ...) Arguments model An object inheriting from class plsm as returned from plsm or read.splsm. data A data.frame containing the observed variables (MVs). The storage mode for all the MVs included in the model must be numeric. maxit A numeric value, which determines the maximum number of iterations performed by the PLS algorithm. The default is 20 iterations. tol A numeric value, specifying the tolerance for the maximum relative differences in the outer weights. The default value is 10−7 . scaled A logical value indicating, whether the observed data shall be scaled to zero mean and unit variance. The default is TRUE. sum1 A logical value indicating, whether the outer weights foreach latent variable (LV) shall be standardized to sum up to one. The default is FALSE. Since the factor scores are scaled in each step of the PLS algorithm, changing this value to TRUE does not affect the results. wscheme A character naming the weighting scheme to use. Possible values are: • "A" or "centroid" for the centroid scheme, the default, • "B" or "factorial"for the factorial scheme and • "C", "pw" or "pathWeighting" for the path weighting scheme. pairwise A logical value indicating, whether correlations shall be calculated pairwise. If the observed data does not contain missing values, the results are not affected. The default is FALSE. For more details the R help, ?cor, can be consulted. method A character naming the method to calculate the correlations. Possible values are: • "pearson" , the default, • "kendall", • "spearman". For more details on the method, the R help, ?cor, can be consulted. Note, that despite of the method argument, pearson correlations are always used for the inner approximation (step 2). convCrit The convergence criteria to use: • "relative", the default, • "square". verbose Logical: If FALSE no status messages are printed. ... Other arguments are ignored matrixpls.sempls 25 Value An object of class sempls. References Monecke, A., & Leisch, F. (2012). semPLS: Structural Equation Modeling Using Partial Least Squares. Journal of Statistical Software, 48(3), 1–32. See Also sempls Examples if(require(semPLS)){ data(ECSImobi) ecsi.sempls <- sempls(model=ECSImobi, data=mobi, wscheme="pathWeighting") ecsi <- matrixpls.sempls(model=ECSImobi, data=mobi, wscheme="pathWeighting") # If RUnit is installed check that the results are identical if(require(RUnit)){ checkEquals(ecsi.sempls,ecsi, check.attributes = FALSE) } ecsi ## create plots densityplot(ecsi) densityplot(ecsi, use="prediction") densityplot(ecsi, use="residuals") ## Values of 'sempls' objects names(ecsi) ecsi$outer_weights ecsi$outer_loadings ecsi$path_coefficients ecsi$total_effects ### using convenience methods to sempls results ## path coefficients pathCoeff(ecsi) ## total effects totalEffects(ecsi) ## get loadings and check for discriminant validity (l <- plsLoadings(ecsi)) # outer loadings 26 matrixpls.sim print(l, type="outer", digits=2) # outer loadings greater than 0.5 print(l,type="outer", cutoff=0.5, digits=2) # cross loadings greater than 0.5 print(l, type="cross", cutoff=0.5, digits=2) ### R-squared rSquared(ecsi) } else{ print("This example requires the semPLS package") } matrixpls.sim Monte Carlo simulations with matrixpls Description Performs Monte Carlo simulations of matrixpls with the sim function of the simsem package. The standard errors and confidence intervals are estimated with the boot and boot.ci functions of the boot package. Usage matrixpls.sim(nRep = NULL, model = NULL, n = NULL, ..., cilevel = 0.95, citype = c("norm", "basic", "stud", "perc", "bca"), boot.R = 500, fitIndices = fitSummary, outfundata = NULL, outfun = NULL) Arguments nRep Number of replications. If any of the n, pmMCAR, or pmMAR arguments are specified as lists, the number of replications will default to the length of the list(s), and nRep need not be specified. model There are two options for this argument: 1. lavaan script or lavaan parameter table, or 2. a list containing three matrices inner, reflective, and formative defining the free regression paths in the model. n Sample size. Either a single value, or a list of values to vary sample size across replications. The n argument can also be specified as a random distribution object; if any resulting values are non-integers, the decimal will be rounded. ... All other arguments are passed through to sim, matrixpls.boot, or matrixpls. cilevel Confidence level. This argument will be forwarded to the boot.ci when calculating the confidence intervals. citype Type of confidence interval. This argument will be forwarded to the boot.ci when calculating the confidence intervals. boot.R Number of bootstrap replications to use to estimate standard errors or FALSE to disable bootstrapping. matrixpls.sim 27 fitIndices A function that returns a list of fit indices for the model. Setting this argument to NULL disables fit indices. outfundata A function to be applied to the matrixpls output and the generated data at each replication. Users can get the characteristics of the generated data and also compare the characteristics with the generated output. The output from this function in each replication will be saved in the simulation output (SimResult), and can be obtained using the getExtraOutput function. outfun A function to be applied to the matrixpls output at each replication. Output from this function in each replication will be saved in the simulation output (SimResult), Details This funtion calls the sim function from the simsem package to perform Monte Carlo simulations with matrixpls. The function parses the model parameters and replaces it with a function call that estimates the model and bootstrapped standard errors and confidence intervals with matrixpls.boot. If the generate or rawdata arguments are not specified in the sim arguments then the model argument will be used for data generation and must be specified in lavaan format. Value An object of class SimResult-class. See Also matrixpls, matrixpls.boot, sim, SimResult-class Examples # # # # # # Runs the second model from Aguirre-Urreta, M., & Marakas, G. (2013). Partial Least Squares and Models with Formatively Specified Endogenous Constructs: A Cautionary Note. Information Systems Research. doi:10.1287/isre.2013.0493 if(require(simsem)){ library(MASS) X <- diag(15) X[upper.tri(X, diag=TRUE)] <1.000, 0.640, 1.000, 0.640, 0.640, 1.000, 0.640, 0.640, 0.640, 1.000, 0.096, 0.096, 0.096, 0.096, 0.096, 0.096, 0.096, 0.096, 0.096, 0.096, 0.096, 0.096, c( 1.000, 0.640, 1.000, 0.640, 0.640, 1.000, 28 matrixpls.sim 0.096, 0.115, 0.115, 0.115, 1.000, 0.115, 0.640, 0.000, 0.325, 0.000, 0.325, 0.000, 0.325, 0.096, 0.115, 0.115, 0.115, 0.096, 0.115, 0.115, 0.115, 0.115, 1.000, 0.000, 0.325, 0.000, 0.325, 0.000, 0.325, 0.115, 0.115, 0.192, 0.192, 0.192, 0.192, 0.640, 0.640, 0.000, 1.000, 0.000, 0.300, 0.000, 0.300, 0.096, 0.115, 0.115, 0.115, 0.640, 0.192, 0.192, 0.192, 0.640, 0.192, 0.192, 0.192, 0.640, 0.192, 0.192, 0.192, 1.000, 0.192, 1.000, 0.192, 0.640, 1.000, 0.192, 0.640, 0.640, 0.000, 0.271, 0.271, 0.271, 0.271, 0.325, 0.325, 0.000, 0.271, 0.271, 0.271, 0.271, 0.325, 0.325, 1.000, 0.000, 0.271, 0.271, 0.271, 0.271, 0.325, 0.325, 0.300, 1.000 ) X <- X + t(X) - diag(diag(X)) colnames(X) <- rownames(X) <- c(paste("Y",1:12,sep=""),paste("X",1:3,sep="")) # Print the population covariance matrix X to see that it is correct X # The estimated model in Lavaan syntax analyzeModel <- " ksi =~ Y1 + Y2 + Y3 + Y4 eta1 <~ X1 + X2 + X3 eta2 =~ Y5 + Y6 + Y7 + Y8 eta3 =~ Y9 + Y10 + Y11 + Y12 eta1 ~ ksi eta2 ~ eta1 eta3 ~ eta1 " # Only run 100 replications without bootstrap replications each so that the # example runs faster. Generate the data outside simsem because simsem # does not support drawing samples from population matrix dataSets <- lapply(1:100, function(x){ mvrnorm(300, # Sample size rep(0,15), # Means X) # Population covarancematrix }) Output <- matrixpls.sim(model = analyzeModel, rawData = dataSets, boot.R=FALSE, multicore = FALSE, stopOnError = TRUE) summary(Output) } else{ print("This example requires the simsem package") optim.GCCA 29 } optim.GCCA GSCA optimization criterion Description GSCA optimization criterion Usage optim.GCCA(matrixpls.res, innerEstimator, ...) Arguments matrixpls.res An object of class matrixpls from which the criterion function is calculated innerEstimator A function used for inner estimation. Setting this argument to null will use identity matrix as inner estimates and causes the algorithm to converge after the first iteration. This is useful when using outer.fixedWeights or some other outer estimation function that does not use inner estimation results. The default is inner.path (PLS path weighting scheme). ... All other arguments are passed through to outerEstimators and innerEstimator. Details Optimization criterion for maximixing the weighted sum of composite correlations Value Sum of residual variances. References Tenenhaus, A., & Tenenhaus, M. (2011). Regularized Generalized Canonical Correlation Analysis. Psychometrika, 76(2), 257–284. doi:10.1007/s11336-011-9206-8 See Also Other Weight optimization criteria: optim.GSCA; optim.maximizeInnerR2; optim.maximizePrediction 30 optim.GSCA optim.GSCA GSCA optimization criterion Description GSCA optimization criterion Usage optim.GSCA(matrixpls.res) Arguments matrixpls.res An object of class matrixpls from which the criterion function is calculated Details Optimization criterion for minimizing the sum of all residual variances in the model. The matrixpls implementation of the GSCA criterion extends the criterion presented by Huang and Takane by including also the minimization of the residual variances of the formative part of the model. The formative regressions in a model are typically specified to be identical to the weight pattern W.mod resulting zero residual variances by definition. However, it is possible to specify a formative model that does not completely overlap with the weight pattern leading to non-zero residuals that can be optimizes. Value Sum of residual variances. References Hwang, H., & Takane, Y. (2004). Generalized structured component analysis. Psychometrika, 69(1), 81–99. doi:10.1007/BF02295841 See Also Other GSCA functions: inner.GSCA; outer.GSCA Other Weight optimization criteria: optim.GCCA; optim.maximizeInnerR2; optim.maximizePrediction optim.maximizeInnerR2 31 optim.maximizeInnerR2 Optimization criterion to maximize the inner model mean R2 Description Optimization criterion to maximize the inner model mean R2 Usage optim.maximizeInnerR2(matrixpls.res) Arguments matrixpls.res An object of class matrixpls from which the criterion function is calculated Value Negative mean R2. See Also Other Weight optimization criteria: optim.GCCA; optim.GSCA; optim.maximizePrediction optim.maximizePrediction Optimization criterion for maximal prediction Description Optimization criterion for maximal prediction Usage optim.maximizePrediction(matrixpls.res) Arguments matrixpls.res An object of class matrixpls from which the criterion function is calculated Details Calculates the predicted variances of reflective indicators. The prediction criterion is negative of the sum of predicted variances. Value Mean squared prediction error. 32 outer.factor See Also Other Weight optimization criteria: optim.GCCA; optim.GSCA; optim.maximizeInnerR2 outer.factor Blockwise factor score outer estimation Description Calculates outer weights by estimating a common factor analysis model with a single factor for each indicator block and using the resulting estimates to calculate factor score weights Usage outer.factor(S, W, E, W.mod, fm = "minres", ...) Arguments S Covariance matrix of the data. W Weight matrix, where the indicators are on colums and composites are on the rows. E Inner weight matrix. A square matrix of inner estimates between the composites. W.mod A matrix specifying the weight relationships and their starting values. fm factoring method for estimating the common factor model. Possible values are minres, wls, gls, pa, and ml. The parameter is passed through to to fa. ... Other parameters are ignored Value A matrix of unscaled outer weights W with the same dimesions as W.mod. See Also Other outer estimators: outer.GSCA; outer.RGCCA; outer.fixedWeights; outer.modeA; outer.modeB outer.fixedWeights 33 outer.fixedWeights PLS outer estimation with fixed weights Description Returns the starting weights as outer estimates. Usage outer.fixedWeights(S, W, E, W.mod, ...) Arguments S Covariance matrix of the data. W Weight matrix, where the indicators are on colums and composites are on the rows. E Inner weight matrix. A square matrix of inner estimates between the composites. W.mod A matrix specifying the weight relationships and their starting values. ... Other parameters are ignored Value A matrix of unscaled outer weights W with the same dimesions as W.mod. See Also Other outer estimators: outer.GSCA; outer.RGCCA; outer.factor; outer.modeA; outer.modeB outer.GSCA GSCA outer estimation Description This implements the second step of the GSCA algorithm. Usage outer.GSCA(S, W, E, W.mod, model, ...) 34 outer.GSCA Arguments S Covariance matrix of the data. W Weight matrix, where the indicators are on colums and composites are on the rows. E Inner weight matrix. A square matrix of inner estimates between the composites. W.mod A matrix specifying the weight relationships and their starting values. model A matrixpls model. See matrixpls for details ... Other parameters are ignored Details The two step GSCA algorithm is designed to minimize. SS(ZV-ZWA) The parameter matrix A contains all model parameters including inner, reflective inner, and formative. The weight matrices V and W, which can contain duplicate elements, contain the indicator weights. The first step of GSCA estimation method is calculation of regressions coefficients A given weights W and V. The function inner.GSCA update the part of A corresponding to regressions between the composites, corresponding to E matrix in matrixpls. The regressions between composites and indicators are estimated in outer.GSCA. This algorithm for estimating the relationships between the composites is therefore identical to the PLS path weighting scheme with the exception that correlations are not used for inverse relationships and there is no falling back to identity scheme for composites that are not connected to other composites The second step of GSCA is calculating a new set of weights conditional on the regression coeffcients A to minimize the sum of error terms in the regressions. This step is implemented in outer.GSCA after updating the regresions between indicators and composites. The implementation of GSCA in matrixpls differs from the Hwang & Takane (2004) version in that during the first step, only regressions between composites are estimated. The regressions between composites and indicators are estimated by the second stage the indicators and compositess. Since these covariances need to be calculated in the second step, it is more efficient to not calculate them during the first step. The matrixpls implementation of the GSCA algorithm extends the criterion presented by Hwang and Takane (2004) by including also the minimization of the residual variances of the formative part of the model. The formative regressions in a model are typically specified to be identical to the weight pattern W.mod resulting zero residual variances by definition. However, it is possible to specify a formative model that does not completely overlap with the weight pattern leading to non-zero residuals that can be optimized. Value A matrix of unscaled outer weights W with the same dimesions as W.mod. References Hwang, H., & Takane, Y. (2004). Generalized structured component analysis. Psychometrika, 69(1), 81–99. doi:10.1007/BF02295841 outer.GSCA 35 See Also Other GSCA functions: inner.GSCA; optim.GSCA Other outer estimators: outer.RGCCA; outer.factor; outer.fixedWeights; outer.modeA; outer.modeB Examples # Run the example from ASGSCA package using GSCA estimation if(require(ASGSCA)) { # Run the GSCA example from the ASGSCA package #Scenario (g) in Romdhani et al. (2014): 4 SNPs mapped to 2 genes and 4 #traits involved in 2 clinical pathways #In total: 8 observed variables and 4 latent variables. #One of the traits is involved in both clinical pathways. #One gene is connected to one of the clinical pathways and #the other to both of them. data(GenPhen) W0 <- matrix(c(rep(1,2),rep(0,8),rep(1,2),rep(0,8),rep(1,3),rep(0,7),rep(1,2)),nrow=8,ncol=4) B0 <- matrix(c(rep(0,8),rep(1,2),rep(0,3),1,rep(0,2)),nrow=4,ncol=4) #Estimation only GSCA.res <- GSCA(GenPhen,W0, B0,estim=TRUE,path.test=FALSE, latent.names=c("Gene1","Gene2","Clinical pathway 1","Clinical pathway 2")) # Setup matrixpls to estimate the same model. Note GSCA places dependent variables # on columns but matrixpls uses rows for dependent variables inner <- t(B0) reflective <- matrix(0,8,4) formative <- t(W0) colnames(formative) <- rownames(reflective) <- names(GenPhen) colnames(inner) <- rownames(inner) <- rownames(formative) <- colnames(reflective) <c("Gene1","Gene2","Clinical pathway 1","Clinical pathway 2") model <- list(inner = inner, reflective = reflective, formative = formative) # Estimate using alternating least squares matrixpls.res1 <- matrixpls(cov(GenPhen), model, outerEstimators = outer.GSCA, innerEstimator = inner.GSCA, tol = 0.000000000001) print("Comparing alternating least squares estimates to original estimats") # Compare thw weights print(GSCA.res$Weight) 36 outer.modeA print(t(attr(matrixpls.res1,"W"))) print(GSCA.res$Weight - t(attr(matrixpls.res1,"W"))) # Compare the paths print(GSCA.res$Path) print(t(attr(matrixpls.res1,"beta"))) print(GSCA.res$Path-t(attr(matrixpls.res1,"beta"))) # Estimate using direct minimization of the estimation criterion matrixpls.res2 <- matrixpls(cov(GenPhen), model, weightFunction = weight.optim, optimCriterion = optim.GSCA) print("Comparing numeric minimization estimates to original estimats") # Compare thw weights print(GSCA.res$Weight) print(t(attr(matrixpls.res2,"W"))) print(GSCA.res$Weight - t(attr(matrixpls.res2,"W"))) # Compare the paths print(GSCA.res$Path) print(t(attr(matrixpls.res2,"beta"))) print(GSCA.res$Path-t(attr(matrixpls.res2,"beta"))) # Check the criterion function values print(optim.GSCA(matrixpls.res1)) print(optim.GSCA(matrixpls.res2)) } else{ print("This example requires the ASGSCA package") } outer.modeA PLS outer estimation with Mode A Description Performs Mode A outer estimation by calculating correlation matrix between the indicators and composites. outer.modeB 37 Usage outer.modeA(S, W, E, W.mod, ...) Arguments S W E W.mod ... Covariance matrix of the data. Weight matrix, where the indicators are on colums and composites are on the rows. Inner weight matrix. A square matrix of inner estimates between the composites. A matrix specifying the weight relationships and their starting values. Other parameters are ignored Value A matrix of unscaled outer weights W with the same dimesions as W.mod. See Also Other outer estimators: outer.GSCA; outer.RGCCA; outer.factor; outer.fixedWeights; outer.modeB outer.modeB PLS outer estimation with Mode B Description Performs Mode B outer estimation by regressing the composites on the observed variables. Usage outer.modeB(S, W, E, W.mod, ...) Arguments S W E W.mod ... Covariance matrix of the data. Weight matrix, where the indicators are on colums and composites are on the rows. Inner weight matrix. A square matrix of inner estimates between the composites. A matrix specifying the weight relationships and their starting values. Other parameters are ignored Value A matrix of unscaled outer weights W with the same dimesions as W.mod. See Also Other outer estimators: outer.GSCA; outer.RGCCA; outer.factor; outer.fixedWeights; outer.modeA 38 outer.RGCCA outer.RGCCA RGCCA outer estimation (Experimental) Description Implements the second step of the RGCCA estimation describe by Tenenhaus & Tenehaus (2011) Usage outer.RGCCA(S, W, E, W.mod, ..., tau = 1) Arguments S Covariance matrix of the data. W Weight matrix, where the indicators are on colums and composites are on the rows. E Inner weight matrix. A square matrix of inner estimates between the composites. W.mod A matrix specifying the weight relationships and their starting values. ... Other parameters are ignored tau The shrinkage parameter (0-1) Details The second step of RGCCA estimation method, as describe by Tenenhaus & Tenehaus (2011) Value A matrix of unscaled outer weights W with the same dimesions as W.mod. References Tenenhaus, A., & Tenenhaus, M. (2011). Regularized Generalized Canonical Correlation Analysis. Psychometrika, 76(2), 257–284. doi:10.1007/s11336-011-9206-8 See Also Other outer estimators: outer.GSCA; outer.factor; outer.fixedWeights; outer.modeA; outer.modeB Examples # Runs the example from the rgcca function of the RGCCA package if(require(RGCCA) & require(Matrix)) { data(Russett) X_agric =as.matrix(Russett[,c("gini","farm","rent")]) X_ind = as.matrix(Russett[,c("gnpr","labo")]) params.plsc 39 X_polit = as.matrix(Russett[ , c("demostab", "dictatur")]) A = list(X_agric, X_ind, X_polit) #Define the design matrix (output = C) C = matrix(c(0, 0, 1, 0, 0, 1, 1, 1, 0), 3, 3) tau <- 0 result.rgcca = rgcca(A, C, tau =rep(tau,3), scheme = "factorial", scale = TRUE) W.rgcca <- as.matrix(bdiag(lapply(result.rgcca$a, function(x){matrix(x,nrow=1)}))) # Do the same with matrixpls W.mod <- (W.rgcca != 0) *1 S <- cov(do.call(cbind,A)) W.matrixpls <- weight.pls(S, list(inner = C, reflective = t(W.mod), formative = matrix(0,nrow(W.mod), ncol(W.mod))), W.mod = W.mod, innerEstimator = inner.factor, outerEstimators = outer.RGCCA, tau = tau) print(W.rgcca) print(W.matrixpls) } # Do we get perfect correlations for the composites cor(do.call(cbind,result.rgcca$Y), do.call(cbind,A) %*% t(W.matrixpls)) params.plsc Parameter estimation with an adaptation of PLSc algorithm Description Estimates the model parameters with an adapted version of Dijkstra’s (2011) PLSc. The parameters between latent variables are estimated using two-stages least squares estimation using a composite covariance matrix that has been disattenuated with estimated composite reliabilities. Usage params.plsc(S, model, W, fm = "dijkstra", tsls = FALSE, ...) Arguments S Covariance matrix of the data. model There are two options for this argument: 1. lavaan script or lavaan parameter table, or 2. a list containing three matrices inner, reflective, and formative defining the free regression paths in the model. 40 params.plsc W Weight matrix, where the indicators are on colums and composites are on the rows. fm factoring method for estimating the corrected factor loadings. "dijkstra" will use the correction presented by Dijkstra (2011), where the PLS estimates of the factor loadings for a latent variable are multiplied with a scalar a, which is calculated by a simple formula that approximately minimizes squared residual covariances of the factor model. minres, wls, gls, pa, and ml will use a factor analysis and passing this parameter through to fa. "cfa" estimates a maximum likelihood confirmatory factor analysis with lavaan tsls Should estimation be done with two stage least squares instead of regression ... All other arguments are passed through to weightFunction and parameterEstimator. Details params.plsc estimates the statistical model described by model with the following steps. If model is not in the native format, it is converted to the native format containing matrices inner, reflective, and formative. The weights W and the data covariance matrix S are used to calculate the composite covariance matrix C and the indicator-composite covariance matrix IC. C is then disattenuated. The reliability estimates used in the dissattenuation process are calculated by using Dijkstra’s (2011) correction or with a separate factor analysis for each indicator block. Indicators that are used in a composite but are not specified as reflective indicators for the latent variable that the composite approximates are assumed to be perfectly reliable. The disattenuated C is used to estimate the the inner part of the model with separate OLS regressions in the same way as in params.regression. This differs from Dijkstra’s (2011) PLSc estimator that uses 2SLS. The reason for not using 2SLS is that PLS is commonly used with models that do not contain a sufficient number of exogenous variables that could be used as instruments in the 2SLS estimation. The results from the disattenuation process are used as estimates of the reflective part of the model and the formative part of the model estimated with separate OLS regressions using the S and IC matrices. Those elements of teh indicator-composite covariance matrix IC that correspond to factor loadings are replaced with the factor loading estimates. The dissattenuation code for Dijkstra’s method is adapted from Huang (2013), which is based on Dijkstra (2011). Value A named vector of parameter estimates. Author(s) Mikko Rönkkö, Wenjing Huang, Theo Dijkstra References Huang, W. (2013). PLSe: Efficient Estimators and Tests for Partial Least Squares (Doctoral dissertation). University of California, Los Angeles. Dijkstra, T. K. (2011). Consistent Partial Least params.plsc 41 Squares estimators for linear and polynomial factor models. A report of a belated, serious and not even unsuccessful attempt. Comments are invited. Retrieved from http://www.rug.nl/staff/t.k.dijkstra/consistentpls-estimators.pdf See Also Other parameter estimators: params.plsregression; params.regression; params.tsls Examples library(plspm) # Run the customer satisfaction examle form plspm # load dataset satisfaction data(satisfaction) # inner model matrix IMAG = c(0,0,0,0,0,0) EXPE = c(1,0,0,0,0,0) QUAL = c(0,1,0,0,0,0) VAL = c(0,1,1,0,0,0) SAT = c(1,1,1,1,0,0) LOY = c(1,0,0,0,1,0) inner = rbind(IMAG, EXPE, QUAL, VAL, SAT, LOY) colnames(inner) <- rownames(inner) # Reflective model list(1:5, 6:10, 11:15, 16:19, 20:23, 24:27) reflective<- matrix( c(1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27,6, dimnames = list(colnames(satisfaction)[1:27],colnames(inner))) 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1), # empty formative model formative <- matrix(0, 6, 27, dimnames = list(colnames(inner), colnames(satisfaction)[1:27])) # Estimation using covariance matrix matrixpls.out <- matrixpls(cov(satisfaction[,1:27]), model = list(inner = inner, reflective = reflective, formative = formative), parameterEstimator = params.plsc) summary(matrixpls.out) 42 params.plsregression params.plsregression Parameter estimation with PLS regression Description Estimates the model parameters with weighted composites using separate OLS regressions for outer model and separate PLS regressions for inner model. Usage params.plsregression(S, W, model) Arguments S Covariance matrix of the data. W Weight matrix, where the indicators are on colums and composites are on the rows. model There are two options for this argument: 1. lavaan script or lavaan parameter table, or 2. a list containing three matrices inner, reflective, and formative defining the free regression paths in the model. Details params.plsregression estimates the model parameters similarly to params.regression with the exception that instead of separate OLS regressions the inner part of the model is estimated with separate PLS regressions using the PLS1 algorithm with two rounds of estimation. The implementation of PLS regression is ported from the raw data version implemented in get_plsr1 funtion of the plspm package. Value A named vector of parameter estimates. References Sanchez, G. (2013). PLS Path Modeling with R. Retrieved from http://www.gastonsanchez.com/PLS Path Modeling with R.pdf Bjørn-Helge Mevik, & Ron Wehrens. (2007). The pls Package: Principal Component and Partial Least Squares Regression in R. Journal of Statistical Software, 18. Retrieved from http://www.jstatsoft.org/v18/i02/paper See Also Other parameter estimators: params.plsc; params.regression; params.tsls params.regression params.regression 43 Parameter estimation with separate regression analyses Description Estimates the model parameters with weighted composites using separate OLS regressions. Usage params.regression(S, model, W, ...) Arguments S Covariance matrix of the data. model There are two options for this argument: 1. lavaan script or lavaan parameter table, or 2. a list containing three matrices inner, reflective, and formative defining the free regression paths in the model. W Weight matrix, where the indicators are on colums and composites are on the rows. ... All other arguments are passed through to weightFunction and parameterEstimator. Details params.regression estimates the statistical model described by model with the following steps. If model is not in the native format, it is converted to the native format containing matrices inner, reflective, and formative. The weights W and the data covariance matrix S are used to calculate the composite covariance matrix C and the indicator-composite covariance matrix IC. These are used to estimate multiple OLS regression models. The OLS regressions are estimated separately for each of the three model parts inner, reflective, and formative. These matrices are analyzed one row at a time so that the row specifies the index of the dependent variable in the OLS regression and the non-zero elements on the row specify the indices of the independent variables. This approach of estimating the inner and outer models separately with separate OLS regression analyses is the standard way of estimation in the PLS literature. Value A named vector of parameter estimates. See Also Other parameter estimators: params.plsc; params.plsregression; params.tsls 44 params.tsls params.tsls Parameter estimation with two-stage least squares Description Estimates the model parameters with weighted composites using two-stage least squares Usage params.tsls(S, model, W, ...) Arguments S Covariance matrix of the data. model There are two options for this argument: 1. lavaan script or lavaan parameter table, or 2. a list containing three matrices inner, reflective, and formative defining the free regression paths in the model. W Weight matrix, where the indicators are on colums and composites are on the rows. ... All other arguments are passed through to weightFunction and parameterEstimator. Details params.tsls estimates the statistical model described by model with the following steps. If model is not in the native format, it is converted to the native format containing matrices inner, reflective, and formative. The weights W and the data covariance matrix S are used to calculate the composite covariance matrix C and the indicator-composite covariance matrix IC. These are used to estimate multiple regression models with two-stage least squares for inner model and OLS regressions for the outer model. Value A named vector of parameter estimates. See Also Other parameter estimators: params.plsc; params.plsregression; params.regression predict.matrixpls predict.matrixpls 45 Predict method for matrixpls results Description The matrixpls method for the generic function predict predict. Predicts the reflective indicators of endogenous latent variables using estimated model and data for the indicators of exogenous latent variables Usage ## S3 method for class 'matrixpls' predict(object, newdata, ...) Arguments object matrixpls estimation result object produced by the matrixpls function. newdata A data frame or a matrix containing data used for prediction. ... All other arguments are ignored. Value a matrix of predicted values for reflective indicators of endogenous latent variables. References Wold, H. (1974). Causal flows with latent variables: Partings of the ways in the light of NIPALS modelling. European Economic Review, 5(1), 67–86. doi:10.1016/0014-2921(74)90008-7 See Also Other post-estimation functions: AVE; CR; GoF; R2; effects.matrixpls; loadings; residuals.matrixpls R2 R2 for matrixpls results Description The matrixpls method for the generic function R2 computes the squared multiple correlation (R2) for composites predicted by other composites in the model. Usage R2(object, ...) 46 residuals.matrixpls Arguments object ... matrixpls estimation result object produced by the matrixpls function. All other arguments are ignored. Value A named numberic vector containing the R2 values. See Also Other post-estimation functions: AVE; CR; GoF; effects.matrixpls; loadings; predict.matrixpls; residuals.matrixpls residuals.matrixpls Residual diagnostics for matrixpls results Description The matrixpls method for generic function residuals computes the residual covariance matrix and various fit indices presented by Lohmöller (1989, ch 2.4) Usage ## S3 method for class 'matrixpls' residuals(object, ...) Arguments object ... matrixpls estimation result object produced by the matrixpls function. All other arguments are ignored. Value A list with three elements: inner, outer, and indices elements containing the residual covariance matrix of regressions of composites on other composites, the residual covariance matrix of indicators on composites, and various fit indices calculated based on the residuals. References Lohmöller J.-B. (1989) Latent variable path modeling with partial least squares. Heidelberg: Physica-Verlag. Henseler, J., Dijkstra, T. K., Sarstedt, M., Ringle, C. M., Diamantopoulos, A., Straub, D. W., . . . Calantone, R. J. (2014). Common Beliefs and Reality About PLS Comments on Rönkkö and Evermann (2013). Organizational Research Methods, 17(2), 182–209. doi:10.1177/1094428114526928 See Also Other post-estimation functions: AVE; CR; GoF; R2; effects.matrixpls; loadings; predict.matrixpls signChange.construct 47 signChange.construct Construct level sign change correction for boostrapping Description Changes the signs of W on all rows where the sign of the sum of the row differs between Worig and W Usage signChange.construct(Worig, W) Arguments Worig the original weight matrix W a weight matrix of a bootstrap sample Value A weight matrix with the same dimensions as W after References Tenenhaus, M., Esposito Vinzi, V., Chatelin, Y.-M., & Lauro, C. (2005). PLS Path Modeling. Computational Statistics & Data Analysis, 48(1), 159–205. doi:10.1016/j.csda.2004.03.005 See Also matrixpls.boot Other signChangeCorrection: signChange.individual signChange.individual Individual indicator sign change correction for boostrapping Description Changes the signs of W to match Worig Usage signChange.individual(Worig, W) Arguments Worig the original weight matrix W a weight matrix of a bootstrap sample 48 weight.fixed Value A weight matrix with the same dimensions as W after References Tenenhaus, M., Esposito Vinzi, V., Chatelin, Y.-M., & Lauro, C. (2005). PLS Path Modeling. Computational Statistics & Data Analysis, 48(1), 159–205. doi:10.1016/j.csda.2004.03.005 See Also matrixpls.boot Other signChangeCorrection: signChange.construct weight.fixed Fixed weights Description Returns fixed weights Usage weight.fixed(S, model, W.mod = NULL, ..., standardize = TRUE) Arguments S Covariance matrix of the data. model There are two options for this argument: 1. lavaan script or lavaan parameter table, or 2. a list containing three matrices inner, reflective, and formative defining the free regression paths in the model. W.mod An optional numeric matrix representing the weight patter and starting weights (i.e. the how the indicators are combined to form the composite variables). If this argument is not specified, the weight patter is defined based on the relationships in the reflective and formative elements of model. ... All other arguments are ignored. standardize TRUE (default) or FALSE indicating whether S should be converted to a correlation matrix. Details Returns the starting weights specified in W.mod. If standardize is TRUE the weights are standardized so that the composites have unit variances. Model can be specified in the lavaan format or the native matrixpls format. The native model format is a list of three binary matrices, inner, reflective, and formative specifying the free parameters of a model: inner (l x l) specifies the regressions between composites, reflective weight.optim 49 (k x l) specifies the regressions of observed data on composites, and formative (l x k) specifies the regressions of composites on the observed data. Here k is the number of observed variables and l is the number of composites. If the model is specified in lavaan format, the native format model is derived from this model by assigning all regressions between latent variables to inner, all factor loadings to reflective, and all regressions of latent variables on observed variables to formative. Regressions between observed variables and all free covariances are ignored. All parameters that are specified in the model will be treated as free parameters. If model is specified in lavaan syntax, the model that is passed to the parameterEstimator will be that model and not the native format model. The original papers about Partial Least Squares, as well as many of the current PLS implementations, impose restrictions on the matrices inner, reflective, and formative: inner must be a lower triangular matrix, reflective must have exactly one non-zero value on each row and must have at least one non-zero value on each column, and formative must only contain zeros. Some PLS implementations allow formative to contain non-zero values, but impose a restriction that the sum of reflective and t(formative) must satisfy the original restrictions of reflective. The only restrictions that matrixpls imposes on inner, reflective, and formative is that these must be binary matrices and that the diagonal of inner must be zeros. The argument W.mod is a (l x k) matrix that indicates how the indicators are combined to form the composites. The original papers about Partial Least Squares as well as all current PLS implementations define this as t(reflective) | formative, which means that the weight patter must match the model specified in reflective and formative. Matrixpls does not require that W.mod needs to match reflective and formative, but accepts any numeric matrix. If this argument is not specified, W.mod is defined as t(reflective) | formative. Value An object of class "matrixplsweights", which is a matrix containing the weights with the following attributes: iterations Number of iterations performed converged A boolean indicating if the algorithm converged history A data.frame containing the weights for each iteration See Also Other Weight algorithms: weight.optim; weight.pls weight.optim Optimized weights Description Calculates a set of weights to minimize an optimization criterion 50 weight.optim Usage weight.optim(S, model, W.mod, parameterEstimator = params.regression, optimCriterion = optim.maximizeInnerR2, method = "BFGS", ..., validateInput = TRUE, standardize = TRUE) Arguments S Covariance matrix of the data. model There are two options for this argument: 1. lavaan script or lavaan parameter table, or 2. a list containing three matrices inner, reflective, and formative defining the free regression paths in the model. W.mod An optional numeric matrix representing the weight patter and starting weights (i.e. the how the indicators are combined to form the composite variables). If this argument is not specified, the weight patter is defined based on the relationships in the reflective and formative elements of model. parameterEstimator A function that takes three or more arguments, the data covariance matrix S, model specification model, and weights W and returns a named vector of parameter estimates. The default is params.regression optimCriterion A function that taking an object of class class matrixpls and returning a scalar. The default is optim.maximizeInnerR2 method The minimization algorithm to be used. See optim for details. Default is "BFGS". ... All other arguments are passed through to optim and parameterEstimator. validateInput A boolean indicating whether the arguments should be validated. standardize TRUE (default) or FALSE indicating whether S should be converted to a correlation matrix. Details weight.optim calculates indicator weights by optimizing the indicator weights against the criterion function using optim. The algoritmh works by first estimating the model with the starting weights. The resulting matrixpls object is passed to the optimCriterion function, which evaluates the optimization criterion for the weights. The weights are adjusted and new estimates are calculated until the optimization criterion converges. Model can be specified in the lavaan format or the native matrixpls format. The native model format is a list of three binary matrices, inner, reflective, and formative specifying the free parameters of a model: inner (l x l) specifies the regressions between composites, reflective (k x l) specifies the regressions of observed data on composites, and formative (l x k) specifies the regressions of composites on the observed data. Here k is the number of observed variables and l is the number of composites. If the model is specified in lavaan format, the native format model is derived from this model by assigning all regressions between latent variables to inner, all factor loadings to reflective, and all regressions of latent variables on observed variables to formative. Regressions between observed variables and all free covariances are ignored. All parameters that are specified in the weight.optim 51 model will be treated as free parameters. If model is specified in lavaan syntax, the model that is passed to the parameterEstimator will be that model and not the native format model. The original papers about Partial Least Squares, as well as many of the current PLS implementations, impose restrictions on the matrices inner, reflective, and formative: inner must be a lower triangular matrix, reflective must have exactly one non-zero value on each row and must have at least one non-zero value on each column, and formative must only contain zeros. Some PLS implementations allow formative to contain non-zero values, but impose a restriction that the sum of reflective and t(formative) must satisfy the original restrictions of reflective. The only restrictions that matrixpls imposes on inner, reflective, and formative is that these must be binary matrices and that the diagonal of inner must be zeros. The argument W.mod is a (l x k) matrix that indicates how the indicators are combined to form the composites. The original papers about Partial Least Squares as well as all current PLS implementations define this as t(reflective) | formative, which means that the weight patter must match the model specified in reflective and formative. Matrixpls does not require that W.mod needs to match reflective and formative, but accepts any numeric matrix. If this argument is not specified, W.mod is defined as t(reflective) | formative. Value An object of class "matrixplsweights", which is a matrix containing the weights with the following attributes: iterations Number of iterations performed converged A boolean indicating if the algorithm converged history A data.frame containing the weights for each iteration See Also Optimization criteria: optim.maximizeInnerR2 Other Weight algorithms: weight.fixed; weight.pls Examples library(plspm) # Run the customer satisfaction examle form plspm # load dataset satisfaction data(satisfaction) # inner model matrix IMAG = c(0,0,0,0,0,0) EXPE = c(1,0,0,0,0,0) QUAL = c(0,1,0,0,0,0) VAL = c(0,1,1,0,0,0) SAT = c(1,1,1,1,0,0) LOY = c(1,0,0,0,1,0) inner = rbind(IMAG, EXPE, QUAL, VAL, SAT, LOY) colnames(inner) <- rownames(inner) 52 weight.pls # Reflective model list(1:5, 6:10, 11:15, 16:19, 20:23, 24:27) reflective<- matrix( c(1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27,6, dimnames = list(colnames(satisfaction)[1:27],colnames(inner))) 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1), # empty formative model formative <- matrix(0, 6, 27, dimnames = list(colnames(inner), colnames(satisfaction)[1:27])) # Estimation using covariance matrix model <- list(inner = inner, reflective = reflective, formative = formative) S <- cov(satisfaction[,1:27]) matrixpls.ModeA <- matrixpls(S, model) matrixpls.ModeB <- matrixpls(S, model, outerEstimators = outer.modeB) matrixpls.MaxR2 <- matrixpls(S, model, weightFunction = weight.optim) # Compare the R2s from the different estimations R2s <- cbind(R2(matrixpls.ModeA), R2(matrixpls.ModeB), R2(matrixpls.MaxR2)) print(R2s) apply(R2s,2,mean) weight.pls Partial Least Squares and other iterative two-stage weight algorithms Description Estimates a weight matrix using Partial Least Squares or a related algorithm. Usage weight.pls(S, model, W.mod, outerEstimators = NULL, innerEstimator = inner.path, ..., convCheck = convCheck.absolute, tol = 1e-05, iter = 100, validateInput = TRUE) weight.pls 53 Arguments S Covariance matrix of the data. model There are two options for this argument: 1. lavaan script or lavaan parameter table, or 2. a list containing three matrices inner, reflective, and formative defining the free regression paths in the model. W.mod An optional numeric matrix representing the weight patter and starting weights (i.e. the how the indicators are combined to form the composite variables). If this argument is not specified, the weight patter is defined based on the relationships in the reflective and formative elements of model. outerEstimators A function or a list of functions used for outer estimation. If the value of this parameter is a function, the same function is applied to all composites. If the value of the parameter is a list, the composite n is estimated with the estimator in the nth position in the list. If this argument is NULL the starting weights specified in W.mod will be returned. The default is outer.modeA (PLS Mode A estimation). innerEstimator A function used for inner estimation. Setting this argument to null will use identity matrix as inner estimates and causes the algorithm to converge after the first iteration. This is useful when using outer.fixedWeights or some other outer estimation function that does not use inner estimation results. The default is inner.path (PLS path weighting scheme). ... All other arguments are passed through to outerEstimators and innerEstimator. convCheck A function that takes the old and new weight matrices and returns a scalar that is compared against tol to check for convergence. The default function calculates the differences between each cell of old and new weights and returns the largest absolute difference. tol Decimal value indicating the tolerance criterion for the iterations. iter An integer indicating the maximum number of iterations. validateInput A boolean indicating whether the validity of the parameter values should be tested. Details weight.pls calculates indicator weights by calling the innerEstimator and outerEstimators iteratively until either the convergence criterion or maximum number of iterations is reached and provides the results in a matrix. Model can be specified in the lavaan format or the native matrixpls format. The native model format is a list of three binary matrices, inner, reflective, and formative specifying the free parameters of a model: inner (l x l) specifies the regressions between composites, reflective (k x l) specifies the regressions of observed data on composites, and formative (l x k) specifies the regressions of composites on the observed data. Here k is the number of observed variables and l is the number of composites. If the model is specified in lavaan format, the native format model is derived from this model by assigning all regressions between latent variables to inner, all factor loadings to reflective, and all regressions of latent variables on observed variables to formative. Regressions between 54 weight.pls observed variables and all free covariances are ignored. All parameters that are specified in the model will be treated as free parameters. If model is specified in lavaan syntax, the model that is passed to the parameterEstimator will be that model and not the native format model. The original papers about Partial Least Squares, as well as many of the current PLS implementations, impose restrictions on the matrices inner, reflective, and formative: inner must be a lower triangular matrix, reflective must have exactly one non-zero value on each row and must have at least one non-zero value on each column, and formative must only contain zeros. Some PLS implementations allow formative to contain non-zero values, but impose a restriction that the sum of reflective and t(formative) must satisfy the original restrictions of reflective. The only restrictions that matrixpls imposes on inner, reflective, and formative is that these must be binary matrices and that the diagonal of inner must be zeros. The argument W.mod is a (l x k) matrix that indicates how the indicators are combined to form the composites. The original papers about Partial Least Squares as well as all current PLS implementations define this as t(reflective) | formative, which means that the weight patter must match the model specified in reflective and formative. Matrixpls does not require that W.mod needs to match reflective and formative, but accepts any numeric matrix. If this argument is not specified, W.mod is defined as t(reflective) | formative. Value An object of class "matrixplsweights", which is a matrix containing the weights with the following attributes: iterations Number of iterations performed converged A boolean indicating if the algorithm converged history A data.frame containing the weights for each iteration See Also Inner estimators: inner.path; inner.centroid; inner.factor; inner.GSCA; inner.identity Outer estimators: outer.modeA; outer.modeB; outer.GSCA; outer.factor; outer.fixedWeights Convergence checks: convCheck.absolute, convCheck.square, and convCheck.relative. Other Weight algorithms: weight.fixed; weight.optim Index optim.GCCA, 29, 30–32 optim.GSCA, 13, 29, 30, 31, 32, 35 optim.maximizeInnerR2, 29, 30, 31, 32, 50, 51 optim.maximizePrediction, 29–31, 31 outer.factor, 32, 33, 35, 37, 38, 54 outer.fixedWeights, 29, 32, 33, 35, 37, 38, 53, 54 outer.GSCA, 12, 13, 30, 32, 33, 33, 34, 37, 38, 54 outer.modeA, 32, 33, 35, 36, 37, 38, 53, 54 outer.modeB, 32, 33, 35, 37, 37, 38, 54 outer.RGCCA, 32, 33, 35, 37, 38 ∗Topic package matrixpls-package, 3 AVE, 4, 7–9, 18, 45, 46 boot, 20, 21, 26 boot.ci, 26 convCheck.absolute, 5, 6, 7, 54 convCheck.relative, 6, 6, 7, 54 convCheck.square, 6, 6, 54 CR, 5, 7, 8, 9, 18, 45, 46 effects, 8 effects.matrixpls, 5, 7, 8, 9, 18, 45, 46 params.plsc, 20, 39, 42–44 params.plsregression, 20, 41, 42, 43, 44 params.regression, 19, 20, 40–42, 43, 44, 50 params.tsls, 20, 41–43, 44 plsm, 24 plspm, 4, 21, 22 predict.matrixpls, 5, 7–9, 18, 45, 46 fa, 32, 40 fitSummary, 8 get_plsr1, 42 GoF, 5, 7, 8, 9, 18, 45, 46 inner.centroid, 10, 11, 13, 15–17, 54 inner.factor, 10, 11, 13, 15–17, 54 inner.GSCA, 10–12, 12, 15–17, 30, 34, 35, 54 inner.Horst, 10, 11, 13, 15, 16, 17 inner.identity, 10, 11, 13, 15, 16, 17, 54 inner.path, 10, 11, 13, 15, 16, 17, 29, 53, 54 R2, 5, 7–9, 18, 45, 45, 46 read.splsm, 24 residuals.matrixpls, 5, 7–9, 18, 45, 46, 46 sempls, 4, 23, 25 signChange.construct, 21, 47, 48 signChange.individual, 21, 47, 47 sim, 4, 26, 27 solve, 3 lavaan, 40 loadings, 5, 7–9, 18, 45, 46 matrixpls, 5, 7–9, 18, 20, 22, 26, 27, 34, 45, 46 matrixpls-package, 3 matrixpls.boot, 20, 26, 27, 47, 48 matrixpls.plspm, 21 matrixpls.sempls, 23 matrixpls.sim, 26 weight.fixed, 20, 48, 51, 54 weight.optim, 20, 49, 49, 54 weight.pls, 19, 20, 49, 51, 52 optim, 50 55