# PCA and visualization using biplots on data with mixed types

I have a dataset of dimensions 1500x200 where the predictors are both quantitative (discrete and continuous), as well as qualitative (categorical and ordinal) and the dependent variable is continuous. I've also performed standardization on these features.

I'm learning about PCA and visualization of PCA using biplots, and wanted to see if I could try it out on this dataset and see if I notice anything interesting. I found some code online that does this. About half way through I made a plot of the number of principal components versus explained variance. I expected that the first few principal components would explain much of the variance, but instead the plot looks sort of logarithmic where it takes over 30 principal components just to explain over 50% of the variance. Here's the plot: So what I'm wondering is, is there something wrong methodologically with attempting to perform PCA on a dataset with mixed types such as the one I'm using? If so, is there a better visualization alternative than to create a biplot for this sort of data?

• Are you using CATPCA? It is for mixed type variables. Second, it is nothing wrong with that 30+ components are needed to explain one third of the variance, it just means low correlations dominate in your data. – ttnphns Nov 29 '17 at 4:12
• Thanks for your comment. So far I've just been using python sklearn's PCA implementation. If approximately half of my variables are continuous and half are dummy categorical variables, should I use CATPCA for all of them or somehow use PCA for the continuous half and CATPCA for the categorical half? – Austin Nov 29 '17 at 4:16
• Dummy binary variables sets represent nomial variables. It is all right to use nominal variables in CatPCA, you don't have to recode them into the dummies, the program should do it internally. – ttnphns Nov 29 '17 at 5:01
• Continuous vars okay to be mixed in also? – Austin Nov 29 '17 at 5:01
• That depends on the implementation. Classic CatPCA algorthm is for discrete values only (scale can be interval, but values should not be fractional, continuous). That constraint is not of great inconvenience because you can bin continuous scale into, say, 30 or more subranges, represented by integer values 1, 2, 3,... With many subranges you don't distort your continuous data any greatly. – ttnphns Nov 29 '17 at 5:48
{"ft_lang_label":"__label__en","ft_lang_prob":0.96186286,"math_prob":0.8298852,"size":1050,"snap":"2019-43-2019-47","text_gpt3_token_len":212,"char_repetition_ratio":0.09751434,"word_repetition_ratio":0.0,"special_character_ratio":0.2,"punctuation_ratio":0.07368421,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9664115,"pos_list":[0,1,2],"im_url_duplicate_count":[null,2,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-11-15T20:51:55Z\",\"WARC-Record-ID\":\"<urn:uuid:9f580ed6-84f7-4fef-870e-b143d7b451f7>\",\"Content-Length\":\"133620\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:a4d9395c-5b68-458c-9081-0366404f3f76>\",\"WARC-Concurrent-To\":\"<urn:uuid:39515fb7-8d17-49d4-9acb-c5d6cd355609>\",\"WARC-IP-Address\":\"151.101.129.69\",\"WARC-Target-URI\":\"https://stats.stackexchange.com/questions/316199/pca-and-visualization-using-biplots-on-data-with-mixed-types\",\"WARC-Payload-Digest\":\"sha1:QW4X4IMX2VH4WTKNWHFWFP3SE7JI3L3Q\",\"WARC-Block-Digest\":\"sha1:JB3GMRZEU6DAMVYRLDLJ75EHS7NF3GNN\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-47/CC-MAIN-2019-47_segments_1573496668712.57_warc_CC-MAIN-20191115195132-20191115223132-00114.warc.gz\"}"}