[R] HELP WITH SEM LIBRARY AND WITH THE MODEL'S SPECIFICATION

John Fox jfox at mcmaster.ca
Mon Mar 30 19:12:45 CEST 2009


Dear Costantino,

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On
> Behalf Of Analisi Dati
> Sent: March-30-09 11:13 AM
> To: r-help at r-project.org
> Subject: [R] HELP WITH SEM LIBRARY AND WITH THE MODEL'S SPECIFICATION
> 
> Dear users,
> i'm using the sem package in R, because i need to improve a confermative
> factor analisys.
> I have so many questions in my survey, and i suppose, for example,  that
> Question 1 (Q1) Q2 and Q3 explain the same thing (factor F1), Q4,Q5 and Q6
> explain F2 and Q7 and Q8 explain F3...
> For check that what i supposed is true, i run this code to see if the
values
> of loadings are big or not.
> (In this code i used more than 3 factors)
> 

. . . (many lines elided)

> 
> 
> Now the problems, and my questions, are various:
> 1)In "mydata" i need to have only the questions or also my latent
variables?
> In other words, i suppose that the mean of  Q1,Q2,Q3 give me a variable
> called "OCB". In mydata i need also this mean???

No. sem() recognizes as latent variables (F1, F2, etc.) those variables that
do not appear in the observed-variable covariance matrix. There are several
examples in ?sem that illustrate this point. Moreover, the latent variables
are not in general simply means of observed variables.

> 2)In the specification of my model, i didn't use nothing like "F1<-
> >F2......", is this a problem? this sentence what indicates??? that i have
a
> mediation/moderation effect between variables???

By not specifying F1 <-> F2, you imply that the factors F1 and F2 are
uncorrelated. This isn't illogical, but it produces a very restrictive
model. Conversely, specifying F1 <-> F2 causes the covariance of F1 and F2
to be estimated; because you set the variances of the factors to 1, this
covariance would be the factor correlation.

> 3)Now, if you look my code,you could see that i don't put in "mydata" the
> mean value called "OCB" (see point 1), and i don't write nothing about the
> relation between F1 and F2, and when i run the sem function i receive
these
> warnings:
> 
> 1: In sem.default(ram = ram, S = S, N = N, param.names = pars, var.names =
> vars,  :
>   S is numerically singular: expect problems
> 2: In sem.default(ram = ram, S = S, N = N, param.names = pars, var.names =
> vars,  :

That seems to me a reasonably informative error message: The
observed-variable covariance matrix is singular. This could happen, e.g., if
two observed variables are perfectly correlated, if an observed variable had
0 variance, or if there were more observed variables than observations.

>   S is not positive-definite: expect problems
> 3: In sem.default(ram = ram, S = S, N = N, param.names = pars, var.names =
> vars,  :

That S is singular implies that it is not positive-definite, but because a
non-singular matrix need not be positive-definite, sem() checks for both.

>   Could not compute QR decomposition of Hessian.
> Optimization probably did not converge.
> 
> and after the summary i receive this error:
> 
>  coefficient covariances cannot be computed

These are the problems that sem() told you to expect.

> 
> What i can do for all this????

Without more information, it's not possible to know. You should figure out
why the observed-variable covariance matrix is singular.

I hope this helps,
 John

> 
> Hoping in your interest about this problem, i wish you the best.
> 
> Costantino Milanese, a young researcher full of problems!
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list