rr-lavaan

lavaan WARNING: some observed variances are (at least) a factor 1000 times larger than others; use varTable(fit) to investigate


I am trying to evaluate the sem model from a dataset, some of the data are in likert scale i.e from 1-5. and some of the data are COUNTS generated from the computer log for some of the activity.

Whereas while performing the fits the laveen is giving me the error as:

lavaan WARNING: some observed variances are (at least) a factor 1000 times larger than others; use varTable(fit) to investigate

To mitigate this warning I want to scale some of the variables. But couldn't understand the way for doing that.

Log_And_SurveyResult <- read_excel("C:/Users/Aakash/Desktop/analysis/Log-And-SurveyResult.xlsx")

model <- '
  Reward =~ REW1 + REW2 + REW3 + REW4
  ECA =~  ECA1 + ECA2 + ECA3
  Feedback =~ FED1 + FED2 + FED3 + FED4
  Motivation =~ Reward + ECA + Feedback
  Satisfaction =~ a*MaxTimeSpentInAWeek + a*TotalTimeSpent + a*TotalLearningActivityView 
  
  Motivation ~ Satisfaction'

fit <- sem(model,data = Log_And_SurveyResult)

summary(fit, standardized=T, std.lv = T)

fitMeasures(fit, c("cfi", "rmsea", "srmr"))

I want to scale some of the variables like MaxTimeSpentInAWeek and TotalTimeSpent

Could you please help me figure out how to scale the variables? Thank you very much.


Solution

  • You can just use scale(MaxTimeSpentInAWeek). This will scale your variable to mean = 0 and variance = 1. E.g:

        Log_And_SurveyResult$MaxTimeSpentInAWeek <- 
        scale(Log_And_SurveyResult$MaxTimeSpentInAWeek)
        Log_And_SurveyResult$TotalTimeSpent <- 
        scale(Log_And_SurveyResult$TotalTimeSpent)
    

    Or did I misunderstand your question?