Hi there,
I would really appreciate your help! I keep on getting the same error notification in my R output. I am trying to do a regression in a SEM with manifest variables. When I use the summary command I get this error:
Error in data.frame(lhs = NAMES, op = rep("r2", nel), rhs = NAMES, block = block, :
Row names contain missing values
I have created a simplified dataframe (which gets me the same error), so that I can share it with you.
This is my R-Code:
q <- data.frame(
a = c(1, 2, 3, 4, 3, 5, 9),
b = c(4, 4, 5, 6, 1, 1, 1),
c = c(3, 4, 2, 4, 1, 2, 1)
)
r <- data.frame(
d = c(4, 6, 1, 6, 8, 8, 8),
e = c(3, 7, 8, 8, 9, 4, 9),
f = c(9, 6, 2, 7, 7, 8, 9)
)
q$Ma <- apply(q, 1, mean, na.rm=T)
r$Mb <- apply(r, 1, mean, na.rm=T)
s <- cbind(q,r)
mod <- 'Ma ~ Mb
Mb ~~ Mb
Ma ~~ Ma
Mb ~ 1
Ma ~ 1'
fit <- lavaan(model=mod, data=s, meanstructure=TRUE, missing="fiml", fixed.x=FALSE)
summary(fit, fit.measures=TRUE, standardized=TRUE, rsquare=TRUE)
Without the 'rsquare=TRUE' it runs through, but I need the R².
I am using the newest version of both R and lavaan. I sent the R-Code to a friend and she didnt get any error messages.
So, I would be grateful for any ideas / suggestions what could cause the error.
Cheers, Simon