{"id":1471,"date":"2012-11-14T14:38:13","date_gmt":"2012-11-14T19:38:13","guid":{"rendered":"http:\/\/www.nomad.priv.at\/researchblog\/?p=1471"},"modified":"2012-11-14T14:50:22","modified_gmt":"2012-11-14T19:50:22","slug":"what-to-do-with-nominal-variables-in-a-mixed-data-set","status":"publish","type":"post","link":"http:\/\/www.nomad.priv.at\/researchblog\/?p=1471","title":{"rendered":"What to do with nominal variables in a mixed data set?"},"content":{"rendered":"<p>&#8230; and I keep looking for a definitive answer &#8230; (so do not read on, if you expect one!)<\/p>\n<p>I would like to perform PCA on a mixed dataset of nominal and continuous variables. Examples for such variables \u00a0are gender (m\/f; nominal), living on a farm (y\/n; nominal) and and organic contaminant concentration data (continuous). The nominal variables cannot be ordered.<\/p>\n<p>According to Kolenikov &amp; Angeles the problem is that<\/p>\n<blockquote><p>\u201cdiscrete data tend to have high skewness and kurtosis, especially if the majority of the data points are concentrated in a single category\u201d<\/p><\/blockquote>\n<p>[<a href=\"http:\/\/www.cpc.unc.edu\/measure\/publications\/wp-04-85\">Kolenikov &amp; Angeles, 2004<\/a>,\u00a0The Use of Discrete Data in PCA: Theory, Simulations, and Applications to Socioeconomic Indices].<\/p>\n<p>In brief &#8211; if using my data as is, since I have lots of data in a single category, I am potentially introducing a bias.\u00a0Furthermore, in a board post on methodspace.com it has been stated that<\/p>\n<blockquote><p>&#8220;the problem is that when the distributions are far from 50:50 for a dichotomous variable, the correlations are suppressed.&#8221;<\/p><\/blockquote>\n<p>This is certainly the case for my data. But also a first step towards a solution is offered (reiterating\u00a0Kolenikov &amp; Angeles&#8217; suggestion)<\/p>\n<blockquote><p>&#8221; You can also go for estimating polychoric\/ tetrachoric correlations. Here you assume that each binary (or ordered discrete) indicator is a manifestation of underlying continuous variables, and so you estimate the correlations between these underlying variables.&#8221;<\/p><\/blockquote>\n<p>[<a href=\"http:\/\/www.methodspace.com\/forum\/topics\/principal-component-analysis?commentId=2289984%3AComment%3A103267\">http:\/\/www.methodspace.com\/forum\/topics\/principal-component-analysis?commentId=2289984%3AComment%3A103267<\/a>]<\/p>\n<p>On the\u00a0stats.stackexchange.com board, different avenues are discussed:<\/p>\n<blockquote><p>\u201cAlthough a PCA applied on binary data would yield results comparable to those obtained from a Multiple Correspondence Analysis (factor scores and eigenvalues are linearly related), there are more appropriate techniques to deal with mixed data types, namely Multiple Factor Analysis for mixed data available in the FactoMineR R package. [&#8230;]\u00a0The challenge with categorical variables is to find a suitable way to represent distances between variable categories and individuals in the factorial space. To overcome this problem, you can look for a non-linear transformation of each variable &#8212; whether it be nominal, ordinal, polynomial, or numerical &#8212; with optimal scaling.\u201d<\/p><\/blockquote>\n<p>[<a href=\"http:\/\/stats.stackexchange.com\/questions\/5774\/can-principal-component-analysis-be-applied-to-datasets-containing-a-mix-of-cont\">http:\/\/stats.stackexchange.com\/questions\/5774\/can-principal-component-analysis-be-applied-to-datasets-containing-a-mix-of-cont<\/a>]<\/p>\n<p>On the other hand, at least for some data sets,\u00a0polychoric PCA does not significantly improve results, as\u00a0Kolenikov &amp; Angeles, 2004 admit:<\/p>\n<blockquote><p>\u201cThe gain from using computationally intensive polychoric correlations in getting the \u201ccorrect\u201d variable weights may not be very large compared to the PCA on ordinal data. However, only the polychoric analysis gives consistent estimates of the explained proportion. [&#8230;] The misclassification rates, as well as Spearman correlation of the theoretical and empirical welfare indices, are not substantially different between the ordinal, group means and polychoric versions of PCA, although the difference is statistically significant due to huge sample size of the simulation results data set.\u201d<\/p><\/blockquote>\n<p>Additionally, in my data set I have the a lot of data below the detection limit (&lt;LOD, coded as zero) and some missing data. The former need to be recoded to better represent an &#8220;actual value&#8221; since it is not zero. Replacement could be e.g., 1\/2 LOD as a simple and often used approach, but bias prone, or, better, Kaplan-Meier estimates (see D. R. Helsel (2005) More than obvious: Better methods for interpreting nondetect data, <a href=\"http:\/\/pubs.acs.org\/doi\/pdf\/10.1021\/es053368a\">Environ Sci Technol 39, 419A\u2013423A<\/a>). A convenient side-effect is the removal of (non-finite) zero values as required for PCA.<\/p>\n<p>As a conclusion I will be trying the following for now &#8211; always in a <strong>b<\/strong>asic (b) and <strong>c<\/strong>omprehensive approach for comparison (c):<\/p>\n<ul>\n<li>1\/2 LOD replacement for &lt;LOD values (b)<\/li>\n<li>Kaplan-Meier estimates for &lt;LOD values (c)<\/li>\n<li>Replacement of discrete variables: 0.5 &amp; 1 instead of 0 &amp; 1 to make values finite (b)<\/li>\n<li>Employ the <em><strong>polycor<\/strong><\/em> R package to treat discrete variables, hopefully giving me finite values (c)<\/li>\n<\/ul>\n<p>Other avenues to explore\u2026<\/p>\n<ul>\n<li>not to carry out PCA, but use the <em><strong>FactominR<\/strong><\/em> package for Multiple Factor Analysis<\/li>\n<li>is optimal scaling using the\u00a0<em><strong>homals<\/strong><\/em> package (which does not work right now in the most recently released version of R. It aborts when loading\u00a0required <em><strong>rgl<\/strong><\/em>\u00a0package)<\/li>\n<\/ul>\n<p>The next issue is that I do not know about is how to validate results, yet.\u00a0I will certainly carry out a detailed analysis &amp; comparison of the (scree, loadings &amp; scores) plots resulting from the approaches described above, first.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8230; and I keep looking for a definitive answer &#8230; (so do not read on, if you expect one!) I would like to perform PCA on a mixed dataset of nominal and continuous variables. Examples for such variables \u00a0are gender (m\/f; nominal), living on a farm (y\/n; nominal) and and organic contaminant concentration data (continuous). &hellip; <a href=\"http:\/\/www.nomad.priv.at\/researchblog\/?p=1471\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">What to do with nominal variables in a mixed data set?<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,4],"tags":[],"class_list":["post-1471","post","type-post","status-publish","format-standard","hentry","category-r","category-research"],"_links":{"self":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/posts\/1471","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1471"}],"version-history":[{"count":4,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/posts\/1471\/revisions"}],"predecessor-version":[{"id":1475,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=\/wp\/v2\/posts\/1471\/revisions\/1475"}],"wp:attachment":[{"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1471"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1471"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.nomad.priv.at\/researchblog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1471"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}