Dear Lisa, As I said, I don't have a whole lot of time today. At a quick glance, you simulation seems straightfoward except for
> F_i ~ N(mu_i, Phi). > > mu_i is fixed to Phi*z_i, where z_i is a 5x1 vector. Why don't the factors have 0 means? I assumethat Phi is a correlation matrix. John On Tue, 8 Nov 2011 22:16:53 +0100 Lisa Pham <lisamlp...@gmail.com> wrote: > Dear John, > > Thank you for your reply. My data is actually simulated under the model X > = Lambda*F + E. > > Since my post, I've simplified the simulation of my data and I still get > the error. This is what I've done since my last post. > > I constructed Lambda apriori (so I know exactly which observed variables > load onto which factors), E follows a Gaussian with mean 0 and var-cov > matrix given by the Identity matrix. > > For my particular model, I sample the factor scores F_i (for sample i) from > a multivariate normal > > F_i ~ N(mu_i, Phi). > > mu_i is fixed to Phi*z_i, where z_i is a 5x1 vector. > > Thinking I could have an ill-conditioned var-cov matrix, I looked at the > condition number of Phi (the factor var-cov matrix). I recently adjusted > Phi to ensure that the condition number was indeed small (it is now about > 2). > > I then sample Y_i ~ N(Lambda*F_i, Psi). > > If the data I'm simulating is ill conditioned, I'm not even sure how to fix > it because the simulation itself is pretty straightforward. Even with a > well conditioned factor var-cov matrix Phi that I used to sample my factor > scores, I still get that same problem. > > In any case, I am so grateful for your help- I've been working on this all > day and I can't seem to figure out where I go wrong. I made Lambda pretty > sparse and with 150 samples, I certainly don't have too many parameters... > besides identifiability, I'm not sure what to check for if its not a > problem with my coding. Your post has already helped me to think about > this problem a little differently. > > Sincerely, > Lisa > > > On Tue, Nov 8, 2011 at 9:32 PM, John Fox <j...@mcmaster.ca> wrote: > > > Dear Lisa, > > > > There doesn't seem to be anything logically wrong with your model. > > > > I don't have much time today to look into it, but trying different > > optimizers in version 2.0-0 of sem, using the correlation matrix in place > > of the covariance matrix, and setting the par.size parameter, I was unable > > to obtain an admissible solution. I also was unable using factanal() to fit > > an exploratory factor analysis for five factors to your data. I expect that > > the problem is ill-conditioned. > > > > Best, > > John > > > > ------------------------------------------------ > > John Fox > > Sen. William McMaster Prof. of Social Statistics > > Department of Sociology > > McMaster University > > Hamilton, Ontario, Canada > > http://socserv.mcmaster.ca/jfox/ > > On Tue, 8 Nov 2011 08:18:28 -0800 (PST) > > lisamp85 <lisamlp...@gmail.com> wrote: > > > Hello. > > > > > > I started using the sem package in R and after a lot of searching and > > trying > > > things I am still having difficulty. I get the following error message > > when > > > I use the sem() function: > > > > > > Warning message: > > > 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. > > > > > > I started with a simple example using the specify.model() function, but > > it > > > is really straight forward. I uploaded my specify.model script and my > > data > > > covariance matrix here too so I wouldn't clutter this email with the > > entire > > > model (20 observed variables, 5 factors). Could this error message be > > from > > > the data itself and not from my path model? > > > > > > I have my observed variables X and my unobserved variables F. I have > > ONLY > > > exogenous latent variables (i.e. they never appear on the right side of > > the > > > single head arrow ->). I include all possible factor covariances FjFk, > > and > > > the only constraints I've made was to restrict the Factor variances to 1. > > > My model follows in this basic format (as you can see from my uploaded > > > file): > > > > > > # Factors (where I specify which observed variables load on to which > > > factors) > > > # I have only exogenous latent variables > > > F.i -> X.j, lamj.i, NA > > > . > > > . > > > . > > > # Observed variable variances > > > X.j <-> X.j, ej, NA > > > . > > > . > > > . > > > # Factor variances (I fixed all factor variances to 1) > > > F.i <-> F.i, NA, 1 > > > . > > > . > > > . > > > # Factor covariances (I represent all factor covariances, i.e. the upper > > or > > > lower triangle of a covariance matrix) > > > F.i <-> F.k, FiFk, NA > > > . > > > . > > > . > > > > > > Did I do something wrong here? > > > Here are my uploaded files: > > > CFA script: http://r.789695.n4.nabble.com/file/n4016569/CFA_script.txt > > > CFA_script.txt > > > Covariance matrix: > > > http://r.789695.n4.nabble.com/file/n4016569/covariance_matrix.RData > > > covariance_matrix.RData > > > > > > > > > Thank you so much for any and all of your help. > > > Lisa > > > > > > -- > > > View this message in context: > > http://r.789695.n4.nabble.com/Help-with-SEM-package-Error-message-tp4016569p4016569.html > > > Sent from the R help mailing list archive at Nabble.com. > > > > > > ______________________________________________ > > > R-help@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. > > > > > > > > > > > -- > ************************** > Lisa Pham > PhD Candidate > Department of Biomedical Engineering > Bioinformatics Program > Boston University > > To raise new questions, new possibilities, to regard old problems from a > new angle, requires creative imagination and marks real advance in science. > - Albert Einstein ------------------------------------------------ John Fox Sen. William McMaster Prof. of Social Statistics Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ ______________________________________________ R-help@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.