Hello,
This is my first time working with FactoMineR and missMDA.
I've had success with FactoMineR with and without the FactoMineR Plugin (incredibly helpful!), and now I am trying to get missMDA to work so the NA values are not plotted and analyzed. The tutorial and video worked great!
My 100% categorical data (except for case IDs and Date columns) are also 100% yes/no binary data. They were
originally
coded as 0s and 1s, but numerous errors caused me to recode it. FactoMineR worked, but missMDA is now generating different errors and I'm working in circles.
Here's how my data is currently formatted:
The first categorical variable is the first column, with case ID and Date moved to the last 2 columns.
I have 31 pairs of qualitative variables, with the headers as follows: X1, X1.1, X2, X2.1, etc. The values in the rows are con1 or NA in X1, and in its paired second column labeled X1.1, the values are op1 or NA. Some rows have con1 and op1, so although they are both for code 1, they are applied differently and the values cannot be in the same cell. 8 columns have no values in any of the rows.
I also have 18 qualitative variable columns with labels such as "Children" and their values are Yes and NA, and all columns have at least one row with data in a cell.
I read in the CSV data as follows:
CIData <- read.table("C:/Users/holly/Documents/R Data/CID/ID May1 for MCA.csv", header=TRUE, stringsAsFactors=TRUE, sep=",", na.strings="NA", dec=",", strip.white=TRUE)
Then, I REMOVED THE EMPTY columns from the active dataframe, which I filled with "FALSE" values after getting this error in missMDA:
complete <- imputeMCA(CIData.MCA, ncp=5)
Error in while (continue) { : missing value where TRUE/FALSE needed
The dataframe was altered to remove the empty columns and name the active qualitative variables as follows:
CIData.MCA<-CIData[, c("X1", "X1.1", ...., "Date")]
Here's a current error that doesn't make sense to me. It sees the data, as indicated by the dimensions and head(CIData.MCA) working, but does not see it when calling the data() command in missMDA:
dim(CIData.MCA) - seems good
[1] 162 73
> data(CIData.MCA) - mysterious failure
Warning message:
In data(CIData.MCA) : data set ‘CIData.MCA’ not found
??: Is data() a vital part of the missMDA process?
Moving on, this has worked a few times and I have 3 attractive graphs, but now it throws this error:
nb <- estim_ncpMCA(CIData.MCA)
Error in apply(tabdisj[, (vec[i] + 1):vec[i + 1]], 1, which.max) :
dim(X) must have a positive length
The next line of code also throws an error:
complete <- imputeMCA(CIData.MCA, ncp=5)
Error in while (continue) { : missing value where TRUE/FALSE needed
The object is not found, probably because it follow the errors & did not make the object it should have:
res.mca <- MCA(comp$completeObs)
Error: object 'comp' not found
The header kept the tutorial's tab.disj information, as indicated by the header
head(complete$tab.disj)
Q7.1.1 Q7.1.2 Q7.1.3....Not my data with the X1, X1.1, column names.
Additionally, the dimdesc() function for describing the categorical variables has always given me an error about not being able to make contrasts when there is only one level to the data.
I'm sure this is a very simple problem with the setup of the data itself costing me a week so far, but I'm so new to this that I cannot find the right solution.
Thank you to anyone offering help!!
It's all so quick and easy when it works! Haha
Best wishes in your endeavors and huge thanks to anyone offering help for my own!
Holly