Hi all,

I want to fit a one fatcor longitudinal model at three measuremet time points based on an observed covariance/correlation matrix from an published article. Unfortunately I get the following error message when running the obs function, see below.

This is the error:

Error: The observed covariance matrix is not a positive-definite matrix

It would be great if somebody could help with some suggestions!

This is the beginning of the 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)

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

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)