@@ -127,52 +127,6 @@ csem_fit <- function(.object,
127127 }
128128}
129129
130-
131- # ' Calculate I-GSCA's Objective Function
132- # '
133- # ' Numerator of the fraction of unexplained variance in the data of the FIT statistic for GSCA models.
134- # '
135- # ' @param .object
136- # '
137- # ' @return Sum of Squares of Unexplained Variance
138- # ' @keywords internal
139- calculateIgscaObjectiveFunction <- function (.object = NULL ) {
140-
141- # As shown in the GSCA_m publication (Hwang et al., 2017)
142- Gamma <- .object $ Estimates $ Construct_scores
143- Psi <- cbind(.object $ Information $ Data , Gamma )
144- # I am fairly confident the transpose of B is what's needed
145- # See Gamma[1,] %*% t(...$Path_estimates)
146- if (! is.null(.object $ Estimates $ Path_estimates )) {
147- # If there's a structural model
148- A <- cbind(.object $ Estimates $ Loading_estimates ,
149- t(.object $ Estimates $ Path_estimates ))
150- }
151- else if (is.null(.object $ Estimates $ Path_estimates ) | (! exists(" .object$Estimates$Path_estimates" ))) {
152- # If no structural model
153- A <- cbind(.object $ Estimates $ Loading_estimates ,
154- matrix (data = 0 ,
155- nrow = nrow(.object $ Estimates $ Loading_estimates ),
156- ncol = nrow(.object $ Estimates $ Loading_estimates ))
157- )
158- }
159-
160- if (! is.null(.object $ Estimates $ Unique_scores )) {
161- S <- cbind(.object $ Estimates $ Unique_scores , matrix (data = 0 , nrow = nrow(Gamma ), ncol = ncol(Gamma )))
162-
163- } else if (is.null(.object $ Estimates $ Unique_scores )) {
164- # Unique_scores should be NULL when GSCA and not GSCA_m/I-GSCA is run
165- S <- matrix (data = 0 , nrow(Psi ), ncol = ncol(Psi ))
166-
167- }
168-
169- SS_unexplained_variance <- sum(diag(t(Psi - Gamma %*% A - S ) %*% (Psi - Gamma %*% A - S )))
170-
171- return (SS_unexplained_variance )
172- }
173-
174-
175-
176130# ' Prune a grown tree from doTrees
177131# '
178132# ' @param .tree Fitted tree
0 commit comments