/*! For license information please see dll.223.js.LICENSE.txt */
(window.webpackJsonp_name_dll=window.webpackJsonp_name_dll||[]).push([[223],{3340:function(e,t,a){"use strict";a.r(t);var n=a(14),r=a.n(n),l=a(12),o=a.n(l),i=a(10),c=a.n(i),u=a(15),s=a.n(u),d=a(16),p=a.n(d),f=a(8),m=a.n(f),v=a(7),E=a.n(v),h=a(0),y=a.n(h),g=a(1),C=a.n(g),P=a(3341),b=a(192),A=a.n(b),R=a(138),x=a.n(R),w=a(147),V=a(1031),q=a.n(V),S=a(354),_=a(191),D=a(197),k=a(194),F=a(359),G=a(190),j=a(992);function J(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var a,n=m()(e);if(t){var r=m()(this).constructor;a=Reflect.construct(n,arguments,r)}else a=n.apply(this,arguments);return p()(this,a)}}var O=function(e,t,a){return y.a.createElement(w.default,{bordered:!0,size:"sm"},y.a.createElement("thead",null,y.a.createElement("tr",null,y.a.createElement("th",null),y.a.createElement("th",null,"Standard Deviation"),y.a.createElement("th",null,"Proportion of Variance"),y.a.createElement("th",null,"Cumulative Variance Proportion"))),y.a.createElement("tbody",null,e.map((function(e,n){return y.a.createElement("tr",{key:n},y.a.createElement("th",null," ","PC".concat(n+1)," "),y.a.createElement("td",null," ",e.toFixed(3)," "),y.a.createElement("td",null," ",t[n].toFixed(3)," "),y.a.createElement("td",null," ",a[n].toFixed(3)," "))}))))},Q=function(e){s()(a,e);var t=J(a);function a(e){var n;return r()(this,a),n=t.call(this,e),E()(c()(n),"compute",(function(e,t,a,r){for(var l=[],o=n.props.data[e[0]].length,i=0;i<o;i++){for(var c=[],u=0;u<e.length;u++)c[u]=n.props.data[e[u]][i];l.push(c)}var s=new P.PCA(l,{center:t,scale:a}),d=s.predict(l,{noComponents:r});if(r>0){for(var p=x()(n.props.data,1),f=n.props.quantitative.slice(),m=e.map((function(e){return e[0]})).join(""),v=0;v<r;v++){for(var E=[],h=0;h<d.data.length;h++)E.push(d.data[h][v]);var g="PC".concat(v+1,"_").concat(m);p[g]=E,A()(f,g)||f.push(g)}n.props.onGenerate(f,p)}n.props.logAction(G.DATA_EXPLORER_PCA,{variables:e,center:t,scale:a});var C=s.getStandardDeviations(),b=s.getExplainedVariance(),R=s.getCumulativeVariance(),w={x:q()(0,b.length,1),y:b,type:"scatter",name:"Proportion of variance"},V={variable:"PCA Summary",type:"PCA",value:y.a.createElement("div",{style:{overflowX:"auto",width:"100%"}},y.a.createElement("span",{className:"title"},"PCA Summary"),O(C,b,R),y.a.createElement(S.default,{editable:!0,data:[w],layout:{xaxis:{title:"Principal Component"},yaxis:{title:"Explained Proportion"}}}))};n.props.onCreated(V)})),n}return o()(a,[{key:"render",value:function(){var e=this.props,t=e.quantitative,a=e.originalQuantitative;return y.a.createElement(F.default,{title:y.a.createElement("span",null,"Principal Component Analysis",y.a.createElement(j.default,{title:"Principal Component Analysis",content:"Algorithm to convert observations of possibly correlated variables into linearly uncorrelated principal components."})),autoStart:!1,onGenerate:this.compute},y.a.createElement(_.default,{legend:"Variables:",multi:!0,defaultValue:a,options:t,closeMenuOnSelect:!1}),y.a.createElement(D.default,{legend:"Center values (= subtract the mean)?",defaultValue:!0}),y.a.createElement(D.default,{legend:"Scale values (= divide by standard deviation)?",defaultValue:!1}),y.a.createElement(k.default,{legend:"# of components to add to data table",min:0,defaultValue:0}))}}]),a}(h.Component);Q.defaultProps={logAction:function(){}},Q.propTypes={quantitative:C.a.array.isRequired,originalQuantitative:C.a.array.isRequired,data:C.a.object.isRequired,logAction:C.a.func,onGenerate:C.a.func.isRequired,onCreated:C.a.func.isRequired},t.default=Q}}]);