Hi,

Finally I managed to fit a longitudinal one- factor model but now I received the following warning message:

NPSOL returned a non-zero status code 6. The model does not satisfy the first-order optimality conditions to the required accuracy, and no improved point for the merit function could be found during the final linesearch (Mx status RED)

As I am a beginner in OpenMX suggestions and any help is very welcome.

Thanks in advance!

###### #

This is my code:

###### #

## create observed covariance matrix

obsnames = c("extrT1","beneT1","conscT1","emostT1","imagT1",

"extrT2","beneT2","conscT2","emostT2","imagT2",

"extrT3","beneT3","conscT3","emostT3","imagT3")

obslabels = list (obsnames,obsnames)

values = c(

1.00,

-.05, 1.00,

-.00, .40, 1.00,

.46, .12, .14, 1.00,

.46, .12, .55, .39, 1.00,

.77, -.02, .06, .31, .36, 1.00,

-.15, .72, .28, .02, .01, -.03, 1.00,

-.07, .33, .79, .07, .43, .03, .41, 1.00,

.32, .10, .20, .70, .40, .43, .12, .19, 1.00,

.26, .09, .48, .29, .80, .39, .13, .57, .45, 1.00,

.31, .00, .11, .29, .29, .79, -.01, .07, .33, .24, 1.00,

-.05, .58, .25, -.04, -.01, -.04, .70, .33, .01, .08, .07, 1.00,

.05, .25, .64, -.01, .29, .07, .31, .75, .06, .41, .16, .51, 1.00,

.27, .07, .24, .58, -.04, .32, .05, .20, .66, .38, .44, .13, .14, 1.00,

.31, .09, .45, .29, .58, .34, .14, .51, .39, .79, .43, .22, .55, .49, 1.00)

SD = c(0.43,0.43,0.53,0.51,0.49,0.44,0.39,0.55,0.48,0.50,0.43,0.38,0.54,0.42,0.48)

akkercov = SEM_obsmatrix(lowtri=values,SD=SD,labels=obslabels)

akkercov

petrmeans = c(3.49,3.50,3.43,3.48,3.69,3.40,3.56,3.41,3.52,3.63,3.32,3.52,3.26,3.52,3.47)

names(petrmeans) = obsnames

akkercov = Matrix::nearPD(akkercov)$mat

akkercov=as.matrix(akkercov)

akkercov

factornames = c('PerTrait_1','PerTrait_2','PerTrait_3')

obslabels = list (obsnames, obsnames)

factorlabels = list (factornames, factornames)

lambdalabels = list (obsnames, factornames)

taulabels = list(obsnames,"Intercept")

kappalabels = list (factornames, "Factor mean")

## Fit a longitudinal one-factor model

title = " Factor model Personality traits at 3 timepoints"

obs = mxData(observed = akkercov, type = 'cov', means = petrmeans, numObs = 290)

## lambda matrix: factor loadings

matrixL = mxMatrix(

type = 'Full',

nrow = 15,

ncol = 3,

free = c(TRUE,FALSE,FALSE,

TRUE,FALSE,FALSE,

TRUE,FALSE,FALSE,

TRUE,FALSE,FALSE,

TRUE,FALSE,FALSE,

FALSE,TRUE,FALSE,

FALSE,TRUE,FALSE,

FALSE,TRUE,FALSE,

FALSE,TRUE,FALSE,

FALSE,TRUE,FALSE,

FALSE,FALSE,TRUE,

FALSE,FALSE,TRUE,

FALSE,FALSE,TRUE,

FALSE,FALSE,TRUE,

FALSE,FALSE,TRUE),

values = c (1,0,0,

1,0,0,

1,0,0,

1,0,0,

1,0,0,

0,1,0,

0,1,0,

0,1,0,

0,1,0,

0,1,0,

0,0,1,

0,0,1,

0,0,1,

0,0,1,

0,0,1),

labels = c("L11t1",NA,NA,

"L21t1",NA,NA,

"L31t1",NA,NA,

"L41t1",NA,NA,

"L51t1",NA,NA,

NA,"L11t2",NA,

NA,"L21t2",NA,

NA,"L31t2",NA,

NA,"L41t2",NA,

NA,"L51t2",NA,

NA,NA,"L11t3",

NA,NA,"L21t3",

NA,NA,"L31t3",

NA,NA,"L41t3",

NA,NA,"L51t3"),

byrow = TRUE,

name = 'L',

dimnames = lambdalabels)

## F matrix: contains variances and covariances of the common factors

matrixF = mxMatrix(

type = 'Symm',

nrow = 3,

ncol = 3,

free = c( FALSE,

TRUE,FALSE,

TRUE,TRUE,FALSE),

```
values = c( 1,
.5,1,
.5,.5,1),
byrow = TRUE,
name = 'F',
dimnames = factorlabels)
```

## Q matrix: contains variances of the residual factors

matrixQ = mxMatrix(

type = 'Symm',

nrow = 15,

ncol = 15,

```
free = c(TRUE,
FALSE,TRUE,
FALSE,FALSE,TRUE,
FALSE,FALSE,FALSE,TRUE,
FALSE,FALSE,FALSE,FALSE,TRUE,
TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,
FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,
FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,
FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,
FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,
FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,
FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,
FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,
FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE,
FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,TRUE,FALSE,FALSE,FALSE,FALSE,TRUE),
values = c(1,
0,1,
0,0,1,
0,0,0,1,
0,0,0,0,1,
.1,0,0,0,0,1,
0,.1,0,0,0,0,1,
0,0,.1,0,0,0,0,1,
0,0,0,.1,0,0,0,0,1,
0,0,0,0,.1,0,0,0,0,1,
0,0,0,0,0,.1,0,0,0,0,1,
0,0,0,0,0,0,.1,0,0,0,0,1,
0,0,0,0,0,0,0,.1,0,0,0,0,1,
0,0,0,0,0,0,0,0,.1,0,0,0,0,1,
0,0,0,0,0,0,0,0,0,.1,0,0,0,0,1),
byrow = TRUE,
name = 'Q',
dimnames = obslabels)
```

## matrix T: is a full matrix with intercepts, with rows equal to Nr of observed variables, and one column. All intercepts are free to be estimnated

matrixT = mxMatrix(

type = 'Full',

nrow = 15,

ncol = 1,

```
free = c(TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE),
values = c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1),
labels = c("t11","t12","t13","t14","t15",
"t21","t22","t23","t24","t25",
"t31","t32","t33","t34","t35"),
byrow = TRUE,
name = 'T',
dimnames = taulabels)
```

## matrix K is a full matrix with common factor means

matrixK = mxMatrix(

type = 'Full',

nrow = 3,

ncol = 1,

```
free = c(FALSE,FALSE,FALSE),
values = c(0,0,0),
byrow = TRUE,
name = 'K',
dimnames = kappalabels)
```

conf = mxCI ("K",interval = .90)

algebraS = mxAlgebra(expression = L %*% F %*% t(L) + Q, name = 'S', dimnames = obslabels)

algebraM = mxAlgebra(expression = t(T + L%*%K), name = 'M', dimnames = list("mean",obsnames))

exp = mxMLObjective(covariance = 'S', means = 'M')

longmodel = mxModel(title,obs,

matrixL,matrixF,matrixQ,matrixT,matrixK,algebraS,algebraM,exp,conf)

longmodelOut = mxRun(longmodel, intervals = TRUE)

summary(longmodelOut)