Michael posted on Thursday, April 21, 2005 - 2:43 pm
I’ve been trying to run a CFA with binary outcomes. I keep getting an error message which reads, “Categorical variable S1 contains less than 2 categories.” I’ve double checked the data file and there are definitely observations that reflect both possible responses (true and false) along with some missing data. The proportion of responses is approximately 90% true and 10% false. Do you know what could account for this error message?
TITLE: CFA multi item and scale test DATA: FILE IS G:\RCS Items (WOMEN)(04.15.05).dat; FORMAT IS free; TYPE IS individual; VARIABLE: NAMES ARE D1-D2 S1-S10 L1-L10 C1-C10 P1-P10 DN1-DN10 A1-A10 H1-H10; USEVARIABLES ARE S1-S10 L1-L10 C1-C10 P1-P10 DN1-DN10 A1-A10 H1-H10; CATEGORICAL ARE S1-S10 L1-L10 C1-C10 P1-P10 DN1-DN10 A1-A10 H1-H10; MISSING ARE all (99); ANALYSIS: TYPE IS general; ESTIMATOR = WLSMV; MATRIX = covariance; MODEL: S BY S1@1 S2-S10; L BY L1@1 L2-L10; C BY C1@1 C2-C10; P BY P1@1 P2-P10; DN BY DN1@1 DN2-DN10; A BY A1@1 A2-A10; H BY H1@1 H2-H10; OUTPUT: standardized sampstat modindices (0) residual;
If you are reading your data correctly, then it is most likely the case that after listwise deletion, some variables have only one category. Any observation with a missing value on one or more analysis variables is eliminated by the default of listwise deletion. If you cannot resolve this, please send the input/output, your data, and your license number to email@example.com.
Note also that with categorical factor indicators, MATRIX = COVARIANCE is not allowed.
While trying to run a multi-group LCA model, I am receiving the following error.
*** ERROR Categorical variable SMOKE contains less than 2 categories.
I have double checked the data and my smoke category contains more than two categories. I have also tried deleting the smoke variable and the error repeats with the next variable in the model. I would like to know if I am specifying the model correctly.
You may be subsetting the data such that v2 has the same value for everyone. If you can't figure it out, please send your input, data, output, and license number to firstname.lastname@example.org.
IYH Boon posted on Friday, June 01, 2012 - 1:54 pm
I'm trying to estimate a LCGA using some data that I simulated. The outcome is binary, but in some time points there is no variation across observations (i.e., everyone has a 0 or everyone has a 1). As a result, I'm getting the "Categorical variable contains less than 2 categories error." Is there an easy workaround for this problem?
You can try the CATEGORICAL * option with ML but I don't think that will help. You may have to use only time points where you have variability.
Sarah Moens posted on Thursday, December 06, 2012 - 2:17 am
I also had the same error message stating that the categorical variable contained less than 2 values.
However, I figured out that in my case this had to do with the way Mac saves txt-csv-dat... files. Mac uses other line breaks than e.g. Windows, \r vs. \r\n Although this is not visible in the file itself, this is how it apparently is stored.
When you use a general text editor like TextWrangler, you can usually specify what type of line break to use: Mac (CR), Unix (LF), or Windows (CRLF). Choosing Windows (CRLF) fixed the error for me and allowed the file to be read properly.