[Swift-commit] r4048 - in SwiftApps/SwiftR/mxtests: . snowfall swift

noreply at svn.ci.uchicago.edu noreply at svn.ci.uchicago.edu
Wed Feb 2 10:13:20 CST 2011


Author: tga
Date: 2011-02-02 10:13:19 -0600 (Wed, 02 Feb 2011)
New Revision: 4048

Added:
   SwiftApps/SwiftR/mxtests/snowfall/
   SwiftApps/SwiftR/mxtests/snowfall/BootstrapParallelBigger.R
   SwiftApps/SwiftR/mxtests/snowfall/RAM-3Factor-96Indicators-covdata-a.R
   SwiftApps/SwiftR/mxtests/swift/
   SwiftApps/SwiftR/mxtests/swift/BootstrapParallelBigger.R
   SwiftApps/SwiftR/mxtests/swift/RAM-3Factor-96Indicators-covdata-a.R
Removed:
   SwiftApps/SwiftR/mxtests/BootstrapParallelBigger.R
Log:
Checking in Snowfall versions of Mx benchmarks, and creating copies to convert to swift.


Deleted: SwiftApps/SwiftR/mxtests/BootstrapParallelBigger.R
===================================================================
--- SwiftApps/SwiftR/mxtests/BootstrapParallelBigger.R	2011-02-01 08:55:10 UTC (rev 4047)
+++ SwiftApps/SwiftR/mxtests/BootstrapParallelBigger.R	2011-02-02 16:13:19 UTC (rev 4048)
@@ -1,118 +0,0 @@
-#
-#   Copyright 2007-2010 The OpenMx Project
-#
-#   Licensed under the Apache License, Version 2.0 (the "License");
-#   you may not use this file except in compliance with the License.
-#   You may obtain a copy of the License at
-# 
-#        http://www.apache.org/licenses/LICENSE-2.0
-# 
-#   Unless required by applicable law or agreed to in writing, software
-#   distributed under the License is distributed on an "AS IS" BASIS,
-#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#   See the License for the specific language governing permissions and
-#   limitations under the License.
-
-require(OpenMx)
-require(snowfall)
-
-hostfile <- Sys.getenv(c("PBS_NODEFILE"))
-
-hostnames <- read.table(hostfile, stringsAsFactors=FALSE)[[1]]
-ncpus <- length(hostnames)
-
-sfSetMaxCPUs(ncpus)
-sfInit(parallel=TRUE, cpus=ncpus, socketHosts=hostnames)
-sfLibrary(OpenMx)
-
-set.seed(10)
-
-# parameters for the simulation: lambda = factor loadings,
-# specifics = specific variances
-nVar <- 75
-nObs <- 10000
-nReps <- 1024
-goodStartValues <- TRUE
-if (!is.logical(goodStartValues)) {
-  stop("'goodStartValues' should be logical. Try again.")
-}
-
-lambda <- matrix(1:nVar*2/nVar, nVar, 1)
-specifics <- diag(nVar)
-chl <- chol(lambda %*% t(lambda) + specifics)
-
-# indices for parameters and hessian estimate in results
-pStrt <- 3
-pEnd <- pStrt + 2*nVar - 1
-hStrt <- pEnd + 1
-hEnd <- hStrt + 2*nVar - 1
-
-# dimension names for OpenMx
-dn <- list()
-dn[[1]] <- paste("Var", 1:nVar, sep="")
-dn[[2]] <- dn[[1]]
-
-# function to get a covariance matrix
-randomCov <- function(nObs, nVar, chl, dn) {
-  x <- matrix(rnorm(nObs*nVar), nObs, nVar)
-  x <- x %*% chl
-  thisCov <- cov(x)
-  dimnames(thisCov) <- dn
-  return(thisCov)  
-}
-
-createNewModel <- function(index, prefix, model) {
-	modelname <- paste(prefix, index, sep='')
-	model at data@observed <- randomCov(nObs, nVar, chl, dn)
-	model at name <- modelname
-	return(model)
-}
-
-getStats <- function(model) {
-	retval <- c(model at output$status[[1]],
-		max(abs(model at output$gradient)),
-		model at output$estimate,
-		sqrt(diag(solve(model at output$hessian))))
-	return(retval)
-}
-
-
-# initialize obsCov for MxModel
-obsCov <- randomCov(nObs, nVar, chl, dn)
-
-# results matrix: get results for each simulation
-results <- matrix(0, nReps, hEnd)
-dnr <- c("inform", "maxAbsG", paste("lambda", 1:nVar, sep=""),
-         paste("specifics", 1:nVar, sep=""),
-         paste("hessLambda", 1:nVar, sep=""),
-         paste("hessSpecifics", 1:nVar, sep=""))
-dimnames(results)[[2]] <- dnr
-
-# instantiate MxModel
-template <- mxModel(name="stErrSim",
-                       mxMatrix(name="lambda", type="Full", nrow=nVar, ncol=1,
-                                free=TRUE, values=(1:nVar*2/nVar)*goodStartValues),
-                       mxMatrix(name="specifics", type="Diag", nrow=nVar,
-                                free=TRUE, values=rep(1, nVar)),
-                       mxAlgebra(lambda %*% t(lambda) + specifics,
-                                 name="preCov", dimnames=dn),
-                       mxData(observed=obsCov, type="cov", numObs=nObs),
-                       mxMLObjective(covariance='preCov'),
-                       independent = TRUE)
-
-topModel <- mxModel(name = 'container')
-
-sfExportAll()
-
-submodels <- lapply(1:nReps, createNewModel, 'stErrSim', template)
-
-names(submodels) <- omxExtractNames(submodels)
-topModel at submodels <- submodels
-
-modelResults <- mxRun(topModel, silent=TRUE, suppressWarnings=TRUE)
-
-print(ncpus)
-print(modelResults at output$wallTime)
-
-sfStop()
-

Added: SwiftApps/SwiftR/mxtests/snowfall/BootstrapParallelBigger.R
===================================================================
--- SwiftApps/SwiftR/mxtests/snowfall/BootstrapParallelBigger.R	                        (rev 0)
+++ SwiftApps/SwiftR/mxtests/snowfall/BootstrapParallelBigger.R	2011-02-02 16:13:19 UTC (rev 4048)
@@ -0,0 +1,118 @@
+#
+#   Copyright 2007-2010 The OpenMx Project
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+# 
+#        http://www.apache.org/licenses/LICENSE-2.0
+# 
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+require(OpenMx)
+require(snowfall)
+
+hostfile <- Sys.getenv(c("PBS_NODEFILE"))
+
+hostnames <- read.table(hostfile, stringsAsFactors=FALSE)[[1]]
+ncpus <- length(hostnames)
+
+sfSetMaxCPUs(ncpus)
+sfInit(parallel=TRUE, cpus=ncpus, socketHosts=hostnames)
+sfLibrary(OpenMx)
+
+set.seed(10)
+
+# parameters for the simulation: lambda = factor loadings,
+# specifics = specific variances
+nVar <- 75
+nObs <- 10000
+nReps <- 1024
+goodStartValues <- TRUE
+if (!is.logical(goodStartValues)) {
+  stop("'goodStartValues' should be logical. Try again.")
+}
+
+lambda <- matrix(1:nVar*2/nVar, nVar, 1)
+specifics <- diag(nVar)
+chl <- chol(lambda %*% t(lambda) + specifics)
+
+# indices for parameters and hessian estimate in results
+pStrt <- 3
+pEnd <- pStrt + 2*nVar - 1
+hStrt <- pEnd + 1
+hEnd <- hStrt + 2*nVar - 1
+
+# dimension names for OpenMx
+dn <- list()
+dn[[1]] <- paste("Var", 1:nVar, sep="")
+dn[[2]] <- dn[[1]]
+
+# function to get a covariance matrix
+randomCov <- function(nObs, nVar, chl, dn) {
+  x <- matrix(rnorm(nObs*nVar), nObs, nVar)
+  x <- x %*% chl
+  thisCov <- cov(x)
+  dimnames(thisCov) <- dn
+  return(thisCov)  
+}
+
+createNewModel <- function(index, prefix, model) {
+	modelname <- paste(prefix, index, sep='')
+	model at data@observed <- randomCov(nObs, nVar, chl, dn)
+	model at name <- modelname
+	return(model)
+}
+
+getStats <- function(model) {
+	retval <- c(model at output$status[[1]],
+		max(abs(model at output$gradient)),
+		model at output$estimate,
+		sqrt(diag(solve(model at output$hessian))))
+	return(retval)
+}
+
+
+# initialize obsCov for MxModel
+obsCov <- randomCov(nObs, nVar, chl, dn)
+
+# results matrix: get results for each simulation
+results <- matrix(0, nReps, hEnd)
+dnr <- c("inform", "maxAbsG", paste("lambda", 1:nVar, sep=""),
+         paste("specifics", 1:nVar, sep=""),
+         paste("hessLambda", 1:nVar, sep=""),
+         paste("hessSpecifics", 1:nVar, sep=""))
+dimnames(results)[[2]] <- dnr
+
+# instantiate MxModel
+template <- mxModel(name="stErrSim",
+                       mxMatrix(name="lambda", type="Full", nrow=nVar, ncol=1,
+                                free=TRUE, values=(1:nVar*2/nVar)*goodStartValues),
+                       mxMatrix(name="specifics", type="Diag", nrow=nVar,
+                                free=TRUE, values=rep(1, nVar)),
+                       mxAlgebra(lambda %*% t(lambda) + specifics,
+                                 name="preCov", dimnames=dn),
+                       mxData(observed=obsCov, type="cov", numObs=nObs),
+                       mxMLObjective(covariance='preCov'),
+                       independent = TRUE)
+
+topModel <- mxModel(name = 'container')
+
+sfExportAll()
+
+submodels <- lapply(1:nReps, createNewModel, 'stErrSim', template)
+
+names(submodels) <- omxExtractNames(submodels)
+topModel at submodels <- submodels
+
+modelResults <- mxRun(topModel, silent=TRUE, suppressWarnings=TRUE)
+
+print(ncpus)
+print(modelResults at output$wallTime)
+
+sfStop()
+

Added: SwiftApps/SwiftR/mxtests/snowfall/RAM-3Factor-96Indicators-covdata-a.R
===================================================================
--- SwiftApps/SwiftR/mxtests/snowfall/RAM-3Factor-96Indicators-covdata-a.R	                        (rev 0)
+++ SwiftApps/SwiftR/mxtests/snowfall/RAM-3Factor-96Indicators-covdata-a.R	2011-02-02 16:13:19 UTC (rev 4048)
@@ -0,0 +1,133 @@
+# ---------------------------------------------------------------------
+# Program: RAM-3Factor-12Indicators.R
+#  Author: Steven M. Boker
+#    Date: Fri Jul 30 13:45:12 EDT 2010
+#
+# This program is a factor model using standard RAM.
+#
+# ---------------------------------------------------------------------
+# Revision History
+#    -- Fri Jul 30 13:45:12 EDT 2010
+#      Created RAM-3Factor-12Indicators.R.
+#
+# ---------------------------------------------------------------------
+
+# ----------------------------------
+# Read libraries and set options.
+
+library(OpenMx)
+library(snowfall)
+
+hostfile <- Sys.getenv(c("PBS_NODEFILE"))
+
+hostnames <- read.table(hostfile, stringsAsFactors=FALSE)[[1]]
+ncpus <- length(hostnames)
+
+sfSetMaxCPUs(ncpus)
+sfInit(parallel=TRUE, cpus=ncpus, socketHosts = hostnames)
+sfLibrary(OpenMx)
+
+options(width=100)
+set.seed(10)
+
+# ---------------------------------------------------------------------
+# Data for factor model.
+
+numberSubjects <- 1000
+numberFactors <- 3
+numberIndPerFactor <- 32
+numberIndicators <- numberIndPerFactor*numberFactors # must be a multiple of numberFactors
+
+XMatrix <- matrix(rnorm(numberSubjects*numberFactors, mean=0, sd=1), numberSubjects, numberFactors)
+
+tLoadings <- c(1, seq(.5, .9, length.out=(numberIndPerFactor-1)), rep(0, numberIndPerFactor*2),
+  rep(0, numberIndPerFactor*1), 1, seq(.5, .9, length.out=(numberIndPerFactor-1)), rep(0, numberIndPerFactor*1),
+  rep(0, numberIndPerFactor*2), 1, seq(.5, .9, length.out=(numberIndPerFactor-1)))
+BMatrix <- matrix(tLoadings, numberFactors, numberIndicators, byrow=TRUE)
+UMatrix <- matrix(rnorm(numberSubjects*numberIndicators, mean=0, sd=1), numberSubjects, numberIndicators)
+YMatrix <- XMatrix %*% BMatrix + UMatrix
+
+cor(XMatrix)
+
+dimnames(YMatrix) <- list(NULL, paste("X", 1:numberIndicators, sep=""))
+
+YFrame <- data.frame(YMatrix)
+
+round(cor(YFrame), 3)
+round(cov(YFrame), 3)
+
+indicators <- paste("X", 1:numberIndicators, sep="")
+totalVars <- numberIndicators + numberFactors
+
+# ----------------------------------
+# Build an orthogonal simple structure factor model
+
+latents <- paste("F", 1:numberFactors, sep="")
+
+uniqueLabels <- paste("U_", indicators, sep="")
+meanLabels <- paste("M_", latents, sep="")
+factorVarLabels <- paste("Var_", latents, sep="")
+
+latents1 <- latents[1]
+indicators1 <- indicators[1:numberIndPerFactor]
+loadingLabels1 <- paste("b_F1", indicators[1:numberIndPerFactor], sep="") 
+latents2 <- latents[2]
+indicators2 <- indicators[numberIndPerFactor+(1:numberIndPerFactor)]
+loadingLabels2 <- paste("b_F2", indicators[numberIndPerFactor+(1:numberIndPerFactor)], sep="") 
+latents3 <- latents[3]
+indicators3 <- indicators[(2*numberIndPerFactor)+(1:numberIndPerFactor)]
+loadingLabels3 <- paste("b_F3", indicators[(2*numberIndPerFactor)+(1:numberIndPerFactor)], sep="") 
+
+threeFactorOrthogonal <- mxModel("threeFactorOrthogonal",
+    type="RAM",
+    manifestVars=c(indicators),
+    latentVars=c(latents,"dummy1"),
+    mxPath(from=latents1, to=indicators1, 
+           arrows=1, all=TRUE, 
+           free=TRUE, values=.2, 
+           labels=loadingLabels1),
+    mxPath(from=latents2, to=indicators2, 
+           arrows=1, all=TRUE, 
+           free=TRUE, values=.2, 
+           labels=loadingLabels2),
+    mxPath(from=latents3, to=indicators3, 
+           arrows=1, all=TRUE, 
+           free=TRUE, values=.2, 
+           labels=loadingLabels3),
+    mxPath(from=latents1, to=indicators1[1], 
+           arrows=1, 
+           free=FALSE, values=1),
+    mxPath(from=latents2, to=indicators2[1], 
+           arrows=1, 
+           free=FALSE, values=1),
+    mxPath(from=latents3, to=indicators3[1], 
+           arrows=1, 
+           free=FALSE, values=1),
+    mxPath(from=indicators, 
+           arrows=2, 
+           free=TRUE, values=.2, 
+           labels=uniqueLabels),
+    mxPath(from=latents,
+           arrows=2, 
+           free=TRUE, values=.8, 
+           labels=factorVarLabels),
+    mxPath(from="one", to=indicators, 
+           arrows=1, free=FALSE, values=0),
+    mxPath(from="one", to=c(latents), 
+           arrows=1, free=TRUE, values=.1, 
+           labels=meanLabels),
+    mxCI(c('A', 'S')),
+    mxData(observed=cov(YFrame), means=mean(YFrame), 
+	numObs=nrow(YFrame), type="cov")
+    )
+
+threeFactorOrthogonalOut <- mxRun(threeFactorOrthogonal)
+threeFactorCI <- omxParallelCI(threeFactorOrthogonalOut)
+
+totalTime <- threeFactorCI at output$wallTime
+seqTime <- threeFactorOrthogonalOut at output$wallTime
+
+print(ncpus)
+print(totalTime - seqTime)
+
+sfStop()

Copied: SwiftApps/SwiftR/mxtests/swift/BootstrapParallelBigger.R (from rev 4047, SwiftApps/SwiftR/mxtests/BootstrapParallelBigger.R)
===================================================================
--- SwiftApps/SwiftR/mxtests/swift/BootstrapParallelBigger.R	                        (rev 0)
+++ SwiftApps/SwiftR/mxtests/swift/BootstrapParallelBigger.R	2011-02-02 16:13:19 UTC (rev 4048)
@@ -0,0 +1,117 @@
+#
+#   Copyright 2007-2010 The OpenMx Project
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+# 
+#        http://www.apache.org/licenses/LICENSE-2.0
+# 
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+require(OpenMx)
+require(Swift)
+
+#hostfile <- Sys.getenv(c("PBS_NODEFILE"))
+
+#hostnames <- read.table(hostfile, stringsAsFactors=FALSE)[[1]]
+#ncpus <- length(hostnames)
+
+options(swift.initialexpr="library(OpenMx)")
+
+
+set.seed(10)
+
+# parameters for the simulation: lambda = factor loadings,
+# specifics = specific variances
+nVar <- 75
+nObs <- 10000
+nReps <- 1024
+goodStartValues <- TRUE
+if (!is.logical(goodStartValues)) {
+  stop("'goodStartValues' should be logical. Try again.")
+}
+
+lambda <- matrix(1:nVar*2/nVar, nVar, 1)
+specifics <- diag(nVar)
+chl <- chol(lambda %*% t(lambda) + specifics)
+
+# indices for parameters and hessian estimate in results
+pStrt <- 3
+pEnd <- pStrt + 2*nVar - 1
+hStrt <- pEnd + 1
+hEnd <- hStrt + 2*nVar - 1
+
+# dimension names for OpenMx
+dn <- list()
+dn[[1]] <- paste("Var", 1:nVar, sep="")
+dn[[2]] <- dn[[1]]
+
+# function to get a covariance matrix
+randomCov <- function(nObs, nVar, chl, dn) {
+  x <- matrix(rnorm(nObs*nVar), nObs, nVar)
+  x <- x %*% chl
+  thisCov <- cov(x)
+  dimnames(thisCov) <- dn
+  return(thisCov)  
+}
+
+createNewModel <- function(index, prefix, model) {
+	modelname <- paste(prefix, index, sep='')
+	model at data@observed <- randomCov(nObs, nVar, chl, dn)
+	model at name <- modelname
+	return(model)
+}
+
+getStats <- function(model) {
+	retval <- c(model at output$status[[1]],
+		max(abs(model at output$gradient)),
+		model at output$estimate,
+		sqrt(diag(solve(model at output$hessian))))
+	return(retval)
+}
+
+
+# initialize obsCov for MxModel
+obsCov <- randomCov(nObs, nVar, chl, dn)
+
+# results matrix: get results for each simulation
+results <- matrix(0, nReps, hEnd)
+dnr <- c("inform", "maxAbsG", paste("lambda", 1:nVar, sep=""),
+         paste("specifics", 1:nVar, sep=""),
+         paste("hessLambda", 1:nVar, sep=""),
+         paste("hessSpecifics", 1:nVar, sep=""))
+dimnames(results)[[2]] <- dnr
+
+# instantiate MxModel
+template <- mxModel(name="stErrSim",
+                       mxMatrix(name="lambda", type="Full", nrow=nVar, ncol=1,
+                                free=TRUE, values=(1:nVar*2/nVar)*goodStartValues),
+                       mxMatrix(name="specifics", type="Diag", nrow=nVar,
+                                free=TRUE, values=rep(1, nVar)),
+                       mxAlgebra(lambda %*% t(lambda) + specifics,
+                                 name="preCov", dimnames=dn),
+                       mxData(observed=obsCov, type="cov", numObs=nObs),
+                       mxMLObjective(covariance='preCov'),
+                       independent = TRUE)
+
+topModel <- mxModel(name = 'container')
+
+sfExportAll()
+
+submodels <- lapply(1:nReps, createNewModel, 'stErrSim', template)
+
+names(submodels) <- omxExtractNames(submodels)
+topModel at submodels <- submodels
+
+modelResults <- mxRun(topModel, silent=TRUE, suppressWarnings=TRUE)
+
+print(ncpus)
+print(modelResults at output$wallTime)
+
+sfStop()
+


Property changes on: SwiftApps/SwiftR/mxtests/swift/BootstrapParallelBigger.R
___________________________________________________________________
Name: svn:mergeinfo
   + 

Added: SwiftApps/SwiftR/mxtests/swift/RAM-3Factor-96Indicators-covdata-a.R
===================================================================
--- SwiftApps/SwiftR/mxtests/swift/RAM-3Factor-96Indicators-covdata-a.R	                        (rev 0)
+++ SwiftApps/SwiftR/mxtests/swift/RAM-3Factor-96Indicators-covdata-a.R	2011-02-02 16:13:19 UTC (rev 4048)
@@ -0,0 +1,133 @@
+# ---------------------------------------------------------------------
+# Program: RAM-3Factor-12Indicators.R
+#  Author: Steven M. Boker
+#    Date: Fri Jul 30 13:45:12 EDT 2010
+#
+# This program is a factor model using standard RAM.
+#
+# ---------------------------------------------------------------------
+# Revision History
+#    -- Fri Jul 30 13:45:12 EDT 2010
+#      Created RAM-3Factor-12Indicators.R.
+#
+# ---------------------------------------------------------------------
+
+# ----------------------------------
+# Read libraries and set options.
+
+library(OpenMx)
+library(snowfall)
+
+hostfile <- Sys.getenv(c("PBS_NODEFILE"))
+
+hostnames <- read.table(hostfile, stringsAsFactors=FALSE)[[1]]
+ncpus <- length(hostnames)
+
+sfSetMaxCPUs(ncpus)
+sfInit(parallel=TRUE, cpus=ncpus, socketHosts = hostnames)
+sfLibrary(OpenMx)
+
+options(width=100)
+set.seed(10)
+
+# ---------------------------------------------------------------------
+# Data for factor model.
+
+numberSubjects <- 1000
+numberFactors <- 3
+numberIndPerFactor <- 32
+numberIndicators <- numberIndPerFactor*numberFactors # must be a multiple of numberFactors
+
+XMatrix <- matrix(rnorm(numberSubjects*numberFactors, mean=0, sd=1), numberSubjects, numberFactors)
+
+tLoadings <- c(1, seq(.5, .9, length.out=(numberIndPerFactor-1)), rep(0, numberIndPerFactor*2),
+  rep(0, numberIndPerFactor*1), 1, seq(.5, .9, length.out=(numberIndPerFactor-1)), rep(0, numberIndPerFactor*1),
+  rep(0, numberIndPerFactor*2), 1, seq(.5, .9, length.out=(numberIndPerFactor-1)))
+BMatrix <- matrix(tLoadings, numberFactors, numberIndicators, byrow=TRUE)
+UMatrix <- matrix(rnorm(numberSubjects*numberIndicators, mean=0, sd=1), numberSubjects, numberIndicators)
+YMatrix <- XMatrix %*% BMatrix + UMatrix
+
+cor(XMatrix)
+
+dimnames(YMatrix) <- list(NULL, paste("X", 1:numberIndicators, sep=""))
+
+YFrame <- data.frame(YMatrix)
+
+round(cor(YFrame), 3)
+round(cov(YFrame), 3)
+
+indicators <- paste("X", 1:numberIndicators, sep="")
+totalVars <- numberIndicators + numberFactors
+
+# ----------------------------------
+# Build an orthogonal simple structure factor model
+
+latents <- paste("F", 1:numberFactors, sep="")
+
+uniqueLabels <- paste("U_", indicators, sep="")
+meanLabels <- paste("M_", latents, sep="")
+factorVarLabels <- paste("Var_", latents, sep="")
+
+latents1 <- latents[1]
+indicators1 <- indicators[1:numberIndPerFactor]
+loadingLabels1 <- paste("b_F1", indicators[1:numberIndPerFactor], sep="") 
+latents2 <- latents[2]
+indicators2 <- indicators[numberIndPerFactor+(1:numberIndPerFactor)]
+loadingLabels2 <- paste("b_F2", indicators[numberIndPerFactor+(1:numberIndPerFactor)], sep="") 
+latents3 <- latents[3]
+indicators3 <- indicators[(2*numberIndPerFactor)+(1:numberIndPerFactor)]
+loadingLabels3 <- paste("b_F3", indicators[(2*numberIndPerFactor)+(1:numberIndPerFactor)], sep="") 
+
+threeFactorOrthogonal <- mxModel("threeFactorOrthogonal",
+    type="RAM",
+    manifestVars=c(indicators),
+    latentVars=c(latents,"dummy1"),
+    mxPath(from=latents1, to=indicators1, 
+           arrows=1, all=TRUE, 
+           free=TRUE, values=.2, 
+           labels=loadingLabels1),
+    mxPath(from=latents2, to=indicators2, 
+           arrows=1, all=TRUE, 
+           free=TRUE, values=.2, 
+           labels=loadingLabels2),
+    mxPath(from=latents3, to=indicators3, 
+           arrows=1, all=TRUE, 
+           free=TRUE, values=.2, 
+           labels=loadingLabels3),
+    mxPath(from=latents1, to=indicators1[1], 
+           arrows=1, 
+           free=FALSE, values=1),
+    mxPath(from=latents2, to=indicators2[1], 
+           arrows=1, 
+           free=FALSE, values=1),
+    mxPath(from=latents3, to=indicators3[1], 
+           arrows=1, 
+           free=FALSE, values=1),
+    mxPath(from=indicators, 
+           arrows=2, 
+           free=TRUE, values=.2, 
+           labels=uniqueLabels),
+    mxPath(from=latents,
+           arrows=2, 
+           free=TRUE, values=.8, 
+           labels=factorVarLabels),
+    mxPath(from="one", to=indicators, 
+           arrows=1, free=FALSE, values=0),
+    mxPath(from="one", to=c(latents), 
+           arrows=1, free=TRUE, values=.1, 
+           labels=meanLabels),
+    mxCI(c('A', 'S')),
+    mxData(observed=cov(YFrame), means=mean(YFrame), 
+	numObs=nrow(YFrame), type="cov")
+    )
+
+threeFactorOrthogonalOut <- mxRun(threeFactorOrthogonal)
+threeFactorCI <- omxParallelCI(threeFactorOrthogonalOut)
+
+totalTime <- threeFactorCI at output$wallTime
+seqTime <- threeFactorOrthogonalOut at output$wallTime
+
+print(ncpus)
+print(totalTime - seqTime)
+
+sfStop()


Property changes on: SwiftApps/SwiftR/mxtests/swift/RAM-3Factor-96Indicators-covdata-a.R
___________________________________________________________________
Name: svn:mergeinfo
   + 




More information about the Swift-commit mailing list