On 7/9/19 8:11 PM, Andrew Grotzinger wrote:
> Hi Yves,
>
> Thanks very much for your quick reply and help! Setting the tolerance
> value to a much smaller number is working in most cases. I'm finding
> that there is still an instance where 0.6-3 will run but 0.6-4 prints an
> error even when using optim.dx.tol = +Inf. The model we are running is
> admittedly a bit strange, but we use it for follow-up models.
This one has nothing to do with the additional check. Run both models
with verbose = TRUE, and you will see it fails in 0.6-4.
It has to do with poor starting values. This is an atypical model, and
therefore, the automatically generated starting values for the factor
loadings are just '1' for all loadings. For this model, this turns out
to be a poor choice.
In 0.6-4, I added a check to make sure that the diagonal elements of the
model-implied covariance matrix are always positive. For some reason,
after three or four iterations, the parameters in this model do generate
negative diagonal variances. In 0.6-3, this was ignored (hoping for the
best), sometimes leading to good results, but also sometimes leading to
strange results. In 0.6-4, the objective value is now 'NA', prompting
the optimizer to change course. Usually, this works better, but in this
case, the optimizer does not recover.
Providing better starting values helps. For example:
Model1<-"F1 =~ NA*V1 + start(0.1)*V2 + V3 + V4 + V5
F1 ~~ 1*F1
VF1 =~ 1*V1
VF1 ~~ 0*VF1
V1 ~~ V1
VF2 =~ 1*V2
VF2 ~~ 0*VF2
V2 ~~ V2
VF1~~ 0*VF2
F1 =~ 0*VF1 + 0*VF2"
seems to work.
Alternatively, as 'V4' was the offending variable, this will also work
(in 0.6-4):
Model1<-"F1 =~ NA*V1 + V2 + V3 + V4 + V5
# 'force' residual variance to be positive
V4 ~~ lower(0)*V4
F1 ~~ 1*F1
VF1 =~ 1*V1
VF1 ~~ 0*VF1
V1 ~~ V1
VF2 =~ 1*V2
VF2 ~~ 0*VF2
V2 ~~ V2
VF1~~ 0*VF2
F1 =~ 0*VF1 + 0*VF2"
Yves.