Skip to content

Commit 8e67b45

Browse files
Merge pull request #43 from sem-in-r/documents
added docs for path_weighting and outer_weighting schemes.
2 parents 6d09d4b + 8316c8a commit 8e67b45

File tree

5 files changed

+174
-4
lines changed

5 files changed

+174
-4
lines changed

R/library.R

Lines changed: 76 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,50 @@ mmMatrix_per_latent <- function(latent, mmMatrix) {
3131
return(latentmatrix)
3232
}
3333

34-
# Factorial weighting scheme Function to create inner paths matrix
34+
#' Inner weighting scheme functions to estimate inner paths matrix
35+
#'
36+
#' \code{path_factorial} and \code{path_weighting} specify the inner weighting scheme to be used in the estimation of the
37+
#' inner paths matrix
38+
#'
39+
#' @param smMatrix is the \code{structural_model} - a source-to-target matrix representing the inner/structural model,
40+
#' generated by \code{relationships}.
41+
#'
42+
#' @param fscores is the matrix of construct scores generated by \code{simplePLS}.
43+
#'
44+
#' @param dependant is the vector of dependant constructs in the model.
45+
#'
46+
#' @param paths_matrix is the matrix of estimated path coefficients estimated by \code{simplePLS}.
47+
#'
48+
#' @usage
49+
#' path_factorial(smMatrix,fscores, dependant, paths_matrix)
50+
#'
51+
#' @references Lohmoller, J.-B. (1989). Latent variables path modeling with partial least squares. Heidelberg, Germany: Physica- Verlag.
52+
#'
3553
#' @export
3654
path_factorial <- function(smMatrix,fscores, dependant, paths_matrix) {
3755
inner_paths <- stats::cor(fscores,fscores) * (paths_matrix + t(paths_matrix))
3856
return(inner_paths)
3957
}
4058

41-
# Factorial weighting scheme Function to create inner paths matrix
59+
#' Inner weighting scheme functions to estimate inner paths matrix
60+
#'
61+
#' \code{path_factorial} and \code{path_weighting} specify the inner weighting scheme to be used in the estimation of the
62+
#' inner paths matrix
63+
#'
64+
#' @param smMatrix is the \code{structural_model} - a source-to-target matrix representing the inner/structural model,
65+
#' generated by \code{relationships}.
66+
#'
67+
#' @param fscores is the matrix of construct scores generated by \code{simplePLS}.
68+
#'
69+
#' @param dependant is the vector of dependant constructs in the model.
70+
#'
71+
#' @param paths_matrix is the matrix of estimated path coefficients estimated by \code{simplePLS}.
72+
#'
73+
#' @usage
74+
#' path_weighting(smMatrix,fscores, dependant, paths_matrix)
75+
#'
76+
#' @references Lohmoller, J.B. (1989). Latent variables path modeling with partial least squares. Heidelberg, Germany: Physica-Verlag.
77+
#'
4278
#' @export
4379
path_weighting <- function(smMatrix, fscores, dependant, paths_matrix) {
4480
# correlations for outgoing paths
@@ -104,20 +140,56 @@ standardize_outer_weights <- function(normData, mmVariables, outer_weights) {
104140
return(t(t(outer_weights) / std_devs))
105141
}
106142

143+
#' Outer weighting scheme functions to estimate construct weighting.
144+
#'
145+
#' \code{mode_A}, \code{correlation_weights} and \code{mode_B}, \code{regression_weights} specify the outer weighting
146+
#' scheme to be used in the estimation of the construct weights and score.
147+
#'
148+
#' @param mmMatrix is the \code{measurement_model} - a source-to-target matrix representing the measurement model,
149+
#' generated by \code{constructs}.
150+
#'
151+
#' @param i is the name of the construct to be estimated.
152+
#'
153+
#' @param normData is the dataframe of the normalized item data.
154+
#'
155+
#' @param fscores is the matrix of construct scores generated by \code{simplePLS}.
156+
#'
157+
#' @usage
158+
#' mode_A(mmMatrix, i, normData, fscores)
159+
#'
160+
#' @aliases mode_A, correlation_weights
161+
#'
107162
#' @export
108163
mode_A <- function(mmMatrix, i, normData, fscores) {
109164
return(stats::cov(normData[,mmMatrix[mmMatrix[,"latent"]==i,"measurement"]],fscores[,i]))
110165
}
111-
112166
#' @export
113167
correlation_weights <- mode_A
114168

169+
#' Outer weighting scheme functions to estimate construct weighting.
170+
#'
171+
#' \code{mode_A}, \code{correlation_weights} and \code{mode_B}, \code{regression_weights} specify the outer weighting
172+
#' scheme to be used in the estimation of the construct weights and score.
173+
#'
174+
#' @param mmMatrix is the \code{measurement_model} - a source-to-target matrix representing the measurement model,
175+
#' generated by \code{constructs}.
176+
#'
177+
#' @param i is the name of the construct to be estimated.
178+
#'
179+
#' @param normData is the dataframe of the normalized item data.
180+
#'
181+
#' @param fscores is the matrix of construct scores generated by \code{simplePLS}.
182+
#'
183+
#' @usage
184+
#' mode_B(mmMatrix, i, normData, fscores)
185+
#'
186+
#' @aliases mode_B, regression_weights
187+
#'
115188
#' @export
116189
mode_B <- function(mmMatrix, i,normData, fscores) {
117190
return(solve(stats::cor(normData[,mmMatrix[mmMatrix[,"latent"]==i,"measurement"]])) %*%
118191
stats::cor(normData[,mmMatrix[mmMatrix[,"latent"]==i,"measurement"]],
119192
fscores[,i]))
120193
}
121-
122194
#' @export
123195
regression_weights <- mode_B

man/mode_A.Rd

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/mode_B.Rd

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/path_factorial.Rd

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/path_weighting.Rd

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)