/*! For license information please see dll.228.js.LICENSE.txt */
(window.webpackJsonp_name_dll=window.webpackJsonp_name_dll||[]).push([[228],{3352:function(e,t,a){"use strict";a.r(t);var n=a(14),r=a.n(n),l=a(12),i=a.n(l),o=a(10),c=a.n(o),u=a(15),s=a.n(u),d=a(16),p=a.n(d),f=a(8),m=a.n(f),v=a(7),h=a.n(v),E=a(0),y=a.n(E),g=a(1),P=a.n(g),b=a(3353),C=a(194),A=a.n(C),R=a(138),x=a.n(R),w=a(147),V=a(1033),q=a.n(V),S=a(102),_=a(137),k=a.n(_),D=a(354),j=a(191),F=a(197),G=a(193),O=a(359),J=a(190),Q=a(993);function T(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 X=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)," "))}))))},z=function(e){s()(a,e);var t=T(a);function a(e){var n;return r()(this,a),n=t.call(this,e),h()(c()(n),"compute",(function(e,t,a,r){for(var l,i=[],o=n.props.data[e[0]].length,c=0;c<o;c++){for(var u=[],s=!1,d=0;d<e.length;d++){var p=n.props.data[e[d]][c];if(l=p,!Object(S.isPrimitive)(l)||k()(l)){s=!0;break}u.push(p)}s||i.push(u)}var f=new b.PCA(i,{center:t,scale:a}),m=f.predict(i,{noComponents:r});if(r>0){for(var v=x()(n.props.data,1),h=n.props.quantitative.slice(),E=e.map((function(e){return e[0]})).join(""),g=0;g<r;g++){for(var P=[],C=0;C<m.data.length;C++)P.push(m.data[C][g]);var R="PC".concat(g+1,"_").concat(E);v[R]=P,A()(h,R)||h.push(R)}n.props.onGenerate(h,v)}n.props.logAction(J.DATA_EXPLORER_PCA,{variables:e,center:t,scale:a});var w=f.getStandardDeviations(),V=f.getExplainedVariance(),_=f.getCumulativeVariance(),j={x:q()(0,V.length,1),y:V,type:"scatter",name:"Proportion of variance"},F={variable:"PCA Summary",type:"PCA",value:y.a.createElement("div",{style:{overflowX:"auto",width:"100%"}},y.a.createElement("span",{className:"title"},"PCA Summary"),X(w,V,_),y.a.createElement(D.default,{editable:!0,data:[j],layout:{xaxis:{title:"Principal Component"},yaxis:{title:"Explained Proportion"}}}))};n.props.onCreated(F)})),n}return i()(a,[{key:"render",value:function(){var e=this.props,t=e.quantitative,a=e.originalQuantitative;return y.a.createElement(O.default,{title:y.a.createElement("span",null,"Principal Component Analysis",y.a.createElement(Q.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(j.default,{legend:"Variables:",multi:!0,defaultValue:a,options:t,closeMenuOnSelect:!1}),y.a.createElement(F.default,{legend:"Center values (= subtract the mean)?",defaultValue:!0}),y.a.createElement(F.default,{legend:"Scale values (= divide by standard deviation)?",defaultValue:!1}),y.a.createElement(G.default,{legend:"# of components to add to data table",min:0,defaultValue:0}))}}]),a}(E.Component);z.defaultProps={logAction:function(){}},z.propTypes={quantitative:P.a.array.isRequired,originalQuantitative:P.a.array.isRequired,data:P.a.object.isRequired,logAction:P.a.func,onGenerate:P.a.func.isRequired,onCreated:P.a.func.isRequired},t.default=z}}]);