Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I'm interested in using multiple factor analysis to analyze data collected from ceramic sherds. The data is pretty complicated, containing both continuous variables (vessel rim diameter, vessel wall thickness) and grouped categorical variables (presence or absence of base- and over- glazes on the vessel interior and exterior). After scaling and centering the continuous variables, my data looks something like this:

row.names   RimDiameter  SherdThickness2cmBelowRim  BGIBrown    BGIclear...
23          -1.05924698  0.1160736                  0           1...
56          0.15586427   -0.7386500                 1           0...

Using FactoMineR, I tried running MFA as follows:

sherdMFA = MFA(cleanRimGlaze[,-1], group=c(2,17,13,1,1),
   type=c("s",rep("n",4)), ncp=5, 
   name.group=c("RimDiamThickness","BGI","BGE","LI", "LE"))

but it produces this error

Error in MFA(cleanRimGlaze[, -1], group = c(2, 17, 13, 1, 1), type = c("s",  : 
    not convenient group definition

I can't figure out how to fix this error.

Looking at the MFA example on the the FactoMineR website, it seems that MFA is built to handle categorical variables as factors, and converting my dummy variables to factor levels might solve the group definition problem. I have tried this (see my painfully slow learning in the comments), but MFA expects more than two factors per column, so dummy variables seem not to be the desired input. However, because in my data it's possible for multiple glazes to be present, it seems weird to have separate factors for "brown", "clear", and "clear and brown". Am I right in thinking that it's better to use dichotomous variables for presence/absence, and simply mark presence for both brown and clear? Is there a way to run MFA in FactoMineR with categorical variables as dummy variables? Or maybe even a more appropriate statistical analysis?

Fixed several errors as follows:

  1. Ditched the [,-1] because it was causing the "not convenient group definition" error.
  2. Converted qualitative columns to factors with two levels to fix the "factors are not defined in the qualitative groups" error.
  3. Removed qualitative columns which contained only one of the two factors to fix the " Error in contrasts<-(tmp, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels " error that popped up.

And now MFA runs. I'm still curious about people's opinions on the appropriateness of multiple factor analysis for such data.

My sample (around 300 lustreware sherds from a much larger number excavated in the 1930's) contained 81 rim sherds. For these sherds, rim diameter was estimated, thickness of sherd 2 cm below rim was measured, and presence or absence of difference colored glazes was measured on the interior and exterior of the sherds (for example, opaque blue, transparent blue, white, clear, lustre, turquoise, no glaze visible).

Because certain interior-exterior combinations seemed common, like white glaze on the interior and blue glaze on the exterior with lustre overglaze on both, it seemed reasonable to have both "Base Glaze Interior Blue" and "Base Glaze Exterior Blue" variables, as well as "Over Glaze Interior" and "Over Glaze Exterior" variables for lustre. This amounts to 20 variables and a row.names for the sherd identifiers. 20 variables to a sample size of 81 seemed to scrape by as acceptable for such analysis, although obviously a larger sample size would be desirable (I'm looking at Sample size and subject to item ratio in principal components analysis for this, but you might know more recent work it). There is a lot more ceramic material available, so any hypotheses developed based on this smaller sample could be tested with more data collection.

I chose MFA because the data mixes continuous and categorical variables. As far as groups go, it seemed like a good idea to combine all of the presence/absence for the base glazes on the interior together, and those on the exterior together. By analogy, the presence of lustre overglaze on interior and exterior each were assigned a group, and finally the highly correlated estimated rim diameter and sherd thickness also got their own group (making 1 continuous group and 4 categorical groups). My first thought was PCA, but the categorical glaze data, while convertible to dummy variables, breaks the normal distribution assumption upon which PCA is predicated. I looked at Latent Class Analysis too, but that didn't seem suited to the continuous data of the rim diameter and sherd thickness variables. MFA seemed capable of handling both, and acknowledging the real groups present in the data collected.

Many thanks to @dcarlson for his clarifying questions.

share|improve this question
    
I realize there are at least two separate things going on here that could be causing distinct problems. One is the fact that the qualitative data is in ints rather than factors, two is the subsetting of the data frame with [,-1], which I thought was getting keeping the row.names out of the MFA, but might be doing something else. Bracket subsetting still confuses me. –  AlexB Dec 22 '12 at 21:55
    
So, changing all the categorical dummy variables from ints to factors and dropping the bracket subset produces the following error: Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels –  AlexB Dec 22 '12 at 22:11
    
It is not really possible to answer your question with so little information. Most of your post deals with the technical issues of running MFA() on your data but you have not told us simple things about the data - number of cases, number of variables (your groups definition implies 34) or why you are grouping the variables you are grouping. Most importantly, you have not told us what you are trying to accomplish and why you think MFA rather than other multivariate methods is better. –  dcarlson Dec 24 '12 at 22:19
    
@dcarlson Thanks for your questions. I tried to answer them above, but if you have any other questions before you answer please let me know. –  AlexB Dec 27 '12 at 16:17
    
Twenty variables and 300 total sherds/81 rim sherds is a reasonable balance assuming they do not come from many groups (based on ceramic types, sites, strata, pits, graves, houses) such that you would want to analyze the groups separately. It sounds like there are only two metric variables (diameter and thickness) and the rest are categories or dichotomies. But what is the question you are trying to answer? Different groups of sherds based on the attributes that indicate different chronological or cultural types? MFA may work fine, but other methods may be easier to use or interpret. –  dcarlson Dec 30 '12 at 22:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.