I fit a simple 1-factor model with three observed variables and 1,000 observations. The bivariate correlations between the three variables range from 0.65 to 0.86. I used cfa() with
std.lv = TRUE, which should identify the model by fixing the latent factor's variance.
What I'm not sure about is why the model fit indices all show perfect fit or produce missing values. Any ideas? It seems to assume the baseline model is the same as the model I'm fitting, but I'm not sure why.
Below, I provide (1) excerpts of the summary output from my actual modeling and (2) code that reproduces the issue using the example data provided in (3).
1. Actual Output
2. Example code to reproduce the issue
# Model syntax
example <- "fac1 =~ x1 + x2 + x3"
# Get fit statistics
fit <- cfa(model = example, df,
std.lv = TRUE)
summary(fit, fit.measures = T, standardized = T)
# These bivariate correlations are roughly representative
cor(df$x1, df$x2, use = "complete.obs")
cor(df$x1, df$x3, use = "complete.obs")
cor(df$x2, df$x3, use = "complete.obs")
3. Example data to reproduce data.frame used in above model
(run the code below to produce a data.frame)
df <- structure(list(x1 = c(0.560264465798536, 0.933211877385453, 0.979830303833817,
-0.139011930926932, -0.651814621858942, 0.513646039350172, -0.372104063168755,
0.793356598040359, 0.513646039350172, -1.35109101858441, 0.746738171591994,
0.0940802013148908, -0.232248783823662, -0.372104063168755, -1.67742000372296,
-0.232248783823662, 0.793356598040359, 0.280553907108349, 0.839975024488723,
-0.185630357375297, 0.140698627763255, 0.70011974514363, 0.373790760005078,
-0.0457750780302031, 0.933211877385453, -0.791669901204036, 0.513646039350172,
-0.41872248961712, -1.21123573923932, 0.653501318695266, 0.839975024488723,
0.467027612901807, -0.884906754100765, 0.606882892246901, 0.886593450937088,
0.280553907108349, 0.606882892246901, 0.746738171591994, 0.513646039350172,
0.327172333556713, -3.21582807651899, 0.560264465798536, -0.0923935044785677,
0.606882892246901, -0.278867210272026, 0.606882892246901, -0.325485636720391,
0.0474617748665261, -0.511959342513849, -0.278867210272026, 0.746738171591994,
0.979830303833817, -3.26244650296736, -2.60978853269025, 0.327172333556713,
0.839975024488723, -0.0923935044785677, 0.606882892246901, 0.0940802013148908,
0.233935480659984, -0.325485636720391, 0.420409186453442, 0.513646039350172,
-0.139011930926932, -0.185630357375297, -0.41872248961712, 0.187317054211619,
-0.325485636720391, -2.51655167979353, -2.79626223848371, -0.139011930926932,
0.933211877385453, -0.558577768962213, -1.53756472437787, -1.30447259213605,
-0.372104063168755, 0.233935480659984, 0.420409186453442, -2.2834595475517,
0.280553907108349, 0.979830303833817, 0.979830303833817, 0.886593450937088,
0.327172333556713, 0.839975024488723, -1.67742000372296, -0.139011930926932,
0.140698627763255, -1.44432787148114, 0.979830303833817, -0.0457750780302031,
0.000843348418161536, 0.560264465798536, 0.606882892246901, 0.0940802013148908,
0.979830303833817, -1.16461731279095, 0.979830303833817, 0.140698627763255,
-2.93611751782881, 0.0474617748665261, 0.793356598040359, 0.187317054211619,
0.513646039350172, -0.605196195410578, 0.0940802013148908, -0.698433048307307,
0.187317054211619, -0.41872248961712, 0.746738171591994, 0.979830303833817,
0.793356598040359, 0.746738171591994, 0.793356598040359, 0.513646039350172,
-0.838288327652401, 0.513646039350172, 0.933211877385453, 0.70011974514363,
0.886593450937088, -2.74964381203535, -3.21582807651899, 0.467027612901807,
0.70011974514363, 0.327172333556713, 0.560264465798536, -0.511959342513849,
-3.21582807651899, 0.70011974514363, 0.979830303833817, 0.70011974514363,
0.839975024488723, 0.560264465798536, 0.467027612901807, 0.653501318695266,
0.933211877385453, 0.886593450937088, 0.560264465798536, -0.185630357375297,
-1.44432787148114, 0.513646039350172, 0.886593450937088, 0.513646039350172,
-0.185630357375297, 0.979830303833817, -0.185630357375297, 0.653501318695266,
0.979830303833817, 0.327172333556713, -1.21123573923932, 0.979830303833817,
0.886593450937088, 0.140698627763255, -3.02935437072554, 0.373790760005078,
0.793356598040359, 0.513646039350172, 0.839975024488723, -1.11799888634259,
-2.4233148268968, 0.0940802013148908, 0.280553907108349, -0.838288327652401,
0.0940802013148908, -1.77065685661969, 0.140698627763255, -0.185630357375297,
0.513646039350172, 0.979830303833817, 0.513646039350172, 0.187317054211619,
0.839975024488723, 0.746738171591994, 0.933211877385453, 0.0474617748665261,
-3.21582807651899, -0.185630357375297, 0.0940802013148908, 0.513646039350172,
-0.978143606997495, -0.698433048307307, 0.746738171591994, 0.0474617748665261,
-2.23684112110334, -0.278867210272026, 0.979830303833817, 0.886593450937088,
0.513646039350172, -1.4909462979295, 0.467027612901807, 0.327172333556713,
0.839975024488723, 0.187317054211619, -1.16461731279095, 0.653501318695266,
0.513646039350172, 0.839975024488723, -0.185630357375297, 0.280553907108349
), x2 = c(0.136902564711936, 0.717047589790198, 0.910429264816285,
0.407636909748458, 0.794400259800633, 0.523665914764111, 0.136902564711936,
0.83307659480585, 0.523665914764111, -0.0951554453193692, -2.76382256067938,
0.0208735596962833, 0.0595498947015008, 0.368960574743241, -0.0564791103141517,
-0.0951554453193692, 0.717047589790198, 0.407636909748458, 0.83307659480585,
-0.0951554453193692, 0.601018584774546, 0.639694919779763, -0.636624135392414,
0.0595498947015008, 0.871752929811068, -1.4875035055072, 0.407636909748458,
0.175578899717153, -1.02338748544459, 0.0595498947015008, 0.871752929811068,
0.562342249769328, -0.0564791103141517, 0.639694919779763, 0.755723924795415,
0.523665914764111, 0.562342249769328, 0.368960574743241, 0.717047589790198,
0.407636909748458, -2.57044088565329, 0.523665914764111, -0.0564791103141517,
0.755723924795415, -0.0178027753089342, 0.717047589790198, -0.133831780324587,
0.136902564711936, -0.0564791103141517, -1.99029586057503, 0.67837125478498,
0.910429264816285, -2.53176455064807, -2.10632486559068, 0.368960574743241,
0.794400259800633, 0.330284239738023, -0.288537120345457, 0.523665914764111,
0.368960574743241, -0.172508115329804, 0.523665914764111, 0.523665914764111,
0.910429264816285, -0.0564791103141517, 0.446313244753676, 0.523665914764111,
0.0982262297067184, -2.18367753560111, -2.33838287562198, -0.0564791103141517,
0.83307659480585, -0.327213455350674, -1.79691418554894, -2.91852790070025,
-1.99029586057503, 0.252931569727588, 0.484989579758893, -1.02338748544459,
0.175578899717153, 0.910429264816285, 0.910429264816285, 0.910429264816285,
0.330284239738023, -2.87985156569503, -1.25544549547589, 0.523665914764111,
0.523665914764111, -1.06206382044981, 0.910429264816285, 0.562342249769328,
-0.0951554453193692, -2.87985156569503, 0.717047589790198, 0.0208735596962833,
0.83307659480585, -0.365889790355891, 0.910429264816285, 0.910429264816285,
0.562342249769328, 0.562342249769328, 0.717047589790198, 0.136902564711936,
0.368960574743241, -0.443242460366326, 0.601018584774546, -0.752653140408067,
-1.02338748544459, 0.446313244753676, 0.562342249769328, 0.910429264816285,
-1.99029586057503, 0.717047589790198, 0.871752929811068, 0.523665914764111,
-0.713976805402849, 0.562342249769328, -0.0951554453193692, 0.871752929811068,
0.639694919779763, -2.3770592106272, -2.57044088565329, 0.562342249769328,
0.562342249769328, 0.523665914764111, 0.562342249769328, -1.64220884552807,
-2.53176455064807, 0.601018584774546, 0.910429264816285, 0.601018584774546,
0.717047589790198, 0.484989579758893, 0.523665914764111, 0.755723924795415,
-2.68646989066894, -0.946034815434154, 0.601018584774546, -0.0564791103141517,
-1.02338748544459, 0.523665914764111, -1.06206382044981, 0.67837125478498,
-0.0178027753089342, 0.910429264816285, 0.407636909748458, 0.794400259800633,
0.910429264816285, 0.407636909748458, 0.0208735596962833, -2.57044088565329,
0.871752929811068, 0.446313244753676, -2.33838287562198, 0.446313244753676,
0.794400259800633, 0.717047589790198, 0.871752929811068, 0.639694919779763,
-0.984711150439371, 0.368960574743241, 0.21425523472237, -0.559271465381979,
0.523665914764111, -1.41015083549676, 0.562342249769328, 0.0208735596962833,
0.562342249769328, -2.95720423570546, 0.562342249769328, 0.601018584774546,
0.755723924795415, 0.639694919779763, 0.83307659480585, 0.523665914764111,
-2.57044088565329, 0.523665914764111, 0.67837125478498, 0.562342249769328,
-0.481918795371544, -0.211184450335022, 0.717047589790198, 0.910429264816285,
-1.56485617551763, -0.0178027753089342, 0.910429264816285, 0.794400259800633,
0.523665914764111, -1.13941649046024, 0.717047589790198, 0.252931569727588,
0.871752929811068, 0.330284239738023, -0.791329475413284, 0.717047589790198,
0.523665914764111, 0.83307659480585, -1.41015083549676, 0.0595498947015008
), x3 = c(0.376284465894342, 0.74833264743926, 0.93435673821172,
-0.367811897195496, 0.794838670132375, 0.469296511280572, 0.0507423070425382,
0.701826624746145, 0.469296511280572, -1.34443837375091, 0.701826624746145,
0.329778443201227, 0.283272420508112, -0.50732996527484, -2.08853473684074,
-0.367811897195496, 0.84134469282549, 0.469296511280572, 0.887850715518605,
-0.0887757610368065, 0.469296511280572, 0.376284465894342, -1.99552269145451,
-0.0422697383436916, 0.887850715518605, -0.693354056047299, 0.283272420508112,
-0.274799851809266, -1.15841428297845, -0.925884169512874, 0.701826624746145,
0.329778443201227, -0.228293829116151, 0.608814579359916, 0.84134469282549,
-0.228293829116151, 0.701826624746145, 0.701826624746145, 0.74833264743926,
0.283272420508112, -3.25118530416862, 0.469296511280572, -0.0422697383436916,
0.84134469282549, -0.181787806423036, 0.562308556666801, -0.181787806423036,
0.00423628434942329, 0.236766397814997, -0.321305874502381, 0.655320602053031,
0.93435673821172, -3.2046792814755, -2.8791371226237, 0.236766397814997,
0.701826624746145, -0.460823942581726, 0.236766397814997, -0.135281783729921,
0.236766397814997, -0.135281783729921, 0.608814579359916, 0.469296511280572,
-1.34443837375091, -0.181787806423036, -0.135281783729921, 0.329778443201227,
0.0972483297356525, -3.01865519070304, -2.8791371226237, 0.469296511280572,
0.84134469282549, -1.06540223759222, -2.22805280492009, -0.832872124126644,
0.143754352428767, -0.135281783729921, 0.422790488587457, -0.925884169512874,
0.562308556666801, 0.887850715518605, 0.93435673821172, 0.93435673821172,
0.283272420508112, 0.794838670132375, -1.39094439644402, -0.181787806423036,
-1.6234745099096, -1.25142632836468, 0.93435673821172, 0.74833264743926,
0.701826624746145, 0.422790488587457, 0.701826624746145, -0.181787806423036,
0.887850715518605, -1.29793235105779, 0.93435673821172, 0.562308556666801,
-2.64660700915812, 0.701826624746145, 0.701826624746145, -0.0422697383436916,
0.422790488587457, -1.25142632836468, 0.283272420508112, -0.879378146819759,
-3.15817325878239, 0.469296511280572, 0.469296511280572, 0.93435673821172,
0.794838670132375, 0.93435673821172, 0.74833264743926, 0.469296511280572,
-1.06540223759222, 0.562308556666801, 0.84134469282549, 0.794838670132375,
0.655320602053031, -2.32106485030632, -3.25118530416862, 0.701826624746145,
0.701826624746145, 0.469296511280572, 0.469296511280572, -2.60010098646501,
-3.25118530416862, 0.608814579359916, 0.93435673821172, 0.0972483297356525,
-0.135281783729921, 0.515802533973686, 0.469296511280572, 0.562308556666801,
0.93435673821172, 0.93435673821172, 0.283272420508112, 0.236766397814997,
-0.460823942581726, 0.469296511280572, 0.887850715518605, 0.562308556666801,
-0.321305874502381, 0.93435673821172, -0.181787806423036, 0.794838670132375,
0.93435673821172, 0.422790488587457, -0.553835987967955, 0.701826624746145,
0.84134469282549, -0.414317919888611, -2.92564314531681, 0.236766397814997,
0.701826624746145, 0.701826624746145, 0.422790488587457, 0.794838670132375,
-2.64660700915812, 0.515802533973686, 0.329778443201227, -2.46058291838566,
0.329778443201227, -1.34443837375091, 0.283272420508112, -0.460823942581726,
0.469296511280572, 0.93435673821172, 0.469296511280572, 0.0972483297356525,
0.701826624746145, 0.84134469282549, 0.84134469282549, 0.469296511280572,
-3.25118530416862, 0.469296511280572, 0.376284465894342, 0.236766397814997,
0.143754352428767, 0.794838670132375, 0.655320602053031, 0.469296511280572,
-2.55359496377189, -0.228293829116151, 0.93435673821172, 0.655320602053031,
0.515802533973686, -1.48395644183025, 0.701826624746145, 0.283272420508112,
0.701826624746145, -0.181787806423036, -1.20492030567156, 0.376284465894342,
0.469296511280572, 0.84134469282549, -0.181787806423036, 0.562308556666801
)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-199L))