folks,
short and sweet: how can OpenMx access user-written functions and functions from other packages? e.g., i would like to access alpha and sumx in the following code:
alpha <- .3
sumx <- function (x) {
sum(x)
}
x <- c(1, 2, 3)
testModel <- mxModel("testModel", mxAlgebra(expression="alpha * sumx(x)", name="test"))
mxRun(testModel)
gory and detailed: i can certainly do this using mxMatrix and mxAlgebra statements, but the problem that i am dealing with is much more complex. it involves analyzing symptom count data in twins where there are lots of 0 counts, fewer counts of 1, etc. i assume that the count data follow poisson processes for twin 1 and twin2 (with respective parameters lambda1 and lambda2) and that lambda1 and lambda2 are random variables distributed as a bivariate gamma that allows for a correlation between lambda1 and lambda2.
to accomplish this, i need to integrate the bivariate gamma over lambda1 and lambda2. the easiest way to do this is to access numerical quadrature routines that are external to the OpenMx functions.
any help is greatly appreciated.
greg