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)
 
library("sem")
#put in "mydata", the value of the questions
mydata <- data.frame(X$X12a,X$X12b,X$X12c,X$X12d,X$X12e,X$X12f,X$X12g,X$X12h,X$X12i,X$X12l,X$X12m,X$X12n,X$X12o,X$X12p,X$X12q,X$X12r,X$X12s,X$X1a,X$X1b,X$X1c,X$X1d,X$X1e,X$X1f,X$X3h,X$X3i,X$X3l,X$X3m,X$X3n,X$X3o,X$X3p,X$X3q,X$X3r,X$X3s,X$X3t,X$X3u,X$X3v,X$X4a,X$X5q,X$X5r,X$X5s,X$X8a,X$X8b,X$X8c,X$X8d)
#i calculate the covariance of the data
mydata.cov <- cov(mydata,use="complete.obs")
#I specify my model
model.mydata <- specify.model() 
F1 ->  X.X12a, lam1, NA
F1 ->  X.X12b, lam2, NA 
F1 ->  X.X12c, lam3, NA
F1 ->  X.X12d, lam4, NA
F1 ->  X.X12e, lam5, NA 
F1 ->  X.X12f, lam6, NA
F1 ->  X.X12g, lam7, NA
F2 ->  X.X12h, lam8, NA 
F2 ->  X.X12i, lam9, NA 
F2 ->  X.X12l, lam10, NA 
F2 ->  X.X12m, lam11, NA 
F2 ->  X.X12n, lam12, NA 
F2 ->  X.X12o, lam13, NA 
F3 ->  X.X12p, lam14, NA 
F3 ->  X.X12q, lam15, NA 
F3 ->  X.X12r, lam16, NA 
F3 ->  X.X12s, lam17, NA 
F4 ->  X.X1a, lam18, NA 
F4 ->  X.X1b, lam19, NA 
F4 ->  X.X1c, lam20, NA 
F4 ->  X.X1d, lam21, NA 
F4 ->  X.X1e, lam22, NA 
F4 ->  X.X1f, lam23, NA 
F5 ->  X.X3h, lam24, NA 
F5 ->  X.X3i, lam25, NA 
F5 ->  X.X3l, lam26, NA 
F5 ->  X.X3m, lam27, NA 
F5 ->  X.X3n, lam28, NA 
F5 ->  X.X3o, lam29, NA 
F5 ->  X.X3p, lam30, NA 
F5 ->  X.X3q, lam31, NA 
F6 ->  X.X3r, lam32, NA 
F6 ->  X.X3s, lam33, NA 
F6 ->  X.X3t, lam34, NA 
F6 ->  X.X3u, lam35, NA 
F6 ->  X.X3v, lam36, NA 
F6 ->  X.X4a, lam37, NA 
F7 ->  X.X5q, lam38, NA 
F7 ->  X.X5r, lam39, NA
F7 ->  X.X5s, lam40, NA
F8 ->  X.X8a, lam41, NA
F8 ->  X.X8b, lam42, NA
F8 ->  X.X8c, lam43, NA
F8 ->  X.X8d, lam44, NA
X.X12a <-> X.X12a, e1,   NA 
X.X12b <-> X.X12b, e2,   NA 
X.X12c <-> X.X12c, e3,   NA 
X.X12d <-> X.X12d, e4,   NA 
X.X12e <-> X.X12e, e5,   NA 
X.X12f <-> X.X12f, e6,   NA 
X.X12g <-> X.X12g, e7,   NA 
X.X12h <-> X.X12h, e8,   NA 
X.X12i <-> X.X12i, e9,   NA 
X.X12l <-> X.X12l, e10,   NA 
X.X12m <-> X.X12m, e11,   NA 
X.X12n <-> X.X12n, e12,   NA
X.X12o <-> X.X12o, e13,   NA
X.X12p <-> X.X12p, e14,   NA
X.X12q <-> X.X12q, e15,   NA
X.X12r <-> X.X12r, e16,   NA
X.X12s <-> X.X12s, e17,   NA
X.X1a <-> X.X1a, e18,   NA
X.X1b <-> X.X1b, e19,   NA
X.X1c <-> X.X1c, e20,   NA
X.X1d <-> X.X1d, e21,   NA
X.X1e <-> X.X1e, e22,   NA
X.X1f <-> X.X1f, e23,   NA
X.X3h <-> X.X3h, e24,   NA
X.X3i <-> X.X3i, e25,   NA
X.X3l <-> X.X3l, e26,   NA
X.X3m <-> X.X3m, e27,   NA
X.X3n <-> X.X3n, e28,   NA
X.X3o <-> X.X3o, e29,   NA
X.X3p <-> X.X3p, e30,   NA
X.X3q <-> X.X3q, e31,   NA
X.X3r <-> X.X3r, e32,   NA
X.X3s <-> X.X3s, e33,   NA
X.X3t <-> X.X3t, e34,   NA
X.X3u <-> X.X3u, e35,   NA
X.X3v <-> X.X3v, e36,   NA
X.X4a <-> X.X4a, e37,   NA
X.X5q <-> X.X5q, e38,   NA
X.X5r <-> X.X5r, e39,   NA
X.X5s <-> X.X5s, e40,   NA
X.X8a <-> X.X8a, e41,   NA
X.X8b <-> X.X8b, e42,   NA
X.X8c <-> X.X8c, e43,   NA
X.X8d <-> X.X8d, e44,   NA
F1 <-> F1, NA, 1 
F2 <-> F2, NA, 1 
F3 <-> F3, NA, 1 
F4 <-> F4, NA, 1 
F5 <-> F5, NA, 1 
F6 <-> F6, NA, 1 
F7 <-> F7, NA, 1 
F8 <-> F8, NA, 1 
 
mydata.sem <- sem(model.mydata, mydata.cov, nrow(mydata))
# print results (fit indices, paramters, hypothesis tests) 
summary(mydata.sem)
# print standardized coefficients (loadings) 
std.coef(mydata.sem) 

 
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???
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???
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,  :
  S is not positive-definite: expect problems
3: In sem.default(ram = ram, S = S, N = N, param.names = pars, var.names = vars,  :
  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

What i can do for all this????
 
Hoping in your interest about this problem, i wish you the best.
 
Costantino Milanese, a young researcher full of problems!
	[[alternative HTML version deleted]]


