Re: object FLAT not found

2,669 views
Skip to first unread message
Message has been deleted

Josephine Grenzer

unread,
Feb 10, 2014, 11:00:29 AM2/10/14
to lav...@googlegroups.com


Am Montag, 10. Februar 2014 16:51:45 UTC+1 schrieb Josephine Grenzer:
Hello :)

i'm new in statistics in R still learned some basics and easy models.

I downloaded the lavaan package and followed the tutorial of Jim Grace (http://www.structuralequations.org/)

read data and define model was fine but when i fit the model i got a warning

> mod1.fit<-sem(mod1, data=k.dat)
Error in lavaan::lavaan(model = mod1, data = k.dat, model.type = "sem",  : 
  object 'FLAT' not found

I use R Studios and R 3.0.2
if i tip sem and lavaan::lavaan i get the function code so i would expact that the instalation was ok 

i do not know what could be wrong in my syntax :(

So please help me :D

yrosseel

unread,
Feb 10, 2014, 11:26:35 AM2/10/14
to lav...@googlegroups.com
On 02/10/2014 05:00 PM, Josephine Grenzer wrote:
> mod1.fit<-sem(mod1, data=k.dat)
> Error in lavaan::lavaan(model = mod1, data = k.dat, model.type =
> "sem", :
> object 'FLAT' not found

Hm. Can we see your full R syntax?

Yves.

Josephine Grenzer

unread,
Feb 10, 2014, 11:50:37 AM2/10/14
to lav...@googlegroups.com
this is my script

k.dat<-read.csv("./Keeley_rawdata_select4.csv")
names(k.dat)
head(k.dat)
library(lavaan)
mod1 <- 'cover ~ age + firesev'
mod1.fit <- sem(mod1, data=k.dat)

Am Montag, 10. Februar 2014 16:51:45 UTC+1 schrieb Josephine Grenzer:
Hello :)

i'm new in statistics in R still learned some basics and easy models.

I downloaded the lavaan package and followed the tutorial of Jim Grace (http://www.structuralequations.org/)

read data and define model was fine but when i fit the model i got a warning

> mod1.fit<-sem(mod1, data=k.dat)
Error in lavaan::lavaan(model = mod1, data = k.dat, model.type = "sem",  : 
  object 'FLAT' not found

Josephine Grenzer

unread,
Feb 10, 2014, 12:08:34 PM2/10/14
to lav...@googlegroups.com
It must be something with my data? The lavaan tutorial worked using the data included in the package

yrosseel

unread,
Feb 10, 2014, 1:13:53 PM2/10/14
to lav...@googlegroups.com
On 02/10/2014 05:50 PM, Josephine Grenzer wrote:
> this is my script
>
> k.dat<-read.csv("./Keeley_rawdata_select4.csv")
> names(k.dat)
> head(k.dat)
> library(lavaan)
> mod1 <- 'cover ~ age + firesev'

> mod1.fit <- sem(mod1, data=k.dat)

Hm. Nothing wrong with this. Could you send me the data (or just a
snippet, just enough to replicate your error?

Yves.

Josephine Grenzer

unread,
Feb 10, 2014, 2:10:21 PM2/10/14
to lav...@googlegroups.com
I fixed the Problem it was a biginner's mistake ^^ 

Chris Gibbons

unread,
Feb 17, 2014, 9:47:15 AM2/17/14
to lav...@googlegroups.com
Can you let us know what the beginner's mistake was? I now have the same error for my CFA model 

yrosseel

unread,
Feb 19, 2014, 5:05:38 AM2/19/14
to lav...@googlegroups.com
On 02/17/2014 03:47 PM, Chris Gibbons wrote:
> Can you let us know what the beginner's mistake was? I now have the same
> error for my CFA model

Could either of you send me the R script? I'm curious what triggers this
too.

Yves.

Josephine Grenzer

unread,
Feb 19, 2014, 5:10:57 AM2/19/14
to lav...@googlegroups.com
In my case it was a syntax error used "  '' looks same but are different :D




--
You received this message because you are subscribed to a topic in the Google Groups "lavaan" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/lavaan/McbUhu82xQY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to lavaan+unsubscribe@googlegroups.com.
To post to this group, send email to lav...@googlegroups.com.
Visit this group at http://groups.google.com/group/lavaan.
For more options, visit https://groups.google.com/groups/opt_out.

cas...@jvrafrica.co.za

unread,
Feb 21, 2014, 7:43:01 AM2/21/14
to lav...@googlegroups.com
Hi 

Is there any news on what causes this problem. I ran a cfa model successfully, but get the same feedback when trying to run the measurement invariance command on the same model. Any ideas?



IMPORTANT: This email and any attachments are intended solely for the addressee(s) and may be confidential. Access to this message by anyone else is unauthorised. If you have received it in error, please delete it from your system, do not use or disclose the information in any way, and notify the sender immediately. The contents of this message may contain personal views, which do not necessarily reflect the views of the JvR Africa Group.

Any attachment to this message has been checked for viruses but please rely on your own virus checker and procedures.

yrosseel

unread,
Feb 21, 2014, 9:41:52 AM2/21/14
to lav...@googlegroups.com
On 02/21/2014 01:43 PM, cas...@jvrafrica.co.za wrote:
> Hi
>
> Is there any news on what causes this problem. I ran a cfa model
> successfully, but get the same feedback when trying to run the
> measurement invariance command on the same model. Any ideas?

just for future reference: the problem here was that the first argument
of the measurementInvariance() function must be the model syntax (not a
fitted object).

Yves.

StazLuver

unread,
Jul 21, 2015, 9:47:52 AM7/21/15
to lav...@googlegroups.com
Hello,
I don't understand the solution. Here's my syntax and error message in R Studio:

## First, defining my latent variables goes off without a hitch (except that I learned that " works and ' does not, contrary to the example provided on p. 12 of this article http://www.ncbi.nlm.nih.gov/pmc/articles/PMC3996839/pdf/nihms419622.pdf )

> PANAS.model <- "NA=~ P1Ups + P2Hos + P4Ash + P6Ner + P9Afr+ A2P1Ups + A2P2Hos + A2P4Ash + A2P6Ner + A2P9Afr+ A3P1Ups + A3P2Hos + A3P4Ash + A3P6Ner + A3P9Afr PA=~ P3Ale + P5Ins + P7Det + P8Att + P10Act +  A2P3Ale + P5Ins + A2P7Det + A2P8Att + A2P10Act + A3P3Ale + P5Ins + A3P7Det + A3P8Att + A3P10Act"

## Then I get this error when I try to fit the model

> Fit <- cfa(PANAS.model , data = joliedisssimpilot6272015clean2,std.lv=TRUE)
Error in ~P1Ups + P2Hos + P4Ash + P6Ner + P9Afr + A2P1Ups + A2P2Hos +  : 
  object 'P1Ups' not found

## It keeps on not finding P1Ups when it is clearly there. I tried to make a data frame with these variables (even though that's all that's in the data set), and get a similar error:

> Data <- data.frame( P1Ups =P1Ups, P2Hos= P2Hos, P4Ash =P4Ash, P6Ner =P6Ner, P9Afr =P9Afr, A2P1Ups = A2P1Ups, A2P2Hos = A2P1Ups,  A2P4Ash = A2P4Ash,  A2P6Ner = A2P6Ner,  A2P9Afr = A2P9Afr,  A3P1Ups = A3P1Ups,  A3P2Hos = A3P2Hos,  A3P4Ash = A3P4Ash,  A3P6Ner = A3P6Ner,  A3P9Afr= A3P9Afr, P3Ale = P3Ale, P5Ins = P5Ins,  P7Det = P7Det,  P8Att = P8Att,  P10Act = P10Act,   A2P3Ale = A2P3Ale, P5Ins = P5Ins,  A2P7Det = A2P7Det,  A2P8Att = A2P8Att,  A2P10Act= A2P10Act,  A3P3Ale = A3P3Ale,  P5Ins = P5Ins,  A3P7Det = A3P7Det,  A3P8Att = A3P8Att,  A3P10Act= A3P10Act)
Error in data.frame(P1Ups = P1Ups, P2Hos = P2Hos, P4Ash = P4Ash, P6Ner = P6Ner,  : 
  object 'P1Ups' not found


## Any thoughts/ help are greatly appreciated!
Reply all
Reply to author
Forward
0 new messages