# Overriding of the S matrix in path notation

5 posts / 0 new Offline
Joined: 04/07/2010 - 19:07
Overriding of the S matrix in path notation

Hi,

I have a problem with the path notation. There's two factors. Their errors are freely correlated. Also, the factors are linked. The problem is: the S matrix depends on the order of arguments for mxModel. In one notation, S is over-ridden.

I'd be happy about any suggestions! Regards, Chris

Here's the code:

latentVars=c("t1","t2")
path_error=mxPath(
from=latentVars,
arrows=2,
all=T,
free=T
)

path_factor=mxPath(
from=latentVars,
to=latentVars,
arrows=1,
free=T
)

# The S matrix should be identical in those models (the arguments differ only in their order), but they aren't:

model_1 <- mxModel(type='RAM',latentVars=latentVars,path_error,path_factor)
model_2 <- mxModel(type='RAM',latentVars=latentVars,path_factor,path_error)
model_1$S@free model_2$S@free Offline
Joined: 07/31/2009 - 15:24
A question: in the

A question: in the specification of path_error, the all=TRUE is intentional? In other words, is the intention to create four two-headed arrows: (t1, t1), (t1, t2), (t2, t1), and (t2, t2)? If this is the case, then the two-headed arrow (t1, t2) is conflicting with the path_factor specification which is the one-headed arrow (t1, t2). Offline
Joined: 04/07/2010 - 19:07
Indeed, it is intended. I am

Indeed, it is intended. I am probably confused about the internal structure used. Let me express everything in the RAM notation v=Av+eps, V(eps)=S. And I thought that arrows=1 assigns to A and arrows=2 assigns to S. Here's what I want to do:

1. there exists a causal arrow from t1 to t2: A[t2,t1]!=0
2. The errors of t1 and t2 are freely correlated: S[t2,t1]!=0

How would I be able to express that? (In case you're wondering, that model is identified if there are other regressors present). Offline
Joined: 07/31/2009 - 15:12
The code you wrote looks

The code you wrote looks fine; the path_factor path should populate to the A matrix, and the path_error path to the S. The "all=TRUE" argument will create four terms for the t1-t2 covariance, when there are really only 3: the second covariance term will replace the first, but that shouldn't affect your path_factor piece.

Unless there are additional constraints that you're not referencing, the path_factor and path_error paths are redundant. Variables latentVars and latentVars have some linear relationship, and both the regression and the covariance/correlated error term (they're identical) restate that relationship. Simply including additional variables will not make the model identified; the model needs information about how to parse the singular linear relationship into two terms.

Either the regression, the covariance or both may be constrained in such a way to make the model identified; these constraints "tell" the model how to partition the t1-t2 covariance into regression and correlated error. However, you'd likely have to label at least one of the parameters you've created in the code above so that constraints could be made.

Could you tell us more about the model you're fitting? Offline
Joined: 04/07/2010 - 19:07
Thanks! In short: there are

Thanks! In short: there are other constraints. I am fitting a dynamic model with multidimensional factors. Call them F_0 (in period 0) and F_1 (in period 1).

The baseline model is this:

F_0=eps_0
F_1=G_0*F_0+eps_1

Which computes just fine. The problem comes about when I change the second equation to

F_1=G_0F_0+G_1F_1+eps_1

where G_1 of course has zero elements on the diagonal. Simple example:
G_0_free=matrix(c(T,F,F,T),nrow=2).
G_1_free=matrix(c(F,T,F,F),nrow=2).

I want to estimate
Var(eps_0),Var(eps_1), G_0 and G_1

and this model is identified (intuition: F_0 serves as instrumental variable for F_1 --- it provides three moment conditions, and there are only two parameters in G_0, so the third moment estimates the parameter in G_1). But when I specify the paths this way, I end up overriding my FREE parameters in the S matrix (the code in my first post was a boiled-down version).
I could solve F_1 out of the RHS and identify all matrices in
F_1=(I-G_1)^(-1)G_0F_0+(I-G_1)^(-1)eps_1
but this would create new problems, mostly because linear constraints in G_1 and G_0 turn into non-linear constraints in
(I-G_1)^(-1)
G_0.

Chris