- OpenMx source tarballs are now up on our webserver (oops)
- Nobody took the bait to build IFA models with OpenMx (as far as I know)
- LISREL help
- Should we have type = “LISREL”?
- Implement plot() for lisrel
- Example in Rd using raw data and means matrices
library(pwr) | |
power.t.test(n = 300, delta = NULL, sd = 1, sig.level = 0.05, power = .8, type = "paired", alternative = "one.sided") | |
# Paired t test power calculation | |
# | |
# n = 300 | |
# delta = 0.1438957 | |
# sd = 1 | |
# sig.level = 0.05 | |
# power = 0.8 | |
# alternative = one.sided |
library(OpenMx) | |
manifests = c("mpg", "disp", "gear") | |
# ============================= | |
# = simple independence model = | |
# ============================= | |
m1 <- mxModel("ind", type = "RAM", | |
manifestVars = manifests, | |
mxPath(from = manifests, arrows = 2), | |
mxPath(from = "one", to = manifests), |
# R version 3.0.3 (2014-03-06) -- "Warm Puppy" | |
source("http://openmx.psyc.virginia.edu/getOpenMxBeta.R") | |
library("OpenMx") | |
packageVersion("OpenMx") # [1] ‘999.0.0.3473’ | |
data(demoOneFactor) | |
manifests <- names(demoOneFactor) | |
latents <- c("G") | |
model <- mxModel(model="One Factor", type="RAM", |
message("load me with devtools::source_gist('11326436')") |
# http://openmx.psyc.virginia.edu/getOpenMxBeta.R | |
if(version$major < 3) { | |
stop("We don't have beta for R 2.15 or below. Consider upgrading to R 3.1?\n | |
You can get this from http://cran.r-project.org/") | |
} | |
if (.Platform$OS.type == "windows") { | |
if (!is.null(.Platform$r_arch) && .Platform$r_arch == "x64") { | |
repos <- c('http://openmx.psyc.virginia.edu/testing/') | |
} else { |
# http://openmx.psyc.virginia.edu/getOpenMx.R | |
# run this as | |
# source_gist(11294078) | |
if (.Platform$OS.type == "windows") { | |
if (!is.null(.Platform$r_arch) && .Platform$r_arch == "x64") { | |
repos <- c('http://openmx.psyc.virginia.edu/packages/') | |
} else { | |
repos <- c('http://openmx.psyc.virginia.edu/32bit/') | |
} | |
install.packages(pkgs = c('OpenMx'), repos = repos) |
# Generate a 25-item test | |
nItems = 25 | |
nOptions = 4 | |
passCriterion = 3 # or better | |
correct_answers = sample(c(1:nOptions), nItems, replace = TRUE) | |
# =================================== | |
# = Generate 10000 random responses = | |
# =================================== |
# mixture distribution.. | |
n = 100000; | |
distOne = rnorm(n, 50, 10) | |
distTwo = rnorm(n, 120, 15) | |
x = c(distOne,distTwo) | |
hist(x) | |
psych::kurtosi(x);psych::skew(x); | |
# DV <- sum of unobserved IVs | |
x = distOne + distTwo |
# Things you should learn in school: Be able to answer any question of the form: | |
# "Which has more gravitational pull on a baby as it is born: the midwife, or the planet Jupiter?" | |
# baby ~ 5 kg | |
# Distance and mass of [Jupiter](http://en.wikipedia.org/wiki/Jupiter) | |
gravitationalAttraction <- function(G = 6.674E-11, m1, m2, r){ | |
# G = 6.674E-11 # [Gravitational constant](http://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation): N m^2 kg^-2 | |
G * (m1 * m2)/r^2 | |
} |