Can anyone advise how best to account for measurement error (as measure by Cronbach's alpha) using the lavaan package in R? Below is a full example. The example attempts to predict the number of friends someone has based on their level of extraversion. Note my failed attempt to try to account for the measurement error of extraversion at the very end of the code.
#Setup dataset with 10000 observations (individuals).
set.seed(1226)
np <- 10000
df <- data.frame(matrix(0,np,0))
#Create 'true' extraversion with mean=5, SD=0.5.
df$TruE <- round(rnorm(np, 5, 0.5),0)
#Create Friends variable, making it depend on Extraversion such that
#for every 1 unit increase in extraversion, the person has +3 friends.
df$Frnd <- 3*df$TruE+round(rnorm(np,5,5),0)
#Create items that attempt to measure true extraversion (TruE).
df$ext1 <- df$TruE+round(rnorm(np,0,0.8),0)
df$ext2 <- df$TruE+round(rnorm(np,0,0.8),0)
df$ext3 <- df$TruE+round(rnorm(np,0,0.8),0)
df$ext4 <- df$TruE+round(rnorm(np,0,0.8),0)
df$ext5 <- df$TruE+round(rnorm(np,0,0.8),0)
multi.hist(df[,c("ext1", "ext2", "ext3", "ext4", "ext5")])
#Create latent variable that attempts to measure extraversion from the items.
df$LatE <- rowMeans(df[,c("ext1", "ext2", "ext3", "ext4", "ext5")])
#Check correlation matrix.
round(cor(df),2)
#Check Cronbach alpha for latent variable.
psych::alpha(df[,c("ext1", "ext2", "ext3", "ext4", "ext5")])
#Recover the true model using standard regression (works as expected).
summary(lm(Frnd~TruE, data=df))
#Attempt to recover the true model based on the latent variable using standard regression.
summary(lm(Frnd~LatE, data=df)) #Not correct due to poor reliability
#Using lavaan with latent variable modelling (works very well).
Mod1 <- 'LatE2 =~ ext1 + ext2 + ext3 + ext4 + ext5
Frnd ~ LatE2
'
Fit1 <- lavaan::sem(Mod1, data=df)
summary(Fit1, standardized=TRUE)
#Attempt to adjust for Cronbach alpha (doesn't work).
Mod2 <- 'Frnd ~ (1-.69)*LatE
'
Fit2 <- lavaan::sem(Mod2, data=df)
summary(Fit2, standardized=TRUE)