You are here

Question about a dimnames error message

4 posts / 0 new
Last post
dkaplan's picture
Offline
Joined: 08/04/2009 - 16:00
Question about a dimnames error message

Greetings all,

I finally was able to get OpenMx going on my Mac. I am reading in some data and estimating a very small path model, just to get the hang of things. The syntax is

sciach <- read.table("~/Desktop/sciach.txt",header=TRUE)

require(OpenMx)

data(sciach)

manifests <- names(sciach)

sciachsimple <- sciach[,c("irtsci", "grades", "probsolv")]

pathmodel <- mxModel("path model",type="RAM",
mxData(observed=sciachsimple,type="raw"),
manifestVars = manifests,

 mxPath(from="probsolv", to="grades",arrows=1,free=TRUE),

 mxPath(from="grades", to="irtsci",arrows=1,free=TRUE),

mxPath(from=c("probsolv", "grades", "irtsci"),
            arrows=2,
            free=TRUE,
            values = c(1, 1, 1),
            labels=c("varx", "residual1", "residual2")),

mxPath(from="one",
            to=c("probsolv", "grades", "irtsci"),
            arrows=1,
            free=TRUE,
            values=c(1, 1, 1),
            labels=c("meanx","beta0grades", "beta0irtsci")))



pathmodelfit &lt;- mxRun(pathmodel)
pathmodelfit@output

summary(mxRun(pathmodel))

The error message I'm getting is

Error: The column name 'challeng' in the observed covariance matrix of the FIML objective function in model 'path model' cannot be found in the dimnames of the data.
> pathmodelfit@output
Error: object 'pathmodelfit' not found
>
> summary(mxRun(pathmodel))
Running path model
Error: The column name 'challeng' in the observed covariance matrix of the FIML objective function in model 'path model' cannot be found in the dimnames of the data.
Error in summary(mxRun(pathmodel)) :

error in evaluating the argument 'object' in selecting a method for function 'summary'

The variable "challeng" is in the sciach dataset but I thought I correctly selected only the variables I wanted using the line sciachsimple <- sciach[,c("irtsci", "grades", "probsolv")] from above.

Thoughts?

Thanks in advance.

David

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
I think you need to set

I think you need to set manifests <- names(sciachsimple). Inferring from the error message, it looks like you're specifying some manifest variables that do not exist in the subset of the dataset that you are using.

twalls's picture
Offline
Joined: 08/26/2009 - 13:59
I am getting the same or

I am getting the same or similar error message:

Running FIML Multiple Regression of Z1, Z2, Z3, Z4 on x1, x2, x3, x4
Error: The column name 'Z1' in the observed covariance matrix of the FIML objective function in model 'FIML Multiple Regression of Z1, Z2, Z3, Z4 on x1, x2, x3, x4' cannot be found in the dimnames of the data.

mspiegel's picture
Offline
Joined: 07/31/2009 - 15:24
Sorry, it looks like there is

Sorry, it looks like there is a typo in the error message. It should read:

The column name 'Z1' in the expected covariance matrix of the FIML objective function in model 'FIML Multiple Regression of Z1, Z2, Z3, Z4 on x1, x2, x3, x4' cannot be found in the dimnames of the data.

The dataset used in the model must have column names. The expected covariance matrix that you specify in your model must also have column names. These two quantities do not have to be of the same length, or appear in the same order. But the column names in the expected covariance matrix should be a subset of the column names in the dataset.