<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>datistics</title>
    <link>https://www.datisticsblog.com/</link>
    <description>Recent content on datistics</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 04 Nov 2025 00:00:00 +0000</lastBuildDate>
    
        <atom:link href="https://www.datisticsblog.com/index.xml" rel="self" type="application/rss+xml" />
    
    
    <item>
      <title>simaerep release 1.0.0</title>
      <link>https://www.datisticsblog.com/2025/11/simaerep-v1.0.0/</link>
      <pubDate>Tue, 04 Nov 2025 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2025/11/simaerep-v1.0.0/</guid>
      <description>


&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;p&gt;Simulate patient-related events in clinical trials with the goal of detecting over and under-reporting sites.&lt;/p&gt;
&lt;p&gt;Monitoring reporting rates of patient-related events such as adverse events (AE) in clinical trials is important for patient safety. We use bootstrap-based simulation to assign over- and under-reporting probabilities to each site in a clinical trial. The method is inspired by the ‘infer’ R package and Allen Downey’s blog article: &lt;a href=&#34;http://allendowney.blogspot.com/2011/05/there-is-only-one-test.html&#34;&gt;“There is only one test!”&lt;/a&gt;.&lt;/p&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;https://github.com/openpharma/simaerep/raw/master/man/figures/logo.png&#34; style=&#34;width: 360px;height: 360px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;div id=&#34;key-risk-indicators&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Key Risk Indicators&lt;/h1&gt;
&lt;p&gt;Statistical monitoring of clinical trial sites typical employs several key risk indicators which are operational metrics derived from activities at the clinical trial sites. The ratio
of AEs is typically one of them, the ratio of issues occurring when treating and examininig patients according to the study protocol might be another one.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;release-v1.0.0&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Release v1.0.0&lt;/h1&gt;
&lt;div id=&#34;announcement&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Announcement&lt;/h2&gt;
&lt;p&gt;We are happy to announce the release of {simaerep} v1.0.0 and {gsm.simarep} v0.2.0 our open source R packages designed to detect clinical trial sites that are under- or over- reporting patient-level clinical events. We have condensed our experience and user feedback from the past 5 years to design a more professional user experience with default settings that reflect our latest recommendations. We have also adapted the algorithm to support the detection of over-reporting of low-incidence terminal events such as patient discontinuations. {gsm.simaerep} provides important data preprocessing functions and a standardized approach to integrate {simaerep} into an end-to-end analysis and reporting pipeline using the good statistical monitoring {gsm} framework.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/openpharma/simaerep/&#34;&gt;https://github.com/openpharma/simaerep/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/IMPALA-Consortium/gsm.simaerep&#34;&gt;https://github.com/IMPALA-Consortium/gsm.simaerep&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;release-highlights&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Release Highlights&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;New user interface for &lt;code&gt;simaerep()&lt;/code&gt; function with defaults reflecting the latest recommendations&lt;/li&gt;
&lt;li&gt;Better output structure, over- and under-reporting probability combined into one score&lt;/li&gt;
&lt;li&gt;Support for low-incidence terminal events (e.g., patient discontinuations)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/openpharma/simaerep/blob/master/NEWS.md&#34;&gt;Detailed Releas Notes&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;demo&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Demo&lt;/h2&gt;
&lt;div id=&#34;simaerep&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;{simaerep}&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages(library(simaerep))
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(knitr))

set.seed(1)

df_visit &amp;lt;- sim_test_data_study(
  n_pat = 1000, # number of patients in study
  n_sites = 100, # number of sites in study
  ratio_out = 0.02, # ratio of sites with outlier
  factor_event_rate = -0.5, # rate of under-reporting
  # non-constant event rates based on gamma distribution
  event_rates = (dgamma(seq(1, 20, 0.5), shape = 5, rate = 2) * 5) + 0.1,
  max_visit = 20,
  max_visit_sd = 10,
  study_id = &amp;quot;A&amp;quot;
)

df_visit %&amp;gt;%
  select(study_id, site_id, patient_id, visit, n_event) %&amp;gt;%
  head(25) %&amp;gt;%
  knitr::kable()&lt;/code&gt;&lt;/pre&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th align=&#34;left&#34;&gt;study_id&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;site_id&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;patient_id&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;visit&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;n_event&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;4&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;6&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;8&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;11&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;12&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;13&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000002&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000002&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000002&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000002&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;4&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000002&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000002&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;6&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000002&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000002&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;8&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000002&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000002&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000002&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;11&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000002&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;12&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;evrep &amp;lt;- simaerep(df_visit, mult_corr = TRUE)

plot(evrep, study = &amp;quot;A&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2025-11-04-simaerep_files/figure-html/unnamed-chunk-2-1.png&#34; width=&#34;960&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;gsm.simaerep&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;{gsm.simaerep}&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;library(gsm.simaerep)
library(gsm.kri)

dfInput &amp;lt;- Input_CumCount(
  dfSubjects = clindata::rawplus_dm,
  dfNumerator = clindata::rawplus_ae,
  dfDenominator = clindata::rawplus_visdt %&amp;gt;% dplyr::mutate(visit_dt = lubridate::ymd(visit_dt)),
  strSubjectCol = &amp;quot;subjid&amp;quot;,
  strGroupCol = &amp;quot;siteid&amp;quot;,
  strGroupLevel = &amp;quot;Site&amp;quot;,
  strNumeratorDateCol = &amp;quot;aest_dt&amp;quot;,
  strDenominatorDateCol = &amp;quot;visit_dt&amp;quot;
)

dfAnalyzed &amp;lt;- Analyze_Simaerep(dfInput)

dfFlagged &amp;lt;- Flag_Simaerep(dfAnalyzed, vThreshold = c(-0.99, -0.95, 0.95, 0.99))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ℹ Sorted dfFlagged using custom Flag order: 2.Sorted dfFlagged using custom Flag order: -2.Sorted dfFlagged using custom Flag order: 1.Sorted dfFlagged using custom Flag order: -1.Sorted dfFlagged using custom Flag order: 0.&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;#&amp;gt; ℹ Sorted dfFlagged using custom Flag order: 2.Sorted dfFlagged using custom Flag order: -2.Sorted dfFlagged using custom Flag order: 1.Sorted dfFlagged using custom Flag order: -1.Sorted dfFlagged using custom Flag order: 0.

gsm.kri::Visualize_Scatter(
  dfFlagged,
  dfBounds = NULL,
  strGroupLabel = &amp;quot;GroupLevel&amp;quot;,
  strUnit = &amp;quot;Visits&amp;quot;
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2025-11-04-simaerep_files/figure-html/unnamed-chunk-3-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;impala&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;IMPALA&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;simaerep&lt;/code&gt; has been published as workproduct of the Inter-Company Quality Analytics (&lt;a href=&#34;https://impala-consortium.org/&#34;&gt;IMPALA&lt;/a&gt;) consortium. IMPALA aims to engage with Health Authorities inspectors on
defining guiding principles for the use of advanced analytics to complement, enhance and accelerate current QA practices. &lt;code&gt;simaerep&lt;/code&gt; has initially been developed at Roche but is currently evaluated by
other companies across the industry to complement their quality assurance activities (&lt;a href=&#34;https://impala-consortium.org/clinical-safety-reporting-work-product-stream/&#34;&gt;see testimonials&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://impala-consortium.org/&#34;&gt;&lt;img src=&#34;https://impala-consortium.org/wp-content/uploads/IMPALA-logo-x2.png&#34; alt=&#34;IMPALA logo&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;ressources&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Ressources&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/openpharma/simaerep/&#34;&gt;github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://openpharma.github.io/simaerep/index.html&#34;&gt;website&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;publications&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Publications&lt;/h1&gt;
&lt;p&gt;Koneswarakantha, B., Adyanthaya, R., Emerson, J. et al. An Open-Source R Package for Detection of Adverse Events Under-Reporting in Clinical Trials: Implementation and Validation by the IMPALA
(Inter coMPany quALity Analytics) Consortium. Ther Innov Regul Sci (2024). &lt;a href=&#34;https://doi.org/10.1007/s43441-024-00631-8&#34; class=&#34;uri&#34;&gt;https://doi.org/10.1007/s43441-024-00631-8&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Koneswarakantha, B., Barmaz, Y., Ménard, T. et al. &lt;em&gt;Follow-up on the Use of Advanced Analytics for Clinical Quality Assurance: Bootstrap Resampling to Enhance Detection of Adverse Event Under-Reporting.&lt;/em&gt; Drug
Saf (2020).&lt;br /&gt;
&lt;a href=&#34;https://doi.org/10.1007/s40264-020-01011-5&#34; class=&#34;uri&#34;&gt;https://doi.org/10.1007/s40264-020-01011-5&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>simaerep release 0.6.0</title>
      <link>https://www.datisticsblog.com/2024/09/simaerep-v0.6.0/</link>
      <pubDate>Mon, 30 Sep 2024 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2024/09/simaerep-v0.6.0/</guid>
      <description>


&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;p&gt;Simulate patient-related events in clinical trials with the goal of detecting over and under-reporting sites.&lt;/p&gt;
&lt;p&gt;Monitoring reporting rates of patient-related events such as adverse events (AE) in clinical trials is important for patient safety. We use bootstrap-based simulation to assign over- and under-reporting probabilities to each site in a clinical trial. The method is inspired by the ‘infer’ R package and Allen Downey’s blog article: &lt;a href=&#34;http://allendowney.blogspot.com/2011/05/there-is-only-one-test.html&#34;&gt;“There is only one test!”&lt;/a&gt;.&lt;/p&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;https://github.com/openpharma/simaerep/raw/master/man/figures/logo.png&#34; style=&#34;width: 360px;height: 360px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;div id=&#34;key-risk-indicators&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Key Risk Indicators&lt;/h1&gt;
&lt;p&gt;Statistical monitoring of clinical trial sites typical employs several key risk indicators which are operational metrics derived from activities at the clinical trial sites. The ratio
of AEs is typically one of them, the ratio of issues occurring when treating and examininig patients according to the study protocol might be another one.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;release-0.6.0&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Release 0.6.0&lt;/h1&gt;
&lt;div id=&#34;updated-algorithm&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Updated Algorithm&lt;/h2&gt;
&lt;p&gt;The default {simaerep} default algorithm picks for each site a specific evaluation point called visit_med75 based
on the individual progression of the majority of the patients at a given site. Based on this site-level metric patients from the study pool would be sampled. With the most current release &lt;code&gt;v0.6.0&lt;/code&gt; an alternative algorithm which identifies matches on patient-level for bootstrapping has been added. This algorithm has been coded with &lt;code&gt;dbplyr&lt;/code&gt; compatible table operations and can be executed within a database-backend. More details about the so called &lt;strong&gt;inframe&lt;/strong&gt; method can be found in the &lt;a href=&#34;https://openpharma.github.io/simaerep/articles/inframe.html&#34;&gt;documentation&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;increased-statistical-performance&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Increased Statistical Performance&lt;/h2&gt;
&lt;p&gt;The latest statistical &lt;a href=&#34;&#34;&gt;performance benchmark&lt;/a&gt; shows that the &lt;strong&gt;inframe&lt;/strong&gt; method with disabled visit_med75 increases the overall statistical performance of {simaerep}. We can further show that the previously implemented multiplicity correction actually decreases performance of {simaerep}. This observation was already previously made during the validataion of {siamerep} by one of the IMPALA member companies. &lt;code&gt;simaerep()&lt;/code&gt; has received a new parameter &lt;code&gt;mult_corr&lt;/code&gt; to conveniently disable the multiplicity correction.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;demo&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Demo&lt;/h2&gt;
&lt;div id=&#34;new-recommendation&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;New Recommendation&lt;/h3&gt;
&lt;p&gt;Recommended Threshold: &lt;code&gt;aerep$dfeval$prob_low_prob_ur: 0.99&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages(library(simaerep))
suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(library(knitr))

set.seed(1)

df_visit &amp;lt;- simaerep::sim_test_data_study(
  n_pat = 1000, # number of patients in study
  n_sites = 100, # number of sites in study
  frac_site_with_ur = 0.05, # fraction of sites under-reporting
  ur_rate = 0.4, # rate of under-reporting
  ae_per_visit_mean = 0.5 # mean AE per patient visit
)

df_visit$study_id &amp;lt;- &amp;quot;A&amp;quot;

df_visit %&amp;gt;%
  select(study_id, site_number, patnum, visit, n_ae) %&amp;gt;%
  head(10) %&amp;gt;%
  knitr::kable()&lt;/code&gt;&lt;/pre&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th align=&#34;left&#34;&gt;study_id&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;site_number&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;patnum&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;visit&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;n_ae&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;4&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;6&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;8&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;aerep &amp;lt;- simaerep::simaerep(
  df_visit,
  inframe = TRUE,
  visit_med75 = FALSE,
  mult_corr = FALSE
  )


plot(aerep, study = &amp;quot;A&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2024-09-30-simaerep_files/figure-html/unnamed-chunk-2-1.png&#34; width=&#34;960&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;in-database-calculation&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;In Database Calculation&lt;/h3&gt;
&lt;p&gt;We demo in database calculations with &lt;code&gt;duckdb&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;We need to provide a in database table that has as many rows as the desired replications in our simulation, instead of providing an integer for the &lt;code&gt;r&lt;/code&gt; parameter.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;con &amp;lt;- DBI::dbConnect(duckdb::duckdb(), dbdir = &amp;quot;:memory:&amp;quot;)
df_r &amp;lt;- tibble(rep = seq(1, 1000))

dplyr::copy_to(con, df_visit, &amp;quot;visit&amp;quot;)
dplyr::copy_to(con, df_r, &amp;quot;r&amp;quot;)

tbl_visit &amp;lt;- tbl(con, &amp;quot;visit&amp;quot;)
tbl_r &amp;lt;- tbl(con, &amp;quot;r&amp;quot;)


aerep &amp;lt;- simaerep(
  tbl_visit,
  r = tbl_r,
  inframe = TRUE,
  visit_med75 = FALSE,
  mult_corr = FALSE
)

plot(aerep, df_visit = tbl_visit)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## study = NULL, defaulting to study:A&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2024-09-30-simaerep_files/figure-html/unnamed-chunk-3-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;DBI::dbDisconnect(con)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;upcoming-breaking-changes&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Upcoming Breaking Changes&lt;/h1&gt;
&lt;p&gt;In the upcoming release the default settings of &lt;code&gt;siamerep&lt;/code&gt; will be changed to the new recommendations and we will remove the AE wording from the package and change input and output column names.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;impala&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;IMPALA&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;simaerep&lt;/code&gt; has been published as workproduct of the Inter-Company Quality Analytics (&lt;a href=&#34;https://impala-consortium.org/&#34;&gt;IMPALA&lt;/a&gt;) consortium. IMPALA aims to engage with Health Authorities inspectors on
defining guiding principles for the use of advanced analytics to complement, enhance and accelerate current QA practices. &lt;code&gt;simaerep&lt;/code&gt; has initially been developed at Roche but is currently evaluated by
other companies across the industry to complement their quality assurance activities (&lt;a href=&#34;https://impala-consortium.org/clinical-safety-reporting-work-product-stream/&#34;&gt;see testimonials&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://impala-consortium.org/&#34;&gt;&lt;img src=&#34;https://impala-consortium.org/wp-content/uploads/IMPALA-logo-x2.png&#34; alt=&#34;IMPALA logo&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;ressources&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Ressources&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/openpharma/simaerep/&#34;&gt;github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://openpharma.github.io/simaerep/index.html&#34;&gt;website&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;publications&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Publications&lt;/h1&gt;
&lt;p&gt;Koneswarakantha, B., Adyanthaya, R., Emerson, J. et al. An Open-Source R Package for Detection of Adverse Events Under-Reporting in Clinical Trials: Implementation and Validation by the IMPALA
(Inter coMPany quALity Analytics) Consortium. Ther Innov Regul Sci (2024). &lt;a href=&#34;https://doi.org/10.1007/s43441-024-00631-8&#34; class=&#34;uri&#34;&gt;https://doi.org/10.1007/s43441-024-00631-8&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Koneswarakantha, B., Barmaz, Y., Ménard, T. et al. &lt;em&gt;Follow-up on the Use of Advanced Analytics for Clinical Quality Assurance: Bootstrap Resampling to Enhance Detection of Adverse Event Under-Reporting.&lt;/em&gt; Drug
Saf (2020).&lt;br /&gt;
&lt;a href=&#34;https://doi.org/10.1007/s40264-020-01011-5&#34; class=&#34;uri&#34;&gt;https://doi.org/10.1007/s40264-020-01011-5&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>simaerep release 0.5.0</title>
      <link>https://www.datisticsblog.com/2024/04/simaerep-v0.5.0/</link>
      <pubDate>Thu, 11 Apr 2024 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2024/04/simaerep-v0.5.0/</guid>
      <description>


&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;p&gt;Simulate adverse event reporting in clinical trials with the goal of detecting under-reporting sites.&lt;/p&gt;
&lt;p&gt;Monitoring of Adverse Event (AE) reporting in clinical trials is important for patient safety. We use bootstrap-based simulation to assign an AE under-reporting probability to each site in a clinical trial. The method is inspired by the ‘infer’ R package and Allen Downey’s blog article: &lt;a href=&#34;http://allendowney.blogspot.com/2011/05/there-is-only-one-test.html&#34;&gt;“There is only one test!”&lt;/a&gt;.&lt;/p&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;https://github.com/openpharma/simaerep/raw/master/man/figures/logo.png&#34; style=&#34;width: 360px;height: 360px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;div id=&#34;adverse-events&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Adverse Events&lt;/h1&gt;
&lt;p&gt;An adverse event (AE) is any untoward medical occurrence in a patient or participating in a clincial trial. These events are not necessarily drug related. It could anything from
a headache to a sporting accident to a life-threatening pneunomia. It is important though for the safety of the patients that these events are being reported in a timely manner
from the clinical trial site to the sponsor of the trial so that the safety profile of the drug can be updated if necessary and appropriate actions can be taken.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;key-risk-indicators&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Key Risk Indicators&lt;/h1&gt;
&lt;p&gt;Statistical monitoring of clinical trial sites typical employs several key risk indicators which are operational metrics derived from activities at the clinical trial sites. The ratio
of AEs is typically one of them, the ratio of issues occurring when treating and examininig patients according to the study protocol might be another one.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;release-0.5.0&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Release 0.5.0&lt;/h1&gt;
&lt;p&gt;{simaerep} was originally developed to detect sites that are under-reporting Adverse Events (AE) in clinical trials using a nonparametric bootstrap algorithm. With the release of
the most current version v0.5.0 {simaerep} can also be used to detect over-reporting. With this update the algorithm can be used to detect under and over-reporting for all
patient-related clinical events at site-level. From a quality perspective under-reporting is of a greater interest than over-reporting of AE. When it comes to other events such
as site and subject issues, protocol deviations and data queries over- or high-reporting can be of the same importance as under-reporting. As high reporting can be indicative of
site problems when executing the study protocol, low- or under-reporting can be indicative of failure of reporting such issues. A detailed guideline on how to obtain both over
and under-reporting probabilities has been added to the package &lt;a href=&#34;https://openpharma.github.io/simaerep/articles/over.html&#34;&gt;documentation&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;comparison-to-other-kri-flagging-methods&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Comparison to other KRI flagging methods&lt;/h1&gt;
&lt;p&gt;The open-source landscape for R packages for clinical study quality monitoring and assurance has lately been extended with the release of the {gsm} R package which provides streamlined
reporting for monitoring of key risk indicators that directly connects to various standardized clinical data formats. It also implements a funnel plot outlier flagging method which holds
various advantages over percentile-based flagging methods. Nevertheless &lt;a href=&#34;https://openpharma.github.io/simaerep/articles/gsm_perf.html&#34;&gt;we could show&lt;/a&gt; that the algorithm used by simarep can
flag under-reporting sites more reliably mostly because event
rates are not constant over-time. This shows that the redistribution/restratification of patients to sites can be used to get more reliable flags than flagging methods that make assumptions
about the underlying process distributions.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;demo&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Demo&lt;/h1&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages(library(simaerep))
suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(library(knitr))

set.seed(1)

df_visit &amp;lt;- simaerep::sim_test_data_study(
  n_pat = 1000, # number of patients in study
  n_sites = 100, # number of sites in study
  frac_site_with_ur = 0.05, # fraction of sites under-reporting
  ur_rate = 0.4, # rate of under-reporting
  ae_per_visit_mean = 0.5 # mean AE per patient visit
)

df_visit$study_id &amp;lt;- &amp;quot;A&amp;quot;

df_visit %&amp;gt;%
  select(study_id, site_number, patnum, visit, n_ae) %&amp;gt;%
  head(10) %&amp;gt;%
  knitr::kable()&lt;/code&gt;&lt;/pre&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th align=&#34;left&#34;&gt;study_id&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;site_number&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;patnum&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;visit&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;n_ae&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;4&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;6&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;8&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;A&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;S0001&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;P000001&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;10&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;aerep &amp;lt;- simaerep::simaerep(df_visit)

plot(aerep, study = &amp;quot;A&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2024-04-11-simaerep_files/figure-html/unnamed-chunk-2-1.png&#34; width=&#34;960&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;impala&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;IMPALA&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;simaerep&lt;/code&gt; has been published as workproduct of the Inter-Company Quality Analytics (&lt;a href=&#34;https://impala-consortium.org/&#34;&gt;IMPALA&lt;/a&gt;) consortium. IMPALA aims to engage with Health Authorities inspectors on
defining guiding principles for the use of advanced analytics to complement, enhance and accelerate current QA practices. &lt;code&gt;simaerep&lt;/code&gt; has initially been developed at Roche but is currently evaluated by
other companies across the industry to complement their quality assurance activities (&lt;a href=&#34;https://impala-consortium.org/clinical-safety-reporting-work-product-stream/&#34;&gt;see testimonials&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://impala-consortium.org/&#34;&gt;&lt;img src=&#34;https://impala-consortium.org/wp-content/uploads/IMPALA-logo-x2.png&#34; alt=&#34;IMPALA logo&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;ressources&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Ressources&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/openpharma/simaerep/&#34;&gt;github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://openpharma.github.io/simaerep/index.html&#34;&gt;website&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;publications&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Publications&lt;/h1&gt;
&lt;p&gt;Koneswarakantha, B., Adyanthaya, R., Emerson, J. et al. An Open-Source R Package for Detection of Adverse Events Under-Reporting in Clinical Trials: Implementation and Validation by the IMPALA
(Inter coMPany quALity Analytics) Consortium. Ther Innov Regul Sci (2024). &lt;a href=&#34;https://doi.org/10.1007/s43441-024-00631-8&#34; class=&#34;uri&#34;&gt;https://doi.org/10.1007/s43441-024-00631-8&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Koneswarakantha, B., Barmaz, Y., Ménard, T. et al. &lt;em&gt;Follow-up on the Use of Advanced Analytics for Clinical Quality Assurance: Bootstrap Resampling to Enhance Detection of Adverse Event Under-Reporting.&lt;/em&gt; Drug
Saf (2020).&lt;br /&gt;
&lt;a href=&#34;https://doi.org/10.1007/s40264-020-01011-5&#34; class=&#34;uri&#34;&gt;https://doi.org/10.1007/s40264-020-01011-5&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>parcats 0.0.3 released</title>
      <link>https://www.datisticsblog.com/2021/10/parcats-0-0-3-released/</link>
      <pubDate>Mon, 18 Oct 2021 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2021/10/parcats-0-0-3-released/</guid>
      <description>
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/header-attrs/header-attrs.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/htmlwidgets/htmlwidgets.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/plotly.js/./plotly.min.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/parcats-binding/parcats.js&#34;&gt;&lt;/script&gt;


&lt;p&gt;&lt;a href=&#34;https://erblast.github.io/parcats/&#34;&gt;&lt;code&gt;parcats 0.0.3&lt;/code&gt;&lt;/a&gt; was released on CRAN. It is an htmlwidget providing bindings to the &lt;code&gt;plotly.js&lt;/code&gt; parcats trace, which is not supported by the &lt;code&gt;plotly&lt;/code&gt; R package. It also adds marginal histograms for numerical variables.&lt;/p&gt;
&lt;div class=&#34;figure&#34;&gt;
&lt;img src=&#34;https://raw.githubusercontent.com/erblast/parcats/master/man/figures/demo1.gif&#34; alt=&#34;&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;demogif&lt;/p&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/erblast/parcats&#34;&gt;github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://erblast.github.io/parcats/&#34;&gt;documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div id=&#34;better-shiny-support&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Better {shiny} Support&lt;/h1&gt;
&lt;p&gt;It now integrates better into &lt;code&gt;shiny&lt;/code&gt; apps. There is a new function &lt;code&gt;parcats_demo()&lt;/code&gt; which let’s you interactively explore all the different parameters of &lt;code&gt;easyalluvial::alluvial_wide()&lt;/code&gt; and &lt;code&gt;parcats::parcats()&lt;/code&gt;. You can see how the alluvial plot and the derived interactive parcats widget look like with different parameters.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://erblast.shinyapps.io/parcats/&#34;&gt;demo&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;update-plotly.js&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Update {plotly.js}&lt;/h1&gt;
&lt;p&gt;In order to be 100% compatible with R &lt;code&gt;plotly&lt;/code&gt;. &lt;code&gt;plotly.js&lt;/code&gt; that is shipped with &lt;code&gt;parcats&lt;/code&gt; has been upgraded to &lt;code&gt;v2.5.1&lt;/code&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;parcats-from-alluvial-plot&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Parcats from Alluvial Plot&lt;/h1&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages(require(tidyverse))
suppressPackageStartupMessages(require(easyalluvial))
suppressPackageStartupMessages(require(parcats))
suppressPackageStartupMessages(require(parsnip))&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p = alluvial_wide(mtcars2, max_variables = 5)

parcats(p, marginal_histograms = TRUE, data_input = mtcars2)&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;htmlwidget-1&#34; style=&#34;width:960px;height:672px;&#34; class=&#34;parcats html-widget&#34;&gt;&lt;/div&gt;
&lt;script type=&#34;application/json&#34; data-for=&#34;htmlwidget-1&#34;&gt;{&#34;x&#34;:{&#34;traces&#34;:{&#34;parcats&#34;:{&#34;type&#34;:&#34;parcats&#34;,&#34;dimensions&#34;:[{&#34;label&#34;:&#34;mpg&#34;,&#34;values&#34;:[&#34;HH&#34;,&#34;HH&#34;,&#34;HH&#34;,&#34;LL&#34;,&#34;LL&#34;,&#34;M&#34;,&#34;M&#34;,&#34;M&#34;,&#34;M&#34;,&#34;M&#34;,&#34;M&#34;,&#34;M&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;ML&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;HH&#34;,&#34;MH&#34;,&#34;M&#34;,&#34;ML&#34;,&#34;LL&#34;]},{&#34;label&#34;:&#34;cyl&#34;,&#34;values&#34;:[&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;8&#34;,&#34;8&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;6&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;8&#34;,&#34;6&#34;,&#34;4&#34;]},{&#34;label&#34;:&#34;disp&#34;,&#34;values&#34;:[&#34;LL&#34;,&#34;LL&#34;,&#34;LL&#34;,&#34;HH&#34;,&#34;MH&#34;,&#34;M&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;HH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;LL&#34;,&#34;LL&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;M&#34;,&#34;HH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;HH&#34;,&#34;MH&#34;,&#34;M&#34;,&#34;ML&#34;,&#34;LL&#34;]},{&#34;label&#34;:&#34;hp&#34;,&#34;values&#34;:[&#34;LL&#34;,&#34;LL&#34;,&#34;ML&#34;,&#34;MH&#34;,&#34;HH&#34;,&#34;ML&#34;,&#34;M&#34;,&#34;MH&#34;,&#34;ML&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;LL&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;MH&#34;,&#34;HH&#34;,&#34;HH&#34;,&#34;HH&#34;,&#34;M&#34;,&#34;M&#34;,&#34;MH&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;HH&#34;,&#34;MH&#34;,&#34;M&#34;,&#34;ML&#34;,&#34;LL&#34;]},{&#34;label&#34;:&#34;drat&#34;,&#34;values&#34;:[&#34;HH&#34;,&#34;MH&#34;,&#34;M&#34;,&#34;LL&#34;,&#34;M&#34;,&#34;LL&#34;,&#34;M&#34;,&#34;M&#34;,&#34;M&#34;,&#34;LL&#34;,&#34;LL&#34;,&#34;ML&#34;,&#34;M&#34;,&#34;MH&#34;,&#34;M&#34;,&#34;M&#34;,&#34;LL&#34;,&#34;ML&#34;,&#34;M&#34;,&#34;MH&#34;,&#34;ML&#34;,&#34;LL&#34;,&#34;ML&#34;,&#34;LL&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;HH&#34;,&#34;MH&#34;,&#34;M&#34;,&#34;ML&#34;,&#34;LL&#34;]}],&#34;counts&#34;:[1,3,1,2,1,1,2,1,2,1,1,1,2,2,1,1,1,1,1,1,1,1,1,2],&#34;line&#34;:{&#34;shape&#34;:&#34;hspline&#34;,&#34;color&#34;:[&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;]},&#34;hoveron&#34;:&#34;color&#34;,&#34;hoverinfo&#34;:&#34;count+probability&#34;,&#34;labelfont&#34;:{&#34;size&#34;:24,&#34;color&#34;:&#34;black&#34;},&#34;arrangement&#34;:&#34;perpendicular&#34;,&#34;bundlecolors&#34;:true,&#34;sortpaths&#34;:&#34;forward&#34;,&#34;tickfont&#34;:null,&#34;domain&#34;:{&#34;y&#34;:[0,0.7]}},&#34;mpg_LL&#34;:{&#34;x&#34;:[2.96996268656716,3.04503132575868,3.1200999649502,3.19516860414172,3.27023724333324,3.34530588252475,3.42037452171627,3.49544316090779,3.57051180009931,3.64558043929083,3.72064907848234,3.79571771767386,3.87078635686538,3.9458549960569,4.02092363524842,4.09599227443993,4.17106091363145,4.24612955282297,4.32119819201449,4.396266831206,4.47133547039752,4.54640410958904,4.62147274878056,4.69654138797208,4.77161002716359,4.84667866635511,4.92174730554663,4.99681594473815,5.07188458392967,5.14695322312118,5.2220218623127,5.29709050150422,5.37215914069574,5.44722777988726,5.52229641907877,5.59736505827029,5.67243369746181,5.74750233665333,5.82257097584485,5.89763961503636,5.97270825422788,6.0477768934194,6.12284553261092,6.19791417180244,6.27298281099395,6.34805145018547,6.42312008937699,6.49818872856851,6.57325736776003,6.64832600695154,6.72339464614306,6.79846328533458,6.8735319245261,6.94860056371762,7.02366920290913,7.09873784210065,7.17380648129217,7.24887512048369,7.3239437596752,7.39901239886672,7.47408103805824,7.54914967724976,7.62421831644128,7.69928695563279,7.77435559482431,7.84942423401583,7.92449287320735,7.99956151239887,8.07463015159038,8.1496987907819,8.22476742997342,8.29983606916494,8.37490470835646,8.44997334754797,8.52504198673949,8.60011062593101,8.67517926512253,8.75024790431405,8.82531654350556,8.90038518269708,8.9754538218886,9.05052246108012,9.12559110027163,9.20065973946315,9.27572837865467,9.35079701784619,9.42586565703771,9.50093429622923,9.57600293542074,9.65107157461226,9.72614021380378,9.8012088529953,9.87627749218682,9.95134613137833,10.0264147705699,10.1014834097614,10.1765520489529,10.2516206881444,10.3266893273359,10.4017579665274,10.476826605719,10.5518952449105,10.626963884102,10.7020325232935,10.777101162485,10.8521698016765,10.9272384408681,11.0023070800596,11.0773757192511,11.1524443584426,11.2275129976341,11.3025816368257,11.3776502760172,11.4527189152087,11.5277875544002,11.6028561935917,11.6779248327832,11.7529934719748,11.8280621111663,11.9031307503578,11.9781993895493,12.0532680287408,12.1283366679324,12.2034053071239,12.2784739463154,12.3535425855069,12.4286112246984,12.5036798638899,12.5787485030815,12.653817142273,12.7288857814645,12.803954420656,12.8790230598475,12.9540916990391,13.0291603382306,13.1042289774221,13.1792976166136,13.2543662558051,13.3294348949966,13.4045035341882,13.4795721733797,13.5546408125712,13.6297094517627,13.7047780909542,13.7798467301457],&#34;y&#34;:[0.000114229889951918,0.000125273732728626,0.000137050151569663,0.000149514448557863,0.000163548707093741,0.00017842086769883,0.000194189645158505,0.000211800991279835,0.000230417785779494,0.000250186134516725,0.000272091353413302,0.000295190853282914,0.000319748138090844,0.000346753678164109,0.000375163278516302,0.000405392353352029,0.00043839191630835,0.000473025083171863,0.000509897608297056,0.000549865884799234,0.000591714932801751,0.000636282193585794,0.000684264269333187,0.00073438873123137,0.000787767533919762,0.000844863679659825,0.000904374032794606,0.000967727509301853,0.00103507332727553,0.00110511011541999,0.00117962360481525,0.00125836582832946,0.00134007455387213,0.00142692713169268,0.00151819575096023,0.0016126982973312,0.00171303097435456,0.00181790876909982,0.00192627252375892,0.00204115460244825,0.00216064557042484,0.00228385182340513,0.00241424734268497,0.00254924588638339,0.00268815944027951,0.0028348960102069,0.00298615903981131,0.00314150124168559,0.00330524381785147,0.00347336810328754,0.00364580684975305,0.00382692787661865,0.00401233499398705,0.00420243406989608,0.00440104244661222,0.00460397348017972,0.00481193213809767,0.00502813429726787,0.00524865605531255,0.00547449396545618,0.00570823503504366,0.00594625891078352,0.00618984036323931,0.0064409330600869,0.00669624683271584,0.00695731896374735,0.00722548499335452,0.0074977968566662,0.00777604073693687,0.0080609631184595,0.0083499561064188,0.00864504824106554,0.00894643182590742,0.00925182565737347,0.00956350616164292,0.00988114251064116,0.0102027587968439,0.0105309013458707,0.0108647331794483,0.0112025590342439,0.011547236767962,0.0118974165128855,0.0122516609834645,0.0126132019991806,0.012980138623248,0.0133512761133107,0.0137303021027543,0.0141146905339388,0.0145034855963567,0.0149009276537631,0.0153037556724812,0.0157112642465902,0.0161283509199834,0.0165508795035261,0.0169784228663741,0.0174166371255152,0.0178603517797577,0.0183097457170008,0.0187704650058753,0.0192369975629635,0.0197100471319284,0.0201948572574038,0.0206858798277631,0.0211843072095414,0.0216948285594811,0.0222119236444772,0.0227373144896621,0.0232749660742645,0.0238194790893781,0.0243731204029669,0.0249389641095947,0.0255118465438023,0.0260945574178793,0.0266891403556056,0.0272907933140105,0.0279027597420157,0.0285259652044185,0.0291560939853421,0.0297967197565422,0.0304476376619687,0.0311051281846789,0.031772913735407,0.0324497409359108,0.0331325681935215,0.0338250282288393,0.0345250077956126,0.0352301850562352,0.0359438137775108,0.0366632203232897,0.0373867956064091,0.0381170855944091,0.0388512610006622,0.0395883645463794,0.0403298819396755,0.0410733226970109,0.0418182659125721,0.0425647807342156,0.0433112747038546,0.0440576976478669,0.044802364259259,0.0455451712759395,0.0462862140481823,0.0470218113915404,0.0477538790156692,0.0484821446565278],&#34;fillcolor&#34;:&#34;#FF0065&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#FF0065&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#FF0065&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;LL&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;mpg_ML&#34;:{&#34;x&#34;:[13.8549153693373,13.9299840085288,14.0050526477203,14.0801212869118,14.1551899261033,14.2302585652949,14.3053272044864,14.3803958436779,14.4554644828694,14.5305331220609,14.6056017612524,14.680670400444,14.7557390396355,14.830807678827,14.9058763180185,14.98094495721,15.0560135964016,15.1310822355931,15.2061508747846,15.2812195139761,15.3562881531676,15.4313567923591,15.5064254315507,15.5814940707422,15.6565627099337,15.7316313491252,15.8066999883167,15.8817686275083,15.9568372666998,16.0319059058913,16.1069745450828,16.1820431842743,16.2571118234658,16.3321804626574,16.4072491018489,16.4823177410404,16.5573863802319,16.6324550194234,16.7075236586149,16.7825922978065],&#34;y&#34;:[0.0492015875490189,0.0499157906849128,0.0506239262649292,0.0513201951201251,0.0520095863574055,0.0526904982752669,0.0533569422312706,0.0540149987916339,0.0546621137887025,0.0552926856883678,0.0559135388539339,0.0565210415399491,0.0571105049903819,0.0576891388589819,0.0582521716549459,0.0587962683880539,0.0593286766734319,0.059843490489783,0.0603390587366376,0.0608223509644597,0.0612863981530185,0.0617314358410082,0.0621638874833518,0.0625758523747786,0.0629695224225652,0.0633505670227897,0.0637103333927429,0.0640529119557001,0.0643830768624863,0.0646916356526201,0.0649844076024407,0.0652651983007734,0.0655245025638205,0.065769611533718,0.0660033525017636,0.0662161295920915,0.0664163923873938,0.0666060347353955,0.0667755680363576,0.0669342649578231],&#34;fillcolor&#34;:&#34;#009850&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#009850&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#009850&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;ML&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;mpg_M&#34;:{&#34;x&#34;:[16.857660936998,16.9327295761895,17.007798215381,17.0828668545725,17.1579354937641,17.2330041329556,17.3080727721471,17.3831414113386,17.4582100505301,17.5332786897216,17.6083473289132,17.6834159681047,17.7584846072962,17.8335532464877,17.9086218856792,17.9836905248708,18.0587591640623,18.1338278032538,18.2088964424453,18.2839650816368,18.3590337208283,18.4341023600199,18.5091709992114,18.5842396384029,18.6593082775944,18.7343769167859,18.8094455559775,18.884514195169,18.9595828343605,19.034651473552,19.1097201127435,19.184788751935,19.2598573911266,19.3349260303181,19.4099946695096,19.4850633087011,19.5601319478926,19.6352005870841,19.7102692262757,19.7853378654672,19.8604065046587,19.9354751438502,20.0105437830417,20.0856124222333,20.1606810614248,20.2357497006163,20.3108183398078,20.3858869789993,20.4609556181908,20.5360242573824,20.6110928965739,20.6861615357654,20.7612301749569,20.8362988141484,20.91136745334,20.9864360925315,21.061504731723,21.1365733709145],&#34;y&#34;:[0.0670831726888495,0.0672130665374253,0.0673337201126039,0.0674451809291316,0.0675393895162468,0.0676255442685601,0.0677028563900642,0.0677651513573859,0.0678201666094758,0.0678667236707489,0.0679002024415557,0.067927068845819,0.0679458272511997,0.0679530984411411,0.0679542870907898,0.0679476158335419,0.0679306780801021,0.067908028835629,0.0678776037870206,0.0678377673350176,0.0677924205679144,0.0677391670424319,0.0676770203348596,0.0676093938007805,0.0675334784000283,0.0674488994872161,0.0673587096352501,0.0672595797145926,0.0671517900375297,0.0670381148572513,0.0669145815719605,0.0667822376920479,0.0666436162842428,0.0664939751479885,0.0663352923518843,0.0661698548433573,0.065992036131299,0.0658049365767762,0.0656105568206685,0.0654022970043372,0.0651845742106906,0.0649590369370421,0.0647180616587153,0.0644675526862324,0.0642087263933387,0.0639329352676019,0.0636476918659782,0.0633536987604394,0.0630413425124595,0.062719792830209,0.0623886523029847,0.0620390086008308,0.0616801017122958,0.061310775372805,0.0609233799319284,0.0605267064243477,0.0601189704145019,0.0596939646610578],&#34;fillcolor&#34;:&#34;#A56F2B&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#A56F2B&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#A56F2B&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;M&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;mpg_MH&#34;:{&#34;x&#34;:[21.211642010106,21.2867106492975,21.3617792884891,21.4368479276806,21.5119165668721,21.5869852060636,21.6620538452551,21.7371224844467,21.8121911236382,21.8872597628297,21.9623284020212,22.0373970412127,22.1124656804042,22.1875343195958,22.2626029587873,22.3376715979788,22.4127402371703,22.4878088763618,22.5628775155533,22.6379461547449,22.7130147939364,22.7880834331279,22.8631520723194,22.9382207115109,23.0132893507025,23.088357989894,23.1634266290855,23.238495268277,23.3135639074685,23.38863254666,23.4637011858516,23.5387698250431,23.6138384642346,23.6889071034261,23.7639757426176,23.8390443818092,23.9141130210007,23.9891816601922,24.0642502993837,24.1393189385752,24.2143875777667,24.2894562169583,24.3645248561498,24.4395934953413,24.5146621345328,24.5897307737243,24.6647994129159,24.7398680521074,24.8149366912989,24.8900053304904,24.9650739696819,25.0401426088734,25.115211248065,25.1902798872565,25.265348526448,25.3404171656395,25.415485804831,25.4905544440225,25.5656230832141,25.6406917224056,25.7157603615971,25.7908290007886,25.8658976399801,25.9409662791717,26.0160349183632,26.0911035575547,26.1661721967462,26.2412408359377,26.3163094751292,26.3913781143208,26.4664467535123,26.5415153927038,26.6165840318953],&#34;y&#34;:[0.059259847792459,0.0588142712837906,0.0583525776493199,0.0578821310903507,0.0574001269997778,0.0569034791960782,0.0563986290457527,0.0558824653752783,0.0553534023360636,0.0548168728813581,0.0542696447286468,0.053711469101004,0.0531467335908559,0.0525722979014553,0.0519890017249994,0.0514002011598197,0.0508030781982394,0.0501992400197976,0.0495910745237401,0.0489763217189034,0.0483569807626469,0.047734579415901,0.0471076445821018,0.0464781586448889,0.0458469346254187,0.0452134964837048,0.0445793908845901,0.0439448893387,0.0433106937006642,0.0426775088365751,0.042045255025224,0.0414159549184166,0.0407890997477807,0.0401644546896987,0.039545462105019,0.0389300802121295,0.0383181593967295,0.037714466155406,0.0371153199871162,0.0365210945965443,0.0359369533632598,0.0353583308523981,0.0347860935385033,0.0342253842147137,0.0336710304119423,0.0331244868555602,0.0325905108764094,0.0320635855212454,0.031545816877892,0.0310412744525422,0.0305443347493063,0.030057787047044,0.0295847780056226,0.0291197843524882,0.028666281873045,0.0282263268466158,0.0277946680039127,0.0273754463619757,0.0269695240219589,0.0265720572854393,0.0261878110245049,0.0258164064978562,0.0254535079204524,0.025104447020359,0.0247676064064712,0.0244392260110327,0.0241251357643548,0.0238225219036058,0.0235282391366668,0.0232485383683775,0.0229794836107023,0.0227185589572238,0.0224723524655867],&#34;fillcolor&#34;:&#34;#005EAA&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#005EAA&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#005EAA&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;MH&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;mpg_HH&#34;:{&#34;x&#34;:[26.6916526710868,26.7667213102784,26.8417899494699,26.9168585886614,26.9919272278529,27.0669958670444,27.1420645062359,27.2171331454275,27.292201784619,27.3672704238105,27.442339063002,27.5174077021935,27.5924763413851,27.6675449805766,27.7426136197681,27.8176822589596,27.8927508981511,27.9678195373426,28.0428881765342,28.1179568157257,28.1930254549172,28.2680940941087,28.3431627333002,28.4182313724917,28.4933000116833,28.5683686508748,28.6434372900663,28.7185059292578,28.7935745684493,28.8686432076409,28.9437118468324,29.0187804860239,29.0938491252154,29.1689177644069,29.2439864035984,29.31905504279,29.3941236819815,29.469192321173,29.5442609603645,29.619329599556,29.6943982387476,29.7694668779391,29.8445355171306,29.9196041563221,29.9946727955136,30.0697414347051,30.1448100738967,30.2198787130882,30.2949473522797,30.3700159914712,30.4450846306627,30.5201532698543,30.5952219090458,30.6702905482373,30.7453591874288,30.8204278266203,30.8954964658118,30.9705651050034,31.0456337441949,31.1207023833864,31.1957710225779,31.2708396617694,31.345908300961,31.4209769401525,31.496045579344,31.5711142185355,31.646182857727,31.7212514969185,31.7963201361101,31.8713887753016,31.9464574144931,32.0215260536846,32.0965946928761,32.1716633320676,32.2467319712592,32.3218006104507,32.3968692496422,32.4719378888337,32.5470065280252,32.6220751672167,32.6971438064083,32.7722124455998,32.8472810847913,32.9223497239828,32.9974183631743,33.0724870023659,33.1475556415574,33.2226242807489,33.2976929199404,33.3727615591319,33.4478301983235,33.522898837515,33.5979674767065,33.673036115898,33.7481047550895,33.823173394281,33.8982420334726,33.9733106726641,34.0483793118556,34.1234479510471,34.1985165902386,34.2735852294301,34.3486538686217,34.4237225078132,34.4987911470047,34.5738597861962,34.6489284253877,34.7239970645793,34.7990657037708,34.8741343429623,34.9492029821538,35.0242716213453,35.0993402605368,35.1744088997284,35.2494775389199,35.3245461781114,35.3996148173029,35.4746834564944,35.549752095686,35.6248207348775,35.699889374069,35.7749580132605,35.850026652452,35.9250952916435,36.0001639308351,36.0752325700266,36.1503012092181,36.2253698484096,36.3004384876011,36.3755071267926,36.4505757659842,36.5256444051757,36.6007130443672,36.6757816835587,36.7508503227502,36.8259189619418,36.9009876011333,36.9760562403248,37.0511248795163,37.1261935187078,37.2012621578994,37.2763307970909,37.3513994362824,37.4264680754739,37.5015367146654,37.5766053538569,37.6516739930485,37.72674263224,37.8018112714315,37.876879910623,37.9519485498145,38.027017189006,38.1020858281976,38.1771544673891,38.2522231065806,38.3272917457721,38.4023603849636,38.4774290241552,38.5524976633467,38.6275663025382,38.7026349417297,38.7777035809212,38.8527722201127,38.9278408593043,39.0029094984958,39.0779781376873,39.1530467768788,39.2281154160703,39.3031840552619,39.3782526944534,39.4533213336449,39.5283899728364,39.6034586120279,39.6785272512194,39.753595890411,39.8286645296025,39.903733168794,39.9788018079855,40.053870447177,40.1289390863685,40.2040077255601,40.2790763647516,40.3541450039431,40.4292136431346,40.5042822823261,40.5793509215177,40.6544195607092,40.7294881999007,40.8045568390922,40.8796254782837,40.9546941174752,41.0297627566668,41.1048313958583,41.1799000350498,41.2549686742413,41.3300373134328],&#34;y&#34;:[0.0222359050903225,0.0220073247261404,0.0217934470120905,0.0215884090640308,0.0213909205690378,0.0212079692739273,0.0210329247967187,0.020865063177382,0.0207114220325011,0.0205647558862172,0.0204251007903076,0.0202987127239451,0.0201786212615207,0.0200654784143913,0.0199641794396866,0.0198686751947915,0.0197799377776933,0.0197016011868594,0.0196285143249308,0.0195618838759074,0.0195042013494479,0.0194511809141234,0.0194041691260234,0.0193646538117595,0.01932917175265,0.0192991062342418,0.0192751007142036,0.0192544613318477,0.019238498082011,0.0192271894132118,0.0192185462539002,0.0192136908392892,0.0192121341003209,0.0192125155494985,0.0192156540395949,0.0192208049472464,0.0192271488909842,0.0192350885946818,0.0192438448631322,0.0192530419023504,0.019262560971588,0.0192718112574272,0.0192807551535821,0.0192886592662957,0.0192953378498803,0.0193009812245984,0.0193041649059721,0.0193053097587176,0.0193047226142344,0.0193002323501242,0.019293043960149,0.0192834723593199,0.019268568517333,0.0192504667992848,0.0192293890452671,0.0192016037364312,0.019170280518466,0.0191352281816972,0.0190926467342532,0.0190461116592218,0.0189950953848759,0.0189360173935566,0.018872635541656,0.0188040718489362,0.0187271525737499,0.0186456726523495,0.0185583885801243,0.0184626819984024,0.0183622544938361,0.0182555037923272,0.0181404729001704,0.018020658095215,0.017894126427459,0.0177596436269259,0.0176204098177031,0.0174742094727197,0.0173205476462964,0.0171622602198725,0.016996915169023,0.0168247302835838,0.0166481325351633,0.0164645548669329,0.0162748610848089,0.0160810477685971,0.0158805066292131,0.0156746449514097,0.015465029591231,0.0152491137657672,0.0150287152174851,0.0148049921788406,0.0145755674031001,0.0143425117236918,0.0141066139974137,0.0138657760289471,0.0136221467751269,0.0133762003712007,0.0131262247974533,0.0128742617322952,0.0126205375516341,0.0123638272945128,0.0121058769293974,0.011846725517612,0.0115857724810267,0.0113242376672141,0.0110620768721777,0.0107993696564901,0.0105366591816821,0.0102739744907838,0.0100118944893552,0.00975037370864591,0.00948959081453261,0.00923043939368806,0.00897238299450102,0.00871581806430377,0.00846177172974433,0.00820931977552797,0.00795913366641453,0.00771220340271279,0.00746732180057261,0.00722547948185629,0.00698747537078352,0.00675192184869771,0.00652015819970899,0.00629266031015632,0.00606795686162937,0.00584774984356118,0.00563208620357928,0.00541949876135071,0.0052120507134402,0.00500928292989102,0.00480980877368389,0.00461603627213573,0.00442695306964015,0.00424131617124104,0.00406184853398545,0.00388696716212249,0.00371562134508756,0.0035508074929813,0.00339038262240756,0.00323352208714429,0.00308344511102575,0.00293748452954117,0.00279506099149529,0.00265955945207812,0.00252784560310971,0.00239959103413078,0.00227828576162718,0.00216040195857675,0.00204599295442202,0.00193818070664026,0.00183354071983298,0.00173241929341168,0.00163731564290115,0.00154519529769942,0.00145657831258937,0.00137337467713549,0.00129294412164485,0.00121594683573901,0.00114375343214423,0.00107410882417359,0.00100777843441016,0.000945654777335617,0.000885848291185367,0.000829195318860362,0.00077617831308329,0.00072524556209966,0.000677272149737364,0.000632401044393554,0.000589385237987149,0.000549109686833407,0.000511447392680604,0.000475419779431035,0.000441896920012362,0.000410547420533136,0.000380623796161366,0.000352961035157659,0.00032708283536957,0.000302436102284799,0.000279805212672391,0.000258620954894212,0.000238489898469976,0.000220134806074134,0.000202937332227206,0.000186631921280278,0.00017187288344902,0.00015802813497583,0.000144931757035498,0.000133166426187584,0.0001221136448986,0.000111682750933327,0.000102384668940646,9.36343974145132e-05,8.53960585846729e-05,7.81111418713846e-05,7.12415249248712e-05,6.48141936795621e-05],&#34;fillcolor&#34;:&#34;#710500&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#710500&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#710500&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;HH&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;cyl_4&#34;:{&#34;x&#34;:[&#34;4&#34;],&#34;y&#34;:[11],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;#BDBDBD&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;cyl_4&#34;,&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y2&#34;},&#34;cyl_6&#34;:{&#34;x&#34;:[&#34;6&#34;],&#34;y&#34;:[7],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;#525252&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;cyl_6&#34;,&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y2&#34;},&#34;cyl_8&#34;:{&#34;x&#34;:[&#34;8&#34;],&#34;y&#34;:[14],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;#969696&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;cyl_8&#34;,&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y2&#34;},&#34;disp_LL&#34;:{&#34;x&#34;:[-96.2172366723656,-94.7778345718867,-93.3384324714078,-91.8990303709289,-90.4596282704499,-89.020226169971,-87.5808240694921,-86.1414219690132,-84.7020198685342,-83.2626177680553,-81.8232156675764,-80.3838135670974,-78.9444114666185,-77.5050093661396,-76.0656072656607,-74.6262051651817,-73.1868030647028,-71.7474009642239,-70.307998863745,-68.868596763266,-67.4291946627871,-65.9897925623082,-64.5503904618293,-63.1109883613503,-61.6715862608714,-60.2321841603925,-58.7927820599135,-57.3533799594346,-55.9139778589557,-54.4745757584768,-53.0351736579978,-51.5957715575189,-50.15636945704,-48.7169673565611,-47.2775652560821,-45.8381631556032,-44.3987610551243,-42.9593589546454,-41.5199568541664,-40.0805547536875,-38.6411526532086,-37.2017505527297,-35.7623484522507,-34.3229463517718,-32.8835442512929,-31.444142150814,-30.004740050335,-28.5653379498561,-27.1259358493772,-25.6865337488982,-24.2471316484193,-22.8077295479404,-21.3683274474615,-19.9289253469825,-18.4895232465036,-17.0501211460247,-15.6107190455458,-14.1713169450668,-12.7319148445879,-11.292512744109,-9.85311064363006,-8.41370854315113,-6.97430644267222,-5.53490434219329,-4.09550224171436,-2.65610014123543,-1.2166980407565,0.222704059722417,1.66210616020135,3.10150826068028,4.54091036115921,5.98031246163812,7.41971456211705,8.85911666259598,10.2985187630749,11.7379208635538,13.1773229640328,14.6167250645117,16.0561271649906,17.4955292654695,18.9349313659485,20.3743334664274,21.8137355669063,23.2531376673852,24.6925397678642,26.1319418683431,27.571343968822,29.010746069301,30.4501481697799,31.8895502702588,33.3289523707377,34.7683544712166,36.2077565716956,37.6471586721745,39.0865607726534,40.5259628731324,41.9653649736113,43.4047670740902,44.8441691745691,46.283571275048,47.722973375527,49.1623754760059,50.6017775764848,52.0411796769638,53.4805817774427,54.9199838779216,56.3593859784006,57.7987880788795,59.2381901793584,60.6775922798373,62.1169943803162,63.5563964807952,64.9957985812741,66.435200681753,67.874602782232,69.3140048827109,70.7534069831898,72.1928090836687,73.6322111841476,75.0716132846266,76.5110153851055,77.9504174855844,79.3898195860634,80.8292216865423,82.2686237870212,83.7080258875001,85.1474279879791,86.586830088458,88.0262321889369,89.4656342894158,90.9050363898948,92.3444384903737,93.7838405908526,95.2232426913315,96.6626447918105,98.1020468922894,99.5414489927683,100.980851093247,102.420253193726,103.859655294205,105.299057394684,106.738459495163,108.177861595642,109.617263696121,111.0566657966,112.496067897079,113.935469997558,115.374872098037,116.814274198515,118.253676298994,119.693078399473,121.132480499952,122.571882600431,124.01128470091,125.450686801389,126.890088901868,128.329491002347,129.768893102826],&#34;y&#34;:[9.10597711225509e-06,9.86358340673543e-06,1.07004180849651e-05,1.15928175453706e-05,1.25324785628445e-05,1.35782274319107e-05,1.46724881957035e-05,1.58510422507725e-05,1.71289407295951e-05,1.84626214185881e-05,1.99304708925988e-05,2.14825270002367e-05,2.31163508431506e-05,2.49137094930455e-05,2.67873860242217e-05,2.88009628246614e-05,3.09629936214023e-05,3.32114913644765e-05,3.56757454783458e-05,3.8260809453213e-05,4.09797650440826e-05,4.39380126026494e-05,4.70105427303938e-05,5.03032381341823e-05,5.38062082911541e-05,5.74367346422903e-05,6.13963797494854e-05,6.55198072971415e-05,6.98505956996887e-05,7.45132869912322e-05,7.93386725765287e-05,8.44922084662555e-05,8.99275807724509e-05,9.55417904731619e-05,0.000101631545522273,0.000107930619145227,0.000114533078313971,0.000121571109594818,0.000128828968178006,0.000136549280288523,0.000144626252139915,0.000152952667452051,0.000161905464525402,0.000171121235354823,0.000180755566625449,0.000190929390440984,0.000201384471592558,0.000212454293090077,0.000223948956183877,0.000235783679965595,0.000248373267556015,0.000261286052119159,0.000274741807185116,0.00028882595459573,0.000303249713171469,0.000318441513669014,0.000334107549974098,0.000350207167046892,0.000367160383356311,0.000384487171480915,0.000402473265593406,0.000421143975025465,0.000440199709794984,0.00046015225812117,0.000480597537857382,0.000501556967622618,0.000523415748362049,0.000545677730802188,0.000568683490745802,0.000592380809281077,0.000616484564462376,0.000641557811803891,0.000667102249717711,0.000693208048653006,0.000720186107611311,0.000747565517121796,0.000775714166644211,0.000804500531521266,0.000833680465761233,0.000863814011960265,0.00089435378806076,0.000925446989138449,0.000957301124346755,0.000989514948811536,0.00102243901281606,0.00105588324488578,0.00108966923971551,0.0011242727478434,0.00115918072581932,0.00119456037528297,0.00123050627148266,0.00126672658829407,0.00130349584166038,0.00134061147943764,0.00137798793059698,0.0014158878901883,0.00145397719078177,0.00149237182510673,0.00153106905754313,0.00156991399301857,0.00160903932157945,0.00164829829974095,0.00168767230828293,0.00172720148271209,0.00176676874878991,0.00180639137613772,0.00184601018304907,0.0018856169728304,0.00192513956931805,0.0019645684093585,0.00200390513173991,0.00204299185549813,0.00208194177588119,0.00212062797155228,0.00215899492574387,0.00219717106190658,0.0022348301213017,0.00227218036769751,0.00230918430248302,0.00234554065582892,0.00238157848439704,0.00241699202582453,0.00245179777587612,0.00248623254017793,0.00251969103098455,0.0025526632282525,0.00258501235334202,0.00261636853285432,0.00264723676270544,0.00267711693560834,0.00270616024209444,0.00273467041201177,0.00276177068945495,0.00278826436693232,0.00281386806762322,0.0028382244934149,0.00286195506623483,0.00288437555945169,0.00290581456215493,0.00292655875041668,0.00294561398898035,0.00296397443703654,0.00298122482175316,0.00299709286928253,0.00301224586343694,0.00302585512982989,0.00303843704740196,0.00305018679345961,0.00306016170902631,0.00306939512838262,0.00307738226496424,0.00308398549045226,0.00308984622449185,0.00309406022479555,0.00309730164890629,0.00309964334003941,0.00310029353058968,0.00310022293059074],&#34;fillcolor&#34;:&#34;#BDBDBD&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#BDBDBD&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#BDBDBD&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;LL&#34;,&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y3&#34;},&#34;disp_ML&#34;:{&#34;x&#34;:[131.208295203305,132.647697303784,134.087099404263,135.526501504741,136.96590360522,138.405305705699,139.844707806178,141.284109906657,142.723512007136,144.162914107615,145.602316208094,147.041718308573,148.481120409052,149.920522509531,151.35992461001,152.799326710489,154.238728810968,155.678130911446,157.117533011925,158.556935112404,159.996337212883,161.435739313362,162.875141413841,164.31454351432,165.753945614799,167.193347715278,168.632749815757,170.072151916236,171.511554016715,172.950956117194,174.390358217672,175.829760318151,177.26916241863,178.708564519109,180.147966619588,181.587368720067,183.026770820546,184.466172921025,185.905575021504,187.344977121983,188.784379222462,190.223781322941,191.66318342342,193.102585523899,194.541987624377,195.981389724856],&#34;y&#34;:[0.00309888530206398,0.00309629367933053,0.00309300078711468,0.0030881196436992,0.00308241017313054,0.00307582614199614,0.00306779243419953,0.00305912744080253,0.00304930990529351,0.00303848081289773,0.00302705922651966,0.00301428124373592,0.00300088542713339,0.00298674476766675,0.00297152280807392,0.00295582030767817,0.00293921653327193,0.00292192161886487,0.00290420025260264,0.00288551419447884,0.00286645465502159,0.00284688013713752,0.00282666887569577,0.00280617225936369,0.00278514124278127,0.00276377166579767,0.0027421769012565,0.00272013264390088,0.0026979539124423,0.00267556681279349,0.00265300169797225,0.00263036628806133,0.00260763459486926,0.00258489922986851,0.00256216106681396,0.00253952062762841,0.00251695761062645,0.00249452844160178,0.00247233084794881,0.00245026901363877,0.00242855792149151,0.0024071155118373,0.00238590710236612,0.00236524813390321,0.00234484912868637,0.00232490909390296],&#34;fillcolor&#34;:&#34;#525252&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#525252&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#525252&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;ML&#34;,&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y3&#34;},&#34;disp_M&#34;:{&#34;x&#34;:[197.420791825335,198.860193925814,200.299596026293,201.738998126772,203.178400227251,204.61780232773,206.057204428209,207.496606528688,208.936008629167,210.375410729646,211.814812830125,213.254214930603,214.693617031082,216.133019131561,217.57242123204,219.011823332519,220.451225432998,221.890627533477,223.330029633956,224.769431734435,226.208833834914,227.648235935393,229.087638035872,230.527040136351,231.96644223683,233.405844337308,234.845246437787,236.284648538266,237.724050638745,239.163452739224,240.602854839703,242.042256940182,243.481659040661,244.92106114114,246.360463241619,247.799865342098,249.239267442577,250.678669543056,252.118071643535,253.557473744013,254.996875844492,256.436277944971,257.87568004545,259.315082145929,260.754484246408,262.193886346887,263.633288447366,265.072690547845,266.512092648324],&#34;y&#34;:[0.00230550829518645,0.00228641210403681,0.00226805314031952,0.00225014148705869,0.00223267452277012,0.00221605814406117,0.00219983049109378,0.00218431589702538,0.00216951416181752,0.00215512656013413,0.00214173989616791,0.00212887360534133,0.00211659780144205,0.00210529748072145,0.00209444582835586,0.00208444707219887,0.00207519480233958,0.00206639520448385,0.00205869639371391,0.00205149393049308,0.00204493506395337,0.00203930754887603,0.00203411698074405,0.0020297825208404,0.002026107452756,0.00202285344499611,0.00202062558564044,0.00201879771055877,0.00201756388221909,0.00201708388598836,0.0020169667845634,0.00201757592388768,0.00201867424365391,0.00202012307762266,0.00202233299152824,0.00202482632395768,0.00202777156124489,0.00203121295416771,0.00203489955703491,0.00203907732341455,0.00204353634876214,0.00204822592158927,0.00205333063989282,0.00205858423185801,0.00206408201581787,0.00206979530094587,0.00207561584310293,0.0020816318173163,0.00208772581445163],&#34;fillcolor&#34;:&#34;#969696&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#969696&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#969696&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;M&#34;,&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y3&#34;},&#34;disp_MH&#34;:{&#34;x&#34;:[267.951494748803,269.390896849282,270.830298949761,272.269701050239,273.709103150718,275.148505251197,276.587907351676,278.027309452155,279.466711552634,280.906113653113,282.345515753592,283.784917854071,285.22431995455,286.663722055029,288.103124155508,289.542526255987,290.981928356466,292.421330456944,293.860732557423,295.300134657902,296.739536758381,298.17893885886,299.618340959339,301.057743059818,302.497145160297,303.936547260776,305.375949361255,306.815351461734,308.254753562213,309.694155662692,311.13355776317,312.572959863649,314.012361964128,315.451764064607,316.891166165086,318.330568265565,319.769970366044,321.209372466523,322.648774567002,324.088176667481,325.52757876796,326.966980868439,328.406382968918,329.845785069397,331.285187169875,332.724589270354,334.163991370833,335.603393471312,337.042795571791,338.48219767227,339.921599772749,341.361001873228,342.800403973707,344.239806074186,345.679208174665,347.118610275144,348.558012375623,349.997414476101,351.43681657658,352.876218677059,354.315620777538,355.755022878017,357.194424978496,358.633827078975,360.073229179454,361.512631279933,362.952033380412,364.391435480891,365.83083758137,367.270239681849,368.709641782328,370.149043882806,371.588445983285,373.027848083764,374.467250184243,375.906652284722,377.346054385201,378.78545648568],&#34;y&#34;:[0.00209389284543939,0.00210013294474575,0.00210638361932692,0.00211264196749641,0.00211886099830913,0.00212505194874527,0.00213113216681756,0.00213712320176388,0.00214301896132972,0.00214870037700174,0.00215427023961108,0.00215962017128236,0.00216473443980284,0.00216970614877411,0.00217429562709517,0.00217868147584528,0.0021828189044301,0.00218653859844234,0.00219005425251731,0.00219316242953569,0.00219591142705577,0.00219843561282346,0.00220037326648345,0.00220204856454989,0.00220335771703856,0.00220413810649412,0.00220465791510692,0.00220464304200193,0.00220421709860566,0.00220351437286146,0.00220211787189763,0.00220044267524274,0.00219833124543973,0.00219566474476477,0.00219271723151767,0.0021891769426622,0.00218523384074065,0.00218098008575955,0.00217604757025545,0.00217083912515112,0.00216517628267551,0.00215899978718741,0.00215255385649938,0.00214552526935231,0.00213814592540861,0.00213045747315605,0.00212217589673771,0.00211364869962795,0.00210469861757659,0.00209532331333104,0.00208571559180987,0.0020755954747785,0.00206520314371968,0.00205453699390559,0.00204340888740456,0.00203208543243289,0.0020204128700416,0.00200842954750873,0.0019962683804973,0.0019837116706502,0.00197097159012738,0.00195802096066539,0.00194476028880247,0.00193136601816317,0.00191772675937144,0.00190389757678809,0.00188995398911917,0.0018757599395043,0.00186146755902483,0.00184704614166828,0.00183246409379467,0.00181781260522013,0.00180303445299428,0.00178817618230233,0.00177326665117531,0.00175825743472015,0.00174321986623152,0.00172813967160522],&#34;fillcolor&#34;:&#34;#252525&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#252525&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#252525&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;MH&#34;,&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y3&#34;},&#34;disp_HH&#34;:{&#34;x&#34;:[380.224858586159,381.664260686638,383.103662787117,384.543064887596,385.982466988075,387.421869088554,388.861271189032,390.300673289511,391.74007538999,393.179477490469,394.618879590948,396.058281691427,397.497683791906,398.937085892385,400.376487992864,401.815890093343,403.255292193822,404.694694294301,406.13409639478,407.573498495258,409.012900595737,410.452302696216,411.891704796695,413.331106897174,414.770508997653,416.209911098132,417.649313198611,419.08871529909,420.528117399569,421.967519500048,423.406921600527,424.846323701006,426.285725801485,427.725127901963,429.164530002442,430.603932102921,432.0433342034,433.482736303879,434.922138404358,436.361540504837,437.800942605316,439.240344705795,440.679746806274,442.119148906753,443.558551007232,444.997953107711,446.43735520819,447.876757308668,449.316159409147,450.755561509626,452.194963610105,453.634365710584,455.073767811063,456.513169911542,457.952572012021,459.3919741125,460.831376212979,462.270778313458,463.710180413937,465.149582514416,466.588984614894,468.028386715373,469.467788815852,470.907190916331,472.34659301681,473.785995117289,475.225397217768,476.664799318247,478.104201418726,479.543603519205,480.983005619684,482.422407720163,483.861809820642,485.301211921121,486.740614021599,488.180016122078,489.619418222557,491.058820323036,492.498222423515,493.937624523994,495.377026624473,496.816428724952,498.255830825431,499.69523292591,501.134635026389,502.574037126868,504.013439227347,505.452841327825,506.892243428304,508.331645528783,509.771047629262,511.210449729741,512.64985183022,514.089253930699,515.528656031178,516.968058131657,518.407460232136,519.846862332615,521.286264433094,522.725666533573,524.165068634052,525.60447073453,527.043872835009,528.483274935488,529.922677035967,531.362079136446,532.801481236925,534.240883337404,535.680285437883,537.119687538362,538.559089638841,539.99849173932,541.437893839799,542.877295940278,544.316698040756,545.756100141235,547.195502241714,548.634904342193,550.074306442672,551.513708543151,552.95311064363,554.392512744109,555.831914844588,557.271316945067,558.710719045546,560.150121146025,561.589523246504,563.028925346983,564.468327447461,565.90772954794,567.347131648419,568.786533748898,570.225935849377,571.665337949856,573.104740050335,574.544142150814,575.983544251293,577.422946351772,578.862348452251,580.30175055273,581.741152653209,583.180554753687,584.619956854166,586.059358954645,587.498761055124,588.938163155603,590.377565256082,591.816967356561,593.25636945704,594.695771557519,596.135173657998,597.574575758477,599.013977858956,600.453379959435,601.892782059914,603.332184160392,604.771586260871,606.21098836135,607.650390461829,609.089792562308,610.529194662787,611.968596763266,613.407998863745,614.847400964224,616.286803064703,617.726205165182,619.165607265661,620.60500936614,622.044411466618,623.483813567097,624.923215667576,626.362617768055,627.802019868534,629.241421969013,630.680824069492,632.120226169971,633.55962827045,634.999030370929,636.438432471408,637.877834571887,639.317236672366],&#34;y&#34;:[0.0017130253833055,0.00169789910893133,0.00168275938567878,0.00166762447034943,0.00165249304190316,0.00163739209151535,0.00162231119820322,0.00160726352484454,0.00159227018729436,0.00157730758022422,0.00156241988853816,0.0015475886229124,0.0015328041616933,0.00151812849504469,0.00150350176755884,0.00148895900700221,0.00147451355124719,0.00146012144131713,0.00144585207905298,0.0014316560989099,0.00141752962156152,0.00140353379090528,0.00138959433631011,0.00137575498372947,0.00136201280617626,0.00134832530219225,0.00133476116395686,0.00132125874438284,0.0013078230402702,0.00129449229270088,0.00128120617119291,0.00126800086206752,0.00125486111805665,0.00124175975388948,0.00122874076543203,0.00121575493034425,0.00120281002440948,0.00118991593236368,0.00117704231232895,0.00116420417794027,0.00115138616751374,0.00113858046828712,0.00112579219040262,0.00111300547829797,0.0011002209780041,0.00108742857528215,0.00107462972985676,0.00106181277551816,0.0010489751877674,0.00103612353647331,0.00102322676000437,0.00101030829736393,0.000997355554522161,0.000984353377246176,0.000971324946809989,0.000958237741039757,0.000945107902067139,0.00093194478885829,0.000918705814623569,0.00090543498750673,0.00089211127447287,0.000878727424828452,0.000865311950507665,0.000851828073556412,0.000838304409835874,0.000824745267456258,0.000811121967106031,0.000797473654030953,0.000783782829474506,0.000770054532954089,0.000756306552261031,0.00074252088762113,0.00072872059372057,0.000714905410302424,0.00070107634150401,0.000687245423766063,0.000673414213838668,0.000659593797965855,0.000645780868723229,0.000631998996553495,0.000618240994738088,0.000604510727016144,0.000590840821820369,0.000577203500636335,0.000563633690695862,0.000550134375917604,0.000536678926549688,0.000523348359031137,0.000510081973669644,0.000496900828177695,0.000483858823198671,0.000470887506401249,0.000458063811425165,0.000445366414044529,0.000432750560945216,0.000420359245544662,0.000408064095126645,0.000395915309259591,0.000383971018448062,0.000372131378459283,0.000360515675783783,0.000349066268981994,0.000337738928149714,0.000326703870818644,0.000315791570492304,0.000305078456344264,0.00029460996987067,0.000284269965774519,0.000274212146295781,0.000264338923915944,0.000254620647122549,0.000245226181624066,0.000235969172622667,0.000226946602011871,0.000218179771014197,0.000209552135656599,0.000201237942738589,0.000193105269985909,0.000185146555576052,0.000177508386892739,0.000170009063366395,0.000162757337467185,0.000155746752138146,0.000148873110493827,0.000142315044520795,0.000135918927981214,0.000129699946190386,0.000123770670904286,0.000117970301104339,0.000112409197756298,0.000107056700838339,0.000101828509541261,9.68928360153756e-05,9.20900279913917e-05,8.74532103153778e-05,8.30584774190275e-05,7.87749877884327e-05,7.47055586155652e-05,7.08034104984416e-05,6.70063941271683e-05,6.34614553957004e-05,6.00175697131866e-05,5.67181719003788e-05,5.36073164599534e-05,5.05863536408356e-05,4.77440608712767e-05,4.50269467084454e-05,4.23961985831507e-05,3.99627693238527e-05,3.76039308968209e-05,3.53626683055102e-05,3.32590143259477e-05,3.12237232816495e-05,2.93283096780023e-05,2.75207059808278e-05,2.57824582900523e-05,2.41842240499659e-05,2.26404643880079e-05,2.11865569389956e-05,1.98271301196025e-05,1.85168103783041e-05,1.73096017922823e-05,1.61603159428838e-05,1.50632935433486e-05,1.40599658830657e-05,1.30942954237329e-05,1.2193330300109e-05,1.13535589122089e-05,1.05471967333412e-05,9.81261152865343e-06,9.11403377222613e-06,8.45253746355187e-06,7.85031303038904e-06,7.2727841758559e-06,6.7392784810614e-06,6.24323791485739e-06,5.76876869694026e-06,5.34158786316747e-06,4.93553275271141e-06,4.55431487334153e-06,4.20860785301161e-06],&#34;fillcolor&#34;:&#34;#737373&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#737373&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#737373&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;HH&#34;,&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y3&#34;},&#34;hp_LL&#34;:{&#34;x&#34;:[-32.1231343283582,-31.2400692233548,-30.3570041183515,-29.4739390133481,-28.5908739083448,-27.7078088033414,-26.8247436983381,-25.9416785933347,-25.0586134883313,-24.175548383328,-23.2924832783246,-22.4094181733213,-21.5263530683179,-20.6432879633145,-19.7602228583112,-18.8771577533078,-17.9940926483045,-17.1110275433011,-16.2279624382977,-15.3448973332944,-14.461832228291,-13.5787671232877,-12.6957020182843,-11.8126369132809,-10.9295718082776,-10.0465067032742,-9.16344159827087,-8.28037649326751,-7.39731138826415,-6.51424628326079,-5.63118117825744,-4.74811607325407,-3.86505096825072,-2.98198586324736,-2.098920758244,-1.21585565324064,-0.332790548237281,0.550274556766077,1.43333966176944,2.3164047667728,3.19946987177615,4.08253497677951,4.96560008178287,5.84866518678623,6.73173029178959,7.61479539679295,8.49786050179631,9.38092560679967,10.263990711803,11.1470558168064,12.0301209218097,12.9131860268131,13.7962511318165,14.6793162368198,15.5623813418232,16.4454464468265,17.3285115518299,18.2115766568333,19.0946417618366,19.97770686684,20.8607719718433,21.7438370768467,22.6269021818501,23.5099672868534,24.3930323918568,25.2760974968601,26.1591626018635,27.0422277068668,27.9252928118702,28.8083579168736,29.6914230218769,30.5744881268803,31.4575532318836,32.340618336887,33.2236834418904,34.1067485468937,34.9898136518971,35.8728787569004,36.7559438619038,37.6390089669072,38.5220740719105,39.4051391769139,40.2882042819172,41.1712693869206,42.054334491924,42.9373995969273,43.8204647019307,44.703529806934,45.5865949119374,46.4696600169408,47.3527251219441,48.2357902269475,49.1188553319508,50.0019204369542,50.8849855419575,51.7680506469609,52.6511157519643,53.5341808569676,54.417245961971,55.3003110669743,56.1833761719777,57.0664412769811,57.9495063819844,58.8325714869878,59.7156365919911,60.5987016969945,61.4817668019978,62.3648319070012,63.2478970120046,64.1309621170079,65.0140272220113,65.8970923270146,66.780157432018,67.6632225370214,68.5462876420247,69.4293527470281,70.3124178520314,71.1954829570348,72.0785480620382,72.9616131670415,73.8446782720449,74.7277433770482,75.6108084820516,76.4938735870549,77.3769386920583,78.2600037970617],&#34;y&#34;:[9.79687808200003e-06,1.08499016101529e-05,1.19779171263786e-05,1.32219932972071e-05,1.46019617858553e-05,1.60769051980817e-05,1.76971699192788e-05,1.94893290064822e-05,2.14005366306973e-05,2.34918412957622e-05,2.5798345961556e-05,2.8252528597658e-05,3.09275990192816e-05,3.38692881353148e-05,3.69922513185915e-05,4.03833015239013e-05,4.41012077795573e-05,4.80392705874274e-05,5.22992666626073e-05,5.69557102168076e-05,6.18766665515483e-05,6.71800814575673e-05,7.29591807032274e-05,7.90526339286086e-05,8.55955242604432e-05,9.27029507060532e-05,0.000100179848819942,0.000108179084702458,0.000116840894128701,0.000125932101211093,0.000135623593658238,0.000146083985034161,0.000157037748013298,0.000168673546334814,0.000181191435411558,0.000194269644924321,0.000208113821433097,0.000222958168294295,0.000238431369048386,0.000254754669372437,0.000272198567827574,0.000290339746278264,0.000309413059328003,0.000329726678393146,0.000350803940730107,0.000372890729241268,0.000396333288579244,0.000420601634984182,0.000445949560029474,0.000472760615676973,0.000500453110652069,0.000529285174284202,0.000559675580144488,0.000590994304942156,0.00062349991551907,0.000657642900663671,0.000692750143021876,0.000729076568398171,0.000767099420568324,0.00080610959952254,0.000846354305009199,0.000888331167877948,0.000931303998790806,0.000975508361719241,0.00102145463033025,0.00106839000098817,0.00111653484642682,0.00116640357761233,0.00121723852708464,0.00126924183781098,0.00132292248016239,0.00137753054912589,0.00143324756976802,0.00149056716547411,0.00154876022574288,0.0016079860133102,0.00166871284148644,0.0017302453244062,0.00179271960726153,0.00185656903958986,0.0019211442831529,0.00198655829405207,0.00205320043677222,0.0021204786786494,0.00218848344396532,0.0022575519659442,0.00232715934479666,0.00239737476182453,0.00246847617729613,0.00254001398809132,0.00261203792480487,0.00268476053006226,0.00275781392835013,0.00283123055122525,0.00290515222121249,0.0029792975990053,0.00305368418504112,0.0031283783259031,0.00320318869337232,0.00327812031524213,0.00335315944156688,0.00342820734101443,0.00350325902370583,0.00357821567435848,0.00365307341338634,0.00372781963207195,0.00380226463704252,0.00387650193527363,0.00395051363452645,0.00402401207015758,0.00409719153969708,0.00417003117403864,0.00424213666290484,0.00431380785365835,0.00438502324548126,0.00445527153523058,0.00452496453745405,0.00459408258682764,0.00466198554596969,0.00472920532157653,0.00479572675282864,0.00486076802243243,0.00492499070730694,0.00498838707597539,0.00505002059489619,0.00511069295991653],&#34;fillcolor&#34;:&#34;#BDBDBD&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#BDBDBD&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#BDBDBD&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;LL&#34;,&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y4&#34;},&#34;hp_ML&#34;:{&#34;x&#34;:[79.143068902065,80.0261340070684,80.9091991120717,81.7922642170751,82.6753293220785,83.5583944270818,84.4414595320852,85.3245246370885,86.2075897420919,87.0906548470953,87.9737199520986,88.856785057102,89.7398501621053,90.6229152671087,91.505980372112,92.3890454771154,93.2721105821188,94.1551756871221,95.0382407921255,95.9213058971288,96.8043710021322,97.6874361071356,98.5705012121389,99.4535663171423,100.336631422146,101.219696527149,102.102761632152,102.985826737156,103.868891842159,104.751956947162,105.635022052166,106.518087157169,107.401152262173,108.284217367176,109.167282472179,110.050347577183,110.933412682186,111.816477787189,112.699542892193,113.582607997196,114.465673102199,115.348738207203,116.231803312206,117.114868417209,117.997933522213],&#34;y&#34;:[0.00517040334738558,0.00522805952649147,0.00528460260028958,0.00534003541994984,0.00539313125355562,0.00544494880364739,0.00549550497632919,0.00554344283196756,0.00558993499432882,0.00563501591643835,0.00567720769739827,0.0057177895709357,0.00575681690188356,0.00579270569964288,0.00582683022301048,0.00585926971669587,0.00588835489291618,0.00591553884307006,0.00594092694777925,0.00596279119416854,0.0059826427352715,0.00600061429863184,0.00601495089450925,0.00602719680394936,0.00603751195045029,0.0060441502408575,0.0060486607789368,0.00605122890688353,0.00605015598194902,0.0060469653736006,0.00604186426305634,0.00603324094172419,0.00602256160835661,0.00601004984371545,0.00599421934690422,0.00597644835500058,0.00595696963234803,0.00593445775289985,0.00591017440998003,0.00588435279361759,0.00585585890148174,0.00582581299422336,0.00579443877077885,0.00576081759088187,0.00572590838081043],&#34;fillcolor&#34;:&#34;#525252&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#525252&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#525252&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;ML&#34;,&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y4&#34;},&#34;hp_M&#34;:{&#34;x&#34;:[118.880998627216,119.76406373222,120.647128837223,121.530193942226,122.41325904723,123.296324152233,124.179389257236,125.06245436224,125.945519467243,126.828584572246,127.71164967725,128.594714782253,129.477779887256,130.36084499226,131.243910097263,132.126975202267,133.01004030727,133.893105412273,134.776170517277,135.65923562228,136.542300727283,137.425365832287,138.30843093729,139.191496042293,140.074561147297,140.9576262523,141.840691357304,142.723756462307,143.60682156731,144.489886672314,145.372951777317,146.25601688232,147.139081987324,148.022147092327,148.90521219733,149.788277302334,150.671342407337,151.55440751234,152.437472617344,153.320537722347,154.203602827351,155.086667932354,155.969733037357,156.852798142361,157.735863247364,158.618928352367,159.501993457371,160.385058562374,161.268123667377,162.151188772381],&#34;y&#34;:[0.00568991478780297,0.00565214950862876,0.00561339622959676,0.00557382795940261,0.00553299582477907,0.00549150101510485,0.00544947596719205,0.00540670802730479,0.00536361553358976,0.00532028176487386,0.00527671887670517,0.00523316874919709,0.00518965891998158,0.00514640636310399,0.00510348909742846,0.00506087490492753,0.00501895809792148,0.00497767075025527,0.00493691987149359,0.00489724363120026,0.00485845024098408,0.00482038817251986,0.0047837017585785,0.00474810026388881,0.00471337915939137,0.00468024900632521,0.00464834645164365,0.00461742264186742,0.00458821422544451,0.00456031156774863,0.00453343293066565,0.00450830267600873,0.00448448992681644,0.00446169369372421,0.00444059124544131,0.00442075308108812,0.00440187405533217,0.00438455463222955,0.00436838600062241,0.00435307456743582,0.00433912055296418,0.00432615123936318,0.00431389999458945,0.00430275040314898,0.00429237702378942,0.0042825543783791,0.00427354041653365,0.00426506391555814,0.00425695266859743,0.00424933730267583],&#34;fillcolor&#34;:&#34;#969696&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#969696&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#969696&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;M&#34;,&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y4&#34;},&#34;hp_MH&#34;:{&#34;x&#34;:[163.034253877384,163.917318982387,164.800384087391,165.683449192394,166.566514297398,167.449579402401,168.332644507404,169.215709612408,170.098774717411,170.981839822414,171.864904927418,172.747970032421,173.631035137424,174.514100242428,175.397165347431,176.280230452435,177.163295557438,178.046360662441,178.929425767445,179.812490872448,180.695555977451,181.578621082455,182.461686187458,183.344751292461,184.227816397465,185.110881502468,185.993946607471,186.877011712475,187.760076817478,188.643141922482,189.526207027485,190.409272132488,191.292337237492,192.175402342495,193.058467447498,193.941532552502,194.824597657505,195.707662762508,196.590727867512,197.473792972515,198.356858077518,199.239923182522,200.122988287525,201.006053392529,201.889118497532,202.772183602535,203.655248707539,204.538313812542,205.421378917545,206.304444022549,207.187509127552,208.070574232555,208.953639337559,209.836704442562,210.719769547566,211.602834652569,212.485899757572,213.368964862576,214.252029967579,215.135095072582,216.018160177586,216.901225282589,217.784290387592,218.667355492596,219.550420597599,220.433485702602,221.316550807606,222.199615912609,223.082681017613,223.965746122616,224.848811227619,225.731876332623,226.614941437626,227.498006542629,228.381071647633,229.264136752636,230.147201857639,231.030266962643,231.913332067646,232.79639717265,233.679462277653,234.562527382656,235.44559248766,236.328657592663,237.211722697666],&#34;y&#34;:[0.00424200375673593,0.00423484239234143,0.00422786165620581,0.00422090405636099,0.00421392842109972,0.00420683215840358,0.00419951084631453,0.00419199390737863,0.00418408374133526,0.00417572332320555,0.00416701088812802,0.00415767344010531,0.00414769427575147,0.00413723485824349,0.00412596857781388,0.004113911324062,0.00410127874612067,0.00408771314588398,0.00407325529683337,0.00405816309674212,0.00404206967607605,0.00402503355616966,0.00400734079293165,0.00398863545292546,0.00396898764779045,0.00394869622007615,0.00392743348302102,0.00390527620273809,0.00388252029991117,0.00385888011772439,0.00383443544465378,0.00380946418688896,0.00378373252418321,0.0037573208743367,0.0037304755513921,0.00370302023679075,0.00367503463824815,0.00364672220233554,0.00361796573981621,0.00358884369028748,0.003559508286406,0.00352989939924513,0.00350009410303498,0.00347018842790519,0.00344017407239337,0.00341012677921175,0.00338008495426087,0.00335008439834303,0.00332019938531918,0.0032904128246132,0.00326079515471126,0.00323141862801866,0.0032022160994284,0.00317328221900555,0.00314468608677897,0.00311631882892708,0.00308828867009858,0.00306065978028147,0.00303329217562533,0.00300629748643484,0.00297973255832207,0.00295343850021728,0.00292752121991004,0.00290202735084002,0.00287679210315529,0.00285190801759298,0.0028274083370815,0.00280313538829475,0.00277916248480108,0.00275550627301554,0.00273202844693663,0.00270877917431494,0.00268575557023437,0.00266284948120425,0.00264008597294099,0.00261744027436354,0.00259484310913937,0.0025722943472445,0.00254974584944774,0.00252717341928582,0.00250455329968352,0.00248181362722983,0.00245897865621778,0.00243600395740772,0.00241279490632013],&#34;fillcolor&#34;:&#34;#252525&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#252525&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#252525&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;MH&#34;,&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y4&#34;},&#34;hp_HH&#34;:{&#34;x&#34;:[238.09478780267,238.977852907673,239.860918012676,240.74398311768,241.627048222683,242.510113327686,243.39317843269,244.276243537693,245.159308642696,246.0423737477,246.925438852703,247.808503957707,248.69156906271,249.574634167713,250.457699272717,251.34076437772,252.223829482723,253.106894587727,253.98995969273,254.873024797733,255.756089902737,256.63915500774,257.522220112744,258.405285217747,259.28835032275,260.171415427754,261.054480532757,261.93754563776,262.820610742764,263.703675847767,264.58674095277,265.469806057774,266.352871162777,267.23593626778,268.119001372784,269.002066477787,269.885131582791,270.768196687794,271.651261792797,272.534326897801,273.417392002804,274.300457107807,275.183522212811,276.066587317814,276.949652422817,277.832717527821,278.715782632824,279.598847737827,280.481912842831,281.364977947834,282.248043052838,283.131108157841,284.014173262844,284.897238367848,285.780303472851,286.663368577854,287.546433682858,288.429498787861,289.312563892864,290.195628997868,291.078694102871,291.961759207875,292.844824312878,293.727889417881,294.610954522885,295.494019627888,296.377084732891,297.260149837895,298.143214942898,299.026280047901,299.909345152905,300.792410257908,301.675475362911,302.558540467915,303.441605572918,304.324670677922,305.207735782925,306.090800887928,306.973865992932,307.856931097935,308.739996202938,309.623061307942,310.506126412945,311.389191517948,312.272256622952,313.155321727955,314.038386832959,314.921451937962,315.804517042965,316.687582147969,317.570647252972,318.453712357975,319.336777462979,320.219842567982,321.102907672985,321.985972777989,322.869037882992,323.752102987995,324.635168092999,325.518233198002,326.401298303006,327.284363408009,328.167428513012,329.050493618016,329.933558723019,330.816623828022,331.699688933026,332.582754038029,333.465819143032,334.348884248036,335.231949353039,336.115014458042,336.998079563046,337.881144668049,338.764209773053,339.647274878056,340.530339983059,341.413405088063,342.296470193066,343.179535298069,344.062600403073,344.945665508076,345.828730613079,346.711795718083,347.594860823086,348.47792592809,349.360991033093,350.244056138096,351.1271212431,352.010186348103,352.893251453106,353.77631655811,354.659381663113,355.542446768116,356.42551187312,357.308576978123,358.191642083126,359.07470718813,359.957772293133,360.840837398137,361.72390250314,362.606967608143,363.490032713147,364.37309781815,365.256162923153,366.139228028157,367.02229313316,367.905358238163,368.788423343167,369.67148844817,370.554553553173,371.437618658177,372.32068376318,373.203748868184,374.086813973187,374.96987907819,375.852944183194,376.736009288197,377.6190743932,378.502139498204,379.385204603207,380.26826970821,381.151334813214,382.034399918217,382.917465023221,383.800530128224,384.683595233227,385.566660338231,386.449725443234,387.332790548237,388.215855653241,389.098920758244,389.981985863247,390.865050968251,391.748116073254,392.631181178257,393.514246283261,394.397311388264,395.280376493268,396.163441598271,397.046506703274,397.929571808278,398.812636913281,399.695702018284,400.578767123288,401.461832228291,402.344897333294,403.227962438298,404.111027543301,404.994092648305,405.877157753308,406.760222858311,407.643287963315,408.526353068318,409.409418173321,410.292483278325,411.175548383328,412.058613488331,412.941678593335,413.824743698338,414.707808803341,415.590873908345,416.473939013348,417.357004118351,418.240069223355,419.123134328358],&#34;y&#34;:[0.00238942459714921,0.00236583194283586,0.00234190195802631,0.00231775399364488,0.00229331502654834,0.00226845358074284,0.00224332986834957,0.00221786400530133,0.00219191330934521,0.00216567094061096,0.00213905524735795,0.00211191889676121,0.00208447797429014,0.00205665387202551,0.00202830221097642,0.00199965036620224,0.00197062705172858,0.00194109920493989,0.00191129279865307,0.00188114741868688,0.0018505500962244,0.00181971224302823,0.00178858700441915,0.00175709031957122,0.00172540600665284,0.00169350252372267,0.00166133317507306,0.00162904185023137,0.00159661312508453,0.00156404537889241,0.00153143146081773,0.0014987719608732,0.0014661169277746,0.00143349874262698,0.00140093308170255,0.00136852681314759,0.00133624448637682,0.00130411523262258,0.00127230616909656,0.00124070900221688,0.0012093641303341,0.00117850041805106,0.00114793425971598,0.00111771473936465,0.00108813189830555,0.00105892698120457,0.00103015495203936,0.00100216432993698,0.000974623993820047,0.000947591924217993,0.000921470312505527,0.000895860973146585,0.000870822138378165,0.00084680286116761,0.000823345519150435,0.000800506069124938,0.000778771788430058,0.000757635303576639,0.000737148123394931,0.000717825535822805,0.000699121825438341,0.000681082326074135,0.000664238860007342,0.000648020113596993,0.000632464026537626,0.000618106585505223,0.000604364526115151,0.000591267715384892,0.000579343453232738,0.000568010616289763,0.00055729086400316,0.000547689920466297,0.000538642864699629,0.000530163531839688,0.000522723602808788,0.000515787914153286,0.000509363326274108,0.000503875891146903,0.00049883278924453,0.000494235147145259,0.000490453126269509,0.000487047434559259,0.000484017665152496,0.00048166157214175,0.000479610767476372,0.000477862149611602,0.000476635299266464,0.000475639317177637,0.000474868663200252,0.000474465977761868,0.000474217417252387,0.000474116803718427,0.000474233493227598,0.000474427843102093,0.000474694792211258,0.000475036245718232,0.000475381745901222,0.000475728943829093,0.00047601998172377,0.000476246740386285,0.000476410917513629,0.000476404048174469,0.000476272060683338,0.000476021688626576,0.000475504050712428,0.000474809810160231,0.000473951318966293,0.000472750046612482,0.00047133149725295,0.000469713782002425,0.000467699602074393,0.000465439264042791,0.000462956330656678,0.000460045285647853,0.000456871467989388,0.000453463158979802,0.000449616441326831,0.000445502555364321,0.000441153392093873,0.000436375369821376,0.000431337450134642,0.000426073722559581,0.000420408325950373,0.000414500955224666,0.000408386276596239,0.00040191199478706,0.0003952229052873,0.000388352521799463,0.000381176321289984,0.000373820004374724,0.000366314203220831,0.000358564722952029,0.00035067541490184,0.000342672405106483,0.000334492802364367,0.00032621722769765,0.000317865874752032,0.000309406691935343,0.000300896934137027,0.000292349712220037,0.000283762107670874,0.000275168943649171,0.0002665754303265,0.000258005069941345,0.000249472052083462,0.000240973233771143,0.000232555078414792,0.000224213581716396,0.000215937169032352,0.000207791321274187,0.000199756698391055,0.000191813574654313,0.000184042272872697,0.000176411183077317,0.00016889303262632,0.000161578806796962,0.000154427711417928,0.000147405802656372,0.00014061073924322,0.000133995491140457,0.000127520526940213,0.000121286534305694,0.000115242936058129,0.00010934583478723,0.000103695758206613,9.82409253553688e-05,9.29343613804089e-05,8.78737694576559e-05,8.30081123131835e-05,7.82886259432095e-05,7.38080779959933e-05,6.95177077826524e-05,6.53681905547252e-05,6.14457961813185e-05,5.77051671081765e-05,5.40975372593573e-05,5.07016327007441e-05,4.74762485032507e-05,4.43741508486817e-05,4.14659391754651e-05,3.8714977832981e-05,3.60763690551319e-05,3.36123996100005e-05,3.1291140181757e-05,2.90706516035676e-05,2.70050455028729e-05,2.50670133245404e-05,2.32180156424582e-05,2.15043757469161e-05,1.99031539313542e-05,1.83794795831441e-05,1.69724529143201e-05,1.56631370668369e-05,1.44204439184336e-05,1.32769303280645e-05,1.22172280953771e-05,1.12140115902366e-05,1.02940335023496e-05,9.44503013055652e-06,8.64330921532224e-06,7.91057296389606e-06,7.23719813109566e-06,6.60291297634657e-06,6.02510267371112e-06,5.49634266454592e-06,4.99950972405931e-06],&#34;fillcolor&#34;:&#34;#737373&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#737373&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#737373&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;HH&#34;,&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y4&#34;},&#34;drat_LL&#34;:{&#34;x&#34;:[2.03818370630419,2.04525539434214,2.05232708238009,2.05939877041803,2.06647045845598,2.07354214649393,2.08061383453188,2.08768552256983,2.09475721060778,2.10182889864572,2.10890058668367,2.11597227472162,2.12304396275957,2.13011565079752,2.13718733883547,2.14425902687341,2.15133071491136,2.15840240294931,2.16547409098726,2.17254577902521,2.17961746706316,2.1866891551011,2.19376084313905,2.200832531177,2.20790421921495,2.2149759072529,2.22204759529085,2.22911928332879,2.23619097136674,2.24326265940469,2.25033434744264,2.25740603548059,2.26447772351854,2.27154941155649,2.27862109959443,2.28569278763238,2.29276447567033,2.29983616370828,2.30690785174623,2.31397953978418,2.32105122782212,2.32812291586007,2.33519460389802,2.34226629193597,2.34933797997392,2.35640966801187,2.36348135604981,2.37055304408776,2.37762473212571,2.38469642016366,2.39176810820161,2.39883979623956,2.4059114842775,2.41298317231545,2.4200548603534,2.42712654839135,2.4341982364293,2.44126992446725,2.44834161250519,2.45541330054314,2.46248498858109,2.46955667661904,2.47662836465699,2.48370005269494,2.49077174073288,2.49784342877083,2.50491511680878,2.51198680484673,2.51905849288468,2.52613018092263,2.53320186896058,2.54027355699852,2.54734524503647,2.55441693307442,2.56148862111237,2.56856030915032,2.57563199718827,2.58270368522621,2.58977537326416,2.59684706130211,2.60391874934006,2.61099043737801,2.61806212541596,2.6251338134539,2.63220550149185,2.6392771895298,2.64634887756775,2.6534205656057,2.66049225364365,2.66756394168159,2.67463562971954,2.68170731775749,2.68877900579544,2.69585069383339,2.70292238187134,2.70999406990928,2.71706575794723,2.72413744598518,2.73120913402313,2.73828082206108,2.74535251009903,2.75242419813697,2.75949588617492,2.76656757421287,2.77363926225082,2.78071095028877,2.78778263832672,2.79485432636467,2.80192601440261,2.80899770244056,2.81606939047851,2.82314107851646,2.83021276655441,2.83728445459236,2.8443561426303,2.85142783066825,2.8584995187062,2.86557120674415,2.8726428947821,2.87971458282005,2.88678627085799,2.89385795889594,2.90092964693389,2.90800133497184,2.91507302300979,2.92214471104774,2.92921639908568,2.93628808712363,2.94335977516158,2.95043146319953,2.95750315123748,2.96457483927543,2.97164652731337,2.97871821535132,2.98578990338927,2.99286159142722,2.99993327946517,3.00700496750312,3.01407665554107,3.02114834357901,3.02822003161696,3.03529171965491,3.04236340769286,3.04943509573081,3.05650678376876,3.0635784718067,3.07065015984465,3.0777218478826,3.08479353592055,3.0918652239585,3.09893691199645,3.10600860003439,3.11308028807234],&#34;y&#34;:[0.00126598819738069,0.00138587235833438,0.00151279746231649,0.00165336725077721,0.00180510837015693,0.0019654058038631,0.00214377816119162,0.00233439091147269,0.00253532020954976,0.00275985720806498,0.00299750396930818,0.00324867639191957,0.00352790473654973,0.00382198729929515,0.00413442496479614,0.00447816038321587,0.00483939751204314,0.00522500214356034,0.00564502750040932,0.00608551323147269,0.0065577271551308,0.00706723007950923,0.00760046762156213,0.00817430194175517,0.00878788577841129,0.00942879215005025,0.0101208179512805,0.0108544798816008,0.0116193569608922,0.0124476545151942,0.0133187271752813,0.0142251956502987,0.0152092577959082,0.0162363117271119,0.0173059691499824,0.0184637927941887,0.0196664982416047,0.0209234778691759,0.0222726649061684,0.0236716127404475,0.0251381983059787,0.0266999116664103,0.0283163944297717,0.0300155634224831,0.0318114692032819,0.0336672243461778,0.0356223386619619,0.0376743211341338,0.0397912392906347,0.0420256954627814,0.0443555397358135,0.0467553412777907,0.0492921843600273,0.0519212299236872,0.0546251129665285,0.0574866177959003,0.0604353856927606,0.063467211885666,0.0666708707798461,0.0699586662584661,0.0733461331737696,0.0769026041965217,0.0805470954727276,0.0843085272010241,0.0882339113354219,0.0922506837414249,0.0964019375984928,0.100709883853709,0.105111967444723,0.109665879904687,0.114367089848177,0.119164457777222,0.124130254270337,0.129231955110414,0.134430990109267,0.139813655714066,0.145319040105102,0.150921967541978,0.156721577756232,0.162629210761753,0.168635595181825,0.174844514130807,0.18114771154497,0.187560396464667,0.194155977250259,0.200842164771749,0.207645808842937,0.214610471086261,0.221660540509082,0.228832344836881,0.236141479394455,0.24352916567825,0.25103817169871,0.258659556323889,0.266350867584505,0.274157333633679,0.282050633308106,0.290003373701541,0.298058283398332,0.306174681066345,0.314338113366994,0.322582876876327,0.330864885503626,0.339179593615226,0.347545998872879,0.355927508127765,0.36432623428102,0.37273599273758,0.381142602341497,0.389543374041856,0.397916057911427,0.406265744204614,0.414578423869034,0.422826756271154,0.431030908453682,0.439158526601253,0.447189729470628,0.455154577330502,0.462995138045393,0.470712675920079,0.478341112071451,0.485789864868427,0.493095569586098,0.500289347146154,0.507241489441664,0.514038026828523,0.520700289278531,0.527054031751429,0.533247646648048,0.539265865423929,0.544945617424384,0.550449069578441,0.555729177572732,0.560657844842349,0.565393427126308,0.569855988020064,0.573965279427514,0.577867793274362,0.58144829303755,0.584684655294346,0.587704207746766,0.590356164794076,0.592683338527435,0.594787822079183,0.596485456778507,0.597886605921603,0.599063727141506,0.599804029258948,0.600283319926518,0.600542055892647,0.600346109940177,0.599929634600915,0.599281155573768],&#34;fillcolor&#34;:&#34;#BDBDBD&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#BDBDBD&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#BDBDBD&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;LL&#34;,&#34;xaxis&#34;:&#34;x5&#34;,&#34;yaxis&#34;:&#34;y5&#34;},&#34;drat_ML&#34;:{&#34;x&#34;:[3.12015197611029,3.12722366414824,3.13429535218619,3.14136704022414,3.14843872826208,3.15551041630003,3.16258210433798,3.16965379237593,3.17672548041388,3.18379716845183,3.19086885648977,3.19794054452772,3.20501223256567,3.21208392060362,3.21915560864157,3.22622729667952,3.23329898471746,3.24037067275541,3.24744236079336,3.25451404883131,3.26158573686926,3.26865742490721,3.27572911294516,3.2828008009831,3.28987248902105,3.296944177059,3.30401586509695,3.3110875531349,3.31815924117285,3.32523092921079,3.33230261724874,3.33937430528669,3.34644599332464,3.35351768136259,3.36058936940054,3.36766105743848,3.37473274547643,3.38180443351438],&#34;y&#34;:[0.598214476951511,0.596950446376127,0.595443311589576,0.593580245466812,0.591538403191161,0.589253991716899,0.586680150241697,0.583950400276721,0.580991787174672,0.577811337412118,0.574501613500055,0.570990831148218,0.567323802458676,0.563557244027627,0.559631753632739,0.555610729480409,0.551522263332985,0.547330774923348,0.543097092377302,0.538829548013045,0.534527361169737,0.530226964677331,0.525928377270284,0.521670934898567,0.517450046435125,0.51327522818671,0.509207175840891,0.50520795051148,0.501306948289293,0.497564460808031,0.493920795213157,0.490433080341685,0.487140975762839,0.483974626321311,0.481024785387179,0.47829299057711,0.475710141420538,0.473404158756678],&#34;fillcolor&#34;:&#34;#525252&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#525252&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#525252&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;ML&#34;,&#34;xaxis&#34;:&#34;x5&#34;,&#34;yaxis&#34;:&#34;y5&#34;},&#34;drat_M&#34;:{&#34;x&#34;:[3.38887612155233,3.39594780959028,3.40301949762823,3.41009118566617,3.41716287370412,3.42423456174207,3.43130624978002,3.43837793781797,3.44544962585592,3.45252131389386,3.45959300193181,3.46666468996976,3.47373637800771,3.48080806604566,3.48787975408361,3.49495144212155,3.5020231301595,3.50909481819745,3.5161665062354,3.52323819427335,3.5303098823113,3.53738157034925,3.54445325838719,3.55152494642514,3.55859663446309,3.56566832250104,3.57274001053899,3.57981169857694,3.58688338661488,3.59395507465283,3.60102676269078,3.60809845072873,3.61517013876668,3.62224182680463,3.62931351484257,3.63638520288052,3.64345689091847,3.65052857895642,3.65760026699437,3.66467195503232,3.67174364307026,3.67881533110821,3.68588701914616,3.69295870718411,3.70003039522206,3.70710208326001,3.71417377129795,3.7212454593359,3.72831714737385,3.7353888354118,3.74246052344975,3.7495322114877,3.75660389952565,3.76367558756359,3.77074727560154,3.77781896363949,3.78489065167744,3.79196233971539,3.79903402775334,3.80610571579128,3.81317740382923,3.82024909186718,3.82732077990513,3.83439246794308,3.84146415598103,3.84853584401897,3.85560753205692,3.86267922009487,3.86975090813282,3.87682259617077,3.88389428420872,3.89096597224666,3.89803766028461,3.90510934832256,3.91218103636051,3.91925272439846,3.92632441243641,3.93339610047435,3.9404677885123,3.94753947655025,3.9546111645882,3.96168285262615,3.9687545406641,3.97582622870204,3.98289791673999,3.98996960477794,3.99704129281589],&#34;y&#34;:[0.471324720875718,0.469413117209191,0.467835380109481,0.466480116797695,0.465306851388123,0.464517970748999,0.463936821298666,0.463557284954281,0.463582329001193,0.46380243703557,0.464255463094842,0.46508761003291,0.466113137109766,0.467396069329002,0.46902191601056,0.470834556701417,0.472920142239685,0.475304671086762,0.477864814759255,0.48070277212703,0.483790977437159,0.487039441161049,0.490558673872761,0.494277686310963,0.49813792762276,0.502249264286104,0.506510873378503,0.510891581313347,0.515490912339685,0.520194380884358,0.524994924983534,0.529964016114044,0.534999079464372,0.540110921315773,0.545322561704539,0.550572508274626,0.555869322882114,0.561203834623387,0.56654857097259,0.571901307814765,0.577237980708613,0.582556994359498,0.587837229135085,0.593057148385689,0.598232293280591,0.603315339562217,0.60830398450476,0.613222026920691,0.617989736614001,0.622639299308256,0.627194175428375,0.631537374297922,0.635748760140588,0.639842135180965,0.643664031184796,0.647348516496629,0.650874778924519,0.654109166075911,0.657189699573837,0.660070080917306,0.662649630777498,0.665061776720675,0.667231741191423,0.669102244024762,0.670794774495389,0.672204573594007,0.673325260989425,0.674260413171227,0.67487524835766,0.675218798907109,0.675372220338789,0.67517204522771,0.674724301148448,0.674084711761959,0.67306371220945,0.671823139566739,0.670391743886503,0.668557539537049,0.666534468242233,0.664300440634407,0.661696768825938,0.658912450870928,0.655899532133248,0.652557463621282,0.649042989088983,0.645287491847884,0.641244969794162],&#34;fillcolor&#34;:&#34;#969696&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#969696&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#969696&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;M&#34;,&#34;xaxis&#34;:&#34;x5&#34;,&#34;yaxis&#34;:&#34;y5&#34;},&#34;drat_MH&#34;:{&#34;x&#34;:[4.00411298085384,4.01118466889179,4.01825635692973,4.02532804496768,4.03239973300563,4.03947142104358,4.04654310908153,4.05361479711948,4.06068648515743,4.06775817319537,4.07482986123332,4.08190154927127,4.08897323730922,4.09604492534717,4.10311661338512,4.11018830142306,4.11725998946101,4.12433167749896,4.13140336553691,4.13847505357486,4.14554674161281,4.15261842965075,4.1596901176887,4.16676180572665,4.1738334937646,4.18090518180255,4.1879768698405,4.19504855787844,4.20212024591639,4.20919193395434,4.21626362199229,4.22333531003024,4.23040699806819,4.23747868610613,4.24455037414408,4.25162206218203,4.25869375021998,4.26576543825793,4.27283712629588,4.27990881433383,4.28698050237177,4.29405219040972,4.30112387844767,4.30819556648562,4.31526725452357,4.32233894256152,4.32941063059946,4.33648231863741,4.34355400667536,4.35062569471331,4.35769738275126,4.36476907078921,4.37184075882715,4.3789124468651,4.38598413490305,4.393055822941,4.40012751097895,4.4071991990169,4.41427088705484,4.42134257509279,4.42841426313074,4.43548595116869,4.44255763920664,4.44962932724459,4.45670101528254,4.46377270332048,4.47084439135843,4.47791607939638,4.48498776743433,4.49205945547228,4.49913114351022,4.50620283154817,4.51327451958612,4.52034620762407,4.52741789566202,4.53448958369997,4.54156127173792,4.54863295977586,4.55570464781381,4.56277633585176,4.56984802388971,4.57691971192766,4.5839913999656,4.59106308800355,4.5981347760415,4.60520646407945,4.6122781521174,4.61934984015535,4.6264215281933,4.63349321623124,4.64056490426919,4.64763659230714,4.65470828034509,4.66177996838304,4.66885165642099,4.67592334445893],&#34;y&#34;:[0.637040080093885,0.632587455203179,0.627890092620828,0.62304192919991,0.617945309507439,0.612645112155295,0.60720693672492,0.601525662244247,0.595679750030535,0.58970966924171,0.583507832860647,0.57717718957808,0.570736913253072,0.564081960810003,0.557330237729437,0.550474704229368,0.543445308037235,0.53633770222662,0.529133653864378,0.521798818515274,0.514401041934012,0.506918774213328,0.49934398156336,0.491721332209864,0.484030369140527,0.476280030162502,0.468496572002771,0.460664767271334,0.452801490901571,0.44491934512443,0.437012116339885,0.429096088986267,0.421174835422999,0.413254528332898,0.405343000231942,0.397439184611123,0.389564560392551,0.381711432314889,0.373880452692728,0.366104008146081,0.358359509836531,0.350654787772851,0.343022981753177,0.335433431940326,0.327903236460449,0.320459230447039,0.313066867245765,0.30575489625887,0.298537678613615,0.291380548649927,0.284325821686569,0.277370135434903,0.270482030028777,0.263718832220486,0.257055140766396,0.250465568004076,0.244023431816766,0.237677912193898,0.231412094698412,0.225315807456963,0.219310362089558,0.213394817859374,0.207658879133097,0.20201115889923,0.19646980142671,0.191102380107365,0.185825813714651,0.180671688534505,0.175682953964337,0.170786781183835,0.166028302156696,0.161424263595708,0.156913572633975,0.152554567075941,0.148337116364783,0.144212888428491,0.140252652894191,0.136419618704497,0.132678785435357,0.129112160373201,0.125657381622271,0.122292903339117,0.119110377487442,0.116023805279236,0.113028441095987,0.110212636773004,0.107480475258719,0.104847119770841,0.102372808049453,0.0999777047115129,0.0976867342759075,0.095533959863475,0.0934552548078404,0.0914834770924906,0.0896292187635928,0.0878432606240513],&#34;fillcolor&#34;:&#34;#252525&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#252525&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#252525&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;MH&#34;,&#34;xaxis&#34;:&#34;x5&#34;,&#34;yaxis&#34;:&#34;y5&#34;},&#34;drat_HH&#34;:{&#34;x&#34;:[4.68299503249688,4.69006672053483,4.69713840857278,4.70421009661073,4.71128178464868,4.71835347268662,4.72542516072457,4.73249684876252,4.73956853680047,4.74664022483842,4.75371191287637,4.76078360091431,4.76785528895226,4.77492697699021,4.78199866502816,4.78907035306611,4.79614204110406,4.803213729142,4.81028541717995,4.8173571052179,4.82442879325585,4.8315004812938,4.83857216933175,4.8456438573697,4.85271554540764,4.85978723344559,4.86685892148354,4.87393060952149,4.88100229755944,4.88807398559739,4.89514567363533,4.90221736167328,4.90928904971123,4.91636073774918,4.92343242578713,4.93050411382508,4.93757580186302,4.94464748990097,4.95171917793892,4.95879086597687,4.96586255401482,4.97293424205277,4.98000593009071,4.98707761812866,4.99414930616661,5.00122099420456,5.00829268224251,5.01536437028046,5.02243605831841,5.02950774635635,5.0365794343943,5.04365112243225,5.0507228104702,5.05779449850815,5.0648661865461,5.07193787458404,5.07900956262199,5.08608125065994,5.09315293869789,5.10022462673584,5.10729631477379,5.11436800281173,5.12143969084968,5.12851137888763,5.13558306692558,5.14265475496353,5.14972644300148,5.15679813103942,5.16386981907737,5.17094150711532,5.17801319515327,5.18508488319122,5.19215657122917,5.19922825926711,5.20629994730506,5.21337163534301,5.22044332338096,5.22751501141891,5.23458669945686,5.24165838749481,5.24873007553275,5.2558017635707,5.26287345160865,5.2699451396466,5.27701682768455,5.28408851572249,5.29116020376044,5.29823189179839,5.30530357983634,5.31237526787429,5.31944695591224,5.32651864395019,5.33359033198813,5.34066202002608,5.34773370806403,5.35480539610198,5.36187708413993,5.36894877217788,5.37602046021582,5.38309214825377,5.39016383629172,5.39723552432967,5.40430721236762,5.41137890040557,5.41845058844351,5.42552227648146,5.43259396451941,5.43966565255736,5.44673734059531,5.45380902863326,5.4608807166712,5.46795240470915,5.4750240927471,5.48209578078505,5.489167468823,5.49623915686095,5.50331084489889,5.51038253293684,5.51745422097479,5.52452590901274,5.53159759705069,5.53866928508864,5.54574097312658,5.55281266116453,5.55988434920248,5.56695603724043,5.57402772527838,5.58109941331633,5.58817110135428,5.59524278939222,5.60231447743017,5.60938616546812,5.61645785350607,5.62352954154402,5.63060122958197,5.63767291761991,5.64474460565786,5.65181629369581],&#34;y&#34;:[0.0861643045796748,0.0845828477546949,0.0830633808239592,0.0816481727534142,0.0803115543022513,0.0790301776545263,0.0778475022961366,0.0767260246757921,0.075652719566355,0.0746698590773018,0.073732666139111,0.0728371653102059,0.0720198206247599,0.0712355226311803,0.0704894944758486,0.069800983441755,0.0691383143891391,0.068508454662699,0.0679180520984674,0.0673465387202299,0.0668006457502443,0.0662789398661138,0.0657695590206963,0.0652772800884783,0.0647968033611789,0.0643226031531908,0.0638561272176374,0.063391931010813,0.062928591120251,0.0624632579135397,0.0619934075708797,0.0615197159325115,0.0610345144051687,0.0605404844606319,0.0600387105835734,0.05951664454409,0.0589835979480441,0.0584380443619576,0.0578680528827122,0.057284993469377,0.0566850411993828,0.0560591400429677,0.0554189335152222,0.0547582308786614,0.0540722221713045,0.0533714872508526,0.0526477750661766,0.0519010432689208,0.0511399209281054,0.0503547201422214,0.0495499133125547,0.0487317277559608,0.0478899054777236,0.0470325229812974,0.046163352912548,0.0452725919798901,0.04437050031536,0.0434586827116506,0.0425288839390092,0.0415917848757343,0.0406467001266353,0.0396900241220092,0.03872890041898,0.0377623990589762,0.0367906440207738,0.0358172075949682,0.0348419598682332,0.0338670482880445,0.0328932139343707,0.0319219319928015,0.0309556051419319,0.0299930099680122,0.0290379179573917,0.0280913036428587,0.0271508885328774,0.0262232728584512,0.0253065252070214,0.0243981901774909,0.0235080423581446,0.0226300616013428,0.0217624021840741,0.0209181605516849,0.0200863960749941,0.0192677404017776,0.0184749137679932,0.0176952492668386,0.0169319230029619,0.0161946622940757,0.0154713779918237,0.0147674441106509,0.0140887999492923,0.0134246036610789,0.0127824060458001,0.0121639219228873,0.0115600384076783,0.0109803248890054,0.0104221646309951,0.00987847120743851,0.00936056635332834,0.00886167761478033,0.00837687340403713,0.00791888531253319,0.0074771865429815,0.00704898286850896,0.0066480288153473,0.00626060787877884,0.00588684340144019,0.00553836538276835,0.00520167927495564,0.0048792702139322,0.00457850799519006,0.00428857475061254,0.00401315379025249,0.00375590388456995,0.00350847963134871,0.00327544749497078,0.00305737051892238,0.00284810657825893,0.00265280406058669,0.00246956351546985,0.00229414032236863,0.00213199171524097,0.00197936823537388,0.00183360457655242,0.00170023137601803,0.00157421218237956,0.00145414973069362,0.00134545528964854,0.00124229983676385,0.00114451305447938,0.00105649133476235,0.000972775090306221,0.000894170016081548,0.000823180029660531,0.000755818981874398,0.000693204298962471,0.000636433145346712,0.000582692014079021],&#34;fillcolor&#34;:&#34;#737373&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#737373&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#737373&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;HH&#34;,&#34;xaxis&#34;:&#34;x5&#34;,&#34;yaxis&#34;:&#34;y5&#34;},&#34;rug_mpg&#34;:{&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:[21,21,22.8,21.4,18.7,18.1,14.3,24.4,22.8,19.2,17.8,16.4,17.3,15.2,10.4,10.4,14.7,32.4,30.4,33.9,21.5,15.5,15.2,13.3,19.2,27.3,26,30.4,15.8,19.7,15,21.4],&#34;y&#34;:[&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;],&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y11&#34;,&#34;name&#34;:&#34;rug_mpg&#34;,&#34;showlegend&#34;:false},&#34;rug_cyl&#34;:{&#34;type&#34;:&#34;bar&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:null,&#34;y&#34;:null,&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y12&#34;,&#34;name&#34;:&#34;rug_cyl&#34;,&#34;showlegend&#34;:false},&#34;rug_disp&#34;:{&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:[160,160,108,258,360,225,360,146.7,140.8,167.6,167.6,275.8,275.8,275.8,472,460,440,78.7,75.7,71.1,120.1,318,304,350,400,79,120.3,95.1,351,145,301,121],&#34;y&#34;:[&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;],&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y13&#34;,&#34;name&#34;:&#34;rug_disp&#34;,&#34;showlegend&#34;:false},&#34;rug_hp&#34;:{&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:[110,110,93,110,175,105,245,62,95,123,123,180,180,180,205,215,230,66,52,65,97,150,150,245,175,66,91,113,264,175,335,109],&#34;y&#34;:[&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;],&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y14&#34;,&#34;name&#34;:&#34;rug_hp&#34;,&#34;showlegend&#34;:false},&#34;rug_drat&#34;:{&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:[3.9,3.9,3.85,3.08,3.15,2.76,3.21,3.69,3.92,3.92,3.92,3.07,3.07,3.07,2.93,3,3.23,4.08,4.93,4.22,3.7,2.76,3.15,3.73,3.08,4.08,4.43,3.77,4.22,3.62,3.54,4.11],&#34;y&#34;:[&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;],&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x5&#34;,&#34;yaxis&#34;:&#34;y15&#34;,&#34;name&#34;:&#34;rug_drat&#34;,&#34;showlegend&#34;:false}},&#34;layout&#34;:{&#34;xaxis1&#34;:{&#34;domain&#34;:[0,0.1875],&#34;anchor&#34;:&#34;y11&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis2&#34;:{&#34;domain&#34;:[0.2125,0.3875],&#34;anchor&#34;:&#34;y12&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis3&#34;:{&#34;domain&#34;:[0.4125,0.5875],&#34;anchor&#34;:&#34;y13&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis4&#34;:{&#34;domain&#34;:[0.6125,0.7875],&#34;anchor&#34;:&#34;y14&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis5&#34;:{&#34;domain&#34;:[0.8125,1],&#34;anchor&#34;:&#34;y15&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis1&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis2&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis3&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis4&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis5&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis11&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x1&#34;},&#34;yaxis12&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x2&#34;},&#34;yaxis13&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x3&#34;},&#34;yaxis14&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x4&#34;},&#34;yaxis15&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x5&#34;}},&#34;shapes&#34;:{},&#34;shapes_original&#34;:{},&#34;map_curve&#34;:[[5,6,9,14,23],[5,6,9,14,22],[5,6,9,15,21],[1,8,13,17,19],[1,8,12,18,21],[3,7,11,15,19],[3,7,10,16,21],[3,7,10,17,21],[3,7,10,15,21],[3,8,13,17,19],[3,8,12,17,19],[3,8,12,17,20],[4,6,9,15,21],[4,6,9,15,22],[4,6,10,14,21],[4,6,10,15,21],[4,7,11,15,19],[2,8,13,17,20],[2,8,12,18,21],[2,8,12,18,22],[2,8,12,18,20],[2,8,12,16,19],[2,8,12,16,20],[2,8,12,17,19]],&#34;map_trace_2_shape&#34;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&#34;map_type&#34;:[[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;]],&#34;map_color&#34;:[[&#34;#710500&#34;,&#34;#BDBDBD&#34;,&#34;#BDBDBD&#34;,&#34;#BDBDBD&#34;,&#34;#737373&#34;],[&#34;#710500&#34;,&#34;#BDBDBD&#34;,&#34;#BDBDBD&#34;,&#34;#BDBDBD&#34;,&#34;#252525&#34;],[&#34;#710500&#34;,&#34;#BDBDBD&#34;,&#34;#BDBDBD&#34;,&#34;#525252&#34;,&#34;#969696&#34;],[&#34;#FF0065&#34;,&#34;#969696&#34;,&#34;#737373&#34;,&#34;#252525&#34;,&#34;#BDBDBD&#34;],[&#34;#FF0065&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#737373&#34;,&#34;#969696&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;#969696&#34;,&#34;#525252&#34;,&#34;#BDBDBD&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;#525252&#34;,&#34;#969696&#34;,&#34;#969696&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;#525252&#34;,&#34;#252525&#34;,&#34;#969696&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;#525252&#34;,&#34;#525252&#34;,&#34;#969696&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;#737373&#34;,&#34;#252525&#34;,&#34;#BDBDBD&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#252525&#34;,&#34;#BDBDBD&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#252525&#34;,&#34;#525252&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;#BDBDBD&#34;,&#34;#525252&#34;,&#34;#969696&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;#BDBDBD&#34;,&#34;#525252&#34;,&#34;#252525&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;#525252&#34;,&#34;#BDBDBD&#34;,&#34;#969696&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;#525252&#34;,&#34;#525252&#34;,&#34;#969696&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;#969696&#34;,&#34;#525252&#34;,&#34;#BDBDBD&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;#737373&#34;,&#34;#252525&#34;,&#34;#525252&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#737373&#34;,&#34;#969696&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#737373&#34;,&#34;#252525&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#737373&#34;,&#34;#525252&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#969696&#34;,&#34;#BDBDBD&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#969696&#34;,&#34;#525252&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#252525&#34;,&#34;#BDBDBD&#34;]],&#34;parcats_cols&#34;:[&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;],&#34;imp&#34;:false},&#34;evals&#34;:[],&#34;jsHooks&#34;:[]}&lt;/script&gt;
&lt;/div&gt;
&lt;div id=&#34;partial-dependence-alluvial-plots&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Partial Dependence Alluvial Plots&lt;/h1&gt;
&lt;p&gt;Machine Learning models operate in a multidimensional space and their response is hard to visualise. Model response and partial dependency plots attempt to visualise ML models in a two dimensional space. Using alluvial plots or parallel categories diagrams we can increase the number of dimensions.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/page/visualising-model-response-with-easyalluvial/&#34;&gt;Visualise model response with alluvial plots&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df &amp;lt;- select(mtcars2, -ids)

m &amp;lt;- parsnip::rand_forest(mode = &amp;quot;regression&amp;quot;) %&amp;gt;%
  parsnip::set_engine(&amp;quot;randomForest&amp;quot;) %&amp;gt;%
  parsnip::fit(disp ~ ., df)

p &amp;lt;- alluvial_model_response_parsnip(m, df, degree = 4, method = &amp;quot;pdp&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Getting partial dependence plot preditions. This can take a while. See easyalluvial::get_pdp_predictions() `Details` on how to use multiprocessing&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;parcats(p, marginal_histograms = TRUE, imp = TRUE, data_input = df)&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;htmlwidget-2&#34; style=&#34;width:960px;height:672px;&#34; class=&#34;parcats html-widget&#34;&gt;&lt;/div&gt;
&lt;script type=&#34;application/json&#34; data-for=&#34;htmlwidget-2&#34;&gt;{&#34;x&#34;:{&#34;traces&#34;:{&#34;parcats&#34;:{&#34;type&#34;:&#34;parcats&#34;,&#34;dimensions&#34;:[{&#34;label&#34;:&#34;pred&#34;,&#34;values&#34;:[&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;HH\n(319,381]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;LL\n(124,170]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;M\n(216,269]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;MH\n(269,319]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;,&#34;ML\n(170,216]&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;HH\n(319,381]&#34;,&#34;MH\n(269,319]&#34;,&#34;M\n(216,269]&#34;,&#34;ML\n(170,216]&#34;,&#34;LL\n(124,170]&#34;]},{&#34;label&#34;:&#34;cyl&#34;,&#34;values&#34;:[&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;8&#34;,&#34;6&#34;,&#34;4&#34;]},{&#34;label&#34;:&#34;mpg&#34;,&#34;values&#34;:[&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;19.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;33.9&#34;,&#34;30.4&#34;,&#34;19.4&#34;,&#34;14.7&#34;,&#34;10.4&#34;]},{&#34;label&#34;:&#34;wt&#34;,&#34;values&#34;:[&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.3&#34;,&#34;5.42&#34;,&#34;5.42&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;,&#34;1.51&#34;,&#34;1.51&#34;,&#34;2.04&#34;,&#34;2.04&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;5.42&#34;,&#34;5.3&#34;,&#34;3.44&#34;,&#34;2.04&#34;,&#34;1.51&#34;]},{&#34;label&#34;:&#34;hp&#34;,&#34;values&#34;:[&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;245&#34;,&#34;335&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;245&#34;,&#34;335&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;245&#34;,&#34;335&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;245&#34;,&#34;335&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;245&#34;,&#34;335&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;245&#34;,&#34;335&#34;,&#34;150&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;,&#34;52&#34;,&#34;78.5&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;335&#34;,&#34;245&#34;,&#34;150&#34;,&#34;78.5&#34;,&#34;52&#34;]}],&#34;counts&#34;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],&#34;line&#34;:{&#34;shape&#34;:&#34;hspline&#34;,&#34;color&#34;:[&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;]},&#34;hoveron&#34;:&#34;color&#34;,&#34;hoverinfo&#34;:&#34;count+probability&#34;,&#34;labelfont&#34;:{&#34;size&#34;:24,&#34;color&#34;:&#34;black&#34;},&#34;arrangement&#34;:&#34;perpendicular&#34;,&#34;bundlecolors&#34;:true,&#34;sortpaths&#34;:&#34;forward&#34;,&#34;tickfont&#34;:null,&#34;domain&#34;:{&#34;y&#34;:[0,0.7],&#34;x&#34;:[0,0.85]}},&#34;pred_LL\n(124,170]&#34;:{&#34;x&#34;:[80.4817305689968,81.1567259163897,81.8317212637826,82.5067166111755,83.1817119585683,83.8567073059612,84.5317026533541,85.206698000747,85.8816933481398,86.5566886955327,87.2316840429256,87.9066793903185,88.5816747377114,89.2566700851042,89.9316654324971,90.60666077989,91.2816561272829,91.9566514746757,92.6316468220686,93.3066421694615,93.9816375168544,94.6566328642473,95.3316282116401,96.006623559033,96.6816189064259,97.3566142538188,98.0316096012116,98.7066049486045,99.3816002959974,100.05659564339,100.731590990783,101.406586338176,102.081581685569,102.756577032962,103.431572380355,104.106567727748,104.78156307514,105.456558422533,106.131553769926,106.806549117319,107.481544464712,108.156539812105,108.831535159498,109.506530506891,110.181525854283,110.856521201676,111.531516549069,112.206511896462,112.881507243855,113.556502591248,114.231497938641,114.906493286034,115.581488633426,116.256483980819,116.931479328212,117.606474675605,118.281470022998,118.956465370391,119.631460717784,120.306456065177,120.981451412569,121.656446759962,122.331442107355,123.006437454748,123.681432802141,124.356428149534,125.031423496927,125.70641884432,126.381414191712,127.056409539105,127.731404886498,128.406400233891,129.081395581284,129.756390928677,130.43138627607,131.106381623463,131.781376970855,132.456372318248,133.131367665641,133.806363013034,134.481358360427,135.15635370782,135.831349055213,136.506344402606,137.181339749999,137.856335097391,138.531330444784,139.206325792177,139.88132113957,140.556316486963,141.231311834356,141.906307181749,142.581302529142,143.256297876534,143.931293223927,144.60628857132,145.281283918713,145.956279266106,146.631274613499,147.306269960892,147.981265308285,148.656260655677,149.33125600307,150.006251350463,150.681246697856,151.356242045249,152.031237392642,152.706232740035,153.381228087428,154.05622343482,154.731218782213,155.406214129606,156.081209476999,156.756204824392,157.431200171785,158.106195519178,158.781190866571,159.456186213963,160.131181561356,160.806176908749,161.481172256142,162.156167603535,162.831162950928,163.506158298321,164.181153645714,164.856148993106,165.531144340499,166.206139687892,166.881135035285,167.556130382678,168.231125730071,168.906121077464,169.581116424857],&#34;y&#34;:[5.24741057906931e-06,6.03909845928878e-06,6.9225065716735e-06,7.90386648710012e-06,9.03377127120927e-06,1.03113941854501e-05,1.17257136602182e-05,1.32850711082278e-05,1.50742176645866e-05,1.70668562993122e-05,1.92553596402767e-05,2.16503483664862e-05,2.43856535477351e-05,2.73888796348609e-05,3.06616225316175e-05,3.42213193752199e-05,3.82536835072148e-05,4.26271873077399e-05,4.73563481303038e-05,5.24875977896883e-05,5.82065257248432e-05,6.43595855797734e-05,7.09618852825202e-05,7.81002897747455e-05,8.59344420205341e-05,9.42962126468976e-05,0.000103199758557566,0.000112781707772494,0.000123145259024723,0.000134119142319376,0.000145714608663454,0.000158121725577104,0.000171357921270547,0.000185262824627435,0.000199842634679368,0.000215335134013167,0.000231651894779072,0.000248657435311911,0.000266350905410348,0.000284999804643552,0.000304407675578994,0.000324474372011883,0.000345190561705654,0.00036682246220431,0.000389088117301587,0.000411926102582522,0.00043531815384054,0.000459487736564733,0.000484116756470615,0.000509176432779266,0.000534660739986731,0.000560643857972055,0.000586903861721829,0.000613408600217132,0.000640142439058514,0.000667062822762515,0.000694052260727368,0.000721076905195672,0.00074808701500632,0.00077498538752381,0.000801745252789709,0.000828335838790847,0.000854656600457211,0.000880626505788748,0.00090628342734926,0.000931604803295199,0.000956439160527156,0.000980781722501519,0.00100470317922416,0.00102819392723986,0.00105107504135625,0.00107344697262353,0.00109538434934638,0.00111689410552549,0.0011378199952667,0.00115834924839669,0.00117854325521177,0.00119842719890837,0.00121794164948181,0.00123728726446773,0.00125651328906492,0.00127566378854315,0.00129486130256322,0.00131420029298897,0.00133373833245456,0.00135357471011856,0.001373984064437,0.00139491792673325,0.00141644207251328,0.00143876167196386,0.00146220418098539,0.00148658964183682,0.0015119844082503,0.00153874573180332,0.0015671233853253,0.00159684469708061,0.00162796807647951,0.00166102981457466,0.00169607093519793,0.00173278236845959,0.00177120628349931,0.00181205251420751,0.00185505588218494,0.00189993084734561,0.00194669645865757,0.00199618990452651,0.00204780616113128,0.00210133166239363,0.00215675793962827,0.00221496208401843,0.00227504826787,0.00233689901506846,0.00240051253184399,0.00246657935878712,0.00253415282588741,0.00260316847180206,0.0026736668014552,0.00274591522324143,0.00281921831240934,0.00289349160336042,0.0029687506936877,0.00304492729891272,0.00312159659399705,0.0031986625829061,0.00327603885912777,0.00335347543660839,0.00343079269707595,0.00350789296127139,0.00358451779745235,0.00366042221642591,0.00373561120312524,0.00380999530811788,0.00388309740943476],&#34;fillcolor&#34;:&#34;#FF0065&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#FF0065&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#FF0065&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;LL\n(124,170]&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;pred_ML\n(170,216]&#34;:{&#34;x&#34;:[170.256111772249,170.931107119642,171.606102467035,172.281097814428,172.956093161821,173.631088509214,174.306083856607,174.981079204,175.656074551392,176.331069898785,177.006065246178,177.681060593571,178.356055940964,179.031051288357,179.70604663575,180.381041983143,181.056037330536,181.731032677928,182.406028025321,183.081023372714,183.756018720107,184.4310140675,185.106009414893,185.781004762286,186.456000109678,187.130995457071,187.805990804464,188.480986151857,189.15598149925,189.830976846643,190.505972194036,191.180967541429,191.855962888822,192.530958236214,193.205953583607,193.880948931,194.555944278393,195.230939625786,195.905934973179,196.580930320572,197.255925667965,197.930921015357,198.60591636275,199.280911710143,199.955907057536,200.630902404929,201.305897752322,201.980893099715,202.655888447108,203.3308837945,204.005879141893,204.680874489286,205.355869836679,206.030865184072,206.705860531465,207.380855878858,208.055851226251,208.730846573643,209.405841921036,210.080837268429,210.755832615822,211.430827963215,212.105823310608,212.780818658001,213.455814005394,214.130809352786,214.805804700179,215.480800047572,216.155795394965],&#34;y&#34;:[0.00395485720874836,0.00402538402210111,0.00409460532701009,0.0041618140363058,0.00422727014297645,0.00429110527463484,0.00435327025122278,0.00441285730679501,0.00447051135291999,0.00452631900364031,0.00458025277898414,0.00463128651798623,0.00468041689360866,0.00472764968365142,0.00477286524011621,0.00481535595396351,0.00485603285998411,0.00489492557725454,0.00493184498888496,0.00496643280735804,0.00499943856815534,0.00503091043098546,0.00506063339523617,0.00508855524692913,0.00511523032174649,0.0051407187114983,0.00516483291068775,0.00518773076640643,0.0052097758004362,0.00523103317257594,0.00525139475868946,0.00527110683520527,0.00529037486280031,0.00530926289875891,0.00532778366334584,0.00534615084015059,0.00536446060127801,0.00538277109393905,0.00540124177840895,0.00541995322410219,0.00543894514645553,0.00545826661130578,0.00547823270469978,0.00549872185151681,0.00551976483770954,0.00554143184706307,0.00556409062032348,0.0055874784749372,0.00561162172531852,0.00563664053351753,0.00566284401515743,0.00568991528419829,0.00571786890418135,0.00574688209026007,0.00577714425925403,0.00580833632347265,0.0058404605768337,0.00587374201008001,0.00590821827939286,0.00594360541486423,0.00597989247588802,0.00601732433575269,0.00605578565988152,0.00609505037082422,0.00613509306004511,0.0061761297510064,0.00621792671826762,0.00626032344769124,0.0063032791151646],&#34;fillcolor&#34;:&#34;#009850&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#009850&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#009850&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;ML\n(170,216]&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;pred_M\n(216,269]&#34;:{&#34;x&#34;:[216.830790742358,217.505786089751,218.180781437144,218.855776784537,219.530772131929,220.205767479322,220.880762826715,221.555758174108,222.230753521501,222.905748868894,223.580744216287,224.25573956368,224.930734911072,225.605730258465,226.280725605858,226.955720953251,227.630716300644,228.305711648037,228.98070699543,229.655702342823,230.330697690216,231.005693037608,231.680688385001,232.355683732394,233.030679079787,233.70567442718,234.380669774573,235.055665121966,235.730660469358,236.405655816751,237.080651164144,237.755646511537,238.43064185893,239.105637206323,239.780632553716,240.455627901109,241.130623248502,241.805618595894,242.480613943287,243.15560929068,243.830604638073,244.505599985466,245.180595332859,245.855590680252,246.530586027645,247.205581375037,247.88057672243,248.555572069823,249.230567417216,249.905562764609,250.580558112002,251.255553459395,251.930548806788,252.60554415418,253.280539501573,253.955534848966,254.630530196359,255.305525543752,255.980520891145,256.655516238538,257.330511585931,258.005506933323,258.680502280716,259.355497628109,260.030492975502,260.705488322895,261.380483670288,262.055479017681,262.730474365074,263.405469712466,264.080465059859,264.755460407252,265.430455754645,266.105451102038,266.780446449431,267.455441796824,268.130437144217],&#34;y&#34;:[0.00634691108898688,0.00639094355691895,0.00643527261896574,0.0064798421436973,0.00652458406496742,0.00656930036769757,0.00661391686696437,0.00665835454672246,0.00670229457495641,0.00674574436472116,0.00678862490716906,0.00683077975844864,0.00687173017308161,0.00691168552740601,0.00695056430324652,0.00698807173324149,0.00702371274576602,0.00705785544348557,0.00709042355892934,0.00712093387434241,0.00714903516092233,0.00717518881647959,0.00719933176138777,0.00722076599203376,0.00723942905209243,0.0072557990804069,0.00726983293305915,0.00728062450266413,0.00728849817857613,0.00729387557418449,0.00729673781675714,0.00729601271775852,0.00729244033839604,0.00728632975216814,0.00727768750938624,0.00726534693817015,0.00725041687057463,0.00723306478813471,0.00721329844919257,0.00719001156952667,0.00716450419766013,0.00713682519158047,0.0071068754354909,0.00707400876458467,0.00703925622695661,0.00700267813835337,0.00696411251684194,0.00692329931839365,0.00688099315683826,0.00683725919289199,0.00679192164925107,0.00674499567973937,0.00669698654206669,0.00664795879170273,0.00659776884673786,0.00654658672256739,0.00649471694106045,0.00644221994517584,0.00638902343774375,0.00633534247988331,0.00628133788851261,0.00622706457624976,0.00617255410828736,0.00611797565207835,0.00606340195060271,0.0060088825747749,0.00595458145499819,0.00590054791611003,0.0058468158288624,0.00579343029046611,0.00574071329359875,0.00568853095463653,0.00563691999235618,0.00558595979972263,0.00553603583898125,0.00548688950829255,0.00543855687762742],&#34;fillcolor&#34;:&#34;#A56F2B&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#A56F2B&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#A56F2B&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;M\n(216,269]&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;pred_MH\n(269,319]&#34;:{&#34;x&#34;:[268.805432491609,269.480427839002,270.155423186395,270.830418533788,271.505413881181,272.180409228574,272.855404575967,273.53039992336,274.205395270752,274.880390618145,275.555385965538,276.230381312931,276.905376660324,277.580372007717,278.25536735511,278.930362702503,279.605358049895,280.280353397288,280.955348744681,281.630344092074,282.305339439467,282.98033478686,283.655330134253,284.330325481646,285.005320829039,285.680316176431,286.355311523824,287.030306871217,287.70530221861,288.380297566003,289.055292913396,289.730288260789,290.405283608182,291.080278955574,291.755274302967,292.43026965036,293.105264997753,293.780260345146,294.455255692539,295.130251039932,295.805246387325,296.480241734717,297.15523708211,297.830232429503,298.505227776896,299.180223124289,299.855218471682,300.530213819075,301.205209166468,301.88020451386,302.555199861253,303.230195208646,303.905190556039,304.580185903432,305.255181250825,305.930176598218,306.605171945611,307.280167293003,307.955162640396,308.630157987789,309.305153335182,309.980148682575,310.655144029968,311.330139377361,312.005134724754,312.680130072146,313.355125419539,314.030120766932,314.705116114325,315.380111461718,316.055106809111,316.730102156504,317.405097503897,318.080092851289,318.755088198682],&#34;y&#34;:[0.00539118480962802,0.00534512791717941,0.00530006007958971,0.00525601014960452,0.00521321044391661,0.00517190800389842,0.00513175156397182,0.00509275923988829,0.00505524976114383,0.005019300295782,0.00498457487441492,0.00495107712213067,0.00491919032002156,0.00488878985408013,0.00485958968487733,0.00483157611936717,0.004805149951211,0.0047799990491608,0.00475590957687619,0.00473284968210659,0.00471116908699124,0.00469043628051987,0.00467051337987801,0.00465135215414607,0.00463317138915593,0.00461553626362955,0.00459836749893927,0.00458161436266723,0.00456526027976031,0.00454903918972671,0.00453288541345562,0.00451671796838432,0.00450033145148779,0.00448366722069206,0.00446666182343621,0.0044491603104439,0.00443089864063139,0.00441197939736426,0.0043923481336521,0.00437174580315268,0.00434997730231304,0.00432724344642095,0.00430350396910286,0.00427838649167871,0.00425186257109917,0.00422416589754699,0.00419527329628471,0.00416471280022986,0.00413267306291239,0.00409936580545038,0.00406478545642731,0.00402839417256745,0.00399059614927638,0.00395154524284582,0.00391125193650322,0.00386915968755682,0.00382584145308201,0.0037813791904234,0.00373577906967936,0.00368857098348421,0.00364036643901558,0.00359119879350329,0.00354103285823649,0.00348963693778552,0.00343746777757066,0.00338456435936733,0.00333087927553861,0.00327636646359865,0.0032213322771783,0.00316581818270547,0.00310979671837318,0.00305333791433981,0.00299661903331475,0.00293968152398775,0.0028825489318934],&#34;fillcolor&#34;:&#34;#005EAA&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#005EAA&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#005EAA&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;MH\n(269,319]&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;pred_HH\n(319,381]&#34;:{&#34;x&#34;:[319.430083546075,320.105078893468,320.780074240861,321.455069588254,322.130064935647,322.80506028304,323.480055630433,324.155050977825,324.830046325218,325.505041672611,326.180037020004,326.855032367397,327.53002771479,328.205023062183,328.880018409575,329.555013756968,330.230009104361,330.905004451754,331.579999799147,332.25499514654,332.929990493933,333.604985841326,334.279981188719,334.954976536111,335.629971883504,336.304967230897,336.97996257829,337.654957925683,338.329953273076,339.004948620469,339.679943967862,340.354939315254,341.029934662647,341.70493001004,342.379925357433,343.054920704826,343.729916052219,344.404911399612,345.079906747005,345.754902094397,346.42989744179,347.104892789183,347.779888136576,348.454883483969,349.129878831362,349.804874178755,350.479869526148,351.15486487354,351.829860220933,352.504855568326,353.179850915719,353.854846263112,354.529841610505,355.204836957898,355.879832305291,356.554827652683,357.229823000076,357.904818347469,358.579813694862,359.254809042255,359.929804389648,360.604799737041,361.279795084434,361.954790431826,362.629785779219,363.304781126612,363.979776474005,364.654771821398,365.329767168791,366.004762516184,366.679757863577,367.354753210969,368.029748558362,368.704743905755,369.379739253148,370.054734600541,370.729729947934,371.404725295327,372.07972064272,372.754715990113,373.429711337505,374.104706684898,374.779702032291,375.454697379684,376.129692727077,376.80468807447,377.479683421863,378.154678769255,378.829674116648,379.504669464041,380.179664811434,380.854660158827,381.52965550622,382.204650853613,382.879646201006,383.554641548399,384.229636895791,384.904632243184,385.579627590577,386.25462293797,386.929618285363,387.604613632756,388.279608980149,388.954604327542,389.629599674934,390.304595022327,390.97959036972,391.654585717113,392.329581064506,393.004576411899,393.679571759292,394.354567106685,395.029562454077,395.70455780147,396.379553148863,397.054548496256,397.729543843649,398.404539191042,399.079534538435,399.754529885828,400.42952523322,401.104520580613,401.779515928006,402.454511275399,403.129506622792,403.804501970185,404.479497317578,405.154492664971,405.829488012363,406.504483359756,407.179478707149,407.854474054542,408.529469401935,409.204464749328,409.879460096721,410.554455444114,411.229450791507,411.904446138899,412.579441486292,413.254436833685,413.929432181078,414.604427528471,415.279422875864,415.954418223257,416.629413570649,417.304408918042,417.979404265435,418.654399612828,419.329394960221,420.004390307614,420.679385655007,421.3543810024,422.029376349793,422.704371697185,423.379367044578,424.054362391971,424.729357739364,425.404353086757],&#34;y&#34;:[0.00282533292740068,0.00276811276061442,0.00271092799654795,0.0026538803134636,0.00259705204653181,0.00254045942221162,0.00248413879864257,0.00242829141942998,0.00237290815077594,0.00231797683592799,0.00226352973338776,0.00220988245861553,0.00215688427030482,0.00210452608130711,0.00205283549585952,0.00200225038377072,0.0019524418357934,0.00190343033800306,0.00185529180086378,0.00180842770809167,0.00176246815308426,0.00171743051631047,0.00167345504272619,0.00163085308309736,0.00158925313890196,0.00154866754763927,0.00150930855878766,0.00147136256235524,0.0014344835888265,0.00139867889707999,0.00136423378606768,0.00133118764742809,0.00129924053843916,0.00126839447403872,0.00123900171442454,0.00121094537657569,0.00118398553021919,0.00115811862057097,0.00113374982902349,0.00111061038830432,0.00108852787267915,0.00106749274301956,0.00104794035820206,0.00102946994117048,0.00101197728298252,0.000995446534901778,0.000980311816510628,0.000966077495784384,0.000952701021741572,0.000940193343892683,0.000928849579828849,0.000918233107565514,0.000908315863166871,0.000899133957841998,0.000890808384764564,0.000883023640705624,0.000875747434748508,0.000869014501627487,0.000862815895856668,0.000856949188682364,0.000851379993728758,0.000846114162031912,0.000841071399179829,0.000836144710492321,0.000831300283502783,0.000826491486816195,0.00082163112478627,0.00081668250361315,0.000811615255787427,0.000806315520472424,0.000800748422104157,0.000794918807525009,0.00078880241759594,0.000782216086499389,0.000775220094642841,0.000767833320329711,0.000760039673545603,0.000751598960003377,0.000742684529622834,0.00073330779935979,0.000723450922165562,0.00071287555854973,0.000701824056140559,0.00069029949603283,0.000678264716617207,0.000665571610393793,0.000652440832920907,0.000638883833159569,0.000624854255607222,0.000610300694165878,0.00059539777051294,0.000580163436369704,0.000564559213968016,0.000548611262677979,0.000532438248422965,0.000516062204812894,0.000499472312691727,0.000482735091042647,0.000465916350943295,0.000449039572375378,0.000432139564528271,0.000415277942786378,0.000398480367895736,0.000381769256005813,0.00036523735333172,0.000348898319429336,0.000332755471132287,0.000316828067293734,0.000301270995927409,0.000286017615069972,0.00027106723988823,0.000256435947566713,0.000242331877753638,0.000228596061380877,0.000215237493629457,0.000202292936519366,0.000189937735695728,0.000177995486632,0.000166469810618441,0.000155420749894497,0.00014496556385359,0.000134934605710533,0.000125326731533161,0.000116222419296849,0.000107671630717888,9.95280149443779e-05,9.17866748027774e-05,8.45419394404061e-05,7.77808164456576e-05,7.13887813701452e-05,6.5358391258795e-05,5.97895734996267e-05,5.46198856628284e-05,4.97682425756821e-05,4.52258629714391e-05,4.10902617278816e-05,3.72672937797002e-05,3.37059535520803e-05,3.03971754285471e-05,2.74296719187421e-05,2.46952807015039e-05,2.21669314849017e-05,1.98360797309125e-05,1.77785600611347e-05,1.58868252146348e-05,1.41507500964792e-05,1.25693529097354e-05,1.11843275752195e-05,9.91841207751947e-06,8.7654705588077e-06,7.72989062105012e-06,6.8268378961883e-06,6.007443874982e-06,5.26690578731457e-06,4.61159772967409e-06,4.04203177960234e-06,3.52902892709136e-06,3.06900517058538e-06],&#34;fillcolor&#34;:&#34;#710500&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#710500&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#710500&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;HH\n(319,381]&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;cyl_4\nHH: 0\nMH: 0.15\nM: 0.34\nML: 0.47\nLL: 0.65&#34;:{&#34;x&#34;:[&#34;4&#34;],&#34;y&#34;:[11],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;#BDBDBD&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;cyl_4\nHH: 0\nMH: 0.15\nM: 0.34\nML: 0.47\nLL: 0.65&#34;,&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y2&#34;},&#34;cyl_6\nHH: 0\nMH: 0.22\nM: 0.38\nML: 0.44\nLL: 0.35&#34;:{&#34;x&#34;:[&#34;6&#34;],&#34;y&#34;:[7],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;#525252&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;cyl_6\nHH: 0\nMH: 0.22\nM: 0.38\nML: 0.44\nLL: 0.35&#34;,&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y2&#34;},&#34;cyl_8\nHH: 1\nMH: 0.62\nM: 0.29\nML: 0.08\nLL: 0&#34;:{&#34;x&#34;:[&#34;8&#34;],&#34;y&#34;:[14],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;#969696&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;cyl_8\nHH: 1\nMH: 0.62\nM: 0.29\nML: 0.08\nLL: 0&#34;,&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y2&#34;},&#34;mpg_dens&#34;:{&#34;x&#34;:[2.96996268656716,3.04503132575868,3.1200999649502,3.19516860414172,3.27023724333324,3.34530588252475,3.42037452171627,3.49544316090779,3.57051180009931,3.64558043929083,3.72064907848234,3.79571771767386,3.87078635686538,3.9458549960569,4.02092363524842,4.09599227443993,4.17106091363145,4.24612955282297,4.32119819201449,4.396266831206,4.47133547039752,4.54640410958904,4.62147274878056,4.69654138797208,4.77161002716359,4.84667866635511,4.92174730554663,4.99681594473815,5.07188458392967,5.14695322312118,5.2220218623127,5.29709050150422,5.37215914069574,5.44722777988726,5.52229641907877,5.59736505827029,5.67243369746181,5.74750233665333,5.82257097584485,5.89763961503636,5.97270825422788,6.0477768934194,6.12284553261092,6.19791417180244,6.27298281099395,6.34805145018547,6.42312008937699,6.49818872856851,6.57325736776003,6.64832600695154,6.72339464614306,6.79846328533458,6.8735319245261,6.94860056371762,7.02366920290913,7.09873784210065,7.17380648129217,7.24887512048369,7.3239437596752,7.39901239886672,7.47408103805824,7.54914967724976,7.62421831644128,7.69928695563279,7.77435559482431,7.84942423401583,7.92449287320735,7.99956151239887,8.07463015159038,8.1496987907819,8.22476742997342,8.29983606916494,8.37490470835646,8.44997334754797,8.52504198673949,8.60011062593101,8.67517926512253,8.75024790431405,8.82531654350556,8.90038518269708,8.9754538218886,9.05052246108012,9.12559110027163,9.20065973946315,9.27572837865467,9.35079701784619,9.42586565703771,9.50093429622923,9.57600293542074,9.65107157461226,9.72614021380378,9.8012088529953,9.87627749218682,9.95134613137833,10.0264147705699,10.1014834097614,10.1765520489529,10.2516206881444,10.3266893273359,10.4017579665274,10.476826605719,10.5518952449105,10.626963884102,10.7020325232935,10.777101162485,10.8521698016765,10.9272384408681,11.0023070800596,11.0773757192511,11.1524443584426,11.2275129976341,11.3025816368257,11.3776502760172,11.4527189152087,11.5277875544002,11.6028561935917,11.6779248327832,11.7529934719748,11.8280621111663,11.9031307503578,11.9781993895493,12.0532680287408,12.1283366679324,12.2034053071239,12.2784739463154,12.3535425855069,12.4286112246984,12.5036798638899,12.5787485030815,12.653817142273,12.7288857814645,12.803954420656,12.8790230598475,12.9540916990391,13.0291603382306,13.1042289774221,13.1792976166136,13.2543662558051,13.3294348949966,13.4045035341882,13.4795721733797,13.5546408125712,13.6297094517627,13.7047780909542,13.7798467301457,13.8549153693373,13.9299840085288,14.0050526477203,14.0801212869118,14.1551899261033,14.2302585652949,14.3053272044864,14.3803958436779,14.4554644828694,14.5305331220609,14.6056017612524,14.680670400444,14.7557390396355,14.830807678827,14.9058763180185,14.98094495721,15.0560135964016,15.1310822355931,15.2061508747846,15.2812195139761,15.3562881531676,15.4313567923591,15.5064254315507,15.5814940707422,15.6565627099337,15.7316313491252,15.8066999883167,15.8817686275083,15.9568372666998,16.0319059058913,16.1069745450828,16.1820431842743,16.2571118234658,16.3321804626574,16.4072491018489,16.4823177410404,16.5573863802319,16.6324550194234,16.7075236586149,16.7825922978065,16.857660936998,16.9327295761895,17.007798215381,17.0828668545725,17.1579354937641,17.2330041329556,17.3080727721471,17.3831414113386,17.4582100505301,17.5332786897216,17.6083473289132,17.6834159681047,17.7584846072962,17.8335532464877,17.9086218856792,17.9836905248708,18.0587591640623,18.1338278032538,18.2088964424453,18.2839650816368,18.3590337208283,18.4341023600199,18.5091709992114,18.5842396384029,18.6593082775944,18.7343769167859,18.8094455559775,18.884514195169,18.9595828343605,19.034651473552,19.1097201127435,19.184788751935,19.2598573911266,19.3349260303181,19.4099946695096,19.4850633087011,19.5601319478926,19.6352005870841,19.7102692262757,19.7853378654672,19.8604065046587,19.9354751438502,20.0105437830417,20.0856124222333,20.1606810614248,20.2357497006163,20.3108183398078,20.3858869789993,20.4609556181908,20.5360242573824,20.6110928965739,20.6861615357654,20.7612301749569,20.8362988141484,20.91136745334,20.9864360925315,21.061504731723,21.1365733709145,21.211642010106,21.2867106492975,21.3617792884891,21.4368479276806,21.5119165668721,21.5869852060636,21.6620538452551,21.7371224844467,21.8121911236382,21.8872597628297,21.9623284020212,22.0373970412127,22.1124656804042,22.1875343195958,22.2626029587873,22.3376715979788,22.4127402371703,22.4878088763618,22.5628775155533,22.6379461547449,22.7130147939364,22.7880834331279,22.8631520723194,22.9382207115109,23.0132893507025,23.088357989894,23.1634266290855,23.238495268277,23.3135639074685,23.38863254666,23.4637011858516,23.5387698250431,23.6138384642346,23.6889071034261,23.7639757426176,23.8390443818092,23.9141130210007,23.9891816601922,24.0642502993837,24.1393189385752,24.2143875777667,24.2894562169583,24.3645248561498,24.4395934953413,24.5146621345328,24.5897307737243,24.6647994129159,24.7398680521074,24.8149366912989,24.8900053304904,24.9650739696819,25.0401426088734,25.115211248065,25.1902798872565,25.265348526448,25.3404171656395,25.415485804831,25.4905544440225,25.5656230832141,25.6406917224056,25.7157603615971,25.7908290007886,25.8658976399801,25.9409662791717,26.0160349183632,26.0911035575547,26.1661721967462,26.2412408359377,26.3163094751292,26.3913781143208,26.4664467535123,26.5415153927038,26.6165840318953,26.6916526710868,26.7667213102784,26.8417899494699,26.9168585886614,26.9919272278529,27.0669958670444,27.1420645062359,27.2171331454275,27.292201784619,27.3672704238105,27.442339063002,27.5174077021935,27.5924763413851,27.6675449805766,27.7426136197681,27.8176822589596,27.8927508981511,27.9678195373426,28.0428881765342,28.1179568157257,28.1930254549172,28.2680940941087,28.3431627333002,28.4182313724917,28.4933000116833,28.5683686508748,28.6434372900663,28.7185059292578,28.7935745684493,28.8686432076409,28.9437118468324,29.0187804860239,29.0938491252154,29.1689177644069,29.2439864035984,29.31905504279,29.3941236819815,29.469192321173,29.5442609603645,29.619329599556,29.6943982387476,29.7694668779391,29.8445355171306,29.9196041563221,29.9946727955136,30.0697414347051,30.1448100738967,30.2198787130882,30.2949473522797,30.3700159914712,30.4450846306627,30.5201532698543,30.5952219090458,30.6702905482373,30.7453591874288,30.8204278266203,30.8954964658118,30.9705651050034,31.0456337441949,31.1207023833864,31.1957710225779,31.2708396617694,31.345908300961,31.4209769401525,31.496045579344,31.5711142185355,31.646182857727,31.7212514969185,31.7963201361101,31.8713887753016,31.9464574144931,32.0215260536846,32.0965946928761,32.1716633320676,32.2467319712592,32.3218006104507,32.3968692496422,32.4719378888337,32.5470065280252,32.6220751672167,32.6971438064083,32.7722124455998,32.8472810847913,32.9223497239828,32.9974183631743,33.0724870023659,33.1475556415574,33.2226242807489,33.2976929199404,33.3727615591319,33.4478301983235,33.522898837515,33.5979674767065,33.673036115898,33.7481047550895,33.823173394281,33.8982420334726,33.9733106726641,34.0483793118556,34.1234479510471,34.1985165902386,34.2735852294301,34.3486538686217,34.4237225078132,34.4987911470047,34.5738597861962,34.6489284253877,34.7239970645793,34.7990657037708,34.8741343429623,34.9492029821538,35.0242716213453,35.0993402605368,35.1744088997284,35.2494775389199,35.3245461781114,35.3996148173029,35.4746834564944,35.549752095686,35.6248207348775,35.699889374069,35.7749580132605,35.850026652452,35.9250952916435,36.0001639308351,36.0752325700266,36.1503012092181,36.2253698484096,36.3004384876011,36.3755071267926,36.4505757659842,36.5256444051757,36.6007130443672,36.6757816835587,36.7508503227502,36.8259189619418,36.9009876011333,36.9760562403248,37.0511248795163,37.1261935187078,37.2012621578994,37.2763307970909,37.3513994362824,37.4264680754739,37.5015367146654,37.5766053538569,37.6516739930485,37.72674263224,37.8018112714315,37.876879910623,37.9519485498145,38.027017189006,38.1020858281976,38.1771544673891,38.2522231065806,38.3272917457721,38.4023603849636,38.4774290241552,38.5524976633467,38.6275663025382,38.7026349417297,38.7777035809212,38.8527722201127,38.9278408593043,39.0029094984958,39.0779781376873,39.1530467768788,39.2281154160703,39.3031840552619,39.3782526944534,39.4533213336449,39.5283899728364,39.6034586120279,39.6785272512194,39.753595890411,39.8286645296025,39.903733168794,39.9788018079855,40.053870447177,40.1289390863685,40.2040077255601,40.2790763647516,40.3541450039431,40.4292136431346,40.5042822823261,40.5793509215177,40.6544195607092,40.7294881999007,40.8045568390922,40.8796254782837,40.9546941174752,41.0297627566668,41.1048313958583,41.1799000350498,41.2549686742413,41.3300373134328],&#34;y&#34;:[0.000114229889951918,0.000125273732728626,0.000137050151569663,0.000149514448557863,0.000163548707093741,0.00017842086769883,0.000194189645158505,0.000211800991279835,0.000230417785779494,0.000250186134516725,0.000272091353413302,0.000295190853282914,0.000319748138090844,0.000346753678164109,0.000375163278516302,0.000405392353352029,0.00043839191630835,0.000473025083171863,0.000509897608297056,0.000549865884799234,0.000591714932801751,0.000636282193585794,0.000684264269333187,0.00073438873123137,0.000787767533919762,0.000844863679659825,0.000904374032794606,0.000967727509301853,0.00103507332727553,0.00110511011541999,0.00117962360481525,0.00125836582832946,0.00134007455387213,0.00142692713169268,0.00151819575096023,0.0016126982973312,0.00171303097435456,0.00181790876909982,0.00192627252375892,0.00204115460244825,0.00216064557042484,0.00228385182340513,0.00241424734268497,0.00254924588638339,0.00268815944027951,0.0028348960102069,0.00298615903981131,0.00314150124168559,0.00330524381785147,0.00347336810328754,0.00364580684975305,0.00382692787661865,0.00401233499398705,0.00420243406989608,0.00440104244661222,0.00460397348017972,0.00481193213809767,0.00502813429726787,0.00524865605531255,0.00547449396545618,0.00570823503504366,0.00594625891078352,0.00618984036323931,0.0064409330600869,0.00669624683271584,0.00695731896374735,0.00722548499335452,0.0074977968566662,0.00777604073693687,0.0080609631184595,0.0083499561064188,0.00864504824106554,0.00894643182590742,0.00925182565737347,0.00956350616164292,0.00988114251064116,0.0102027587968439,0.0105309013458707,0.0108647331794483,0.0112025590342439,0.011547236767962,0.0118974165128855,0.0122516609834645,0.0126132019991806,0.012980138623248,0.0133512761133107,0.0137303021027543,0.0141146905339388,0.0145034855963567,0.0149009276537631,0.0153037556724812,0.0157112642465902,0.0161283509199834,0.0165508795035261,0.0169784228663741,0.0174166371255152,0.0178603517797577,0.0183097457170008,0.0187704650058753,0.0192369975629635,0.0197100471319284,0.0201948572574038,0.0206858798277631,0.0211843072095414,0.0216948285594811,0.0222119236444772,0.0227373144896621,0.0232749660742645,0.0238194790893781,0.0243731204029669,0.0249389641095947,0.0255118465438023,0.0260945574178793,0.0266891403556056,0.0272907933140105,0.0279027597420157,0.0285259652044185,0.0291560939853421,0.0297967197565422,0.0304476376619687,0.0311051281846789,0.031772913735407,0.0324497409359108,0.0331325681935215,0.0338250282288393,0.0345250077956126,0.0352301850562352,0.0359438137775108,0.0366632203232897,0.0373867956064091,0.0381170855944091,0.0388512610006622,0.0395883645463794,0.0403298819396755,0.0410733226970109,0.0418182659125721,0.0425647807342156,0.0433112747038546,0.0440576976478669,0.044802364259259,0.0455451712759395,0.0462862140481823,0.0470218113915404,0.0477538790156692,0.0484821446565278,0.0492015875490189,0.0499157906849128,0.0506239262649292,0.0513201951201251,0.0520095863574055,0.0526904982752669,0.0533569422312706,0.0540149987916339,0.0546621137887025,0.0552926856883678,0.0559135388539339,0.0565210415399491,0.0571105049903819,0.0576891388589819,0.0582521716549459,0.0587962683880539,0.0593286766734319,0.059843490489783,0.0603390587366376,0.0608223509644597,0.0612863981530185,0.0617314358410082,0.0621638874833518,0.0625758523747786,0.0629695224225652,0.0633505670227897,0.0637103333927429,0.0640529119557001,0.0643830768624863,0.0646916356526201,0.0649844076024407,0.0652651983007734,0.0655245025638205,0.065769611533718,0.0660033525017636,0.0662161295920915,0.0664163923873938,0.0666060347353955,0.0667755680363576,0.0669342649578231,0.0670831726888495,0.0672130665374253,0.0673337201126039,0.0674451809291316,0.0675393895162468,0.0676255442685601,0.0677028563900642,0.0677651513573859,0.0678201666094758,0.0678667236707489,0.0679002024415557,0.067927068845819,0.0679458272511997,0.0679530984411411,0.0679542870907898,0.0679476158335419,0.0679306780801021,0.067908028835629,0.0678776037870206,0.0678377673350176,0.0677924205679144,0.0677391670424319,0.0676770203348596,0.0676093938007805,0.0675334784000283,0.0674488994872161,0.0673587096352501,0.0672595797145926,0.0671517900375297,0.0670381148572513,0.0669145815719605,0.0667822376920479,0.0666436162842428,0.0664939751479885,0.0663352923518843,0.0661698548433573,0.065992036131299,0.0658049365767762,0.0656105568206685,0.0654022970043372,0.0651845742106906,0.0649590369370421,0.0647180616587153,0.0644675526862324,0.0642087263933387,0.0639329352676019,0.0636476918659782,0.0633536987604394,0.0630413425124595,0.062719792830209,0.0623886523029847,0.0620390086008308,0.0616801017122958,0.061310775372805,0.0609233799319284,0.0605267064243477,0.0601189704145019,0.0596939646610578,0.059259847792459,0.0588142712837906,0.0583525776493199,0.0578821310903507,0.0574001269997778,0.0569034791960782,0.0563986290457527,0.0558824653752783,0.0553534023360636,0.0548168728813581,0.0542696447286468,0.053711469101004,0.0531467335908559,0.0525722979014553,0.0519890017249994,0.0514002011598197,0.0508030781982394,0.0501992400197976,0.0495910745237401,0.0489763217189034,0.0483569807626469,0.047734579415901,0.0471076445821018,0.0464781586448889,0.0458469346254187,0.0452134964837048,0.0445793908845901,0.0439448893387,0.0433106937006642,0.0426775088365751,0.042045255025224,0.0414159549184166,0.0407890997477807,0.0401644546896987,0.039545462105019,0.0389300802121295,0.0383181593967295,0.037714466155406,0.0371153199871162,0.0365210945965443,0.0359369533632598,0.0353583308523981,0.0347860935385033,0.0342253842147137,0.0336710304119423,0.0331244868555602,0.0325905108764094,0.0320635855212454,0.031545816877892,0.0310412744525422,0.0305443347493063,0.030057787047044,0.0295847780056226,0.0291197843524882,0.028666281873045,0.0282263268466158,0.0277946680039127,0.0273754463619757,0.0269695240219589,0.0265720572854393,0.0261878110245049,0.0258164064978562,0.0254535079204524,0.025104447020359,0.0247676064064712,0.0244392260110327,0.0241251357643548,0.0238225219036058,0.0235282391366668,0.0232485383683775,0.0229794836107023,0.0227185589572238,0.0224723524655867,0.0222359050903225,0.0220073247261404,0.0217934470120905,0.0215884090640308,0.0213909205690378,0.0212079692739273,0.0210329247967187,0.020865063177382,0.0207114220325011,0.0205647558862172,0.0204251007903076,0.0202987127239451,0.0201786212615207,0.0200654784143913,0.0199641794396866,0.0198686751947915,0.0197799377776933,0.0197016011868594,0.0196285143249308,0.0195618838759074,0.0195042013494479,0.0194511809141234,0.0194041691260234,0.0193646538117595,0.01932917175265,0.0192991062342418,0.0192751007142036,0.0192544613318477,0.019238498082011,0.0192271894132118,0.0192185462539002,0.0192136908392892,0.0192121341003209,0.0192125155494985,0.0192156540395949,0.0192208049472464,0.0192271488909842,0.0192350885946818,0.0192438448631322,0.0192530419023504,0.019262560971588,0.0192718112574272,0.0192807551535821,0.0192886592662957,0.0192953378498803,0.0193009812245984,0.0193041649059721,0.0193053097587176,0.0193047226142344,0.0193002323501242,0.019293043960149,0.0192834723593199,0.019268568517333,0.0192504667992848,0.0192293890452671,0.0192016037364312,0.019170280518466,0.0191352281816972,0.0190926467342532,0.0190461116592218,0.0189950953848759,0.0189360173935566,0.018872635541656,0.0188040718489362,0.0187271525737499,0.0186456726523495,0.0185583885801243,0.0184626819984024,0.0183622544938361,0.0182555037923272,0.0181404729001704,0.018020658095215,0.017894126427459,0.0177596436269259,0.0176204098177031,0.0174742094727197,0.0173205476462964,0.0171622602198725,0.016996915169023,0.0168247302835838,0.0166481325351633,0.0164645548669329,0.0162748610848089,0.0160810477685971,0.0158805066292131,0.0156746449514097,0.015465029591231,0.0152491137657672,0.0150287152174851,0.0148049921788406,0.0145755674031001,0.0143425117236918,0.0141066139974137,0.0138657760289471,0.0136221467751269,0.0133762003712007,0.0131262247974533,0.0128742617322952,0.0126205375516341,0.0123638272945128,0.0121058769293974,0.011846725517612,0.0115857724810267,0.0113242376672141,0.0110620768721777,0.0107993696564901,0.0105366591816821,0.0102739744907838,0.0100118944893552,0.00975037370864591,0.00948959081453261,0.00923043939368806,0.00897238299450102,0.00871581806430377,0.00846177172974433,0.00820931977552797,0.00795913366641453,0.00771220340271279,0.00746732180057261,0.00722547948185629,0.00698747537078352,0.00675192184869771,0.00652015819970899,0.00629266031015632,0.00606795686162937,0.00584774984356118,0.00563208620357928,0.00541949876135071,0.0052120507134402,0.00500928292989102,0.00480980877368389,0.00461603627213573,0.00442695306964015,0.00424131617124104,0.00406184853398545,0.00388696716212249,0.00371562134508756,0.0035508074929813,0.00339038262240756,0.00323352208714429,0.00308344511102575,0.00293748452954117,0.00279506099149529,0.00265955945207812,0.00252784560310971,0.00239959103413078,0.00227828576162718,0.00216040195857675,0.00204599295442202,0.00193818070664026,0.00183354071983298,0.00173241929341168,0.00163731564290115,0.00154519529769942,0.00145657831258937,0.00137337467713549,0.00129294412164485,0.00121594683573901,0.00114375343214423,0.00107410882417359,0.00100777843441016,0.000945654777335617,0.000885848291185367,0.000829195318860362,0.00077617831308329,0.00072524556209966,0.000677272149737364,0.000632401044393554,0.000589385237987149,0.000549109686833407,0.000511447392680604,0.000475419779431035,0.000441896920012362,0.000410547420533136,0.000380623796161366,0.000352961035157659,0.00032708283536957,0.000302436102284799,0.000279805212672391,0.000258620954894212,0.000238489898469976,0.000220134806074134,0.000202937332227206,0.000186631921280278,0.00017187288344902,0.00015802813497583,0.000144931757035498,0.000133166426187584,0.0001221136448986,0.000111682750933327,0.000102384668940646,9.36343974145132e-05,8.53960585846729e-05,7.81111418713846e-05,7.12415249248712e-05,6.48141936795621e-05],&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;grey&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;grey&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_dens&#34;,&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y3&#34;},&#34;mpg_10.4\nHH: 0.48\nMH: 0.28\nM: 0.23\nML: 0.08\nLL: 0&#34;:{&#34;x0&#34;:10.4,&#34;y0&#34;:0,&#34;x1&#34;:10.4,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_10.4\nHH: 0.48\nMH: 0.28\nM: 0.23\nML: 0.08\nLL: 0&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_14.7\nHH: 0.3\nMH: 0.31\nM: 0.21\nML: 0.12\nLL: 0&#34;:{&#34;x0&#34;:14.7,&#34;y0&#34;:0,&#34;x1&#34;:14.7,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_14.7\nHH: 0.3\nMH: 0.31\nM: 0.21\nML: 0.12\nLL: 0&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_19.4\nHH: 0.22\nMH: 0.19\nM: 0.19\nML: 0.22\nLL: 0.23&#34;:{&#34;x0&#34;:19.45,&#34;y0&#34;:0,&#34;x1&#34;:19.45,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_19.4\nHH: 0.22\nMH: 0.19\nM: 0.19\nML: 0.22\nLL: 0.23&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_30.4\nHH: 0\nMH: 0.11\nM: 0.19\nML: 0.29\nLL: 0.39&#34;:{&#34;x0&#34;:30.4,&#34;y0&#34;:0,&#34;x1&#34;:30.4,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_30.4\nHH: 0\nMH: 0.11\nM: 0.19\nML: 0.29\nLL: 0.39&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_33.9\nHH: 0\nMH: 0.11\nM: 0.19\nML: 0.29\nLL: 0.39&#34;:{&#34;x0&#34;:33.9,&#34;y0&#34;:0,&#34;x1&#34;:33.9,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_33.9\nHH: 0\nMH: 0.11\nM: 0.19\nML: 0.29\nLL: 0.39&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;wt_dens&#34;:{&#34;x&#34;:[0.47657276119403,0.488282848234366,0.499992935274703,0.511703022315039,0.523413109355376,0.535123196395712,0.546833283436048,0.558543370476385,0.570253457516721,0.581963544557058,0.593673631597394,0.605383718637731,0.617093805678067,0.628803892718404,0.64051397975874,0.652224066799077,0.663934153839413,0.67564424087975,0.687354327920086,0.699064414960423,0.710774502000759,0.722484589041096,0.734194676081432,0.745904763121769,0.757614850162105,0.769324937202442,0.781035024242778,0.792745111283115,0.804455198323451,0.816165285363788,0.827875372404124,0.839585459444461,0.851295546484797,0.863005633525133,0.87471572056547,0.886425807605806,0.898135894646143,0.909845981686479,0.921556068726816,0.933266155767152,0.944976242807489,0.956686329847825,0.968396416888162,0.980106503928498,0.991816590968835,1.00352667800917,1.01523676504951,1.02694685208984,1.03865693913018,1.05036702617052,1.06207711321085,1.07378720025119,1.08549728729153,1.09720737433186,1.1089174613722,1.12062754841254,1.13233763545287,1.14404772249321,1.15575780953355,1.16746789657388,1.17917798361422,1.19088807065455,1.20259815769489,1.21430824473523,1.22601833177556,1.2377284188159,1.24943850585624,1.26114859289657,1.27285867993691,1.28456876697725,1.29627885401758,1.30798894105792,1.31969902809826,1.33140911513859,1.34311920217893,1.35482928921927,1.3665393762596,1.37824946329994,1.38995955034027,1.40166963738061,1.41337972442095,1.42508981146128,1.43679989850162,1.44850998554196,1.46022007258229,1.47193015962263,1.48364024666297,1.4953503337033,1.50706042074364,1.51877050778398,1.53048059482431,1.54219068186465,1.55390076890499,1.56561085594532,1.57732094298566,1.589031030026,1.60074111706633,1.61245120410667,1.624161291147,1.63587137818734,1.64758146522768,1.65929155226801,1.67100163930835,1.68271172634869,1.69442181338902,1.70613190042936,1.7178419874697,1.72955207451003,1.74126216155037,1.75297224859071,1.76468233563104,1.77639242267138,1.78810250971172,1.79981259675205,1.81152268379239,1.82323277083272,1.83494285787306,1.8466529449134,1.85836303195373,1.87007311899407,1.88178320603441,1.89349329307474,1.90520338011508,1.91691346715542,1.92862355419575,1.94033364123609,1.95204372827643,1.96375381531676,1.9754639023571,1.98717398939744,1.99888407643777,2.01059416347811,2.02230425051845,2.03401433755878,2.04572442459912,2.05743451163945,2.06914459867979,2.08085468572013,2.09256477276046,2.1042748598008,2.11598494684114,2.12769503388147,2.13940512092181,2.15111520796215,2.16282529500248,2.17453538204282,2.18624546908316,2.19795555612349,2.20966564316383,2.22137573020416,2.2330858172445,2.24479590428484,2.25650599132517,2.26821607836551,2.27992616540585,2.29163625244618,2.30334633948652,2.31505642652686,2.32676651356719,2.33847660060753,2.35018668764787,2.3618967746882,2.37360686172854,2.38531694876888,2.39702703580921,2.40873712284955,2.42044720988989,2.43215729693022,2.44386738397056,2.45557747101089,2.46728755805123,2.47899764509157,2.4907077321319,2.50241781917224,2.51412790621258,2.52583799325291,2.53754808029325,2.54925816733359,2.56096825437392,2.57267834141426,2.5843884284546,2.59609851549493,2.60780860253527,2.61951868957561,2.63122877661594,2.64293886365628,2.65464895069661,2.66635903773695,2.67806912477729,2.68977921181762,2.70148929885796,2.7131993858983,2.72490947293863,2.73661955997897,2.74832964701931,2.76003973405964,2.77174982109998,2.78345990814032,2.79516999518065,2.80688008222099,2.81859016926133,2.83030025630166,2.842010343342,2.85372043038234,2.86543051742267,2.87714060446301,2.88885069150334,2.90056077854368,2.91227086558402,2.92398095262435,2.93569103966469,2.94740112670503,2.95911121374536,2.9708213007857,2.98253138782604,2.99424147486637,3.00595156190671,3.01766164894705,3.02937173598738,3.04108182302772,3.05279191006806,3.06450199710839,3.07621208414873,3.08792217118906,3.0996322582294,3.11134234526974,3.12305243231007,3.13476251935041,3.14647260639075,3.15818269343108,3.16989278047142,3.18160286751176,3.19331295455209,3.20502304159243,3.21673312863277,3.2284432156731,3.24015330271344,3.25186338975378,3.26357347679411,3.27528356383445,3.28699365087478,3.29870373791512,3.31041382495546,3.32212391199579,3.33383399903613,3.34554408607647,3.3572541731168,3.36896426015714,3.38067434719748,3.39238443423781,3.40409452127815,3.41580460831849,3.42751469535882,3.43922478239916,3.4509348694395,3.46264495647983,3.47435504352017,3.48606513056051,3.49777521760084,3.50948530464118,3.52119539168151,3.53290547872185,3.54461556576219,3.55632565280252,3.56803573984286,3.5797458268832,3.59145591392353,3.60316600096387,3.61487608800421,3.62658617504454,3.63829626208488,3.65000634912522,3.66171643616555,3.67342652320589,3.68513661024623,3.69684669728656,3.7085567843269,3.72026687136723,3.73197695840757,3.74368704544791,3.75539713248824,3.76710721952858,3.77881730656892,3.79052739360925,3.80223748064959,3.81394756768993,3.82565765473026,3.8373677417706,3.84907782881094,3.86078791585127,3.87249800289161,3.88420808993195,3.89591817697228,3.90762826401262,3.91933835105295,3.93104843809329,3.94275852513363,3.95446861217396,3.9661786992143,3.97788878625464,3.98959887329497,4.00130896033531,4.01301904737565,4.02472913441598,4.03643922145632,4.04814930849666,4.05985939553699,4.07156948257733,4.08327956961767,4.094989656658,4.10669974369834,4.11840983073867,4.13011991777901,4.14183000481935,4.15354009185968,4.16525017890002,4.17696026594036,4.18867035298069,4.20038044002103,4.21209052706137,4.2238006141017,4.23551070114204,4.24722078818238,4.25893087522271,4.27064096226305,4.28235104930339,4.29406113634372,4.30577122338406,4.31748131042439,4.32919139746473,4.34090148450507,4.3526115715454,4.36432165858574,4.37603174562608,4.38774183266641,4.39945191970675,4.41116200674709,4.42287209378742,4.43458218082776,4.4462922678681,4.45800235490843,4.46971244194877,4.48142252898911,4.49313261602944,4.50484270306978,4.51655279011012,4.52826287715045,4.53997296419079,4.55168305123112,4.56339313827146,4.5751032253118,4.58681331235213,4.59852339939247,4.61023348643281,4.62194357347314,4.63365366051348,4.64536374755382,4.65707383459415,4.66878392163449,4.68049400867483,4.69220409571516,4.7039141827555,4.71562426979584,4.72733435683617,4.73904444387651,4.75075453091684,4.76246461795718,4.77417470499752,4.78588479203785,4.79759487907819,4.80930496611853,4.82101505315886,4.8327251401992,4.84443522723954,4.85614531427987,4.86785540132021,4.87956548836055,4.89127557540088,4.90298566244122,4.91469574948156,4.92640583652189,4.93811592356223,4.94982601060256,4.9615360976429,4.97324618468324,4.98495627172357,4.99666635876391,5.00837644580425,5.02008653284458,5.03179661988492,5.04350670692526,5.05521679396559,5.06692688100593,5.07863696804627,5.0903470550866,5.10205714212694,5.11376722916728,5.12547731620761,5.13718740324795,5.14889749028829,5.16060757732862,5.17231766436896,5.18402775140929,5.19573783844963,5.20744792548997,5.2191580125303,5.23086809957064,5.24257818661098,5.25428827365131,5.26599836069165,5.27770844773199,5.28941853477232,5.30112862181266,5.312838708853,5.32454879589333,5.33625888293367,5.347968969974,5.35967905701434,5.37138914405468,5.38309923109501,5.39480931813535,5.40651940517569,5.41822949221602,5.42993957925636,5.4416496662967,5.45335975333703,5.46506984037737,5.47677992741771,5.48849001445804,5.50020010149838,5.51191018853872,5.52362027557905,5.53533036261939,5.54704044965973,5.55875053670006,5.5704606237404,5.58217071078074,5.59388079782107,5.60559088486141,5.61730097190174,5.62901105894208,5.64072114598242,5.65243123302275,5.66414132006309,5.67585140710343,5.68756149414376,5.6992715811841,5.71098166822444,5.72269175526477,5.73440184230511,5.74611192934545,5.75782201638578,5.76953210342612,5.78124219046645,5.79295227750679,5.80466236454713,5.81637245158746,5.8280825386278,5.83979262566814,5.85150271270847,5.86321279974881,5.87492288678915,5.88663297382948,5.89834306086982,5.91005314791016,5.92176323495049,5.93347332199083,5.94518340903117,5.9568934960715,5.96860358311184,5.98031367015218,5.99202375719251,6.00373384423285,6.01544393127318,6.02715401831352,6.03886410535386,6.05057419239419,6.06228427943453,6.07399436647487,6.0857044535152,6.09741454055554,6.10912462759588,6.12083471463621,6.13254480167655,6.14425488871689,6.15596497575722,6.16767506279756,6.17938514983789,6.19109523687823,6.20280532391857,6.2145154109589,6.22622549799924,6.23793558503958,6.24964567207991,6.26135575912025,6.27306584616059,6.28477593320092,6.29648602024126,6.3081961072816,6.31990619432193,6.33161628136227,6.34332636840261,6.35503645544294,6.36674654248328,6.37845662952362,6.39016671656395,6.40187680360429,6.41358689064463,6.42529697768496,6.4370070647253,6.44871715176563,6.46042723880597],&#34;y&#34;:[0.000588305747859967,0.000653662546177274,0.000723963411877116,0.000802929549769688,0.000889479434486823,0.000982370534203977,0.00108518976103097,0.00119855544237036,0.00131994472036086,0.00145247187698992,0.00159934484368989,0.001756232665348,0.00192532734307172,0.0021135415600787,0.00231408560427172,0.00252765905332986,0.00276623020813335,0.00301977234637767,0.00328847357713965,0.00358591738691038,0.00390296030311583,0.00423814316428617,0.00460440885268853,0.00499653052779915,0.00541004685425102,0.00585650024639029,0.0063361959305214,0.00684075642738382,0.00737945433089139,0.00795989840270584,0.00856881043554106,0.00921224659521632,0.00990697081345154,0.0106337925309994,0.0113945736179875,0.0122170636181251,0.013075178091888,0.0139691415838804,0.0149288526323047,0.0159309722779777,0.0169721838389724,0.01807856341184,0.0192361819738506,0.0204357060491956,0.0216983672563278,0.0230211834918149,0.0243881253482525,0.0258147223814598,0.0273100655794014,0.0288510035218589,0.0304467493337186,0.0321190412211169,0.0338375059584044,0.0356047402731382,0.0374550300138563,0.0393510679905891,0.0412927845618922,0.0433145138958261,0.0453843698154036,0.0474983012194,0.0496827616165884,0.0519187106233118,0.0541960307689625,0.0565335011844187,0.0589238533290903,0.0613518038985453,0.0638290951290422,0.0663583842292055,0.0689205174971155,0.0715212422140802,0.0741705987861254,0.0768472018860914,0.0795521935327253,0.0822998881459878,0.0850685711131232,0.0878578097355036,0.0906785641177854,0.0935149813910552,0.0963652269537345,0.0992340266500031,0.102112691054892,0.104998280069066,0.107891150714918,0.110786291398719,0.113681520357562,0.116574751849369,0.119461164070792,0.122341127438455,0.125211983458818,0.128065819018823,0.130907173518256,0.13373452530288,0.136533977764915,0.13931558956002,0.142079033749399,0.144806289228922,0.147509731046339,0.150190518443112,0.15283159734119,0.155441475785252,0.158025081387198,0.160567718175561,0.163071826127385,0.165546925203725,0.167981725463347,0.17037102903303,0.172729439687436,0.17504978300274,0.177318265544688,0.179554757094315,0.181756596717929,0.18390099262779,0.186012994885452,0.188092598181578,0.190114042061918,0.192101295724165,0.194056388973739,0.195958591236368,0.197822780321955,0.1996555254982,0.201441118790422,0.203185522584342,0.204899585868711,0.206572444876928,0.208201639740741,0.209801911977778,0.211366933510961,0.212886565247555,0.214378957034801,0.215841906076329,0.217258542582392,0.218649860379786,0.220015994195073,0.221338347385617,0.222636246504854,0.223911138655524,0.22514921749551,0.226362219114609,0.227554637986412,0.228716948487392,0.229854501893055,0.230974166590472,0.232070098654074,0.233142667284122,0.234200336738981,0.235240243011945,0.236259393596278,0.237266953219638,0.238262220569756,0.239240698293245,0.24021122863041,0.241174063325155,0.242126109352169,0.243073927209882,0.24401806844024,0.244958754005581,0.245899422915709,0.246840776138009,0.247785361452477,0.248735673786362,0.249691364080893,0.250656189653498,0.251634126018204,0.252622452030991,0.25362489311511,0.254649565002808,0.255689937484511,0.256748346700479,0.257839925383187,0.258952791788404,0.260087323189842,0.261266058142699,0.262472807913362,0.263707076771838,0.264991431631539,0.266314268120489,0.267670675736086,0.269081718567118,0.270543474566533,0.272044986082628,0.273604196845273,0.275228063149989,0.276897904714739,0.278626873439181,0.280436005601543,0.282297229263909,0.284217232541924,0.28623420151517,0.288309084838269,0.290442255233552,0.292686574075527,0.294995829747783,0.297368588070914,0.299851612251397,0.302413397376107,0.305043015556477,0.307779347589871,0.310608082047404,0.313507731471377,0.316507812535489,0.319612839226409,0.322790214423111,0.32605909434202,0.329443238939267,0.332899102401217,0.336435167401056,0.34009327872927,0.343820014387732,0.347615097969852,0.351531320943,0.355511601262243,0.35955403509858,0.363696461121886,0.367902142641089,0.372160663012396,0.376495653373984,0.380887015934679,0.385318639003849,0.389801910426376,0.394327345290166,0.398877201664297,0.403453858795064,0.408050090435334,0.412651813316133,0.417256864237264,0.421849760911855,0.426426472456697,0.430985502995479,0.435491844748906,0.439957746827314,0.444381891230911,0.448717929623582,0.452980463551273,0.457175700975284,0.461252378008086,0.465214876606076,0.469083898103611,0.472810305547681,0.476375023599267,0.47982034767669,0.483106513622703,0.486177892778987,0.489105168486745,0.491864951288793,0.494352955369166,0.496674285024609,0.498827508853677,0.500651583403777,0.502288692429284,0.50373845205029,0.504855872216302,0.505742961360178,0.506427298195742,0.506786419567335,0.506872554200583,0.506744957236864,0.506308677031344,0.505559597500064,0.504590629896242,0.50333757804063,0.501736851592977,0.499915102799359,0.497840253196014,0.495389728635065,0.492722065747208,0.489836758164059,0.486556325721963,0.483067458688263,0.479370953920444,0.475325551151142,0.471056963844871,0.466594264319548,0.461833521021623,0.456841851451872,0.451673447306482,0.446258483642867,0.440613459829106,0.434812285084145,0.428814586237262,0.422596638507221,0.416245612713471,0.409744830207442,0.403042505801392,0.396231915002329,0.389313568260189,0.382220870866176,0.3750457080453,0.367789805280088,0.360412648116943,0.352970021259336,0.345472702151974,0.337902553617375,0.330289252925561,0.322646846200007,0.314972323988092,0.307282620659989,0.299588360868811,0.291894644023726,0.284218373196358,0.276560573003801,0.26892791440864,0.261348875945522,0.25380942288498,0.246311939597434,0.238906633460259,0.231559823289543,0.224272651590395,0.217101269346922,0.210012974658456,0.203000597376581,0.19611744920332,0.189344611228538,0.182661461665087,0.176113704593134,0.169704127869832,0.163395493900408,0.157222094848814,0.151214518087706,0.145316687503506,0.139548627137778,0.133973038650724,0.128513678860714,0.123174342161713,0.118052504075493,0.113051239244301,0.108170748464163,0.103503103564732,0.0989722486908078,0.0945644373323544,0.0903546233194461,0.0863000315013777,0.0823691195201222,0.0786189484250374,0.0750409247730967,0.0715858480294263,0.0682927113521793,0.0651869450311057,0.0622022835713439,0.0593599496263401,0.0567184148587647,0.0541952757212188,0.0517946348331432,0.0496064129050594,0.0475332203175651,0.0455748122691548,0.0438149182675307,0.0421780685312028,0.0406521091370875,0.0393025352306227,0.0380868808816794,0.03697785295599,0.0360237074136805,0.0352128455249011,0.034504022103745,0.0339293615838494,0.0335057141184952,0.0331791784313083,0.0329669599114406,0.032911649354783,0.0329481141959803,0.0330799835756437,0.0333725237896389,0.033750975399349,0.0342149240130743,0.0348247569891112,0.0355219653281096,0.0362980540284246,0.0371978236678173,0.0381877761573159,0.0392491304087517,0.0404126053670661,0.041665933245323,0.0429821686723628,0.0443797881849895,0.0458632621617102,0.0474000146837426,0.0489985253107278,0.0506746989559435,0.0523933252676557,0.054155582572988,0.0559826570274991,0.0578401761691543,0.05972730168576,0.0616571378564448,0.0636064707752118,0.0655722390799825,0.0675567281013371,0.0695472719390482,0.0715402439550405,0.0735305642963638,0.0755091128780825,0.0774755650339556,0.0794212725286344,0.0813332660231287,0.0832185281145797,0.0850688096035054,0.0868598669283704,0.0886099235537995,0.090315051053707,0.0919327109429747,0.0934959848341262,0.0950040361473199,0.0964044706630829,0.0977336848702283,0.0989958680932156,0.100142029176245,0.101196031204604,0.102173161728404,0.10303159354464,0.103777019847113,0.10443813022448,0.104983248745097,0.105395913303758,0.105719542615345,0.105934635905498,0.10600054187191,0.105975622449468,0.105853489007502,0.105569386427853,0.105195659692428,0.104732495479535,0.104112281028684,0.103400206663057,0.102603058124606,0.10166966790964,0.100639826234939,0.0995319095064192,0.098310437660737,0.0969924607441409,0.0956056682531188,0.0941284847116692,0.0925595842276427,0.0909329118212423,0.0892381942792896,0.0874613806634923,0.0856390779195163,0.0837691443928913,0.0818312501902711,0.0798608105282003,0.0778586898734543,0.075809979404024,0.073740092461846,0.0716515274952025,0.0695399188652703,0.0674185037130016,0.0652909035532863,0.0631594916324714,0.0610319166339332,0.0589096794471216,0.0567983141345672,0.0547058893124197,0.0526289858434713,0.0505731501286169,0.0485519529634297,0.0465548564239365,0.0445848462917197,0.0426649145149171,0.0407759020201483,0.0389181996211283,0.0371212188112957,0.0353620427803762,0.0336390170455964,0.0319783425365085,0.0303642466784235,0.0287893862376131,0.0272751295484269,0.0258151648994898,0.0243958992850823,0.0230329287961383,0.0217305117795463,0.0204688280285173,0.0192573636156022,0.0181110106426288,0.0170042264886259,0.0159405454843738,0.0149447169905036,0.0139863440929984,0.0130652625080126,0.0122095355101697,0.0113901710175855,0.0106052370943992,0.00987576463566898,0.00918395788574547,0.00852328855852022,0.00790852861288404,0.00733158064509462,0.0067822552286302,0.00626998860171669,0.00579465411012348,0.00534338414643543,0.00492125787797452,0.00453433111682078,0.00416801080577014,0.00382397867860762,0.00351275571502464,0.00321888830972854,0.00294216929408905,0.00269416625186015,0.00246117041258166,0.00224238158882995,0.00204566626120114,0.00186307285946595,0.0016920717973324,0.00153769718615137,0.0013962513825373,0.00126412485707081,0.00114425717398871,0.00103594290582272,0.000935012077976891,0.00084291503764595,0.000760919634733202,0.000684690514374745],&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;grey&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;grey&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_dens&#34;,&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y4&#34;},&#34;wt_1.51\nHH: 0\nMH: 0.1\nM: 0.17\nML: 0.3\nLL: 0.45&#34;:{&#34;x0&#34;:1.513,&#34;y0&#34;:0,&#34;x1&#34;:1.513,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_1.51\nHH: 0\nMH: 0.1\nM: 0.17\nML: 0.3\nLL: 0.45&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_2.04\nHH: 0\nMH: 0.1\nM: 0.17\nML: 0.31\nLL: 0.42&#34;:{&#34;x0&#34;:2.04,&#34;y0&#34;:0,&#34;x1&#34;:2.04,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_2.04\nHH: 0\nMH: 0.1\nM: 0.17\nML: 0.31\nLL: 0.42&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_3.44\nHH: 0.19\nMH: 0.2\nM: 0.23\nML: 0.19\nLL: 0.13&#34;:{&#34;x0&#34;:3.44,&#34;y0&#34;:0,&#34;x1&#34;:3.44,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_3.44\nHH: 0.19\nMH: 0.2\nM: 0.23\nML: 0.19\nLL: 0.13&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_5.3\nHH: 0.41\nMH: 0.3\nM: 0.21\nML: 0.1\nLL: 0&#34;:{&#34;x0&#34;:5.3,&#34;y0&#34;:0,&#34;x1&#34;:5.3,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_5.3\nHH: 0.41\nMH: 0.3\nM: 0.21\nML: 0.1\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_5.42\nHH: 0.41\nMH: 0.3\nM: 0.21\nML: 0.1\nLL: 0&#34;:{&#34;x0&#34;:5.424,&#34;y0&#34;:0,&#34;x1&#34;:5.424,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_5.42\nHH: 0.41\nMH: 0.3\nM: 0.21\nML: 0.1\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;hp_dens&#34;:{&#34;x&#34;:[-32.1231343283582,-31.2400692233548,-30.3570041183515,-29.4739390133481,-28.5908739083448,-27.7078088033414,-26.8247436983381,-25.9416785933347,-25.0586134883313,-24.175548383328,-23.2924832783246,-22.4094181733213,-21.5263530683179,-20.6432879633145,-19.7602228583112,-18.8771577533078,-17.9940926483045,-17.1110275433011,-16.2279624382977,-15.3448973332944,-14.461832228291,-13.5787671232877,-12.6957020182843,-11.8126369132809,-10.9295718082776,-10.0465067032742,-9.16344159827087,-8.28037649326751,-7.39731138826415,-6.51424628326079,-5.63118117825744,-4.74811607325407,-3.86505096825072,-2.98198586324736,-2.098920758244,-1.21585565324064,-0.332790548237281,0.550274556766077,1.43333966176944,2.3164047667728,3.19946987177615,4.08253497677951,4.96560008178287,5.84866518678623,6.73173029178959,7.61479539679295,8.49786050179631,9.38092560679967,10.263990711803,11.1470558168064,12.0301209218097,12.9131860268131,13.7962511318165,14.6793162368198,15.5623813418232,16.4454464468265,17.3285115518299,18.2115766568333,19.0946417618366,19.97770686684,20.8607719718433,21.7438370768467,22.6269021818501,23.5099672868534,24.3930323918568,25.2760974968601,26.1591626018635,27.0422277068668,27.9252928118702,28.8083579168736,29.6914230218769,30.5744881268803,31.4575532318836,32.340618336887,33.2236834418904,34.1067485468937,34.9898136518971,35.8728787569004,36.7559438619038,37.6390089669072,38.5220740719105,39.4051391769139,40.2882042819172,41.1712693869206,42.054334491924,42.9373995969273,43.8204647019307,44.703529806934,45.5865949119374,46.4696600169408,47.3527251219441,48.2357902269475,49.1188553319508,50.0019204369542,50.8849855419575,51.7680506469609,52.6511157519643,53.5341808569676,54.417245961971,55.3003110669743,56.1833761719777,57.0664412769811,57.9495063819844,58.8325714869878,59.7156365919911,60.5987016969945,61.4817668019978,62.3648319070012,63.2478970120046,64.1309621170079,65.0140272220113,65.8970923270146,66.780157432018,67.6632225370214,68.5462876420247,69.4293527470281,70.3124178520314,71.1954829570348,72.0785480620382,72.9616131670415,73.8446782720449,74.7277433770482,75.6108084820516,76.4938735870549,77.3769386920583,78.2600037970617,79.143068902065,80.0261340070684,80.9091991120717,81.7922642170751,82.6753293220785,83.5583944270818,84.4414595320852,85.3245246370885,86.2075897420919,87.0906548470953,87.9737199520986,88.856785057102,89.7398501621053,90.6229152671087,91.505980372112,92.3890454771154,93.2721105821188,94.1551756871221,95.0382407921255,95.9213058971288,96.8043710021322,97.6874361071356,98.5705012121389,99.4535663171423,100.336631422146,101.219696527149,102.102761632152,102.985826737156,103.868891842159,104.751956947162,105.635022052166,106.518087157169,107.401152262173,108.284217367176,109.167282472179,110.050347577183,110.933412682186,111.816477787189,112.699542892193,113.582607997196,114.465673102199,115.348738207203,116.231803312206,117.114868417209,117.997933522213,118.880998627216,119.76406373222,120.647128837223,121.530193942226,122.41325904723,123.296324152233,124.179389257236,125.06245436224,125.945519467243,126.828584572246,127.71164967725,128.594714782253,129.477779887256,130.36084499226,131.243910097263,132.126975202267,133.01004030727,133.893105412273,134.776170517277,135.65923562228,136.542300727283,137.425365832287,138.30843093729,139.191496042293,140.074561147297,140.9576262523,141.840691357304,142.723756462307,143.60682156731,144.489886672314,145.372951777317,146.25601688232,147.139081987324,148.022147092327,148.90521219733,149.788277302334,150.671342407337,151.55440751234,152.437472617344,153.320537722347,154.203602827351,155.086667932354,155.969733037357,156.852798142361,157.735863247364,158.618928352367,159.501993457371,160.385058562374,161.268123667377,162.151188772381,163.034253877384,163.917318982387,164.800384087391,165.683449192394,166.566514297398,167.449579402401,168.332644507404,169.215709612408,170.098774717411,170.981839822414,171.864904927418,172.747970032421,173.631035137424,174.514100242428,175.397165347431,176.280230452435,177.163295557438,178.046360662441,178.929425767445,179.812490872448,180.695555977451,181.578621082455,182.461686187458,183.344751292461,184.227816397465,185.110881502468,185.993946607471,186.877011712475,187.760076817478,188.643141922482,189.526207027485,190.409272132488,191.292337237492,192.175402342495,193.058467447498,193.941532552502,194.824597657505,195.707662762508,196.590727867512,197.473792972515,198.356858077518,199.239923182522,200.122988287525,201.006053392529,201.889118497532,202.772183602535,203.655248707539,204.538313812542,205.421378917545,206.304444022549,207.187509127552,208.070574232555,208.953639337559,209.836704442562,210.719769547566,211.602834652569,212.485899757572,213.368964862576,214.252029967579,215.135095072582,216.018160177586,216.901225282589,217.784290387592,218.667355492596,219.550420597599,220.433485702602,221.316550807606,222.199615912609,223.082681017613,223.965746122616,224.848811227619,225.731876332623,226.614941437626,227.498006542629,228.381071647633,229.264136752636,230.147201857639,231.030266962643,231.913332067646,232.79639717265,233.679462277653,234.562527382656,235.44559248766,236.328657592663,237.211722697666,238.09478780267,238.977852907673,239.860918012676,240.74398311768,241.627048222683,242.510113327686,243.39317843269,244.276243537693,245.159308642696,246.0423737477,246.925438852703,247.808503957707,248.69156906271,249.574634167713,250.457699272717,251.34076437772,252.223829482723,253.106894587727,253.98995969273,254.873024797733,255.756089902737,256.63915500774,257.522220112744,258.405285217747,259.28835032275,260.171415427754,261.054480532757,261.93754563776,262.820610742764,263.703675847767,264.58674095277,265.469806057774,266.352871162777,267.23593626778,268.119001372784,269.002066477787,269.885131582791,270.768196687794,271.651261792797,272.534326897801,273.417392002804,274.300457107807,275.183522212811,276.066587317814,276.949652422817,277.832717527821,278.715782632824,279.598847737827,280.481912842831,281.364977947834,282.248043052838,283.131108157841,284.014173262844,284.897238367848,285.780303472851,286.663368577854,287.546433682858,288.429498787861,289.312563892864,290.195628997868,291.078694102871,291.961759207875,292.844824312878,293.727889417881,294.610954522885,295.494019627888,296.377084732891,297.260149837895,298.143214942898,299.026280047901,299.909345152905,300.792410257908,301.675475362911,302.558540467915,303.441605572918,304.324670677922,305.207735782925,306.090800887928,306.973865992932,307.856931097935,308.739996202938,309.623061307942,310.506126412945,311.389191517948,312.272256622952,313.155321727955,314.038386832959,314.921451937962,315.804517042965,316.687582147969,317.570647252972,318.453712357975,319.336777462979,320.219842567982,321.102907672985,321.985972777989,322.869037882992,323.752102987995,324.635168092999,325.518233198002,326.401298303006,327.284363408009,328.167428513012,329.050493618016,329.933558723019,330.816623828022,331.699688933026,332.582754038029,333.465819143032,334.348884248036,335.231949353039,336.115014458042,336.998079563046,337.881144668049,338.764209773053,339.647274878056,340.530339983059,341.413405088063,342.296470193066,343.179535298069,344.062600403073,344.945665508076,345.828730613079,346.711795718083,347.594860823086,348.47792592809,349.360991033093,350.244056138096,351.1271212431,352.010186348103,352.893251453106,353.77631655811,354.659381663113,355.542446768116,356.42551187312,357.308576978123,358.191642083126,359.07470718813,359.957772293133,360.840837398137,361.72390250314,362.606967608143,363.490032713147,364.37309781815,365.256162923153,366.139228028157,367.02229313316,367.905358238163,368.788423343167,369.67148844817,370.554553553173,371.437618658177,372.32068376318,373.203748868184,374.086813973187,374.96987907819,375.852944183194,376.736009288197,377.6190743932,378.502139498204,379.385204603207,380.26826970821,381.151334813214,382.034399918217,382.917465023221,383.800530128224,384.683595233227,385.566660338231,386.449725443234,387.332790548237,388.215855653241,389.098920758244,389.981985863247,390.865050968251,391.748116073254,392.631181178257,393.514246283261,394.397311388264,395.280376493268,396.163441598271,397.046506703274,397.929571808278,398.812636913281,399.695702018284,400.578767123288,401.461832228291,402.344897333294,403.227962438298,404.111027543301,404.994092648305,405.877157753308,406.760222858311,407.643287963315,408.526353068318,409.409418173321,410.292483278325,411.175548383328,412.058613488331,412.941678593335,413.824743698338,414.707808803341,415.590873908345,416.473939013348,417.357004118351,418.240069223355,419.123134328358],&#34;y&#34;:[9.79687808200003e-06,1.08499016101529e-05,1.19779171263786e-05,1.32219932972071e-05,1.46019617858553e-05,1.60769051980817e-05,1.76971699192788e-05,1.94893290064822e-05,2.14005366306973e-05,2.34918412957622e-05,2.5798345961556e-05,2.8252528597658e-05,3.09275990192816e-05,3.38692881353148e-05,3.69922513185915e-05,4.03833015239013e-05,4.41012077795573e-05,4.80392705874274e-05,5.22992666626073e-05,5.69557102168076e-05,6.18766665515483e-05,6.71800814575673e-05,7.29591807032274e-05,7.90526339286086e-05,8.55955242604432e-05,9.27029507060532e-05,0.000100179848819942,0.000108179084702458,0.000116840894128701,0.000125932101211093,0.000135623593658238,0.000146083985034161,0.000157037748013298,0.000168673546334814,0.000181191435411558,0.000194269644924321,0.000208113821433097,0.000222958168294295,0.000238431369048386,0.000254754669372437,0.000272198567827574,0.000290339746278264,0.000309413059328003,0.000329726678393146,0.000350803940730107,0.000372890729241268,0.000396333288579244,0.000420601634984182,0.000445949560029474,0.000472760615676973,0.000500453110652069,0.000529285174284202,0.000559675580144488,0.000590994304942156,0.00062349991551907,0.000657642900663671,0.000692750143021876,0.000729076568398171,0.000767099420568324,0.00080610959952254,0.000846354305009199,0.000888331167877948,0.000931303998790806,0.000975508361719241,0.00102145463033025,0.00106839000098817,0.00111653484642682,0.00116640357761233,0.00121723852708464,0.00126924183781098,0.00132292248016239,0.00137753054912589,0.00143324756976802,0.00149056716547411,0.00154876022574288,0.0016079860133102,0.00166871284148644,0.0017302453244062,0.00179271960726153,0.00185656903958986,0.0019211442831529,0.00198655829405207,0.00205320043677222,0.0021204786786494,0.00218848344396532,0.0022575519659442,0.00232715934479666,0.00239737476182453,0.00246847617729613,0.00254001398809132,0.00261203792480487,0.00268476053006226,0.00275781392835013,0.00283123055122525,0.00290515222121249,0.0029792975990053,0.00305368418504112,0.0031283783259031,0.00320318869337232,0.00327812031524213,0.00335315944156688,0.00342820734101443,0.00350325902370583,0.00357821567435848,0.00365307341338634,0.00372781963207195,0.00380226463704252,0.00387650193527363,0.00395051363452645,0.00402401207015758,0.00409719153969708,0.00417003117403864,0.00424213666290484,0.00431380785365835,0.00438502324548126,0.00445527153523058,0.00452496453745405,0.00459408258682764,0.00466198554596969,0.00472920532157653,0.00479572675282864,0.00486076802243243,0.00492499070730694,0.00498838707597539,0.00505002059489619,0.00511069295991653,0.00517040334738558,0.00522805952649147,0.00528460260028958,0.00534003541994984,0.00539313125355562,0.00544494880364739,0.00549550497632919,0.00554344283196756,0.00558993499432882,0.00563501591643835,0.00567720769739827,0.0057177895709357,0.00575681690188356,0.00579270569964288,0.00582683022301048,0.00585926971669587,0.00588835489291618,0.00591553884307006,0.00594092694777925,0.00596279119416854,0.0059826427352715,0.00600061429863184,0.00601495089450925,0.00602719680394936,0.00603751195045029,0.0060441502408575,0.0060486607789368,0.00605122890688353,0.00605015598194902,0.0060469653736006,0.00604186426305634,0.00603324094172419,0.00602256160835661,0.00601004984371545,0.00599421934690422,0.00597644835500058,0.00595696963234803,0.00593445775289985,0.00591017440998003,0.00588435279361759,0.00585585890148174,0.00582581299422336,0.00579443877077885,0.00576081759088187,0.00572590838081043,0.00568991478780297,0.00565214950862876,0.00561339622959676,0.00557382795940261,0.00553299582477907,0.00549150101510485,0.00544947596719205,0.00540670802730479,0.00536361553358976,0.00532028176487386,0.00527671887670517,0.00523316874919709,0.00518965891998158,0.00514640636310399,0.00510348909742846,0.00506087490492753,0.00501895809792148,0.00497767075025527,0.00493691987149359,0.00489724363120026,0.00485845024098408,0.00482038817251986,0.0047837017585785,0.00474810026388881,0.00471337915939137,0.00468024900632521,0.00464834645164365,0.00461742264186742,0.00458821422544451,0.00456031156774863,0.00453343293066565,0.00450830267600873,0.00448448992681644,0.00446169369372421,0.00444059124544131,0.00442075308108812,0.00440187405533217,0.00438455463222955,0.00436838600062241,0.00435307456743582,0.00433912055296418,0.00432615123936318,0.00431389999458945,0.00430275040314898,0.00429237702378942,0.0042825543783791,0.00427354041653365,0.00426506391555814,0.00425695266859743,0.00424933730267583,0.00424200375673593,0.00423484239234143,0.00422786165620581,0.00422090405636099,0.00421392842109972,0.00420683215840358,0.00419951084631453,0.00419199390737863,0.00418408374133526,0.00417572332320555,0.00416701088812802,0.00415767344010531,0.00414769427575147,0.00413723485824349,0.00412596857781388,0.004113911324062,0.00410127874612067,0.00408771314588398,0.00407325529683337,0.00405816309674212,0.00404206967607605,0.00402503355616966,0.00400734079293165,0.00398863545292546,0.00396898764779045,0.00394869622007615,0.00392743348302102,0.00390527620273809,0.00388252029991117,0.00385888011772439,0.00383443544465378,0.00380946418688896,0.00378373252418321,0.0037573208743367,0.0037304755513921,0.00370302023679075,0.00367503463824815,0.00364672220233554,0.00361796573981621,0.00358884369028748,0.003559508286406,0.00352989939924513,0.00350009410303498,0.00347018842790519,0.00344017407239337,0.00341012677921175,0.00338008495426087,0.00335008439834303,0.00332019938531918,0.0032904128246132,0.00326079515471126,0.00323141862801866,0.0032022160994284,0.00317328221900555,0.00314468608677897,0.00311631882892708,0.00308828867009858,0.00306065978028147,0.00303329217562533,0.00300629748643484,0.00297973255832207,0.00295343850021728,0.00292752121991004,0.00290202735084002,0.00287679210315529,0.00285190801759298,0.0028274083370815,0.00280313538829475,0.00277916248480108,0.00275550627301554,0.00273202844693663,0.00270877917431494,0.00268575557023437,0.00266284948120425,0.00264008597294099,0.00261744027436354,0.00259484310913937,0.0025722943472445,0.00254974584944774,0.00252717341928582,0.00250455329968352,0.00248181362722983,0.00245897865621778,0.00243600395740772,0.00241279490632013,0.00238942459714921,0.00236583194283586,0.00234190195802631,0.00231775399364488,0.00229331502654834,0.00226845358074284,0.00224332986834957,0.00221786400530133,0.00219191330934521,0.00216567094061096,0.00213905524735795,0.00211191889676121,0.00208447797429014,0.00205665387202551,0.00202830221097642,0.00199965036620224,0.00197062705172858,0.00194109920493989,0.00191129279865307,0.00188114741868688,0.0018505500962244,0.00181971224302823,0.00178858700441915,0.00175709031957122,0.00172540600665284,0.00169350252372267,0.00166133317507306,0.00162904185023137,0.00159661312508453,0.00156404537889241,0.00153143146081773,0.0014987719608732,0.0014661169277746,0.00143349874262698,0.00140093308170255,0.00136852681314759,0.00133624448637682,0.00130411523262258,0.00127230616909656,0.00124070900221688,0.0012093641303341,0.00117850041805106,0.00114793425971598,0.00111771473936465,0.00108813189830555,0.00105892698120457,0.00103015495203936,0.00100216432993698,0.000974623993820047,0.000947591924217993,0.000921470312505527,0.000895860973146585,0.000870822138378165,0.00084680286116761,0.000823345519150435,0.000800506069124938,0.000778771788430058,0.000757635303576639,0.000737148123394931,0.000717825535822805,0.000699121825438341,0.000681082326074135,0.000664238860007342,0.000648020113596993,0.000632464026537626,0.000618106585505223,0.000604364526115151,0.000591267715384892,0.000579343453232738,0.000568010616289763,0.00055729086400316,0.000547689920466297,0.000538642864699629,0.000530163531839688,0.000522723602808788,0.000515787914153286,0.000509363326274108,0.000503875891146903,0.00049883278924453,0.000494235147145259,0.000490453126269509,0.000487047434559259,0.000484017665152496,0.00048166157214175,0.000479610767476372,0.000477862149611602,0.000476635299266464,0.000475639317177637,0.000474868663200252,0.000474465977761868,0.000474217417252387,0.000474116803718427,0.000474233493227598,0.000474427843102093,0.000474694792211258,0.000475036245718232,0.000475381745901222,0.000475728943829093,0.00047601998172377,0.000476246740386285,0.000476410917513629,0.000476404048174469,0.000476272060683338,0.000476021688626576,0.000475504050712428,0.000474809810160231,0.000473951318966293,0.000472750046612482,0.00047133149725295,0.000469713782002425,0.000467699602074393,0.000465439264042791,0.000462956330656678,0.000460045285647853,0.000456871467989388,0.000453463158979802,0.000449616441326831,0.000445502555364321,0.000441153392093873,0.000436375369821376,0.000431337450134642,0.000426073722559581,0.000420408325950373,0.000414500955224666,0.000408386276596239,0.00040191199478706,0.0003952229052873,0.000388352521799463,0.000381176321289984,0.000373820004374724,0.000366314203220831,0.000358564722952029,0.00035067541490184,0.000342672405106483,0.000334492802364367,0.00032621722769765,0.000317865874752032,0.000309406691935343,0.000300896934137027,0.000292349712220037,0.000283762107670874,0.000275168943649171,0.0002665754303265,0.000258005069941345,0.000249472052083462,0.000240973233771143,0.000232555078414792,0.000224213581716396,0.000215937169032352,0.000207791321274187,0.000199756698391055,0.000191813574654313,0.000184042272872697,0.000176411183077317,0.00016889303262632,0.000161578806796962,0.000154427711417928,0.000147405802656372,0.00014061073924322,0.000133995491140457,0.000127520526940213,0.000121286534305694,0.000115242936058129,0.00010934583478723,0.000103695758206613,9.82409253553688e-05,9.29343613804089e-05,8.78737694576559e-05,8.30081123131835e-05,7.82886259432095e-05,7.38080779959933e-05,6.95177077826524e-05,6.53681905547252e-05,6.14457961813185e-05,5.77051671081765e-05,5.40975372593573e-05,5.07016327007441e-05,4.74762485032507e-05,4.43741508486817e-05,4.14659391754651e-05,3.8714977832981e-05,3.60763690551319e-05,3.36123996100005e-05,3.1291140181757e-05,2.90706516035676e-05,2.70050455028729e-05,2.50670133245404e-05,2.32180156424582e-05,2.15043757469161e-05,1.99031539313542e-05,1.83794795831441e-05,1.69724529143201e-05,1.56631370668369e-05,1.44204439184336e-05,1.32769303280645e-05,1.22172280953771e-05,1.12140115902366e-05,1.02940335023496e-05,9.44503013055652e-06,8.64330921532224e-06,7.91057296389606e-06,7.23719813109566e-06,6.60291297634657e-06,6.02510267371112e-06,5.49634266454592e-06,4.99950972405931e-06],&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;grey&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;grey&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_dens&#34;,&#34;xaxis&#34;:&#34;x5&#34;,&#34;yaxis&#34;:&#34;y5&#34;},&#34;hp_52\nHH: 0.07\nMH: 0.07\nM: 0.19\nML: 0.28\nLL: 0.45&#34;:{&#34;x0&#34;:52,&#34;y0&#34;:0,&#34;x1&#34;:52,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_52\nHH: 0.07\nMH: 0.07\nM: 0.19\nML: 0.28\nLL: 0.45&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;},&#34;hp_78.5\nHH: 0.07\nMH: 0.07\nM: 0.19\nML: 0.29\nLL: 0.42&#34;:{&#34;x0&#34;:78.5,&#34;y0&#34;:0,&#34;x1&#34;:78.5,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_78.5\nHH: 0.07\nMH: 0.07\nM: 0.19\nML: 0.29\nLL: 0.42&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;},&#34;hp_150\nHH: 0.26\nMH: 0.25\nM: 0.21\nML: 0.14\nLL: 0.13&#34;:{&#34;x0&#34;:150,&#34;y0&#34;:0,&#34;x1&#34;:150,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_150\nHH: 0.26\nMH: 0.25\nM: 0.21\nML: 0.14\nLL: 0.13&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;},&#34;hp_245\nHH: 0.3\nMH: 0.3\nM: 0.21\nML: 0.14\nLL: 0&#34;:{&#34;x0&#34;:245,&#34;y0&#34;:0,&#34;x1&#34;:245,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_245\nHH: 0.3\nMH: 0.3\nM: 0.21\nML: 0.14\nLL: 0&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;},&#34;hp_335\nHH: 0.3\nMH: 0.3\nM: 0.21\nML: 0.14\nLL: 0&#34;:{&#34;x0&#34;:335,&#34;y0&#34;:0,&#34;x1&#34;:335,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_335\nHH: 0.3\nMH: 0.3\nM: 0.21\nML: 0.14\nLL: 0&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;},&#34;rug_pred&#34;:{&#34;type&#34;:&#34;bar&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:null,&#34;y&#34;:null,&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y11&#34;,&#34;name&#34;:&#34;rug_pred&#34;,&#34;showlegend&#34;:false},&#34;rug_cyl&#34;:{&#34;type&#34;:&#34;bar&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:null,&#34;y&#34;:null,&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y12&#34;,&#34;name&#34;:&#34;rug_cyl&#34;,&#34;showlegend&#34;:false},&#34;rug_mpg&#34;:{&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:[21,21,22.8,21.4,18.7,18.1,14.3,24.4,22.8,19.2,17.8,16.4,17.3,15.2,10.4,10.4,14.7,32.4,30.4,33.9,21.5,15.5,15.2,13.3,19.2,27.3,26,30.4,15.8,19.7,15,21.4],&#34;y&#34;:[&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;],&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y13&#34;,&#34;name&#34;:&#34;rug_mpg&#34;,&#34;showlegend&#34;:false},&#34;rug_wt&#34;:{&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:[2.62,2.875,2.32,3.215,3.44,3.46,3.57,3.19,3.15,3.44,3.44,4.07,3.73,3.78,5.25,5.424,5.345,2.2,1.615,1.835,2.465,3.52,3.435,3.84,3.845,1.935,2.14,1.513,3.17,2.77,3.57,2.78],&#34;y&#34;:[&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;],&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y14&#34;,&#34;name&#34;:&#34;rug_wt&#34;,&#34;showlegend&#34;:false},&#34;rug_hp&#34;:{&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:[110,110,93,110,175,105,245,62,95,123,123,180,180,180,205,215,230,66,52,65,97,150,150,245,175,66,91,113,264,175,335,109],&#34;y&#34;:[&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;],&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x5&#34;,&#34;yaxis&#34;:&#34;y15&#34;,&#34;name&#34;:&#34;rug_hp&#34;,&#34;showlegend&#34;:false},&#34;imp_am&#34;:{&#34;y&#34;:[&#34;am&#34;],&#34;x&#34;:[0.00715488166084253],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;pdp&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_carb&#34;:{&#34;y&#34;:[&#34;carb&#34;],&#34;x&#34;:[0.0150810412041427],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;pdp&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_vs&#34;:{&#34;y&#34;:[&#34;vs&#34;],&#34;x&#34;:[0.0331936494702018],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;pdp&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_qsec&#34;:{&#34;y&#34;:[&#34;qsec&#34;],&#34;x&#34;:[0.0391609538973388],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;pdp&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_gear&#34;:{&#34;y&#34;:[&#34;gear&#34;],&#34;x&#34;:[0.0531474707080981],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;pdp&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_drat&#34;:{&#34;y&#34;:[&#34;drat&#34;],&#34;x&#34;:[0.116007168594247],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;pdp&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_hp&#34;:{&#34;y&#34;:[&#34;hp&#34;],&#34;x&#34;:[0.152692785822779],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;darkgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;alluvial&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_wt&#34;:{&#34;y&#34;:[&#34;wt&#34;],&#34;x&#34;:[0.162624630971077],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;darkgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;alluvial&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_mpg&#34;:{&#34;y&#34;:[&#34;mpg&#34;],&#34;x&#34;:[0.177578602545468],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;darkgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;alluvial&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_cyl&#34;:{&#34;y&#34;:[&#34;cyl&#34;],&#34;x&#34;:[0.243358815125805],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;darkgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;alluvial&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_total\nalluvial&#34;:{&#34;y&#34;:[&#34;total\nalluvial&#34;],&#34;x&#34;:[0.73625483446513],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;darkgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;alluvial&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;}},&#34;layout&#34;:{&#34;xaxis1&#34;:{&#34;domain&#34;:[0,0.1575],&#34;anchor&#34;:&#34;y11&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis2&#34;:{&#34;domain&#34;:[0.1825,0.3275],&#34;anchor&#34;:&#34;y12&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis3&#34;:{&#34;domain&#34;:[0.3525,0.4975],&#34;anchor&#34;:&#34;y13&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis4&#34;:{&#34;domain&#34;:[0.5225,0.6675],&#34;anchor&#34;:&#34;y14&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis5&#34;:{&#34;domain&#34;:[0.6925,0.85],&#34;anchor&#34;:&#34;y15&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis1&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis2&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis3&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis4&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis5&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis11&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x1&#34;},&#34;yaxis12&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x2&#34;},&#34;yaxis13&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x3&#34;},&#34;yaxis14&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x4&#34;},&#34;yaxis15&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x5&#34;},&#34;yaxis99&#34;:{&#34;domain&#34;:[0,1],&#34;anchor&#34;:&#34;y99&#34;,&#34;showticklabels&#34;:false},&#34;xaxis99&#34;:{&#34;domain&#34;:[0.9,1],&#34;anchor&#34;:&#34;x99&#34;,&#34;showticklabels&#34;:false},&#34;annotations&#34;:[{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.73625483446513,&#34;y&#34;:&#34;am&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;am&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.73625483446513,&#34;y&#34;:&#34;carb&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;carb&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.73625483446513,&#34;y&#34;:&#34;vs&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;vs&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.73625483446513,&#34;y&#34;:&#34;qsec&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;qsec&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.73625483446513,&#34;y&#34;:&#34;gear&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;gear&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.73625483446513,&#34;y&#34;:&#34;drat&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;drat&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.73625483446513,&#34;y&#34;:&#34;hp&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;hp&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.73625483446513,&#34;y&#34;:&#34;wt&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;wt&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.73625483446513,&#34;y&#34;:&#34;mpg&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;mpg&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.73625483446513,&#34;y&#34;:&#34;cyl&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;cyl&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.73625483446513,&#34;y&#34;:&#34;total\nalluvial&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;total\nalluvial&#34;,&#34;align&#34;:&#34;right&#34;}]},&#34;shapes&#34;:{&#34;mpg_10.4\nHH: 0.48\nMH: 0.28\nM: 0.23\nML: 0.08\nLL: 0&#34;:{&#34;x0&#34;:10.4,&#34;y0&#34;:0,&#34;x1&#34;:10.4,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_10.4\nHH: 0.48\nMH: 0.28\nM: 0.23\nML: 0.08\nLL: 0&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_14.7\nHH: 0.3\nMH: 0.31\nM: 0.21\nML: 0.12\nLL: 0&#34;:{&#34;x0&#34;:14.7,&#34;y0&#34;:0,&#34;x1&#34;:14.7,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_14.7\nHH: 0.3\nMH: 0.31\nM: 0.21\nML: 0.12\nLL: 0&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_19.4\nHH: 0.22\nMH: 0.19\nM: 0.19\nML: 0.22\nLL: 0.23&#34;:{&#34;x0&#34;:19.45,&#34;y0&#34;:0,&#34;x1&#34;:19.45,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_19.4\nHH: 0.22\nMH: 0.19\nM: 0.19\nML: 0.22\nLL: 0.23&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_30.4\nHH: 0\nMH: 0.11\nM: 0.19\nML: 0.29\nLL: 0.39&#34;:{&#34;x0&#34;:30.4,&#34;y0&#34;:0,&#34;x1&#34;:30.4,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_30.4\nHH: 0\nMH: 0.11\nM: 0.19\nML: 0.29\nLL: 0.39&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_33.9\nHH: 0\nMH: 0.11\nM: 0.19\nML: 0.29\nLL: 0.39&#34;:{&#34;x0&#34;:33.9,&#34;y0&#34;:0,&#34;x1&#34;:33.9,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_33.9\nHH: 0\nMH: 0.11\nM: 0.19\nML: 0.29\nLL: 0.39&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;wt_1.51\nHH: 0\nMH: 0.1\nM: 0.17\nML: 0.3\nLL: 0.45&#34;:{&#34;x0&#34;:1.513,&#34;y0&#34;:0,&#34;x1&#34;:1.513,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_1.51\nHH: 0\nMH: 0.1\nM: 0.17\nML: 0.3\nLL: 0.45&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_2.04\nHH: 0\nMH: 0.1\nM: 0.17\nML: 0.31\nLL: 0.42&#34;:{&#34;x0&#34;:2.04,&#34;y0&#34;:0,&#34;x1&#34;:2.04,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_2.04\nHH: 0\nMH: 0.1\nM: 0.17\nML: 0.31\nLL: 0.42&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_3.44\nHH: 0.19\nMH: 0.2\nM: 0.23\nML: 0.19\nLL: 0.13&#34;:{&#34;x0&#34;:3.44,&#34;y0&#34;:0,&#34;x1&#34;:3.44,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_3.44\nHH: 0.19\nMH: 0.2\nM: 0.23\nML: 0.19\nLL: 0.13&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_5.3\nHH: 0.41\nMH: 0.3\nM: 0.21\nML: 0.1\nLL: 0&#34;:{&#34;x0&#34;:5.3,&#34;y0&#34;:0,&#34;x1&#34;:5.3,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_5.3\nHH: 0.41\nMH: 0.3\nM: 0.21\nML: 0.1\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_5.42\nHH: 0.41\nMH: 0.3\nM: 0.21\nML: 0.1\nLL: 0&#34;:{&#34;x0&#34;:5.424,&#34;y0&#34;:0,&#34;x1&#34;:5.424,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_5.42\nHH: 0.41\nMH: 0.3\nM: 0.21\nML: 0.1\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;hp_52\nHH: 0.07\nMH: 0.07\nM: 0.19\nML: 0.28\nLL: 0.45&#34;:{&#34;x0&#34;:52,&#34;y0&#34;:0,&#34;x1&#34;:52,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_52\nHH: 0.07\nMH: 0.07\nM: 0.19\nML: 0.28\nLL: 0.45&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;},&#34;hp_78.5\nHH: 0.07\nMH: 0.07\nM: 0.19\nML: 0.29\nLL: 0.42&#34;:{&#34;x0&#34;:78.5,&#34;y0&#34;:0,&#34;x1&#34;:78.5,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_78.5\nHH: 0.07\nMH: 0.07\nM: 0.19\nML: 0.29\nLL: 0.42&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;},&#34;hp_150\nHH: 0.26\nMH: 0.25\nM: 0.21\nML: 0.14\nLL: 0.13&#34;:{&#34;x0&#34;:150,&#34;y0&#34;:0,&#34;x1&#34;:150,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_150\nHH: 0.26\nMH: 0.25\nM: 0.21\nML: 0.14\nLL: 0.13&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;},&#34;hp_245\nHH: 0.3\nMH: 0.3\nM: 0.21\nML: 0.14\nLL: 0&#34;:{&#34;x0&#34;:245,&#34;y0&#34;:0,&#34;x1&#34;:245,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_245\nHH: 0.3\nMH: 0.3\nM: 0.21\nML: 0.14\nLL: 0&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;},&#34;hp_335\nHH: 0.3\nMH: 0.3\nM: 0.21\nML: 0.14\nLL: 0&#34;:{&#34;x0&#34;:335,&#34;y0&#34;:0,&#34;x1&#34;:335,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_335\nHH: 0.3\nMH: 0.3\nM: 0.21\nML: 0.14\nLL: 0&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;}},&#34;shapes_original&#34;:{&#34;mpg_10.4\nHH: 0.48\nMH: 0.28\nM: 0.23\nML: 0.08\nLL: 0&#34;:{&#34;x0&#34;:10.4,&#34;y0&#34;:0,&#34;x1&#34;:10.4,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_10.4\nHH: 0.48\nMH: 0.28\nM: 0.23\nML: 0.08\nLL: 0&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_14.7\nHH: 0.3\nMH: 0.31\nM: 0.21\nML: 0.12\nLL: 0&#34;:{&#34;x0&#34;:14.7,&#34;y0&#34;:0,&#34;x1&#34;:14.7,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_14.7\nHH: 0.3\nMH: 0.31\nM: 0.21\nML: 0.12\nLL: 0&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_19.4\nHH: 0.22\nMH: 0.19\nM: 0.19\nML: 0.22\nLL: 0.23&#34;:{&#34;x0&#34;:19.45,&#34;y0&#34;:0,&#34;x1&#34;:19.45,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_19.4\nHH: 0.22\nMH: 0.19\nM: 0.19\nML: 0.22\nLL: 0.23&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_30.4\nHH: 0\nMH: 0.11\nM: 0.19\nML: 0.29\nLL: 0.39&#34;:{&#34;x0&#34;:30.4,&#34;y0&#34;:0,&#34;x1&#34;:30.4,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_30.4\nHH: 0\nMH: 0.11\nM: 0.19\nML: 0.29\nLL: 0.39&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_33.9\nHH: 0\nMH: 0.11\nM: 0.19\nML: 0.29\nLL: 0.39&#34;:{&#34;x0&#34;:33.9,&#34;y0&#34;:0,&#34;x1&#34;:33.9,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_33.9\nHH: 0\nMH: 0.11\nM: 0.19\nML: 0.29\nLL: 0.39&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;wt_1.51\nHH: 0\nMH: 0.1\nM: 0.17\nML: 0.3\nLL: 0.45&#34;:{&#34;x0&#34;:1.513,&#34;y0&#34;:0,&#34;x1&#34;:1.513,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_1.51\nHH: 0\nMH: 0.1\nM: 0.17\nML: 0.3\nLL: 0.45&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_2.04\nHH: 0\nMH: 0.1\nM: 0.17\nML: 0.31\nLL: 0.42&#34;:{&#34;x0&#34;:2.04,&#34;y0&#34;:0,&#34;x1&#34;:2.04,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_2.04\nHH: 0\nMH: 0.1\nM: 0.17\nML: 0.31\nLL: 0.42&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_3.44\nHH: 0.19\nMH: 0.2\nM: 0.23\nML: 0.19\nLL: 0.13&#34;:{&#34;x0&#34;:3.44,&#34;y0&#34;:0,&#34;x1&#34;:3.44,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_3.44\nHH: 0.19\nMH: 0.2\nM: 0.23\nML: 0.19\nLL: 0.13&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_5.3\nHH: 0.41\nMH: 0.3\nM: 0.21\nML: 0.1\nLL: 0&#34;:{&#34;x0&#34;:5.3,&#34;y0&#34;:0,&#34;x1&#34;:5.3,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_5.3\nHH: 0.41\nMH: 0.3\nM: 0.21\nML: 0.1\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_5.42\nHH: 0.41\nMH: 0.3\nM: 0.21\nML: 0.1\nLL: 0&#34;:{&#34;x0&#34;:5.424,&#34;y0&#34;:0,&#34;x1&#34;:5.424,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_5.42\nHH: 0.41\nMH: 0.3\nM: 0.21\nML: 0.1\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;hp_52\nHH: 0.07\nMH: 0.07\nM: 0.19\nML: 0.28\nLL: 0.45&#34;:{&#34;x0&#34;:52,&#34;y0&#34;:0,&#34;x1&#34;:52,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_52\nHH: 0.07\nMH: 0.07\nM: 0.19\nML: 0.28\nLL: 0.45&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;},&#34;hp_78.5\nHH: 0.07\nMH: 0.07\nM: 0.19\nML: 0.29\nLL: 0.42&#34;:{&#34;x0&#34;:78.5,&#34;y0&#34;:0,&#34;x1&#34;:78.5,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_78.5\nHH: 0.07\nMH: 0.07\nM: 0.19\nML: 0.29\nLL: 0.42&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;},&#34;hp_150\nHH: 0.26\nMH: 0.25\nM: 0.21\nML: 0.14\nLL: 0.13&#34;:{&#34;x0&#34;:150,&#34;y0&#34;:0,&#34;x1&#34;:150,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_150\nHH: 0.26\nMH: 0.25\nM: 0.21\nML: 0.14\nLL: 0.13&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;},&#34;hp_245\nHH: 0.3\nMH: 0.3\nM: 0.21\nML: 0.14\nLL: 0&#34;:{&#34;x0&#34;:245,&#34;y0&#34;:0,&#34;x1&#34;:245,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_245\nHH: 0.3\nMH: 0.3\nM: 0.21\nML: 0.14\nLL: 0&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;},&#34;hp_335\nHH: 0.3\nMH: 0.3\nM: 0.21\nML: 0.14\nLL: 0&#34;:{&#34;x0&#34;:335,&#34;y0&#34;:0,&#34;x1&#34;:335,&#34;y1&#34;:0.00605122890688353,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;hp_335\nHH: 0.3\nMH: 0.3\nM: 0.21\nML: 0.14\nLL: 0&#34;,&#34;xref&#34;:&#34;x5&#34;,&#34;yref&#34;:&#34;y5&#34;}},&#34;map_curve&#34;:[[5,8,10,18,24],[5,8,10,18,25],[5,8,10,18,26],[5,8,10,19,24],[5,8,10,19,25],[5,8,10,19,26],[5,8,10,19,22],[5,8,10,19,23],[5,8,10,20,24],[5,8,10,20,25],[5,8,10,20,26],[5,8,10,20,22],[5,8,10,20,23],[5,8,11,18,25],[5,8,11,18,26],[5,8,11,19,24],[5,8,11,19,25],[5,8,11,19,26],[5,8,11,20,24],[5,8,11,20,25],[5,8,11,20,26],[5,8,12,19,24],[5,8,12,19,25],[5,8,12,19,26],[5,8,12,20,24],[5,8,12,20,25],[5,8,12,20,26],[1,6,12,16,22],[1,6,12,16,23],[1,6,12,17,22],[1,6,12,17,23],[1,6,13,16,24],[1,6,13,16,22],[1,6,13,16,23],[1,6,13,17,24],[1,6,13,17,22],[1,6,13,17,23],[1,6,13,18,22],[1,6,13,18,23],[1,6,14,16,24],[1,6,14,16,22],[1,6,14,16,23],[1,6,14,17,24],[1,6,14,17,22],[1,6,14,17,23],[1,6,14,18,22],[1,6,14,18,23],[1,7,12,16,22],[1,7,12,16,23],[1,7,12,17,22],[1,7,13,16,22],[1,7,13,16,23],[1,7,13,17,22],[1,7,13,17,23],[1,7,14,16,22],[1,7,14,16,23],[1,7,14,17,22],[1,7,14,17,23],[3,6,10,16,24],[3,6,10,16,25],[3,6,10,16,26],[3,6,10,17,24],[3,6,10,17,25],[3,6,10,17,26],[3,6,10,18,24],[3,6,10,18,25],[3,6,10,18,26],[3,6,10,18,22],[3,6,10,18,23],[3,6,10,19,22],[3,6,10,19,23],[3,6,10,20,22],[3,6,10,20,23],[3,6,11,16,25],[3,6,11,16,26],[3,6,11,17,25],[3,6,11,17,26],[3,6,11,18,24],[3,6,11,18,25],[3,6,11,18,26],[3,6,11,19,22],[3,6,11,19,23],[3,6,11,20,22],[3,6,11,20,23],[3,6,12,18,24],[3,6,12,18,25],[3,6,12,18,26],[3,6,12,19,24],[3,6,12,19,25],[3,6,12,19,26],[3,6,12,20,24],[3,6,12,20,25],[3,6,12,20,26],[3,6,13,19,24],[3,6,13,19,25],[3,6,13,19,26],[3,6,13,20,24],[3,6,13,20,25],[3,6,13,20,26],[3,6,14,19,24],[3,6,14,19,25],[3,6,14,19,26],[3,6,14,20,24],[3,6,14,20,25],[3,6,14,20,26],[3,7,10,16,24],[3,7,10,16,25],[3,7,10,16,26],[3,7,10,17,24],[3,7,10,17,25],[3,7,10,17,26],[3,7,10,18,24],[3,7,10,18,22],[3,7,10,18,23],[3,7,10,19,22],[3,7,10,19,23],[3,7,10,20,22],[3,7,10,20,23],[3,7,11,16,24],[3,7,11,16,25],[3,7,11,16,26],[3,7,11,17,24],[3,7,11,17,25],[3,7,11,17,26],[3,7,11,18,24],[3,7,11,18,25],[3,7,11,18,26],[3,7,11,18,22],[3,7,11,18,23],[3,7,11,19,22],[3,7,11,19,23],[3,7,11,20,22],[3,7,11,20,23],[3,7,12,18,24],[3,7,12,18,25],[3,7,12,18,26],[3,7,12,19,24],[3,7,12,19,22],[3,7,12,19,23],[3,7,12,20,24],[3,7,12,20,22],[3,7,12,20,23],[3,7,13,18,25],[3,7,13,18,26],[3,7,13,19,24],[3,7,13,19,25],[3,7,13,19,26],[3,7,13,20,24],[3,7,13,20,25],[3,7,13,20,26],[3,7,14,18,25],[3,7,14,18,26],[3,7,14,19,24],[3,7,14,19,25],[3,7,14,19,26],[3,7,14,20,24],[3,7,14,20,25],[3,7,14,20,26],[3,8,10,16,22],[3,8,10,16,23],[3,8,10,17,22],[3,8,10,17,23],[3,8,11,16,22],[3,8,11,16,23],[3,8,11,17,22],[3,8,11,17,23],[3,8,12,16,24],[3,8,12,16,22],[3,8,12,16,23],[3,8,12,17,24],[3,8,12,17,22],[3,8,12,17,23],[3,8,12,18,22],[3,8,12,18,23],[3,8,13,16,24],[3,8,13,16,25],[3,8,13,16,26],[3,8,13,17,24],[3,8,13,17,25],[3,8,13,17,26],[3,8,13,18,22],[3,8,13,18,23],[3,8,13,19,22],[3,8,13,19,23],[3,8,13,20,22],[3,8,13,20,23],[3,8,14,16,24],[3,8,14,16,25],[3,8,14,16,26],[3,8,14,17,24],[3,8,14,17,25],[3,8,14,17,26],[3,8,14,18,22],[3,8,14,18,23],[3,8,14,19,22],[3,8,14,19,23],[3,8,14,20,22],[3,8,14,20,23],[4,6,10,19,24],[4,6,10,19,25],[4,6,10,19,26],[4,6,10,20,24],[4,6,10,20,25],[4,6,10,20,26],[4,6,11,19,24],[4,6,11,19,25],[4,6,11,19,26],[4,6,11,20,24],[4,6,11,20,25],[4,6,11,20,26],[4,7,10,18,25],[4,7,10,18,26],[4,7,10,19,24],[4,7,10,19,25],[4,7,10,19,26],[4,7,10,20,24],[4,7,10,20,25],[4,7,10,20,26],[4,7,11,19,24],[4,7,11,19,25],[4,7,11,19,26],[4,7,11,20,24],[4,7,11,20,25],[4,7,11,20,26],[4,7,12,19,25],[4,7,12,19,26],[4,7,12,20,25],[4,7,12,20,26],[4,8,10,16,24],[4,8,10,16,25],[4,8,10,16,26],[4,8,10,17,24],[4,8,10,17,25],[4,8,10,17,26],[4,8,10,18,22],[4,8,10,18,23],[4,8,11,16,24],[4,8,11,16,25],[4,8,11,16,26],[4,8,11,17,24],[4,8,11,17,25],[4,8,11,17,26],[4,8,11,18,24],[4,8,11,18,22],[4,8,11,18,23],[4,8,11,19,22],[4,8,11,19,23],[4,8,11,20,22],[4,8,11,20,23],[4,8,12,16,25],[4,8,12,16,26],[4,8,12,17,25],[4,8,12,17,26],[4,8,12,18,24],[4,8,12,18,25],[4,8,12,18,26],[4,8,12,19,22],[4,8,12,19,23],[4,8,12,20,22],[4,8,12,20,23],[4,8,13,18,24],[4,8,13,18,25],[4,8,13,18,26],[4,8,13,19,24],[4,8,13,19,25],[4,8,13,19,26],[4,8,13,20,24],[4,8,13,20,25],[4,8,13,20,26],[4,8,14,18,24],[4,8,14,18,25],[4,8,14,18,26],[4,8,14,19,24],[4,8,14,19,25],[4,8,14,19,26],[4,8,14,20,24],[4,8,14,20,25],[4,8,14,20,26],[2,6,10,16,22],[2,6,10,16,23],[2,6,10,17,22],[2,6,10,17,23],[2,6,11,16,24],[2,6,11,16,22],[2,6,11,16,23],[2,6,11,17,24],[2,6,11,17,22],[2,6,11,17,23],[2,6,11,18,22],[2,6,11,18,23],[2,6,12,16,24],[2,6,12,16,25],[2,6,12,16,26],[2,6,12,17,24],[2,6,12,17,25],[2,6,12,17,26],[2,6,12,18,22],[2,6,12,18,23],[2,6,12,19,22],[2,6,12,19,23],[2,6,12,20,22],[2,6,12,20,23],[2,6,13,16,25],[2,6,13,16,26],[2,6,13,17,25],[2,6,13,17,26],[2,6,13,18,24],[2,6,13,18,25],[2,6,13,18,26],[2,6,13,19,22],[2,6,13,19,23],[2,6,13,20,22],[2,6,13,20,23],[2,6,14,16,25],[2,6,14,16,26],[2,6,14,17,25],[2,6,14,17,26],[2,6,14,18,24],[2,6,14,18,25],[2,6,14,18,26],[2,6,14,19,22],[2,6,14,19,23],[2,6,14,20,22],[2,6,14,20,23],[2,7,10,16,22],[2,7,10,16,23],[2,7,10,17,22],[2,7,10,17,23],[2,7,11,16,22],[2,7,11,16,23],[2,7,11,17,22],[2,7,11,17,23],[2,7,12,16,24],[2,7,12,16,25],[2,7,12,16,26],[2,7,12,17,24],[2,7,12,17,25],[2,7,12,17,26],[2,7,12,17,23],[2,7,12,18,22],[2,7,12,18,23],[2,7,13,16,24],[2,7,13,16,25],[2,7,13,16,26],[2,7,13,17,24],[2,7,13,17,25],[2,7,13,17,26],[2,7,13,18,24],[2,7,13,18,22],[2,7,13,18,23],[2,7,13,19,22],[2,7,13,19,23],[2,7,13,20,22],[2,7,13,20,23],[2,7,14,16,24],[2,7,14,16,25],[2,7,14,16,26],[2,7,14,17,24],[2,7,14,17,25],[2,7,14,17,26],[2,7,14,18,24],[2,7,14,18,22],[2,7,14,18,23],[2,7,14,19,22],[2,7,14,19,23],[2,7,14,20,22],[2,7,14,20,23],[2,8,13,16,22],[2,8,13,16,23],[2,8,13,17,22],[2,8,13,17,23],[2,8,14,16,22],[2,8,14,16,23],[2,8,14,17,22],[2,8,14,17,23]],&#34;map_trace_2_shape&#34;:[0,0,0,0,0,0,0,0,0,1,2,3,4,5,0,6,7,8,9,10,0,11,12,13,14,15],&#34;map_type&#34;:[[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;,&#34;line&#34;]],&#34;map_color&#34;:[[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;]],&#34;parcats_cols&#34;:[&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;],&#34;imp&#34;:true},&#34;evals&#34;:[],&#34;jsHooks&#34;:[]}&lt;/script&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Advanced R - Notes (part2)</title>
      <link>https://www.datisticsblog.com/2021/10/advancedrmeta/</link>
      <pubDate>Thu, 14 Oct 2021 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2021/10/advancedrmeta/</guid>
      <description>
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/header-attrs/header-attrs.js&#34;&gt;&lt;/script&gt;

&lt;div id=&#34;TOC&#34;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#metaprogramming&#34;&gt;Metaprogramming&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#basics&#34;&gt;Basics&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#capturingquoting-an-expression-or-many-expression&#34;&gt;Capturing/Quoting an Expression or many expression&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#evaluatingunquoting-an-expression&#34;&gt;Evaluating/Unquoting an Expression&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#capturing-an-expression-as-a-string---deparsing&#34;&gt;Capturing an Expression as a String - Deparsing&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#parsing-strings-and-evaluating-code-from-strings&#34;&gt;Parsing Strings and Evaluating Code from Strings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#converting-strings-to-symbols&#34;&gt;Converting Strings to Symbols&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#symbols-to-strings&#34;&gt;Symbols to Strings&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#code-is-a-tree&#34;&gt;Code is a tree&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#subsetting-and-modifiyng-expressions&#34;&gt;Subsetting and modifiyng Expressions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#quotingunquoting-in-functions&#34;&gt;Quoting/Unquoting in Functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#bang-bang&#34;&gt;bang bang !!&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#bang-bang-bang&#34;&gt;bang bang bang !!!&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#dynamic-dots&#34;&gt;Dynamic Dots …&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#provide-lists-as-function-arguments&#34;&gt;Provide lists as function arguments&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#quosures&#34;&gt;Quosures&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#formulas&#34;&gt;Formulas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#rlang&#34;&gt;rlang&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#data-masks&#34;&gt;Data Masks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#base-function-using-datamasks&#34;&gt;Base Function Using Datamasks&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#subset&#34;&gt;subset&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#transform&#34;&gt;transform&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#select&#34;&gt;select&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#programming-with-rlangdplyr&#34;&gt;Programming with rlang/dplyr&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#pass-expressions-onto-functions-using-expression&#34;&gt;Pass expressions onto functions using expression&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#pass-strings-onto-functions-using-expression&#34;&gt;Pass strings onto functions using expression&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#applications&#34;&gt;Applications&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#fetching-model-training-data-from-global-environment&#34;&gt;Fetching Model Training Data from Global Environment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#correcting-calls-for-wrapped-modelling-functions&#34;&gt;Correcting Calls for Wrapped Modelling Functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#printing-r-code-for-ggplots-plots&#34;&gt;Printing R Code for ggplots Plots&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;https://d33wubrfki0l68.cloudfront.net/565916198b0be51bf88b36f94b80c7ea67cafe7c/7f70b/cover.png&#34; style=&#34;width: 400px;height: 600px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Advanced R (Hadley Wickham).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;knitr::opts_chunk$set(error = TRUE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(library(rlang))
suppressPackageStartupMessages(library(lobstr))
suppressPackageStartupMessages(library(withr))
suppressPackageStartupMessages(library(glue))
# devtools::install_github(&amp;quot;openpharma/simaerep@v0.3.1&amp;quot;)
suppressPackageStartupMessages(library(simaerep))&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;metaprogramming&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Metaprogramming&lt;/h1&gt;
&lt;div id=&#34;basics&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Basics&lt;/h2&gt;
&lt;p&gt;We are ignoring environments for now.&lt;/p&gt;
&lt;div id=&#34;capturingquoting-an-expression-or-many-expression&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Capturing/Quoting an Expression or many expression&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ex1 &amp;lt;- rlang::expr(mean(mtcars$disp))
ex1&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## mean(mtcars$disp)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ex2 &amp;lt;- quote(mean(mtcars$disp))
ex2&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## mean(mtcars$disp)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;exs1 &amp;lt;- rlang::exprs(mean(mtcars$disp), median(mtcars$disp))
exs1&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [[1]]
## mean(mtcars$disp)
## 
## [[2]]
## median(mtcars$disp)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;exs2 &amp;lt;- alist(mean(mtcars$disp), median(mtcars$disp))
exs2&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [[1]]
## mean(mtcars$disp)
## 
## [[2]]
## median(mtcars$disp)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;evaluatingunquoting-an-expression&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Evaluating/Unquoting an Expression&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;eval(ex1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 230.7219&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;lapply(exs1, eval)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [[1]]
## [1] 230.7219
## 
## [[2]]
## [1] 196.3&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;capturing-an-expression-as-a-string---deparsing&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Capturing an Expression as a String - Deparsing&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;str_ex1 &amp;lt;- deparse(ex1)
str_ex1&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;mean(mtcars$disp)&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;rlang::expr_text(ex1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;mean(mtcars$disp)&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;parsing-strings-and-evaluating-code-from-strings&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Parsing Strings and Evaluating Code from Strings&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;parse(text = str_ex1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## expression(mean(mtcars$disp))&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;eval(parse(text = str_ex1))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 230.7219&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;rlang::parse_expr(str_ex1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## mean(mtcars$disp)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;eval(rlang::parse_expr(str_ex1))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 230.7219&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;converting-strings-to-symbols&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Converting Strings to Symbols&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;rlang::sym(&amp;quot;foo&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## foo&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;as.name(&amp;quot;foo&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## foo&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;symbols-to-strings&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Symbols to Strings&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;deparse(rlang::sym(&amp;quot;foo&amp;quot;))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;foo&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;rlang::expr_text(as.name(&amp;quot;foo&amp;quot;))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;foo&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;code-is-a-tree&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Code is a tree&lt;/h2&gt;
&lt;p&gt;Code can be displayed as an &lt;em&gt;abstract synthax tree (AST)&lt;/em&gt; with functions/expressions/symbols as nodes and literals/constants as leaves.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;lobstr::ast(f(a, &amp;quot;b&amp;quot;))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## █─f 
## ├─a 
## └─&amp;quot;b&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;lobstr::ast(f1(f2(a, b), f3(1, f4(2))))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## █─f1 
## ├─█─f2 
## │ ├─a 
## │ └─b 
## └─█─f3 
##   ├─1 
##   └─█─f4 
##     └─2&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;lobstr::ast(1 + 2 * 3)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## █─`+` 
## ├─1 
## └─█─`*` 
##   ├─2 
##   └─3&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;subsetting-and-modifiyng-expressions&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Subsetting and modifiyng Expressions&lt;/h2&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;length(ex1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 2&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ex1[[1]]&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## mean&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ex1[[2]]&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## mtcars$disp&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ex1[[1]] &amp;lt;- quote(median)
ex1[[1]]&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## median&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ex1&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## median(mtcars$disp)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;eval(ex1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 196.3&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;quotingunquoting-in-functions&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Quoting/Unquoting in Functions&lt;/h2&gt;
&lt;p&gt;here we want to capture the user-supplied expression&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;capture1 &amp;lt;- function(x) {
  quote(x)
}

capture1(mean(mtcars$disp))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## x&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;capture2 &amp;lt;- function(x) {
  rlang::enexpr(x)
}

capture2(mean(mtcars$disp))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## mean(mtcars$disp)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;capture3 &amp;lt;- function(x) {
  substitute(x)
}

capture3(mean(mtcars$disp))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## mean(mtcars$disp)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;substitute() can also be used to alter expressions&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;substitute(mean(mtcars$disp), list(mean = quote(median), disp = quote(vs)))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## median(mtcars$vs)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;bang-bang&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;bang bang !!&lt;/h2&gt;
&lt;p&gt;In &lt;code&gt;rlang&lt;/code&gt; when constructing expression we can chose to selectively unquote parts of the expression using &lt;code&gt;!!&lt;/code&gt; bang bang.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;x &amp;lt;- rlang::expr(-1)

rlang::expr(f(!!x, y))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## f(-1, y)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;a &amp;lt;- rlang::sym(&amp;quot;foo&amp;quot;)
b &amp;lt;- 1
rlang::expr(f(!!a, !!b))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## f(foo, 1)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;bang-bang-bang&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;bang bang bang !!!&lt;/h2&gt;
&lt;p&gt;selectively unquote lists of expressions using &lt;code&gt;!!!&lt;/code&gt; bang bang bang.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;xs &amp;lt;- rlang::exprs(1, a, -b)
rlang::expr(f(!!!xs, y))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## f(1, a, -b, y)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# Or with names
ys &amp;lt;- rlang::set_names(xs, c(&amp;quot;a&amp;quot;, &amp;quot;b&amp;quot;, &amp;quot;c&amp;quot;))
rlang::expr(f(!!!ys, d = 4))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## f(a = 1, b = a, c = -b, d = 4)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;dynamic-dots&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Dynamic Dots …&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;rlang::list2()&lt;/code&gt; allows a function to use &lt;code&gt;!!!&lt;/code&gt; and &lt;code&gt;:=&lt;/code&gt; with its &lt;code&gt;...&lt;/code&gt; argument, which unpacks the list.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;f &amp;lt;- function(...) {
  out &amp;lt;- rlang::list2(...)
  rev(out)
}

x &amp;lt;- list(alpha = &amp;quot;first&amp;quot;, omega = &amp;quot;last&amp;quot;)

f(!!!x)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $omega
## [1] &amp;quot;last&amp;quot;
## 
## $alpha
## [1] &amp;quot;first&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;f(x)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [[1]]
## [[1]]$alpha
## [1] &amp;quot;first&amp;quot;
## 
## [[1]]$omega
## [1] &amp;quot;last&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;nm &amp;lt;- &amp;quot;foo&amp;quot;
f(!!nm := &amp;quot;bar&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $foo
## [1] &amp;quot;bar&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;provide-lists-as-function-arguments&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Provide lists as function arguments&lt;/h2&gt;
&lt;p&gt;use &lt;code&gt;rlang::exec()&lt;/code&gt; which uses dynamic dots&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# Directly
exec(mean, x = 1:10, na.rm = TRUE, trim = 0.1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 5.5&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# Indirectly
args &amp;lt;- list(x = 1:10, na.rm = TRUE, trim = 0.1)
exec(mean, !!!args)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 5.5&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# Mixed
params &amp;lt;- list(na.rm = TRUE, trim = 0.1)
exec(mean, x = 1:10, !!!params)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 5.5&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;use &lt;code&gt;do.Call&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;do.call(mean, list(x = 1:10, na.rm = TRUE, trim = 0.1))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 5.5&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;quosures&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Quosures&lt;/h2&gt;
&lt;p&gt;When evaluating an expression we can control the environment. Quosures consist of an expression and an environment.&lt;/p&gt;
&lt;p&gt;They are similar to formulas in base R&lt;/p&gt;
&lt;div id=&#34;formulas&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Formulas&lt;/h3&gt;
&lt;p&gt;we can extract environment and formula expressions using &lt;code&gt;rlang&lt;/code&gt; functions and evaluate both.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;construct_formula &amp;lt;- function() {
  env_x &amp;lt;- 3
  ~runif(env_x)
}

f &amp;lt;- construct_formula()

f&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ~runif(env_x)
## &amp;lt;environment: 0x7fe60b693388&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;eval(rlang::f_rhs(f), envir = rlang::f_env(f))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 0.4454028 0.3837579 0.3728023&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;rlang&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;rlang&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;rlang::quo&lt;/code&gt; and &lt;code&gt;rlang::quos&lt;/code&gt; match &lt;code&gt;rlang::expr()&lt;/code&gt; and &lt;code&gt;rlang::exprs()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;rlang::eval_tidy()&lt;/code&gt; evaluates quosures&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;foo &amp;lt;- function(x) enquo(x)
foo(a + b)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## &amp;lt;quosure&amp;gt;
## expr: ^a + b
## env:  global&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q1 &amp;lt;- new_quosure(expr(x + y), env(x = 1, y = 10))
eval_tidy(q1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 11&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;data-masks&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Data Masks&lt;/h2&gt;
&lt;p&gt;Call variables from a data frame using expressions. &lt;code&gt;eval_tidy()&lt;/code&gt; excepts a dataframe in addition to the environment in the closure which it unpacks and makes available to the evaluation of the expression.&lt;/p&gt;
&lt;p&gt;&lt;code&gt;eval()&lt;/code&gt; excepts a dataframe as an environment&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;with2 &amp;lt;- function(data, expr) {
  expr &amp;lt;- enquo(expr)
  eval_tidy(expr, data = data)
}

df &amp;lt;- data.frame(y = 1:10)
x &amp;lt;- 100

with2(df, x * y)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##  [1]  100  200  300  400  500  600  700  800  900 1000&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;with3 &amp;lt;- function(data, expr) {
  expr &amp;lt;- substitute(expr)
  eval(expr, envir = data)
}

with3(df, x * y)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##  [1]  100  200  300  400  500  600  700  800  900 1000&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;for &lt;code&gt;rlang&lt;/code&gt; quosures we can solve ambiguity between the dataframe and the environment using &lt;code&gt;.data&lt;/code&gt; and &lt;code&gt;.env&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df &amp;lt;- data.frame(y = 1:10, x = 11:20)
x &amp;lt;- 100

with2(df, .data$x + .data$y)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##  [1] 12 14 16 18 20 22 24 26 28 30&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;with2(df, .env$x + .data$y)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##  [1] 101 102 103 104 105 106 107 108 109 110&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# does  not work with the base version
with3(df, .data$x)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## NULL&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;base-function-using-datamasks&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Base Function Using Datamasks&lt;/h2&gt;
&lt;div id=&#34;subset&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;subset&lt;/h3&gt;
&lt;p&gt;similar to &lt;code&gt;dplyr::filter&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;subset2 &amp;lt;- function(df, expr) {
  qu &amp;lt;- enquo(expr)
  bool &amp;lt;- eval_tidy(qu, df)
  browser
  stopifnot(is.logical(bool))
  df[bool,]
}

subset2(mtcars, cyl == 6)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##                 mpg cyl  disp  hp drat    wt  qsec vs am gear carb
## Mazda RX4      21.0   6 160.0 110 3.90 2.620 16.46  0  1    4    4
## Mazda RX4 Wag  21.0   6 160.0 110 3.90 2.875 17.02  0  1    4    4
## Hornet 4 Drive 21.4   6 258.0 110 3.08 3.215 19.44  1  0    3    1
## Valiant        18.1   6 225.0 105 2.76 3.460 20.22  1  0    3    1
## Merc 280       19.2   6 167.6 123 3.92 3.440 18.30  1  0    4    4
## Merc 280C      17.8   6 167.6 123 3.92 3.440 18.90  1  0    4    4
## Ferrari Dino   19.7   6 145.0 175 3.62 2.770 15.50  0  1    5    6&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;transform&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;transform&lt;/h3&gt;
&lt;p&gt;similar to &lt;code&gt;dplyr::mutate&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;transform2 &amp;lt;- function(df, ...) {
  dots &amp;lt;- enquos(...)
  
  for (i in seq_along(dots)) {
    col &amp;lt;- names(dots)[i]
    df[[col]] &amp;lt;- eval_tidy(dots[[i]], df)
  }
  
  return(df)
}

df &amp;lt;- data.frame(x = 1:10, y = 11: 10)

transform2(df, z = x * y, z0 = z + 1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##     x  y   z  z0
## 1   1 11  11  12
## 2   2 10  20  21
## 3   3 11  33  34
## 4   4 10  40  41
## 5   5 11  55  56
## 6   6 10  60  61
## 7   7 11  77  78
## 8   8 10  80  81
## 9   9 11  99 100
## 10 10 10 100 101&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;select&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;select&lt;/h3&gt;
&lt;p&gt;rewrite of dplyr::select()&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;select2 &amp;lt;- function(data, ...) {
  dots &amp;lt;- enquos(...)
  vars &amp;lt;- as.list(set_names(seq_along(data), names(data)))
  cols &amp;lt;- unlist(map(dots, eval_tidy, vars))

  data[, cols, drop = FALSE]
}

df &amp;lt;- data.frame(a = 1, b = 2, c = 3, d = 4, e = 5)

select2(df, b:d, a)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##   b c d a
## 1 2 3 4 1&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;programming-with-rlangdplyr&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Programming with rlang/dplyr&lt;/h2&gt;
&lt;div id=&#34;pass-expressions-onto-functions-using-expression&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Pass expressions onto functions using expression&lt;/h3&gt;
&lt;p&gt;We cannot pass them directly. We need to quote and selectively unquote&lt;/p&gt;
&lt;div id=&#34;we-can-use-quosures-and-bangs&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;We can use quosures and bangs&lt;/h4&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sample_col &amp;lt;- function(df, col, n = 5) {
  qu_col &amp;lt;- enquo(col)
  head(select2(df, !! qu_col), n)
}

sample_col(mtcars, disp)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##                   disp
## Mazda RX4          160
## Mazda RX4 Wag      160
## Datsun 710         108
## Hornet 4 Drive     258
## Hornet Sportabout  360&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sample_cols &amp;lt;- function(df, ..., n = 5) {
  qu_cols &amp;lt;- enquos(...)
  head(select2(df, !!! qu_cols), n)
}

sample_cols(mtcars, disp, cyl)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##                   disp cyl
## Mazda RX4          160   6
## Mazda RX4 Wag      160   6
## Datsun 710         108   4
## Hornet 4 Drive     258   6
## Hornet Sportabout  360   8&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;or-expressions&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Or expressions&lt;/h4&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sample_col &amp;lt;- function(df, col, n = 5) {
  qu_col &amp;lt;- enexpr(col)
  head(select(df, !! qu_col), n)
}

sample_col(mtcars, disp)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##                   disp
## Mazda RX4          160
## Mazda RX4 Wag      160
## Datsun 710         108
## Hornet 4 Drive     258
## Hornet Sportabout  360&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sample_cols &amp;lt;- function(df, ..., n = 5) {
  qu_cols &amp;lt;- enexprs(...)
  head(select2(df, !!! qu_cols), n)
}

sample_cols(mtcars, disp, cyl)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##                   disp cyl
## Mazda RX4          160   6
## Mazda RX4 Wag      160   6
## Datsun 710         108   4
## Hornet 4 Drive     258   6
## Hornet Sportabout  360   8&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;or-curly-curl&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Or Curly Curl&lt;/h4&gt;
&lt;p&gt;**new standard as of &lt;code&gt;rlang 0.4.0&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sample_col &amp;lt;- function(df, col, n = 5) {
  head(select2(df, {{col}}), n)
}

sample_col(mtcars, disp)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##                   disp
## Mazda RX4          160
## Mazda RX4 Wag      160
## Datsun 710         108
## Hornet 4 Drive     258
## Hornet Sportabout  360&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sample_cols &amp;lt;- function(df, ..., n = 5) {
  head(select2(df, ...), n)
}

sample_cols(mtcars, disp, cyl)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##                   disp cyl
## Mazda RX4          160   6
## Mazda RX4 Wag      160   6
## Datsun 710         108   4
## Hornet 4 Drive     258   6
## Hornet Sportabout  360   8&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;pass-strings-onto-functions-using-expression&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Pass strings onto functions using expression&lt;/h3&gt;
&lt;p&gt;use &lt;code&gt;.data&lt;/code&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;applications&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Applications&lt;/h2&gt;
&lt;div id=&#34;fetching-model-training-data-from-global-environment&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Fetching Model Training Data from Global Environment&lt;/h3&gt;
&lt;p&gt;save the call using match.call()&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;slope_model &amp;lt;- function(data, form) {
  m &amp;lt;- lm(form, data)
  structure(
    list(
      slope = m$coefficients[[2]],
      intercept = m$coefficients[[1]],
      call = match.call()
    ),
    class = &amp;quot;slope_model&amp;quot;
  )
}

plot.slope_model &amp;lt;- function(m) {
  stopifnot(inherits(m, &amp;quot;slope_model&amp;quot;))
  
  data_expr &amp;lt;- m$call[[&amp;quot;data&amp;quot;]]
  stopifnot(exists(deparse(data_expr)))
  cols &amp;lt;- colnames(eval(data_expr))
  
  
  form &amp;lt;- m$call[[&amp;quot;form&amp;quot;]]
  y_expr &amp;lt;- rlang::f_lhs(form)
  x_expr &amp;lt;- rlang::f_rhs(form)
  y_str &amp;lt;- deparse(y_expr)
  x_str &amp;lt;- deparse(x_expr)
  stopifnot(c(y_str, y_str) %in% cols)
  
  eval(data_expr) %&amp;gt;%
    select({{y_expr}}, {{x_expr}}) %&amp;gt;%
    ggplot(aes({{x_expr}}, {{y_expr}})) +
      geom_point() +
      geom_abline(slope = m$slope, intercept = m$intercept) +
      theme_minimal()
  
}

m &amp;lt;- slope_model(mtcars, disp ~ hp)
m&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $slope
## [1] 1.42977
## 
## $intercept
## [1] 20.99248
## 
## $call
## slope_model(data = mtcars, form = disp ~ hp)
## 
## attr(,&amp;quot;class&amp;quot;)
## [1] &amp;quot;slope_model&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(m)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part2_files/figure-html/unnamed-chunk-28-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;pryr::object_size(m)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## 1,520 B&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;pryr::object_size({m$data &amp;lt;- mtcars})&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## 7,208 B&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;correcting-calls-for-wrapped-modelling-functions&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Correcting Calls for Wrapped Modelling Functions&lt;/h3&gt;
&lt;p&gt;when we write a wrapper the saved call cannot be used to reconstruct the actual call. And methods relying on it will not work&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;wr_slope &amp;lt;- function(data, form) {
  slope_model(data, form)
}

m &amp;lt;- wr_slope(mtcars, disp ~ hp)
m&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $slope
## [1] 1.42977
## 
## $intercept
## [1] 20.99248
## 
## $call
## slope_model(data = data, form = form)
## 
## attr(,&amp;quot;class&amp;quot;)
## [1] &amp;quot;slope_model&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(m)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error: `x` must be a formula&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;we need to reconstruct a new call inside the wrapper and pass it to the modelling function.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;wr_slope &amp;lt;- function(data, form) {
  data &amp;lt;- enexpr(data)
  form &amp;lt;- enexpr(form)
  
  new_call &amp;lt;- expr(slope_model(!!data, !!form))
  eval(new_call)
}

m &amp;lt;- wr_slope(mtcars, disp ~ hp)
m&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $slope
## [1] 1.42977
## 
## $intercept
## [1] 20.99248
## 
## $call
## slope_model(data = mtcars, form = disp ~ hp)
## 
## attr(,&amp;quot;class&amp;quot;)
## [1] &amp;quot;slope_model&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(m)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part2_files/figure-html/unnamed-chunk-31-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;attaching the call to the model object is risky because if the modeling function is used by &lt;code&gt;do.call&lt;/code&gt; or &lt;code&gt;purr::map&lt;/code&gt; we risk attaching the entire data to the call.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;do.call(slope_model, list(mtcars, disp ~ hp))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $slope
## [1] 1.42977
## 
## $intercept
## [1] 20.99248
## 
## $call
## (function(data, form) {
##   m &amp;lt;- lm(form, data)
##   structure(
##     list(
##       slope = m$coefficients[[2]],
##       intercept = m$coefficients[[1]],
##       call = match.call()
##     ),
##     class = &amp;quot;slope_model&amp;quot;
##   )
## })(data = list(mpg = c(21, 21, 22.8, 21.4, 18.7, 18.1, 14.3, 
## 24.4, 22.8, 19.2, 17.8, 16.4, 17.3, 15.2, 10.4, 10.4, 14.7, 32.4, 
## 30.4, 33.9, 21.5, 15.5, 15.2, 13.3, 19.2, 27.3, 26, 30.4, 15.8, 
## 19.7, 15, 21.4), cyl = c(6, 6, 4, 6, 8, 6, 8, 4, 4, 6, 6, 8, 
## 8, 8, 8, 8, 8, 4, 4, 4, 4, 8, 8, 8, 8, 4, 4, 4, 8, 6, 8, 4), 
##     disp = c(160, 160, 108, 258, 360, 225, 360, 146.7, 140.8, 
##     167.6, 167.6, 275.8, 275.8, 275.8, 472, 460, 440, 78.7, 75.7, 
##     71.1, 120.1, 318, 304, 350, 400, 79, 120.3, 95.1, 351, 145, 
##     301, 121), hp = c(110, 110, 93, 110, 175, 105, 245, 62, 95, 
##     123, 123, 180, 180, 180, 205, 215, 230, 66, 52, 65, 97, 150, 
##     150, 245, 175, 66, 91, 113, 264, 175, 335, 109), drat = c(3.9, 
##     3.9, 3.85, 3.08, 3.15, 2.76, 3.21, 3.69, 3.92, 3.92, 3.92, 
##     3.07, 3.07, 3.07, 2.93, 3, 3.23, 4.08, 4.93, 4.22, 3.7, 2.76, 
##     3.15, 3.73, 3.08, 4.08, 4.43, 3.77, 4.22, 3.62, 3.54, 4.11
##     ), wt = c(2.62, 2.875, 2.32, 3.215, 3.44, 3.46, 3.57, 3.19, 
##     3.15, 3.44, 3.44, 4.07, 3.73, 3.78, 5.25, 5.424, 5.345, 2.2, 
##     1.615, 1.835, 2.465, 3.52, 3.435, 3.84, 3.845, 1.935, 2.14, 
##     1.513, 3.17, 2.77, 3.57, 2.78), qsec = c(16.46, 17.02, 18.61, 
##     19.44, 17.02, 20.22, 15.84, 20, 22.9, 18.3, 18.9, 17.4, 17.6, 
##     18, 17.98, 17.82, 17.42, 19.47, 18.52, 19.9, 20.01, 16.87, 
##     17.3, 15.41, 17.05, 18.9, 16.7, 16.9, 14.5, 15.5, 14.6, 18.6
##     ), vs = c(0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 
##     0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1), am = c(1, 
##     1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 
##     0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1), gear = c(4, 4, 4, 3, 
##     3, 3, 3, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 4, 4, 4, 3, 3, 3, 
##     3, 3, 4, 5, 5, 5, 5, 5, 4), carb = c(4, 4, 1, 1, 2, 1, 4, 
##     2, 2, 4, 4, 3, 3, 3, 4, 4, 4, 1, 2, 1, 1, 2, 2, 4, 2, 1, 
##     2, 2, 4, 6, 8, 2)), form = disp ~ hp)
## 
## attr(,&amp;quot;class&amp;quot;)
## [1] &amp;quot;slope_model&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;do.call(wr_slope, list(mtcars, disp ~ hp))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $slope
## [1] 1.42977
## 
## $intercept
## [1] 20.99248
## 
## $call
## slope_model(data = list(mpg = c(21, 21, 22.8, 21.4, 18.7, 18.1, 
## 14.3, 24.4, 22.8, 19.2, 17.8, 16.4, 17.3, 15.2, 10.4, 10.4, 14.7, 
## 32.4, 30.4, 33.9, 21.5, 15.5, 15.2, 13.3, 19.2, 27.3, 26, 30.4, 
## 15.8, 19.7, 15, 21.4), cyl = c(6, 6, 4, 6, 8, 6, 8, 4, 4, 6, 
## 6, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 8, 8, 8, 8, 4, 4, 4, 8, 6, 8, 
## 4), disp = c(160, 160, 108, 258, 360, 225, 360, 146.7, 140.8, 
## 167.6, 167.6, 275.8, 275.8, 275.8, 472, 460, 440, 78.7, 75.7, 
## 71.1, 120.1, 318, 304, 350, 400, 79, 120.3, 95.1, 351, 145, 301, 
## 121), hp = c(110, 110, 93, 110, 175, 105, 245, 62, 95, 123, 123, 
## 180, 180, 180, 205, 215, 230, 66, 52, 65, 97, 150, 150, 245, 
## 175, 66, 91, 113, 264, 175, 335, 109), drat = c(3.9, 3.9, 3.85, 
## 3.08, 3.15, 2.76, 3.21, 3.69, 3.92, 3.92, 3.92, 3.07, 3.07, 3.07, 
## 2.93, 3, 3.23, 4.08, 4.93, 4.22, 3.7, 2.76, 3.15, 3.73, 3.08, 
## 4.08, 4.43, 3.77, 4.22, 3.62, 3.54, 4.11), wt = c(2.62, 2.875, 
## 2.32, 3.215, 3.44, 3.46, 3.57, 3.19, 3.15, 3.44, 3.44, 4.07, 
## 3.73, 3.78, 5.25, 5.424, 5.345, 2.2, 1.615, 1.835, 2.465, 3.52, 
## 3.435, 3.84, 3.845, 1.935, 2.14, 1.513, 3.17, 2.77, 3.57, 2.78
## ), qsec = c(16.46, 17.02, 18.61, 19.44, 17.02, 20.22, 15.84, 
## 20, 22.9, 18.3, 18.9, 17.4, 17.6, 18, 17.98, 17.82, 17.42, 19.47, 
## 18.52, 19.9, 20.01, 16.87, 17.3, 15.41, 17.05, 18.9, 16.7, 16.9, 
## 14.5, 15.5, 14.6, 18.6), vs = c(0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 
## 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 
## 1), am = c(1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
## 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1), gear = c(4, 4, 
## 4, 3, 3, 3, 3, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 4, 4, 4, 3, 3, 3, 
## 3, 3, 4, 5, 5, 5, 5, 5, 4), carb = c(4, 4, 1, 1, 2, 1, 4, 2, 
## 2, 4, 4, 3, 3, 3, 4, 4, 4, 1, 2, 1, 1, 2, 2, 4, 2, 1, 2, 2, 4, 
## 6, 8, 2)), form = disp ~ hp)
## 
## attr(,&amp;quot;class&amp;quot;)
## [1] &amp;quot;slope_model&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;do.call(lm, list(disp ~ hp, mtcars))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## 
## Call:
## (function (formula, data, subset, weights, na.action, method = &amp;quot;qr&amp;quot;, 
##     model = TRUE, x = FALSE, y = FALSE, qr = TRUE, singular.ok = TRUE, 
##     contrasts = NULL, offset, ...) 
## {
##     ret.x &amp;lt;- x
##     ret.y &amp;lt;- y
##     cl &amp;lt;- match.call()
##     mf &amp;lt;- match.call(expand.dots = FALSE)
##     m &amp;lt;- match(c(&amp;quot;formula&amp;quot;, &amp;quot;data&amp;quot;, &amp;quot;subset&amp;quot;, &amp;quot;weights&amp;quot;, &amp;quot;na.action&amp;quot;, 
##         &amp;quot;offset&amp;quot;), names(mf), 0L)
##     mf &amp;lt;- mf[c(1L, m)]
##     mf$drop.unused.levels &amp;lt;- TRUE
##     mf[[1L]] &amp;lt;- quote(stats::model.frame)
##     mf &amp;lt;- eval(mf, parent.frame())
##     if (method == &amp;quot;model.frame&amp;quot;) 
##         return(mf)
##     else if (method != &amp;quot;qr&amp;quot;) 
##         warning(gettextf(&amp;quot;method = &amp;#39;%s&amp;#39; is not supported. Using &amp;#39;qr&amp;#39;&amp;quot;, 
##             method), domain = NA)
##     mt &amp;lt;- attr(mf, &amp;quot;terms&amp;quot;)
##     y &amp;lt;- model.response(mf, &amp;quot;numeric&amp;quot;)
##     w &amp;lt;- as.vector(model.weights(mf))
##     if (!is.null(w) &amp;amp;&amp;amp; !is.numeric(w)) 
##         stop(&amp;quot;&amp;#39;weights&amp;#39; must be a numeric vector&amp;quot;)
##     offset &amp;lt;- model.offset(mf)
##     mlm &amp;lt;- is.matrix(y)
##     ny &amp;lt;- if (mlm) 
##         nrow(y)
##     else length(y)
##     if (!is.null(offset)) {
##         if (!mlm) 
##             offset &amp;lt;- as.vector(offset)
##         if (NROW(offset) != ny) 
##             stop(gettextf(&amp;quot;number of offsets is %d, should equal %d (number of observations)&amp;quot;, 
##                 NROW(offset), ny), domain = NA)
##     }
##     if (is.empty.model(mt)) {
##         x &amp;lt;- NULL
##         z &amp;lt;- list(coefficients = if (mlm) matrix(NA_real_, 0, 
##             ncol(y)) else numeric(), residuals = y, fitted.values = 0 * 
##             y, weights = w, rank = 0L, df.residual = if (!is.null(w)) sum(w != 
##             0) else ny)
##         if (!is.null(offset)) {
##             z$fitted.values &amp;lt;- offset
##             z$residuals &amp;lt;- y - offset
##         }
##     }
##     else {
##         x &amp;lt;- model.matrix(mt, mf, contrasts)
##         z &amp;lt;- if (is.null(w)) 
##             lm.fit(x, y, offset = offset, singular.ok = singular.ok, 
##                 ...)
##         else lm.wfit(x, y, w, offset = offset, singular.ok = singular.ok, 
##             ...)
##     }
##     class(z) &amp;lt;- c(if (mlm) &amp;quot;mlm&amp;quot;, &amp;quot;lm&amp;quot;)
##     z$na.action &amp;lt;- attr(mf, &amp;quot;na.action&amp;quot;)
##     z$offset &amp;lt;- offset
##     z$contrasts &amp;lt;- attr(x, &amp;quot;contrasts&amp;quot;)
##     z$xlevels &amp;lt;- .getXlevels(mt, mf)
##     z$call &amp;lt;- cl
##     z$terms &amp;lt;- mt
##     if (model) 
##         z$model &amp;lt;- mf
##     if (ret.x) 
##         z$x &amp;lt;- x
##     if (ret.y) 
##         z$y &amp;lt;- y
##     if (!qr) 
##         z$qr &amp;lt;- NULL
##     z
## })(formula = disp ~ hp, data = structure(list(mpg = c(21, 21, 
## 22.8, 21.4, 18.7, 18.1, 14.3, 24.4, 22.8, 19.2, 17.8, 16.4, 17.3, 
## 15.2, 10.4, 10.4, 14.7, 32.4, 30.4, 33.9, 21.5, 15.5, 15.2, 13.3, 
## 19.2, 27.3, 26, 30.4, 15.8, 19.7, 15, 21.4), cyl = c(6, 6, 4, 
## 6, 8, 6, 8, 4, 4, 6, 6, 8, 8, 8, 8, 8, 8, 4, 4, 4, 4, 8, 8, 8, 
## 8, 4, 4, 4, 8, 6, 8, 4), disp = c(160, 160, 108, 258, 360, 225, 
## 360, 146.7, 140.8, 167.6, 167.6, 275.8, 275.8, 275.8, 472, 460, 
## 440, 78.7, 75.7, 71.1, 120.1, 318, 304, 350, 400, 79, 120.3, 
## 95.1, 351, 145, 301, 121), hp = c(110, 110, 93, 110, 175, 105, 
## 245, 62, 95, 123, 123, 180, 180, 180, 205, 215, 230, 66, 52, 
## 65, 97, 150, 150, 245, 175, 66, 91, 113, 264, 175, 335, 109), 
##     drat = c(3.9, 3.9, 3.85, 3.08, 3.15, 2.76, 3.21, 3.69, 3.92, 
##     3.92, 3.92, 3.07, 3.07, 3.07, 2.93, 3, 3.23, 4.08, 4.93, 
##     4.22, 3.7, 2.76, 3.15, 3.73, 3.08, 4.08, 4.43, 3.77, 4.22, 
##     3.62, 3.54, 4.11), wt = c(2.62, 2.875, 2.32, 3.215, 3.44, 
##     3.46, 3.57, 3.19, 3.15, 3.44, 3.44, 4.07, 3.73, 3.78, 5.25, 
##     5.424, 5.345, 2.2, 1.615, 1.835, 2.465, 3.52, 3.435, 3.84, 
##     3.845, 1.935, 2.14, 1.513, 3.17, 2.77, 3.57, 2.78), qsec = c(16.46, 
##     17.02, 18.61, 19.44, 17.02, 20.22, 15.84, 20, 22.9, 18.3, 
##     18.9, 17.4, 17.6, 18, 17.98, 17.82, 17.42, 19.47, 18.52, 
##     19.9, 20.01, 16.87, 17.3, 15.41, 17.05, 18.9, 16.7, 16.9, 
##     14.5, 15.5, 14.6, 18.6), vs = c(0, 0, 1, 1, 0, 1, 0, 1, 1, 
##     1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 
##     0, 0, 0, 1), am = c(1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
##     0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1), 
##     gear = c(4, 4, 4, 3, 3, 3, 3, 4, 4, 4, 4, 3, 3, 3, 3, 3, 
##     3, 4, 4, 4, 3, 3, 3, 3, 3, 4, 5, 5, 5, 5, 5, 4), carb = c(4, 
##     4, 1, 1, 2, 1, 4, 2, 2, 4, 4, 3, 3, 3, 4, 4, 4, 1, 2, 1, 
##     1, 2, 2, 4, 2, 1, 2, 2, 4, 6, 8, 2)), row.names = c(&amp;quot;Mazda RX4&amp;quot;, 
## &amp;quot;Mazda RX4 Wag&amp;quot;, &amp;quot;Datsun 710&amp;quot;, &amp;quot;Hornet 4 Drive&amp;quot;, &amp;quot;Hornet Sportabout&amp;quot;, 
## &amp;quot;Valiant&amp;quot;, &amp;quot;Duster 360&amp;quot;, &amp;quot;Merc 240D&amp;quot;, &amp;quot;Merc 230&amp;quot;, &amp;quot;Merc 280&amp;quot;, 
## &amp;quot;Merc 280C&amp;quot;, &amp;quot;Merc 450SE&amp;quot;, &amp;quot;Merc 450SL&amp;quot;, &amp;quot;Merc 450SLC&amp;quot;, &amp;quot;Cadillac Fleetwood&amp;quot;, 
## &amp;quot;Lincoln Continental&amp;quot;, &amp;quot;Chrysler Imperial&amp;quot;, &amp;quot;Fiat 128&amp;quot;, &amp;quot;Honda Civic&amp;quot;, 
## &amp;quot;Toyota Corolla&amp;quot;, &amp;quot;Toyota Corona&amp;quot;, &amp;quot;Dodge Challenger&amp;quot;, &amp;quot;AMC Javelin&amp;quot;, 
## &amp;quot;Camaro Z28&amp;quot;, &amp;quot;Pontiac Firebird&amp;quot;, &amp;quot;Fiat X1-9&amp;quot;, &amp;quot;Porsche 914-2&amp;quot;, 
## &amp;quot;Lotus Europa&amp;quot;, &amp;quot;Ford Pantera L&amp;quot;, &amp;quot;Ferrari Dino&amp;quot;, &amp;quot;Maserati Bora&amp;quot;, 
## &amp;quot;Volvo 142E&amp;quot;), class = &amp;quot;data.frame&amp;quot;))
## 
## Coefficients:
## (Intercept)           hp  
##       20.99         1.43&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is why a size check for the saving the call is required in the &lt;a href=&#34;https://tidymodels.github.io/model-implementation-principles/the-model-object.html&#34;&gt;tidymodels convention guide&lt;/a&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df_m &amp;lt;- mtcars %&amp;gt;%
  group_by(cyl) %&amp;gt;%
  nest() %&amp;gt;%
  mutate(m = map(data, wr_slope, disp ~ hp))

map(df_m$m, ~ .$call)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [[1]]
## slope_model(data = list(mpg = c(21, 21, 21.4, 18.1, 19.2, 17.8, 
## 19.7), disp = c(160, 160, 258, 225, 167.6, 167.6, 145), hp = c(110, 
## 110, 110, 105, 123, 123, 175), drat = c(3.9, 3.9, 3.08, 2.76, 
## 3.92, 3.92, 3.62), wt = c(2.62, 2.875, 3.215, 3.46, 3.44, 3.44, 
## 2.77), qsec = c(16.46, 17.02, 19.44, 20.22, 18.3, 18.9, 15.5), 
##     vs = c(0, 0, 1, 1, 1, 1, 0), am = c(1, 1, 0, 0, 0, 0, 1), 
##     gear = c(4, 4, 3, 3, 4, 4, 5), carb = c(4, 4, 1, 1, 4, 4, 
##     6)), form = disp ~ hp)
## 
## [[2]]
## slope_model(data = list(mpg = c(22.8, 24.4, 22.8, 32.4, 30.4, 
## 33.9, 21.5, 27.3, 26, 30.4, 21.4), disp = c(108, 146.7, 140.8, 
## 78.7, 75.7, 71.1, 120.1, 79, 120.3, 95.1, 121), hp = c(93, 62, 
## 95, 66, 52, 65, 97, 66, 91, 113, 109), drat = c(3.85, 3.69, 3.92, 
## 4.08, 4.93, 4.22, 3.7, 4.08, 4.43, 3.77, 4.11), wt = c(2.32, 
## 3.19, 3.15, 2.2, 1.615, 1.835, 2.465, 1.935, 2.14, 1.513, 2.78
## ), qsec = c(18.61, 20, 22.9, 19.47, 18.52, 19.9, 20.01, 18.9, 
## 16.7, 16.9, 18.6), vs = c(1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1), am = c(1, 
## 0, 0, 1, 1, 1, 0, 1, 1, 1, 1), gear = c(4, 4, 4, 4, 4, 4, 3, 
## 4, 5, 5, 4), carb = c(1, 2, 2, 1, 2, 1, 1, 1, 2, 2, 2)), form = disp ~ 
##     hp)
## 
## [[3]]
## slope_model(data = list(mpg = c(18.7, 14.3, 16.4, 17.3, 15.2, 
## 10.4, 10.4, 14.7, 15.5, 15.2, 13.3, 19.2, 15.8, 15), disp = c(360, 
## 360, 275.8, 275.8, 275.8, 472, 460, 440, 318, 304, 350, 400, 
## 351, 301), hp = c(175, 245, 180, 180, 180, 205, 215, 230, 150, 
## 150, 245, 175, 264, 335), drat = c(3.15, 3.21, 3.07, 3.07, 3.07, 
## 2.93, 3, 3.23, 2.76, 3.15, 3.73, 3.08, 4.22, 3.54), wt = c(3.44, 
## 3.57, 4.07, 3.73, 3.78, 5.25, 5.424, 5.345, 3.52, 3.435, 3.84, 
## 3.845, 3.17, 3.57), qsec = c(17.02, 15.84, 17.4, 17.6, 18, 17.98, 
## 17.82, 17.42, 16.87, 17.3, 15.41, 17.05, 14.5, 14.6), vs = c(0, 
## 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), am = c(0, 0, 0, 0, 0, 
## 0, 0, 0, 0, 0, 0, 0, 1, 1), gear = c(3, 3, 3, 3, 3, 3, 3, 3, 
## 3, 3, 3, 3, 5, 5), carb = c(2, 4, 3, 3, 3, 4, 4, 4, 2, 2, 4, 
## 2, 4, 8)), form = disp ~ hp)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;map(df_m$m, plot)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in exists(deparse(data_expr)): first argument has length &amp;gt; 1&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;instead attach arguments individually&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;training_data &amp;lt;- function(name, df) {
  structure(
    list(
      name = stringr::str_trunc(name, width = 120)[[1]],
      cols = colnames(df),
      dim = dim(df)
    ),
    class = &amp;quot;train_data&amp;quot;
  )
}

match_training_data &amp;lt;- function(df, train_data) {
  
  stopifnot(is.data.frame(df))
  
  stopifnot(all(train_data$cols %in% colnames(df)))
  
  df &amp;lt;- df[, train_data$cols]
  
  stopifnot(all(dim(df) == train_data$dim))
  
  return(TRUE)
}

slope_model2 &amp;lt;- function(data, form) {
  
  y &amp;lt;- deparse(rlang::f_lhs(form))
  x &amp;lt;- deparse(rlang::f_rhs(form))
  data_name &amp;lt;- deparse(rlang::enexpr(data))
  
  train_data &amp;lt;- training_data(data_name, data[, c(x, y)])
  
  m &amp;lt;- lm(form, data)
  
  
  structure(
    list(
      slope = m$coefficients[[2]],
      intercept = m$coefficients[[1]],
      train_data = train_data,
      x = x,
      y = y
    ),
    class = &amp;quot;slope_model&amp;quot;
  )
}

plot.slope_model &amp;lt;- function(m, data = NULL) {
  stopifnot(inherits(m, &amp;quot;slope_model&amp;quot;))
  
  if (is.null(data) &amp;amp; exists(m$train_data$name)) {
    df_train &amp;lt;- eval(parse(text = m$train_data$name))
    match_training_data(df_train, m$train_data)
  } else if (! is.null(data)) {
    df_train &amp;lt;- data 
    match_training_data(df_train, m$train_data)
  } else {
    stop(&amp;quot;training data not found&amp;quot;)
  }
  
  ggplot(df_train, aes_string(m$x, m$y)) +
      geom_point() +
      geom_abline(slope = m$slope, intercept = m$intercept) +
      theme_minimal()
  
}


m &amp;lt;- slope_model2(mtcars, disp ~ hp)
str(m)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## List of 5
##  $ slope     : num 1.43
##  $ intercept : num 21
##  $ train_data:List of 3
##   ..$ name: chr &amp;quot;mtcars&amp;quot;
##   ..$ cols: chr [1:2] &amp;quot;hp&amp;quot; &amp;quot;disp&amp;quot;
##   ..$ dim : int [1:2] 32 2
##   ..- attr(*, &amp;quot;class&amp;quot;)= chr &amp;quot;train_data&amp;quot;
##  $ x         : chr &amp;quot;hp&amp;quot;
##  $ y         : chr &amp;quot;disp&amp;quot;
##  - attr(*, &amp;quot;class&amp;quot;)= chr &amp;quot;slope_model&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(m)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part2_files/figure-html/unnamed-chunk-34-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;check wrapper compatibility&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;wr_slope &amp;lt;- function(data, form) {
  slope_model2(data, form)
}

m &amp;lt;- wr_slope(mtcars, disp ~ hp)
str(m)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## List of 5
##  $ slope     : num 1.43
##  $ intercept : num 21
##  $ train_data:List of 3
##   ..$ name: chr &amp;quot;data&amp;quot;
##   ..$ cols: chr [1:2] &amp;quot;hp&amp;quot; &amp;quot;disp&amp;quot;
##   ..$ dim : int [1:2] 32 2
##   ..- attr(*, &amp;quot;class&amp;quot;)= chr &amp;quot;train_data&amp;quot;
##  $ x         : chr &amp;quot;hp&amp;quot;
##  $ y         : chr &amp;quot;disp&amp;quot;
##  - attr(*, &amp;quot;class&amp;quot;)= chr &amp;quot;slope_model&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(m)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in match_training_data(df_train, m$train_data): is.data.frame(df) is not TRUE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(m, mtcars)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part2_files/figure-html/unnamed-chunk-35-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;still need it&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;wr_slope2 &amp;lt;- function(data, form) {
  data &amp;lt;- enexpr(data)
  form &amp;lt;- enexpr(form)
  
  new_call &amp;lt;- expr(slope_model2(!!data, !!form))
  eval(new_call)
}

m &amp;lt;- wr_slope2(mtcars, disp ~ hp)
str(m)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## List of 5
##  $ slope     : num 1.43
##  $ intercept : num 21
##  $ train_data:List of 3
##   ..$ name: chr &amp;quot;mtcars&amp;quot;
##   ..$ cols: chr [1:2] &amp;quot;hp&amp;quot; &amp;quot;disp&amp;quot;
##   ..$ dim : int [1:2] 32 2
##   ..- attr(*, &amp;quot;class&amp;quot;)= chr &amp;quot;train_data&amp;quot;
##  $ x         : chr &amp;quot;hp&amp;quot;
##  $ y         : chr &amp;quot;disp&amp;quot;
##  - attr(*, &amp;quot;class&amp;quot;)= chr &amp;quot;slope_model&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(m)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part2_files/figure-html/unnamed-chunk-36-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;do.call&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;m &amp;lt;- do.call(slope_model2, list(mtcars, disp ~ hp))
str(m)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## List of 5
##  $ slope     : num 1.43
##  $ intercept : num 21
##  $ train_data:List of 3
##   ..$ name: chr &amp;quot;structure(list(mpg = c(21, 21, 22.8, 21.4, 18.7, 18.1, 14.3, &amp;quot;
##   ..$ cols: chr [1:2] &amp;quot;hp&amp;quot; &amp;quot;disp&amp;quot;
##   ..$ dim : int [1:2] 32 2
##   ..- attr(*, &amp;quot;class&amp;quot;)= chr &amp;quot;train_data&amp;quot;
##  $ x         : chr &amp;quot;hp&amp;quot;
##  $ y         : chr &amp;quot;disp&amp;quot;
##  - attr(*, &amp;quot;class&amp;quot;)= chr &amp;quot;slope_model&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(m)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in plot.slope_model(m): training data not found&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(m, mtcars)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part2_files/figure-html/unnamed-chunk-37-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;printing-r-code-for-ggplots-plots&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Printing R Code for ggplots Plots&lt;/h3&gt;
&lt;p&gt;we want to display the r code necessary to render a plot&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot_vars &amp;lt;- function(df, x, y, smooth = FALSE) {
    df &amp;lt;- enexpr(df)
    x &amp;lt;- enexpr(x)
    y &amp;lt;- enexpr(y)
    
    ex &amp;lt;- expr(
      ggplot(!!df, aes(!! x, !!y)) +
        geom_point()
    )
    
    if(smooth){
      ex &amp;lt;- expr(!! ex + geom_smooth())
    }
    
    return(ex)
}

ex &amp;lt;- plot_vars(mtcars, disp, hp)
cat(deparse(ex))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ggplot(mtcars, aes(disp, hp)) + geom_point()&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;eval(plot_vars(mtcars, disp, hp))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part2_files/figure-html/unnamed-chunk-38-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ex_smooth &amp;lt;- plot_vars(mtcars, disp, hp, smooth = TRUE)

cat(deparse(ex_smooth))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ggplot(mtcars, aes(disp, hp)) + geom_point() + geom_smooth()&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;eval(ex_smooth)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## `geom_smooth()` using method = &amp;#39;loess&amp;#39; and formula &amp;#39;y ~ x&amp;#39;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part2_files/figure-html/unnamed-chunk-38-2.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Advanced R - Notes (part1)</title>
      <link>https://www.datisticsblog.com/2021/10/advancedr/</link>
      <pubDate>Wed, 13 Oct 2021 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2021/10/advancedr/</guid>
      <description>
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/header-attrs/header-attrs.js&#34;&gt;&lt;/script&gt;

&lt;div id=&#34;TOC&#34;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#functions&#34;&gt;Functions&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#conventions-for-arguments-that-come-from-a-set-of-strings&#34;&gt;Conventions for arguments that come from a set of strings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#functions-to-investigate-functions&#34;&gt;Functions to Investigate Functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#get-all-functions-from-package&#34;&gt;Get all Functions from package&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#function-with-the-most-arguments&#34;&gt;Function with the most arguments&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#scoping&#34;&gt;Scoping&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#search-environment&#34;&gt;Search Environment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#list-unbound-global-variables&#34;&gt;List unbound global variables&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#lazy-evaluation-of-arguments&#34;&gt;Lazy Evaluation of Arguments&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#default-or-user-supplied-argument&#34;&gt;Default or User Supplied argument&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#capture-dot-dot-dot&#34;&gt;Capture dot dot dot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#exit-handler-on.exit&#34;&gt;Exit Handler &lt;code&gt;on.exit()&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#capture-output-capture.output&#34;&gt;Capture output &lt;code&gt;capture.output()&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#everything-that-happens-in-r-is-a-function-call&#34;&gt;Everything that happens in R is a function call&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#replacement-functions&#34;&gt;Replacement Functions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#environments&#34;&gt;Environments&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#create-a-parent-environment&#34;&gt;Create a parent environment&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#packages&#34;&gt;Packages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#package-functions&#34;&gt;Package Functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#callstacks&#34;&gt;Callstacks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#conditions&#34;&gt;Conditions&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#warnings&#34;&gt;Warnings&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#condition-objects&#34;&gt;Condition Objects&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#trycatch&#34;&gt;tryCatch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#withcallinghandlers&#34;&gt;withCallingHandlers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#custom-errors&#34;&gt;Custom Errors&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#functional-programming&#34;&gt;Functional Programming&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#functionals&#34;&gt;Functionals&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#purrrreduce&#34;&gt;purrr::reduce&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#purrraccumulate&#34;&gt;purrr::accumulate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#predicate-functional&#34;&gt;predicate functional&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#apply-and-friends&#34;&gt;apply() and friends&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#function-factories&#34;&gt;Function Factories&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#force&#34;&gt;force()&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#closures-stateful-functions&#34;&gt;Closures (Stateful functions)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#applications&#34;&gt;Applications&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#geom_histogram&#34;&gt;geom_histogram&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#geom_function-and-stat_function&#34;&gt;geom_function() and stat_function()&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#boxcox-transformation&#34;&gt;Boxcox Transformation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#bootstraping&#34;&gt;Bootstraping&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#maximum-likelihod-estimation&#34;&gt;Maximum Likelihod Estimation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#function-operators&#34;&gt;Function Operators&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#memoisememoise&#34;&gt;memoise::memoise()&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#oop&#34;&gt;OOP&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#s3&#34;&gt;S3&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#simaerep-example&#34;&gt;simaerep example&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#r6&#34;&gt;R6&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#s4&#34;&gt;S4&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#slots&#34;&gt;Slots&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#conventions&#34;&gt;Conventions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#multiple-inheritence&#34;&gt;Multiple Inheritence&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#multiple-dispatch&#34;&gt;Multiple dispatch&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#s4-vs-s3&#34;&gt;S4 vs S3&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;https://d33wubrfki0l68.cloudfront.net/565916198b0be51bf88b36f94b80c7ea67cafe7c/7f70b/cover.png&#34; style=&#34;width: 400px;height: 600px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Advanced R (Hadley Wickham).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;knitr::opts_chunk$set(error = TRUE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(library(rlang))
suppressPackageStartupMessages(library(lobstr))
suppressPackageStartupMessages(library(withr))
suppressPackageStartupMessages(library(glue))
# devtools::install_github(&amp;quot;openpharma/simaerep@v0.3.1&amp;quot;)
suppressPackageStartupMessages(library(simaerep))&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;functions&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Functions&lt;/h2&gt;
&lt;div id=&#34;conventions-for-arguments-that-come-from-a-set-of-strings&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Conventions for arguments that come from a set of strings&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;center &amp;lt;- function(x, type = c(&amp;quot;mean&amp;quot;, &amp;quot;median&amp;quot;, &amp;quot;trimmed&amp;quot;)) {
  type &amp;lt;- match.arg(type)
  switch(type,
         mean = mean(x),
         median = median(x),
         trimmed = mean(x, trim = .1))
}&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;functions-to-investigate-functions&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Functions to Investigate Functions&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;.f &amp;lt;- function(x,y){
  # Comment
  x + y
}
formals(.f) # returns arguments&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $x
## 
## 
## $y&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;body(.f) # returns body without comments&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## {
##     x + y
## }&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;environment(.f) &lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## &amp;lt;environment: R_GlobalEnv&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;attributes(.f)$srcref # returns body with commments&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## function(x,y){
##   # Comment
##   x + y
## }&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;get-all-functions-from-package&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Get all Functions from package&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;objs &amp;lt;- mget(ls(&amp;quot;package:base&amp;quot;, all = TRUE), inherits = TRUE)
funs &amp;lt;- Filter(is.function, objs)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;function-with-the-most-arguments&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Function with the most arguments&lt;/h3&gt;
&lt;p&gt;primitive base functions written in C are either of type “builtin” or “special”. &lt;code&gt;formals()&lt;/code&gt;, &lt;code&gt;body()&lt;/code&gt;and &lt;code&gt;environment()&lt;/code&gt; will return NULL for those functions.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df_funs &amp;lt;- tibble(funs = funs,
       names = names(funs) ) %&amp;gt;%
  mutate(formals = map(funs, formals),
         n_args = map_int(formals, length),
         type = map_chr(funs, typeof)) %&amp;gt;%
  arrange(desc(n_args))

df_funs&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## # A tibble: 1,323 × 5
##    funs         names            formals      n_args type   
##    &amp;lt;named list&amp;gt; &amp;lt;chr&amp;gt;            &amp;lt;named list&amp;gt;  &amp;lt;int&amp;gt; &amp;lt;chr&amp;gt;  
##  1 &amp;lt;fn&amp;gt;         scan             &amp;lt;pairlist&amp;gt;       22 closure
##  2 &amp;lt;fn&amp;gt;         format.default   &amp;lt;pairlist&amp;gt;       16 closure
##  3 &amp;lt;fn&amp;gt;         source           &amp;lt;pairlist&amp;gt;       16 closure
##  4 &amp;lt;fn&amp;gt;         formatC          &amp;lt;pairlist&amp;gt;       15 closure
##  5 &amp;lt;fn&amp;gt;         library          &amp;lt;pairlist&amp;gt;       13 closure
##  6 &amp;lt;fn&amp;gt;         merge.data.frame &amp;lt;pairlist&amp;gt;       13 closure
##  7 &amp;lt;fn&amp;gt;         prettyNum        &amp;lt;pairlist&amp;gt;       13 closure
##  8 &amp;lt;fn&amp;gt;         system2          &amp;lt;pairlist&amp;gt;       11 closure
##  9 &amp;lt;fn&amp;gt;         print.default    &amp;lt;pairlist&amp;gt;       10 closure
## 10 &amp;lt;fn&amp;gt;         save             &amp;lt;pairlist&amp;gt;       10 closure
## # … with 1,313 more rows&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df_funs %&amp;gt;%
  group_by(type, n_args == 0) %&amp;gt;%
  count()&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## # A tibble: 4 × 3
## # Groups:   type, n_args == 0 [4]
##   type    `n_args == 0`     n
##   &amp;lt;chr&amp;gt;   &amp;lt;lgl&amp;gt;         &amp;lt;int&amp;gt;
## 1 builtin TRUE            165
## 2 closure FALSE          1072
## 3 closure TRUE             47
## 4 special TRUE             39&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;scoping&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Scoping&lt;/h2&gt;
&lt;div id=&#34;search-environment&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Search Environment&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;my_string &amp;lt;- &amp;quot;hello world&amp;quot;

exists(&amp;quot;my_string&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] TRUE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;exists(&amp;quot;my_string_2&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] FALSE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;get0(&amp;quot;my_string&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;hello world&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;get0(&amp;quot;my_string_2&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## NULL&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ls() # get all variable names&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;center&amp;quot;    &amp;quot;df_funs&amp;quot;   &amp;quot;funs&amp;quot;      &amp;quot;my_string&amp;quot; &amp;quot;objs&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;list-unbound-global-variables&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;List unbound global variables&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;g12 &amp;lt;- function() x + 1
codetools::findGlobals(g12)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;+&amp;quot; &amp;quot;x&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;g13 &amp;lt;- function(x) x + 1
codetools::findGlobals(g13)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;+&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;lazy-evaluation-of-arguments&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Lazy Evaluation of Arguments&lt;/h3&gt;
&lt;p&gt;arguments even when given as expressions will only be evaluated when called in the function, these structures are called promises. So this works, surprisingly:&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;h04 &amp;lt;- function(x = 1, y = x * 2, z = a + b) {
  a &amp;lt;- 10
  b &amp;lt;- 100
  
  c(x, y, z)
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But only when supplied as default arguments not when user-supplied&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;h04(1, x * 2, a + b)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in h04(1, x * 2, a + b): object &amp;#39;x&amp;#39; not found&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;User-Supplied arguments are evaluated before they are passed to the function, that is why infix functions and operators such as &lt;code&gt;+&lt;/code&gt; and &lt;code&gt;%%&lt;/code&gt;are working.&lt;/p&gt;
&lt;p&gt;Default arguments are evaluated as promises only when they are called within the function.&lt;/p&gt;
&lt;p&gt;Reminder infix functions take two arguments, code that comes directly before and right after. User defined infix functions need to be defined like this with `&lt;code&gt;%name%&lt;/code&gt; &amp;lt;- function(lhs, rhs)`&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;x &amp;lt;- 1

!is.null(x) &amp;amp;&amp;amp; length(x) == 1 &amp;amp;&amp;amp; x &amp;gt; 0&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] TRUE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# in python we would need to put brackets around the logic statements
(!is.null(x)) &amp;amp;&amp;amp; (length(x) == 1) &amp;amp;&amp;amp; (x &amp;gt; 0)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] TRUE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;c(TRUE, FALSE) &amp;amp;&amp;amp; c(TRUE, FALSE) # evaluation stops at first element&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] TRUE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;c(TRUE, FALSE) &amp;amp; c(TRUE, FALSE) # all elements are pair-wise evaluated&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1]  TRUE FALSE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;FALSE &amp;amp;&amp;amp; NULL # evaluation stops after result is determined by first argument FALSE&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] FALSE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;FALSE || NULL # gives error because NULL needs to be evaluated for OR condition&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in FALSE || NULL: invalid &amp;#39;y&amp;#39; type in &amp;#39;x || y&amp;#39;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;FALSE &amp;amp; NULL # I would expect this to error too&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## logical(0)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;FALSE | NULL # this as well mmh&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## logical(0)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;default-or-user-supplied-argument&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Default or User Supplied argument&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;h06 &amp;lt;- function(x = 10) {
  is_default &amp;lt;- missing(x)
  return(is_default)
}

h06()&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] TRUE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;h06(10)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] FALSE&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;capture-dot-dot-dot&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Capture dot dot dot&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;i03 &amp;lt;- function(...) {
  list(first = ..1, third = ..3)
}
str(i03(1, 2, 3))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## List of 2
##  $ first: num 1
##  $ third: num 3&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;i04 &amp;lt;- function(...) {
  list(...)
}
str(i04(a = 1, b = 2))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## List of 2
##  $ a: num 1
##  $ b: num 2&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;exit-handler-on.exit&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Exit Handler &lt;code&gt;on.exit()&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;Always set add = TRUE when using on.exit(). If you don’t, each call to on.exit() will overwrite the previous exit handler. Even when only registering a single handler, it’s good practice to set add = TRUE so that you won’t get any unpleasant surprises if you later add more exit handlers.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;j06 &amp;lt;- function(x) {
  cat(&amp;quot;Hello\n&amp;quot;)
  on.exit(cat(&amp;quot;Goodbye!\n&amp;quot;), add = TRUE)
  
  if (x) {
    return(10)
  } else {
    stop(&amp;quot;Error&amp;quot;)
  }
}

j06(TRUE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Hello
## Goodbye!&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 10&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;j06(FALSE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Hello&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in j06(FALSE): Error&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Goodbye!&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Better than using &lt;code&gt;on.exit&lt;/code&gt; is actually to use functions of the &lt;code&gt;withr&lt;/code&gt; package that automatically provide cleanups for files and directories&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;capture-output-capture.output&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Capture output &lt;code&gt;capture.output()&lt;/code&gt;&lt;/h3&gt;
&lt;p&gt;also captures error messages&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;everything-that-happens-in-r-is-a-function-call&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Everything that happens in R is a function call&lt;/h3&gt;
&lt;p&gt;Almost everything can be rewritten as a function call&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;x + y&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in eval(expr, envir, enclos): object &amp;#39;y&amp;#39; not found&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;`+`(x, y)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in eval(expr, envir, enclos): object &amp;#39;y&amp;#39; not found&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;names(df) &amp;lt;- c(&amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in names(df) &amp;lt;- c(&amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot;): names() applied to a non-vector&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;`names&amp;lt;-`(df, c(&amp;quot;x&amp;quot;, &amp;quot;y&amp;quot;, &amp;quot;z&amp;quot;))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in eval(expr, envir, enclos): names() applied to a non-vector&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;for(i in 1:10) print(i)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 1
## [1] 2
## [1] 3
## [1] 4
## [1] 5
## [1] 6
## [1] 7
## [1] 8
## [1] 9
## [1] 10&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;`for`(i, 1:10, print(i))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 1
## [1] 2
## [1] 3
## [1] 4
## [1] 5
## [1] 6
## [1] 7
## [1] 8
## [1] 9
## [1] 10&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;replacement-functions&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Replacement Functions&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;`second&amp;lt;-` &amp;lt;- function(x, value) {
  x[2] &amp;lt;- value
  x
}

x &amp;lt;- 1:10
second(x) &amp;lt;- 5

x&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##  [1]  1  5  3  4  5  6  7  8  9 10&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;environments&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Environments&lt;/h2&gt;
&lt;p&gt;Generally, an environment is similar to a named list, with four important exceptions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Every name must be unique.&lt;/li&gt;
&lt;li&gt;The names in an environment are not ordered.&lt;/li&gt;
&lt;li&gt;An environment has a parent.&lt;/li&gt;
&lt;li&gt;Environments are not copied when modified.&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;e1 &amp;lt;- env(
  a = FALSE,
  b = &amp;quot;a&amp;quot;,
  c = 2.3,
  d = 1:3,
)

rlang::env_print(e1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## &amp;lt;environment: 0x7fd2d346bac0&amp;gt;
## parent: &amp;lt;environment: global&amp;gt;
## bindings:
##  * a: &amp;lt;lgl&amp;gt;
##  * b: &amp;lt;chr&amp;gt;
##  * c: &amp;lt;dbl&amp;gt;
##  * d: &amp;lt;int&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;rlang::env_names(e1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;a&amp;quot; &amp;quot;b&amp;quot; &amp;quot;c&amp;quot; &amp;quot;d&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;create-a-parent-environment&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Create a parent environment&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;e2 &amp;lt;- env(e1, letters = LETTERS)

rlang::env_parent(e2)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## &amp;lt;environment: 0x7fd2d346bac0&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;rlang::env_parents(e2)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [[1]]   &amp;lt;env: 0x7fd2d346bac0&amp;gt;
## [[2]] $ &amp;lt;env: global&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;packages&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Packages&lt;/h3&gt;
&lt;p&gt;Composition of the global environment&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;search()&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##  [1] &amp;quot;.GlobalEnv&amp;quot;        &amp;quot;package:simaerep&amp;quot;  &amp;quot;package:glue&amp;quot;     
##  [4] &amp;quot;package:withr&amp;quot;     &amp;quot;package:lobstr&amp;quot;    &amp;quot;package:rlang&amp;quot;    
##  [7] &amp;quot;package:forcats&amp;quot;   &amp;quot;package:stringr&amp;quot;   &amp;quot;package:dplyr&amp;quot;    
## [10] &amp;quot;package:purrr&amp;quot;     &amp;quot;package:readr&amp;quot;     &amp;quot;package:tidyr&amp;quot;    
## [13] &amp;quot;package:tibble&amp;quot;    &amp;quot;package:ggplot2&amp;quot;   &amp;quot;package:tidyverse&amp;quot;
## [16] &amp;quot;package:stats&amp;quot;     &amp;quot;package:graphics&amp;quot;  &amp;quot;package:grDevices&amp;quot;
## [19] &amp;quot;package:utils&amp;quot;     &amp;quot;package:datasets&amp;quot;  &amp;quot;package:methods&amp;quot;  
## [22] &amp;quot;Autoloads&amp;quot;         &amp;quot;package:base&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;rlang::search_envs()&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##  [[1]] $ &amp;lt;env: global&amp;gt;
##  [[2]] $ &amp;lt;env: package:simaerep&amp;gt;
##  [[3]] $ &amp;lt;env: package:glue&amp;gt;
##  [[4]] $ &amp;lt;env: package:withr&amp;gt;
##  [[5]] $ &amp;lt;env: package:lobstr&amp;gt;
##  [[6]] $ &amp;lt;env: package:rlang&amp;gt;
##  [[7]] $ &amp;lt;env: package:forcats&amp;gt;
##  [[8]] $ &amp;lt;env: package:stringr&amp;gt;
##  [[9]] $ &amp;lt;env: package:dplyr&amp;gt;
## [[10]] $ &amp;lt;env: package:purrr&amp;gt;
## [[11]] $ &amp;lt;env: package:readr&amp;gt;
## [[12]] $ &amp;lt;env: package:tidyr&amp;gt;
## [[13]] $ &amp;lt;env: package:tibble&amp;gt;
## [[14]] $ &amp;lt;env: package:ggplot2&amp;gt;
## [[15]] $ &amp;lt;env: package:tidyverse&amp;gt;
## [[16]] $ &amp;lt;env: package:stats&amp;gt;
## [[17]] $ &amp;lt;env: package:graphics&amp;gt;
## [[18]] $ &amp;lt;env: package:grDevices&amp;gt;
## [[19]] $ &amp;lt;env: package:utils&amp;gt;
## [[20]] $ &amp;lt;env: package:datasets&amp;gt;
## ... and 3 more environments&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;package-functions&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Package Functions&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;passively bound by one environment (where they can be called from)&lt;/li&gt;
&lt;li&gt;actively bind one environment (which they use to make their calls)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;for regular functions both environments are the same. For functions loaded from packages the bind environment is defined by the package namespace created from the package NAMESPACE file. Like this they are not affected by overrides in the execution environment.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;callstacks&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Callstacks&lt;/h3&gt;
&lt;p&gt;use &lt;code&gt;lobstr::cst()&lt;/code&gt; in a similar way to &lt;code&gt;traceback()&lt;/code&gt; to visualise the callstack.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;f &amp;lt;- function(x) {
  g(x = 2)
}
g &amp;lt;- function(x) {
  h(x = 3)
}
h &amp;lt;- function(x) {
  stop()
}

f(x = 1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in h(x = 3):&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;traceback()&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## No traceback available&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;h &amp;lt;- function(x) {
  lobstr::cst()
  print(&amp;quot;do I get executed =&amp;quot;)
}

f(x = 1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##     █
##  1. └─global::f(x = 1)
##  2.   └─global::g(x = 2)
##  3.     └─global::h(x = 3)
##  4.       └─lobstr::cst()
## [1] &amp;quot;do I get executed =&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;conditions&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Conditions&lt;/h2&gt;
&lt;div id=&#34;warnings&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Warnings&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;give_warning &amp;lt;- function() {
  warning(&amp;quot;You have been warned&amp;quot;)
}

withr::with_options(list(warn = 1), give_warning()) # causes warning to appear immediately&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Warning in give_warning(): You have been warned&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;withr::with_options(list(warn = 2), give_warning()) # convert warning to error&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in give_warning(): (converted from warning) You have been warned&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;condition-objects&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Condition Objects&lt;/h3&gt;
&lt;p&gt;conditions such as messages, warnings and errors are objects&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;cnd &amp;lt;- rlang::catch_cnd(stop(&amp;quot;An error&amp;quot;))
str(cnd)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## List of 2
##  $ message: chr &amp;quot;An error&amp;quot;
##  $ call   : language force(expr)
##  - attr(*, &amp;quot;class&amp;quot;)= chr [1:3] &amp;quot;simpleError&amp;quot; &amp;quot;error&amp;quot; &amp;quot;condition&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;trycatch&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;tryCatch&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;tryCatch&lt;/code&gt; executes code and has arguments for different types of condition objects. Each arguments takes a function with a single condition object argument.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;try_me &amp;lt;- function(expr) {
    tryCatch(
      error = function(cnd) print(&amp;quot;error&amp;quot;),
      warning = function(cnd) print(&amp;quot;warning&amp;quot;),
      message = function(cnd) print(&amp;quot;message&amp;quot;),
      finally = print(&amp;quot;finished&amp;quot;),
      expr
  )
}

try_me(stop(&amp;quot;hello&amp;quot;))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;error&amp;quot;
## [1] &amp;quot;finished&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;try_me(warning(&amp;quot;hello&amp;quot;))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;warning&amp;quot;
## [1] &amp;quot;finished&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;try_me(message(&amp;quot;hello&amp;quot;))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;message&amp;quot;
## [1] &amp;quot;finished&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;variable assignments within trycatch are not passed to parent env&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;if(exists(&amp;quot;res&amp;quot;)) remove(res)
tryCatch(
  warning = function(cnd) res &amp;lt;- 0,
  res &amp;lt;- log(-1)
)
exists(&amp;quot;res&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] FALSE&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;this does not work because user-defined arguments are evaluated on the spot, so alternative expression always gets evaluated&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;try_me3 &amp;lt;- function(expr, expr_alt) {
    tryCatch(
      warning = function(cnd) expr_alt,
      expr
  )
}

try_me3(res &amp;lt;- log(-1), res &amp;lt;- 0)
res&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 0&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;try_me3(res &amp;lt;- log(1), res &amp;lt;- 0)
res&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 0&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;tryCatch returns last value which can be assigned inside the active env&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;if(exists(&amp;quot;res&amp;quot;)) remove(res)
res &amp;lt;- tryCatch(
  warning = function(cnd) 0,
  log(-1)
)

res&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 0&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;withcallinghandlers&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;withCallingHandlers&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;withCallingHandlers&lt;/code&gt; still executes the condition, while &lt;code&gt;tryCatch&lt;/code&gt; muffles them.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;try_me &amp;lt;- function(expr) {
    withCallingHandlers(
      error = function(cnd) print(&amp;quot;error&amp;quot;),
      warning = function(cnd) print(&amp;quot;warning&amp;quot;),
      message = function(cnd) print(&amp;quot;message&amp;quot;),
      finally = print(&amp;quot;finished&amp;quot;),
      expr
  )
}

try_me(stop(&amp;quot;hello&amp;quot;))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;finished&amp;quot;
## [1] &amp;quot;error&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in withCallingHandlers(error = function(cnd) print(&amp;quot;error&amp;quot;), warning = function(cnd) print(&amp;quot;warning&amp;quot;), : hello&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;try_me(warning(&amp;quot;hello&amp;quot;))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;finished&amp;quot;
## [1] &amp;quot;warning&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Warning in withCallingHandlers(error = function(cnd) print(&amp;quot;error&amp;quot;), warning =
## function(cnd) print(&amp;quot;warning&amp;quot;), : hello&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;try_me(message(&amp;quot;hello&amp;quot;))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;finished&amp;quot;
## [1] &amp;quot;message&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## hello&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;custom-errors&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Custom Errors&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;reuse check function to supply consistent error messages&lt;/li&gt;
&lt;li&gt;catch and handle different types of errors&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;We start by defining a custom error Class&lt;/p&gt;
&lt;p&gt;We cannot execute the code chunk below because Rmarkdown is not compatible with custom errors&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;stop_custom &amp;lt;- function(.subclass, message, ...) {
  err &amp;lt;- structure(
    list(
      message = message,
      call = call,
      ...
    ),
    class = c(.subclass, &amp;quot;error&amp;quot;, &amp;quot;condition&amp;quot;)
  )
  stop(err)
}

stop_custom(&amp;quot;error_new&amp;quot;, &amp;quot;This is a custom error&amp;quot;, x = 10)

err &amp;lt;- rlang::catch_cnd(
  stop_custom(&amp;quot;error_new&amp;quot;, &amp;quot;This is a custom error&amp;quot;, x = 10)
)

class(err)
# we can supply additional arguments that will be attached as attributes
err$x
str(err)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We can then use this new class for creating customized errors&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;abort_bad_argument &amp;lt;- function(arg, must, not = NULL) {
  msg &amp;lt;- glue::glue(&amp;quot;`{arg}` must be {must}&amp;quot;)
  if (!is.null(not)) {
    not &amp;lt;- typeof(not)
    msg &amp;lt;- glue::glue(&amp;quot;{msg}; not {not}.&amp;quot;)
  }
  
  stop_custom(&amp;quot;error_bad_argument&amp;quot;, 
    message = msg, 
    arg = arg, 
    must = must, 
    not = not
  )
}

abort_bad_argument(&amp;quot;key&amp;quot;, &amp;quot;numeric&amp;quot;, &amp;quot;ABC&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in stop_custom(&amp;quot;error_bad_argument&amp;quot;, message = msg, arg = arg, must = must, : could not find function &amp;quot;stop_custom&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We can then chose to handle those errors specifically&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;mylog &amp;lt;- function(x) {
  if(! is.numeric(x)) abort_bad_argument(&amp;quot;x&amp;quot;, &amp;quot;numeric&amp;quot;, x)
  return(log(x))
}

mylog(1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 0&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;mylog(&amp;quot;A&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in stop_custom(&amp;quot;error_bad_argument&amp;quot;, message = msg, arg = arg, must = must, : could not find function &amp;quot;stop_custom&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;tryCatch(
  error_bad_argument = function(cnd) NULL,
  mylog(&amp;quot;A&amp;quot;)
)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in stop_custom(&amp;quot;error_bad_argument&amp;quot;, message = msg, arg = arg, must = must, : could not find function &amp;quot;stop_custom&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;tryCatch(
  error_bad_argument = function(cnd) NULL,
  stop()
)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in doTryCatch(return(expr), name, parentenv, handler):&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;functional-programming&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Functional Programming&lt;/h1&gt;
&lt;div id=&#34;functionals&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Functionals&lt;/h2&gt;
&lt;div id=&#34;purrrreduce&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;purrr::reduce&lt;/h3&gt;
&lt;p&gt;used to apply a function with two arguments to a stack o items by executing on the first to items and saving the result for the next function call to apply with the next item in line.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;purrr::reduce(LETTERS, paste0)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;finding an intersection or union&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;l &amp;lt;- purrr::map(1:4, ~ sample(1:10, 15, replace = T))
str(l)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## List of 4
##  $ : int [1:15] 5 5 1 9 6 9 1 8 4 4 ...
##  $ : int [1:15] 7 3 4 5 2 6 5 9 9 8 ...
##  $ : int [1:15] 1 3 3 7 1 8 10 1 4 10 ...
##  $ : int [1:15] 8 7 7 7 5 6 5 8 5 7 ...&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;purrr::reduce(l, intersect)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 8 4 2&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;purrr::reduce(l, union)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##  [1]  5  1  9  6  8  4  2  7  3 10&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;adding up numbers&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;purrr::reduce(c(1, 2, 3), `+`)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 6&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;purrraccumulate&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;purrr::accumulate&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;purrr::accumulate(LETTERS, paste0)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##  [1] &amp;quot;A&amp;quot;                          &amp;quot;AB&amp;quot;                        
##  [3] &amp;quot;ABC&amp;quot;                        &amp;quot;ABCD&amp;quot;                      
##  [5] &amp;quot;ABCDE&amp;quot;                      &amp;quot;ABCDEF&amp;quot;                    
##  [7] &amp;quot;ABCDEFG&amp;quot;                    &amp;quot;ABCDEFGH&amp;quot;                  
##  [9] &amp;quot;ABCDEFGHI&amp;quot;                  &amp;quot;ABCDEFGHIJ&amp;quot;                
## [11] &amp;quot;ABCDEFGHIJK&amp;quot;                &amp;quot;ABCDEFGHIJKL&amp;quot;              
## [13] &amp;quot;ABCDEFGHIJKLM&amp;quot;              &amp;quot;ABCDEFGHIJKLMN&amp;quot;            
## [15] &amp;quot;ABCDEFGHIJKLMNO&amp;quot;            &amp;quot;ABCDEFGHIJKLMNOP&amp;quot;          
## [17] &amp;quot;ABCDEFGHIJKLMNOPQ&amp;quot;          &amp;quot;ABCDEFGHIJKLMNOPQR&amp;quot;        
## [19] &amp;quot;ABCDEFGHIJKLMNOPQRS&amp;quot;        &amp;quot;ABCDEFGHIJKLMNOPQRST&amp;quot;      
## [21] &amp;quot;ABCDEFGHIJKLMNOPQRSTU&amp;quot;      &amp;quot;ABCDEFGHIJKLMNOPQRSTUV&amp;quot;    
## [23] &amp;quot;ABCDEFGHIJKLMNOPQRSTUVW&amp;quot;    &amp;quot;ABCDEFGHIJKLMNOPQRSTUVWX&amp;quot;  
## [25] &amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXY&amp;quot;  &amp;quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;predicate-functional&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;predicate functional&lt;/h3&gt;
&lt;p&gt;purr has only some of those&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;any(LETTERS == &amp;quot;A&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] TRUE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;any(as.list(LETTERS) == &amp;quot;A&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] TRUE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;purrr::some(LETTERS, ~ . == &amp;quot;A&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] TRUE&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;is.na&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;is.na&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;is.na()&lt;/code&gt; is not a predicate function because it is vectorized while &lt;code&gt;anyNA&lt;/code&gt; is.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;is.na(c(NA, 1))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1]  TRUE FALSE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;anyNA(c(NA, 1))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] TRUE&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;apply-and-friends&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;apply() and friends&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;vapply()&lt;/code&gt; uses and returns vectors&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sapply()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ls &amp;lt;- list(a = c(1, 2, 3), b = c(TRUE, FALSE, TRUE, FALSE))
vs &amp;lt;- c(&amp;quot;do&amp;quot;, &amp;quot;not&amp;quot;, &amp;quot;leak&amp;quot;)
cl &amp;lt;- structure(ls, class = &amp;quot;apply_test&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;purrr::map()&lt;/code&gt; is similar to &lt;code&gt;base::lapply()&lt;/code&gt; which uses lists as in and output.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;purrr::map(ls, sum)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $a
## [1] 6
## 
## $b
## [1] 2&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;purrr::map(vs, str_length)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [[1]]
## [1] 2
## 
## [[2]]
## [1] 3
## 
## [[3]]
## [1] 4&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;purrr::map(ls, sum)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $a
## [1] 6
## 
## $b
## [1] 2&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;lapply(ls, sum)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $a
## [1] 6
## 
## $b
## [1] 2&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;lapply(vs, str_length)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [[1]]
## [1] 2
## 
## [[2]]
## [1] 3
## 
## [[3]]
## [1] 4&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;lapply(cl, sum)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $a
## [1] 6
## 
## $b
## [1] 2&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;sapply()&lt;/code&gt; is more flexible and returns vectors if possible&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sapply(ls, sum)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## a b 
## 6 2&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sapply(vs, str_length)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##   do  not leak 
##    2    3    4&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sapply(cl, sum)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## a b 
## 6 2&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;vapply()&lt;/code&gt; is similar to &lt;code&gt;sapply()&lt;/code&gt; requires a FUN.Value argument to set requirements for the output.&lt;/p&gt;
&lt;p&gt;It compares the length and type of the FUN.Value argument with the output.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;vapply(ls, sum)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in vapply(ls, sum): argument &amp;quot;FUN.VALUE&amp;quot; is missing, with no default&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;vapply(ls, sum, FUN.VALUE = integer(1))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in vapply(ls, sum, FUN.VALUE = integer(1)): values must be type &amp;#39;integer&amp;#39;,
##  but FUN(X[[1]]) result is type &amp;#39;double&amp;#39;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;vapply(ls, sum, FUN.VALUE = double(1))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## a b 
## 6 2&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;vapply(ls, sum, FUN.VALUE = double(2))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in vapply(ls, sum, FUN.VALUE = double(2)): values must be length 2,
##  but FUN(X[[1]]) result is length 1&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;vapply(ls, sum, FUN.VALUE = c(c = 8))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## a b 
## 6 2&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;vapply(ls, sum, FUN.VALUE = &amp;quot;hello&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in vapply(ls, sum, FUN.VALUE = &amp;quot;hello&amp;quot;): values must be type &amp;#39;character&amp;#39;,
##  but FUN(X[[1]]) result is type &amp;#39;double&amp;#39;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;vapply(vs, str_length, 9999)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##   do  not leak 
##    2    3    4&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;vapply(cl, sum, 1)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## a b 
## 6 2&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;sapply()&lt;/code&gt; can also return a matrix&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;i39 &amp;lt;- sapply(3:9, seq)
i39&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [[1]]
## [1] 1 2 3
## 
## [[2]]
## [1] 1 2 3 4
## 
## [[3]]
## [1] 1 2 3 4 5
## 
## [[4]]
## [1] 1 2 3 4 5 6
## 
## [[5]]
## [1] 1 2 3 4 5 6 7
## 
## [[6]]
## [1] 1 2 3 4 5 6 7 8
## 
## [[7]]
## [1] 1 2 3 4 5 6 7 8 9&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# fivenum returns boxcox stats
x &amp;lt;- fivenum(i39[[1]])

vapply(vs, str_length)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in vapply(vs, str_length): argument &amp;quot;FUN.VALUE&amp;quot; is missing, with no default&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;vapply(cl, sum)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in vapply(cl, sum): argument &amp;quot;FUN.VALUE&amp;quot; is missing, with no default&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;lapply(i39, fivenum)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [[1]]
## [1] 1.0 1.5 2.0 2.5 3.0
## 
## [[2]]
## [1] 1.0 1.5 2.5 3.5 4.0
## 
## [[3]]
## [1] 1 2 3 4 5
## 
## [[4]]
## [1] 1.0 2.0 3.5 5.0 6.0
## 
## [[5]]
## [1] 1.0 2.5 4.0 5.5 7.0
## 
## [[6]]
## [1] 1.0 2.5 4.5 6.5 8.0
## 
## [[7]]
## [1] 1 3 5 7 9&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sapply(i39, fivenum)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##      [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## [1,]  1.0  1.0    1  1.0  1.0  1.0    1
## [2,]  1.5  1.5    2  2.0  2.5  2.5    3
## [3,]  2.0  2.5    3  3.5  4.0  4.5    5
## [4,]  2.5  3.5    4  5.0  5.5  6.5    7
## [5,]  3.0  4.0    5  6.0  7.0  8.0    9&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;vapply()&lt;/code&gt; can add row_names&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;vapply(i39, fivenum,
       c(Min. = 0, &amp;quot;1st Qu.&amp;quot; = 0, Median = 0, &amp;quot;3rd Qu.&amp;quot; = 0, Max. = 0))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##         [,1] [,2] [,3] [,4] [,5] [,6] [,7]
## Min.     1.0  1.0    1  1.0  1.0  1.0    1
## 1st Qu.  1.5  1.5    2  2.0  2.5  2.5    3
## Median   2.0  2.5    3  3.5  4.0  4.5    5
## 3rd Qu.  2.5  3.5    4  5.0  5.5  6.5    7
## Max.     3.0  4.0    5  6.0  7.0  8.0    9&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;vapply(i39, fivenum,
       c(Min. = 0, &amp;quot;1st Qu.&amp;quot; = 0, Median = 0, &amp;quot;3rd Qu.&amp;quot; = 0))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in vapply(i39, fivenum, c(Min. = 0, `1st Qu.` = 0, Median = 0, `3rd Qu.` = 0)): values must be length 4,
##  but FUN(X[[1]]) result is length 5&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;function-factories&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Function Factories&lt;/h2&gt;
&lt;p&gt;Functions that return other functions. Those functions are not garbage collectd and need to be deleted manually.&lt;/p&gt;
&lt;div id=&#34;force&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;force()&lt;/h3&gt;
&lt;p&gt;The expression are evaluated lazily thus when x changes the function does not behave as expected.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;power &amp;lt;- function(exp) {
  function(x) {
    x ^ exp
  }
}

x &amp;lt;- 2
square &amp;lt;- power(x)
x &amp;lt;- 3
square(2)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 8&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;always use &lt;code&gt;force()&lt;/code&gt; when creating function factories&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;power2 &amp;lt;- function(exp) {
  force(exp)
  function(x) {
    x ^ exp
  }
}

x &amp;lt;- 2
square &amp;lt;- power2(x)
x &amp;lt;- 3
square(2)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 4&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;closures-stateful-functions&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Closures (Stateful functions)&lt;/h3&gt;
&lt;p&gt;not recommended in R&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;storer &amp;lt;- function(){
  store_var &amp;lt;- 5
  function() store_var
}
storage &amp;lt;- storer()
storage()&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 5&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;exists(&amp;quot;store_var&amp;quot;, envir = rlang::current_env())&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] FALSE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;exists(&amp;quot;store_var&amp;quot;, envir = environment(storage))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] TRUE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;make_counter &amp;lt;- function(){
  count_var &amp;lt;- 0
  function() {
    count_var &amp;lt;&amp;lt;- count_var + 1 # &amp;lt;&amp;lt;- passes the assignment to parent environment where it is preserved via the binding
    count_var
  }
}
counter &amp;lt;- make_counter()
exists(&amp;quot;count_var&amp;quot;, envir = rlang::current_env())&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] FALSE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;exists(&amp;quot;count_var&amp;quot;, envir = environment(counter))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] TRUE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;counter()&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 1&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;counter()&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 2&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;counter()&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 3&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;counter()&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 4&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;applications&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Applications&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;stats::approxfun()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;stats::ecdf()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;scales::comma_format()&lt;/code&gt; and other &lt;code&gt;scales&lt;/code&gt; functions&lt;/li&gt;
&lt;li&gt;&lt;code&gt;geom_histogram()&lt;/code&gt; binwidth argument (see below)&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://adv-r.hadley.nz/function-factories.html#ggsave&#34;&gt;harmonising input arguments of similar functions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Box-Cox Transformation (see below)&lt;/li&gt;
&lt;li&gt;Bootstrap Resampling (see below)&lt;/li&gt;
&lt;li&gt;Maximum Likelihood Estimation (see below)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;geom_histogram&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;geom_histogram&lt;/h3&gt;
&lt;p&gt;same number of observations with different sd will give a different number of bins in each facet.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sd &amp;lt;- c(1, 5, 15)
n &amp;lt;- 100

df &amp;lt;- data.frame(x = rnorm(3 * n, sd = sd), sd = rep(sd, n))

head(df)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##            x sd
## 1  0.8702774  1
## 2  4.2134232  5
## 3 -9.6693749 15
## 4 -0.5572895  1
## 5 -2.0192570  5
## 6 10.4718642 15&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ggplot(df, aes(x)) + 
  geom_histogram(binwidth = 2) + 
  facet_wrap(~ sd, scales = &amp;quot;free_x&amp;quot;) + 
  labs(x = NULL)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part1_files/figure-html/unnamed-chunk-46-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;In order to fix the number of bins per facet we can pass a function instead.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;binwidth_bins &amp;lt;- function(n) {
  force(n)
  
  function(x) {
    (max(x) - min(x)) / n
  }
}

ggplot(df, aes(x)) + 
  geom_histogram(binwidth = binwidth_bins(20)) + 
  facet_wrap(~ sd, scales = &amp;quot;free_x&amp;quot;) + 
  labs(x = NULL)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part1_files/figure-html/unnamed-chunk-47-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;geom_function-and-stat_function&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;geom_function() and stat_function()&lt;/h3&gt;
&lt;p&gt;in ggplot2 &lt;code&gt;stat_function()&lt;/code&gt; and &lt;code&gt;geom_function()&lt;/code&gt; allow you to plot a function that returns y of a given x values.&lt;/p&gt;
&lt;p&gt;Here the density derived from 100 samples from a normal distribution vs the actual normal density function.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ggplot(data.frame(x = rnorm(100)), aes(x)) +
  geom_density() +
  geom_function(fun = dnorm, colour = &amp;quot;red&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part1_files/figure-html/unnamed-chunk-48-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;or using &lt;code&gt;statfunction()&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ggplot(data.frame(x = rnorm(100)), aes(x)) +
  geom_density() +
  stat_function(fun = dnorm, geom = &amp;quot;line&amp;quot;, colour = &amp;quot;red&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part1_files/figure-html/unnamed-chunk-49-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;function only&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ggplot() +
  stat_function(fun = dnorm, geom = &amp;quot;line&amp;quot;, colour = &amp;quot;red&amp;quot;) +
  lims(x = c(-3, +3))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part1_files/figure-html/unnamed-chunk-50-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;boxcox-transformation&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Boxcox Transformation&lt;/h3&gt;
&lt;p&gt;boxcox transformation is a power transformation that is used to convert non normal distributed values to a normal distribution. The degree of the transformation is defined by an unspecified lambda. For lambda == 0 it results in a log(x) transformation.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;boxcox1 &amp;lt;- function(x, lambda) {
  if (lambda == 0) {
    log(x)
  } else {
    (x ^ lambda - 1) / lambda
  }
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;in order to plot boxcox transformations for different lambdas we need to generate a function that takes only one x argument.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;boxcox2 &amp;lt;- function(lambda) {
  if (lambda == 0) {
    function(x) log(x)
  } else {
    function(x) (x ^ lambda - 1) / lambda
  }
}

ggplot() +
  geom_function(aes(colour = 0), fun = boxcox2(0)) +
  geom_function(aes(colour = 1), fun = boxcox2(1)) +
  geom_function(aes(colour = 1.5), fun = boxcox2(1.5)) +
  lims(x = c(0, 10))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part1_files/figure-html/unnamed-chunk-52-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;we can wrap the geom calls into another function and use &lt;code&gt;lapply()&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;geoms_boxcox &amp;lt;- function(lambda, ...) {
  geom_function(aes(colour = lambda), fun = boxcox2(lambda), ...)
}

ggplot() +
  lapply(c(0, 1, 1.5), geoms_boxcox) +
  lims(x = c(0, 10))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part1_files/figure-html/unnamed-chunk-53-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;bootstraping&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Bootstraping&lt;/h3&gt;
&lt;p&gt;bootstrap resampling to permute columns in a dataframe&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;boot_permute &amp;lt;- function(df, var) {
  n &amp;lt;- nrow(df)
  force(var)
  
  function() {
    col &amp;lt;- df[[var]]
    col[sample(n, replace = TRUE)]
  }
}

boot_mtcars1 &amp;lt;- boot_permute(mtcars, &amp;quot;mpg&amp;quot;)
head(boot_mtcars1())&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 32.4 32.4 24.4 33.9 21.4 21.5&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;head(boot_mtcars1())&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 26.0 13.3 15.0 17.3 15.2 15.5&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Imagine we would want to resample residuals of a model in order to bootstrap error statistics&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;mod &amp;lt;- lm(mpg ~ wt + disp, data = mtcars)
# fitted returns fitted values, same as predict without newdata argument
fitted &amp;lt;- unname(fitted(mod))
pred &amp;lt;- unname(predict(mod))
stopifnot(identical(round(fitted, 6), round(pred, 6)))

resid &amp;lt;- unname(resid(mod))
head(resid)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] -2.345433 -1.490972 -2.472367  1.785333  1.647193 -1.278631&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;boot_resid &amp;lt;- boot_permute(tibble(resid = resid), &amp;quot;resid&amp;quot;)
head(boot_resid())&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] -2.472367 -3.408680  6.348440  2.192792 -2.862147 -2.317052&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;head(boot_resid())&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1]  1.3973583 -2.1005656  0.8901898 -0.2734911 -2.4723669 -2.0291802&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;we can refactor, and remove the model fitting into the factory.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;boot_model &amp;lt;- function(df, formula) {
  mod &amp;lt;- lm(formula, data = df)
  resid &amp;lt;- unname(resid(mod))
  # remove the model to save memory
  rm(mod)

  function() {
    sample(resid, size = length(resid), replace = TRUE)
  }
} 

boot_mtcars2 &amp;lt;- boot_model(mtcars, mpg ~ wt + disp)
head(boot_mtcars2())&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1]  2.728799  2.192792  2.728799  6.348440 -2.317200 -1.278631&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;head(boot_mtcars2())&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] -2.47236688 -0.03421046  0.89018976  2.19486787 -2.31719966  0.22354778&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;maximum-likelihod-estimation&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Maximum Likelihod Estimation&lt;/h3&gt;
&lt;p&gt;find the parameter of a distribution that fits some observed values&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;lprob_poisson &amp;lt;- function(lambda, x) {
  n &amp;lt;- length(x)
  (log(lambda) * sum(x)) - (n * lambda) - sum(lfactorial(x))
}

obs &amp;lt;- c(41, 30, 31, 38, 29, 24, 30, 29, 31, 38)

lprob_poisson(10, obs)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] -183.6405&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;lprob_poisson(20, obs)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] -61.14028&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;lprob_poisson(30, obs)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] -30.98598&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the term &lt;code&gt;sum(lfactorial(x)&lt;/code&gt; is independent of lambda and can be precomputed to optimise the calculation&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;c &amp;lt;- sum(lfactorial(x))

lprob_poisson1 &amp;lt;- function(lambda, x, c) {
  n &amp;lt;- length(x)
  (log(lambda) * sum(x)) - (n * lambda) - c
}

lprob_poisson(10, obs)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] -183.6405&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;we can also move x and c into the function&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;lprob_poisson2 &amp;lt;- function(x) {
  
  # we do not need to force(x)
  # since it is not used by the 
  # returned function
  n &amp;lt;-length(x)
  c &amp;lt;- sum(lfactorial(x))
  sum_x &amp;lt;- sum(x)
  
  function(lambda) {
    (log(lambda) * sum_x) - (n * lambda) - c
  }
}

ll1 &amp;lt;- lprob_poisson2(obs)
ll1(10)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] -183.6405&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;we can use &lt;code&gt;optimise&lt;/code&gt; to find the best value&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;optimise(f = ll1, interval = c(0, 100), maximum = TRUE)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $maximum
## [1] 32.09999
## 
## $objective
## [1] -30.26755&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;function-operators&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Function Operators&lt;/h2&gt;
&lt;p&gt;Functions that take a function as an argument and return a modfified function.
Are called decorators in python.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;purrr::safely()&lt;/code&gt; and friends&lt;/li&gt;
&lt;li&gt;&lt;code&gt;memoise::memoise()&lt;/code&gt; (see below)&lt;/li&gt;
&lt;li&gt;any reusable wrapper, for example one that automatically retries a give function on failure&lt;/li&gt;
&lt;/ul&gt;
&lt;div id=&#34;memoisememoise&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;memoise::memoise()&lt;/h3&gt;
&lt;p&gt;caching the results of a slow function when executed again with the same arguments&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;slow_function &amp;lt;- function(x) {
  Sys.sleep(1)
  x * 10 * runif(1)
}

# different results
system.time(print(slow_function(1)))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 3.095154&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##    user  system elapsed 
##   0.001   0.000   1.004&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;system.time(print(slow_function(1)))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 9.585923&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##    user  system elapsed 
##   0.004   0.000   1.008&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;fast_function &amp;lt;- memoise::memoise(slow_function)

# same results because cached result is returned
system.time(print(fast_function(1)))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 1.817053&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##    user  system elapsed 
##   0.001   0.000   1.003&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;system.time(print(fast_function(1)))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 1.817053&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##    user  system elapsed 
##   0.022   0.000   0.022&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# different result because argument has changed
system.time(print(fast_function(2)))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 6.450071&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##    user  system elapsed 
##       0       0       1&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;recursion&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Recursion&lt;/h4&gt;
&lt;p&gt;a classical example for recursive functions is the fibinacci sequence&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;fib &amp;lt;- function(n) {
  if (n &amp;lt; 2) return(1)
  fib(n - 2) + fib(n - 1)
}
system.time(print(fib(23)))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 46368&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##    user  system elapsed 
##   0.050   0.002   0.052&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;system.time(print(fib(33)))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 5702887&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##    user  system elapsed 
##   5.056   0.050   5.138&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;memoise::memoise() will cache the results&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;fib2 &amp;lt;- memoise::memoise(function(n) {
  if (n &amp;lt; 2) return(1)
  fib2(n - 2) + fib2(n - 1)
})

system.time(fib2(23))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##    user  system elapsed 
##   0.009   0.000   0.010&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;system.time(fib2(33))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##    user  system elapsed 
##   0.003   0.000   0.003&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;oop&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;OOP&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;encapsulated&lt;/strong&gt; OOP &lt;code&gt;object.method(arg1, arg2)&lt;/code&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;functional&lt;/strong&gt; OOP &lt;code&gt;generic(object, arg1, arg2)&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div id=&#34;s3&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;S3&lt;/h2&gt;
&lt;p&gt;Functional OOP framework that is most commonly used in R.&lt;/p&gt;
&lt;p&gt;There are very few constrictions for creating S3 classes but some conventions.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;create a low-level constructor that creates objects with the right structure called &lt;code&gt;new_myclass()&lt;/code&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;a validator that performs computationally expensive checks, called &lt;code&gt;validate_myclass()&lt;/code&gt;&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;a user-friendly helper called &lt;code&gt;myclass()&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div id=&#34;simaerep-example&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;simaerep example&lt;/h3&gt;
&lt;p&gt;the &lt;code&gt;simaerep v0.3.1&lt;/code&gt; package currently performs a sequence of operations on a dataframe. Each operations requires a different function that takes a data.frame and returns a modified version. We could simplify the interface for the users by grouping all those operations using S3 classes.&lt;/p&gt;
&lt;p&gt;There is no function wrapping the entire workflow because we want intermediary results to be accessible and visible. By convention a function returns only one object which would then only return the final dataframe df_eval. Then we would loose df_site and df_sim_sites for plotting and inspection.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Advantages:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;simplified user interface&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;input checks only need to run once&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;preserve intermediary results as class attributes&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# devtools::install_github(&amp;quot;openpharma/simaerep@v0.3.1&amp;quot;)

suppressPackageStartupMessages(library(&amp;quot;simaerep&amp;quot;))

set.seed(1)

df_visit &amp;lt;- sim_test_data_study(
  n_pat = 1000, # number of patients in study
  n_sites = 100, # number of sites in study
  frac_site_with_ur = 0.05, # fraction of sites under-reporting
  ur_rate = 0.4, # rate of under-reporting
  ae_per_visit_mean = 0.5 # mean AE per patient visit
)

df_visit$study_id &amp;lt;- &amp;quot;A&amp;quot;

df_site &amp;lt;- site_aggr(df_visit)

df_sim_sites &amp;lt;- sim_sites(df_site, df_visit, r = 1000)

df_eval &amp;lt;- eval_sites(df_sim_sites)

plot_study(df_visit, df_site, df_eval, study = &amp;quot;A&amp;quot;) &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part1_files/figure-html/unnamed-chunk-64-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;constructor&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;new_simaerep &amp;lt;- function(df_site,
                           df_sim_sites,
                           df_eval,
                           r) {
  
  structure(
    list(
      df_site = df_site,
      df_sim_sites = df_sim_sites,
      df_eval = df_eval,
      r = r
    ),
    class = &amp;quot;simaerep&amp;quot;
  )
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;validator&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;validate_simaerep &amp;lt;- function(obj) {
  comp &amp;lt;- sort(attributes(obj)$names) ==  sort(c(&amp;quot;df_site&amp;quot;, &amp;quot;df_sim_sites&amp;quot;, &amp;quot;df_eval&amp;quot;, &amp;quot;r&amp;quot;))
  stopifnot(all(comp))
  return(obj)
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;user-friendly constructor&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;simaerep &amp;lt;- function(df_visit, r = 1000) {
  
  df_site &amp;lt;- site_aggr(df_visit)
  
  df_sim_sites &amp;lt;- sim_sites(df_site, df_visit, r = 1000)
  
  df_eval &amp;lt;- eval_sites(df_sim_sites)
  
  validate_simaerep(
    new_simaerep(
      df_site,
      df_sim_sites,
      df_eval,
      r
    )
  )
}

simaerep_studyA &amp;lt;- simaerep(df_visit)

str(simaerep_studyA)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## List of 4
##  $ df_site     : tibble [100 × 6] (S3: tbl_df/tbl/data.frame)
##   ..$ study_id          : chr [1:100] &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; ...
##   ..$ site_number       : chr [1:100] &amp;quot;S0001&amp;quot; &amp;quot;S0002&amp;quot; &amp;quot;S0003&amp;quot; &amp;quot;S0004&amp;quot; ...
##   ..$ n_pat             : int [1:100] 10 10 10 10 10 10 10 10 10 10 ...
##   ..$ n_pat_with_med75  : int [1:100] 9 8 9 9 7 8 10 7 10 8 ...
##   ..$ visit_med75       : Named num [1:100] 15 19 14 16 18 19 17 16 16 16 ...
##   .. ..- attr(*, &amp;quot;names&amp;quot;)= chr [1:100] &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; ...
##   ..$ mean_ae_site_med75: num [1:100] 4 5.12 4.22 4.67 6.29 ...
##  $ df_sim_sites: tibble [100 × 9] (S3: tbl_df/tbl/data.frame)
##   ..$ study_id           : chr [1:100] &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; ...
##   ..$ site_number        : chr [1:100] &amp;quot;S0001&amp;quot; &amp;quot;S0002&amp;quot; &amp;quot;S0003&amp;quot; &amp;quot;S0004&amp;quot; ...
##   ..$ n_pat              : int [1:100] 10 10 10 10 10 10 10 10 10 10 ...
##   ..$ n_pat_with_med75   : int [1:100] 9 8 9 9 7 8 10 7 10 8 ...
##   ..$ visit_med75        : Named num [1:100] 15 19 14 16 18 19 17 16 16 16 ...
##   .. ..- attr(*, &amp;quot;names&amp;quot;)= chr [1:100] &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; ...
##   ..$ mean_ae_site_med75 : num [1:100] 4 5.12 4.22 4.67 6.29 ...
##   ..$ mean_ae_study_med75: num [1:100] 7.38 9.33 6.92 7.91 8.84 ...
##   ..$ pval               : num [1:100] 7.14e-05 3.15e-05 1.38e-03 2.60e-04 2.11e-02 ...
##   ..$ prob_low           : num [1:100] 0 0 0 0 0.012 0.431 0.04 1 1 0.395 ...
##  $ df_eval     : tibble [100 × 13] (S3: tbl_df/tbl/data.frame)
##   ..$ study_id           : chr [1:100] &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; ...
##   ..$ site_number        : chr [1:100] &amp;quot;S0002&amp;quot; &amp;quot;S0001&amp;quot; &amp;quot;S0004&amp;quot; &amp;quot;S0003&amp;quot; ...
##   ..$ n_pat              : int [1:100] 10 10 10 10 10 10 10 10 10 10 ...
##   ..$ n_pat_with_med75   : int [1:100] 8 9 9 9 10 7 9 9 9 10 ...
##   ..$ visit_med75        : Named num [1:100] 19 15 16 14 15 18 17 15 16 17 ...
##   .. ..- attr(*, &amp;quot;names&amp;quot;)= chr [1:100] &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; ...
##   ..$ mean_ae_site_med75 : num [1:100] 5.12 4 4.67 4.22 5.4 ...
##   ..$ mean_ae_study_med75: num [1:100] 9.33 7.38 7.91 6.92 7.37 ...
##   ..$ pval               : num [1:100] 3.15e-05 7.14e-05 2.60e-04 1.38e-03 2.19e-02 ...
##   ..$ prob_low           : num [1:100] 0 0 0 0 0.009 0.012 0.017 0.036 0.038 0.04 ...
##   ..$ pval_adj           : num [1:100] 0.00315 0.00357 0.00867 0.03444 0.36483 ...
##   ..$ pval_prob_ur       : num [1:100] 0.997 0.996 0.991 0.966 0.635 ...
##   ..$ prob_low_adj       : num [1:100] 0 0 0 0 0.18 ...
##   ..$ prob_low_prob_ur   : num [1:100] 1 1 1 1 0.82 ...
##  $ r           : num 1000
##  - attr(*, &amp;quot;class&amp;quot;)= chr &amp;quot;simaerep&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;adding some class methods for common generic functions like &lt;code&gt;print()&lt;/code&gt;, &lt;code&gt;plot()&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;print.simaerep &amp;lt;- function(obj) {
  studies &amp;lt;- unique(obj$df_site$study_id)
  print(paste(&amp;quot;AE underreporting for studies:&amp;quot;, studies))
}

print(simaerep_studyA)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;AE underreporting for studies: A&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot.simaerep &amp;lt;- function(obj, df_visit, study, what = c(&amp;quot;study&amp;quot;, &amp;quot;med75&amp;quot;)) {
  
  stopifnot(study %in% unique(df_visit$study_id))
  
  what &amp;lt;- match.arg(what)
  .f &amp;lt;- switch(
     what,
     study = function(...) simaerep::plot_study(..., df_eval = obj$df_eval, study = study),
     med75 = function(...) simaerep::plot_visit_med75(..., study_id_str = study)
  )
  
  .f(df_visit = df_visit, df_site = obj$df_site)
}

plot(simaerep_studyA, df_visit, study = &amp;quot;A&amp;quot;, what = &amp;quot;study&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part1_files/figure-html/unnamed-chunk-69-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(simaerep_studyA, df_visit, study = &amp;quot;A&amp;quot;, what = &amp;quot;med75&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## purple line:          mean site ae of patients with visit_med75
## grey line:            patient included
## black dashed line:    patient excluded
## dotted vertical line: visit_med75, 0.75 x median of maximum patient visits of site 
## solid vertical line:  visit_med75 adjusted, increased to minimum maximum patient visit of included patients
## dashed vertical line: maximum value for visit_med75 adjusted, 80% quantile of maximum patient visits of study&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part1_files/figure-html/unnamed-chunk-69-2.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;to this point we have not:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;created new generic functions&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;used class inheritance&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A class that inherits from another class mus carry all its parents attributes, we can implement this by modifying the parent constructor as below and by calling the parent constructor from within the child constructor.&lt;/p&gt;
&lt;p&gt;Here we will create two classes one for initiating a simaerep object and the initial df_site aggregation step and one for the simulation.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;new_simaerep &amp;lt;- function(df_site, ..., class = character()) {
  structure(
    list(
      df_site = df_site,
      ...
    ),
    class = c(class, &amp;quot;simaerep&amp;quot;)
  )
}

validate_simaerep &amp;lt;- function(obj) {
  comp &amp;lt;- attributes(obj)$names ==  &amp;quot;df_site&amp;quot;
  stopifnot(all(comp))
  return(obj)
}

simaerep &amp;lt;- function(df_visit) {
  
  df_site &amp;lt;- site_aggr(df_visit)
  
  validate_simaerep(
    new_simaerep(
      df_site
    )
  )
}

simaerep_studyA &amp;lt;- simaerep(df_visit)

str(simaerep_studyA)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## List of 1
##  $ df_site: tibble [100 × 6] (S3: tbl_df/tbl/data.frame)
##   ..$ study_id          : chr [1:100] &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; ...
##   ..$ site_number       : chr [1:100] &amp;quot;S0001&amp;quot; &amp;quot;S0002&amp;quot; &amp;quot;S0003&amp;quot; &amp;quot;S0004&amp;quot; ...
##   ..$ n_pat             : int [1:100] 10 10 10 10 10 10 10 10 10 10 ...
##   ..$ n_pat_with_med75  : int [1:100] 9 8 9 9 7 8 10 7 10 8 ...
##   ..$ visit_med75       : Named num [1:100] 15 19 14 16 18 19 17 16 16 16 ...
##   .. ..- attr(*, &amp;quot;names&amp;quot;)= chr [1:100] &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; ...
##   ..$ mean_ae_site_med75: num [1:100] 4 5.12 4.22 4.67 6.29 ...
##  - attr(*, &amp;quot;class&amp;quot;)= chr &amp;quot;simaerep&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;new_simaerep_sim &amp;lt;- function(df_site, df_sim_sites, df_eval, r) {
  
  new_simaerep(
    df_site = df_site,
    df_sim_sites = df_sim_sites,
    df_eval = df_eval,
    r = r,
    class = &amp;quot;simaerep_sim&amp;quot;
  )

}

validate_simaerep_sim &amp;lt;- function(obj) {
  
  comp &amp;lt;- sort(attributes(obj)$names) ==  sort(c(&amp;quot;df_site&amp;quot;, &amp;quot;df_sim_sites&amp;quot;, &amp;quot;df_eval&amp;quot;, &amp;quot;r&amp;quot;))
  stopifnot(all(comp))
  return(obj)
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;next we define a new generic method called &lt;code&gt;sim&lt;/code&gt; that starts the simulation which returns the new class &lt;code&gt;simaerep_sim&lt;/code&gt;. The process that finds the right method to call for an object called with a generic function is called method dispatching.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# define generic function
sim &amp;lt;- function(obj, ...) {
  UseMethod(&amp;quot;sim&amp;quot;)
}

sim.simaerep &amp;lt;- function(obj, df_visit, r = 1000) {
  
  df_sim_sites &amp;lt;- sim_sites(obj$df_site, df_visit, r = r)
  
  df_eval &amp;lt;- eval_sites(df_sim_sites)
  
  validate_simaerep_sim(
    new_simaerep_sim(
      df_site,
      df_sim_sites,
      df_eval,
      r
    )
  )
}

simaerep_studyA_sim &amp;lt;- sim(simaerep_studyA, df_visit)

str(simaerep_studyA_sim)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## List of 4
##  $ df_site     : tibble [100 × 6] (S3: tbl_df/tbl/data.frame)
##   ..$ study_id          : chr [1:100] &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; ...
##   ..$ site_number       : chr [1:100] &amp;quot;S0001&amp;quot; &amp;quot;S0002&amp;quot; &amp;quot;S0003&amp;quot; &amp;quot;S0004&amp;quot; ...
##   ..$ n_pat             : int [1:100] 10 10 10 10 10 10 10 10 10 10 ...
##   ..$ n_pat_with_med75  : int [1:100] 9 8 9 9 7 8 10 7 10 8 ...
##   ..$ visit_med75       : Named num [1:100] 15 19 14 16 18 19 17 16 16 16 ...
##   .. ..- attr(*, &amp;quot;names&amp;quot;)= chr [1:100] &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; ...
##   ..$ mean_ae_site_med75: num [1:100] 4 5.12 4.22 4.67 6.29 ...
##  $ df_sim_sites: tibble [100 × 9] (S3: tbl_df/tbl/data.frame)
##   ..$ study_id           : chr [1:100] &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; ...
##   ..$ site_number        : chr [1:100] &amp;quot;S0001&amp;quot; &amp;quot;S0002&amp;quot; &amp;quot;S0003&amp;quot; &amp;quot;S0004&amp;quot; ...
##   ..$ n_pat              : int [1:100] 10 10 10 10 10 10 10 10 10 10 ...
##   ..$ n_pat_with_med75   : int [1:100] 9 8 9 9 7 8 10 7 10 8 ...
##   ..$ visit_med75        : Named num [1:100] 15 19 14 16 18 19 17 16 16 16 ...
##   .. ..- attr(*, &amp;quot;names&amp;quot;)= chr [1:100] &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; ...
##   ..$ mean_ae_site_med75 : num [1:100] 4 5.12 4.22 4.67 6.29 ...
##   ..$ mean_ae_study_med75: num [1:100] 7.38 9.33 6.92 7.91 8.84 ...
##   ..$ pval               : num [1:100] 7.14e-05 3.15e-05 1.38e-03 2.60e-04 2.11e-02 ...
##   ..$ prob_low           : num [1:100] 0 0 0 0 0.012 0.431 0.04 1 1 0.395 ...
##  $ df_eval     : tibble [100 × 13] (S3: tbl_df/tbl/data.frame)
##   ..$ study_id           : chr [1:100] &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; &amp;quot;A&amp;quot; ...
##   ..$ site_number        : chr [1:100] &amp;quot;S0002&amp;quot; &amp;quot;S0001&amp;quot; &amp;quot;S0004&amp;quot; &amp;quot;S0003&amp;quot; ...
##   ..$ n_pat              : int [1:100] 10 10 10 10 10 10 10 10 10 10 ...
##   ..$ n_pat_with_med75   : int [1:100] 8 9 9 9 10 7 9 9 9 10 ...
##   ..$ visit_med75        : Named num [1:100] 19 15 16 14 15 18 17 15 16 17 ...
##   .. ..- attr(*, &amp;quot;names&amp;quot;)= chr [1:100] &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; &amp;quot;80%&amp;quot; ...
##   ..$ mean_ae_site_med75 : num [1:100] 5.12 4 4.67 4.22 5.4 ...
##   ..$ mean_ae_study_med75: num [1:100] 9.33 7.38 7.91 6.92 7.37 ...
##   ..$ pval               : num [1:100] 3.15e-05 7.14e-05 2.60e-04 1.38e-03 2.19e-02 ...
##   ..$ prob_low           : num [1:100] 0 0 0 0 0.009 0.012 0.017 0.036 0.038 0.04 ...
##   ..$ pval_adj           : num [1:100] 0.00315 0.00357 0.00867 0.03444 0.36483 ...
##   ..$ pval_prob_ur       : num [1:100] 0.997 0.996 0.991 0.966 0.635 ...
##   ..$ prob_low_adj       : num [1:100] 0 0 0 0 0.18 ...
##   ..$ prob_low_prob_ur   : num [1:100] 1 1 1 1 0.82 ...
##  $ r           : num 1000
##  - attr(*, &amp;quot;class&amp;quot;)= chr [1:2] &amp;quot;simaerep_sim&amp;quot; &amp;quot;simaerep&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;class(simaerep_studyA_sim)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;simaerep_sim&amp;quot; &amp;quot;simaerep&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot.simaerep &amp;lt;- function(obj, df_visit, study,
                          ... # we need ... to ignore additional arguments when called with NextMethod()
                          ) {
  simaerep::plot_visit_med75(df_visit, obj$df_site, study_id_str = study)
}&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;override plot method of parent class, and use user-supplied argument to switch back to parent class method using &lt;code&gt;NextMethod()&lt;/code&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot.simaerep_sim &amp;lt;- function(obj, df_visit, study, what = c(&amp;quot;study&amp;quot;, &amp;quot;med75&amp;quot;)) {
  what &amp;lt;- match.arg(what)
  if (what == &amp;quot;study&amp;quot;) {
    simaerep::plot_study(df_visit, obj$df_site, obj$df_eval, study = study)
  } else {
    # calls parent class method using all original arguments
    NextMethod()
  }
}


plot(simaerep_studyA_sim, df_visit, study = &amp;quot;A&amp;quot;, what = &amp;quot;study&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part1_files/figure-html/unnamed-chunk-73-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(simaerep_studyA_sim, df_visit, study = &amp;quot;A&amp;quot;, what = &amp;quot;med75&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## purple line:          mean site ae of patients with visit_med75
## grey line:            patient included
## black dashed line:    patient excluded
## dotted vertical line: visit_med75, 0.75 x median of maximum patient visits of site 
## solid vertical line:  visit_med75 adjusted, increased to minimum maximum patient visit of included patients
## dashed vertical line: maximum value for visit_med75 adjusted, 80% quantile of maximum patient visits of study&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part1_files/figure-html/unnamed-chunk-73-2.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(simaerep_studyA_sim, df_visit, study = &amp;quot;A&amp;quot;, what = &amp;quot;XXX&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Error in match.arg(what): &amp;#39;arg&amp;#39; should be one of &amp;quot;study&amp;quot;, &amp;quot;med75&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(simaerep_studyA, df_visit, study = &amp;quot;A&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## purple line:          mean site ae of patients with visit_med75
## grey line:            patient included
## black dashed line:    patient excluded
## dotted vertical line: visit_med75, 0.75 x median of maximum patient visits of site 
## solid vertical line:  visit_med75 adjusted, increased to minimum maximum patient visit of included patients
## dashed vertical line: maximum value for visit_med75 adjusted, 80% quantile of maximum patient visits of study&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-10-13-advancedr-part1_files/figure-html/unnamed-chunk-73-3.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;sloop provides some function to investigate S3 class behavior.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sloop::s3_methods_class(&amp;quot;simaerep&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## # A tibble: 3 × 4
##   generic class    visible source    
##   &amp;lt;chr&amp;gt;   &amp;lt;chr&amp;gt;    &amp;lt;lgl&amp;gt;   &amp;lt;chr&amp;gt;     
## 1 plot    simaerep TRUE    .GlobalEnv
## 2 print   simaerep TRUE    .GlobalEnv
## 3 sim     simaerep TRUE    .GlobalEnv&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sloop::s3_methods_class(&amp;quot;simaerep_sim&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## # A tibble: 1 × 4
##   generic class        visible source    
##   &amp;lt;chr&amp;gt;   &amp;lt;chr&amp;gt;        &amp;lt;lgl&amp;gt;   &amp;lt;chr&amp;gt;     
## 1 plot    simaerep_sim TRUE    .GlobalEnv&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sloop::s3_methods_generic(&amp;quot;sim&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## # A tibble: 1 × 4
##   generic class    visible source    
##   &amp;lt;chr&amp;gt;   &amp;lt;chr&amp;gt;    &amp;lt;lgl&amp;gt;   &amp;lt;chr&amp;gt;     
## 1 sim     simaerep TRUE    .GlobalEnv&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sloop::s3_dispatch(plot(simaerep_studyA_sim, df_visit, study = &amp;quot;A&amp;quot;))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## =&amp;gt; plot.simaerep_sim
## -&amp;gt; plot.simaerep
##  * plot.default&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;sloop::s3_dispatch(plot(simaerep_studyA, df_visit, study = &amp;quot;A&amp;quot;))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## =&amp;gt; plot.simaerep
##  * plot.default&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;r6&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;R6&lt;/h2&gt;
&lt;p&gt;R6 uses the encapsulated OOP framework, commonly used in shiny. Works like object in python.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use &lt;code&gt;R6::R6Class()&lt;/code&gt; to construct classes&lt;/li&gt;
&lt;li&gt;Pass a list with attributes (static values) and methods (functions)&lt;/li&gt;
&lt;li&gt;Within methods refer to the class as &lt;code&gt;self&lt;/code&gt; and subset with &lt;code&gt;$&lt;/code&gt; (&lt;code&gt;self$attribute&lt;/code&gt;, &lt;code&gt;self.method()&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Instantiate objects by calling &lt;code&gt;x &amp;lt;- Class$new()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;methods can be chained &lt;code&gt;x$add(1)$sub(1)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;initialize()&lt;/code&gt; method overrise &lt;code&gt;new()&lt;/code&gt; and works like &lt;code&gt;__init()&lt;/code&gt; in python&lt;/li&gt;
&lt;li&gt;inherit by using the &lt;code&gt;inherit&lt;/code&gt; argument of &lt;code&gt;R6::R6Class()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;pass private and public attributes and classes using the &lt;code&gt;privat&lt;/code&gt; and &lt;code&gt;public&lt;/code&gt; arguments of &lt;code&gt;R6::R6Class()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;active fields look like attributes but are methods, can run additional checks&lt;/li&gt;
&lt;li&gt;instantiated R6 classes behave like python objects modifying one object will also modify all of its copies&lt;/li&gt;
&lt;li&gt;always put randomized default values that you do not want to share across instances into the initialize function&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;s4&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;S4&lt;/h2&gt;
&lt;p&gt;Mostly used for bioconductor packages uses functional OOP framework. A well-known package that uses S4 is &lt;code&gt;ROCR&lt;/code&gt; and &lt;code&gt;lubridate&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;much stricter framework than S3&lt;/li&gt;
&lt;li&gt;makes use of specialized functions like &lt;code&gt;setClass()&lt;/code&gt;, &lt;code&gt;setGeneric()&lt;/code&gt;, &lt;code&gt;setMethod()&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;all functions are distributed with R in the &lt;code&gt;methods&lt;/code&gt; package (which should be explicitly loaded so show S4 framework is used and to avoid problems when running non-interactive mode)&lt;/li&gt;
&lt;li&gt;attributes are &lt;em&gt;slots&lt;/em&gt; which can be subset using &lt;code&gt;@&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;supports multiple inheritance and multiple dispatch (which should be avoided because its complicated)&lt;/li&gt;
&lt;/ul&gt;
&lt;div id=&#34;slots&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Slots&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;when instantiated objects slot’s are automatically checked if they contain the correct data types&lt;/li&gt;
&lt;li&gt;&lt;code&gt;setValidity()&lt;/code&gt;, &lt;code&gt;validObject()&lt;/code&gt; can be used to extend checks and to validate existing objects&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;conventions&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Conventions&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;CamelCase&lt;/li&gt;
&lt;li&gt;provide constructor with same name as class&lt;/li&gt;
&lt;li&gt;write generics that call and set slot values&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;multiple-inheritence&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Multiple Inheritence&lt;/h3&gt;
&lt;p&gt;in case a class inherits from multiple classes the method that is closest to the class is chosen. If two methods are matching the method for the class which has a higher lexical order is chosen.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;multiple-dispatch&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Multiple dispatch&lt;/h3&gt;
&lt;p&gt;If a generic uses two classes as input both classes are searched for methods.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;s4-vs-s3&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;S4 vs S3&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;S4 more suitable for larger teams&lt;/li&gt;
&lt;li&gt;S4 is better with many inter related objects (for example provide methods via generics for combinations of different types of sparse matrices)&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Six Sigma with R - Notes</title>
      <link>https://www.datisticsblog.com/2021/09/sixsigmawithr/</link>
      <pubDate>Wed, 01 Sep 2021 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2021/09/sixsigmawithr/</guid>
      <description>
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/header-attrs/header-attrs.js&#34;&gt;&lt;/script&gt;
&lt;link href=&#34;https://www.datisticsblog.com/rmarkdown-libs/anchor-sections/anchor-sections.css&#34; rel=&#34;stylesheet&#34; /&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/anchor-sections/anchor-sections.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/htmlwidgets/htmlwidgets.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/es6shim/es6shim.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/es7shim/es7shim.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/graphre/graphre.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/nomnoml/nomnoml.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/nomnoml-binding/nomnoml.js&#34;&gt;&lt;/script&gt;

&lt;div id=&#34;TOC&#34;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#r-packages&#34;&gt;R packages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#sigma&#34;&gt;6 Sigma&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#define&#34;&gt;Define&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#process-charts&#34;&gt;Process Charts&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#high-level&#34;&gt;High Level:&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#low-level&#34;&gt;Low Level:&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#analyse&#34;&gt;Analyse&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#loss-function-analysis&#34;&gt;Loss Function Analysis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#measurement-system-analysis&#34;&gt;Measurement System Analysis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#capability-analysis&#34;&gt;Capability Analysis&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#improve&#34;&gt;Improve&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#experimental-design&#34;&gt;Experimental Design&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#control&#34;&gt;Control&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#control-charts&#34;&gt;Control Charts&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;https://images.springer.com/sgw/books/medium/9781461436515.jpg&#34; style=&#34;width: 400px;height: 600px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Six Sigma with R. Statistical Engineering for Process Improvement (Cano EL, Moguerza JM and Redchuk A, 2012).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;div id=&#34;r-packages&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;R packages&lt;/h1&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages(library(tidyverse))
library(SixSigma)
library(DiagrammeR)
library(nomnoml)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;sigma&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;6 Sigma&lt;/h1&gt;
&lt;p&gt;6 sigma is framework for process improvement and is not limited to process control. It consists of a cycle of several stages all of which are employing the &lt;strong&gt;scientific method&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;DMAIC cycle:&lt;/strong&gt;&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;&lt;strong&gt;D&lt;/strong&gt;efine&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;M&lt;/strong&gt;easure&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;A&lt;/strong&gt;nalyse&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;I&lt;/strong&gt;mprove&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;C&lt;/strong&gt;ontrol&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;div id=&#34;define&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Define&lt;/h1&gt;
&lt;div id=&#34;process-charts&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Process Charts&lt;/h2&gt;
&lt;div id=&#34;high-level&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;High Level:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Process fits onto one power point slide&lt;/li&gt;
&lt;li&gt;Onboarding new people&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/SIPOC&#34;&gt;SIPOC&lt;/a&gt;, &lt;a href=&#34;https://en.wikipedia.org/wiki/Value-stream_mapping&#34;&gt;VSM&lt;/a&gt; are commonly used in six sigma&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;six sigma focuses on the inputs and the output of a process.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Inputs&lt;/strong&gt; are the 6 Ms:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Manpower&lt;/li&gt;
&lt;li&gt;Materials&lt;/li&gt;
&lt;li&gt;Machines&lt;/li&gt;
&lt;li&gt;Methods&lt;/li&gt;
&lt;li&gt;Measurements&lt;/li&gt;
&lt;li&gt;Mother Nature (Environment)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;CTQ (Crtitical to Quality Characteristics)&lt;/li&gt;
&lt;li&gt;key measurable characteristics of a product or process whose performance standards or specification limits must be met&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For example the processing of Individual Case Safety Reports for submission to the Health Authorities.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.nomnoml.com/&#34;&gt;&lt;code&gt;nomnoml&lt;/code&gt; webtool&lt;/a&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;nomnoml::nomnoml(
&amp;quot;#direction: right
#padding: 20
#spacing: 100

[Input 6M&amp;#39;s|ICSR; IT System; Legislation; Process Owner; PV Associate]

[Input 6M&amp;#39;s]-&amp;gt;[Output CTQs|Recipients; Submission Status; Processing Time; Compliance Status; Medical Risk; Compliance Risk]&amp;quot;
)&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;htmlwidget-1&#34; style=&#34;width:672px;height:480px;&#34; class=&#34;nomnoml html-widget&#34;&gt;&lt;/div&gt;
&lt;script type=&#34;application/json&#34; data-for=&#34;htmlwidget-1&#34;&gt;{&#34;x&#34;:{&#34;code&#34;:&#34;\n#fill: #FEFEFF\n#lineWidth: 1\n#zoom: 4\n#direction: right\n\n#direction: right\n#padding: 20\n#spacing: 100\n\n[Input 6M&#39;s|ICSR; IT System; Legislation; Process Owner; PV Associate]\n\n[Input 6M&#39;s]-&gt;[Output CTQs|Recipients; Submission Status; Processing Time; Compliance Status; Medical Risk; Compliance Risk]&#34;,&#34;svg&#34;:false},&#34;evals&#34;:[],&#34;jsHooks&#34;:[]}&lt;/script&gt;
&lt;/div&gt;
&lt;div id=&#34;low-level&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Low Level:&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;more elaborate flow charts&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Activity_diagram&#34;&gt;UML activity diagram&lt;/a&gt; provides some standards.&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Swim_lane&#34;&gt;BMPN Swim Lanes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;UML/BMPN process maps do not focus on 6 Ms and CTQs. We can continue the simplified input output diagram ba adding more steps to the process.
The input for each individual consists of elements of the initial 6M input (X) or the output produced by one of the previous steps. Each Step can have parameters (x) that influence the quality of the output. Each step output has quality features (y). Which can be included in the final output CTQs (Y).&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;nomnoml::nomnoml(
&amp;quot;#title: ICSR Processing
#direction: right
#padding: 20
#spacing: 100


[Input 6M&amp;#39;s (X)|ICSR; IT System; Legislation; Process Owner; PV Associate; Product]
[Input 6M&amp;#39;s (X)]-&amp;gt;[&amp;lt;table&amp;gt; Ensure Completeness|
    Input| ICSR; IT System; PV Associate||
    Substeps/Methods| follow_up()||
    Parameters(x); influence Quality|ICSR Source||
    Quality Features(y)|ICSR Completeness; Time
]
[Ensure Completeness]-&amp;gt;[Medical Review|
  ICSR Complete; IT System; PV Associate|
  review(); follow_up()|
  ICSR Complexity;Source Accessibility; Privacy Laws|
  Medical Risk; Causality;Severity; Labelling; Product Approval; Time
]
[Medical Review]-&amp;gt;[Apply Submission Legislation|
  ICSR Reviewed; Legislation; IT System; Process Owner|
  encode_legislation(); qc_submission_status(); submit()|
  Legislation Complexity; Number Cases to Review|
  Compliance Risk; Submission Status; Recipients; Time; QC Status
]
[Apply Submission Legislation]-&amp;gt;[Output CTQs (Y)|
    Recipients; Submission Status; Processing Time; Compliance Status; Medical Risk; Compliance Risk; QC Status
]&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;htmlwidget-2&#34; style=&#34;width:1152px;height:768px;&#34; class=&#34;nomnoml html-widget&#34;&gt;&lt;/div&gt;
&lt;script type=&#34;application/json&#34; data-for=&#34;htmlwidget-2&#34;&gt;{&#34;x&#34;:{&#34;code&#34;:&#34;\n#fill: #FEFEFF\n#lineWidth: 1\n#zoom: 4\n#direction: right\n\n#title: ICSR Processing\n#direction: right\n#padding: 20\n#spacing: 100\n\n\n[Input 6M&#39;s (X)|ICSR; IT System; Legislation; Process Owner; PV Associate; Product]\n[Input 6M&#39;s (X)]-&gt;[&lt;table&gt; Ensure Completeness|\n\tInput| ICSR; IT System; PV Associate||\n    Substeps/Methods| follow_up()||\n    Parameters(x); influence Quality|ICSR Source||\n    Quality Features(y)|ICSR Completeness; Time\n]\n[Ensure Completeness]-&gt;[Medical Review|\n  ICSR Complete; IT System; PV Associate|\n  review(); follow_up()|\n  ICSR Complexity;Source Accessibility; Privacy Laws|\n  Medical Risk; Causality;Severity; Labelling; Product Approval; Time\n]\n[Medical Review]-&gt;[Apply Submission Legislation|\n  ICSR Reviewed; Legislation; IT System; Process Owner|\n  encode_legislation(); qc_submission_status(); submit()|\n  Legislation Complexity; Number Cases to Review|\n  Compliance Risk; Submission Status; Recipients; Time; QC Status\n]\n[Apply Submission Legislation]-&gt;[Output CTQs (Y)|\n\tRecipients; Submission Status; Processing Time; Compliance Status; Medical Risk; Compliance Risk; QC Status\n]&#34;,&#34;svg&#34;:false},&#34;evals&#34;:[],&#34;jsHooks&#34;:[]}&lt;/script&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;analyse&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Analyse&lt;/h1&gt;
&lt;div id=&#34;loss-function-analysis&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Loss Function Analysis&lt;/h2&gt;
&lt;p&gt;Loss functioncan be used during the DMAIC measure phase by calculating expected loss as a product of average loss per item by number of items.
It can also be used to set the &lt;a href=&#34;https://www.datisticsblog.com/2021/08/qcwithr/#capabilityperformance-indices&#34;&gt;upper and lower specification limits (USL/LSL)&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In six sigma loss increases quadratically when deviating from the process target not only after crossing a threshold.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Loss = k(Y-Y0)^2&lt;/strong&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df &amp;lt;- SixSigma::ss.data.bolts
head(df)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##   diameter
## 1  10.4042
## 2  10.2584
## 3   9.9478
## 4  10.2678
## 5  10.1144
## 6   9.9830&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;lfa &amp;lt;- SixSigma::ss.lfa(
  lfa.data = df,
  lfa.ctq = &amp;quot;diameter&amp;quot;,
  lfa.Delta = 0.5, #process tolerance,
  lfa.Y0 = 10, #process target
  lfa.L0 = 0.001, #cost at tolerance limit
  lfa.size = 1e5
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-09-01-sixsigmawithr_files/figure-html/unnamed-chunk-5-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;lfa&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $lfa.k
## [1] 0.004
## 
## $lfa.lf
## expression(bold(L == 0.004 %.% (Y - 10)^2))
## 
## $lfa.MSD
## [1] 0.03372065
## 
## $lfa.avLoss
## [1] 0.0001348826
## 
## $lfa.Loss
## [1] 13.48826&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;loss_at_10.25 &amp;lt;- lfa$lfa.k * (10.25 - 10)^2
loss_at_10.25&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 0.00025&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;measurement-system-analysis&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Measurement System Analysis&lt;/h2&gt;
&lt;p&gt;Measurement system analysis (MSA) is also known as gage R&amp;amp;R study identifies and quantifies the sources of variation that influence the measurement system.&lt;/p&gt;
&lt;p&gt;In a good measurement the only variability is random and stems from the difference in the parts that are measured and not from the so called appraisers (operator, measurement machines, time of the day). MSA uses ANOVA to compare the ratio of between-groups variability to within-groups variability. If this ratio is large, we conclude that the groups are significantly different.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;G R&amp;amp;R (appraisal) contribution to variation must be low and is the sum of Repeatability (appraisers) and Reproducibility (interactions)&lt;/li&gt;
&lt;li&gt;part to part contribution to variation must be high&lt;/li&gt;
&lt;li&gt;total variation = R&amp;amp;R + part to part&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df &amp;lt;- SixSigma::ss.data.rr
head(df)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##   prototype operator    run time1 time2
## 1   prot #1    op #1 run #1  1.27  1.15
## 2   prot #1    op #1 run #2  0.90  1.31
## 3   prot #1    op #1 run #3  1.09  1.25
## 4   prot #2    op #1 run #1  1.12  1.36
## 5   prot #2    op #1 run #2  1.09  1.41
## 6   prot #2    op #1 run #3  1.15  1.37&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;rr &amp;lt;- SixSigma::ss.rr(
  var = time1,
  part = prototype,
  appr = operator,
  data = df,
  alphaLim = 0.05,
  errorTerm = &amp;quot;Interaction&amp;quot;,
  lsl = 0.7,
  usl = 1.8,
  method = &amp;quot;crossed&amp;quot; #crossed uses all possible combinations of parts and appraisals
  # https://blog.minitab.com/en/a-simple-guide-to-gage-randr-for-destructive-testing
)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Complete model (with interaction):
## 
##                    Df Sum Sq Mean Sq F value   Pr(&amp;gt;F)
## prototype           2 1.2007  0.6004  28.040 2.95e-06
## operator            2 0.0529  0.0265   1.236    0.314
## prototype:operator  4 0.0834  0.0208   0.974    0.446
## Repeatability      18 0.3854  0.0214                 
## Total              26 1.7225                         
## 
## alpha for removing interaction: 0.05 
## 
## 
## Reduced model (without interaction):
## 
##               Df Sum Sq Mean Sq F value   Pr(&amp;gt;F)
## prototype      2 1.2007  0.6004  28.174 8.56e-07
## operator       2 0.0529  0.0265   1.242    0.308
## Repeatability 22 0.4688  0.0213                 
## Total         26 1.7225                         
## 
## Gage R&amp;amp;R
## 
##                        VarComp %Contrib
## Total Gage R&amp;amp;R    0.0218822671    25.38
##   Repeatability   0.0213087542    24.71
##   Reproducibility 0.0005735129     0.67
##     operator      0.0005735129     0.67
## Part-To-Part      0.0643389450    74.62
## Total Variation   0.0862212121   100.00
## 
##                        VarComp     StdDev  StudyVar %StudyVar %Tolerance
## Total Gage R&amp;amp;R    0.0218822671 0.14792656 0.8875594     50.38      80.69
##   Repeatability   0.0213087542 0.14597518 0.8758511     49.71      79.62
##   Reproducibility 0.0005735129 0.02394813 0.1436888      8.16      13.06
##     operator      0.0005735129 0.02394813 0.1436888      8.16      13.06
## Part-To-Part      0.0643389450 0.25365123 1.5219074     86.38     138.36
## Total Variation   0.0862212121 0.29363449 1.7618069    100.00     160.16
## 
## Number of Distinct Categories = 2&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-09-01-sixsigmawithr_files/figure-html/unnamed-chunk-6-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;% Contribution is the total contribution to variability (range)&lt;/li&gt;
&lt;li&gt;% Study Var is the within group variance as percent of the total variance&lt;/li&gt;
&lt;li&gt;% Tolerance should be below 100 for R&amp;amp;R&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;capability-analysis&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Capability Analysis&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://www.datisticsblog.com/2021/08/qcwithr/#capabilityperformance-indices&#34;&gt;see capability performance indeces from previous blogpost&lt;/a&gt;.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ss.study.ca(
  xST = ss.data.ca$Volume, # short-term process data,
  xLT = rnorm(40, 753, 3), # long-term process data
    LSL = 740,
  USL = 760,
  Target = 750,
  alpha = 0.05,
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-09-01-sixsigmawithr_files/figure-html/unnamed-chunk-7-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;Cpk: min(left right capability index)
CI: Confidence Interval of capability index&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;improve&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Improve&lt;/h1&gt;
&lt;div id=&#34;experimental-design&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Experimental Design&lt;/h2&gt;
&lt;p&gt;When optimizing a process it is not enough to vary one variable and keep all other variables constant, because we are missing out on interactions. It is best to use a factorial design (binning continuous variables into two) and try all possible combinations in several repeats. Use ANOVA or pairwise t-test to get best result. Include uncontrollable factors in experimental design to find which controllable variables give most robust results when uncontrollable variables vary. Example: Best frozen Pizza recipe for varying baking time and temperature.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;control&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Control&lt;/h1&gt;
&lt;div id=&#34;control-charts&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Control Charts&lt;/h2&gt;
&lt;p&gt;&lt;a href=&#34;https://www.datisticsblog.com/2021/08/qcwithr/#control-charts&#34;&gt;see controil charts in a previous blog post&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Quality Control with R - Notes</title>
      <link>https://www.datisticsblog.com/2021/08/qcwithr/</link>
      <pubDate>Fri, 27 Aug 2021 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2021/08/qcwithr/</guid>
      <description>
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/header-attrs/header-attrs.js&#34;&gt;&lt;/script&gt;
&lt;link href=&#34;https://www.datisticsblog.com/rmarkdown-libs/anchor-sections/anchor-sections.css&#34; rel=&#34;stylesheet&#34; /&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/anchor-sections/anchor-sections.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/htmlwidgets/htmlwidgets.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/d3/d3.min.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/dagre/dagre-d3.min.js&#34;&gt;&lt;/script&gt;
&lt;link href=&#34;https://www.datisticsblog.com/rmarkdown-libs/mermaid/dist/mermaid.css&#34; rel=&#34;stylesheet&#34; /&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/mermaid/dist/mermaid.slim.min.js&#34;&gt;&lt;/script&gt;
&lt;link href=&#34;https://www.datisticsblog.com/rmarkdown-libs/DiagrammeR-styles/styles.css&#34; rel=&#34;stylesheet&#34; /&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/chromatography/chromatography.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/DiagrammeR-binding/DiagrammeR.js&#34;&gt;&lt;/script&gt;

&lt;div id=&#34;TOC&#34;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#r-packages&#34;&gt;R packages&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#iso-standard-qc-approach&#34;&gt;ISO standard QC Approach&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#qc-tools&#34;&gt;QC tools&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#cause-and-effect-diagrams&#34;&gt;Cause and Effect Diagrams&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#check-sheets&#34;&gt;Check Sheets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#control-charts-shewhart-charts&#34;&gt;Control Charts (Shewhart Charts)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#histogram&#34;&gt;Histogram&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#pareto-chart&#34;&gt;Pareto Chart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#scatter-plots&#34;&gt;Scatter Plots&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#stratification&#34;&gt;Stratification&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#control-charts&#34;&gt;Control Charts&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#continuous-grouped-variables&#34;&gt;Continuous Grouped Variables&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#x-bar-chart&#34;&gt;X-bar Chart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#r-chart&#34;&gt;R Chart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#s-chart&#34;&gt;S Chart&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#continuous-non-grouped-variables&#34;&gt;Continuous Non-Grouped Variables&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#x-bar-chart-1&#34;&gt;X-bar chart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#r-chart-1&#34;&gt;R Chart&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#discrete-measurements&#34;&gt;Discrete Measurements&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#p-and-np-charts&#34;&gt;p and np Charts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#c-chart&#34;&gt;c chart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#u-chart&#34;&gt;u chart&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#capabilityperformance-indices&#34;&gt;Capability/Performance Indices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#cusum-chart&#34;&gt;CUSUM Chart&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#ewma-chart&#34;&gt;EWMA Chart&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#samplingstratification&#34;&gt;Sampling/Stratification&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#attribute-acceptance-sampling&#34;&gt;Attribute Acceptance Sampling&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#variable-acceptance-sampling&#34;&gt;Variable Acceptance Sampling&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;https://media.springernature.com/w306/springer-static/cover-hires/book/978-3-319-24046-6&#34; style=&#34;width: 400px;height: 600px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Quality Control with R. An ISO Standards Approach (Cano EL, Moguerza JM and Prieto M, 2015).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;div id=&#34;r-packages&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;R packages&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;qcc&lt;/code&gt; seems to be the most popular and best maintained QC package for control charts.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages(library(tidyverse))
# we use qcc 3.0 which is not released on CRAN yet
# devtools::install_github(&amp;quot;luca-scr/qcc&amp;quot;, build = TRUE, build_opts = c(&amp;quot;--no-resave-data&amp;quot;, &amp;quot;--no-manual&amp;quot;))
library(qcc)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Package &amp;#39;qcc&amp;#39; version 3.0
## Type &amp;#39;citation(&amp;quot;qcc&amp;quot;)&amp;#39; for citing this R package in publications.&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;library(AcceptanceSampling)
library(SixSigma)
library(DiagrammeR)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;iso-standard-qc-approach&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;ISO standard QC Approach&lt;/h1&gt;
&lt;p&gt;ISO standards are defined by the International Organisation for Standardisation by technical committees using a process that is similar to peer-review. There are a lot of ISO standards covering Quality Control.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;qc-tools&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;QC tools&lt;/h1&gt;
&lt;p&gt;There are 7 general quality Ishikava tools, each of them is covered by numerous ISO documents.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Cause and Effect Diagram&lt;/li&gt;
&lt;li&gt;Check sheet&lt;/li&gt;
&lt;li&gt;Control chart&lt;/li&gt;
&lt;li&gt;Histogram&lt;/li&gt;
&lt;li&gt;Pareto Chart&lt;/li&gt;
&lt;li&gt;Scatter Diagram&lt;/li&gt;
&lt;li&gt;Stratification
&lt;ul&gt;
&lt;li&gt;Flow charts&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div id=&#34;cause-and-effect-diagrams&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Cause and Effect Diagrams&lt;/h2&gt;
&lt;p&gt;The effect is usually undesired. As causes for a given effect
for processes of the producing industry the ISO standard is 5Ms+E&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Manpower&lt;/li&gt;
&lt;li&gt;Materials&lt;/li&gt;
&lt;li&gt;Machines&lt;/li&gt;
&lt;li&gt;Methods&lt;/li&gt;
&lt;li&gt;Measurements&lt;/li&gt;
&lt;li&gt;Environment&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Creatively I would adapt this for data-driven business processes to:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Manpower&lt;/li&gt;
&lt;li&gt;Events&lt;/li&gt;
&lt;li&gt;IT System&lt;/li&gt;
&lt;li&gt;Methods (Statistics, DevOps, Code base, Manual Processes)&lt;/li&gt;
&lt;li&gt;Measurements of Events (Data Entry, Data Coding)&lt;/li&gt;
&lt;li&gt;Environment (Culture, External Events, Regulations)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Specifically for the reporting of Adverse Drug Reactions in the form of individual case safety reports (ICSR) to Health Authorities (HA).&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;qcc::causeEffectDiagram(
  cause = list(
    Manpower = c(
      &amp;quot;Medical Reviewer&amp;quot;,
      &amp;quot;Global Process Owner&amp;quot;,
      &amp;quot;Local Process Owner&amp;quot;,
      &amp;quot;IT Developer&amp;quot;,
      &amp;quot;Database Manager&amp;quot;,
      &amp;quot;Auditer&amp;quot;
    ),
    Event = c(
      &amp;quot;ICSR Quality&amp;quot;,
      &amp;quot;ICSR Detectability&amp;quot;,
      &amp;quot;ICSR Quantity&amp;quot;,
      &amp;quot;ICSR Complexity&amp;quot;
    ),
    `IT Systems` = c(
      &amp;quot;Availability&amp;quot;,
      &amp;quot;Complexity&amp;quot;,
      &amp;quot;Performance&amp;quot;,
      &amp;quot;Quality&amp;quot;
    ),
    Methods = c(
      &amp;quot;Medial Review Process\n(Data Guides)&amp;quot;,
      &amp;quot;Decisioning\n(Submission Rules)&amp;quot;,
      &amp;quot;Risk Management&amp;quot;,
      &amp;quot;Quality Mangement System&amp;quot;,
      &amp;quot;Change Management&amp;quot;
    ),
    Measurements = c(
      &amp;quot;Data Entry&amp;quot;,
      &amp;quot;Medical Coding&amp;quot;
    ),
    Environment = c(
      &amp;quot;HA Regulations&amp;quot;,
      &amp;quot;Local Cultures&amp;quot;,
      &amp;quot;Company Culture&amp;quot;,
      &amp;quot;Epidemiology&amp;quot;,
      &amp;quot;Local Health Systems&amp;quot;
    )
  ),
  effect = &amp;quot;ICSR not\nreported\nto HA&amp;quot;
)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-3-1.png&#34; width=&#34;960&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;check-sheets&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Check Sheets&lt;/h2&gt;
&lt;p&gt;Serve to generate process related data, should be part of a general data collection plan. Will be automated for most processes.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Audit Trail Data&lt;/li&gt;
&lt;li&gt;Quality Evidence&lt;/li&gt;
&lt;li&gt;IT Logs&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Classically serves to attribute each effect (ICSR not reported to HA) to any of the suspected causes in the cause and effect diagram.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;control-charts-shewhart-charts&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Control Charts (Shewhart Charts)&lt;/h2&gt;
&lt;p&gt;Process Monitoring Charts, can be used to track whether process KPI are in or out of control.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;data(&amp;quot;pistonrings&amp;quot;)
df &amp;lt;- as_tibble(pistonrings)

df_g1 &amp;lt;- df %&amp;gt;%
  group_by(sample) %&amp;gt;%
  mutate(rwn = row_number()) %&amp;gt;%
  filter(rwn == 1)

qcc_shew &amp;lt;- qcc(
  df$diameter,
  type = &amp;quot;xbar.one&amp;quot;,
  rules = c(1, 2, 3, 4)
)

qcc_shew&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Quality Control Chart ───────────────────────── 
## 
## Chart type                 = xbar.one 
## Data (phase I)             = df$diameter 
## Number of groups           = 200 
## Group sample size          = 1 
## Center of group statistics = 74.0036 
## Standard deviation         = 0.01001461 
## 
## Control limits at nsigmas  = 3 
##       LCL      UCL
##  73.97356 74.03365&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;str(qcc_shew)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## List of 12
##  $ call      : language qcc(data = df$diameter, type = &amp;quot;xbar.one&amp;quot;, rules = c(1, 2, 3, 4))
##  $ type      : chr &amp;quot;xbar.one&amp;quot;
##  $ data.name : chr &amp;quot;df$diameter&amp;quot;
##  $ data      : num [1:200, 1] 74 74 74 74 74 ...
##   ..- attr(*, &amp;quot;dimnames&amp;quot;)=List of 2
##   .. ..$ Group  : chr [1:200] &amp;quot;1&amp;quot; &amp;quot;2&amp;quot; &amp;quot;3&amp;quot; &amp;quot;4&amp;quot; ...
##   .. ..$ Samples: NULL
##  $ statistics: Named num [1:200] 74 74 74 74 74 ...
##   ..- attr(*, &amp;quot;names&amp;quot;)= chr [1:200] &amp;quot;1&amp;quot; &amp;quot;2&amp;quot; &amp;quot;3&amp;quot; &amp;quot;4&amp;quot; ...
##  $ sizes     : int [1:200] 1 1 1 1 1 1 1 1 1 1 ...
##  $ center    : num 74
##  $ std.dev   : num 0.01
##  $ rules     : num [1:4] 1 2 3 4
##  $ nsigmas   : num 3
##  $ limits    : num [1, 1:2] 74 74
##   ..- attr(*, &amp;quot;dimnames&amp;quot;)=List of 2
##   .. ..$ : chr &amp;quot;&amp;quot;
##   .. ..$ : chr [1:2] &amp;quot;LCL&amp;quot; &amp;quot;UCL&amp;quot;
##  $ violations: num [1:200] NA NA NA NA NA NA NA NA NA NA ...
##   ..- attr(*, &amp;quot;WesternElectricRules&amp;quot;)= num [1:4] 1 2 3 4
##  - attr(*, &amp;quot;class&amp;quot;)= chr &amp;quot;qcc&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(qcc_shew)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-4-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;qcc_shew$violations&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##   [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
##  [26] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
##  [51] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA  1 NA NA NA NA NA NA NA NA
##  [76] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## [101] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## [126] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
## [151] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA  2 NA NA NA NA
## [176] NA NA NA NA NA NA NA  3 NA  3  1  4  4  4  4  4  4  1  2  2  4  4  4 NA NA
## attr(,&amp;quot;WesternElectricRules&amp;quot;)
## [1] 1 2 3 4&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;qcc_shew$rules&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 1 2 3 4&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;qcc&lt;/code&gt; uses the &lt;a href=&#34;https://en.wikipedia.org/wiki/Western_Electric_rules&#34;&gt;Western Electric Rules&lt;/a&gt; to flag out of control values.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;One point plots outside 3-sigma control limits.&lt;/li&gt;
&lt;li&gt;Two of three consecutive points plot beyond a 2-sigma limit.&lt;/li&gt;
&lt;li&gt;Four of five consecutive points plot beyond a 1-sigma limit.&lt;/li&gt;
&lt;li&gt;Eight consecutive points plot on one side of the center line.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These rules do not appear to be customizable, it seems to me that &lt;a href=&#34;https://en.wikipedia.org/wiki/Nelson_rules&#34;&gt;Nelson Rules&lt;/a&gt; are
a bit more complete and cover more non-random scenarios such as trends and oscillation.&lt;/p&gt;
&lt;p&gt;The control chart type depends on the data type and its distribution. There is a decision tree for the chart selection.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;DiagrammeR::mermaid(
  &amp;quot;graph TB
    A(Select Control Chart)--&amp;gt;B{data type}
    B --&amp;gt; |Discrete| C{Distribution}
    B --&amp;gt; |Continuous| D{Sample Size}
    C --&amp;gt; |Poisson| E{Sample Size}
    C --&amp;gt; |Binominal| F{Frequency}
    E --&amp;gt; |constant| G[c-chart]
    E --&amp;gt; |variable| H[u-chart]
    F --&amp;gt; |count| I[np-chart]
    F --&amp;gt; |proportion| J[p-chart]
    D --&amp;gt; |n = 1| K[x.one + R chart]
    D --&amp;gt; |n = 2-10| L[x + R chart]
    D --&amp;gt; |n &amp;gt; 10| M[x + S chart]
&amp;quot;
)&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;htmlwidget-1&#34; style=&#34;width:672px;height:480px;&#34; class=&#34;DiagrammeR html-widget&#34;&gt;&lt;/div&gt;
&lt;script type=&#34;application/json&#34; data-for=&#34;htmlwidget-1&#34;&gt;{&#34;x&#34;:{&#34;diagram&#34;:&#34;graph TB\n    A(Select Control Chart)--&gt;B{data type}\n    B --&gt; |Discrete| C{Distribution}\n    B --&gt; |Continuous| D{Sample Size}\n    C --&gt; |Poisson| E{Sample Size}\n    C --&gt; |Binominal| F{Frequency}\n    E --&gt; |constant| G[c-chart]\n    E --&gt; |variable| H[u-chart]\n    F --&gt; |count| I[np-chart]\n    F --&gt; |proportion| J[p-chart]\n    D --&gt; |n = 1| K[x.one + R chart]\n    D --&gt; |n = 2-10| L[x + R chart]\n    D --&gt; |n &gt; 10| M[x + S chart]\n&#34;},&#34;evals&#34;:[],&#34;jsHooks&#34;:[]}&lt;/script&gt;
&lt;/div&gt;
&lt;div id=&#34;histogram&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Histogram&lt;/h2&gt;
&lt;p&gt;self explanatory, explore distribution of continuous variable.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;ggplot(df_g1) +
  geom_histogram(aes(diameter))&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-6-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;pareto-chart&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Pareto Chart&lt;/h2&gt;
&lt;p&gt;Plot Frequency of effect causes, apply &lt;a href=&#34;https://en.wikipedia.org/wiki/Pareto_principle&#34;&gt;80:20 rule&lt;/a&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;defect &amp;lt;- c(80, 27, 66, 94, 33)
names(defect) &amp;lt;- c(&amp;quot;HA Regulations&amp;quot;, &amp;quot;Risk Management&amp;quot;, &amp;quot;Data Entry&amp;quot;, &amp;quot;Change Management&amp;quot;, &amp;quot;IT System Performance&amp;quot;)
qcc_pareto &amp;lt;- qcc::paretoChart(defect)
str(qcc_pareto)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## List of 3
##  $ call     : language qcc::paretoChart(data = defect)
##  $ data.name: chr &amp;quot;defect&amp;quot;
##  $ tab      : num [1:5, 1:4] 94 80 66 33 27 94 174 240 273 300 ...
##   ..- attr(*, &amp;quot;dimnames&amp;quot;)=List of 2
##   .. ..$ defect: chr [1:5] &amp;quot;Change Management&amp;quot; &amp;quot;HA Regulations&amp;quot; &amp;quot;Data Entry&amp;quot; &amp;quot;IT System Performance&amp;quot; ...
##   .. ..$       : chr [1:4] &amp;quot;Frequency&amp;quot; &amp;quot;Cum.Freq.&amp;quot; &amp;quot;Percentage&amp;quot; &amp;quot;Cum.Percent.&amp;quot;
##  - attr(*, &amp;quot;class&amp;quot;)= chr &amp;quot;paretoChart&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(qcc_pareto) +
  theme(axis.text.x = element_text(angle = 90))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-7-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;scatter-plots&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Scatter Plots&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;validate established cause and effect relationships&lt;/li&gt;
&lt;li&gt;multivariate control diagrams&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;stratification&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Stratification&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;identify relevant process subgroups by which to stratify the analysis&lt;/li&gt;
&lt;li&gt;use of process flow charts&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;control-charts&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Control Charts&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;ideally have even sample sizes to obtain even upper and lower control limits, although &lt;code&gt;qcc&lt;/code&gt; allow you to create control charts with uneven sample sizes but oc plots cannot be created, thus it is difficult to make good estimates about appropriate sample sizes.&lt;/li&gt;
&lt;li&gt;plot in pairs to monitor different summary statistics like x-bar chart (means) and range chart (R chart) as a measure for variance&lt;/li&gt;
&lt;li&gt;use Shewart’s formula to estimate control limits&lt;/li&gt;
&lt;li&gt;phase I determine a calibration period during which the process is in control and determine control limits&lt;/li&gt;
&lt;li&gt;phase II monitor process for out of range values&lt;/li&gt;
&lt;/ul&gt;
&lt;div id=&#34;continuous-grouped-variables&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Continuous Grouped Variables&lt;/h2&gt;
&lt;p&gt;We are going to measure a continuous variable over time such as the thickness of a board.&lt;/p&gt;
&lt;p&gt;Controls Charts use the &lt;strong&gt;population&lt;/strong&gt; standard deviation to flag out of control data points.&lt;/p&gt;
&lt;p&gt;Determine &lt;strong&gt;population&lt;/strong&gt; standard deviation:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;determine a calibration period during which the process is in control (set n)&lt;/li&gt;
&lt;li&gt;at each time point measure samples and take the mean&lt;/li&gt;
&lt;li&gt;according to the &lt;a href=&#34;https://en.wikipedia.org/wiki/Central_limit_theorem&#34;&gt;central limit theorem&lt;/a&gt; the distribution of the means will be normally distributed&lt;/li&gt;
&lt;li&gt;measure population standard deviation of the means &lt;code&gt;sqrt((n-1)/n) * sd(x)&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;in statistical process control this is considered to be biased&lt;/li&gt;
&lt;li&gt;instead the range and the shewart constant (d2/c4) which depends on the number of measurements (n) are used by the Shewart’s formula to estimate control limits&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Determine sample size:
- ARL is the average run length (number of consecutive samples) needed to get a point that is outside the upper and lower control limits. For a normal distribution the ARL is 370. So every 370 measurements we will get a false positive signal.
- The power of a control chart depends on the sample size. The operator characteristics (OC) plots the probabilty of a false negative (type two error) against the process shift in standard deviations for several sample sizes (n). For a given shift in process deviation we can also determine the probability &lt;em&gt;beta&lt;/em&gt; for a false negative using the OC curve.
- ARL = 1 / (1 - &lt;em&gt;beta&lt;/em&gt;)&lt;/p&gt;
&lt;div id=&#34;x-bar-chart&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;X-bar Chart&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Monitors the mean&lt;/li&gt;
&lt;li&gt;uses d2 Shewart’s constants&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## # A tibble: 200 x 3
##    diameter sample trial
##       &amp;lt;dbl&amp;gt;  &amp;lt;int&amp;gt; &amp;lt;lgl&amp;gt;
##  1     74.0      1 TRUE 
##  2     74.0      1 TRUE 
##  3     74.0      1 TRUE 
##  4     74.0      1 TRUE 
##  5     74.0      1 TRUE 
##  6     74.0      2 TRUE 
##  7     74.0      2 TRUE 
##  8     74.0      2 TRUE 
##  9     74.0      2 TRUE 
## 10     74.0      2 TRUE 
## # … with 190 more rows&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# pivot from long to wide
qcc_gr &amp;lt;- qcc::qccGroups(df, diameter, sample)

qcc_gr&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##      [,1]   [,2]   [,3]   [,4]   [,5]
## 1  74.030 74.002 74.019 73.992 74.008
## 2  73.995 73.992 74.001 74.011 74.004
## 3  73.988 74.024 74.021 74.005 74.002
## 4  74.002 73.996 73.993 74.015 74.009
## 5  73.992 74.007 74.015 73.989 74.014
## 6  74.009 73.994 73.997 73.985 73.993
## 7  73.995 74.006 73.994 74.000 74.005
## 8  73.985 74.003 73.993 74.015 73.988
## 9  74.008 73.995 74.009 74.005 74.004
## 10 73.998 74.000 73.990 74.007 73.995
## 11 73.994 73.998 73.994 73.995 73.990
## 12 74.004 74.000 74.007 74.000 73.996
## 13 73.983 74.002 73.998 73.997 74.012
## 14 74.006 73.967 73.994 74.000 73.984
## 15 74.012 74.014 73.998 73.999 74.007
## 16 74.000 73.984 74.005 73.998 73.996
## 17 73.994 74.012 73.986 74.005 74.007
## 18 74.006 74.010 74.018 74.003 74.000
## 19 73.984 74.002 74.003 74.005 73.997
## 20 74.000 74.010 74.013 74.020 74.003
## 21 73.988 74.001 74.009 74.005 73.996
## 22 74.004 73.999 73.990 74.006 74.009
## 23 74.010 73.989 73.990 74.009 74.014
## 24 74.015 74.008 73.993 74.000 74.010
## 25 73.982 73.984 73.995 74.017 74.013
## 26 74.012 74.015 74.030 73.986 74.000
## 27 73.995 74.010 73.990 74.015 74.001
## 28 73.987 73.999 73.985 74.000 73.990
## 29 74.008 74.010 74.003 73.991 74.006
## 30 74.003 74.000 74.001 73.986 73.997
## 31 73.994 74.003 74.015 74.020 74.004
## 32 74.008 74.002 74.018 73.995 74.005
## 33 74.001 74.004 73.990 73.996 73.998
## 34 74.015 74.000 74.016 74.025 74.000
## 35 74.030 74.005 74.000 74.016 74.012
## 36 74.001 73.990 73.995 74.010 74.024
## 37 74.015 74.020 74.024 74.005 74.019
## 38 74.035 74.010 74.012 74.015 74.026
## 39 74.017 74.013 74.036 74.025 74.026
## 40 74.010 74.005 74.029 74.000 74.020&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q1 &amp;lt;- qcc(
  qcc_gr[1:25, ],
  type = &amp;quot;xbar&amp;quot;,
  newdata = qcc_gr[26:nrow(qcc_gr), ],
  rules = c(1, 2, 3, 4)
)

q1&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Quality Control Chart ───────────────────────── 
## 
## Chart type                 = xbar 
## Data (phase I)             = qcc_gr[1:25, ] 
## Number of groups           = 25 
## Group sample size          = 5 
## Center of group statistics = 74.00118 
## Standard deviation         = 0.009785039 
## 
## New data (phase II)        = qcc_gr[26:nrow(qcc_gr), ] 
## Number of groups           = 15 
## Group sample size          = 5 
## 
## Control limits at nsigmas  = 3 
##       LCL     UCL
##  73.98805 74.0143&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(q1)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-8-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q1_oc &amp;lt;- qcc::ocCurves(q1)

q1_oc&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Operating Characteristic Curves ─────────────── 
## 
## Chart type                 = xbar 
## Prob. type II error (beta) =
##               sample size
## shift (StdDev)      1      5     10     15     20
##            0.0 0.9973 0.9973 0.9973 0.9973 0.9973
##            0.1 0.9972 0.9966 0.9959 0.9952 0.9944
##            0.2 0.9968 0.9944 0.9909 0.9869 0.9823
##            :                                     
##            4.9 0.0287 0.0000 0.0000 0.0000 0.0000
##            5.0 0.0228 0.0000 0.0000 0.0000 0.0000
## Average run length (ARL)   =
##               sample size
## shift (StdDev)   1   5  10  15  20
##            0.0 370 370 370 370 370
##            0.1 353 296 244 206 178
##            0.2 308 178 110  76  57
##            :                      
##            4.9   1   1   1   1   1
##            5.0   1   1   1   1   1&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(q1_oc)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-8-2.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;arl_n5 &amp;lt;- q1_oc$ARL %&amp;gt;%
  as_tibble(rownames = &amp;quot;shift_stdev&amp;quot;) %&amp;gt;%
  filter(shift_stdev == &amp;quot;1.0&amp;quot;) %&amp;gt;%
  pull(`5`)

arl_n5&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 4.495312&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So for a change in average diameter by 0.009785 we need in average 4.4953122 runs to detect a change in the mean statistic using 5 samples.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;r-chart&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;R Chart&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;monitors process stability by means of the sample ranges&lt;/li&gt;
&lt;li&gt;uses d3 and d2 Shewart’s constants&lt;/li&gt;
&lt;li&gt;appropriate for sample sizes &amp;lt; 8&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q2 &amp;lt;- qcc(
  qcc_gr[1:25, ],
  type = &amp;quot;R&amp;quot;,
  newdata = qcc_gr[26:nrow(qcc_gr), ],
  rules = c(1, 2, 3, 4)
)

q2&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Quality Control Chart ───────────────────────── 
## 
## Chart type                 = R 
## Data (phase I)             = qcc_gr[1:25, ] 
## Number of groups           = 25 
## Group sample size          = 5 
## Center of group statistics = 0.02276 
## Standard deviation         = 0.009785039 
## 
## New data (phase II)        = qcc_gr[26:nrow(qcc_gr), ] 
## Number of groups           = 15 
## Group sample size          = 5 
## 
## Control limits at nsigmas  = 3 
##  LCL        UCL
##    0 0.04812533&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(q2)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-9-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q2_oc &amp;lt;- qcc::ocCurves(q2)

# throws error, https://github.com/luca-scr/qcc/issues/31
# plot(q2_oc)

q2_oc&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Operating Characteristic Curves ─────────────── 
## 
## Chart type                 = R 
## Prob. type II error (beta) =
##                 sample size
## scale multiplier      2      5     10     15     20
##              1.0 0.9908 0.9954 0.9956 0.9955 0.9954
##              1.1 0.9822 0.9864 0.9841 0.9818 0.9798
##              1.2 0.9701 0.9692 0.9583 0.9486 0.9403
##              :                                     
##              5.9 0.3413 0.0233 0.0003 0.0000 0.0000
##              6.0 0.3360 0.0219 0.0002 0.0000 0.0000
## Average run length (ARL)   =
##                 sample size
## scale multiplier   2   5  10  15  20
##              1.0 109 217 229 223 217
##              1.1  56  74  63  55  50
##              1.2  33  32  24  19  17
##              :                      
##              5.9   2   1   1   1   1
##              6.0   2   1   1   1   1&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;arl_n5 &amp;lt;- q2_oc$ARL %&amp;gt;%
  as_tibble(rownames = &amp;quot;scale_multiplier&amp;quot;) %&amp;gt;%
  filter(scale_multiplier == &amp;quot;1.5&amp;quot;) %&amp;gt;%
  pull(`5`)

arl_n5&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] 7.198125&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So for a change in range by 50% need in average 7.1981249 runs using 5 samples.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;s-chart&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;S Chart&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;monitors process stability by means of standard deviations&lt;/li&gt;
&lt;li&gt;uses c4 Shewart’s constant&lt;/li&gt;
&lt;li&gt;appropriate for sample sizes &amp;gt;= 8&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q3 &amp;lt;- qcc(
  qcc_gr[1:25, ],
  type = &amp;quot;S&amp;quot;,
  newdata = qcc_gr[26:nrow(qcc_gr), ],
  rules = c(1, 2, 3, 4)
)

q3&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Quality Control Chart ───────────────────────── 
## 
## Chart type                 = S 
## Data (phase I)             = qcc_gr[1:25, ] 
## Number of groups           = 25 
## Group sample size          = 5 
## Center of group statistics = 0.009240037 
## Standard deviation         = 0.009829977 
## 
## New data (phase II)        = qcc_gr[26:nrow(qcc_gr), ] 
## Number of groups           = 15 
## Group sample size          = 5 
## 
## Control limits at nsigmas  = 3 
##  LCL        UCL
##    0 0.01930242&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(q3)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-10-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q3_oc &amp;lt;- qcc::ocCurves(q3)

# throws error, https://github.com/luca-scr/qcc/issues/31
# plot(q3_oc)

q3_oc&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Operating Characteristic Curves ─────────────── 
## 
## Chart type                 = S 
## Prob. type II error (beta) =
##                 sample size
## scale multiplier      2      5     10     15     20
##              1.0 0.9908 0.9961 0.9970 0.9972 0.9972
##              1.1 0.9822 0.9874 0.9860 0.9838 0.9812
##              1.2 0.9701 0.9700 0.9574 0.9425 0.9261
##              :                                     
##              5.9 0.3413 0.0212 0.0001 0.0000 0.0000
##              6.0 0.3360 0.0199 0.0001 0.0000 0.0000
## Average run length (ARL)   =
##                 sample size
## scale multiplier   2   5  10  15  20
##              1.0 109 256 333 351 358
##              1.1  56  79  72  62  53
##              1.2  33  33  23  17  14
##              :                      
##              5.9   2   1   1   1   1
##              6.0   2   1   1   1   1&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;arl_n5 &amp;lt;- q3_oc$ARL %&amp;gt;%
  as_tibble(rownames = &amp;quot;scale_multiplier&amp;quot;) %&amp;gt;%
  filter(scale_multiplier == &amp;quot;1.5&amp;quot;) %&amp;gt;%
  pull(`5`)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So for a change in range by 50% need in average 6.9559271 runs using 5 samples.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;continuous-non-grouped-variables&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Continuous Non-Grouped Variables&lt;/h2&gt;
&lt;p&gt;If a process is described best by a continuous one at a time measurement we cannot use sampling&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;central limit theorem does not apply&lt;/li&gt;
&lt;li&gt;normality needs to be confirmed&lt;/li&gt;
&lt;li&gt;if possible use power transformation to normalize&lt;/li&gt;
&lt;li&gt;accompany x-bar chart with moving range chart&lt;/li&gt;
&lt;/ul&gt;
&lt;div id=&#34;x-bar-chart-1&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;X-bar chart&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;uses the moving range to calculate global standard deviation&lt;/li&gt;
&lt;li&gt;takes Shewart’s constant d2 for n = 2&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# airplane paint viscosity, one batch takes hours to produce and no rational subgroups can be formed
data(&amp;quot;viscosity&amp;quot;)
df_vis &amp;lt;- viscosity

df_vis&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##    batch viscosity trial
## 1      1     34.05  TRUE
## 2      2     34.40  TRUE
## 3      3     33.59  TRUE
## 4      4     35.96  TRUE
## 5      5     34.70  TRUE
## 6      6     33.51  TRUE
## 7      7     33.79  TRUE
## 8      8     34.04  TRUE
## 9      9     34.52  TRUE
## 10    10     33.75  TRUE
## 11    11     33.27  TRUE
## 12    12     33.71  TRUE
## 13    13     34.03  TRUE
## 14    14     34.58  TRUE
## 15    15     34.02  TRUE
## 16    16     33.97  TRUE
## 17    17     34.05  TRUE
## 18    18     34.04  TRUE
## 19    19     33.73  TRUE
## 20    20     34.05  TRUE
## 21    21     34.39 FALSE
## 22    22     33.75 FALSE
## 23    23     33.40 FALSE
## 24    24     33.27 FALSE
## 25    25     34.65 FALSE
## 26    26     34.80 FALSE
## 27    27     34.55 FALSE
## 28    28     35.40 FALSE
## 29    29     34.75 FALSE
## 30    30     34.50 FALSE
## 31    31     34.70 FALSE
## 32    32     34.29 FALSE
## 33    33     34.61 FALSE
## 34    34     34.49 FALSE
## 35    35     35.03 FALSE&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q4 &amp;lt;- qcc(
  df_vis$viscosity[df_vis$trial],
  type = &amp;quot;xbar.one&amp;quot;,
  newdata = df_vis$viscosity[! df_vis$trial],
  rules = c(1, 2, 3, 4)
)

q4&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Quality Control Chart ───────────────────────── 
## 
## Chart type                 = xbar.one 
## Data (phase I)             = df_vis$viscosity[df_vis$trial] 
## Number of groups           = 20 
## Group sample size          = 1 
## Center of group statistics = 34.088 
## Standard deviation         = 0.5076521 
## 
## New data (phase II)        = df_vis$viscosity[!df_vis$trial] 
## Number of groups           = 15 
## Group sample size          = 1 
## 
## Control limits at nsigmas  = 3 
##       LCL      UCL
##  32.56504 35.61096&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(q4)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-11-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;r-chart-1&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;R Chart&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;uses the range between a given and the next measurement&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;vis_mat &amp;lt;- df_vis %&amp;gt;%
  mutate(lead = lead(viscosity)) %&amp;gt;%
  select(viscosity, lead) %&amp;gt;%
  filter(! is.na(lead)) %&amp;gt;%
  as.matrix()


q5 &amp;lt;- qcc(
  vis_mat[df_vis$trial[1:nrow(df_vis)-1], ],
  type = &amp;quot;R&amp;quot;,
  newdata = vis_mat[! df_vis$trial[1:nrow(df_vis)-1], ]
)

q5&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Quality Control Chart ───────────────────────── 
## 
## Chart type                 = R 
## Data (phase I)             = vis_mat[df_vis$trial[1:nrow(df_vis) - 1], ] 
## Number of groups           = 20 
## Group sample size          = 2 
## Center of group statistics = 0.561 
## Standard deviation         = 0.4973404 
## 
## New data (phase II)        = vis_mat[!df_vis$trial[1:nrow(df_vis) - 1], ] 
## Number of groups           = 14 
## Group sample size          = 2 
## 
## Control limits at nsigmas  = 3 
##  LCL      UCL
##    0 1.832953&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(q5)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-12-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;discrete-measurements&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Discrete Measurements&lt;/h2&gt;
&lt;div id=&#34;p-and-np-charts&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;p and np Charts&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;measure frequency or relative frequency&lt;/li&gt;
&lt;li&gt;p is for relative frequency&lt;/li&gt;
&lt;li&gt;np for frequency&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;data(&amp;quot;orangejuice&amp;quot;)
df_oj &amp;lt;- orangejuice

q6 &amp;lt;- qcc(
  df_oj$D[df_oj$trial],
  df_oj$size[df_oj$trial],
  type = &amp;quot;p&amp;quot;,
  newdata = df_oj$D[! df_oj$trial],
  newsizes = df_oj$size[! df_oj$trial],
  rules = c(1, 2, 3, 4)
)

q6&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Quality Control Chart ───────────────────────── 
## 
## Chart type                 = p 
## Data (phase I)             = df_oj$D[df_oj$trial] 
## Number of groups           = 30 
## Group sample size          = 50 
## Center of group statistics = 0.2313333 
## Standard deviation         = 0.05963526 
## 
## New data (phase II)        = df_oj$D[!df_oj$trial] 
## Number of groups           = 24 
## Group sample size          = 50 
## 
## Control limits at nsigmas  = 3 
##          LCL       UCL
##   0.05242755 0.4102391
##   0.05242755 0.4102391
## :                     
##   0.05242755 0.4102391&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(q6)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-13-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q6_oc &amp;lt;- qcc::ocCurves(q6)

q6_oc&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Operating Characteristic Curves ─────────────── 
## 
## Chart type                 = p 
## Prob. type II error (beta) =
##                       
## fraction nonconforming   [,1]
##                   0.00 0.0000
##                   0.01 0.0894
##                   0.02 0.2642
##                   :          
##                   0.99 0.0000
##                   1.00 0.0000
## Average run length (ARL)   =
##                       
## fraction nonconforming [,1]
##                   0.00    1
##                   0.01    1
##                   0.02    1
##                   :        
##                   0.99    1
##                   1.00    1&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(q6_oc)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-13-2.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(q6_oc, what = &amp;quot;ARL&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-13-3.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q6a &amp;lt;- qcc(
  df_oj$D[df_oj$trial],
  df_oj$size[df_oj$trial],
  type = &amp;quot;np&amp;quot;,
  newdata = df_oj$D[! df_oj$trial],
  newsizes = df_oj$size[! df_oj$trial],
  rules = c(1, 2, 3, 4)
)

q6a&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Quality Control Chart ───────────────────────── 
## 
## Chart type                 = np 
## Data (phase I)             = df_oj$D[df_oj$trial] 
## Number of groups           = 30 
## Group sample size          = 50 
## Center of group statistics = 11.56667 
## Standard deviation         = 2.981763 
## 
## New data (phase II)        = df_oj$D[!df_oj$trial] 
## Number of groups           = 24 
## Group sample size          = 50 
## 
## Control limits at nsigmas  = 3 
##       LCL      UCL
##  2.621377 20.51196&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(q6a)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-13-4.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;c-chart&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;c chart&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;for count of events that cannot be attributed to a sample size&lt;/li&gt;
&lt;li&gt;examples: nonconformities per day, defects per m^2 of fabric or flaws per metal plate&lt;/li&gt;
&lt;li&gt;unit should stay constant&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;library(SixSigma)

ss.data.thickness2 %&amp;gt;%
  head(15)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##    day shift thickness ushift flaws
## 1    1     1     0.713    1.1     9
## 2    1     1     0.776    1.1    NA
## 3    1     1     0.743    1.1    NA
## 4    1     1     0.713    1.1    NA
## 5    1     1     0.747    1.1    NA
## 6    1     1     0.753    1.1    NA
## 7    1     2     0.749    1.2     2
## 8    1     2     0.726    1.2     7
## 9    1     2     0.774    1.2     9
## 10   1     2     0.744    1.2    NA
## 11   1     2     0.718    1.2    NA
## 12   1     2     0.677    1.2    NA
## 13   2     1     0.778    2.1     7
## 14   2     1     0.802    2.1    NA
## 15   2     1     0.798    2.1    NA&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# remove uninspected items
df_flaws &amp;lt;- ss.data.thickness2 %&amp;gt;%
  as_tibble() %&amp;gt;%
  filter(! is.na(flaws))

df_flaws&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## # A tibble: 23 x 5
##    day   shift thickness ushift flaws
##    &amp;lt;fct&amp;gt; &amp;lt;fct&amp;gt;     &amp;lt;dbl&amp;gt; &amp;lt;chr&amp;gt;  &amp;lt;int&amp;gt;
##  1 1     1         0.713 1.1        9
##  2 1     2         0.749 1.2        2
##  3 1     2         0.726 1.2        7
##  4 1     2         0.774 1.2        9
##  5 2     1         0.778 2.1        7
##  6 2     2         0.78  2.2        4
##  7 2     2         0.729 2.2        6
##  8 2     2         0.793 2.2        9
##  9 3     1         0.775 3.1        9
## 10 3     2         0.727 3.2        4
## # … with 13 more rows&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q7 &amp;lt;- qcc(
  df_flaws$flaws,
  type = &amp;quot;c&amp;quot;,
  rules = c(1, 2, 3, 4)
)

q7&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Quality Control Chart ───────────────────────── 
## 
## Chart type                 = c 
## Data (phase I)             = df_flaws$flaws 
## Number of groups           = 23 
## Group sample size          = 1 
## Center of group statistics = 5.26087 
## Standard deviation         = 2.293659 
## 
## Control limits at nsigmas  = 3 
##  LCL      UCL
##    0 12.14185&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(q7)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-14-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q7_oc &amp;lt;- qcc::ocCurves(q7)

q7_oc&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Operating Characteristic Curves ─────────────── 
## 
## Chart type                 = c 
## Prob. type II error (beta) =
##        [,1]
## 0.00  1e+00
## 1.00  1e+00
## 2.00  1e+00
## :          
## 28.00 6e-04
## 29.00 3e-04
## Average run length (ARL)   =
##              [,1]
## 0.00          Inf
## 1.00  15723815904
## 2.00      4822834
## :                
## 28.00           1
## 29.00           1&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(q7_oc, what = &amp;quot;ARL&amp;quot;) +
  coord_cartesian(ylim = c(0, 10))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-14-2.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;u-chart&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;u chart&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;average number of defects from a varying number of samples&lt;/li&gt;
&lt;li&gt;for example: 18 flaws from 3 metal plates, then 3 flaws in 5 metal plates&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df_gr_flaws &amp;lt;- df_flaws %&amp;gt;%
  group_by(ushift) %&amp;gt;%
  summarise(n_plates_per_shift = n(),
            n_flaws_per_shift = sum(flaws))

df_gr_flaws&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## # A tibble: 14 x 3
##    ushift n_plates_per_shift n_flaws_per_shift
##    &amp;lt;chr&amp;gt;               &amp;lt;int&amp;gt;             &amp;lt;int&amp;gt;
##  1 1.1                     1                 9
##  2 1.2                     3                18
##  3 2.1                     1                 7
##  4 2.2                     3                19
##  5 3.1                     1                 9
##  6 3.2                     1                 4
##  7 4.1                     2                 6
##  8 4.2                     1                 4
##  9 5.1                     1                 5
## 10 5.2                     2                13
## 11 6.1                     2                 5
## 12 6.2                     1                 4
## 13 7.1                     1                 7
## 14 7.2                     3                11&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;qu8 &amp;lt;- qcc(
  df_gr_flaws$n_flaws_per_shift,
  type = &amp;quot;u&amp;quot;,
  sizes = df_gr_flaws$n_plates_per_shift,
  rules = c(1, 2, 3, 4)
)

qu8&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Quality Control Chart ───────────────────────── 
## 
## Chart type                 = u 
## Data (phase I)             = df_gr_flaws$n_flaws_per_shift 
## Number of groups           = 14 
## Group sample sizes         =              
##   sizes  1 2 3
##   counts 8 3 3
## Center of group statistics = 5.26087 
## Standard deviation         = 2.293659 
## 
## Control limits at nsigmas  = 3 
##        LCL       UCL
##   0.000000 12.141845
##   1.288136  9.233603
## :                   
##   1.288136  9.233603&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(qu8)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-15-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# OC curves need constant sample sizes
# qu8_oc &amp;lt;- qcc::ocCurves(qu8)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;capabilityperformance-indices&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Capability/Performance Indices&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;measure whether consumer specified upper and lower specification limits (LSL/USL) are compatible with process control limits (LCL/UCL)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;performance measures long-term variability and capacity short-term variability&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;C = (USL - LSL) / 6sigma&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;index below 1 is unsufficient, 1.33-167 is outstanding and 2 refers to six sigma quality&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;adjusted index variations account for processes that are not perfectly centered&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cp: capability index&lt;br /&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cp_l: lower index&lt;br /&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cp_u: upper index&lt;br /&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cp_k: minimum of lower and upper index&lt;br /&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cpm : Tagauchi index (controls for not centered processes)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q1&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Quality Control Chart ───────────────────────── 
## 
## Chart type                 = xbar 
## Data (phase I)             = qcc_gr[1:25, ] 
## Number of groups           = 25 
## Group sample size          = 5 
## Center of group statistics = 74.00118 
## Standard deviation         = 0.009785039 
## 
## New data (phase II)        = qcc_gr[26:nrow(qcc_gr), ] 
## Number of groups           = 15 
## Group sample size          = 5 
## 
## Control limits at nsigmas  = 3 
##       LCL     UCL
##  73.98805 74.0143&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q1_pc &amp;lt;- qcc::processCapability(q1, spec.limits = c(73.975, 74.025))

q1_pc&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Process Capability Analysis ─────────────────── 
## 
## Number of obs = 125          Target = 74      
## Center        = 74.00118     LSL    = 73.975  
## StdDev        = 0.009785039  USL    = 74.025  
##                   
## Capability indices  Value   2.5%  97.5%
##               Cp    0.852  0.746  0.957
##               Cp_l  0.892  0.786  0.997
##               Cp_u  0.812  0.714  0.910
##               Cp_k  0.812  0.695  0.928
##               Cpm   0.846  0.740  0.951
## 
## Exp&amp;lt;LSL 0.0037%   Obs&amp;lt;LSL 0.008%
## Exp&amp;gt;USL 0.0075%   Obs&amp;gt;USL 0.008%&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(q1_pc)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-16-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q1_pc &amp;lt;- qcc::processCapability(q1, spec.limits = c(73.95, 74.05))

q1_pc&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## ── Process Capability Analysis ─────────────────── 
## 
## Number of obs = 125          Target = 74      
## Center        = 74.00118     LSL    = 73.95   
## StdDev        = 0.009785039  USL    = 74.05   
##                   
## Capability indices  Value  2.5%  97.5%
##               Cp     1.70  1.49   1.91
##               Cp_l   1.74  1.55   1.93
##               Cp_u   1.66  1.48   1.84
##               Cp_k   1.66  1.45   1.88
##               Cpm    1.69  1.48   1.90
## 
## Exp&amp;lt;LSL 0%    Obs&amp;lt;LSL 0%
## Exp&amp;gt;USL 0%    Obs&amp;gt;USL 0%&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot(q1_pc)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-16-2.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;cusum-chart&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;CUSUM Chart&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;cumulative sum chart&lt;/li&gt;
&lt;li&gt;two lines one below zero and one above zero and a center which is the expected value.&lt;/li&gt;
&lt;li&gt;positive deviation of the process from the central value results in an uptick of both lines&lt;/li&gt;
&lt;li&gt;negative deviation of the process from the central value results in a down tick of both lines&lt;/li&gt;
&lt;li&gt;both lines never cross the central line&lt;/li&gt;
&lt;li&gt;supposedly more sensitive than regular control charts&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;qcc_gr&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##      [,1]   [,2]   [,3]   [,4]   [,5]
## 1  74.030 74.002 74.019 73.992 74.008
## 2  73.995 73.992 74.001 74.011 74.004
## 3  73.988 74.024 74.021 74.005 74.002
## 4  74.002 73.996 73.993 74.015 74.009
## 5  73.992 74.007 74.015 73.989 74.014
## 6  74.009 73.994 73.997 73.985 73.993
## 7  73.995 74.006 73.994 74.000 74.005
## 8  73.985 74.003 73.993 74.015 73.988
## 9  74.008 73.995 74.009 74.005 74.004
## 10 73.998 74.000 73.990 74.007 73.995
## 11 73.994 73.998 73.994 73.995 73.990
## 12 74.004 74.000 74.007 74.000 73.996
## 13 73.983 74.002 73.998 73.997 74.012
## 14 74.006 73.967 73.994 74.000 73.984
## 15 74.012 74.014 73.998 73.999 74.007
## 16 74.000 73.984 74.005 73.998 73.996
## 17 73.994 74.012 73.986 74.005 74.007
## 18 74.006 74.010 74.018 74.003 74.000
## 19 73.984 74.002 74.003 74.005 73.997
## 20 74.000 74.010 74.013 74.020 74.003
## 21 73.988 74.001 74.009 74.005 73.996
## 22 74.004 73.999 73.990 74.006 74.009
## 23 74.010 73.989 73.990 74.009 74.014
## 24 74.015 74.008 73.993 74.000 74.010
## 25 73.982 73.984 73.995 74.017 74.013
## 26 74.012 74.015 74.030 73.986 74.000
## 27 73.995 74.010 73.990 74.015 74.001
## 28 73.987 73.999 73.985 74.000 73.990
## 29 74.008 74.010 74.003 73.991 74.006
## 30 74.003 74.000 74.001 73.986 73.997
## 31 73.994 74.003 74.015 74.020 74.004
## 32 74.008 74.002 74.018 73.995 74.005
## 33 74.001 74.004 73.990 73.996 73.998
## 34 74.015 74.000 74.016 74.025 74.000
## 35 74.030 74.005 74.000 74.016 74.012
## 36 74.001 73.990 73.995 74.010 74.024
## 37 74.015 74.020 74.024 74.005 74.019
## 38 74.035 74.010 74.012 74.015 74.026
## 39 74.017 74.013 74.036 74.025 74.026
## 40 74.010 74.005 74.029 74.000 74.020&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q1 &amp;lt;- qcc(
  qcc_gr[1:25, ],
  type = &amp;quot;xbar&amp;quot;,
  newdata = qcc_gr[26:nrow(qcc_gr), ],
  rules = c(1, 2, 3, 4)
)

plot(q1)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-17-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q9 &amp;lt;- qcc::cusum(
  qcc_gr[1:25, ],
  newdata = qcc_gr[26:nrow(qcc_gr), ]
)

plot(q9)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-17-2.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;ewma-chart&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;EWMA Chart&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;exponentially weighted moving average chart&lt;/li&gt;
&lt;li&gt;zj = gamma * xj + (1 - gamma) * zj-1&lt;/li&gt;
&lt;li&gt;if the smoothing parameter gamma is 0.2 a given value for x is 20% present value and 80% past values&lt;/li&gt;
&lt;li&gt;&lt;code&gt;+&lt;/code&gt; indicates the actual values&lt;/li&gt;
&lt;li&gt;supposed to work well for not normal values&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;q10 &amp;lt;- qcc::ewma(
  qcc_gr[1:25, ],
  newdata = qcc_gr[26:nrow(qcc_gr), ]
)

plot(q10)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-18-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;samplingstratification&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Sampling/Stratification&lt;/h1&gt;
&lt;p&gt;Naturally samples need to be representative of the population. If there are known subgroups it is important to adapt a stratified sampling strategy.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://bookdown.org/lawson/an_introduction_to_acceptance_sampling_and_spc_with_r26/&#34;&gt;free ebook&lt;/a&gt;&lt;/p&gt;
&lt;div id=&#34;attribute-acceptance-sampling&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Attribute Acceptance Sampling&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;attribute: defective / not defective&lt;/li&gt;
&lt;li&gt;producer wants a high probability of acceptance for a lot with a low defective fraction&lt;/li&gt;
&lt;li&gt;producers and consumer agree on acceptable quality level (AQL)&lt;/li&gt;
&lt;li&gt;alpha (producers risk) is the probability with which a lot that passes AQL is rejected&lt;/li&gt;
&lt;li&gt;consumer wants a high probability of rejection for a lot with a high defective ratio&lt;/li&gt;
&lt;li&gt;producers and consumer agree on lot tolerance percent defective (LTPD)&lt;/li&gt;
&lt;li&gt;beta (consumers risk) is the probability with which a lot that does not pass LTPD is accepted&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Requirements:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;AQL: 0.06&lt;/li&gt;
&lt;li&gt;alpha: 0.05&lt;/li&gt;
&lt;li&gt;LTPD: 0.16&lt;/li&gt;
&lt;li&gt;beta: 0.10&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;library(AcceptanceSampling)

plan &amp;lt;- AcceptanceSampling::find.plan(
  PRP = c(0.06, 0.95),
  CRP = c(0.16, 0.10)
)

plan&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $n
## [1] 79
## 
## $c
## [1] 8
## 
## $r
## [1] 9&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;oc &amp;lt;- AcceptanceSampling::OC2c(plan$n, plan$c, plan$r)

plot(oc, xlim = c(0, 0.25))&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2021-08-27-qcwithr_files/figure-html/unnamed-chunk-19-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;take a sample of 79 and reject when 9 items are defective&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;variable-acceptance-sampling&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Variable Acceptance Sampling&lt;/h2&gt;
&lt;p&gt;specify:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;upper specification limit (USL)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;and or:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;lower specification limit (LSL)&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plan2 &amp;lt;- AcceptanceSampling::find.plan(
  PRP = c(0.06, 0.95),
  CRP = c(0.16, 0.10),
  type = &amp;quot;normal&amp;quot;,
  s.type = &amp;quot;known&amp;quot;
)

plan2&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $n
## [1] 28
## 
## $k
## [1] 1.243925
## 
## $s.type
## [1] &amp;quot;known&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;proceed:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;take a sample of 28&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;compute the mean&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;compute LSL/USL - mean(sample) / sd&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;compare accept if value above is greater 1.2439255&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plan3 &amp;lt;- AcceptanceSampling::find.plan(
  PRP = c(0.06, 0.95),
  CRP = c(0.16, 0.10),
  type = &amp;quot;normal&amp;quot;,
  s.type = &amp;quot;unknown&amp;quot;
)

plan3&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## $n
## [1] 49
## 
## $k
## [1] 1.245424
## 
## $s.type
## [1] &amp;quot;unknown&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;proceed:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;take a sample of 49&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;compute the mean&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;compute LSL/USL - mean(sample) / sd(sample)&lt;br /&gt;
&lt;/li&gt;
&lt;li&gt;compare accept if value above is greater 1.2454244&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Note that sample size has increased because we do not know population sd and need to estimate it from the sample.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>simaerep</title>
      <link>https://www.datisticsblog.com/2020/11/simaerep/</link>
      <pubDate>Tue, 10 Nov 2020 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2020/11/simaerep/</guid>
      <description>
&lt;link href=&#34;https://www.datisticsblog.com/rmarkdown-libs/anchor-sections/anchor-sections.css&#34; rel=&#34;stylesheet&#34; /&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/anchor-sections/anchor-sections.js&#34;&gt;&lt;/script&gt;


&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;p&gt;Simulate adverse event reporting in clinical trials with the goal of detecting under-reporting sites.&lt;/p&gt;
&lt;p&gt;Monitoring of Adverse Event (AE) reporting in clinical trials is important for patient safety. We use bootstrap-based simulation to assign an AE under-reporting probability to each site in a clinical trial. The method is inspired by the ‘infer’ R package and Allen Downey’s blog article: &lt;a href=&#34;http://allendowney.blogspot.com/2011/05/there-is-only-one-test.html&#34;&gt;“There is only one test!”&lt;/a&gt;.&lt;/p&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;https://github.com/openpharma/simaerep/raw/master/man/figures/logo.png&#34; style=&#34;width: 360px;height: 360px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;div id=&#34;adverse-events&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Adverse Events&lt;/h1&gt;
&lt;p&gt;An adverse event (AE) is any untoward medical occurrence in a patient or participating in a clincial trial. These events are not necessarily drug related. It could anything from a headache to a sporting accident to a life-threatening pneunomia. It is important though for the safety of the patients that these events are being reported in a timely manner from the clinical trial site to the sponsor of the trial so that the safety profile of the drug can be updated if necessary and appropriate actions can be taken.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;simaerep&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;{simaerep}&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;simaerep&lt;/code&gt; can be used to flag sites that are statistically reporting fewer AEs than other sites by using bootstrap resampling. For a site that needs to be tested it draws with replacement a new patient sample from the entire study patient population. This is repeated several times to be able to determine the probability to get an equal or lower number of AEs than initially reported.&lt;/p&gt;
&lt;p&gt;There is a bit more to it of course &lt;code&gt;simaerep&lt;/code&gt; needs to account for the fact that patients have been recruited at different points in time and it needs to account for the alpha-error that occurs when you perform many statistical tests. The exact methodology is explained &lt;a href=&#34;https://openpharma.github.io/simaerep/articles/intro.html&#34;&gt;here&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/openpharma/simaerep/&#34;&gt;github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://openpharma.github.io/simaerep/index.html&#34;&gt;website&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;ae-reporting-quality-assurance&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;AE Reporting Quality Assurance&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;simaerep&lt;/code&gt; is currently a cornerstone in our AE reporting quality assurance strategy. As we describe in our latest publication:&lt;/p&gt;
&lt;p&gt;Koneswarakantha, B., Barmaz, Y., Ménard, T. et al. &lt;em&gt;Follow-up on the Use of Advanced Analytics for Clinical Quality Assurance: Bootstrap Resampling to Enhance Detection of Adverse Event Under-Reporting.&lt;/em&gt; Drug
Saf (2020).&lt;br /&gt;
&lt;a href=&#34;https://doi.org/10.1007/s40264-020-01011-5&#34; class=&#34;uri&#34;&gt;https://doi.org/10.1007/s40264-020-01011-5&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;collaboration&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Collaboration&lt;/h1&gt;
&lt;p&gt;We are frequently refining our quality analytics methods and are happy to collaborate in developing industry standards. Please reach out if you have any comments or questions.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;application&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Application&lt;/h1&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages(library(&amp;quot;simaerep&amp;quot;))

set.seed(1)

df_visit &amp;lt;- sim_test_data_study(
  n_pat = 1000, # number of patients in study
  n_sites = 100, # number of sites in study
  frac_site_with_ur = 0.05, # fraction of sites under-reporting
  ur_rate = 0.4, # rate of under-reporting
  ae_per_visit_mean = 0.5 # mean AE per patient visit
)

df_visit$study_id &amp;lt;- &amp;quot;A&amp;quot;

df_site &amp;lt;- site_aggr(df_visit)

df_sim_sites &amp;lt;- sim_sites(df_site, df_visit, r = 1000)

df_eval &amp;lt;- eval_sites(df_sim_sites, r_sim_sites = 1000)

plot_study(df_visit, df_site, df_eval, study = &amp;quot;A&amp;quot;) &lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2020-11-10-simaerep_files/figure-html/unnamed-chunk-2-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>easyalluvial 0.2.3 released</title>
      <link>https://www.datisticsblog.com/2020/05/easyalluvial-0-2-3-released/</link>
      <pubDate>Sun, 17 May 2020 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2020/05/easyalluvial-0-2-3-released/</guid>
      <description>


&lt;p&gt;&lt;code&gt;easyalluvial&lt;/code&gt; allows you to build exploratory and interactive alluvial plots (sankey diagrams) with a single line of code while automatically binning numerical variables. This release &lt;code&gt;0.2.3&lt;/code&gt; ensures &lt;code&gt;dplyr 1.0.0&lt;/code&gt; compatibilitiy and now builds a slick pkgdown documentation website and makes better use of &lt;code&gt;Travis CI&lt;/code&gt; using multiple builds to test compatibility with development versions of selected package dependencies.&lt;/p&gt;
&lt;div id=&#34;new-pkgdown-documentaion&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;New ‘pkgdown’ Documentaion&lt;/h1&gt;
&lt;p&gt;If I knew how easy it was to create a &lt;code&gt;pkgdown&lt;/code&gt; documentation website I would have done it long time ago. The &lt;code&gt;easyalluvial&lt;/code&gt; documentation used to consist of only the &lt;code&gt;README.md&lt;/code&gt; file with links to blogposts that would contain more detailed tutorials. Now everything can be found in one place.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://erblast.github.io/easyalluvial/&#34;&gt;https://erblast.github.io/easyalluvial/&lt;/a&gt;&lt;/p&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;../../../screenshot_pkgdown.png&#34; &gt;
  
  
&lt;/div&gt;

&lt;/div&gt;
&lt;div id=&#34;new-travis-ci-configuration&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;New ‘Travis CI’ Configuration&lt;/h1&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;https://annakrystalli.me/talks/assets/travis.png&#34; style=&#34;width: 120px;height: 120px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;p&gt;The real change however, is that I am now making better use of &lt;code&gt;Travis CI&lt;/code&gt;. I made it a habit to develop in a designated branch and use pull requests to merge with the master branch. &lt;code&gt;Travis CI&lt;/code&gt; now controls the merge of the pull request only allowing it if all checks in all builds have passed. In addition to simply running package checks &lt;code&gt;Travis CI&lt;/code&gt; now uses multiple parallel builds. One build each for &lt;code&gt;R-release&lt;/code&gt; and &lt;code&gt;R-devel&lt;/code&gt; and a couple of more for checking compatibility with development versions of selected tidyverse dependencies. Another build checks the reverse dependency &lt;code&gt;parcats&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Even cooler &lt;code&gt;Travis CI&lt;/code&gt; is setup to build the &lt;code&gt;pkgdown&lt;/code&gt; website and publishes it immediately to a separate github pages branch. So me forgetting to build the website before commiting to github will not effect the documentation. There is a great &lt;a href=&#34;https://www.r-bloggers.com/continuous-deployment-of-package-documentation-with-pkgdown-and-travis-ci/&#34;&gt;blogpost&lt;/a&gt; with instruction on how to set-up &lt;code&gt;Travis CI&lt;/code&gt; to deploy github pages.&lt;/p&gt;
&lt;p&gt;Since I set up many parallel builds in different environments I only want one of them to render the documentation. Therefore I created an environment variable &lt;code&gt;PKGDOWN&lt;/code&gt; which is set to &lt;code&gt;yes&lt;/code&gt; in only one of the builds and set to &lt;code&gt;no&lt;/code&gt; in the others. The deploy section will only run if &lt;code&gt;PKGDOWN=yes&lt;/code&gt; on the master branch.&lt;/p&gt;
&lt;p&gt;For R-packages the script section of each build is pre-configured. In order to integrate the building of the &lt;code&gt;pkgdown&lt;/code&gt; website into the script part of the &lt;code&gt;r-release&lt;/code&gt; build I had to overwrite it. Which required me to also add commands for installing package dependencies and running package checks.&lt;/p&gt;
&lt;p&gt;This is the content of the final &lt;code&gt;.travis.yml&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;language: R
R:
  - release
sudo: false
cache: packages

r_packages:
  - covr

matrix:
  include:
  - r: devel
    after_success:
    - export PKGDOWN=no
  - r: release
    before_script: 
      - Rscript -e &amp;#39;install.packages(c(&amp;quot;earth&amp;quot;, &amp;quot;tidyverse&amp;quot;, &amp;quot;mlbench&amp;quot;, &amp;quot;pkgdown&amp;quot;))&amp;#39;
      - Rscript -e &amp;quot;devtools::install_deps(&amp;#39;.&amp;#39;, dependencies = &amp;#39;suggests&amp;#39;)&amp;quot;
    script:
      - Rscript -e &amp;quot;devtools::check(&amp;#39;.&amp;#39;, error_on = &amp;#39;note&amp;#39;)&amp;quot;
      - Rscript -e &amp;#39;pkgdown::build_site(run_dont_run = TRUE)&amp;#39;
    after_success:
      - Rscript -e &amp;#39;covr::codecov()&amp;#39;
      - export PKGDOWN=yes
  - r: release
    name: tidyr-devel
    before_script: Rscript -e &amp;quot;remotes::install_github(&amp;#39;tidyverse/tidyr&amp;#39;)&amp;quot;
    after_success:
    - export PKGDOWN=no
  - r: release
    name: dplyr-devel
    before_script: Rscript -e &amp;quot;remotes::install_github(&amp;#39;tidyverse/dplyr&amp;#39;)&amp;quot;
    after_success:
    - export PKGDOWN=no
  - r: release
    name: parcats-devel
    script:
      - git clone https://github.com/erblast/parcats.git
      - git clone https://github.com/erblast/easyalluvial.git
      - Rscript -e &amp;quot;install.packages(&amp;#39;spelling&amp;#39;)&amp;quot;
      - Rscript -e &amp;quot;devtools::install_deps(&amp;#39;easyalluvial/&amp;#39;, dependencies = &amp;#39;suggests&amp;#39;)&amp;quot;
      - Rscript -e &amp;quot;devtools::install_deps(&amp;#39;parcats/&amp;#39;, dependencies = &amp;#39;suggests&amp;#39;)&amp;quot;
      - Rscript -e &amp;quot;devtools::install(&amp;#39;easyalluvial/&amp;#39;)&amp;quot;
      - Rscript -e &amp;quot;devtools::check(&amp;#39;easyalluvial/&amp;#39;, error_on = &amp;#39;note&amp;#39;)&amp;quot;
      - Rscript -e &amp;quot;devtools::check(&amp;#39;parcats/&amp;#39;, error_on = &amp;#39;note&amp;#39;)&amp;quot;
    after_success:
    - export PKGDOWN=no
    
deploy:
  provider: pages
  skip_cleanup: true
  github_token: $GITHUB_TOKEN  # Set in the settings page of your repository, as a secure variable
  keep_history: true
  local-dir: docs
  on:
    branch: master
    condition: $PKGDOWN = yes&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;more-changes&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;More changes&lt;/h1&gt;
&lt;p&gt;… &lt;a href=&#34;https://github.com/erblast/easyalluvial/blob/master/NEWS.md&#34;&gt;NEWS.md&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>parcats 0.0.1 released</title>
      <link>https://www.datisticsblog.com/2019/12/parcats-0-0-1-released/</link>
      <pubDate>Thu, 05 Dec 2019 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2019/12/parcats-0-0-1-released/</guid>
      <description>
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/htmlwidgets/htmlwidgets.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/plotly.js/./plotly.min.js&#34;&gt;&lt;/script&gt;
&lt;script src=&#34;https://www.datisticsblog.com/rmarkdown-libs/parcats-binding/parcats.js&#34;&gt;&lt;/script&gt;


&lt;p&gt;&lt;a href=&#34;https://erblast.github.io/parcats/&#34;&gt;&lt;code&gt;parcats&lt;/code&gt;&lt;/a&gt; was released on CRAN. It is an htmlwidget providing bindings to the &lt;code&gt;plotly.js&lt;/code&gt; parcats trace, which is not supported by the &lt;code&gt;plotly&lt;/code&gt; R package. Also adds marginal histograms for numerical variables.&lt;/p&gt;
&lt;div class=&#34;figure&#34;&gt;
&lt;img src=&#34;https://raw.githubusercontent.com/erblast/parcats/master/man/figures/demo1.gif&#34; alt=&#34;demogif&#34; /&gt;
&lt;p class=&#34;caption&#34;&gt;demogif&lt;/p&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/erblast/parcats&#34;&gt;github&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://erblast.github.io/parcats/&#34;&gt;documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div id=&#34;what-it-can-do&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;What it can do&lt;/h1&gt;
&lt;p&gt;I wanted to add interactivity to &lt;a href=&#34;https://github.com/erblast/easyalluvial&#34;&gt;&lt;code&gt;easyalluvial&lt;/code&gt;&lt;/a&gt; plots for a while now and found that the parcats trace of &lt;code&gt;plotly.js&lt;/code&gt; would be perfect because brushing with the mouse highlights the entire flow and not just everything flowing in and out of a specific node as in most &lt;code&gt;D3&lt;/code&gt; Sankey chart implementations. Unfortunately the parcats trace was not available in the &lt;code&gt;plotly&lt;/code&gt; R package so I decided to build a new html widget to create R bindings for specifically this trace.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;converts any &lt;code&gt;easyalluvial&lt;/code&gt; plot to an interactive parallel categories diagram&lt;/li&gt;
&lt;li&gt;interactive marginal histograms&lt;/li&gt;
&lt;li&gt;multidimensional partial dependency and model response plots&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;easyalluvial&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;easyalluvial&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;parcats&lt;/code&gt; requires an alluvial plot created with &lt;code&gt;easyalluvial&lt;/code&gt; to create an interactive parrallel categories diagram.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/10/intro_easyalluvial/#features&#34;&gt;Data exploration with alluvial plots&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href=&#34;https://github.com/erblast/easyalluvial&#34;&gt;easyalluvial github page&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;demo&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Demo&lt;/h1&gt;
&lt;div id=&#34;examples&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Examples&lt;/h2&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages( require(tidyverse) )
suppressPackageStartupMessages( require(easyalluvial) )
suppressPackageStartupMessages( require(parcats) )&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;parcats-from-alluvial-from-data-in-wide-format&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Parcats from alluvial from data in wide format&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p = alluvial_wide(mtcars2, max_variables = 5)
parcats(p, marginal_histograms = TRUE, data_input = mtcars2)&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;htmlwidget-1&#34; style=&#34;width:960px;height:672px;&#34; class=&#34;parcats html-widget&#34;&gt;&lt;/div&gt;
&lt;script type=&#34;application/json&#34; data-for=&#34;htmlwidget-1&#34;&gt;{&#34;x&#34;:{&#34;traces&#34;:{&#34;parcats&#34;:{&#34;type&#34;:&#34;parcats&#34;,&#34;dimensions&#34;:[{&#34;label&#34;:&#34;mpg&#34;,&#34;values&#34;:[&#34;HH&#34;,&#34;HH&#34;,&#34;HH&#34;,&#34;LL&#34;,&#34;LL&#34;,&#34;M&#34;,&#34;M&#34;,&#34;M&#34;,&#34;M&#34;,&#34;M&#34;,&#34;M&#34;,&#34;M&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;ML&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;HH&#34;,&#34;MH&#34;,&#34;M&#34;,&#34;ML&#34;,&#34;LL&#34;]},{&#34;label&#34;:&#34;cyl&#34;,&#34;values&#34;:[&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;8&#34;,&#34;8&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;6&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;8&#34;,&#34;6&#34;,&#34;4&#34;]},{&#34;label&#34;:&#34;disp&#34;,&#34;values&#34;:[&#34;LL&#34;,&#34;LL&#34;,&#34;LL&#34;,&#34;HH&#34;,&#34;MH&#34;,&#34;M&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;HH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;LL&#34;,&#34;LL&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;M&#34;,&#34;HH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;HH&#34;,&#34;MH&#34;,&#34;M&#34;,&#34;ML&#34;,&#34;LL&#34;]},{&#34;label&#34;:&#34;hp&#34;,&#34;values&#34;:[&#34;LL&#34;,&#34;LL&#34;,&#34;ML&#34;,&#34;MH&#34;,&#34;HH&#34;,&#34;ML&#34;,&#34;M&#34;,&#34;MH&#34;,&#34;ML&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;MH&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;LL&#34;,&#34;ML&#34;,&#34;ML&#34;,&#34;MH&#34;,&#34;HH&#34;,&#34;HH&#34;,&#34;HH&#34;,&#34;M&#34;,&#34;M&#34;,&#34;MH&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;HH&#34;,&#34;MH&#34;,&#34;M&#34;,&#34;ML&#34;,&#34;LL&#34;]},{&#34;label&#34;:&#34;drat&#34;,&#34;values&#34;:[&#34;HH&#34;,&#34;MH&#34;,&#34;M&#34;,&#34;LL&#34;,&#34;M&#34;,&#34;LL&#34;,&#34;M&#34;,&#34;M&#34;,&#34;M&#34;,&#34;LL&#34;,&#34;LL&#34;,&#34;ML&#34;,&#34;M&#34;,&#34;MH&#34;,&#34;M&#34;,&#34;M&#34;,&#34;LL&#34;,&#34;ML&#34;,&#34;M&#34;,&#34;MH&#34;,&#34;ML&#34;,&#34;LL&#34;,&#34;ML&#34;,&#34;LL&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;HH&#34;,&#34;MH&#34;,&#34;M&#34;,&#34;ML&#34;,&#34;LL&#34;]}],&#34;counts&#34;:[1,3,1,2,1,1,2,1,2,1,1,1,2,2,1,1,1,1,1,1,1,1,1,2],&#34;line&#34;:{&#34;shape&#34;:&#34;hspline&#34;,&#34;color&#34;:[&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;]},&#34;hoveron&#34;:&#34;color&#34;,&#34;hoverinfo&#34;:&#34;count+probability&#34;,&#34;labelfont&#34;:{&#34;size&#34;:24,&#34;color&#34;:&#34;black&#34;},&#34;arrangement&#34;:&#34;perpendicular&#34;,&#34;bundlecolors&#34;:true,&#34;sortpaths&#34;:&#34;forward&#34;,&#34;tickfont&#34;:null,&#34;domain&#34;:{&#34;y&#34;:[0,0.7]}},&#34;mpg_LL&#34;:{&#34;x&#34;:[2.96996268656716,3.04503132575868,3.1200999649502,3.19516860414172,3.27023724333324,3.34530588252475,3.42037452171627,3.49544316090779,3.57051180009931,3.64558043929083,3.72064907848234,3.79571771767386,3.87078635686538,3.9458549960569,4.02092363524842,4.09599227443993,4.17106091363145,4.24612955282297,4.32119819201449,4.396266831206,4.47133547039752,4.54640410958904,4.62147274878056,4.69654138797208,4.77161002716359,4.84667866635511,4.92174730554663,4.99681594473815,5.07188458392967,5.14695322312118,5.2220218623127,5.29709050150422,5.37215914069574,5.44722777988726,5.52229641907877,5.59736505827029,5.67243369746181,5.74750233665333,5.82257097584485,5.89763961503636,5.97270825422788,6.0477768934194,6.12284553261092,6.19791417180244,6.27298281099395,6.34805145018547,6.42312008937699,6.49818872856851,6.57325736776003,6.64832600695154,6.72339464614306,6.79846328533458,6.8735319245261,6.94860056371762,7.02366920290913,7.09873784210065,7.17380648129217,7.24887512048369,7.3239437596752,7.39901239886672,7.47408103805824,7.54914967724976,7.62421831644128,7.69928695563279,7.77435559482431,7.84942423401583,7.92449287320735,7.99956151239887,8.07463015159038,8.1496987907819,8.22476742997342,8.29983606916494,8.37490470835646,8.44997334754797,8.52504198673949,8.60011062593101,8.67517926512253,8.75024790431405,8.82531654350556,8.90038518269708,8.9754538218886,9.05052246108012,9.12559110027163,9.20065973946315,9.27572837865467,9.35079701784619,9.42586565703771,9.50093429622923,9.57600293542074,9.65107157461226,9.72614021380378,9.8012088529953,9.87627749218682,9.95134613137833,10.0264147705699,10.1014834097614,10.1765520489529,10.2516206881444,10.3266893273359,10.4017579665274,10.476826605719,10.5518952449105,10.626963884102,10.7020325232935,10.777101162485,10.8521698016765,10.9272384408681,11.0023070800596,11.0773757192511,11.1524443584426,11.2275129976341,11.3025816368257,11.3776502760172,11.4527189152087,11.5277875544002,11.6028561935917,11.6779248327832,11.7529934719748,11.8280621111663,11.9031307503578,11.9781993895493,12.0532680287408,12.1283366679324,12.2034053071239,12.2784739463154,12.3535425855069,12.4286112246984,12.5036798638899,12.5787485030815,12.653817142273,12.7288857814645,12.803954420656,12.8790230598475,12.9540916990391,13.0291603382306,13.1042289774221,13.1792976166136,13.2543662558051,13.3294348949966,13.4045035341882,13.4795721733797,13.5546408125712,13.6297094517627,13.7047780909542,13.7798467301457],&#34;y&#34;:[0.000114229889951918,0.000125273732728626,0.000137050151569663,0.000149514448557863,0.000163548707093741,0.00017842086769883,0.000194189645158505,0.000211800991279835,0.000230417785779494,0.000250186134516725,0.000272091353413302,0.000295190853282914,0.000319748138090844,0.000346753678164109,0.000375163278516302,0.000405392353352029,0.00043839191630835,0.000473025083171863,0.000509897608297056,0.000549865884799234,0.000591714932801751,0.000636282193585794,0.000684264269333187,0.00073438873123137,0.000787767533919762,0.000844863679659825,0.000904374032794606,0.000967727509301853,0.00103507332727553,0.00110511011541999,0.00117962360481525,0.00125836582832946,0.00134007455387213,0.00142692713169268,0.00151819575096023,0.0016126982973312,0.00171303097435456,0.00181790876909982,0.00192627252375892,0.00204115460244825,0.00216064557042484,0.00228385182340513,0.00241424734268497,0.00254924588638339,0.00268815944027951,0.0028348960102069,0.00298615903981131,0.00314150124168559,0.00330524381785147,0.00347336810328754,0.00364580684975305,0.00382692787661865,0.00401233499398705,0.00420243406989608,0.00440104244661222,0.00460397348017972,0.00481193213809767,0.00502813429726787,0.00524865605531255,0.00547449396545618,0.00570823503504366,0.00594625891078352,0.00618984036323931,0.0064409330600869,0.00669624683271584,0.00695731896374735,0.00722548499335452,0.0074977968566662,0.00777604073693687,0.0080609631184595,0.0083499561064188,0.00864504824106554,0.00894643182590742,0.00925182565737347,0.00956350616164292,0.00988114251064116,0.0102027587968439,0.0105309013458707,0.0108647331794483,0.0112025590342439,0.011547236767962,0.0118974165128855,0.0122516609834645,0.0126132019991806,0.012980138623248,0.0133512761133107,0.0137303021027543,0.0141146905339388,0.0145034855963567,0.0149009276537631,0.0153037556724812,0.0157112642465902,0.0161283509199834,0.0165508795035261,0.0169784228663741,0.0174166371255152,0.0178603517797577,0.0183097457170008,0.0187704650058753,0.0192369975629635,0.0197100471319284,0.0201948572574038,0.0206858798277631,0.0211843072095414,0.0216948285594811,0.0222119236444772,0.0227373144896621,0.0232749660742645,0.0238194790893781,0.0243731204029669,0.0249389641095947,0.0255118465438023,0.0260945574178793,0.0266891403556056,0.0272907933140105,0.0279027597420157,0.0285259652044185,0.0291560939853421,0.0297967197565422,0.0304476376619687,0.0311051281846789,0.031772913735407,0.0324497409359108,0.0331325681935215,0.0338250282288393,0.0345250077956126,0.0352301850562352,0.0359438137775108,0.0366632203232897,0.0373867956064091,0.0381170855944091,0.0388512610006622,0.0395883645463794,0.0403298819396755,0.0410733226970109,0.0418182659125721,0.0425647807342156,0.0433112747038546,0.0440576976478669,0.044802364259259,0.0455451712759395,0.0462862140481823,0.0470218113915404,0.0477538790156692,0.0484821446565278],&#34;fillcolor&#34;:&#34;#FF0065&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#FF0065&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#FF0065&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;LL&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;mpg_ML&#34;:{&#34;x&#34;:[13.8549153693373,13.9299840085288,14.0050526477203,14.0801212869118,14.1551899261033,14.2302585652949,14.3053272044864,14.3803958436779,14.4554644828694,14.5305331220609,14.6056017612524,14.680670400444,14.7557390396355,14.830807678827,14.9058763180185,14.98094495721,15.0560135964016,15.1310822355931,15.2061508747846,15.2812195139761,15.3562881531676,15.4313567923591,15.5064254315507,15.5814940707422,15.6565627099337,15.7316313491252,15.8066999883167,15.8817686275083,15.9568372666998,16.0319059058913,16.1069745450828,16.1820431842743,16.2571118234658,16.3321804626574,16.4072491018489,16.4823177410404,16.5573863802319,16.6324550194234,16.7075236586149,16.7825922978065],&#34;y&#34;:[0.0492015875490189,0.0499157906849128,0.0506239262649292,0.0513201951201251,0.0520095863574055,0.0526904982752669,0.0533569422312706,0.0540149987916339,0.0546621137887025,0.0552926856883678,0.0559135388539339,0.0565210415399491,0.0571105049903819,0.0576891388589819,0.0582521716549459,0.0587962683880539,0.0593286766734319,0.059843490489783,0.0603390587366376,0.0608223509644597,0.0612863981530185,0.0617314358410082,0.0621638874833518,0.0625758523747786,0.0629695224225652,0.0633505670227897,0.0637103333927429,0.0640529119557001,0.0643830768624863,0.0646916356526201,0.0649844076024407,0.0652651983007734,0.0655245025638205,0.065769611533718,0.0660033525017636,0.0662161295920915,0.0664163923873938,0.0666060347353955,0.0667755680363576,0.0669342649578231],&#34;fillcolor&#34;:&#34;#009850&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#009850&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#009850&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;ML&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;mpg_M&#34;:{&#34;x&#34;:[16.857660936998,16.9327295761895,17.007798215381,17.0828668545725,17.1579354937641,17.2330041329556,17.3080727721471,17.3831414113386,17.4582100505301,17.5332786897216,17.6083473289132,17.6834159681047,17.7584846072962,17.8335532464877,17.9086218856792,17.9836905248708,18.0587591640623,18.1338278032538,18.2088964424453,18.2839650816368,18.3590337208283,18.4341023600199,18.5091709992114,18.5842396384029,18.6593082775944,18.7343769167859,18.8094455559775,18.884514195169,18.9595828343605,19.034651473552,19.1097201127435,19.184788751935,19.2598573911266,19.3349260303181,19.4099946695096,19.4850633087011,19.5601319478926,19.6352005870841,19.7102692262757,19.7853378654672,19.8604065046587,19.9354751438502,20.0105437830417,20.0856124222333,20.1606810614248,20.2357497006163,20.3108183398078,20.3858869789993,20.4609556181908,20.5360242573824,20.6110928965739,20.6861615357654,20.7612301749569,20.8362988141484,20.91136745334,20.9864360925315,21.061504731723,21.1365733709145],&#34;y&#34;:[0.0670831726888495,0.0672130665374253,0.0673337201126039,0.0674451809291316,0.0675393895162468,0.0676255442685601,0.0677028563900642,0.0677651513573859,0.0678201666094758,0.0678667236707489,0.0679002024415557,0.067927068845819,0.0679458272511997,0.0679530984411411,0.0679542870907898,0.0679476158335419,0.0679306780801021,0.067908028835629,0.0678776037870206,0.0678377673350176,0.0677924205679144,0.0677391670424319,0.0676770203348596,0.0676093938007805,0.0675334784000283,0.0674488994872161,0.0673587096352501,0.0672595797145926,0.0671517900375297,0.0670381148572513,0.0669145815719605,0.0667822376920479,0.0666436162842428,0.0664939751479885,0.0663352923518843,0.0661698548433573,0.065992036131299,0.0658049365767762,0.0656105568206685,0.0654022970043372,0.0651845742106906,0.0649590369370421,0.0647180616587153,0.0644675526862324,0.0642087263933387,0.0639329352676019,0.0636476918659782,0.0633536987604394,0.0630413425124595,0.062719792830209,0.0623886523029847,0.0620390086008308,0.0616801017122958,0.061310775372805,0.0609233799319284,0.0605267064243477,0.0601189704145019,0.0596939646610578],&#34;fillcolor&#34;:&#34;#A56F2B&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#A56F2B&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#A56F2B&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;M&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;mpg_MH&#34;:{&#34;x&#34;:[21.211642010106,21.2867106492975,21.3617792884891,21.4368479276806,21.5119165668721,21.5869852060636,21.6620538452551,21.7371224844467,21.8121911236382,21.8872597628297,21.9623284020212,22.0373970412127,22.1124656804042,22.1875343195958,22.2626029587873,22.3376715979788,22.4127402371703,22.4878088763618,22.5628775155533,22.6379461547449,22.7130147939364,22.7880834331279,22.8631520723194,22.9382207115109,23.0132893507025,23.088357989894,23.1634266290855,23.238495268277,23.3135639074685,23.38863254666,23.4637011858516,23.5387698250431,23.6138384642346,23.6889071034261,23.7639757426176,23.8390443818092,23.9141130210007,23.9891816601922,24.0642502993837,24.1393189385752,24.2143875777667,24.2894562169583,24.3645248561498,24.4395934953413,24.5146621345328,24.5897307737243,24.6647994129159,24.7398680521074,24.8149366912989,24.8900053304904,24.9650739696819,25.0401426088734,25.115211248065,25.1902798872565,25.265348526448,25.3404171656395,25.415485804831,25.4905544440225,25.5656230832141,25.6406917224056,25.7157603615971,25.7908290007886,25.8658976399801,25.9409662791717,26.0160349183632,26.0911035575547,26.1661721967462,26.2412408359377,26.3163094751292,26.3913781143208,26.4664467535123,26.5415153927038,26.6165840318953],&#34;y&#34;:[0.059259847792459,0.0588142712837906,0.0583525776493199,0.0578821310903507,0.0574001269997778,0.0569034791960782,0.0563986290457527,0.0558824653752783,0.0553534023360636,0.0548168728813581,0.0542696447286468,0.053711469101004,0.0531467335908559,0.0525722979014553,0.0519890017249994,0.0514002011598197,0.0508030781982394,0.0501992400197976,0.0495910745237401,0.0489763217189034,0.0483569807626469,0.047734579415901,0.0471076445821018,0.0464781586448889,0.0458469346254187,0.0452134964837048,0.0445793908845901,0.0439448893387,0.0433106937006642,0.0426775088365751,0.042045255025224,0.0414159549184166,0.0407890997477807,0.0401644546896987,0.039545462105019,0.0389300802121295,0.0383181593967295,0.037714466155406,0.0371153199871162,0.0365210945965443,0.0359369533632598,0.0353583308523981,0.0347860935385033,0.0342253842147137,0.0336710304119423,0.0331244868555602,0.0325905108764094,0.0320635855212454,0.031545816877892,0.0310412744525422,0.0305443347493063,0.030057787047044,0.0295847780056226,0.0291197843524882,0.028666281873045,0.0282263268466158,0.0277946680039127,0.0273754463619757,0.0269695240219589,0.0265720572854393,0.0261878110245049,0.0258164064978562,0.0254535079204524,0.025104447020359,0.0247676064064712,0.0244392260110327,0.0241251357643548,0.0238225219036058,0.0235282391366668,0.0232485383683775,0.0229794836107023,0.0227185589572238,0.0224723524655867],&#34;fillcolor&#34;:&#34;#005EAA&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#005EAA&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#005EAA&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;MH&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;mpg_HH&#34;:{&#34;x&#34;:[26.6916526710868,26.7667213102784,26.8417899494699,26.9168585886614,26.9919272278529,27.0669958670444,27.1420645062359,27.2171331454275,27.292201784619,27.3672704238105,27.442339063002,27.5174077021935,27.5924763413851,27.6675449805766,27.7426136197681,27.8176822589596,27.8927508981511,27.9678195373426,28.0428881765342,28.1179568157257,28.1930254549172,28.2680940941087,28.3431627333002,28.4182313724917,28.4933000116833,28.5683686508748,28.6434372900663,28.7185059292578,28.7935745684493,28.8686432076409,28.9437118468324,29.0187804860239,29.0938491252154,29.1689177644069,29.2439864035984,29.31905504279,29.3941236819815,29.469192321173,29.5442609603645,29.619329599556,29.6943982387476,29.7694668779391,29.8445355171306,29.9196041563221,29.9946727955136,30.0697414347051,30.1448100738967,30.2198787130882,30.2949473522797,30.3700159914712,30.4450846306627,30.5201532698543,30.5952219090458,30.6702905482373,30.7453591874288,30.8204278266203,30.8954964658118,30.9705651050034,31.0456337441949,31.1207023833864,31.1957710225779,31.2708396617694,31.345908300961,31.4209769401525,31.496045579344,31.5711142185355,31.646182857727,31.7212514969185,31.7963201361101,31.8713887753016,31.9464574144931,32.0215260536846,32.0965946928761,32.1716633320676,32.2467319712592,32.3218006104507,32.3968692496422,32.4719378888337,32.5470065280252,32.6220751672167,32.6971438064083,32.7722124455998,32.8472810847913,32.9223497239828,32.9974183631743,33.0724870023659,33.1475556415574,33.2226242807489,33.2976929199404,33.3727615591319,33.4478301983235,33.522898837515,33.5979674767065,33.673036115898,33.7481047550895,33.823173394281,33.8982420334726,33.9733106726641,34.0483793118556,34.1234479510471,34.1985165902386,34.2735852294301,34.3486538686217,34.4237225078132,34.4987911470047,34.5738597861962,34.6489284253877,34.7239970645793,34.7990657037708,34.8741343429623,34.9492029821538,35.0242716213453,35.0993402605368,35.1744088997284,35.2494775389199,35.3245461781114,35.3996148173029,35.4746834564944,35.549752095686,35.6248207348775,35.699889374069,35.7749580132605,35.850026652452,35.9250952916435,36.0001639308351,36.0752325700266,36.1503012092181,36.2253698484096,36.3004384876011,36.3755071267926,36.4505757659842,36.5256444051757,36.6007130443672,36.6757816835587,36.7508503227502,36.8259189619418,36.9009876011333,36.9760562403248,37.0511248795163,37.1261935187078,37.2012621578994,37.2763307970909,37.3513994362824,37.4264680754739,37.5015367146654,37.5766053538569,37.6516739930485,37.72674263224,37.8018112714315,37.876879910623,37.9519485498145,38.027017189006,38.1020858281976,38.1771544673891,38.2522231065806,38.3272917457721,38.4023603849636,38.4774290241552,38.5524976633467,38.6275663025382,38.7026349417297,38.7777035809212,38.8527722201127,38.9278408593043,39.0029094984958,39.0779781376873,39.1530467768788,39.2281154160703,39.3031840552619,39.3782526944534,39.4533213336449,39.5283899728364,39.6034586120279,39.6785272512194,39.753595890411,39.8286645296025,39.903733168794,39.9788018079855,40.053870447177,40.1289390863685,40.2040077255601,40.2790763647516,40.3541450039431,40.4292136431346,40.5042822823261,40.5793509215177,40.6544195607092,40.7294881999007,40.8045568390922,40.8796254782837,40.9546941174752,41.0297627566668,41.1048313958583,41.1799000350498,41.2549686742413,41.3300373134328],&#34;y&#34;:[0.0222359050903225,0.0220073247261404,0.0217934470120905,0.0215884090640308,0.0213909205690378,0.0212079692739273,0.0210329247967187,0.020865063177382,0.0207114220325011,0.0205647558862172,0.0204251007903076,0.0202987127239451,0.0201786212615207,0.0200654784143913,0.0199641794396866,0.0198686751947915,0.0197799377776933,0.0197016011868594,0.0196285143249308,0.0195618838759074,0.0195042013494479,0.0194511809141234,0.0194041691260234,0.0193646538117595,0.01932917175265,0.0192991062342418,0.0192751007142036,0.0192544613318477,0.019238498082011,0.0192271894132118,0.0192185462539002,0.0192136908392892,0.0192121341003209,0.0192125155494985,0.0192156540395949,0.0192208049472464,0.0192271488909842,0.0192350885946818,0.0192438448631322,0.0192530419023504,0.019262560971588,0.0192718112574272,0.0192807551535821,0.0192886592662957,0.0192953378498803,0.0193009812245984,0.0193041649059721,0.0193053097587176,0.0193047226142344,0.0193002323501242,0.019293043960149,0.0192834723593199,0.019268568517333,0.0192504667992848,0.0192293890452671,0.0192016037364312,0.019170280518466,0.0191352281816972,0.0190926467342532,0.0190461116592218,0.0189950953848759,0.0189360173935566,0.018872635541656,0.0188040718489362,0.0187271525737499,0.0186456726523495,0.0185583885801243,0.0184626819984024,0.0183622544938361,0.0182555037923272,0.0181404729001704,0.018020658095215,0.017894126427459,0.0177596436269259,0.0176204098177031,0.0174742094727197,0.0173205476462964,0.0171622602198725,0.016996915169023,0.0168247302835838,0.0166481325351633,0.0164645548669329,0.0162748610848089,0.0160810477685971,0.0158805066292131,0.0156746449514097,0.015465029591231,0.0152491137657672,0.0150287152174851,0.0148049921788406,0.0145755674031001,0.0143425117236918,0.0141066139974137,0.0138657760289471,0.0136221467751269,0.0133762003712007,0.0131262247974533,0.0128742617322952,0.0126205375516341,0.0123638272945128,0.0121058769293974,0.011846725517612,0.0115857724810267,0.0113242376672141,0.0110620768721777,0.0107993696564901,0.0105366591816821,0.0102739744907838,0.0100118944893552,0.00975037370864591,0.00948959081453261,0.00923043939368806,0.00897238299450102,0.00871581806430377,0.00846177172974433,0.00820931977552797,0.00795913366641453,0.00771220340271279,0.00746732180057261,0.00722547948185629,0.00698747537078352,0.00675192184869771,0.00652015819970899,0.00629266031015632,0.00606795686162937,0.00584774984356118,0.00563208620357928,0.00541949876135071,0.0052120507134402,0.00500928292989102,0.00480980877368389,0.00461603627213573,0.00442695306964015,0.00424131617124104,0.00406184853398545,0.00388696716212249,0.00371562134508756,0.0035508074929813,0.00339038262240756,0.00323352208714429,0.00308344511102575,0.00293748452954117,0.00279506099149529,0.00265955945207812,0.00252784560310971,0.00239959103413078,0.00227828576162718,0.00216040195857675,0.00204599295442202,0.00193818070664026,0.00183354071983298,0.00173241929341168,0.00163731564290115,0.00154519529769942,0.00145657831258937,0.00137337467713549,0.00129294412164485,0.00121594683573901,0.00114375343214423,0.00107410882417359,0.00100777843441016,0.000945654777335617,0.000885848291185367,0.000829195318860362,0.00077617831308329,0.00072524556209966,0.000677272149737364,0.000632401044393554,0.000589385237987149,0.000549109686833407,0.000511447392680604,0.000475419779431035,0.000441896920012362,0.000410547420533136,0.000380623796161366,0.000352961035157659,0.00032708283536957,0.000302436102284799,0.000279805212672391,0.000258620954894212,0.000238489898469976,0.000220134806074134,0.000202937332227206,0.000186631921280278,0.00017187288344902,0.00015802813497583,0.000144931757035498,0.000133166426187584,0.0001221136448986,0.000111682750933327,0.000102384668940646,9.36343974145132e-05,8.53960585846729e-05,7.81111418713846e-05,7.12415249248712e-05,6.48141936795621e-05],&#34;fillcolor&#34;:&#34;#710500&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#710500&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#710500&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;HH&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;cyl_4&#34;:{&#34;x&#34;:[&#34;4&#34;],&#34;y&#34;:[11],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;#BDBDBD&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;cyl_4&#34;,&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y2&#34;},&#34;cyl_6&#34;:{&#34;x&#34;:[&#34;6&#34;],&#34;y&#34;:[7],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;#525252&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;cyl_6&#34;,&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y2&#34;},&#34;cyl_8&#34;:{&#34;x&#34;:[&#34;8&#34;],&#34;y&#34;:[14],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;#969696&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;cyl_8&#34;,&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y2&#34;},&#34;disp_LL&#34;:{&#34;x&#34;:[-96.2172366723656,-94.7778345718867,-93.3384324714078,-91.8990303709289,-90.4596282704499,-89.020226169971,-87.5808240694921,-86.1414219690132,-84.7020198685342,-83.2626177680553,-81.8232156675764,-80.3838135670974,-78.9444114666185,-77.5050093661396,-76.0656072656607,-74.6262051651817,-73.1868030647028,-71.7474009642239,-70.307998863745,-68.868596763266,-67.4291946627871,-65.9897925623082,-64.5503904618293,-63.1109883613503,-61.6715862608714,-60.2321841603925,-58.7927820599135,-57.3533799594346,-55.9139778589557,-54.4745757584768,-53.0351736579978,-51.5957715575189,-50.15636945704,-48.7169673565611,-47.2775652560821,-45.8381631556032,-44.3987610551243,-42.9593589546454,-41.5199568541664,-40.0805547536875,-38.6411526532086,-37.2017505527297,-35.7623484522507,-34.3229463517718,-32.8835442512929,-31.444142150814,-30.004740050335,-28.5653379498561,-27.1259358493772,-25.6865337488982,-24.2471316484193,-22.8077295479404,-21.3683274474615,-19.9289253469825,-18.4895232465036,-17.0501211460247,-15.6107190455458,-14.1713169450668,-12.7319148445879,-11.292512744109,-9.85311064363006,-8.41370854315113,-6.97430644267222,-5.53490434219329,-4.09550224171436,-2.65610014123543,-1.2166980407565,0.222704059722417,1.66210616020135,3.10150826068028,4.54091036115921,5.98031246163812,7.41971456211705,8.85911666259598,10.2985187630749,11.7379208635538,13.1773229640328,14.6167250645117,16.0561271649906,17.4955292654695,18.9349313659485,20.3743334664274,21.8137355669063,23.2531376673852,24.6925397678642,26.1319418683431,27.571343968822,29.010746069301,30.4501481697799,31.8895502702588,33.3289523707377,34.7683544712166,36.2077565716956,37.6471586721745,39.0865607726534,40.5259628731324,41.9653649736113,43.4047670740902,44.8441691745691,46.283571275048,47.722973375527,49.1623754760059,50.6017775764848,52.0411796769638,53.4805817774427,54.9199838779216,56.3593859784006,57.7987880788795,59.2381901793584,60.6775922798373,62.1169943803162,63.5563964807952,64.9957985812741,66.435200681753,67.874602782232,69.3140048827109,70.7534069831898,72.1928090836687,73.6322111841476,75.0716132846266,76.5110153851055,77.9504174855844,79.3898195860634,80.8292216865423,82.2686237870212,83.7080258875001,85.1474279879791,86.586830088458,88.0262321889369,89.4656342894158,90.9050363898948,92.3444384903737,93.7838405908526,95.2232426913315,96.6626447918105,98.1020468922894,99.5414489927683,100.980851093247,102.420253193726,103.859655294205,105.299057394684,106.738459495163,108.177861595642,109.617263696121,111.0566657966,112.496067897079,113.935469997558,115.374872098037,116.814274198515,118.253676298994,119.693078399473,121.132480499952,122.571882600431,124.01128470091,125.450686801389,126.890088901868,128.329491002347,129.768893102826],&#34;y&#34;:[9.10597711225509e-06,9.86358340673543e-06,1.07004180849651e-05,1.15928175453706e-05,1.25324785628445e-05,1.35782274319107e-05,1.46724881957035e-05,1.58510422507725e-05,1.71289407295951e-05,1.84626214185881e-05,1.99304708925988e-05,2.14825270002367e-05,2.31163508431506e-05,2.49137094930455e-05,2.67873860242217e-05,2.88009628246614e-05,3.09629936214023e-05,3.32114913644765e-05,3.56757454783458e-05,3.8260809453213e-05,4.09797650440826e-05,4.39380126026494e-05,4.70105427303938e-05,5.03032381341823e-05,5.38062082911541e-05,5.74367346422903e-05,6.13963797494854e-05,6.55198072971415e-05,6.98505956996887e-05,7.45132869912322e-05,7.93386725765287e-05,8.44922084662555e-05,8.99275807724509e-05,9.55417904731619e-05,0.000101631545522273,0.000107930619145227,0.000114533078313971,0.000121571109594818,0.000128828968178006,0.000136549280288523,0.000144626252139915,0.000152952667452051,0.000161905464525402,0.000171121235354823,0.000180755566625449,0.000190929390440984,0.000201384471592558,0.000212454293090077,0.000223948956183877,0.000235783679965595,0.000248373267556015,0.000261286052119159,0.000274741807185116,0.00028882595459573,0.000303249713171469,0.000318441513669014,0.000334107549974098,0.000350207167046892,0.000367160383356311,0.000384487171480915,0.000402473265593406,0.000421143975025465,0.000440199709794984,0.00046015225812117,0.000480597537857382,0.000501556967622618,0.000523415748362049,0.000545677730802188,0.000568683490745802,0.000592380809281077,0.000616484564462376,0.000641557811803891,0.000667102249717711,0.000693208048653006,0.000720186107611311,0.000747565517121796,0.000775714166644211,0.000804500531521266,0.000833680465761233,0.000863814011960265,0.00089435378806076,0.000925446989138449,0.000957301124346755,0.000989514948811536,0.00102243901281606,0.00105588324488578,0.00108966923971551,0.0011242727478434,0.00115918072581932,0.00119456037528297,0.00123050627148266,0.00126672658829407,0.00130349584166038,0.00134061147943764,0.00137798793059698,0.0014158878901883,0.00145397719078177,0.00149237182510673,0.00153106905754313,0.00156991399301857,0.00160903932157945,0.00164829829974095,0.00168767230828293,0.00172720148271209,0.00176676874878991,0.00180639137613772,0.00184601018304907,0.0018856169728304,0.00192513956931805,0.0019645684093585,0.00200390513173991,0.00204299185549813,0.00208194177588119,0.00212062797155228,0.00215899492574387,0.00219717106190658,0.0022348301213017,0.00227218036769751,0.00230918430248302,0.00234554065582892,0.00238157848439704,0.00241699202582453,0.00245179777587612,0.00248623254017793,0.00251969103098455,0.0025526632282525,0.00258501235334202,0.00261636853285432,0.00264723676270544,0.00267711693560834,0.00270616024209444,0.00273467041201177,0.00276177068945495,0.00278826436693232,0.00281386806762322,0.0028382244934149,0.00286195506623483,0.00288437555945169,0.00290581456215493,0.00292655875041668,0.00294561398898035,0.00296397443703654,0.00298122482175316,0.00299709286928253,0.00301224586343694,0.00302585512982989,0.00303843704740196,0.00305018679345961,0.00306016170902631,0.00306939512838262,0.00307738226496424,0.00308398549045226,0.00308984622449185,0.00309406022479555,0.00309730164890629,0.00309964334003941,0.00310029353058968,0.00310022293059074],&#34;fillcolor&#34;:&#34;#BDBDBD&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#BDBDBD&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#BDBDBD&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;LL&#34;,&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y3&#34;},&#34;disp_ML&#34;:{&#34;x&#34;:[131.208295203305,132.647697303784,134.087099404263,135.526501504741,136.96590360522,138.405305705699,139.844707806178,141.284109906657,142.723512007136,144.162914107615,145.602316208094,147.041718308573,148.481120409052,149.920522509531,151.35992461001,152.799326710489,154.238728810968,155.678130911446,157.117533011925,158.556935112404,159.996337212883,161.435739313362,162.875141413841,164.31454351432,165.753945614799,167.193347715278,168.632749815757,170.072151916236,171.511554016715,172.950956117194,174.390358217672,175.829760318151,177.26916241863,178.708564519109,180.147966619588,181.587368720067,183.026770820546,184.466172921025,185.905575021504,187.344977121983,188.784379222462,190.223781322941,191.66318342342,193.102585523899,194.541987624377,195.981389724856],&#34;y&#34;:[0.00309888530206398,0.00309629367933053,0.00309300078711468,0.0030881196436992,0.00308241017313054,0.00307582614199614,0.00306779243419953,0.00305912744080253,0.00304930990529351,0.00303848081289773,0.00302705922651966,0.00301428124373592,0.00300088542713339,0.00298674476766675,0.00297152280807392,0.00295582030767817,0.00293921653327193,0.00292192161886487,0.00290420025260264,0.00288551419447884,0.00286645465502159,0.00284688013713752,0.00282666887569577,0.00280617225936369,0.00278514124278127,0.00276377166579767,0.0027421769012565,0.00272013264390088,0.0026979539124423,0.00267556681279349,0.00265300169797225,0.00263036628806133,0.00260763459486926,0.00258489922986851,0.00256216106681396,0.00253952062762841,0.00251695761062645,0.00249452844160178,0.00247233084794881,0.00245026901363877,0.00242855792149151,0.0024071155118373,0.00238590710236612,0.00236524813390321,0.00234484912868637,0.00232490909390296],&#34;fillcolor&#34;:&#34;#525252&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#525252&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#525252&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;ML&#34;,&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y3&#34;},&#34;disp_M&#34;:{&#34;x&#34;:[197.420791825335,198.860193925814,200.299596026293,201.738998126772,203.178400227251,204.61780232773,206.057204428209,207.496606528688,208.936008629167,210.375410729646,211.814812830125,213.254214930603,214.693617031082,216.133019131561,217.57242123204,219.011823332519,220.451225432998,221.890627533477,223.330029633956,224.769431734435,226.208833834914,227.648235935393,229.087638035872,230.527040136351,231.96644223683,233.405844337308,234.845246437787,236.284648538266,237.724050638745,239.163452739224,240.602854839703,242.042256940182,243.481659040661,244.92106114114,246.360463241619,247.799865342098,249.239267442577,250.678669543056,252.118071643535,253.557473744013,254.996875844492,256.436277944971,257.87568004545,259.315082145929,260.754484246408,262.193886346887,263.633288447366,265.072690547845,266.512092648324],&#34;y&#34;:[0.00230550829518645,0.00228641210403681,0.00226805314031952,0.00225014148705869,0.00223267452277012,0.00221605814406117,0.00219983049109378,0.00218431589702538,0.00216951416181752,0.00215512656013413,0.00214173989616791,0.00212887360534133,0.00211659780144205,0.00210529748072145,0.00209444582835586,0.00208444707219887,0.00207519480233958,0.00206639520448385,0.00205869639371391,0.00205149393049308,0.00204493506395337,0.00203930754887603,0.00203411698074405,0.0020297825208404,0.002026107452756,0.00202285344499611,0.00202062558564044,0.00201879771055877,0.00201756388221909,0.00201708388598836,0.0020169667845634,0.00201757592388768,0.00201867424365391,0.00202012307762266,0.00202233299152824,0.00202482632395768,0.00202777156124489,0.00203121295416771,0.00203489955703491,0.00203907732341455,0.00204353634876214,0.00204822592158927,0.00205333063989282,0.00205858423185801,0.00206408201581787,0.00206979530094587,0.00207561584310293,0.0020816318173163,0.00208772581445163],&#34;fillcolor&#34;:&#34;#969696&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#969696&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#969696&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;M&#34;,&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y3&#34;},&#34;disp_MH&#34;:{&#34;x&#34;:[267.951494748803,269.390896849282,270.830298949761,272.269701050239,273.709103150718,275.148505251197,276.587907351676,278.027309452155,279.466711552634,280.906113653113,282.345515753592,283.784917854071,285.22431995455,286.663722055029,288.103124155508,289.542526255987,290.981928356466,292.421330456944,293.860732557423,295.300134657902,296.739536758381,298.17893885886,299.618340959339,301.057743059818,302.497145160297,303.936547260776,305.375949361255,306.815351461734,308.254753562213,309.694155662692,311.13355776317,312.572959863649,314.012361964128,315.451764064607,316.891166165086,318.330568265565,319.769970366044,321.209372466523,322.648774567002,324.088176667481,325.52757876796,326.966980868439,328.406382968918,329.845785069397,331.285187169875,332.724589270354,334.163991370833,335.603393471312,337.042795571791,338.48219767227,339.921599772749,341.361001873228,342.800403973707,344.239806074186,345.679208174665,347.118610275144,348.558012375623,349.997414476101,351.43681657658,352.876218677059,354.315620777538,355.755022878017,357.194424978496,358.633827078975,360.073229179454,361.512631279933,362.952033380412,364.391435480891,365.83083758137,367.270239681849,368.709641782328,370.149043882806,371.588445983285,373.027848083764,374.467250184243,375.906652284722,377.346054385201,378.78545648568],&#34;y&#34;:[0.00209389284543939,0.00210013294474575,0.00210638361932692,0.00211264196749641,0.00211886099830913,0.00212505194874527,0.00213113216681756,0.00213712320176388,0.00214301896132972,0.00214870037700174,0.00215427023961108,0.00215962017128236,0.00216473443980284,0.00216970614877411,0.00217429562709517,0.00217868147584528,0.0021828189044301,0.00218653859844234,0.00219005425251731,0.00219316242953569,0.00219591142705577,0.00219843561282346,0.00220037326648345,0.00220204856454989,0.00220335771703856,0.00220413810649412,0.00220465791510692,0.00220464304200193,0.00220421709860566,0.00220351437286146,0.00220211787189763,0.00220044267524274,0.00219833124543973,0.00219566474476477,0.00219271723151767,0.0021891769426622,0.00218523384074065,0.00218098008575955,0.00217604757025545,0.00217083912515112,0.00216517628267551,0.00215899978718741,0.00215255385649938,0.00214552526935231,0.00213814592540861,0.00213045747315605,0.00212217589673771,0.00211364869962795,0.00210469861757659,0.00209532331333104,0.00208571559180987,0.0020755954747785,0.00206520314371968,0.00205453699390559,0.00204340888740456,0.00203208543243289,0.0020204128700416,0.00200842954750873,0.0019962683804973,0.0019837116706502,0.00197097159012738,0.00195802096066539,0.00194476028880247,0.00193136601816317,0.00191772675937144,0.00190389757678809,0.00188995398911917,0.0018757599395043,0.00186146755902483,0.00184704614166828,0.00183246409379467,0.00181781260522013,0.00180303445299428,0.00178817618230233,0.00177326665117531,0.00175825743472015,0.00174321986623152,0.00172813967160522],&#34;fillcolor&#34;:&#34;#252525&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#252525&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#252525&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;MH&#34;,&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y3&#34;},&#34;disp_HH&#34;:{&#34;x&#34;:[380.224858586159,381.664260686638,383.103662787117,384.543064887596,385.982466988075,387.421869088554,388.861271189032,390.300673289511,391.74007538999,393.179477490469,394.618879590948,396.058281691427,397.497683791906,398.937085892385,400.376487992864,401.815890093343,403.255292193822,404.694694294301,406.13409639478,407.573498495258,409.012900595737,410.452302696216,411.891704796695,413.331106897174,414.770508997653,416.209911098132,417.649313198611,419.08871529909,420.528117399569,421.967519500048,423.406921600527,424.846323701006,426.285725801485,427.725127901963,429.164530002442,430.603932102921,432.0433342034,433.482736303879,434.922138404358,436.361540504837,437.800942605316,439.240344705795,440.679746806274,442.119148906753,443.558551007232,444.997953107711,446.43735520819,447.876757308668,449.316159409147,450.755561509626,452.194963610105,453.634365710584,455.073767811063,456.513169911542,457.952572012021,459.3919741125,460.831376212979,462.270778313458,463.710180413937,465.149582514416,466.588984614894,468.028386715373,469.467788815852,470.907190916331,472.34659301681,473.785995117289,475.225397217768,476.664799318247,478.104201418726,479.543603519205,480.983005619684,482.422407720163,483.861809820642,485.301211921121,486.740614021599,488.180016122078,489.619418222557,491.058820323036,492.498222423515,493.937624523994,495.377026624473,496.816428724952,498.255830825431,499.69523292591,501.134635026389,502.574037126868,504.013439227347,505.452841327825,506.892243428304,508.331645528783,509.771047629262,511.210449729741,512.64985183022,514.089253930699,515.528656031178,516.968058131657,518.407460232136,519.846862332615,521.286264433094,522.725666533573,524.165068634052,525.60447073453,527.043872835009,528.483274935488,529.922677035967,531.362079136446,532.801481236925,534.240883337404,535.680285437883,537.119687538362,538.559089638841,539.99849173932,541.437893839799,542.877295940278,544.316698040756,545.756100141235,547.195502241714,548.634904342193,550.074306442672,551.513708543151,552.95311064363,554.392512744109,555.831914844588,557.271316945067,558.710719045546,560.150121146025,561.589523246504,563.028925346983,564.468327447461,565.90772954794,567.347131648419,568.786533748898,570.225935849377,571.665337949856,573.104740050335,574.544142150814,575.983544251293,577.422946351772,578.862348452251,580.30175055273,581.741152653209,583.180554753687,584.619956854166,586.059358954645,587.498761055124,588.938163155603,590.377565256082,591.816967356561,593.25636945704,594.695771557519,596.135173657998,597.574575758477,599.013977858956,600.453379959435,601.892782059914,603.332184160392,604.771586260871,606.21098836135,607.650390461829,609.089792562308,610.529194662787,611.968596763266,613.407998863745,614.847400964224,616.286803064703,617.726205165182,619.165607265661,620.60500936614,622.044411466618,623.483813567097,624.923215667576,626.362617768055,627.802019868534,629.241421969013,630.680824069492,632.120226169971,633.55962827045,634.999030370929,636.438432471408,637.877834571887,639.317236672366],&#34;y&#34;:[0.0017130253833055,0.00169789910893133,0.00168275938567878,0.00166762447034943,0.00165249304190316,0.00163739209151535,0.00162231119820322,0.00160726352484454,0.00159227018729436,0.00157730758022422,0.00156241988853816,0.0015475886229124,0.0015328041616933,0.00151812849504469,0.00150350176755884,0.00148895900700221,0.00147451355124719,0.00146012144131713,0.00144585207905298,0.0014316560989099,0.00141752962156152,0.00140353379090528,0.00138959433631011,0.00137575498372947,0.00136201280617626,0.00134832530219225,0.00133476116395686,0.00132125874438284,0.0013078230402702,0.00129449229270088,0.00128120617119291,0.00126800086206752,0.00125486111805665,0.00124175975388948,0.00122874076543203,0.00121575493034425,0.00120281002440948,0.00118991593236368,0.00117704231232895,0.00116420417794027,0.00115138616751374,0.00113858046828712,0.00112579219040262,0.00111300547829797,0.0011002209780041,0.00108742857528215,0.00107462972985676,0.00106181277551816,0.0010489751877674,0.00103612353647331,0.00102322676000437,0.00101030829736393,0.000997355554522161,0.000984353377246176,0.000971324946809989,0.000958237741039757,0.000945107902067139,0.00093194478885829,0.000918705814623569,0.00090543498750673,0.00089211127447287,0.000878727424828452,0.000865311950507665,0.000851828073556412,0.000838304409835874,0.000824745267456258,0.000811121967106031,0.000797473654030953,0.000783782829474506,0.000770054532954089,0.000756306552261031,0.00074252088762113,0.00072872059372057,0.000714905410302424,0.00070107634150401,0.000687245423766063,0.000673414213838668,0.000659593797965855,0.000645780868723229,0.000631998996553495,0.000618240994738088,0.000604510727016144,0.000590840821820369,0.000577203500636335,0.000563633690695862,0.000550134375917604,0.000536678926549688,0.000523348359031137,0.000510081973669644,0.000496900828177695,0.000483858823198671,0.000470887506401249,0.000458063811425165,0.000445366414044529,0.000432750560945216,0.000420359245544662,0.000408064095126645,0.000395915309259591,0.000383971018448062,0.000372131378459283,0.000360515675783783,0.000349066268981994,0.000337738928149714,0.000326703870818644,0.000315791570492304,0.000305078456344264,0.00029460996987067,0.000284269965774519,0.000274212146295781,0.000264338923915944,0.000254620647122549,0.000245226181624066,0.000235969172622667,0.000226946602011871,0.000218179771014197,0.000209552135656599,0.000201237942738589,0.000193105269985909,0.000185146555576052,0.000177508386892739,0.000170009063366395,0.000162757337467185,0.000155746752138146,0.000148873110493827,0.000142315044520795,0.000135918927981214,0.000129699946190386,0.000123770670904286,0.000117970301104339,0.000112409197756298,0.000107056700838339,0.000101828509541261,9.68928360153756e-05,9.20900279913917e-05,8.74532103153778e-05,8.30584774190275e-05,7.87749877884327e-05,7.47055586155652e-05,7.08034104984416e-05,6.70063941271683e-05,6.34614553957004e-05,6.00175697131866e-05,5.67181719003788e-05,5.36073164599534e-05,5.05863536408356e-05,4.77440608712767e-05,4.50269467084454e-05,4.23961985831507e-05,3.99627693238527e-05,3.76039308968209e-05,3.53626683055102e-05,3.32590143259477e-05,3.12237232816495e-05,2.93283096780023e-05,2.75207059808278e-05,2.57824582900523e-05,2.41842240499659e-05,2.26404643880079e-05,2.11865569389956e-05,1.98271301196025e-05,1.85168103783041e-05,1.73096017922823e-05,1.61603159428838e-05,1.50632935433486e-05,1.40599658830657e-05,1.30942954237329e-05,1.2193330300109e-05,1.13535589122089e-05,1.05471967333412e-05,9.81261152865343e-06,9.11403377222613e-06,8.45253746355187e-06,7.85031303038904e-06,7.2727841758559e-06,6.7392784810614e-06,6.24323791485739e-06,5.76876869694026e-06,5.34158786316747e-06,4.93553275271141e-06,4.55431487334153e-06,4.20860785301161e-06],&#34;fillcolor&#34;:&#34;#737373&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#737373&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#737373&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;HH&#34;,&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y3&#34;},&#34;hp_LL&#34;:{&#34;x&#34;:[-32.1231343283582,-31.2400692233548,-30.3570041183515,-29.4739390133481,-28.5908739083448,-27.7078088033414,-26.8247436983381,-25.9416785933347,-25.0586134883313,-24.175548383328,-23.2924832783246,-22.4094181733213,-21.5263530683179,-20.6432879633145,-19.7602228583112,-18.8771577533078,-17.9940926483045,-17.1110275433011,-16.2279624382977,-15.3448973332944,-14.461832228291,-13.5787671232877,-12.6957020182843,-11.8126369132809,-10.9295718082776,-10.0465067032742,-9.16344159827087,-8.28037649326751,-7.39731138826415,-6.51424628326079,-5.63118117825744,-4.74811607325407,-3.86505096825072,-2.98198586324736,-2.098920758244,-1.21585565324064,-0.332790548237281,0.550274556766077,1.43333966176944,2.3164047667728,3.19946987177615,4.08253497677951,4.96560008178287,5.84866518678623,6.73173029178959,7.61479539679295,8.49786050179631,9.38092560679967,10.263990711803,11.1470558168064,12.0301209218097,12.9131860268131,13.7962511318165,14.6793162368198,15.5623813418232,16.4454464468265,17.3285115518299,18.2115766568333,19.0946417618366,19.97770686684,20.8607719718433,21.7438370768467,22.6269021818501,23.5099672868534,24.3930323918568,25.2760974968601,26.1591626018635,27.0422277068668,27.9252928118702,28.8083579168736,29.6914230218769,30.5744881268803,31.4575532318836,32.340618336887,33.2236834418904,34.1067485468937,34.9898136518971,35.8728787569004,36.7559438619038,37.6390089669072,38.5220740719105,39.4051391769139,40.2882042819172,41.1712693869206,42.054334491924,42.9373995969273,43.8204647019307,44.703529806934,45.5865949119374,46.4696600169408,47.3527251219441,48.2357902269475,49.1188553319508,50.0019204369542,50.8849855419575,51.7680506469609,52.6511157519643,53.5341808569676,54.417245961971,55.3003110669743,56.1833761719777,57.0664412769811,57.9495063819844,58.8325714869878,59.7156365919911,60.5987016969945,61.4817668019978,62.3648319070012,63.2478970120046,64.1309621170079,65.0140272220113,65.8970923270146,66.780157432018,67.6632225370214,68.5462876420247,69.4293527470281,70.3124178520314,71.1954829570348,72.0785480620382,72.9616131670415,73.8446782720449,74.7277433770482,75.6108084820516,76.4938735870549,77.3769386920583,78.2600037970617],&#34;y&#34;:[9.79687808200003e-06,1.08499016101529e-05,1.19779171263786e-05,1.32219932972071e-05,1.46019617858553e-05,1.60769051980817e-05,1.76971699192788e-05,1.94893290064822e-05,2.14005366306973e-05,2.34918412957622e-05,2.5798345961556e-05,2.8252528597658e-05,3.09275990192816e-05,3.38692881353148e-05,3.69922513185915e-05,4.03833015239013e-05,4.41012077795573e-05,4.80392705874274e-05,5.22992666626073e-05,5.69557102168076e-05,6.18766665515483e-05,6.71800814575673e-05,7.29591807032274e-05,7.90526339286086e-05,8.55955242604432e-05,9.27029507060532e-05,0.000100179848819942,0.000108179084702458,0.000116840894128701,0.000125932101211093,0.000135623593658238,0.000146083985034161,0.000157037748013298,0.000168673546334814,0.000181191435411558,0.000194269644924321,0.000208113821433097,0.000222958168294295,0.000238431369048386,0.000254754669372437,0.000272198567827574,0.000290339746278264,0.000309413059328003,0.000329726678393146,0.000350803940730107,0.000372890729241268,0.000396333288579244,0.000420601634984182,0.000445949560029474,0.000472760615676973,0.000500453110652069,0.000529285174284202,0.000559675580144488,0.000590994304942156,0.00062349991551907,0.000657642900663671,0.000692750143021876,0.000729076568398171,0.000767099420568324,0.00080610959952254,0.000846354305009199,0.000888331167877948,0.000931303998790806,0.000975508361719241,0.00102145463033025,0.00106839000098817,0.00111653484642682,0.00116640357761233,0.00121723852708464,0.00126924183781098,0.00132292248016239,0.00137753054912589,0.00143324756976802,0.00149056716547411,0.00154876022574288,0.0016079860133102,0.00166871284148644,0.0017302453244062,0.00179271960726153,0.00185656903958986,0.0019211442831529,0.00198655829405207,0.00205320043677222,0.0021204786786494,0.00218848344396532,0.0022575519659442,0.00232715934479666,0.00239737476182453,0.00246847617729613,0.00254001398809132,0.00261203792480487,0.00268476053006226,0.00275781392835013,0.00283123055122525,0.00290515222121249,0.0029792975990053,0.00305368418504112,0.0031283783259031,0.00320318869337232,0.00327812031524213,0.00335315944156688,0.00342820734101443,0.00350325902370583,0.00357821567435848,0.00365307341338634,0.00372781963207195,0.00380226463704252,0.00387650193527363,0.00395051363452645,0.00402401207015758,0.00409719153969708,0.00417003117403864,0.00424213666290484,0.00431380785365835,0.00438502324548126,0.00445527153523058,0.00452496453745405,0.00459408258682764,0.00466198554596969,0.00472920532157653,0.00479572675282864,0.00486076802243243,0.00492499070730694,0.00498838707597539,0.00505002059489619,0.00511069295991653],&#34;fillcolor&#34;:&#34;#BDBDBD&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#BDBDBD&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#BDBDBD&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;LL&#34;,&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y4&#34;},&#34;hp_ML&#34;:{&#34;x&#34;:[79.143068902065,80.0261340070684,80.9091991120717,81.7922642170751,82.6753293220785,83.5583944270818,84.4414595320852,85.3245246370885,86.2075897420919,87.0906548470953,87.9737199520986,88.856785057102,89.7398501621053,90.6229152671087,91.505980372112,92.3890454771154,93.2721105821188,94.1551756871221,95.0382407921255,95.9213058971288,96.8043710021322,97.6874361071356,98.5705012121389,99.4535663171423,100.336631422146,101.219696527149,102.102761632152,102.985826737156,103.868891842159,104.751956947162,105.635022052166,106.518087157169,107.401152262173,108.284217367176,109.167282472179,110.050347577183,110.933412682186,111.816477787189,112.699542892193,113.582607997196,114.465673102199,115.348738207203,116.231803312206,117.114868417209,117.997933522213],&#34;y&#34;:[0.00517040334738558,0.00522805952649147,0.00528460260028958,0.00534003541994984,0.00539313125355562,0.00544494880364739,0.00549550497632919,0.00554344283196756,0.00558993499432882,0.00563501591643835,0.00567720769739827,0.0057177895709357,0.00575681690188356,0.00579270569964288,0.00582683022301048,0.00585926971669587,0.00588835489291618,0.00591553884307006,0.00594092694777925,0.00596279119416854,0.0059826427352715,0.00600061429863184,0.00601495089450925,0.00602719680394936,0.00603751195045029,0.0060441502408575,0.0060486607789368,0.00605122890688353,0.00605015598194902,0.0060469653736006,0.00604186426305634,0.00603324094172419,0.00602256160835661,0.00601004984371545,0.00599421934690422,0.00597644835500058,0.00595696963234803,0.00593445775289985,0.00591017440998003,0.00588435279361759,0.00585585890148174,0.00582581299422336,0.00579443877077885,0.00576081759088187,0.00572590838081043],&#34;fillcolor&#34;:&#34;#525252&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#525252&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#525252&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;ML&#34;,&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y4&#34;},&#34;hp_M&#34;:{&#34;x&#34;:[118.880998627216,119.76406373222,120.647128837223,121.530193942226,122.41325904723,123.296324152233,124.179389257236,125.06245436224,125.945519467243,126.828584572246,127.71164967725,128.594714782253,129.477779887256,130.36084499226,131.243910097263,132.126975202267,133.01004030727,133.893105412273,134.776170517277,135.65923562228,136.542300727283,137.425365832287,138.30843093729,139.191496042293,140.074561147297,140.9576262523,141.840691357304,142.723756462307,143.60682156731,144.489886672314,145.372951777317,146.25601688232,147.139081987324,148.022147092327,148.90521219733,149.788277302334,150.671342407337,151.55440751234,152.437472617344,153.320537722347,154.203602827351,155.086667932354,155.969733037357,156.852798142361,157.735863247364,158.618928352367,159.501993457371,160.385058562374,161.268123667377,162.151188772381],&#34;y&#34;:[0.00568991478780297,0.00565214950862876,0.00561339622959676,0.00557382795940261,0.00553299582477907,0.00549150101510485,0.00544947596719205,0.00540670802730479,0.00536361553358976,0.00532028176487386,0.00527671887670517,0.00523316874919709,0.00518965891998158,0.00514640636310399,0.00510348909742846,0.00506087490492753,0.00501895809792148,0.00497767075025527,0.00493691987149359,0.00489724363120026,0.00485845024098408,0.00482038817251986,0.0047837017585785,0.00474810026388881,0.00471337915939137,0.00468024900632521,0.00464834645164365,0.00461742264186742,0.00458821422544451,0.00456031156774863,0.00453343293066565,0.00450830267600873,0.00448448992681644,0.00446169369372421,0.00444059124544131,0.00442075308108812,0.00440187405533217,0.00438455463222955,0.00436838600062241,0.00435307456743582,0.00433912055296418,0.00432615123936318,0.00431389999458945,0.00430275040314898,0.00429237702378942,0.0042825543783791,0.00427354041653365,0.00426506391555814,0.00425695266859743,0.00424933730267583],&#34;fillcolor&#34;:&#34;#969696&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#969696&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#969696&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;M&#34;,&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y4&#34;},&#34;hp_MH&#34;:{&#34;x&#34;:[163.034253877384,163.917318982387,164.800384087391,165.683449192394,166.566514297398,167.449579402401,168.332644507404,169.215709612408,170.098774717411,170.981839822414,171.864904927418,172.747970032421,173.631035137424,174.514100242428,175.397165347431,176.280230452435,177.163295557438,178.046360662441,178.929425767445,179.812490872448,180.695555977451,181.578621082455,182.461686187458,183.344751292461,184.227816397465,185.110881502468,185.993946607471,186.877011712475,187.760076817478,188.643141922482,189.526207027485,190.409272132488,191.292337237492,192.175402342495,193.058467447498,193.941532552502,194.824597657505,195.707662762508,196.590727867512,197.473792972515,198.356858077518,199.239923182522,200.122988287525,201.006053392529,201.889118497532,202.772183602535,203.655248707539,204.538313812542,205.421378917545,206.304444022549,207.187509127552,208.070574232555,208.953639337559,209.836704442562,210.719769547566,211.602834652569,212.485899757572,213.368964862576,214.252029967579,215.135095072582,216.018160177586,216.901225282589,217.784290387592,218.667355492596,219.550420597599,220.433485702602,221.316550807606,222.199615912609,223.082681017613,223.965746122616,224.848811227619,225.731876332623,226.614941437626,227.498006542629,228.381071647633,229.264136752636,230.147201857639,231.030266962643,231.913332067646,232.79639717265,233.679462277653,234.562527382656,235.44559248766,236.328657592663,237.211722697666],&#34;y&#34;:[0.00424200375673593,0.00423484239234143,0.00422786165620581,0.00422090405636099,0.00421392842109972,0.00420683215840358,0.00419951084631453,0.00419199390737863,0.00418408374133526,0.00417572332320555,0.00416701088812802,0.00415767344010531,0.00414769427575147,0.00413723485824349,0.00412596857781388,0.004113911324062,0.00410127874612067,0.00408771314588398,0.00407325529683337,0.00405816309674212,0.00404206967607605,0.00402503355616966,0.00400734079293165,0.00398863545292546,0.00396898764779045,0.00394869622007615,0.00392743348302102,0.00390527620273809,0.00388252029991117,0.00385888011772439,0.00383443544465378,0.00380946418688896,0.00378373252418321,0.0037573208743367,0.0037304755513921,0.00370302023679075,0.00367503463824815,0.00364672220233554,0.00361796573981621,0.00358884369028748,0.003559508286406,0.00352989939924513,0.00350009410303498,0.00347018842790519,0.00344017407239337,0.00341012677921175,0.00338008495426087,0.00335008439834303,0.00332019938531918,0.0032904128246132,0.00326079515471126,0.00323141862801866,0.0032022160994284,0.00317328221900555,0.00314468608677897,0.00311631882892708,0.00308828867009858,0.00306065978028147,0.00303329217562533,0.00300629748643484,0.00297973255832207,0.00295343850021728,0.00292752121991004,0.00290202735084002,0.00287679210315529,0.00285190801759298,0.0028274083370815,0.00280313538829475,0.00277916248480108,0.00275550627301554,0.00273202844693663,0.00270877917431494,0.00268575557023437,0.00266284948120425,0.00264008597294099,0.00261744027436354,0.00259484310913937,0.0025722943472445,0.00254974584944774,0.00252717341928582,0.00250455329968352,0.00248181362722983,0.00245897865621778,0.00243600395740772,0.00241279490632013],&#34;fillcolor&#34;:&#34;#252525&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#252525&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#252525&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;MH&#34;,&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y4&#34;},&#34;hp_HH&#34;:{&#34;x&#34;:[238.09478780267,238.977852907673,239.860918012676,240.74398311768,241.627048222683,242.510113327686,243.39317843269,244.276243537693,245.159308642696,246.0423737477,246.925438852703,247.808503957707,248.69156906271,249.574634167713,250.457699272717,251.34076437772,252.223829482723,253.106894587727,253.98995969273,254.873024797733,255.756089902737,256.63915500774,257.522220112744,258.405285217747,259.28835032275,260.171415427754,261.054480532757,261.93754563776,262.820610742764,263.703675847767,264.58674095277,265.469806057774,266.352871162777,267.23593626778,268.119001372784,269.002066477787,269.885131582791,270.768196687794,271.651261792797,272.534326897801,273.417392002804,274.300457107807,275.183522212811,276.066587317814,276.949652422817,277.832717527821,278.715782632824,279.598847737827,280.481912842831,281.364977947834,282.248043052838,283.131108157841,284.014173262844,284.897238367848,285.780303472851,286.663368577854,287.546433682858,288.429498787861,289.312563892864,290.195628997868,291.078694102871,291.961759207875,292.844824312878,293.727889417881,294.610954522885,295.494019627888,296.377084732891,297.260149837895,298.143214942898,299.026280047901,299.909345152905,300.792410257908,301.675475362911,302.558540467915,303.441605572918,304.324670677922,305.207735782925,306.090800887928,306.973865992932,307.856931097935,308.739996202938,309.623061307942,310.506126412945,311.389191517948,312.272256622952,313.155321727955,314.038386832959,314.921451937962,315.804517042965,316.687582147969,317.570647252972,318.453712357975,319.336777462979,320.219842567982,321.102907672985,321.985972777989,322.869037882992,323.752102987995,324.635168092999,325.518233198002,326.401298303006,327.284363408009,328.167428513012,329.050493618016,329.933558723019,330.816623828022,331.699688933026,332.582754038029,333.465819143032,334.348884248036,335.231949353039,336.115014458042,336.998079563046,337.881144668049,338.764209773053,339.647274878056,340.530339983059,341.413405088063,342.296470193066,343.179535298069,344.062600403073,344.945665508076,345.828730613079,346.711795718083,347.594860823086,348.47792592809,349.360991033093,350.244056138096,351.1271212431,352.010186348103,352.893251453106,353.77631655811,354.659381663113,355.542446768116,356.42551187312,357.308576978123,358.191642083126,359.07470718813,359.957772293133,360.840837398137,361.72390250314,362.606967608143,363.490032713147,364.37309781815,365.256162923153,366.139228028157,367.02229313316,367.905358238163,368.788423343167,369.67148844817,370.554553553173,371.437618658177,372.32068376318,373.203748868184,374.086813973187,374.96987907819,375.852944183194,376.736009288197,377.6190743932,378.502139498204,379.385204603207,380.26826970821,381.151334813214,382.034399918217,382.917465023221,383.800530128224,384.683595233227,385.566660338231,386.449725443234,387.332790548237,388.215855653241,389.098920758244,389.981985863247,390.865050968251,391.748116073254,392.631181178257,393.514246283261,394.397311388264,395.280376493268,396.163441598271,397.046506703274,397.929571808278,398.812636913281,399.695702018284,400.578767123288,401.461832228291,402.344897333294,403.227962438298,404.111027543301,404.994092648305,405.877157753308,406.760222858311,407.643287963315,408.526353068318,409.409418173321,410.292483278325,411.175548383328,412.058613488331,412.941678593335,413.824743698338,414.707808803341,415.590873908345,416.473939013348,417.357004118351,418.240069223355,419.123134328358],&#34;y&#34;:[0.00238942459714921,0.00236583194283586,0.00234190195802631,0.00231775399364488,0.00229331502654834,0.00226845358074284,0.00224332986834957,0.00221786400530133,0.00219191330934521,0.00216567094061096,0.00213905524735795,0.00211191889676121,0.00208447797429014,0.00205665387202551,0.00202830221097642,0.00199965036620224,0.00197062705172858,0.00194109920493989,0.00191129279865307,0.00188114741868688,0.0018505500962244,0.00181971224302823,0.00178858700441915,0.00175709031957122,0.00172540600665284,0.00169350252372267,0.00166133317507306,0.00162904185023137,0.00159661312508453,0.00156404537889241,0.00153143146081773,0.0014987719608732,0.0014661169277746,0.00143349874262698,0.00140093308170255,0.00136852681314759,0.00133624448637682,0.00130411523262258,0.00127230616909656,0.00124070900221688,0.0012093641303341,0.00117850041805106,0.00114793425971598,0.00111771473936465,0.00108813189830555,0.00105892698120457,0.00103015495203936,0.00100216432993698,0.000974623993820047,0.000947591924217993,0.000921470312505527,0.000895860973146585,0.000870822138378165,0.00084680286116761,0.000823345519150435,0.000800506069124938,0.000778771788430058,0.000757635303576639,0.000737148123394931,0.000717825535822805,0.000699121825438341,0.000681082326074135,0.000664238860007342,0.000648020113596993,0.000632464026537626,0.000618106585505223,0.000604364526115151,0.000591267715384892,0.000579343453232738,0.000568010616289763,0.00055729086400316,0.000547689920466297,0.000538642864699629,0.000530163531839688,0.000522723602808788,0.000515787914153286,0.000509363326274108,0.000503875891146903,0.00049883278924453,0.000494235147145259,0.000490453126269509,0.000487047434559259,0.000484017665152496,0.00048166157214175,0.000479610767476372,0.000477862149611602,0.000476635299266464,0.000475639317177637,0.000474868663200252,0.000474465977761868,0.000474217417252387,0.000474116803718427,0.000474233493227598,0.000474427843102093,0.000474694792211258,0.000475036245718232,0.000475381745901222,0.000475728943829093,0.00047601998172377,0.000476246740386285,0.000476410917513629,0.000476404048174469,0.000476272060683338,0.000476021688626576,0.000475504050712428,0.000474809810160231,0.000473951318966293,0.000472750046612482,0.00047133149725295,0.000469713782002425,0.000467699602074393,0.000465439264042791,0.000462956330656678,0.000460045285647853,0.000456871467989388,0.000453463158979802,0.000449616441326831,0.000445502555364321,0.000441153392093873,0.000436375369821376,0.000431337450134642,0.000426073722559581,0.000420408325950373,0.000414500955224666,0.000408386276596239,0.00040191199478706,0.0003952229052873,0.000388352521799463,0.000381176321289984,0.000373820004374724,0.000366314203220831,0.000358564722952029,0.00035067541490184,0.000342672405106483,0.000334492802364367,0.00032621722769765,0.000317865874752032,0.000309406691935343,0.000300896934137027,0.000292349712220037,0.000283762107670874,0.000275168943649171,0.0002665754303265,0.000258005069941345,0.000249472052083462,0.000240973233771143,0.000232555078414792,0.000224213581716396,0.000215937169032352,0.000207791321274187,0.000199756698391055,0.000191813574654313,0.000184042272872697,0.000176411183077317,0.00016889303262632,0.000161578806796962,0.000154427711417928,0.000147405802656372,0.00014061073924322,0.000133995491140457,0.000127520526940213,0.000121286534305694,0.000115242936058129,0.00010934583478723,0.000103695758206613,9.82409253553688e-05,9.29343613804089e-05,8.78737694576559e-05,8.30081123131835e-05,7.82886259432095e-05,7.38080779959933e-05,6.95177077826524e-05,6.53681905547252e-05,6.14457961813185e-05,5.77051671081765e-05,5.40975372593573e-05,5.07016327007441e-05,4.74762485032507e-05,4.43741508486817e-05,4.14659391754651e-05,3.8714977832981e-05,3.60763690551319e-05,3.36123996100005e-05,3.1291140181757e-05,2.90706516035676e-05,2.70050455028729e-05,2.50670133245404e-05,2.32180156424582e-05,2.15043757469161e-05,1.99031539313542e-05,1.83794795831441e-05,1.69724529143201e-05,1.56631370668369e-05,1.44204439184336e-05,1.32769303280645e-05,1.22172280953771e-05,1.12140115902366e-05,1.02940335023496e-05,9.44503013055652e-06,8.64330921532224e-06,7.91057296389606e-06,7.23719813109566e-06,6.60291297634657e-06,6.02510267371112e-06,5.49634266454592e-06,4.99950972405931e-06],&#34;fillcolor&#34;:&#34;#737373&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#737373&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#737373&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;HH&#34;,&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y4&#34;},&#34;drat_LL&#34;:{&#34;x&#34;:[2.03818370630419,2.04525539434214,2.05232708238009,2.05939877041803,2.06647045845598,2.07354214649393,2.08061383453188,2.08768552256983,2.09475721060778,2.10182889864572,2.10890058668367,2.11597227472162,2.12304396275957,2.13011565079752,2.13718733883547,2.14425902687341,2.15133071491136,2.15840240294931,2.16547409098726,2.17254577902521,2.17961746706316,2.1866891551011,2.19376084313905,2.200832531177,2.20790421921495,2.2149759072529,2.22204759529085,2.22911928332879,2.23619097136674,2.24326265940469,2.25033434744264,2.25740603548059,2.26447772351854,2.27154941155649,2.27862109959443,2.28569278763238,2.29276447567033,2.29983616370828,2.30690785174623,2.31397953978418,2.32105122782212,2.32812291586007,2.33519460389802,2.34226629193597,2.34933797997392,2.35640966801187,2.36348135604981,2.37055304408776,2.37762473212571,2.38469642016366,2.39176810820161,2.39883979623956,2.4059114842775,2.41298317231545,2.4200548603534,2.42712654839135,2.4341982364293,2.44126992446725,2.44834161250519,2.45541330054314,2.46248498858109,2.46955667661904,2.47662836465699,2.48370005269494,2.49077174073288,2.49784342877083,2.50491511680878,2.51198680484673,2.51905849288468,2.52613018092263,2.53320186896058,2.54027355699852,2.54734524503647,2.55441693307442,2.56148862111237,2.56856030915032,2.57563199718827,2.58270368522621,2.58977537326416,2.59684706130211,2.60391874934006,2.61099043737801,2.61806212541596,2.6251338134539,2.63220550149185,2.6392771895298,2.64634887756775,2.6534205656057,2.66049225364365,2.66756394168159,2.67463562971954,2.68170731775749,2.68877900579544,2.69585069383339,2.70292238187134,2.70999406990928,2.71706575794723,2.72413744598518,2.73120913402313,2.73828082206108,2.74535251009903,2.75242419813697,2.75949588617492,2.76656757421287,2.77363926225082,2.78071095028877,2.78778263832672,2.79485432636467,2.80192601440261,2.80899770244056,2.81606939047851,2.82314107851646,2.83021276655441,2.83728445459236,2.8443561426303,2.85142783066825,2.8584995187062,2.86557120674415,2.8726428947821,2.87971458282005,2.88678627085799,2.89385795889594,2.90092964693389,2.90800133497184,2.91507302300979,2.92214471104774,2.92921639908568,2.93628808712363,2.94335977516158,2.95043146319953,2.95750315123748,2.96457483927543,2.97164652731337,2.97871821535132,2.98578990338927,2.99286159142722,2.99993327946517,3.00700496750312,3.01407665554107,3.02114834357901,3.02822003161696,3.03529171965491,3.04236340769286,3.04943509573081,3.05650678376876,3.0635784718067,3.07065015984465,3.0777218478826,3.08479353592055,3.0918652239585,3.09893691199645,3.10600860003439,3.11308028807234],&#34;y&#34;:[0.00126598819738069,0.00138587235833438,0.00151279746231649,0.00165336725077721,0.00180510837015693,0.0019654058038631,0.00214377816119162,0.00233439091147269,0.00253532020954976,0.00275985720806498,0.00299750396930818,0.00324867639191957,0.00352790473654973,0.00382198729929515,0.00413442496479614,0.00447816038321587,0.00483939751204314,0.00522500214356034,0.00564502750040932,0.00608551323147269,0.0065577271551308,0.00706723007950923,0.00760046762156213,0.00817430194175517,0.00878788577841129,0.00942879215005025,0.0101208179512805,0.0108544798816008,0.0116193569608922,0.0124476545151942,0.0133187271752813,0.0142251956502987,0.0152092577959082,0.0162363117271119,0.0173059691499824,0.0184637927941887,0.0196664982416047,0.0209234778691759,0.0222726649061684,0.0236716127404475,0.0251381983059787,0.0266999116664103,0.0283163944297717,0.0300155634224831,0.0318114692032819,0.0336672243461778,0.0356223386619619,0.0376743211341338,0.0397912392906347,0.0420256954627814,0.0443555397358135,0.0467553412777907,0.0492921843600273,0.0519212299236872,0.0546251129665285,0.0574866177959003,0.0604353856927606,0.063467211885666,0.0666708707798461,0.0699586662584661,0.0733461331737696,0.0769026041965217,0.0805470954727276,0.0843085272010241,0.0882339113354219,0.0922506837414249,0.0964019375984928,0.100709883853709,0.105111967444723,0.109665879904687,0.114367089848177,0.119164457777222,0.124130254270337,0.129231955110414,0.134430990109267,0.139813655714066,0.145319040105102,0.150921967541978,0.156721577756232,0.162629210761753,0.168635595181825,0.174844514130807,0.18114771154497,0.187560396464667,0.194155977250259,0.200842164771749,0.207645808842937,0.214610471086261,0.221660540509082,0.228832344836881,0.236141479394455,0.24352916567825,0.25103817169871,0.258659556323889,0.266350867584505,0.274157333633679,0.282050633308106,0.290003373701541,0.298058283398332,0.306174681066345,0.314338113366994,0.322582876876327,0.330864885503626,0.339179593615226,0.347545998872879,0.355927508127765,0.36432623428102,0.37273599273758,0.381142602341497,0.389543374041856,0.397916057911427,0.406265744204614,0.414578423869034,0.422826756271154,0.431030908453682,0.439158526601253,0.447189729470628,0.455154577330502,0.462995138045393,0.470712675920079,0.478341112071451,0.485789864868427,0.493095569586098,0.500289347146154,0.507241489441664,0.514038026828523,0.520700289278531,0.527054031751429,0.533247646648048,0.539265865423929,0.544945617424384,0.550449069578441,0.555729177572732,0.560657844842349,0.565393427126308,0.569855988020064,0.573965279427514,0.577867793274362,0.58144829303755,0.584684655294346,0.587704207746766,0.590356164794076,0.592683338527435,0.594787822079183,0.596485456778507,0.597886605921603,0.599063727141506,0.599804029258948,0.600283319926518,0.600542055892647,0.600346109940177,0.599929634600915,0.599281155573768],&#34;fillcolor&#34;:&#34;#BDBDBD&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#BDBDBD&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#BDBDBD&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;LL&#34;,&#34;xaxis&#34;:&#34;x5&#34;,&#34;yaxis&#34;:&#34;y5&#34;},&#34;drat_ML&#34;:{&#34;x&#34;:[3.12015197611029,3.12722366414824,3.13429535218619,3.14136704022414,3.14843872826208,3.15551041630003,3.16258210433798,3.16965379237593,3.17672548041388,3.18379716845183,3.19086885648977,3.19794054452772,3.20501223256567,3.21208392060362,3.21915560864157,3.22622729667952,3.23329898471746,3.24037067275541,3.24744236079336,3.25451404883131,3.26158573686926,3.26865742490721,3.27572911294516,3.2828008009831,3.28987248902105,3.296944177059,3.30401586509695,3.3110875531349,3.31815924117285,3.32523092921079,3.33230261724874,3.33937430528669,3.34644599332464,3.35351768136259,3.36058936940054,3.36766105743848,3.37473274547643,3.38180443351438],&#34;y&#34;:[0.598214476951511,0.596950446376127,0.595443311589576,0.593580245466812,0.591538403191161,0.589253991716899,0.586680150241697,0.583950400276721,0.580991787174672,0.577811337412118,0.574501613500055,0.570990831148218,0.567323802458676,0.563557244027627,0.559631753632739,0.555610729480409,0.551522263332985,0.547330774923348,0.543097092377302,0.538829548013045,0.534527361169737,0.530226964677331,0.525928377270284,0.521670934898567,0.517450046435125,0.51327522818671,0.509207175840891,0.50520795051148,0.501306948289293,0.497564460808031,0.493920795213157,0.490433080341685,0.487140975762839,0.483974626321311,0.481024785387179,0.47829299057711,0.475710141420538,0.473404158756678],&#34;fillcolor&#34;:&#34;#525252&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#525252&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#525252&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;ML&#34;,&#34;xaxis&#34;:&#34;x5&#34;,&#34;yaxis&#34;:&#34;y5&#34;},&#34;drat_M&#34;:{&#34;x&#34;:[3.38887612155233,3.39594780959028,3.40301949762823,3.41009118566617,3.41716287370412,3.42423456174207,3.43130624978002,3.43837793781797,3.44544962585592,3.45252131389386,3.45959300193181,3.46666468996976,3.47373637800771,3.48080806604566,3.48787975408361,3.49495144212155,3.5020231301595,3.50909481819745,3.5161665062354,3.52323819427335,3.5303098823113,3.53738157034925,3.54445325838719,3.55152494642514,3.55859663446309,3.56566832250104,3.57274001053899,3.57981169857694,3.58688338661488,3.59395507465283,3.60102676269078,3.60809845072873,3.61517013876668,3.62224182680463,3.62931351484257,3.63638520288052,3.64345689091847,3.65052857895642,3.65760026699437,3.66467195503232,3.67174364307026,3.67881533110821,3.68588701914616,3.69295870718411,3.70003039522206,3.70710208326001,3.71417377129795,3.7212454593359,3.72831714737385,3.7353888354118,3.74246052344975,3.7495322114877,3.75660389952565,3.76367558756359,3.77074727560154,3.77781896363949,3.78489065167744,3.79196233971539,3.79903402775334,3.80610571579128,3.81317740382923,3.82024909186718,3.82732077990513,3.83439246794308,3.84146415598103,3.84853584401897,3.85560753205692,3.86267922009487,3.86975090813282,3.87682259617077,3.88389428420872,3.89096597224666,3.89803766028461,3.90510934832256,3.91218103636051,3.91925272439846,3.92632441243641,3.93339610047435,3.9404677885123,3.94753947655025,3.9546111645882,3.96168285262615,3.9687545406641,3.97582622870204,3.98289791673999,3.98996960477794,3.99704129281589],&#34;y&#34;:[0.471324720875718,0.469413117209191,0.467835380109481,0.466480116797695,0.465306851388123,0.464517970748999,0.463936821298666,0.463557284954281,0.463582329001193,0.46380243703557,0.464255463094842,0.46508761003291,0.466113137109766,0.467396069329002,0.46902191601056,0.470834556701417,0.472920142239685,0.475304671086762,0.477864814759255,0.48070277212703,0.483790977437159,0.487039441161049,0.490558673872761,0.494277686310963,0.49813792762276,0.502249264286104,0.506510873378503,0.510891581313347,0.515490912339685,0.520194380884358,0.524994924983534,0.529964016114044,0.534999079464372,0.540110921315773,0.545322561704539,0.550572508274626,0.555869322882114,0.561203834623387,0.56654857097259,0.571901307814765,0.577237980708613,0.582556994359498,0.587837229135085,0.593057148385689,0.598232293280591,0.603315339562217,0.60830398450476,0.613222026920691,0.617989736614001,0.622639299308256,0.627194175428375,0.631537374297922,0.635748760140588,0.639842135180965,0.643664031184796,0.647348516496629,0.650874778924519,0.654109166075911,0.657189699573837,0.660070080917306,0.662649630777498,0.665061776720675,0.667231741191423,0.669102244024762,0.670794774495389,0.672204573594007,0.673325260989425,0.674260413171227,0.67487524835766,0.675218798907109,0.675372220338789,0.67517204522771,0.674724301148448,0.674084711761959,0.67306371220945,0.671823139566739,0.670391743886503,0.668557539537049,0.666534468242233,0.664300440634407,0.661696768825938,0.658912450870928,0.655899532133248,0.652557463621282,0.649042989088983,0.645287491847884,0.641244969794162],&#34;fillcolor&#34;:&#34;#969696&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#969696&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#969696&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;M&#34;,&#34;xaxis&#34;:&#34;x5&#34;,&#34;yaxis&#34;:&#34;y5&#34;},&#34;drat_MH&#34;:{&#34;x&#34;:[4.00411298085384,4.01118466889179,4.01825635692973,4.02532804496768,4.03239973300563,4.03947142104358,4.04654310908153,4.05361479711948,4.06068648515743,4.06775817319537,4.07482986123332,4.08190154927127,4.08897323730922,4.09604492534717,4.10311661338512,4.11018830142306,4.11725998946101,4.12433167749896,4.13140336553691,4.13847505357486,4.14554674161281,4.15261842965075,4.1596901176887,4.16676180572665,4.1738334937646,4.18090518180255,4.1879768698405,4.19504855787844,4.20212024591639,4.20919193395434,4.21626362199229,4.22333531003024,4.23040699806819,4.23747868610613,4.24455037414408,4.25162206218203,4.25869375021998,4.26576543825793,4.27283712629588,4.27990881433383,4.28698050237177,4.29405219040972,4.30112387844767,4.30819556648562,4.31526725452357,4.32233894256152,4.32941063059946,4.33648231863741,4.34355400667536,4.35062569471331,4.35769738275126,4.36476907078921,4.37184075882715,4.3789124468651,4.38598413490305,4.393055822941,4.40012751097895,4.4071991990169,4.41427088705484,4.42134257509279,4.42841426313074,4.43548595116869,4.44255763920664,4.44962932724459,4.45670101528254,4.46377270332048,4.47084439135843,4.47791607939638,4.48498776743433,4.49205945547228,4.49913114351022,4.50620283154817,4.51327451958612,4.52034620762407,4.52741789566202,4.53448958369997,4.54156127173792,4.54863295977586,4.55570464781381,4.56277633585176,4.56984802388971,4.57691971192766,4.5839913999656,4.59106308800355,4.5981347760415,4.60520646407945,4.6122781521174,4.61934984015535,4.6264215281933,4.63349321623124,4.64056490426919,4.64763659230714,4.65470828034509,4.66177996838304,4.66885165642099,4.67592334445893],&#34;y&#34;:[0.637040080093885,0.632587455203179,0.627890092620828,0.62304192919991,0.617945309507439,0.612645112155295,0.60720693672492,0.601525662244247,0.595679750030535,0.58970966924171,0.583507832860647,0.57717718957808,0.570736913253072,0.564081960810003,0.557330237729437,0.550474704229368,0.543445308037235,0.53633770222662,0.529133653864378,0.521798818515274,0.514401041934012,0.506918774213328,0.49934398156336,0.491721332209864,0.484030369140527,0.476280030162502,0.468496572002771,0.460664767271334,0.452801490901571,0.44491934512443,0.437012116339885,0.429096088986267,0.421174835422999,0.413254528332898,0.405343000231942,0.397439184611123,0.389564560392551,0.381711432314889,0.373880452692728,0.366104008146081,0.358359509836531,0.350654787772851,0.343022981753177,0.335433431940326,0.327903236460449,0.320459230447039,0.313066867245765,0.30575489625887,0.298537678613615,0.291380548649927,0.284325821686569,0.277370135434903,0.270482030028777,0.263718832220486,0.257055140766396,0.250465568004076,0.244023431816766,0.237677912193898,0.231412094698412,0.225315807456963,0.219310362089558,0.213394817859374,0.207658879133097,0.20201115889923,0.19646980142671,0.191102380107365,0.185825813714651,0.180671688534505,0.175682953964337,0.170786781183835,0.166028302156696,0.161424263595708,0.156913572633975,0.152554567075941,0.148337116364783,0.144212888428491,0.140252652894191,0.136419618704497,0.132678785435357,0.129112160373201,0.125657381622271,0.122292903339117,0.119110377487442,0.116023805279236,0.113028441095987,0.110212636773004,0.107480475258719,0.104847119770841,0.102372808049453,0.0999777047115129,0.0976867342759075,0.095533959863475,0.0934552548078404,0.0914834770924906,0.0896292187635928,0.0878432606240513],&#34;fillcolor&#34;:&#34;#252525&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#252525&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#252525&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;MH&#34;,&#34;xaxis&#34;:&#34;x5&#34;,&#34;yaxis&#34;:&#34;y5&#34;},&#34;drat_HH&#34;:{&#34;x&#34;:[4.68299503249688,4.69006672053483,4.69713840857278,4.70421009661073,4.71128178464868,4.71835347268662,4.72542516072457,4.73249684876252,4.73956853680047,4.74664022483842,4.75371191287637,4.76078360091431,4.76785528895226,4.77492697699021,4.78199866502816,4.78907035306611,4.79614204110406,4.803213729142,4.81028541717995,4.8173571052179,4.82442879325585,4.8315004812938,4.83857216933175,4.8456438573697,4.85271554540764,4.85978723344559,4.86685892148354,4.87393060952149,4.88100229755944,4.88807398559739,4.89514567363533,4.90221736167328,4.90928904971123,4.91636073774918,4.92343242578713,4.93050411382508,4.93757580186302,4.94464748990097,4.95171917793892,4.95879086597687,4.96586255401482,4.97293424205277,4.98000593009071,4.98707761812866,4.99414930616661,5.00122099420456,5.00829268224251,5.01536437028046,5.02243605831841,5.02950774635635,5.0365794343943,5.04365112243225,5.0507228104702,5.05779449850815,5.0648661865461,5.07193787458404,5.07900956262199,5.08608125065994,5.09315293869789,5.10022462673584,5.10729631477379,5.11436800281173,5.12143969084968,5.12851137888763,5.13558306692558,5.14265475496353,5.14972644300148,5.15679813103942,5.16386981907737,5.17094150711532,5.17801319515327,5.18508488319122,5.19215657122917,5.19922825926711,5.20629994730506,5.21337163534301,5.22044332338096,5.22751501141891,5.23458669945686,5.24165838749481,5.24873007553275,5.2558017635707,5.26287345160865,5.2699451396466,5.27701682768455,5.28408851572249,5.29116020376044,5.29823189179839,5.30530357983634,5.31237526787429,5.31944695591224,5.32651864395019,5.33359033198813,5.34066202002608,5.34773370806403,5.35480539610198,5.36187708413993,5.36894877217788,5.37602046021582,5.38309214825377,5.39016383629172,5.39723552432967,5.40430721236762,5.41137890040557,5.41845058844351,5.42552227648146,5.43259396451941,5.43966565255736,5.44673734059531,5.45380902863326,5.4608807166712,5.46795240470915,5.4750240927471,5.48209578078505,5.489167468823,5.49623915686095,5.50331084489889,5.51038253293684,5.51745422097479,5.52452590901274,5.53159759705069,5.53866928508864,5.54574097312658,5.55281266116453,5.55988434920248,5.56695603724043,5.57402772527838,5.58109941331633,5.58817110135428,5.59524278939222,5.60231447743017,5.60938616546812,5.61645785350607,5.62352954154402,5.63060122958197,5.63767291761991,5.64474460565786,5.65181629369581],&#34;y&#34;:[0.0861643045796748,0.0845828477546949,0.0830633808239592,0.0816481727534142,0.0803115543022513,0.0790301776545263,0.0778475022961366,0.0767260246757921,0.075652719566355,0.0746698590773018,0.073732666139111,0.0728371653102059,0.0720198206247599,0.0712355226311803,0.0704894944758486,0.069800983441755,0.0691383143891391,0.068508454662699,0.0679180520984674,0.0673465387202299,0.0668006457502443,0.0662789398661138,0.0657695590206963,0.0652772800884783,0.0647968033611789,0.0643226031531908,0.0638561272176374,0.063391931010813,0.062928591120251,0.0624632579135397,0.0619934075708797,0.0615197159325115,0.0610345144051687,0.0605404844606319,0.0600387105835734,0.05951664454409,0.0589835979480441,0.0584380443619576,0.0578680528827122,0.057284993469377,0.0566850411993828,0.0560591400429677,0.0554189335152222,0.0547582308786614,0.0540722221713045,0.0533714872508526,0.0526477750661766,0.0519010432689208,0.0511399209281054,0.0503547201422214,0.0495499133125547,0.0487317277559608,0.0478899054777236,0.0470325229812974,0.046163352912548,0.0452725919798901,0.04437050031536,0.0434586827116506,0.0425288839390092,0.0415917848757343,0.0406467001266353,0.0396900241220092,0.03872890041898,0.0377623990589762,0.0367906440207738,0.0358172075949682,0.0348419598682332,0.0338670482880445,0.0328932139343707,0.0319219319928015,0.0309556051419319,0.0299930099680122,0.0290379179573917,0.0280913036428587,0.0271508885328774,0.0262232728584512,0.0253065252070214,0.0243981901774909,0.0235080423581446,0.0226300616013428,0.0217624021840741,0.0209181605516849,0.0200863960749941,0.0192677404017776,0.0184749137679932,0.0176952492668386,0.0169319230029619,0.0161946622940757,0.0154713779918237,0.0147674441106509,0.0140887999492923,0.0134246036610789,0.0127824060458001,0.0121639219228873,0.0115600384076783,0.0109803248890054,0.0104221646309951,0.00987847120743851,0.00936056635332834,0.00886167761478033,0.00837687340403713,0.00791888531253319,0.0074771865429815,0.00704898286850896,0.0066480288153473,0.00626060787877884,0.00588684340144019,0.00553836538276835,0.00520167927495564,0.0048792702139322,0.00457850799519006,0.00428857475061254,0.00401315379025249,0.00375590388456995,0.00350847963134871,0.00327544749497078,0.00305737051892238,0.00284810657825893,0.00265280406058669,0.00246956351546985,0.00229414032236863,0.00213199171524097,0.00197936823537388,0.00183360457655242,0.00170023137601803,0.00157421218237956,0.00145414973069362,0.00134545528964854,0.00124229983676385,0.00114451305447938,0.00105649133476235,0.000972775090306221,0.000894170016081548,0.000823180029660531,0.000755818981874398,0.000693204298962471,0.000636433145346712,0.000582692014079021],&#34;fillcolor&#34;:&#34;#737373&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#737373&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#737373&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;HH&#34;,&#34;xaxis&#34;:&#34;x5&#34;,&#34;yaxis&#34;:&#34;y5&#34;},&#34;rug_mpg&#34;:{&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:[21,21,22.8,21.4,18.7,18.1,14.3,24.4,22.8,19.2,17.8,16.4,17.3,15.2,10.4,10.4,14.7,32.4,30.4,33.9,21.5,15.5,15.2,13.3,19.2,27.3,26,30.4,15.8,19.7,15,21.4],&#34;y&#34;:[&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;],&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y11&#34;,&#34;name&#34;:&#34;rug_mpg&#34;,&#34;showlegend&#34;:false},&#34;rug_cyl&#34;:{&#34;type&#34;:&#34;bar&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:null,&#34;y&#34;:null,&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y12&#34;,&#34;name&#34;:&#34;rug_cyl&#34;,&#34;showlegend&#34;:false},&#34;rug_disp&#34;:{&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:[160,160,108,258,360,225,360,146.7,140.8,167.6,167.6,275.8,275.8,275.8,472,460,440,78.7,75.7,71.1,120.1,318,304,350,400,79,120.3,95.1,351,145,301,121],&#34;y&#34;:[&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;],&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y13&#34;,&#34;name&#34;:&#34;rug_disp&#34;,&#34;showlegend&#34;:false},&#34;rug_hp&#34;:{&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:[110,110,93,110,175,105,245,62,95,123,123,180,180,180,205,215,230,66,52,65,97,150,150,245,175,66,91,113,264,175,335,109],&#34;y&#34;:[&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;],&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y14&#34;,&#34;name&#34;:&#34;rug_hp&#34;,&#34;showlegend&#34;:false},&#34;rug_drat&#34;:{&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:[3.9,3.9,3.85,3.08,3.15,2.76,3.21,3.69,3.92,3.92,3.92,3.07,3.07,3.07,2.93,3,3.23,4.08,4.93,4.22,3.7,2.76,3.15,3.73,3.08,4.08,4.43,3.77,4.22,3.62,3.54,4.11],&#34;y&#34;:[&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;],&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x5&#34;,&#34;yaxis&#34;:&#34;y15&#34;,&#34;name&#34;:&#34;rug_drat&#34;,&#34;showlegend&#34;:false}},&#34;layout&#34;:{&#34;xaxis1&#34;:{&#34;domain&#34;:[0,0.1875],&#34;anchor&#34;:&#34;y11&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis2&#34;:{&#34;domain&#34;:[0.2125,0.3875],&#34;anchor&#34;:&#34;y12&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis3&#34;:{&#34;domain&#34;:[0.4125,0.5875],&#34;anchor&#34;:&#34;y13&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis4&#34;:{&#34;domain&#34;:[0.6125,0.7875],&#34;anchor&#34;:&#34;y14&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis5&#34;:{&#34;domain&#34;:[0.8125,1],&#34;anchor&#34;:&#34;y15&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis1&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis2&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis3&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis4&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis5&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis11&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x1&#34;},&#34;yaxis12&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x2&#34;},&#34;yaxis13&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x3&#34;},&#34;yaxis14&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x4&#34;},&#34;yaxis15&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x5&#34;}},&#34;shapes&#34;:{},&#34;shapes_original&#34;:{},&#34;map_curve&#34;:[[5,6,9,14,23],[5,6,9,14,22],[5,6,9,15,21],[1,8,13,17,19],[1,8,12,18,21],[3,7,11,15,19],[3,7,10,16,21],[3,7,10,17,21],[3,7,10,15,21],[3,8,13,17,19],[3,8,12,17,19],[3,8,12,17,20],[4,6,9,15,21],[4,6,9,15,22],[4,6,10,14,21],[4,6,10,15,21],[4,7,11,15,19],[2,8,13,17,20],[2,8,12,18,21],[2,8,12,18,22],[2,8,12,18,20],[2,8,12,16,19],[2,8,12,16,20],[2,8,12,17,19]],&#34;map_trace_2_shape&#34;:[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],&#34;map_type&#34;:[[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;scatter&#34;,&#34;scatter&#34;,&#34;scatter&#34;]],&#34;map_color&#34;:[[&#34;#710500&#34;,&#34;#BDBDBD&#34;,&#34;#BDBDBD&#34;,&#34;#BDBDBD&#34;,&#34;#737373&#34;],[&#34;#710500&#34;,&#34;#BDBDBD&#34;,&#34;#BDBDBD&#34;,&#34;#BDBDBD&#34;,&#34;#252525&#34;],[&#34;#710500&#34;,&#34;#BDBDBD&#34;,&#34;#BDBDBD&#34;,&#34;#525252&#34;,&#34;#969696&#34;],[&#34;#FF0065&#34;,&#34;#969696&#34;,&#34;#737373&#34;,&#34;#252525&#34;,&#34;#BDBDBD&#34;],[&#34;#FF0065&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#737373&#34;,&#34;#969696&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;#969696&#34;,&#34;#525252&#34;,&#34;#BDBDBD&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;#525252&#34;,&#34;#969696&#34;,&#34;#969696&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;#525252&#34;,&#34;#252525&#34;,&#34;#969696&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;#525252&#34;,&#34;#525252&#34;,&#34;#969696&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;#737373&#34;,&#34;#252525&#34;,&#34;#BDBDBD&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#252525&#34;,&#34;#BDBDBD&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#252525&#34;,&#34;#525252&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;#BDBDBD&#34;,&#34;#525252&#34;,&#34;#969696&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;#BDBDBD&#34;,&#34;#525252&#34;,&#34;#252525&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;#525252&#34;,&#34;#BDBDBD&#34;,&#34;#969696&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;#525252&#34;,&#34;#525252&#34;,&#34;#969696&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;#969696&#34;,&#34;#525252&#34;,&#34;#BDBDBD&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;#737373&#34;,&#34;#252525&#34;,&#34;#525252&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#737373&#34;,&#34;#969696&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#737373&#34;,&#34;#252525&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#737373&#34;,&#34;#525252&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#969696&#34;,&#34;#BDBDBD&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#969696&#34;,&#34;#525252&#34;],[&#34;#009850&#34;,&#34;#969696&#34;,&#34;#252525&#34;,&#34;#252525&#34;,&#34;#BDBDBD&#34;]],&#34;parcats_cols&#34;:[&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;],&#34;imp&#34;:false},&#34;evals&#34;:[],&#34;jsHooks&#34;:[]}&lt;/script&gt;
&lt;/div&gt;
&lt;div id=&#34;parcats-from-model-response-alluvial&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Parcats from model response alluvial&lt;/h3&gt;
&lt;p&gt;Machine Learning models operate in a multidimensional space and their response is hard to visualise. Model response and partial dependency plots attempt to visualise ML models in a two dimensional space. Using alluvial plots or parrallel categories diagrams we can increase the number of dimensions.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/page/visualising-model-response-with-easyalluvial/&#34;&gt;Visualise model response with alluvial plots&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here we see the response of a random forest model if we vary the three variables with the highest importance while keeping all other features at their median/mode value.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df = select(mtcars2, -ids )
m = randomForest::randomForest( disp ~ ., df)
imp = m$importance
dspace = get_data_space(df, imp, degree = 3)
pred = predict(m, newdata = dspace)
p = alluvial_model_response(pred, dspace, imp, degree = 3)
parcats(p, marginal_histograms = TRUE, imp = TRUE, data_input = df)&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;htmlwidget-2&#34; style=&#34;width:960px;height:672px;&#34; class=&#34;parcats html-widget&#34;&gt;&lt;/div&gt;
&lt;script type=&#34;application/json&#34; data-for=&#34;htmlwidget-2&#34;&gt;{&#34;x&#34;:{&#34;traces&#34;:{&#34;parcats&#34;:{&#34;type&#34;:&#34;parcats&#34;,&#34;dimensions&#34;:[{&#34;label&#34;:&#34;pred&#34;,&#34;values&#34;:[&#34;HH\n(303,351]&#34;,&#34;HH\n(303,351]&#34;,&#34;HH\n(303,351]&#34;,&#34;HH\n(303,351]&#34;,&#34;HH\n(303,351]&#34;,&#34;HH\n(303,351]&#34;,&#34;HH\n(303,351]&#34;,&#34;LL\n(139,176]&#34;,&#34;LL\n(139,176]&#34;,&#34;LL\n(139,176]&#34;,&#34;LL\n(139,176]&#34;,&#34;LL\n(139,176]&#34;,&#34;LL\n(139,176]&#34;,&#34;LL\n(139,176]&#34;,&#34;LL\n(139,176]&#34;,&#34;LL\n(139,176]&#34;,&#34;LL\n(139,176]&#34;,&#34;M\n(213,252]&#34;,&#34;M\n(213,252]&#34;,&#34;M\n(213,252]&#34;,&#34;M\n(213,252]&#34;,&#34;M\n(213,252]&#34;,&#34;M\n(213,252]&#34;,&#34;M\n(213,252]&#34;,&#34;M\n(213,252]&#34;,&#34;M\n(213,252]&#34;,&#34;M\n(213,252]&#34;,&#34;M\n(213,252]&#34;,&#34;M\n(213,252]&#34;,&#34;M\n(213,252]&#34;,&#34;M\n(213,252]&#34;,&#34;M\n(213,252]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;MH\n(252,303]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;,&#34;ML\n(176,213]&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;HH\n(303,351]&#34;,&#34;MH\n(252,303]&#34;,&#34;M\n(213,252]&#34;,&#34;ML\n(176,213]&#34;,&#34;LL\n(139,176]&#34;]},{&#34;label&#34;:&#34;cyl&#34;,&#34;values&#34;:[&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;8&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;4&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;,&#34;6&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;8&#34;,&#34;6&#34;,&#34;4&#34;]},{&#34;label&#34;:&#34;mpg&#34;,&#34;values&#34;:[&#34;10.4&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;19.45&#34;,&#34;19.45&#34;,&#34;19.45&#34;,&#34;19.45&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;19.45&#34;,&#34;19.45&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;19.45&#34;,&#34;19.45&#34;,&#34;19.45&#34;,&#34;19.45&#34;,&#34;19.45&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;19.45&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;19.45&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;10.4&#34;,&#34;10.4&#34;,&#34;14.7&#34;,&#34;14.7&#34;,&#34;19.45&#34;,&#34;19.45&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;30.4&#34;,&#34;33.9&#34;,&#34;33.9&#34;,&#34;33.9&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;33.9&#34;,&#34;30.4&#34;,&#34;19.45&#34;,&#34;14.7&#34;,&#34;10.4&#34;]},{&#34;label&#34;:&#34;wt&#34;,&#34;values&#34;:[&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.424&#34;,&#34;5.3&#34;,&#34;5.424&#34;,&#34;5.3&#34;,&#34;5.424&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.424&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.424&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;5.3&#34;,&#34;5.424&#34;,&#34;5.3&#34;,&#34;5.424&#34;,&#34;5.3&#34;,&#34;5.424&#34;,&#34;5.3&#34;,&#34;5.424&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.424&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.424&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.424&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.424&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;1.513&#34;,&#34;2.04&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.424&#34;,&#34;3.44&#34;,&#34;5.3&#34;,&#34;5.424&#34;],&#34;categoryorder&#34;:&#34;array&#34;,&#34;categoryarray&#34;:[&#34;5.424&#34;,&#34;5.3&#34;,&#34;3.44&#34;,&#34;2.04&#34;,&#34;1.513&#34;]}],&#34;counts&#34;:[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],&#34;line&#34;:{&#34;shape&#34;:&#34;hspline&#34;,&#34;color&#34;:[&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;]},&#34;hoveron&#34;:&#34;color&#34;,&#34;hoverinfo&#34;:&#34;count+probability&#34;,&#34;labelfont&#34;:{&#34;size&#34;:24,&#34;color&#34;:&#34;black&#34;},&#34;arrangement&#34;:&#34;perpendicular&#34;,&#34;bundlecolors&#34;:true,&#34;sortpaths&#34;:&#34;forward&#34;,&#34;tickfont&#34;:null,&#34;domain&#34;:{&#34;y&#34;:[0,0.7],&#34;x&#34;:[0,0.85]}},&#34;pred_LL\n(139,176]&#34;:{&#34;x&#34;:[81.6145689214148,82.2529056740259,82.8912424266371,83.5295791792482,84.1679159318594,84.8062526844706,85.4445894370817,86.0829261896929,86.721262942304,87.3595996949152,87.9979364475263,88.6362732001375,89.2746099527486,89.9129467053598,90.5512834579709,91.1896202105821,91.8279569631932,92.4662937158044,93.1046304684155,93.7429672210267,94.3813039736378,95.019640726249,95.6579774788601,96.2963142314713,96.9346509840825,97.5729877366936,98.2113244893048,98.8496612419159,99.487997994527,100.126334747138,100.764671499749,101.403008252361,102.041345004972,102.679681757583,103.318018510194,103.956355262805,104.594692015416,105.233028768027,105.871365520639,106.50970227325,107.148039025861,107.786375778472,108.424712531083,109.063049283694,109.701386036305,110.339722788917,110.978059541528,111.616396294139,112.25473304675,112.893069799361,113.531406551972,114.169743304584,114.808080057195,115.446416809806,116.084753562417,116.723090315028,117.361427067639,117.99976382025,118.638100572862,119.276437325473,119.914774078084,120.553110830695,121.191447583306,121.829784335917,122.468121088529,123.10645784114,123.744794593751,124.383131346362,125.021468098973,125.659804851584,126.298141604195,126.936478356807,127.574815109418,128.213151862029,128.85148861464,129.489825367251,130.128162119862,130.766498872474,131.404835625085,132.043172377696,132.681509130307,133.319845882918,133.958182635529,134.59651938814,135.234856140752,135.873192893363,136.511529645974,137.149866398585,137.788203151196,138.426539903807,139.064876656419,139.70321340903,140.341550161641,140.979886914252,141.618223666863,142.256560419474,142.894897172085,143.533233924697,144.171570677308,144.809907429919,145.44824418253,146.086580935141,146.724917687752,147.363254440364,148.001591192975,148.639927945586,149.278264698197,149.916601450808,150.554938203419,151.19327495603,151.831611708642,152.469948461253,153.108285213864,153.746621966475,154.384958719086,155.023295471697,155.661632224308,156.29996897692,156.938305729531,157.576642482142,158.214979234753,158.853315987364,159.491652739975,160.129989492587,160.768326245198,161.406662997809,162.04499975042,162.683336503031,163.321673255642,163.960010008253,164.598346760865,165.236683513476,165.875020266087,166.513357018698,167.151693771309,167.79003052392,168.428367276532,169.066704029143,169.705040781754,170.343377534365,170.981714286976,171.620051039587,172.258387792198,172.89672454481,173.535061297421,174.173398050032,174.811734802643,175.450071555254],&#34;y&#34;:[1.19173246710817e-05,1.3170899629494e-05,1.46056268726439e-05,1.61474159359315e-05,1.77972395675539e-05,1.96634236396363e-05,2.16758771866831e-05,2.3824619358626e-05,2.62281530503849e-05,2.88277891929302e-05,3.15971754834057e-05,3.46622675432542e-05,3.79856037423725e-05,4.15176488459478e-05,4.5387730390313e-05,4.95920763576814e-05,5.40496806420295e-05,5.88876635182043e-05,6.41511150797165e-05,6.971779700963e-05,7.5705482609601e-05,8.22258846684046e-05,8.91044176228279e-05,9.64408564598601e-05,0.000104433511543191,0.000112843247652764,0.000121741868442838,0.000131435796874875,0.000141608496909309,0.000152292861966045,0.000163925473735013,0.00017609952361129,0.000188817810106271,0.000202607745488615,0.000217020727678343,0.000232039185511293,0.000248177117382712,0.000265056817982114,0.000282599123507487,0.000301289874997252,0.000320843940222996,0.000341110637852323,0.000362532957008403,0.000384937559027148,0.000408094529318716,0.000432390391980982,0.00045777841288058,0.000483945026717914,0.000511208887929063,0.000539658269350136,0.00056889591174981,0.000599164540943238,0.000630687560778092,0.000662989311763676,0.0006962329233214,0.000730767234873166,0.00076604955452973,0.000802164980395988,0.000839567269483133,0.000877664536424515,0.000916471171104228,0.00095651424158153,0.000997176928573147,0.00103845524479927,0.00108079008322798,0.00112368721546986,0.00116710226618678,0.00121134369315205,0.00125607002481043,0.00130119833033827,0.00134691641114238,0.00139300448220102,0.0014393643959108,0.00148608153298811,0.00153301844656801,0.00158008817245702,0.0016272970952398,0.00167454550684739,0.00172178512493706,0.00176897015737809,0.00181599261869541,0.0018628691648081,0.00190952983210882,0.0019558153123204,0.00200182965316103,0.00204750544599796,0.00209259659271128,0.00213731059849973,0.00218160553378692,0.00222512505990213,0.00226818743019235,0.00231078951556584,0.00235246746440805,0.00239363652673704,0.00243429921819626,0.00247403092580526,0.00251319281117876,0.00255183848501504,0.0025896103985799,0.002626791202046,0.00266348444896741,0.00269941765759424,0.00273478850524315,0.00276973910062657,0.00280408905541825,0.00283796340024823,0.00287152138804695,0.00290467050895716,0.00293749343840632,0.00297013624945495,0.00300257951689379,0.00303490934049265,0.00306722135247322,0.00309954539426422,0.00313202825493318,0.0031646736667499,0.00319753023537056,0.00323086891801012,0.00326455922249121,0.00329863428760961,0.00333355275414711,0.0033690104221246,0.00340501549831618,0.00344219579702893,0.00348011601303015,0.00351875800046489,0.00355879685328802,0.00359980925747621,0.00364169472155099,0.00368512754806909,0.003729759939106,0.00377538423740734,0.0038226297895458,0.00387127563547914,0.00392099176531246,0.0039723257929905,0.00402521719548388,0.00407921051435294,0.00413474515651229,0.00419193263550937,0.00425020273100638,0.00430987263249774,0.00437121276354222,0.00443356340138876,0.00449711924726926,0.00456227081189192,0.00462830851177017,0.00469531834095238],&#34;fillcolor&#34;:&#34;#FF0065&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#FF0065&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#FF0065&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;LL\n(139,176]&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;pred_ML\n(176,213]&#34;:{&#34;x&#34;:[176.088408307865,176.726745060477,177.365081813088,178.003418565699,178.64175531831,179.280092070921,179.918428823532,180.556765576143,181.195102328755,181.833439081366,182.471775833977,183.110112586588,183.748449339199,184.38678609181,185.025122844421,185.663459597033,186.301796349644,186.940133102255,187.578469854866,188.216806607477,188.855143360088,189.4934801127,190.131816865311,190.770153617922,191.408490370533,192.046827123144,192.685163875755,193.323500628366,193.961837380978,194.600174133589,195.2385108862,195.876847638811,196.515184391422,197.153521144033,197.791857896645,198.430194649256,199.068531401867,199.706868154478,200.345204907089,200.9835416597,201.621878412311,202.260215164923,202.898551917534,203.536888670145,204.175225422756,204.813562175367,205.451898927978,206.09023568059,206.728572433201,207.366909185812,208.005245938423,208.643582691034,209.281919443645,209.920256196256,210.558592948868,211.196929701479,211.83526645409,212.473603206701],&#34;y&#34;:[0.00476374725985302,0.0048328886555746,0.00490274697901242,0.00497373990384156,0.0050452276521922,0.00511719934500243,0.00518985812394954,0.00526278474777891,0.00533593914108588,0.00540929923614304,0.00548263793296248,0.00555592165317185,0.00562894383885156,0.00570158496690676,0.00577387246599623,0.00584546619146073,0.00591625787201588,0.00598639288499073,0.00605545493229404,0.00612324599182656,0.0061900848048487,0.00625553889019684,0.00631922222243246,0.00638167680485577,0.00644251240400398,0.00650106677232676,0.00655814579326509,0.00661345447398132,0.00666598281120759,0.00671682862726879,0.00676583625847315,0.00681159866096971,0.00685551853251205,0.00689758954000823,0.00693605177290115,0.00697254184099864,0.00700707931813954,0.00703805061446137,0.00706681154063699,0.00709357219330713,0.00711691172265117,0.00713785534000837,0.00715680743069274,0.00717257050866431,0.00718581732909631,0.00719713568345698,0.00720556583642815,0.00721143376977634,0.00721548618000929,0.00721699984449009,0.00721598497341926,0.00721331097276836,0.00720847582700498,0.00720122650736389,0.00719250989163817,0.007182018129139,0.00716930401527211,0.00715534078361935],&#34;fillcolor&#34;:&#34;#009850&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#009850&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#009850&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;ML\n(176,213]&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;pred_M\n(213,252]&#34;:{&#34;x&#34;:[213.111939959312,213.750276711923,214.388613464535,215.026950217146,215.665286969757,216.303623722368,216.941960474979,217.58029722759,218.218633980201,218.856970732813,219.495307485424,220.133644238035,220.771980990646,221.410317743257,222.048654495868,222.686991248479,223.325328001091,223.963664753702,224.602001506313,225.240338258924,225.878675011535,226.517011764146,227.155348516758,227.793685269369,228.43202202198,229.070358774591,229.708695527202,230.347032279813,230.985369032424,231.623705785036,232.262042537647,232.900379290258,233.538716042869,234.17705279548,234.815389548091,235.453726300703,236.092063053314,236.730399805925,237.368736558536,238.007073311147,238.645410063758,239.283746816369,239.922083568981,240.560420321592,241.198757074203,241.837093826814,242.475430579425,243.113767332036,243.752104084647,244.390440837259,245.02877758987,245.667114342481,246.305451095092,246.943787847703,247.582124600314,248.220461352926,248.858798105537,249.497134858148,250.135471610759,250.77380836337,251.412145115981,252.050481868592],&#34;y&#34;:[0.00713997885424551,0.00712265665605003,0.00710432021170032,0.00708493666031762,0.00706391450939032,0.0070421199911265,0.00701956395348348,0.0069957952469327,0.00697146475706754,0.00694661187452383,0.00692100494940751,0.00689503522100259,0.00686877096679954,0.00684214722120044,0.0068153809545756,0.00678852964485491,0.00676164380296566,0.00673484553552485,0.00670814755215984,0.00668166881668613,0.00665550581030514,0.00662959991542983,0.00660409770714265,0.00657912598171619,0.00655453675931426,0.00653047097137124,0.00650712631319607,0.00648425649384795,0.00646197197458032,0.00644056552575737,0.00641969275300428,0.0063994175884931,0.006380135488179,0.00636141297493777,0.00634326007322972,0.00632616657075724,0.00630962706573959,0.00629364040600195,0.00627864202011066,0.0062642045410574,0.00625028319152233,0.0062372198641007,0.00622469873374473,0.00621263063017898,0.00620126110313959,0.00619037691923979,0.00617985953405619,0.00616986321424802,0.00616025547223492,0.00615090885707847,0.00614189822179248,0.00613313936804409,0.00612452056957501,0.00611605472532189,0.0061076654390778,0.00609928408406216,0.00609088329488184,0.00608234877453118,0.00607368358654754,0.00606484454750469,0.00605563151842917,0.00604614746162653],&#34;fillcolor&#34;:&#34;#A56F2B&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#A56F2B&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#A56F2B&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;M\n(213,252]&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;pred_MH\n(252,303]&#34;:{&#34;x&#34;:[252.688818621204,253.327155373815,253.965492126426,254.603828879037,255.242165631648,255.880502384259,256.518839136871,257.157175889482,257.795512642093,258.433849394704,259.072186147315,259.710522899926,260.348859652537,260.987196405149,261.62553315776,262.263869910371,262.902206662982,263.540543415593,264.178880168204,264.817216920816,265.455553673427,266.093890426038,266.732227178649,267.37056393126,268.008900683871,268.647237436482,269.285574189094,269.923910941705,270.562247694316,271.200584446927,271.838921199538,272.477257952149,273.11559470476,273.753931457372,274.392268209983,275.030604962594,275.668941715205,276.307278467816,276.945615220427,277.583951973039,278.22228872565,278.860625478261,279.498962230872,280.137298983483,280.775635736094,281.413972488705,282.052309241317,282.690645993928,283.328982746539,283.96731949915,284.605656251761,285.243993004372,285.882329756984,286.520666509595,287.159003262206,287.797340014817,288.435676767428,289.074013520039,289.71235027265,290.350687025262,290.989023777873,291.627360530484,292.265697283095,292.904034035706,293.542370788317,294.180707540929,294.81904429354,295.457381046151,296.095717798762,296.734054551373,297.372391303984,298.010728056595,298.649064809207,299.287401561818,299.925738314429,300.56407506704,301.202411819651,301.840748572262,302.479085324873],&#34;y&#34;:[0.00603635902860386,0.00602593310803514,0.00601509876819666,0.00600384995141894,0.00599170074711699,0.00597900547508771,0.00596576656049348,0.00595145867925071,0.00593642895512381,0.00592073864412362,0.00590385466546496,0.00588606910947777,0.00586752205823773,0.00584770201782907,0.00582680448606348,0.00580506378460346,0.00578201561928654,0.00575772588258701,0.00573253299162369,0.00570604057383869,0.00567816218338489,0.00564934396914695,0.00561927246451281,0.00558769754753863,0.00555517020260854,0.00552146861780622,0.00548617950793594,0.0054499493102609,0.00541265024035503,0.00537371801271475,0.00533387903890938,0.00529309576047166,0.00525067589626338,0.00520740495388137,0.00516328590855993,0.00511765166607742,0.00507120083040586,0.00502397770539361,0.00497545580374213,0.00492614303000073,0.00487614981266715,0.00482508198551032,0.00477328031411686,0.00472090297530234,0.00466767472627155,0.00461380060858543,0.00455946526899413,0.00450449494794773,0.00444899619767285,0.00439315705529974,0.00433688488598023,0.00428022871437011,0.00422335617428958,0.00416623359672252,0.00410889512571567,0.00405146450597014,0.0039939441360226,0.00393639570966749,0.00387887682153841,0.00382140326435508,0.00376410480115362,0.00370695262405517,0.00364995431144318,0.00359334486261134,0.00353699145679293,0.00348089875351037,0.00342536421720029,0.00337021194358913,0.00331542082409385,0.00326131857634029,0.00320773462371547,0.00315460218456322,0.00310225630142636,0.00305056845825168,0.00299941142944316,0.00294910716738925,0.00289960072123828,0.00285069265336939,0.00280267425017431],&#34;fillcolor&#34;:&#34;#005EAA&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#005EAA&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#005EAA&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;MH\n(252,303]&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;pred_HH\n(303,351]&#34;:{&#34;x&#34;:[303.117422077485,303.755758830096,304.394095582707,305.032432335318,305.670769087929,306.30910584054,306.947442593152,307.585779345763,308.224116098374,308.862452850985,309.500789603596,310.139126356207,310.777463108818,311.41579986143,312.054136614041,312.692473366652,313.330810119263,313.969146871874,314.607483624485,315.245820377097,315.884157129708,316.522493882319,317.16083063493,317.799167387541,318.437504140152,319.075840892763,319.714177645375,320.352514397986,320.990851150597,321.629187903208,322.267524655819,322.90586140843,323.544198161042,324.182534913653,324.820871666264,325.459208418875,326.097545171486,326.735881924097,327.374218676708,328.01255542932,328.650892181931,329.289228934542,329.927565687153,330.565902439764,331.204239192375,331.842575944986,332.480912697598,333.119249450209,333.75758620282,334.395922955431,335.034259708042,335.672596460653,336.310933213265,336.949269965876,337.587606718487,338.225943471098,338.864280223709,339.50261697632,340.140953728931,340.779290481543,341.417627234154,342.055963986765,342.694300739376,343.332637491987,343.970974244598,344.60931099721,345.247647749821,345.885984502432,346.524321255043,347.162658007654,347.800994760265,348.439331512876,349.077668265488,349.716005018099,350.35434177071,350.992678523321,351.631015275932,352.269352028543,352.907688781155,353.546025533766,354.184362286377,354.822699038988,355.461035791599,356.09937254421,356.737709296821,357.376046049433,358.014382802044,358.652719554655,359.291056307266,359.929393059877,360.567729812488,361.2060665651,361.844403317711,362.482740070322,363.121076822933,363.759413575544,364.397750328155,365.036087080766,365.674423833378,366.312760585989,366.9510973386,367.589434091211,368.227770843822,368.866107596433,369.504444349045,370.142781101656,370.781117854267,371.419454606878,372.057791359489,372.6961281121,373.334464864711,373.972801617323,374.611138369934,375.249475122545,375.887811875156,376.526148627767,377.164485380378,377.802822132989,378.441158885601,379.079495638212,379.717832390823,380.356169143434,380.994505896045,381.632842648656,382.271179401268,382.909516153879,383.54785290649,384.186189659101,384.824526411712,385.462863164323,386.101199916934,386.739536669546,387.377873422157,388.016210174768,388.654546927379,389.29288367999,389.931220432601,390.569557185213,391.207893937824,391.846230690435,392.484567443046,393.122904195657,393.761240948268,394.399577700879,395.037914453491,395.676251206102,396.314587958713,396.952924711324,397.591261463935,398.229598216546,398.867934969158,399.506271721769,400.14460847438,400.782945226991,401.421281979602,402.059618732213,402.697955484824,403.336292237436,403.974628990047,404.612965742658,405.251302495269,405.88963924788,406.527976000491,407.166312753103,407.804649505714],&#34;y&#34;:[0.0027555898548349,0.00270915922333216,0.00266362845058428,0.00261916077339421,0.00257538980776692,0.00253250510412315,0.00249080205768944,0.00244982610150615,0.00240970212077054,0.0023708644969256,0.00233277172465503,0.00229547915700892,0.00225956051773177,0.00222439187800368,0.00218997323587853,0.00215696418424047,0.00212471350285292,0.00209320459409858,0.00206301165104382,0.0020336259052471,0.00200496125427324,0.00197750218156995,0.0019508820408274,0.00192495007104672,0.00190010008066714,0.00187610088707459,0.00185274505932255,0.00183033809936434,0.00180877152123898,0.00178779221804655,0.00176762301855277,0.00174825964230572,0.00172941706593654,0.00171124417742373,0.00169381729727471,0.00167683563208625,0.0016603856614145,0.00164459647950585,0.0016291695100692,0.00161414269528786,0.00159966705717065,0.00158546533517845,0.00157154250678412,0.00155803917539504,0.00154471869858549,0.00153157697758984,0.00151868988351068,0.00150590210121105,0.00149320225607271,0.00148059330793876,0.00146799611625029,0.00145539948678034,0.00144275326813093,0.00143002252050073,0.00141721155602109,0.00140423686616892,0.00139107781864828,0.00137776740077862,0.0013642073145607,0.00135036536314485,0.00133631323557142,0.00132195413641503,0.00130722419567058,0.00129223985789374,0.00127691889859198,0.00126115281978383,0.00124510430726058,0.00122871482616271,0.00121182635663695,0.00119464444778224,0.0011771389830247,0.00115910591821383,0.0011407854693523,0.00112217616064245,0.00110303952244352,0.00108363782056798,0.00106397253979982,0.00104385442798525,0.00102348665090624,0.00100289314198203,0.000981941333826689,0.000960773400004106,0.000939429803025979,0.000917831420007072,0.000896070679174351,0.000874193751009432,0.000852167655469887,0.00083005200205899,0.000807885900559152,0.00078567213119051,0.000763458205644105,0.000741262556871566,0.000719111367660962,0.000697062541001888,0.000675100483978491,0.000653261585999681,0.000631636400666454,0.000610163267208225,0.000588875826028268,0.000567917495904251,0.000547170700674395,0.000526654560044201,0.000506582023682935,0.000486772621537305,0.000467228492473444,0.000448222000256035,0.00042952822649381,0.000411141287872489,0.00039332852172939,0.000375891479240089,0.000358792497341645,0.000342281279066509,0.000326202787488505,0.000310482986534048,0.000295344240940846,0.000280686728206728,0.000266398214898698,0.000252667052723917,0.000239455257734292,0.000226613176330379,0.000214291406406113,0.000202515579032319,0.000191101665053322,0.000180161428457496,0.000169781662426629,0.000159748821811402,0.000150137015743662,0.000141088330961253,0.000132365861255832,0.000124009020574921,0.000116206821220216,0.000108705908680159,0.000101515234867055,9.48608032783106e-05,8.84799692401448e-05,8.23714463250366e-05,7.67419730852142e-05,7.13721982474355e-05,6.62455881954508e-05,6.15244986386014e-05,5.70538183004158e-05,5.27969924913877e-05,4.88777891043382e-05,4.51952195998061e-05,4.16979843901942e-05,3.84772464107743e-05,3.54759674617796e-05,3.26330349631392e-05,3.00128373453053e-05,2.75926125511954e-05,2.53058131432066e-05,2.31954799265952e-05,2.12643451883344e-05,1.94441232062264e-05,1.7761363789136e-05,1.62366495766764e-05,1.48029162806468e-05,1.34744172235949e-05,1.22831949224016e-05,1.11656338506404e-05,1.01271933964958e-05,9.20624921584261e-06,8.34417929873895e-06,7.54047778765538e-06,6.83592132578275e-06],&#34;fillcolor&#34;:&#34;#710500&#34;,&#34;fill&#34;:&#34;tozeroy&#34;,&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;#710500&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;#710500&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;HH\n(303,351]&#34;,&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y1&#34;},&#34;cyl_4\nHH: 0\nMH: 0.2\nM: 0.27\nML: 0.48\nLL: 0.6&#34;:{&#34;x&#34;:[&#34;4&#34;],&#34;y&#34;:[11],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;#BDBDBD&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;cyl_4\nHH: 0\nMH: 0.2\nM: 0.27\nML: 0.48\nLL: 0.6&#34;,&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y2&#34;},&#34;cyl_6\nHH: 0\nMH: 0.2\nM: 0.33\nML: 0.52\nLL: 0.4&#34;:{&#34;x&#34;:[&#34;6&#34;],&#34;y&#34;:[7],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;#525252&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;cyl_6\nHH: 0\nMH: 0.2\nM: 0.33\nML: 0.52\nLL: 0.4&#34;,&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y2&#34;},&#34;cyl_8\nHH: 1\nMH: 0.6\nM: 0.4\nML: 0\nLL: 0&#34;:{&#34;x&#34;:[&#34;8&#34;],&#34;y&#34;:[14],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;#969696&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;cyl_8\nHH: 1\nMH: 0.6\nM: 0.4\nML: 0\nLL: 0&#34;,&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y2&#34;},&#34;mpg_dens&#34;:{&#34;x&#34;:[2.96996268656716,3.04503132575868,3.1200999649502,3.19516860414172,3.27023724333324,3.34530588252475,3.42037452171627,3.49544316090779,3.57051180009931,3.64558043929083,3.72064907848234,3.79571771767386,3.87078635686538,3.9458549960569,4.02092363524842,4.09599227443993,4.17106091363145,4.24612955282297,4.32119819201449,4.396266831206,4.47133547039752,4.54640410958904,4.62147274878056,4.69654138797208,4.77161002716359,4.84667866635511,4.92174730554663,4.99681594473815,5.07188458392967,5.14695322312118,5.2220218623127,5.29709050150422,5.37215914069574,5.44722777988726,5.52229641907877,5.59736505827029,5.67243369746181,5.74750233665333,5.82257097584485,5.89763961503636,5.97270825422788,6.0477768934194,6.12284553261092,6.19791417180244,6.27298281099395,6.34805145018547,6.42312008937699,6.49818872856851,6.57325736776003,6.64832600695154,6.72339464614306,6.79846328533458,6.8735319245261,6.94860056371762,7.02366920290913,7.09873784210065,7.17380648129217,7.24887512048369,7.3239437596752,7.39901239886672,7.47408103805824,7.54914967724976,7.62421831644128,7.69928695563279,7.77435559482431,7.84942423401583,7.92449287320735,7.99956151239887,8.07463015159038,8.1496987907819,8.22476742997342,8.29983606916494,8.37490470835646,8.44997334754797,8.52504198673949,8.60011062593101,8.67517926512253,8.75024790431405,8.82531654350556,8.90038518269708,8.9754538218886,9.05052246108012,9.12559110027163,9.20065973946315,9.27572837865467,9.35079701784619,9.42586565703771,9.50093429622923,9.57600293542074,9.65107157461226,9.72614021380378,9.8012088529953,9.87627749218682,9.95134613137833,10.0264147705699,10.1014834097614,10.1765520489529,10.2516206881444,10.3266893273359,10.4017579665274,10.476826605719,10.5518952449105,10.626963884102,10.7020325232935,10.777101162485,10.8521698016765,10.9272384408681,11.0023070800596,11.0773757192511,11.1524443584426,11.2275129976341,11.3025816368257,11.3776502760172,11.4527189152087,11.5277875544002,11.6028561935917,11.6779248327832,11.7529934719748,11.8280621111663,11.9031307503578,11.9781993895493,12.0532680287408,12.1283366679324,12.2034053071239,12.2784739463154,12.3535425855069,12.4286112246984,12.5036798638899,12.5787485030815,12.653817142273,12.7288857814645,12.803954420656,12.8790230598475,12.9540916990391,13.0291603382306,13.1042289774221,13.1792976166136,13.2543662558051,13.3294348949966,13.4045035341882,13.4795721733797,13.5546408125712,13.6297094517627,13.7047780909542,13.7798467301457,13.8549153693373,13.9299840085288,14.0050526477203,14.0801212869118,14.1551899261033,14.2302585652949,14.3053272044864,14.3803958436779,14.4554644828694,14.5305331220609,14.6056017612524,14.680670400444,14.7557390396355,14.830807678827,14.9058763180185,14.98094495721,15.0560135964016,15.1310822355931,15.2061508747846,15.2812195139761,15.3562881531676,15.4313567923591,15.5064254315507,15.5814940707422,15.6565627099337,15.7316313491252,15.8066999883167,15.8817686275083,15.9568372666998,16.0319059058913,16.1069745450828,16.1820431842743,16.2571118234658,16.3321804626574,16.4072491018489,16.4823177410404,16.5573863802319,16.6324550194234,16.7075236586149,16.7825922978065,16.857660936998,16.9327295761895,17.007798215381,17.0828668545725,17.1579354937641,17.2330041329556,17.3080727721471,17.3831414113386,17.4582100505301,17.5332786897216,17.6083473289132,17.6834159681047,17.7584846072962,17.8335532464877,17.9086218856792,17.9836905248708,18.0587591640623,18.1338278032538,18.2088964424453,18.2839650816368,18.3590337208283,18.4341023600199,18.5091709992114,18.5842396384029,18.6593082775944,18.7343769167859,18.8094455559775,18.884514195169,18.9595828343605,19.034651473552,19.1097201127435,19.184788751935,19.2598573911266,19.3349260303181,19.4099946695096,19.4850633087011,19.5601319478926,19.6352005870841,19.7102692262757,19.7853378654672,19.8604065046587,19.9354751438502,20.0105437830417,20.0856124222333,20.1606810614248,20.2357497006163,20.3108183398078,20.3858869789993,20.4609556181908,20.5360242573824,20.6110928965739,20.6861615357654,20.7612301749569,20.8362988141484,20.91136745334,20.9864360925315,21.061504731723,21.1365733709145,21.211642010106,21.2867106492975,21.3617792884891,21.4368479276806,21.5119165668721,21.5869852060636,21.6620538452551,21.7371224844467,21.8121911236382,21.8872597628297,21.9623284020212,22.0373970412127,22.1124656804042,22.1875343195958,22.2626029587873,22.3376715979788,22.4127402371703,22.4878088763618,22.5628775155533,22.6379461547449,22.7130147939364,22.7880834331279,22.8631520723194,22.9382207115109,23.0132893507025,23.088357989894,23.1634266290855,23.238495268277,23.3135639074685,23.38863254666,23.4637011858516,23.5387698250431,23.6138384642346,23.6889071034261,23.7639757426176,23.8390443818092,23.9141130210007,23.9891816601922,24.0642502993837,24.1393189385752,24.2143875777667,24.2894562169583,24.3645248561498,24.4395934953413,24.5146621345328,24.5897307737243,24.6647994129159,24.7398680521074,24.8149366912989,24.8900053304904,24.9650739696819,25.0401426088734,25.115211248065,25.1902798872565,25.265348526448,25.3404171656395,25.415485804831,25.4905544440225,25.5656230832141,25.6406917224056,25.7157603615971,25.7908290007886,25.8658976399801,25.9409662791717,26.0160349183632,26.0911035575547,26.1661721967462,26.2412408359377,26.3163094751292,26.3913781143208,26.4664467535123,26.5415153927038,26.6165840318953,26.6916526710868,26.7667213102784,26.8417899494699,26.9168585886614,26.9919272278529,27.0669958670444,27.1420645062359,27.2171331454275,27.292201784619,27.3672704238105,27.442339063002,27.5174077021935,27.5924763413851,27.6675449805766,27.7426136197681,27.8176822589596,27.8927508981511,27.9678195373426,28.0428881765342,28.1179568157257,28.1930254549172,28.2680940941087,28.3431627333002,28.4182313724917,28.4933000116833,28.5683686508748,28.6434372900663,28.7185059292578,28.7935745684493,28.8686432076409,28.9437118468324,29.0187804860239,29.0938491252154,29.1689177644069,29.2439864035984,29.31905504279,29.3941236819815,29.469192321173,29.5442609603645,29.619329599556,29.6943982387476,29.7694668779391,29.8445355171306,29.9196041563221,29.9946727955136,30.0697414347051,30.1448100738967,30.2198787130882,30.2949473522797,30.3700159914712,30.4450846306627,30.5201532698543,30.5952219090458,30.6702905482373,30.7453591874288,30.8204278266203,30.8954964658118,30.9705651050034,31.0456337441949,31.1207023833864,31.1957710225779,31.2708396617694,31.345908300961,31.4209769401525,31.496045579344,31.5711142185355,31.646182857727,31.7212514969185,31.7963201361101,31.8713887753016,31.9464574144931,32.0215260536846,32.0965946928761,32.1716633320676,32.2467319712592,32.3218006104507,32.3968692496422,32.4719378888337,32.5470065280252,32.6220751672167,32.6971438064083,32.7722124455998,32.8472810847913,32.9223497239828,32.9974183631743,33.0724870023659,33.1475556415574,33.2226242807489,33.2976929199404,33.3727615591319,33.4478301983235,33.522898837515,33.5979674767065,33.673036115898,33.7481047550895,33.823173394281,33.8982420334726,33.9733106726641,34.0483793118556,34.1234479510471,34.1985165902386,34.2735852294301,34.3486538686217,34.4237225078132,34.4987911470047,34.5738597861962,34.6489284253877,34.7239970645793,34.7990657037708,34.8741343429623,34.9492029821538,35.0242716213453,35.0993402605368,35.1744088997284,35.2494775389199,35.3245461781114,35.3996148173029,35.4746834564944,35.549752095686,35.6248207348775,35.699889374069,35.7749580132605,35.850026652452,35.9250952916435,36.0001639308351,36.0752325700266,36.1503012092181,36.2253698484096,36.3004384876011,36.3755071267926,36.4505757659842,36.5256444051757,36.6007130443672,36.6757816835587,36.7508503227502,36.8259189619418,36.9009876011333,36.9760562403248,37.0511248795163,37.1261935187078,37.2012621578994,37.2763307970909,37.3513994362824,37.4264680754739,37.5015367146654,37.5766053538569,37.6516739930485,37.72674263224,37.8018112714315,37.876879910623,37.9519485498145,38.027017189006,38.1020858281976,38.1771544673891,38.2522231065806,38.3272917457721,38.4023603849636,38.4774290241552,38.5524976633467,38.6275663025382,38.7026349417297,38.7777035809212,38.8527722201127,38.9278408593043,39.0029094984958,39.0779781376873,39.1530467768788,39.2281154160703,39.3031840552619,39.3782526944534,39.4533213336449,39.5283899728364,39.6034586120279,39.6785272512194,39.753595890411,39.8286645296025,39.903733168794,39.9788018079855,40.053870447177,40.1289390863685,40.2040077255601,40.2790763647516,40.3541450039431,40.4292136431346,40.5042822823261,40.5793509215177,40.6544195607092,40.7294881999007,40.8045568390922,40.8796254782837,40.9546941174752,41.0297627566668,41.1048313958583,41.1799000350498,41.2549686742413,41.3300373134328],&#34;y&#34;:[0.000114229889951918,0.000125273732728626,0.000137050151569663,0.000149514448557863,0.000163548707093741,0.00017842086769883,0.000194189645158505,0.000211800991279835,0.000230417785779494,0.000250186134516725,0.000272091353413302,0.000295190853282914,0.000319748138090844,0.000346753678164109,0.000375163278516302,0.000405392353352029,0.00043839191630835,0.000473025083171863,0.000509897608297056,0.000549865884799234,0.000591714932801751,0.000636282193585794,0.000684264269333187,0.00073438873123137,0.000787767533919762,0.000844863679659825,0.000904374032794606,0.000967727509301853,0.00103507332727553,0.00110511011541999,0.00117962360481525,0.00125836582832946,0.00134007455387213,0.00142692713169268,0.00151819575096023,0.0016126982973312,0.00171303097435456,0.00181790876909982,0.00192627252375892,0.00204115460244825,0.00216064557042484,0.00228385182340513,0.00241424734268497,0.00254924588638339,0.00268815944027951,0.0028348960102069,0.00298615903981131,0.00314150124168559,0.00330524381785147,0.00347336810328754,0.00364580684975305,0.00382692787661865,0.00401233499398705,0.00420243406989608,0.00440104244661222,0.00460397348017972,0.00481193213809767,0.00502813429726787,0.00524865605531255,0.00547449396545618,0.00570823503504366,0.00594625891078352,0.00618984036323931,0.0064409330600869,0.00669624683271584,0.00695731896374735,0.00722548499335452,0.0074977968566662,0.00777604073693687,0.0080609631184595,0.0083499561064188,0.00864504824106554,0.00894643182590742,0.00925182565737347,0.00956350616164292,0.00988114251064116,0.0102027587968439,0.0105309013458707,0.0108647331794483,0.0112025590342439,0.011547236767962,0.0118974165128855,0.0122516609834645,0.0126132019991806,0.012980138623248,0.0133512761133107,0.0137303021027543,0.0141146905339388,0.0145034855963567,0.0149009276537631,0.0153037556724812,0.0157112642465902,0.0161283509199834,0.0165508795035261,0.0169784228663741,0.0174166371255152,0.0178603517797577,0.0183097457170008,0.0187704650058753,0.0192369975629635,0.0197100471319284,0.0201948572574038,0.0206858798277631,0.0211843072095414,0.0216948285594811,0.0222119236444772,0.0227373144896621,0.0232749660742645,0.0238194790893781,0.0243731204029669,0.0249389641095947,0.0255118465438023,0.0260945574178793,0.0266891403556056,0.0272907933140105,0.0279027597420157,0.0285259652044185,0.0291560939853421,0.0297967197565422,0.0304476376619687,0.0311051281846789,0.031772913735407,0.0324497409359108,0.0331325681935215,0.0338250282288393,0.0345250077956126,0.0352301850562352,0.0359438137775108,0.0366632203232897,0.0373867956064091,0.0381170855944091,0.0388512610006622,0.0395883645463794,0.0403298819396755,0.0410733226970109,0.0418182659125721,0.0425647807342156,0.0433112747038546,0.0440576976478669,0.044802364259259,0.0455451712759395,0.0462862140481823,0.0470218113915404,0.0477538790156692,0.0484821446565278,0.0492015875490189,0.0499157906849128,0.0506239262649292,0.0513201951201251,0.0520095863574055,0.0526904982752669,0.0533569422312706,0.0540149987916339,0.0546621137887025,0.0552926856883678,0.0559135388539339,0.0565210415399491,0.0571105049903819,0.0576891388589819,0.0582521716549459,0.0587962683880539,0.0593286766734319,0.059843490489783,0.0603390587366376,0.0608223509644597,0.0612863981530185,0.0617314358410082,0.0621638874833518,0.0625758523747786,0.0629695224225652,0.0633505670227897,0.0637103333927429,0.0640529119557001,0.0643830768624863,0.0646916356526201,0.0649844076024407,0.0652651983007734,0.0655245025638205,0.065769611533718,0.0660033525017636,0.0662161295920915,0.0664163923873938,0.0666060347353955,0.0667755680363576,0.0669342649578231,0.0670831726888495,0.0672130665374253,0.0673337201126039,0.0674451809291316,0.0675393895162468,0.0676255442685601,0.0677028563900642,0.0677651513573859,0.0678201666094758,0.0678667236707489,0.0679002024415557,0.067927068845819,0.0679458272511997,0.0679530984411411,0.0679542870907898,0.0679476158335419,0.0679306780801021,0.067908028835629,0.0678776037870206,0.0678377673350176,0.0677924205679144,0.0677391670424319,0.0676770203348596,0.0676093938007805,0.0675334784000283,0.0674488994872161,0.0673587096352501,0.0672595797145926,0.0671517900375297,0.0670381148572513,0.0669145815719605,0.0667822376920479,0.0666436162842428,0.0664939751479885,0.0663352923518843,0.0661698548433573,0.065992036131299,0.0658049365767762,0.0656105568206685,0.0654022970043372,0.0651845742106906,0.0649590369370421,0.0647180616587153,0.0644675526862324,0.0642087263933387,0.0639329352676019,0.0636476918659782,0.0633536987604394,0.0630413425124595,0.062719792830209,0.0623886523029847,0.0620390086008308,0.0616801017122958,0.061310775372805,0.0609233799319284,0.0605267064243477,0.0601189704145019,0.0596939646610578,0.059259847792459,0.0588142712837906,0.0583525776493199,0.0578821310903507,0.0574001269997778,0.0569034791960782,0.0563986290457527,0.0558824653752783,0.0553534023360636,0.0548168728813581,0.0542696447286468,0.053711469101004,0.0531467335908559,0.0525722979014553,0.0519890017249994,0.0514002011598197,0.0508030781982394,0.0501992400197976,0.0495910745237401,0.0489763217189034,0.0483569807626469,0.047734579415901,0.0471076445821018,0.0464781586448889,0.0458469346254187,0.0452134964837048,0.0445793908845901,0.0439448893387,0.0433106937006642,0.0426775088365751,0.042045255025224,0.0414159549184166,0.0407890997477807,0.0401644546896987,0.039545462105019,0.0389300802121295,0.0383181593967295,0.037714466155406,0.0371153199871162,0.0365210945965443,0.0359369533632598,0.0353583308523981,0.0347860935385033,0.0342253842147137,0.0336710304119423,0.0331244868555602,0.0325905108764094,0.0320635855212454,0.031545816877892,0.0310412744525422,0.0305443347493063,0.030057787047044,0.0295847780056226,0.0291197843524882,0.028666281873045,0.0282263268466158,0.0277946680039127,0.0273754463619757,0.0269695240219589,0.0265720572854393,0.0261878110245049,0.0258164064978562,0.0254535079204524,0.025104447020359,0.0247676064064712,0.0244392260110327,0.0241251357643548,0.0238225219036058,0.0235282391366668,0.0232485383683775,0.0229794836107023,0.0227185589572238,0.0224723524655867,0.0222359050903225,0.0220073247261404,0.0217934470120905,0.0215884090640308,0.0213909205690378,0.0212079692739273,0.0210329247967187,0.020865063177382,0.0207114220325011,0.0205647558862172,0.0204251007903076,0.0202987127239451,0.0201786212615207,0.0200654784143913,0.0199641794396866,0.0198686751947915,0.0197799377776933,0.0197016011868594,0.0196285143249308,0.0195618838759074,0.0195042013494479,0.0194511809141234,0.0194041691260234,0.0193646538117595,0.01932917175265,0.0192991062342418,0.0192751007142036,0.0192544613318477,0.019238498082011,0.0192271894132118,0.0192185462539002,0.0192136908392892,0.0192121341003209,0.0192125155494985,0.0192156540395949,0.0192208049472464,0.0192271488909842,0.0192350885946818,0.0192438448631322,0.0192530419023504,0.019262560971588,0.0192718112574272,0.0192807551535821,0.0192886592662957,0.0192953378498803,0.0193009812245984,0.0193041649059721,0.0193053097587176,0.0193047226142344,0.0193002323501242,0.019293043960149,0.0192834723593199,0.019268568517333,0.0192504667992848,0.0192293890452671,0.0192016037364312,0.019170280518466,0.0191352281816972,0.0190926467342532,0.0190461116592218,0.0189950953848759,0.0189360173935566,0.018872635541656,0.0188040718489362,0.0187271525737499,0.0186456726523495,0.0185583885801243,0.0184626819984024,0.0183622544938361,0.0182555037923272,0.0181404729001704,0.018020658095215,0.017894126427459,0.0177596436269259,0.0176204098177031,0.0174742094727197,0.0173205476462964,0.0171622602198725,0.016996915169023,0.0168247302835838,0.0166481325351633,0.0164645548669329,0.0162748610848089,0.0160810477685971,0.0158805066292131,0.0156746449514097,0.015465029591231,0.0152491137657672,0.0150287152174851,0.0148049921788406,0.0145755674031001,0.0143425117236918,0.0141066139974137,0.0138657760289471,0.0136221467751269,0.0133762003712007,0.0131262247974533,0.0128742617322952,0.0126205375516341,0.0123638272945128,0.0121058769293974,0.011846725517612,0.0115857724810267,0.0113242376672141,0.0110620768721777,0.0107993696564901,0.0105366591816821,0.0102739744907838,0.0100118944893552,0.00975037370864591,0.00948959081453261,0.00923043939368806,0.00897238299450102,0.00871581806430377,0.00846177172974433,0.00820931977552797,0.00795913366641453,0.00771220340271279,0.00746732180057261,0.00722547948185629,0.00698747537078352,0.00675192184869771,0.00652015819970899,0.00629266031015632,0.00606795686162937,0.00584774984356118,0.00563208620357928,0.00541949876135071,0.0052120507134402,0.00500928292989102,0.00480980877368389,0.00461603627213573,0.00442695306964015,0.00424131617124104,0.00406184853398545,0.00388696716212249,0.00371562134508756,0.0035508074929813,0.00339038262240756,0.00323352208714429,0.00308344511102575,0.00293748452954117,0.00279506099149529,0.00265955945207812,0.00252784560310971,0.00239959103413078,0.00227828576162718,0.00216040195857675,0.00204599295442202,0.00193818070664026,0.00183354071983298,0.00173241929341168,0.00163731564290115,0.00154519529769942,0.00145657831258937,0.00137337467713549,0.00129294412164485,0.00121594683573901,0.00114375343214423,0.00107410882417359,0.00100777843441016,0.000945654777335617,0.000885848291185367,0.000829195318860362,0.00077617831308329,0.00072524556209966,0.000677272149737364,0.000632401044393554,0.000589385237987149,0.000549109686833407,0.000511447392680604,0.000475419779431035,0.000441896920012362,0.000410547420533136,0.000380623796161366,0.000352961035157659,0.00032708283536957,0.000302436102284799,0.000279805212672391,0.000258620954894212,0.000238489898469976,0.000220134806074134,0.000202937332227206,0.000186631921280278,0.00017187288344902,0.00015802813497583,0.000144931757035498,0.000133166426187584,0.0001221136448986,0.000111682750933327,0.000102384668940646,9.36343974145132e-05,8.53960585846729e-05,7.81111418713846e-05,7.12415249248712e-05,6.48141936795621e-05],&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;grey&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;grey&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_dens&#34;,&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y3&#34;},&#34;mpg_10.4\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;:{&#34;x0&#34;:10.4,&#34;y0&#34;:0,&#34;x1&#34;:10.4,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_10.4\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_14.7\nHH: 0.29\nMH: 0.35\nM: 0.13\nML: 0.17\nLL: 0&#34;:{&#34;x0&#34;:14.7,&#34;y0&#34;:0,&#34;x1&#34;:14.7,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_14.7\nHH: 0.29\nMH: 0.35\nM: 0.13\nML: 0.17\nLL: 0&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_19.45\nHH: 0.29\nMH: 0.05\nM: 0.47\nML: 0.13\nLL: 0.2&#34;:{&#34;x0&#34;:19.45,&#34;y0&#34;:0,&#34;x1&#34;:19.45,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_19.45\nHH: 0.29\nMH: 0.05\nM: 0.47\nML: 0.13\nLL: 0.2&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_30.4\nHH: 0\nMH: 0.15\nM: 0.13\nML: 0.26\nLL: 0.4&#34;:{&#34;x0&#34;:30.4,&#34;y0&#34;:0,&#34;x1&#34;:30.4,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_30.4\nHH: 0\nMH: 0.15\nM: 0.13\nML: 0.26\nLL: 0.4&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_33.9\nHH: 0\nMH: 0.15\nM: 0.13\nML: 0.26\nLL: 0.4&#34;:{&#34;x0&#34;:33.9,&#34;y0&#34;:0,&#34;x1&#34;:33.9,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_33.9\nHH: 0\nMH: 0.15\nM: 0.13\nML: 0.26\nLL: 0.4&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;wt_dens&#34;:{&#34;x&#34;:[0.47657276119403,0.488282848234366,0.499992935274703,0.511703022315039,0.523413109355376,0.535123196395712,0.546833283436048,0.558543370476385,0.570253457516721,0.581963544557058,0.593673631597394,0.605383718637731,0.617093805678067,0.628803892718404,0.64051397975874,0.652224066799077,0.663934153839413,0.67564424087975,0.687354327920086,0.699064414960423,0.710774502000759,0.722484589041096,0.734194676081432,0.745904763121769,0.757614850162105,0.769324937202442,0.781035024242778,0.792745111283115,0.804455198323451,0.816165285363788,0.827875372404124,0.839585459444461,0.851295546484797,0.863005633525133,0.87471572056547,0.886425807605806,0.898135894646143,0.909845981686479,0.921556068726816,0.933266155767152,0.944976242807489,0.956686329847825,0.968396416888162,0.980106503928498,0.991816590968835,1.00352667800917,1.01523676504951,1.02694685208984,1.03865693913018,1.05036702617052,1.06207711321085,1.07378720025119,1.08549728729153,1.09720737433186,1.1089174613722,1.12062754841254,1.13233763545287,1.14404772249321,1.15575780953355,1.16746789657388,1.17917798361422,1.19088807065455,1.20259815769489,1.21430824473523,1.22601833177556,1.2377284188159,1.24943850585624,1.26114859289657,1.27285867993691,1.28456876697725,1.29627885401758,1.30798894105792,1.31969902809826,1.33140911513859,1.34311920217893,1.35482928921927,1.3665393762596,1.37824946329994,1.38995955034027,1.40166963738061,1.41337972442095,1.42508981146128,1.43679989850162,1.44850998554196,1.46022007258229,1.47193015962263,1.48364024666297,1.4953503337033,1.50706042074364,1.51877050778398,1.53048059482431,1.54219068186465,1.55390076890499,1.56561085594532,1.57732094298566,1.589031030026,1.60074111706633,1.61245120410667,1.624161291147,1.63587137818734,1.64758146522768,1.65929155226801,1.67100163930835,1.68271172634869,1.69442181338902,1.70613190042936,1.7178419874697,1.72955207451003,1.74126216155037,1.75297224859071,1.76468233563104,1.77639242267138,1.78810250971172,1.79981259675205,1.81152268379239,1.82323277083272,1.83494285787306,1.8466529449134,1.85836303195373,1.87007311899407,1.88178320603441,1.89349329307474,1.90520338011508,1.91691346715542,1.92862355419575,1.94033364123609,1.95204372827643,1.96375381531676,1.9754639023571,1.98717398939744,1.99888407643777,2.01059416347811,2.02230425051845,2.03401433755878,2.04572442459912,2.05743451163945,2.06914459867979,2.08085468572013,2.09256477276046,2.1042748598008,2.11598494684114,2.12769503388147,2.13940512092181,2.15111520796215,2.16282529500248,2.17453538204282,2.18624546908316,2.19795555612349,2.20966564316383,2.22137573020416,2.2330858172445,2.24479590428484,2.25650599132517,2.26821607836551,2.27992616540585,2.29163625244618,2.30334633948652,2.31505642652686,2.32676651356719,2.33847660060753,2.35018668764787,2.3618967746882,2.37360686172854,2.38531694876888,2.39702703580921,2.40873712284955,2.42044720988989,2.43215729693022,2.44386738397056,2.45557747101089,2.46728755805123,2.47899764509157,2.4907077321319,2.50241781917224,2.51412790621258,2.52583799325291,2.53754808029325,2.54925816733359,2.56096825437392,2.57267834141426,2.5843884284546,2.59609851549493,2.60780860253527,2.61951868957561,2.63122877661594,2.64293886365628,2.65464895069661,2.66635903773695,2.67806912477729,2.68977921181762,2.70148929885796,2.7131993858983,2.72490947293863,2.73661955997897,2.74832964701931,2.76003973405964,2.77174982109998,2.78345990814032,2.79516999518065,2.80688008222099,2.81859016926133,2.83030025630166,2.842010343342,2.85372043038234,2.86543051742267,2.87714060446301,2.88885069150334,2.90056077854368,2.91227086558402,2.92398095262435,2.93569103966469,2.94740112670503,2.95911121374536,2.9708213007857,2.98253138782604,2.99424147486637,3.00595156190671,3.01766164894705,3.02937173598738,3.04108182302772,3.05279191006806,3.06450199710839,3.07621208414873,3.08792217118906,3.0996322582294,3.11134234526974,3.12305243231007,3.13476251935041,3.14647260639075,3.15818269343108,3.16989278047142,3.18160286751176,3.19331295455209,3.20502304159243,3.21673312863277,3.2284432156731,3.24015330271344,3.25186338975378,3.26357347679411,3.27528356383445,3.28699365087478,3.29870373791512,3.31041382495546,3.32212391199579,3.33383399903613,3.34554408607647,3.3572541731168,3.36896426015714,3.38067434719748,3.39238443423781,3.40409452127815,3.41580460831849,3.42751469535882,3.43922478239916,3.4509348694395,3.46264495647983,3.47435504352017,3.48606513056051,3.49777521760084,3.50948530464118,3.52119539168151,3.53290547872185,3.54461556576219,3.55632565280252,3.56803573984286,3.5797458268832,3.59145591392353,3.60316600096387,3.61487608800421,3.62658617504454,3.63829626208488,3.65000634912522,3.66171643616555,3.67342652320589,3.68513661024623,3.69684669728656,3.7085567843269,3.72026687136723,3.73197695840757,3.74368704544791,3.75539713248824,3.76710721952858,3.77881730656892,3.79052739360925,3.80223748064959,3.81394756768993,3.82565765473026,3.8373677417706,3.84907782881094,3.86078791585127,3.87249800289161,3.88420808993195,3.89591817697228,3.90762826401262,3.91933835105295,3.93104843809329,3.94275852513363,3.95446861217396,3.9661786992143,3.97788878625464,3.98959887329497,4.00130896033531,4.01301904737565,4.02472913441598,4.03643922145632,4.04814930849666,4.05985939553699,4.07156948257733,4.08327956961767,4.094989656658,4.10669974369834,4.11840983073867,4.13011991777901,4.14183000481935,4.15354009185968,4.16525017890002,4.17696026594036,4.18867035298069,4.20038044002103,4.21209052706137,4.2238006141017,4.23551070114204,4.24722078818238,4.25893087522271,4.27064096226305,4.28235104930339,4.29406113634372,4.30577122338406,4.31748131042439,4.32919139746473,4.34090148450507,4.3526115715454,4.36432165858574,4.37603174562608,4.38774183266641,4.39945191970675,4.41116200674709,4.42287209378742,4.43458218082776,4.4462922678681,4.45800235490843,4.46971244194877,4.48142252898911,4.49313261602944,4.50484270306978,4.51655279011012,4.52826287715045,4.53997296419079,4.55168305123112,4.56339313827146,4.5751032253118,4.58681331235213,4.59852339939247,4.61023348643281,4.62194357347314,4.63365366051348,4.64536374755382,4.65707383459415,4.66878392163449,4.68049400867483,4.69220409571516,4.7039141827555,4.71562426979584,4.72733435683617,4.73904444387651,4.75075453091684,4.76246461795718,4.77417470499752,4.78588479203785,4.79759487907819,4.80930496611853,4.82101505315886,4.8327251401992,4.84443522723954,4.85614531427987,4.86785540132021,4.87956548836055,4.89127557540088,4.90298566244122,4.91469574948156,4.92640583652189,4.93811592356223,4.94982601060256,4.9615360976429,4.97324618468324,4.98495627172357,4.99666635876391,5.00837644580425,5.02008653284458,5.03179661988492,5.04350670692526,5.05521679396559,5.06692688100593,5.07863696804627,5.0903470550866,5.10205714212694,5.11376722916728,5.12547731620761,5.13718740324795,5.14889749028829,5.16060757732862,5.17231766436896,5.18402775140929,5.19573783844963,5.20744792548997,5.2191580125303,5.23086809957064,5.24257818661098,5.25428827365131,5.26599836069165,5.27770844773199,5.28941853477232,5.30112862181266,5.312838708853,5.32454879589333,5.33625888293367,5.347968969974,5.35967905701434,5.37138914405468,5.38309923109501,5.39480931813535,5.40651940517569,5.41822949221602,5.42993957925636,5.4416496662967,5.45335975333703,5.46506984037737,5.47677992741771,5.48849001445804,5.50020010149838,5.51191018853872,5.52362027557905,5.53533036261939,5.54704044965973,5.55875053670006,5.5704606237404,5.58217071078074,5.59388079782107,5.60559088486141,5.61730097190174,5.62901105894208,5.64072114598242,5.65243123302275,5.66414132006309,5.67585140710343,5.68756149414376,5.6992715811841,5.71098166822444,5.72269175526477,5.73440184230511,5.74611192934545,5.75782201638578,5.76953210342612,5.78124219046645,5.79295227750679,5.80466236454713,5.81637245158746,5.8280825386278,5.83979262566814,5.85150271270847,5.86321279974881,5.87492288678915,5.88663297382948,5.89834306086982,5.91005314791016,5.92176323495049,5.93347332199083,5.94518340903117,5.9568934960715,5.96860358311184,5.98031367015218,5.99202375719251,6.00373384423285,6.01544393127318,6.02715401831352,6.03886410535386,6.05057419239419,6.06228427943453,6.07399436647487,6.0857044535152,6.09741454055554,6.10912462759588,6.12083471463621,6.13254480167655,6.14425488871689,6.15596497575722,6.16767506279756,6.17938514983789,6.19109523687823,6.20280532391857,6.2145154109589,6.22622549799924,6.23793558503958,6.24964567207991,6.26135575912025,6.27306584616059,6.28477593320092,6.29648602024126,6.3081961072816,6.31990619432193,6.33161628136227,6.34332636840261,6.35503645544294,6.36674654248328,6.37845662952362,6.39016671656395,6.40187680360429,6.41358689064463,6.42529697768496,6.4370070647253,6.44871715176563,6.46042723880597],&#34;y&#34;:[0.000588305747859967,0.000653662546177274,0.000723963411877116,0.000802929549769688,0.000889479434486823,0.000982370534203977,0.00108518976103097,0.00119855544237036,0.00131994472036086,0.00145247187698992,0.00159934484368989,0.001756232665348,0.00192532734307172,0.0021135415600787,0.00231408560427172,0.00252765905332986,0.00276623020813335,0.00301977234637767,0.00328847357713965,0.00358591738691038,0.00390296030311583,0.00423814316428617,0.00460440885268853,0.00499653052779915,0.00541004685425102,0.00585650024639029,0.0063361959305214,0.00684075642738382,0.00737945433089139,0.00795989840270584,0.00856881043554106,0.00921224659521632,0.00990697081345154,0.0106337925309994,0.0113945736179875,0.0122170636181251,0.013075178091888,0.0139691415838804,0.0149288526323047,0.0159309722779777,0.0169721838389724,0.01807856341184,0.0192361819738506,0.0204357060491956,0.0216983672563278,0.0230211834918149,0.0243881253482525,0.0258147223814598,0.0273100655794014,0.0288510035218589,0.0304467493337186,0.0321190412211169,0.0338375059584044,0.0356047402731382,0.0374550300138563,0.0393510679905891,0.0412927845618922,0.0433145138958261,0.0453843698154036,0.0474983012194,0.0496827616165884,0.0519187106233118,0.0541960307689625,0.0565335011844187,0.0589238533290903,0.0613518038985453,0.0638290951290422,0.0663583842292055,0.0689205174971155,0.0715212422140802,0.0741705987861254,0.0768472018860914,0.0795521935327253,0.0822998881459878,0.0850685711131232,0.0878578097355036,0.0906785641177854,0.0935149813910552,0.0963652269537345,0.0992340266500031,0.102112691054892,0.104998280069066,0.107891150714918,0.110786291398719,0.113681520357562,0.116574751849369,0.119461164070792,0.122341127438455,0.125211983458818,0.128065819018823,0.130907173518256,0.13373452530288,0.136533977764915,0.13931558956002,0.142079033749399,0.144806289228922,0.147509731046339,0.150190518443112,0.15283159734119,0.155441475785252,0.158025081387198,0.160567718175561,0.163071826127385,0.165546925203725,0.167981725463347,0.17037102903303,0.172729439687436,0.17504978300274,0.177318265544688,0.179554757094315,0.181756596717929,0.18390099262779,0.186012994885452,0.188092598181578,0.190114042061918,0.192101295724165,0.194056388973739,0.195958591236368,0.197822780321955,0.1996555254982,0.201441118790422,0.203185522584342,0.204899585868711,0.206572444876928,0.208201639740741,0.209801911977778,0.211366933510961,0.212886565247555,0.214378957034801,0.215841906076329,0.217258542582392,0.218649860379786,0.220015994195073,0.221338347385617,0.222636246504854,0.223911138655524,0.22514921749551,0.226362219114609,0.227554637986412,0.228716948487392,0.229854501893055,0.230974166590472,0.232070098654074,0.233142667284122,0.234200336738981,0.235240243011945,0.236259393596278,0.237266953219638,0.238262220569756,0.239240698293245,0.24021122863041,0.241174063325155,0.242126109352169,0.243073927209882,0.24401806844024,0.244958754005581,0.245899422915709,0.246840776138009,0.247785361452477,0.248735673786362,0.249691364080893,0.250656189653498,0.251634126018204,0.252622452030991,0.25362489311511,0.254649565002808,0.255689937484511,0.256748346700479,0.257839925383187,0.258952791788404,0.260087323189842,0.261266058142699,0.262472807913362,0.263707076771838,0.264991431631539,0.266314268120489,0.267670675736086,0.269081718567118,0.270543474566533,0.272044986082628,0.273604196845273,0.275228063149989,0.276897904714739,0.278626873439181,0.280436005601543,0.282297229263909,0.284217232541924,0.28623420151517,0.288309084838269,0.290442255233552,0.292686574075527,0.294995829747783,0.297368588070914,0.299851612251397,0.302413397376107,0.305043015556477,0.307779347589871,0.310608082047404,0.313507731471377,0.316507812535489,0.319612839226409,0.322790214423111,0.32605909434202,0.329443238939267,0.332899102401217,0.336435167401056,0.34009327872927,0.343820014387732,0.347615097969852,0.351531320943,0.355511601262243,0.35955403509858,0.363696461121886,0.367902142641089,0.372160663012396,0.376495653373984,0.380887015934679,0.385318639003849,0.389801910426376,0.394327345290166,0.398877201664297,0.403453858795064,0.408050090435334,0.412651813316133,0.417256864237264,0.421849760911855,0.426426472456697,0.430985502995479,0.435491844748906,0.439957746827314,0.444381891230911,0.448717929623582,0.452980463551273,0.457175700975284,0.461252378008086,0.465214876606076,0.469083898103611,0.472810305547681,0.476375023599267,0.47982034767669,0.483106513622703,0.486177892778987,0.489105168486745,0.491864951288793,0.494352955369166,0.496674285024609,0.498827508853677,0.500651583403777,0.502288692429284,0.50373845205029,0.504855872216302,0.505742961360178,0.506427298195742,0.506786419567335,0.506872554200583,0.506744957236864,0.506308677031344,0.505559597500064,0.504590629896242,0.50333757804063,0.501736851592977,0.499915102799359,0.497840253196014,0.495389728635065,0.492722065747208,0.489836758164059,0.486556325721963,0.483067458688263,0.479370953920444,0.475325551151142,0.471056963844871,0.466594264319548,0.461833521021623,0.456841851451872,0.451673447306482,0.446258483642867,0.440613459829106,0.434812285084145,0.428814586237262,0.422596638507221,0.416245612713471,0.409744830207442,0.403042505801392,0.396231915002329,0.389313568260189,0.382220870866176,0.3750457080453,0.367789805280088,0.360412648116943,0.352970021259336,0.345472702151974,0.337902553617375,0.330289252925561,0.322646846200007,0.314972323988092,0.307282620659989,0.299588360868811,0.291894644023726,0.284218373196358,0.276560573003801,0.26892791440864,0.261348875945522,0.25380942288498,0.246311939597434,0.238906633460259,0.231559823289543,0.224272651590395,0.217101269346922,0.210012974658456,0.203000597376581,0.19611744920332,0.189344611228538,0.182661461665087,0.176113704593134,0.169704127869832,0.163395493900408,0.157222094848814,0.151214518087706,0.145316687503506,0.139548627137778,0.133973038650724,0.128513678860714,0.123174342161713,0.118052504075493,0.113051239244301,0.108170748464163,0.103503103564732,0.0989722486908078,0.0945644373323544,0.0903546233194461,0.0863000315013777,0.0823691195201222,0.0786189484250374,0.0750409247730967,0.0715858480294263,0.0682927113521793,0.0651869450311057,0.0622022835713439,0.0593599496263401,0.0567184148587647,0.0541952757212188,0.0517946348331432,0.0496064129050594,0.0475332203175651,0.0455748122691548,0.0438149182675307,0.0421780685312028,0.0406521091370875,0.0393025352306227,0.0380868808816794,0.03697785295599,0.0360237074136805,0.0352128455249011,0.034504022103745,0.0339293615838494,0.0335057141184952,0.0331791784313083,0.0329669599114406,0.032911649354783,0.0329481141959803,0.0330799835756437,0.0333725237896389,0.033750975399349,0.0342149240130743,0.0348247569891112,0.0355219653281096,0.0362980540284246,0.0371978236678173,0.0381877761573159,0.0392491304087517,0.0404126053670661,0.041665933245323,0.0429821686723628,0.0443797881849895,0.0458632621617102,0.0474000146837426,0.0489985253107278,0.0506746989559435,0.0523933252676557,0.054155582572988,0.0559826570274991,0.0578401761691543,0.05972730168576,0.0616571378564448,0.0636064707752118,0.0655722390799825,0.0675567281013371,0.0695472719390482,0.0715402439550405,0.0735305642963638,0.0755091128780825,0.0774755650339556,0.0794212725286344,0.0813332660231287,0.0832185281145797,0.0850688096035054,0.0868598669283704,0.0886099235537995,0.090315051053707,0.0919327109429747,0.0934959848341262,0.0950040361473199,0.0964044706630829,0.0977336848702283,0.0989958680932156,0.100142029176245,0.101196031204604,0.102173161728404,0.10303159354464,0.103777019847113,0.10443813022448,0.104983248745097,0.105395913303758,0.105719542615345,0.105934635905498,0.10600054187191,0.105975622449468,0.105853489007502,0.105569386427853,0.105195659692428,0.104732495479535,0.104112281028684,0.103400206663057,0.102603058124606,0.10166966790964,0.100639826234939,0.0995319095064192,0.098310437660737,0.0969924607441409,0.0956056682531188,0.0941284847116692,0.0925595842276427,0.0909329118212423,0.0892381942792896,0.0874613806634923,0.0856390779195163,0.0837691443928913,0.0818312501902711,0.0798608105282003,0.0778586898734543,0.075809979404024,0.073740092461846,0.0716515274952025,0.0695399188652703,0.0674185037130016,0.0652909035532863,0.0631594916324714,0.0610319166339332,0.0589096794471216,0.0567983141345672,0.0547058893124197,0.0526289858434713,0.0505731501286169,0.0485519529634297,0.0465548564239365,0.0445848462917197,0.0426649145149171,0.0407759020201483,0.0389181996211283,0.0371212188112957,0.0353620427803762,0.0336390170455964,0.0319783425365085,0.0303642466784235,0.0287893862376131,0.0272751295484269,0.0258151648994898,0.0243958992850823,0.0230329287961383,0.0217305117795463,0.0204688280285173,0.0192573636156022,0.0181110106426288,0.0170042264886259,0.0159405454843738,0.0149447169905036,0.0139863440929984,0.0130652625080126,0.0122095355101697,0.0113901710175855,0.0106052370943992,0.00987576463566898,0.00918395788574547,0.00852328855852022,0.00790852861288404,0.00733158064509462,0.0067822552286302,0.00626998860171669,0.00579465411012348,0.00534338414643543,0.00492125787797452,0.00453433111682078,0.00416801080577014,0.00382397867860762,0.00351275571502464,0.00321888830972854,0.00294216929408905,0.00269416625186015,0.00246117041258166,0.00224238158882995,0.00204566626120114,0.00186307285946595,0.0016920717973324,0.00153769718615137,0.0013962513825373,0.00126412485707081,0.00114425717398871,0.00103594290582272,0.000935012077976891,0.00084291503764595,0.000760919634733202,0.000684690514374745],&#34;type&#34;:&#34;scatter&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;grey&#34;},&#34;marker&#34;:{&#34;size&#34;:0,&#34;color&#34;:&#34;grey&#34;,&#34;opacity&#34;:0},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_dens&#34;,&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y4&#34;},&#34;wt_1.513\nHH: 0\nMH: 0.1\nM: 0.2\nML: 0.22\nLL: 0.5&#34;:{&#34;x0&#34;:1.513,&#34;y0&#34;:0,&#34;x1&#34;:1.513,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_1.513\nHH: 0\nMH: 0.1\nM: 0.2\nML: 0.22\nLL: 0.5&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_2.04\nHH: 0\nMH: 0.1\nM: 0.2\nML: 0.22\nLL: 0.5&#34;:{&#34;x0&#34;:2.04,&#34;y0&#34;:0,&#34;x1&#34;:2.04,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_2.04\nHH: 0\nMH: 0.1\nM: 0.2\nML: 0.22\nLL: 0.5&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_3.44\nHH: 0.14\nMH: 0.2\nM: 0.33\nML: 0.22\nLL: 0&#34;:{&#34;x0&#34;:3.44,&#34;y0&#34;:0,&#34;x1&#34;:3.44,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_3.44\nHH: 0.14\nMH: 0.2\nM: 0.33\nML: 0.22\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_5.3\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;:{&#34;x0&#34;:5.3,&#34;y0&#34;:0,&#34;x1&#34;:5.3,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_5.3\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_5.424\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;:{&#34;x0&#34;:5.424,&#34;y0&#34;:0,&#34;x1&#34;:5.424,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_5.424\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;rug_pred&#34;:{&#34;type&#34;:&#34;bar&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:null,&#34;y&#34;:null,&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x1&#34;,&#34;yaxis&#34;:&#34;y11&#34;,&#34;name&#34;:&#34;rug_pred&#34;,&#34;showlegend&#34;:false},&#34;rug_cyl&#34;:{&#34;type&#34;:&#34;bar&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:null,&#34;y&#34;:null,&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x2&#34;,&#34;yaxis&#34;:&#34;y12&#34;,&#34;name&#34;:&#34;rug_cyl&#34;,&#34;showlegend&#34;:false},&#34;rug_mpg&#34;:{&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:[21,21,22.8,21.4,18.7,18.1,14.3,24.4,22.8,19.2,17.8,16.4,17.3,15.2,10.4,10.4,14.7,32.4,30.4,33.9,21.5,15.5,15.2,13.3,19.2,27.3,26,30.4,15.8,19.7,15,21.4],&#34;y&#34;:[&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;],&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x3&#34;,&#34;yaxis&#34;:&#34;y13&#34;,&#34;name&#34;:&#34;rug_mpg&#34;,&#34;showlegend&#34;:false},&#34;rug_wt&#34;:{&#34;type&#34;:&#34;scatter&#34;,&#34;mode&#34;:&#34;markers&#34;,&#34;x&#34;:[2.62,2.875,2.32,3.215,3.44,3.46,3.57,3.19,3.15,3.44,3.44,4.07,3.73,3.78,5.25,5.424,5.345,2.2,1.615,1.835,2.465,3.52,3.435,3.84,3.845,1.935,2.14,1.513,3.17,2.77,3.57,2.78],&#34;y&#34;:[&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;,&#34;rug&#34;],&#34;marker&#34;:{&#34;symbol&#34;:&#34;line-ns-open&#34;,&#34;color&#34;:&#34;black&#34;},&#34;xaxis&#34;:&#34;x4&#34;,&#34;yaxis&#34;:&#34;y14&#34;,&#34;name&#34;:&#34;rug_wt&#34;,&#34;showlegend&#34;:false},&#34;imp_am&#34;:{&#34;y&#34;:[&#34;am&#34;],&#34;x&#34;:[0.00692949196041615],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;fixed: automatic&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_carb&#34;:{&#34;y&#34;:[&#34;carb&#34;],&#34;x&#34;:[0.0164714633124604],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;fixed: 4&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_vs&#34;:{&#34;y&#34;:[&#34;vs&#34;],&#34;x&#34;:[0.0314446655333106],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;fixed: V&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_qsec&#34;:{&#34;y&#34;:[&#34;qsec&#34;],&#34;x&#34;:[0.0410426972682671],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;fixed: 17.71&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_gear&#34;:{&#34;y&#34;:[&#34;gear&#34;],&#34;x&#34;:[0.0474881508093971],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;fixed: 3&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_drat&#34;:{&#34;y&#34;:[&#34;drat&#34;],&#34;x&#34;:[0.10967878242409],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;fixed: 3.695&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_hp&#34;:{&#34;y&#34;:[&#34;hp&#34;],&#34;x&#34;:[0.155424403653332],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;fixed: 123&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_wt&#34;:{&#34;y&#34;:[&#34;wt&#34;],&#34;x&#34;:[0.158026230740526],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;darkgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;alluvial&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_mpg&#34;:{&#34;y&#34;:[&#34;mpg&#34;],&#34;x&#34;:[0.158693784472936],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;darkgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;alluvial&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_cyl&#34;:{&#34;y&#34;:[&#34;cyl&#34;],&#34;x&#34;:[0.274800329825265],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;darkgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;alluvial&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;},&#34;imp_total\nalluvial&#34;:{&#34;y&#34;:[&#34;total\nalluvial&#34;],&#34;x&#34;:[0.591520345038727],&#34;type&#34;:&#34;bar&#34;,&#34;marker&#34;:{&#34;color&#34;:&#34;darkgrey&#34;},&#34;showlegend&#34;:false,&#34;width&#34;:0.5,&#34;name&#34;:&#34;alluvial&#34;,&#34;xaxis&#34;:&#34;x99&#34;,&#34;yaxis&#34;:&#34;y99&#34;,&#34;orientation&#34;:&#34;h&#34;}},&#34;layout&#34;:{&#34;xaxis1&#34;:{&#34;domain&#34;:[0,0.2],&#34;anchor&#34;:&#34;y11&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis2&#34;:{&#34;domain&#34;:[0.225,0.4125],&#34;anchor&#34;:&#34;y12&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis3&#34;:{&#34;domain&#34;:[0.4375,0.625],&#34;anchor&#34;:&#34;y13&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;xaxis4&#34;:{&#34;domain&#34;:[0.65,0.85],&#34;anchor&#34;:&#34;y14&#34;,&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis1&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis2&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis3&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis4&#34;:{&#34;domain&#34;:[0.9,1],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false},&#34;yaxis11&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x1&#34;},&#34;yaxis12&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x2&#34;},&#34;yaxis13&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x3&#34;},&#34;yaxis14&#34;:{&#34;domain&#34;:[0.89,0.899],&#34;showgrid&#34;:false,&#34;showline&#34;:false,&#34;showticklabels&#34;:false,&#34;zeroline&#34;:false,&#34;anchor&#34;:&#34;x4&#34;},&#34;yaxis99&#34;:{&#34;domain&#34;:[0,1],&#34;anchor&#34;:&#34;y99&#34;,&#34;showticklabels&#34;:false},&#34;xaxis99&#34;:{&#34;domain&#34;:[0.9,1],&#34;anchor&#34;:&#34;x99&#34;,&#34;showticklabels&#34;:false},&#34;annotations&#34;:[{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.591520345038727,&#34;y&#34;:&#34;am&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;am&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.591520345038727,&#34;y&#34;:&#34;carb&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;carb&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.591520345038727,&#34;y&#34;:&#34;vs&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;vs&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.591520345038727,&#34;y&#34;:&#34;qsec&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;qsec&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.591520345038727,&#34;y&#34;:&#34;gear&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;gear&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.591520345038727,&#34;y&#34;:&#34;drat&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;drat&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.591520345038727,&#34;y&#34;:&#34;hp&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;hp&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.591520345038727,&#34;y&#34;:&#34;wt&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;wt&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.591520345038727,&#34;y&#34;:&#34;mpg&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;mpg&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.591520345038727,&#34;y&#34;:&#34;cyl&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;cyl&#34;,&#34;align&#34;:&#34;right&#34;},{&#34;xref&#34;:&#34;x99&#34;,&#34;yref&#34;:&#34;y99&#34;,&#34;x&#34;:0.591520345038727,&#34;y&#34;:&#34;total\nalluvial&#34;,&#34;showarrow&#34;:false,&#34;text&#34;:&#34;total\nalluvial&#34;,&#34;align&#34;:&#34;right&#34;}]},&#34;shapes&#34;:{&#34;mpg_10.4\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;:{&#34;x0&#34;:10.4,&#34;y0&#34;:0,&#34;x1&#34;:10.4,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_10.4\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_14.7\nHH: 0.29\nMH: 0.35\nM: 0.13\nML: 0.17\nLL: 0&#34;:{&#34;x0&#34;:14.7,&#34;y0&#34;:0,&#34;x1&#34;:14.7,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_14.7\nHH: 0.29\nMH: 0.35\nM: 0.13\nML: 0.17\nLL: 0&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_19.45\nHH: 0.29\nMH: 0.05\nM: 0.47\nML: 0.13\nLL: 0.2&#34;:{&#34;x0&#34;:19.45,&#34;y0&#34;:0,&#34;x1&#34;:19.45,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_19.45\nHH: 0.29\nMH: 0.05\nM: 0.47\nML: 0.13\nLL: 0.2&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_30.4\nHH: 0\nMH: 0.15\nM: 0.13\nML: 0.26\nLL: 0.4&#34;:{&#34;x0&#34;:30.4,&#34;y0&#34;:0,&#34;x1&#34;:30.4,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_30.4\nHH: 0\nMH: 0.15\nM: 0.13\nML: 0.26\nLL: 0.4&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_33.9\nHH: 0\nMH: 0.15\nM: 0.13\nML: 0.26\nLL: 0.4&#34;:{&#34;x0&#34;:33.9,&#34;y0&#34;:0,&#34;x1&#34;:33.9,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_33.9\nHH: 0\nMH: 0.15\nM: 0.13\nML: 0.26\nLL: 0.4&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;wt_1.513\nHH: 0\nMH: 0.1\nM: 0.2\nML: 0.22\nLL: 0.5&#34;:{&#34;x0&#34;:1.513,&#34;y0&#34;:0,&#34;x1&#34;:1.513,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_1.513\nHH: 0\nMH: 0.1\nM: 0.2\nML: 0.22\nLL: 0.5&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_2.04\nHH: 0\nMH: 0.1\nM: 0.2\nML: 0.22\nLL: 0.5&#34;:{&#34;x0&#34;:2.04,&#34;y0&#34;:0,&#34;x1&#34;:2.04,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_2.04\nHH: 0\nMH: 0.1\nM: 0.2\nML: 0.22\nLL: 0.5&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_3.44\nHH: 0.14\nMH: 0.2\nM: 0.33\nML: 0.22\nLL: 0&#34;:{&#34;x0&#34;:3.44,&#34;y0&#34;:0,&#34;x1&#34;:3.44,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_3.44\nHH: 0.14\nMH: 0.2\nM: 0.33\nML: 0.22\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_5.3\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;:{&#34;x0&#34;:5.3,&#34;y0&#34;:0,&#34;x1&#34;:5.3,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_5.3\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_5.424\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;:{&#34;x0&#34;:5.424,&#34;y0&#34;:0,&#34;x1&#34;:5.424,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_5.424\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;}},&#34;shapes_original&#34;:{&#34;mpg_10.4\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;:{&#34;x0&#34;:10.4,&#34;y0&#34;:0,&#34;x1&#34;:10.4,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_10.4\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_14.7\nHH: 0.29\nMH: 0.35\nM: 0.13\nML: 0.17\nLL: 0&#34;:{&#34;x0&#34;:14.7,&#34;y0&#34;:0,&#34;x1&#34;:14.7,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_14.7\nHH: 0.29\nMH: 0.35\nM: 0.13\nML: 0.17\nLL: 0&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_19.45\nHH: 0.29\nMH: 0.05\nM: 0.47\nML: 0.13\nLL: 0.2&#34;:{&#34;x0&#34;:19.45,&#34;y0&#34;:0,&#34;x1&#34;:19.45,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_19.45\nHH: 0.29\nMH: 0.05\nM: 0.47\nML: 0.13\nLL: 0.2&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_30.4\nHH: 0\nMH: 0.15\nM: 0.13\nML: 0.26\nLL: 0.4&#34;:{&#34;x0&#34;:30.4,&#34;y0&#34;:0,&#34;x1&#34;:30.4,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_30.4\nHH: 0\nMH: 0.15\nM: 0.13\nML: 0.26\nLL: 0.4&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;mpg_33.9\nHH: 0\nMH: 0.15\nM: 0.13\nML: 0.26\nLL: 0.4&#34;:{&#34;x0&#34;:33.9,&#34;y0&#34;:0,&#34;x1&#34;:33.9,&#34;y1&#34;:0.0679542870907898,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;mpg_33.9\nHH: 0\nMH: 0.15\nM: 0.13\nML: 0.26\nLL: 0.4&#34;,&#34;xref&#34;:&#34;x3&#34;,&#34;yref&#34;:&#34;y3&#34;},&#34;wt_1.513\nHH: 0\nMH: 0.1\nM: 0.2\nML: 0.22\nLL: 0.5&#34;:{&#34;x0&#34;:1.513,&#34;y0&#34;:0,&#34;x1&#34;:1.513,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_1.513\nHH: 0\nMH: 0.1\nM: 0.2\nML: 0.22\nLL: 0.5&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_2.04\nHH: 0\nMH: 0.1\nM: 0.2\nML: 0.22\nLL: 0.5&#34;:{&#34;x0&#34;:2.04,&#34;y0&#34;:0,&#34;x1&#34;:2.04,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_2.04\nHH: 0\nMH: 0.1\nM: 0.2\nML: 0.22\nLL: 0.5&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_3.44\nHH: 0.14\nMH: 0.2\nM: 0.33\nML: 0.22\nLL: 0&#34;:{&#34;x0&#34;:3.44,&#34;y0&#34;:0,&#34;x1&#34;:3.44,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_3.44\nHH: 0.14\nMH: 0.2\nM: 0.33\nML: 0.22\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_5.3\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;:{&#34;x0&#34;:5.3,&#34;y0&#34;:0,&#34;x1&#34;:5.3,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_5.3\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;},&#34;wt_5.424\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;:{&#34;x0&#34;:5.424,&#34;y0&#34;:0,&#34;x1&#34;:5.424,&#34;y1&#34;:0.506872554200583,&#34;type&#34;:&#34;line&#34;,&#34;line&#34;:{&#34;color&#34;:&#34;lightgrey&#34;},&#34;showlegend&#34;:false,&#34;name&#34;:&#34;wt_5.424\nHH: 0.43\nMH: 0.3\nM: 0.13\nML: 0.17\nLL: 0&#34;,&#34;xref&#34;:&#34;x4&#34;,&#34;yref&#34;:&#34;y4&#34;}},&#34;map_curve&#34;:[[5,8,10,18],[5,8,10,19],[5,8,10,20],[5,8,11,19],[5,8,11,20],[5,8,12,19],[5,8,12,20],[1,6,12,16],[1,6,12,17],[1,6,13,16],[1,6,13,17],[1,6,14,16],[1,6,14,17],[1,7,13,16],[1,7,13,17],[1,7,14,16],[1,7,14,17],[3,6,10,18],[3,6,11,18],[3,6,12,19],[3,6,12,20],[3,7,10,18],[3,7,11,18],[3,7,12,18],[3,7,12,19],[3,7,12,20],[3,8,12,16],[3,8,12,17],[3,8,13,16],[3,8,13,17],[3,8,14,16],[3,8,14,17],[4,6,10,19],[4,6,10,20],[4,6,11,19],[4,6,11,20],[4,7,10,19],[4,7,10,20],[4,7,11,19],[4,7,11,20],[4,8,10,16],[4,8,10,17],[4,8,11,16],[4,8,11,17],[4,8,11,18],[4,8,12,18],[4,8,13,18],[4,8,13,19],[4,8,13,20],[4,8,14,18],[4,8,14,19],[4,8,14,20],[2,6,10,16],[2,6,10,17],[2,6,11,16],[2,6,11,17],[2,6,12,18],[2,6,13,18],[2,6,13,19],[2,6,13,20],[2,6,14,18],[2,6,14,19],[2,6,14,20],[2,7,10,16],[2,7,10,17],[2,7,11,16],[2,7,11,17],[2,7,12,16],[2,7,12,17],[2,7,13,18],[2,7,13,19],[2,7,13,20],[2,7,14,18],[2,7,14,19],[2,7,14,20]],&#34;map_trace_2_shape&#34;:[0,0,0,0,0,0,0,0,0,1,2,3,4,5,0,6,7,8,9,10],&#34;map_type&#34;:[[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;],[&#34;scatter&#34;,&#34;bar&#34;,&#34;line&#34;,&#34;line&#34;]],&#34;map_color&#34;:[[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#710500&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#FF0065&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#A56F2B&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#005EAA&#34;,&#34;#969696&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#BDBDBD&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;],[&#34;#009850&#34;,&#34;#525252&#34;,&#34;lightgrey&#34;,&#34;lightgrey&#34;]],&#34;parcats_cols&#34;:[&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#710500&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#FF0065&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#A56F2B&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#005EAA&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;,&#34;#009850&#34;],&#34;imp&#34;:true},&#34;evals&#34;:[],&#34;jsHooks&#34;:[]}&lt;/script&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Easyalluvial 0.2.1 released</title>
      <link>https://www.datisticsblog.com/2019/09/easyalluvial-0-2-1-released/</link>
      <pubDate>Tue, 17 Sep 2019 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2019/09/easyalluvial-0-2-1-released/</guid>
      <description>


&lt;p&gt;&lt;code&gt;easyalluvial&lt;/code&gt; allows you to build exploratory alluvial plots (sankey diagrams) with a single line of code while automatically binning numerical variables. This releas &lt;code&gt;0.2.1&lt;/code&gt; ensures &lt;code&gt;tidyr 1.0.0&lt;/code&gt; compatibility and fixes a bug around categorical variables for model response plots&lt;/p&gt;
&lt;div id=&#34;model-response-plots-with-categorical-variables&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Model Response Plots with Categorical Variables&lt;/h1&gt;
&lt;p&gt;This feature had som glitches before as edvardoss reported in this &lt;a href=&#34;https://github.com/erblast/easyalluvial/issues/13&#34;&gt;issue&lt;/a&gt;. If anybody else encounters some glitches or inconcistencies please report them as well.&lt;/p&gt;
&lt;p&gt;We create a grid of all possible feature combinations and use an alluvial plot to visualise the model response.&lt;/p&gt;
&lt;p&gt;Learn more about this feature in this &lt;a href=&#34;https://www.datisticsblog.com/2019/04/visualising-model-response-with-easyalluvial/&#34;&gt;previous blog post&lt;/a&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages( require(tidyverse) )
suppressPackageStartupMessages( require(easyalluvial) )&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df = titanic %&amp;gt;%
  select_if(is.factor)

set.seed(0)
m = randomForest::randomForest( Survived ~ ., df)
imp = m$importance
dspace = get_data_space(df, imp, degree = 3)
pred = predict(m, newdata = dspace,type = &amp;#39;response&amp;#39;)


p = alluvial_model_response(pred, dspace, imp, degree = 3)

grid = add_marginal_histograms(p, plot = F, data_input = df) 
grid = add_imp_plot(grid = grid, p = p, data_input = df, plot = T)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2019-09-17-easyalluvial-0-2-1-released_files/figure-html/unnamed-chunk-2-1.png&#34; width=&#34;1152&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;more-changes&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;More changes&lt;/h1&gt;
&lt;p&gt;… &lt;a href=&#34;https://github.com/erblast/easyalluvial/blob/master/NEWS.md&#34;&gt;NEWS.md&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Europython 2019</title>
      <link>https://www.datisticsblog.com/2019/07/europython/</link>
      <pubDate>Mon, 15 Jul 2019 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2019/07/europython/</guid>
      <description>

&lt;!-- toc --&gt;

&lt;h1 id=&#34;europython-2019&#34;&gt;Europython 2019&lt;/h1&gt;

&lt;p&gt;I attended &lt;a href=&#34;https://ep2019.europython.eu/&#34;&gt;europython 2019&lt;/a&gt; here are some of my takeaways and notes.&lt;/p&gt;

&lt;h2 id=&#34;general-takeaways&#34;&gt;General Takeaways&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;docker&lt;/code&gt; is widely used for reproducible environments especially for training sessions and for deploying models.&lt;/li&gt;
&lt;li&gt;mostly &lt;code&gt;docker&lt;/code&gt; images would be deployed as &lt;code&gt;flask&lt;/code&gt; apps, with an REST API.&lt;/li&gt;
&lt;li&gt;REST APIs can be managed using &lt;code&gt;swagger&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;docker&lt;/code&gt; images would be managed using &lt;code&gt;kubernetes&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;continuous delivery&lt;/code&gt; was advertised a lot&lt;/li&gt;
&lt;li&gt;&lt;code&gt;VS Code&lt;/code&gt; seems to be the most popular IDE, very good demo at the MS booth. Beats &lt;code&gt;atom&lt;/code&gt; and &lt;code&gt;pycharm&lt;/code&gt; in my opinion.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;scikitlearn 0.21&lt;/code&gt; release great new features ColumnTransformer replaces &lt;code&gt;sklearn-pandas&lt;/code&gt;, histogram gradient boosting, faster and more light weight then regular gradient boosting.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dirty_cat&lt;/code&gt; has great encoders for dirty data. SimilarityEncoder and&lt;/li&gt;
&lt;/ul&gt;

&lt;div class=&#34;alert warning &#34;&gt;
  &lt;p&gt;the new sci-kit column transformer, has very a very simple API, that makes it easy to transform your pandas df into a numpy matrix. Howver the method &lt;code&gt;get_feature_names()&lt;/code&gt;. Is not working for most transformers &lt;a href=&#34;https://github.com/scikit-learn/scikit-learn/issues/6425&#34;&gt;github issue&lt;/a&gt;. So it is not really possible to inspect the transformations inside the matrix in a systematic way. &lt;code&gt;sklearn-pandas&lt;/code&gt; does not have that problem, however its API is a bit more complicated.&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&#34;training-days&#34;&gt;Training Days&lt;/h2&gt;

&lt;h3 id=&#34;rest-api-microservices&#34;&gt;REST API/Microservices&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;use &lt;code&gt;connexion&lt;/code&gt; with &lt;code&gt;swagger&lt;/code&gt; to build YAML configurable REST API&amp;rsquo;s. &lt;code&gt;swagger&lt;/code&gt; provides documentation and user interface based on yaml.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;pytest&#34;&gt;Pytest&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;pytest can run tests from other testing suites, in order to incorporate examples from docstrings doctest can be used as &lt;code&gt;pytest --doctest&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;pytest goes by no API is a good API&lt;/li&gt;
&lt;li&gt;markers can be used to organise tests&lt;/li&gt;

&lt;li&gt;&lt;p&gt;fixtures can be used to pass data to tests&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;code&gt;hypothesis&lt;/code&gt; can be used to generate random testing strings. If a fail is  detected it will give a minimal reproducible example.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;intel-tensorflow&#34;&gt;Intel Tensorflow&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;intel published &lt;code&gt;tensorflow&lt;/code&gt; configuration that is 2X -4x times faster than out-of-the-box &lt;code&gt;tensorflow&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;talks&#34;&gt;Talks&lt;/h2&gt;

&lt;h3 id=&#34;scikitlearn-0-21&#34;&gt;scikitlearn 0.21&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;rf models are larger than gb trees&lt;/li&gt;
&lt;li&gt;histogram gradient boosted trees are implemented, low memory cost, faster training&lt;/li&gt;
&lt;li&gt;early stopping, stops training when a platuea of performance has been reached such as for number of trees.&lt;/li&gt;
&lt;li&gt;column transformer has been introduced, game changer, better alternative to &lt;code&gt;sklearn-pandas&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;kbinsdicretizer preprocessor to compute nonelinear decision boundaries in order to generate new features which improves performance of linear models.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;vaex&#34;&gt;Vaex&lt;/h3&gt;

&lt;p&gt;lazy loads large data from disk to RAM&lt;br /&gt;
creates virtual columns from column calculations&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;has great histogram plotting features&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;supports hdfs and appache arrow&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;user defined functions, can be translated to C using numbajit&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;window functions like aggregate in pandas&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;comes with a lot of wrappers for python ml libraries, supports scikitlearn but does not support all scalers&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;pca on data points on a map with x-y coordinates can be used to shift coordinate points representing a density grid tilted   grid into a horizontally alligned grid&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;save all operations done in one df, can be saved as json and applied to a new dataframe. Replacement for pipelines&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;make-docker-images-safe&#34;&gt;Make Docker Images Safe&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Large docker images have many exposed vulnarbilities&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;securety tools like &lt;code&gt;claire&lt;/code&gt; can be used to scan them&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;shells can be attached to the docker image&lt;/li&gt;
&lt;li&gt;use distroless image (reduced images)&lt;/li&gt;
&lt;li&gt;distroless get rid of everything that is not needed, for example the &lt;code&gt;ls&lt;/code&gt; command from the shell.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pyinstaller&lt;/code&gt; can be used to reduce dependencies, but does not detect all dependencies and then they need to be added manually.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Do:
- dont run as root
- use image hash instead of image name and tag (hash sign version of image similar like git commit hashes)
- build your own distroless images
- sign docker images&lt;/p&gt;

&lt;h3 id=&#34;recommendation-engine&#34;&gt;Recommendation Engine&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;use euclidean distance of ratings to calculate similarity score&lt;/li&gt;
&lt;li&gt;calculate weighted average (by similarity score) as prediction&lt;/li&gt;
&lt;li&gt;recommend if predicted recommendation is higher than average rating&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;python-packaging&#34;&gt;Python packaging&lt;/h3&gt;

&lt;p&gt;&lt;a href=&#34;https://github.com/judy2k/publishing_python_packages_talk&#34;&gt;slides&lt;/a&gt;&lt;/p&gt;

&lt;h4 id=&#34;dev-test-workflow&#34;&gt;Dev Test workflow&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;use &lt;code&gt;pip install -e .&lt;/code&gt; install package from from curent wd, during package dev. updates all files loaded from repo, like devtools::load_all() in R. Does not install directly into py dist.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;put &lt;code&gt;.py&lt;/code&gt; files into &lt;code&gt;src/&lt;/code&gt; directory instead of packagename directory. Force your tests to run on &lt;code&gt;pip install -e .&lt;/code&gt; version of your code.&lt;/p&gt;

&lt;p&gt;Testing with &lt;code&gt;Tox&lt;/code&gt; somehow like Rcmdcheck, different python versions can be spcified.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;check-manifest&lt;/code&gt; checks whether all files are included in tar ball.&lt;/p&gt;

&lt;h4 id=&#34;documentation&#34;&gt;Documentation&lt;/h4&gt;

&lt;p&gt;sphinx pythonic solution for python doc. generates api reference from docstrings&lt;/p&gt;

&lt;p&gt;mkdocs language agnostic markdown documentation for projects libraries, &lt;code&gt;pydocmd&lt;/code&gt; claims to do generate api reference from docstrings. sphinx might be more advanced, on this, best to check receommended docstring layout recommended for the tool.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;pydoc&lt;/code&gt; can also bve used to make documentation from docstrings. In standard library.&lt;/p&gt;

&lt;p&gt;add readme.md to setuptools so it propably shows up on python&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;from setuptools import setup
with open(&amp;quot;README.md&amp;quot;, &amp;quot;r&amp;quot;) as fh:
 long_description = fh.read()
setup(
 …
 long_description=long_description,
 long_description_content_type=&amp;quot;text/markdown&amp;quot;, 
 ...
)
&lt;/code&gt;&lt;/pre&gt;

&lt;h4 id=&#34;templates&#34;&gt;Templates&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;cookiecutter&lt;/code&gt; has python package templates&lt;/p&gt;

&lt;h3 id=&#34;dirty-data&#34;&gt;Dirty Data&lt;/h3&gt;

&lt;h4 id=&#34;dirty-categorical-features&#34;&gt;Dirty categorical features&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;manualy break up into two or more seperate features, for example first name, last name&lt;/li&gt;
&lt;li&gt;manualy group categories&lt;/li&gt;
&lt;li&gt;Similarity Endoding, similarity distance to category, new strings can be fitted on old categories&lt;/li&gt;
&lt;li&gt;Jaro-winkler, levenstain, 3-gram similarity scores&lt;/li&gt;
&lt;li&gt;&lt;code&gt;dirty_cat&lt;/code&gt; has similarity encoder &lt;code&gt;from dirty_cat import SimilarityEncoder&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;TargetEncoder, Encode Categorical Feature as Mean/Median of other value, example police officer ranking on Salary&lt;/li&gt;
&lt;li&gt;Latent Category Encoder, builds new categories based on substring similarities&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&#34;missing-values&#34;&gt;Missing Values&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;classical data generation assumption, data generation is complete and random entries are random.&lt;/li&gt;
&lt;li&gt;NA values are seldom random, and sometimes are the result of the data model, like age of spouse will be NA for people that are single&lt;/li&gt;
&lt;li&gt;mean imputation distorts the distribution, concerning for statisitcal models but not algorithmic models&lt;/li&gt;
&lt;li&gt;when imputing age of spouse, missingness indicator could be used to flagg single people&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;from-script-to-open-source&#34;&gt;From Script to Open Source&lt;/h3&gt;

&lt;p&gt;-&lt;code&gt;docopt&lt;/code&gt; helps you build GNU compliant CLI-tools
- code guides, only 2 parameters per function.
- &lt;code&gt;python setup.py develop&lt;/code&gt; same as &lt;code&gt;pip install -e .&lt;/code&gt;
- setup.py let&amp;rsquo;s you define entry points (for package plug-ins) and CLI callable name
- requirements.txt file can augment setup.py dependencies, stating tested dependency versions
- &lt;code&gt;black&lt;/code&gt; reformats code to be pythonic
- &lt;code&gt;pre-commit&lt;/code&gt; runs formatters such as &lt;code&gt;black&lt;/code&gt; before git commit
- &lt;code&gt;flake8&lt;/code&gt; to check you code
- &lt;code&gt;tox.ini&lt;/code&gt; configuration file for &lt;code&gt;black&lt;/code&gt; code standard and &lt;code&gt;flake8&lt;/code&gt;
- use static type analysis, &lt;code&gt;MyPy&lt;/code&gt; checks if function with wrong type has been called
- &lt;code&gt;tox&lt;/code&gt; manages all those tools including testing tools similar to Rcmdcheck I guess
- &lt;code&gt;travisCI&lt;/code&gt; pip installing &lt;code&gt;tox&lt;/code&gt; is enough to run all test
- requirements updater is a bot that will continuosly check versions of dependencies, &lt;code&gt;PyUP&lt;/code&gt;
- &lt;code&gt;pytest-cov&lt;/code&gt; will check test coverage
- automated code review &lt;code&gt;PR&lt;/code&gt;
- automated pull request merge &lt;code&gt;mergify&lt;/code&gt;
- &lt;code&gt;twine&lt;/code&gt; to upload to pypi&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;http://michal.karzynski.pl&#34;&gt;blog&lt;/a&gt;&lt;/p&gt;

&lt;h3 id=&#34;state-of-production-ml-in-2019&#34;&gt;State of Production ML in 2019&lt;/h3&gt;

&lt;p&gt;&lt;a href=&#34;https://github.com/EthicalML/state-of-mlops-2019&#34;&gt;slides + example projects&lt;/a&gt;&lt;/p&gt;

&lt;h4 id=&#34;gitops-strategies-for-ml&#34;&gt;GITOPS STRATEGIES FOR ML&lt;/h4&gt;

&lt;p&gt;CI/CD via github, using, docker, kubernetes
&lt;a href=&#34;https://dzone.com/articles/a-practical-guide-to-operating-kubernetes-the-gito&#34;&gt;description&lt;/a&gt;&lt;/p&gt;

&lt;h4 id=&#34;modelling-process&#34;&gt;Modelling Process&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;data assessment&lt;/li&gt;
&lt;li&gt;model assessment (feature importance, shap-values, pdp-plots, interpretability)&lt;/li&gt;
&lt;li&gt;production monitoring (see that asassments remain intact during production)&lt;/li&gt;
&lt;li&gt;explainer, model that adds explanations to predictions,

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;alibi&lt;/code&gt;, delivers pertinent negative and pertinate positive (minimum changes for positive and negative prediction)&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;seldon&lt;/code&gt; can be used to manage kubernetes&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&#34;reproducibility&#34;&gt;Reproducibility&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Container Versioning&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;modern-continuous-delivery&#34;&gt;Modern Continuous Delivery&lt;/h3&gt;

&lt;p&gt;&lt;a href=&#34;tinyurl.com/moderncd&#34;&gt;slides&lt;/a&gt;&lt;br /&gt;
- deploy to production from commit #1&lt;br /&gt;
- take over release schedule from IT to Business&lt;br /&gt;
- CDEV is concept, CI and CDEP are techniques&lt;br /&gt;
- Modern&lt;br /&gt;
  * immutable infrastructure&lt;br /&gt;
  * container orchestration&lt;br /&gt;
  * version control and automation&lt;br /&gt;
  * cloud native apps&lt;/p&gt;

&lt;p&gt;tools? choice or lock-in?, lock-in choices should be avoided&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;cookiecutter&lt;/code&gt; seems to be what devtools/usethis is for python, can be used to setup CDEV for projects.&lt;/li&gt;
&lt;li&gt;generate + seal your secrets, otherwise you cant continuously deliver&lt;/li&gt;
&lt;li&gt;dont overload your yaml&lt;/li&gt;
&lt;li&gt;test-driven, pair programming&lt;/li&gt;
&lt;li&gt;the only way to go fast is to go well, robert c. martin&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;practical-clean-architecture&#34;&gt;Practical Clean Architecture&lt;/h3&gt;

&lt;h4 id=&#34;typing-for-data-interfaces&#34;&gt;Typing for data interfaces&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;typing, use type annotations when writing functions&lt;/li&gt;
&lt;li&gt;typing package has objects that allow you type specifications for dictionaries&lt;/li&gt;
&lt;li&gt;python 3.7 offers data classes that make this easier&lt;/li&gt;
&lt;li&gt;dataclasses can be frozen, immutability can be added&lt;/li&gt;
&lt;li&gt;use abstractions to interact with databases, &lt;code&gt;ABC&lt;/code&gt; packages&lt;/li&gt;
&lt;li&gt;we can use &lt;code&gt;injector&lt;/code&gt; to build interfaces, will inject stuff into data classes&lt;/li&gt;
&lt;li&gt;the interfaces can be documented with swagger&lt;/li&gt;
&lt;li&gt;make an in RAM db for testing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These interfaces are easily testable&lt;/p&gt;

&lt;h4 id=&#34;architecture&#34;&gt;Architecture&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;lifetime 10 years&lt;/li&gt;
&lt;li&gt;make an application centric infrastructure&lt;/li&gt;
&lt;li&gt;do not put your db the center of your architecture&lt;/li&gt;
&lt;/ul&gt;
</description>
    </item>
    
    <item>
      <title>Visualising Model Response with easyalluvial</title>
      <link>https://www.datisticsblog.com/2019/04/visualising-model-response-with-easyalluvial/</link>
      <pubDate>Wed, 10 Apr 2019 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2019/04/visualising-model-response-with-easyalluvial/</guid>
      <description>


&lt;p&gt;In this tutorial I want to show how you can use alluvial plots to visualise model response in up to 4 dimensions. &lt;code&gt;easyalluvial&lt;/code&gt; generates an artificial data space using fixed values for unplotted variables or uses the partial dependence plotting method. It is model agnostic but offers some convenient wrappers for &lt;code&gt;caret&lt;/code&gt; models.


HUGOMORE42

&lt;/p&gt;
&lt;div id=&#34;introduction&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;div id=&#34;taking-a-peek&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Taking a peek&lt;/h2&gt;
&lt;p&gt;When building machine learning models we are usually faced with a trade-off between accurracy and interpretability. However even if we tend to lean towards accuracy and pick a modelling method that results in nearly uninterpretable models we can still make use of model agnostic interporetation techniques that have been summarized in this excellent ebook &lt;a href=&#34;https://christophm.github.io/interpretable-ml-book/&#34;&gt;Interpretable Machine Learning by Christoph Molnar&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Whithout getting to theoretical I personally always feel the urge to simply take a peek simulate some data and see how the model reacts a method described in &lt;a href=&#34;http://vita.had.co.nz/papers/model-vis.pdf&#34;&gt;here&lt;/a&gt;. In order to simulate data we can generate a a vector with a sequence of values over the entire range of a predictor variable of interest while setting all the others to their median or mode and use this artificial data space to obtain model predictions which we can plot against our variable of interest. An R package that will do this for you is (&lt;code&gt;plotmo&lt;/code&gt;)[&lt;a href=&#34;https://cran.r-project.org/web/packages/plotmo/index.html&#34; class=&#34;uri&#34;&gt;https://cran.r-project.org/web/packages/plotmo/index.html&lt;/a&gt;]. Instead of ranging over 1 predictor variable we can create a data grid using 2 predictor variables and plot the response as a third dimension. However this is as far as you can go in a conventional plot. Alluvial plots can line up much more than 3 dimensions on a plane next to each other only limited by the number of flows as it will get too cluttered when there are too many of them.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;which-variables-to-plot&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Which variables to plot&lt;/h2&gt;
&lt;p&gt;When using conventional model response plotting beeing limited two 2 variables we can simply resolve this by generating many plots and look at them one by one. Alluvial plots require a bit more attention and cannot easily be screened and compared since visually there is so much going on. Therefore I do not recommend to brute force it by simply creating a lot of random combinations of predictor variables and multiple alluvial plots but instead to focus on those that have the highest calculated feature importance. Feature importance values are natively provided by most modelling packages. So the question is how many can we plot and it turns out 4 features will usually result in well-interpretable plot.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;generating-the-data-space&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Generating the data space&lt;/h2&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages( require(tidyverse) )
suppressPackageStartupMessages( require(easyalluvial) )
suppressPackageStartupMessages( require(mlbench) )
suppressPackageStartupMessages( require(randomForest) )&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;We start by creating a model&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;data(&amp;#39;BostonHousing&amp;#39;)
df = as_tibble( BostonHousing )
m = randomForest( lstat ~ ., df )&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;and looking at the importance features&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;imp = m$importance %&amp;gt;%
  tidy_imp(df) # 

knitr::kable(imp)&lt;/code&gt;&lt;/pre&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th align=&#34;left&#34;&gt;vars&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;imp&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;medv&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;7978.9670&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;rm&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3683.4451&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;age&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2696.7073&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;indus&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2625.7043&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;crim&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2360.3927&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;nox&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1851.2070&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;dis&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1801.1501&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;b&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;699.6415&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;tax&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;586.4917&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;ptratio&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;385.9052&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;rad&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;211.5843&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;zn&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;136.5514&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;chas&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;125.0429&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;When generating the data space we cannot screen an infinite amount of values per variable but will have to limit ourselves to a fixed number. Then we want to create all possible combinations between these values which determines the number of flows. The visual limit for flows on an alluvial plot is somewhere around 1000 flows. Thus I recommend to go with 5 values which will result in 5 x 5 X 5 X 5 –&amp;gt; 625 combinations and the same number of flows. That also leaves some wiggeling room if one of the top 4 variables is a factor with more than 5 levels. &lt;code&gt;get_data_space()&lt;/code&gt; will split the range of a variable into 3 and pick the median of each split and add the variable minimum and the maximum to the set.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;dspace = get_data_space(df, imp
                        , degree = 4 # specifies the number of variables
                        , bins = 5 # the number of values per variable
                        )

knitr::kable( head(dspace, 10) )&lt;/code&gt;&lt;/pre&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th align=&#34;right&#34;&gt;medv&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;rm&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;age&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;indus&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;crim&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;nox&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;dis&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;b&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;tax&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;ptratio&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;rad&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;zn&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;chas&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.561&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.9&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.46&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.25651&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.538&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.20745&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;391.44&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;330&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;19.05&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.561&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.9&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;4.27&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.25651&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.538&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.20745&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;391.44&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;330&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;19.05&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.561&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.9&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9.90&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.25651&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.538&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.20745&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;391.44&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;330&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;19.05&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.561&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.9&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;18.10&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.25651&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.538&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.20745&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;391.44&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;330&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;19.05&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.561&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.9&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;27.74&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.25651&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.538&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.20745&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;391.44&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;330&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;19.05&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.561&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;32.2&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.46&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.25651&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.538&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.20745&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;391.44&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;330&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;19.05&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.561&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;32.2&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;4.27&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.25651&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.538&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.20745&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;391.44&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;330&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;19.05&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.561&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;32.2&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;9.90&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.25651&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.538&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.20745&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;391.44&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;330&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;19.05&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.561&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;32.2&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;18.10&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.25651&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.538&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.20745&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;391.44&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;330&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;19.05&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.561&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;32.2&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;27.74&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.25651&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0.538&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.20745&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;391.44&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;330&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;19.05&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Total rows in dspace: 625&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;dspace %&amp;gt;%
  summarise_all( ~ length( unique(.) ) ) %&amp;gt;%
  knitr::kable()&lt;/code&gt;&lt;/pre&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th align=&#34;right&#34;&gt;medv&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;rm&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;age&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;indus&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;crim&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;nox&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;dis&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;b&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;tax&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;ptratio&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;rad&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;zn&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;chas&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div id=&#34;generating-model-response&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Generating model response&lt;/h2&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;pred = predict(m, newdata = dspace)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;plotting&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Plotting&lt;/h2&gt;
&lt;p&gt;The predictions will be binned as well into 5 bins. Binning options can be passed as a list via the &lt;code&gt;params_bin_numeric_pred&lt;/code&gt; parameter.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p = alluvial_model_response(pred, dspace, imp
                            , degree = 4, bins = 5
                            , stratum_label_size = 2.8 )
p&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2019-03-29-visualising-model-response-with-easyalluvial_files/figure-html/alluv1-1.png&#34; width=&#34;960&#34; /&gt;&lt;/p&gt;
&lt;p&gt;We can see the binned range of predictions and explore by which variable combination they have been created by tracing the coloured flows. The stratum labels of the prediction variables indicate the value of the variable and which fraction of the flows of that colour (prediction variable bin range) pass through that stratum.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;marginal-histograms&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Marginal histograms&lt;/h2&gt;
&lt;p&gt;As well as for other &lt;code&gt;easyalluvial&lt;/code&gt; plots we can add marginal histograms and as a bonus also the feature importance.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p_grid = add_marginal_histograms(p, data_input = df
                                 , plot = F # plot only after adding feature importance
                                 , scale = 50 # to increase distance between ridge plots, Default: 400
                                 ) %&amp;gt;%
  add_imp_plot( p = p, data_input = df)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2019-03-29-visualising-model-response-with-easyalluvial_files/figure-html/unnamed-chunk-7-1.png&#34; width=&#34;1152&#34; /&gt;&lt;/p&gt;
&lt;p&gt;We can see the original distribution of the variables, the lines indicate the position of the values as picked by &lt;code&gt;get_data_space()&lt;/code&gt;. When comparing the distribution of the predictions against the original distribution of &lt;code&gt;lstat&lt;/code&gt; we see that the range of the predictions in response to the artificial dataspace do not cover all of the range of &lt;code&gt;lstat&lt;/code&gt;. Which most likely means that all possible combinations of the 4 plotted variables in combination with moderate values for all other predictors will not give any extreme values. Which we can further explore, first we will need to check whether the model is capable of making predictions in the lower and upper ranges of &lt;code&gt;lsat&lt;/code&gt;. We can use &lt;code&gt;plot_hist()&lt;/code&gt; to only plot the distributions and add the prediction for the training data set using the &lt;code&gt;pred_train&lt;/code&gt; parameter.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;pred_train = predict(m)

plot_hist(&amp;#39;pred&amp;#39;, p, df
          , pred_train = pred_train # pred_train can also be passed to add_marginal_histograms()
          , scale = 50)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2019-03-29-visualising-model-response-with-easyalluvial_files/figure-html/unnamed-chunk-8-1.png&#34; width=&#34;288&#34; style=&#34;display: block; margin: auto;&#34; /&gt;&lt;/p&gt;
&lt;p&gt;We see that the training prediction also do not completely cover all of the &lt;code&gt;lstat&lt;/code&gt; range but more of it than the predictions from the aritficial data space.&lt;/p&gt;
&lt;p&gt;If we wanted to emphasize this we can bin the data space predictions on the basis of the training predictions. In this case it makes sense to increase the number of bins for the predictions in order not to loose resolution on the plot.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p = alluvial_model_response(pred, dspace, imp, degree = 4, bins = 7
                            , bin_labels = c(&amp;quot;LLL&amp;quot;,&amp;quot;LL&amp;quot;, &amp;quot;ML&amp;quot;, &amp;quot;M&amp;quot;, &amp;quot;MH&amp;quot;, &amp;quot;HH&amp;quot;, &amp;quot;HHH&amp;quot;)
                            , pred_train = pred_train
                            , stratum_label_size = 2.8 )

plot_hist(&amp;#39;pred&amp;#39;, p, df, scale = 50)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2019-03-29-visualising-model-response-with-easyalluvial_files/figure-html/p_hist-1.png&#34; width=&#34;288&#34; style=&#34;display: block; margin: auto;&#34; /&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p_grid = add_marginal_histograms(p, data_input = df
                                 , plot = F # plot only after adding feature importance
                                 , scale = 50 # to increase distance between ridge plots, Default: 400
                                 ) %&amp;gt;%
  add_imp_plot( p = p, data_input = df)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2019-03-29-visualising-model-response-with-easyalluvial_files/figure-html/unnamed-chunk-9-1.png&#34; width=&#34;1152&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;what-feature-combinations-are-needed-to-obtain-predictions-in-the-lower-and-higher-ranges-of-lstat&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;What feature combinations are needed to obtain predictions in the lower and higher ranges of &lt;code&gt;lstat&lt;/code&gt;?&lt;/h1&gt;
&lt;p&gt;We can add the training predictions to the training data and assign the variables not covered by the model response plot to bins. We can then create an alluvial plot over the entire training dataframe in order to trace the &lt;code&gt;lstat&lt;/code&gt; ranges not covered by the model response alluvial plot above. Since we are only interested in those observations we remove all other flows from the plot by setting their color to &lt;code&gt;NA&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;breaks = c( min(pred_train) - 1,min(pred),max(pred),max(pred_train) + 1 )

df_inv = df %&amp;gt;%
  select(-lstat) %&amp;gt;%
  mutate( pred_train = pred_train
          , pred_train = cut(pred_train, breaks) ) %&amp;gt;%
  select( pred_train, one_of(imp$vars) ) # order by feature importance

p = alluvial_wide(df_inv, bin_labels = &amp;#39;min_max&amp;#39;
                  , stratum_label_size = 3
                  , col_vector_flow = c(&amp;#39;blue&amp;#39;, NA, &amp;#39;orange&amp;#39;)
                  , colorful_fill_variable_stratum = F)

p_grid = add_marginal_histograms(p, df_inv)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2019-03-29-visualising-model-response-with-easyalluvial_files/figure-html/unnamed-chunk-10-1.png&#34; width=&#34;1152&#34; /&gt;&lt;/p&gt;
&lt;p&gt;We can see that for the upper ranges of &lt;code&gt;lstat&lt;/code&gt; a pretty specific combination values is required from 8 feature variables from &lt;code&gt;medv&lt;/code&gt; until &lt;code&gt;tax&lt;/code&gt; only then begin the flows to scatter over the eintire range of the following variables. The lower range values of &lt;code&gt;lstat&lt;/code&gt; start to scatter at &lt;code&gt;crim&lt;/code&gt; or &lt;code&gt;dis&lt;/code&gt;. Interestingly there seems to be a set of houses that branches off from the other houses in the lower range of &lt;code&gt;lstat&lt;/code&gt; predictions already at the third feature, &lt;code&gt;age&lt;/code&gt;. We could potentially explore this further, as a reminder you can get the binned input data for each alluvial plot by calling &lt;code&gt;p$data_key&lt;/code&gt; and trace the variables of interest.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;caret-wrapper&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;&lt;code&gt;caret&lt;/code&gt; wrapper&lt;/h1&gt;
&lt;p&gt;&lt;code&gt;caret&lt;/code&gt; provides a uniformous interface for training and calling a lot of machine learning models as well as for calculating feature importance. &lt;code&gt;easyalluvial&lt;/code&gt; provides a function that wraps the above described workflow into one single call. Note that feature importance values are slightly different. &lt;code&gt;randomForest&lt;/code&gt; returns a combined importance for all levels of a factor variable while &lt;code&gt;caret&lt;/code&gt; splits them up. &lt;code&gt;tidy_imp()&lt;/code&gt; aggregates them and uses the maximum value of all values. This behaviour can be adjusted by passing another aggregating function to the &lt;code&gt;.f&lt;/code&gt; parameter.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;train = caret::train( lstat ~ .
                     , df
                     , method = &amp;#39;rf&amp;#39;
                     , trControl = caret::trainControl( method = &amp;#39;none&amp;#39; )
                     , importance = TRUE )

alluvial_model_response_caret(train, degree = 4, bins = 5
                              , stratum_label_size = 2.8)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2019-03-29-visualising-model-response-with-easyalluvial_files/figure-html/unnamed-chunk-11-1.png&#34; width=&#34;960&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;advantages&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Advantages&lt;/h1&gt;
&lt;p&gt;Model response alluvial plots can help us to get an immediate intuitive understanding how predictions of a certain range can be generated by the model. They can be understood by none-statistical stakeholders and invite the viewer to start exploring and question the decision making process of the model while also conveying an appreciation for the model complexity as flows branch out to the variables of lower feature importance.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;partial-dependence-plotting-method&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Partial Dependence Plotting Method&lt;/h1&gt;
&lt;p&gt;When simulating artificial data space we need to be aware that we will create data space that is outside the feature distribution space of our original training data. In this example we could be creating houses that cannot exist as such maybe a 5 square meter appartment with 10 bedrooms. We have to keep this in mind when interpretating the plot. Moreover by setting all the none-plotted values to median/mode we might also be creating observations outside the possible feature distribution space but this will be hidden and not foreseable even by somebody who has some subject matter expertise. Simply imagine how likely it would be if I meassurre a hundred different feautures of the inhabitants of a certain country how likely will it be that I find one person that is exactly the average for all of those measurements? So to alleviate this we can use the partial dependency plotting method:&lt;/p&gt;
&lt;ol style=&#34;list-style-type: decimal&#34;&gt;
&lt;li&gt;&lt;p&gt;construct the data space as described above, but instead of setting all none-plotted variables to median/mode we set them to the values found in the first row of the training data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Repeat 1. for each row&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use all data spaces to get model predictions&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Average model predictions&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Using this method we reduce the risk of simulating data outside the feature distribution space concerning the variables that are not plotted.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;pred = get_pdp_predictions(df, imp, m, degree = 4, bins = 5)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [=&amp;gt;---------------------------------------------------------------------] 3%
## [==&amp;gt;--------------------------------------------------------------------] 4%
## [==&amp;gt;--------------------------------------------------------------------] 5%
## [===&amp;gt;-------------------------------------------------------------------] 5%
## [===&amp;gt;-------------------------------------------------------------------] 6%
## [====&amp;gt;------------------------------------------------------------------] 7%
## [====&amp;gt;------------------------------------------------------------------] 8%
## [=====&amp;gt;-----------------------------------------------------------------] 8%
## [=====&amp;gt;-----------------------------------------------------------------] 9%
## [======&amp;gt;----------------------------------------------------------------] 9%
## [======&amp;gt;----------------------------------------------------------------] 10%
## [=======&amp;gt;---------------------------------------------------------------] 11%
## [=======&amp;gt;---------------------------------------------------------------] 12%
## [========&amp;gt;--------------------------------------------------------------] 12%
## [========&amp;gt;--------------------------------------------------------------] 13%
## [=========&amp;gt;-------------------------------------------------------------] 13%
## [=========&amp;gt;-------------------------------------------------------------] 14%
## [=========&amp;gt;-------------------------------------------------------------] 15%
## [==========&amp;gt;------------------------------------------------------------] 15%
## [==========&amp;gt;------------------------------------------------------------] 16%
## [===========&amp;gt;-----------------------------------------------------------] 16%
## [===========&amp;gt;-----------------------------------------------------------] 17%
## [===========&amp;gt;-----------------------------------------------------------] 18%
## [============&amp;gt;----------------------------------------------------------] 18%
## [============&amp;gt;----------------------------------------------------------] 19%
## [=============&amp;gt;---------------------------------------------------------] 19%
## [=============&amp;gt;---------------------------------------------------------] 20%
## [==============&amp;gt;--------------------------------------------------------] 21%
## [==============&amp;gt;--------------------------------------------------------] 22%
## [===============&amp;gt;-------------------------------------------------------] 22%
## [===============&amp;gt;-------------------------------------------------------] 23%
## [================&amp;gt;------------------------------------------------------] 23%
## [================&amp;gt;------------------------------------------------------] 24%
## [================&amp;gt;------------------------------------------------------] 25%
## [=================&amp;gt;-----------------------------------------------------] 25%
## [=================&amp;gt;-----------------------------------------------------] 26%
## [==================&amp;gt;----------------------------------------------------] 26%
## [==================&amp;gt;----------------------------------------------------] 27%
## [===================&amp;gt;---------------------------------------------------] 27%
## [===================&amp;gt;---------------------------------------------------] 28%
## [===================&amp;gt;---------------------------------------------------] 29%
## [====================&amp;gt;--------------------------------------------------] 29%
## [====================&amp;gt;--------------------------------------------------] 30%
## [=====================&amp;gt;-------------------------------------------------] 30%
## [=====================&amp;gt;-------------------------------------------------] 31%
## [=====================&amp;gt;-------------------------------------------------] 32%
## [======================&amp;gt;------------------------------------------------] 32%
## [======================&amp;gt;------------------------------------------------] 33%
## [=======================&amp;gt;-----------------------------------------------] 33%
## [=======================&amp;gt;-----------------------------------------------] 34%
## [========================&amp;gt;----------------------------------------------] 35%
## [========================&amp;gt;----------------------------------------------] 36%
## [=========================&amp;gt;---------------------------------------------] 36%
## [=========================&amp;gt;---------------------------------------------] 37%
## [==========================&amp;gt;--------------------------------------------] 37%
## [==========================&amp;gt;--------------------------------------------] 38%
## [==========================&amp;gt;--------------------------------------------] 39%
## [===========================&amp;gt;-------------------------------------------] 39%
## [===========================&amp;gt;-------------------------------------------] 40%
## [============================&amp;gt;------------------------------------------] 40%
## [============================&amp;gt;------------------------------------------] 41%
## [============================&amp;gt;------------------------------------------] 42%
## [=============================&amp;gt;-----------------------------------------] 42%
## [=============================&amp;gt;-----------------------------------------] 43%
## [==============================&amp;gt;----------------------------------------] 43%
## [==============================&amp;gt;----------------------------------------] 44%
## [===============================&amp;gt;---------------------------------------] 44%
## [===============================&amp;gt;---------------------------------------] 45%
## [===============================&amp;gt;---------------------------------------] 46%
## [================================&amp;gt;--------------------------------------] 46%
## [================================&amp;gt;--------------------------------------] 47%
## [=================================&amp;gt;-------------------------------------] 47%
## [=================================&amp;gt;-------------------------------------] 48%
## [==================================&amp;gt;------------------------------------] 49%
## [==================================&amp;gt;------------------------------------] 50%
## [===================================&amp;gt;-----------------------------------] 50%
## [===================================&amp;gt;-----------------------------------] 51%
## [====================================&amp;gt;----------------------------------] 52%
## [====================================&amp;gt;----------------------------------] 53%
## [=====================================&amp;gt;---------------------------------] 53%
## [=====================================&amp;gt;---------------------------------] 54%
## [======================================&amp;gt;--------------------------------] 54%
## [======================================&amp;gt;--------------------------------] 55%
## [======================================&amp;gt;--------------------------------] 56%
## [=======================================&amp;gt;-------------------------------] 56%
## [=======================================&amp;gt;-------------------------------] 57%
## [========================================&amp;gt;------------------------------] 57%
## [========================================&amp;gt;------------------------------] 58%
## [=========================================&amp;gt;-----------------------------] 58%
## [=========================================&amp;gt;-----------------------------] 59%
## [=========================================&amp;gt;-----------------------------] 60%
## [==========================================&amp;gt;----------------------------] 60%
## [==========================================&amp;gt;----------------------------] 61%
## [===========================================&amp;gt;---------------------------] 61%
## [===========================================&amp;gt;---------------------------] 62%
## [===========================================&amp;gt;---------------------------] 63%
## [============================================&amp;gt;--------------------------] 63%
## [============================================&amp;gt;--------------------------] 64%
## [=============================================&amp;gt;-------------------------] 64%
## [=============================================&amp;gt;-------------------------] 65%
## [==============================================&amp;gt;------------------------] 66%
## [==============================================&amp;gt;------------------------] 67%
## [===============================================&amp;gt;-----------------------] 67%
## [===============================================&amp;gt;-----------------------] 68%
## [================================================&amp;gt;----------------------] 68%
## [================================================&amp;gt;----------------------] 69%
## [================================================&amp;gt;----------------------] 70%
## [=================================================&amp;gt;---------------------] 70%
## [=================================================&amp;gt;---------------------] 71%
## [==================================================&amp;gt;--------------------] 71%
## [==================================================&amp;gt;--------------------] 72%
## [==================================================&amp;gt;--------------------] 73%
## [===================================================&amp;gt;-------------------] 73%
## [===================================================&amp;gt;-------------------] 74%
## [====================================================&amp;gt;------------------] 74%
## [====================================================&amp;gt;------------------] 75%
## [=====================================================&amp;gt;-----------------] 75%
## [=====================================================&amp;gt;-----------------] 76%
## [=====================================================&amp;gt;-----------------] 77%
## [======================================================&amp;gt;----------------] 77%
## [======================================================&amp;gt;----------------] 78%
## [=======================================================&amp;gt;---------------] 78%
## [=======================================================&amp;gt;---------------] 79%
## [========================================================&amp;gt;--------------] 80%
## [========================================================&amp;gt;--------------] 81%
## [=========================================================&amp;gt;-------------] 81%
## [=========================================================&amp;gt;-------------] 82%
## [==========================================================&amp;gt;------------] 82%
## [==========================================================&amp;gt;------------] 83%
## [==========================================================&amp;gt;------------] 84%
## [===========================================================&amp;gt;-----------] 84%
## [===========================================================&amp;gt;-----------] 85%
## [============================================================&amp;gt;----------] 85%
## [============================================================&amp;gt;----------] 86%
## [============================================================&amp;gt;----------] 87%
## [=============================================================&amp;gt;---------] 87%
## [=============================================================&amp;gt;---------] 88%
## [==============================================================&amp;gt;--------] 88%
## [==============================================================&amp;gt;--------] 89%
## [===============================================================&amp;gt;-------] 90%
## [===============================================================&amp;gt;-------] 91%
## [================================================================&amp;gt;------] 91%
## [================================================================&amp;gt;------] 92%
## [=================================================================&amp;gt;-----] 92%
## [=================================================================&amp;gt;-----] 93%
## [==================================================================&amp;gt;----] 94%
## [==================================================================&amp;gt;----] 95%
## [===================================================================&amp;gt;---] 95%
## [===================================================================&amp;gt;---] 96%
## [====================================================================&amp;gt;--] 97%
## [====================================================================&amp;gt;--] 98%
## [=====================================================================&amp;gt;-] 98%
## [=====================================================================&amp;gt;-] 99%
## [======================================================================&amp;gt;] 99%
## [======================================================================&amp;gt;] 100%
## [=======================================================================] 100%&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;alluvial_model_response(pred, dspace, imp, degree = 4
                        , method = &amp;#39;pdp&amp;#39; # changes title and caption
                        , stratum_label_size = 2.8 )&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2019-03-29-visualising-model-response-with-easyalluvial_files/figure-html/pdp-1.png&#34; width=&#34;960&#34; /&gt;&lt;/p&gt;
&lt;p&gt;thanks to the uniformous modelling interface of &lt;code&gt;caret&lt;/code&gt; &lt;code&gt;alluvial_model_response_caret()&lt;/code&gt; can call &lt;code&gt;get_pdp_predictions()&lt;/code&gt; directly.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;alluvial_model_response_caret(train, degree = 4, bins = 5
                              , method = &amp;#39;pdp&amp;#39;
                              , stratum_label_size = 2.8 )&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [=&amp;gt;---------------------------------------------------------------------] 3%
## [==&amp;gt;--------------------------------------------------------------------] 4%
## [==&amp;gt;--------------------------------------------------------------------] 5%
## [===&amp;gt;-------------------------------------------------------------------] 5%
## [===&amp;gt;-------------------------------------------------------------------] 6%
## [====&amp;gt;------------------------------------------------------------------] 7%
## [====&amp;gt;------------------------------------------------------------------] 8%
## [=====&amp;gt;-----------------------------------------------------------------] 8%
## [=====&amp;gt;-----------------------------------------------------------------] 9%
## [======&amp;gt;----------------------------------------------------------------] 9%
## [======&amp;gt;----------------------------------------------------------------] 10%
## [=======&amp;gt;---------------------------------------------------------------] 11%
## [=======&amp;gt;---------------------------------------------------------------] 12%
## [========&amp;gt;--------------------------------------------------------------] 12%
## [========&amp;gt;--------------------------------------------------------------] 13%
## [=========&amp;gt;-------------------------------------------------------------] 13%
## [=========&amp;gt;-------------------------------------------------------------] 14%
## [=========&amp;gt;-------------------------------------------------------------] 15%
## [==========&amp;gt;------------------------------------------------------------] 15%
## [==========&amp;gt;------------------------------------------------------------] 16%
## [===========&amp;gt;-----------------------------------------------------------] 16%
## [===========&amp;gt;-----------------------------------------------------------] 17%
## [===========&amp;gt;-----------------------------------------------------------] 18%
## [============&amp;gt;----------------------------------------------------------] 18%
## [============&amp;gt;----------------------------------------------------------] 19%
## [=============&amp;gt;---------------------------------------------------------] 19%
## [=============&amp;gt;---------------------------------------------------------] 20%
## [==============&amp;gt;--------------------------------------------------------] 21%
## [==============&amp;gt;--------------------------------------------------------] 22%
## [===============&amp;gt;-------------------------------------------------------] 22%
## [===============&amp;gt;-------------------------------------------------------] 23%
## [================&amp;gt;------------------------------------------------------] 23%
## [================&amp;gt;------------------------------------------------------] 24%
## [================&amp;gt;------------------------------------------------------] 25%
## [=================&amp;gt;-----------------------------------------------------] 25%
## [=================&amp;gt;-----------------------------------------------------] 26%
## [==================&amp;gt;----------------------------------------------------] 26%
## [==================&amp;gt;----------------------------------------------------] 27%
## [===================&amp;gt;---------------------------------------------------] 27%
## [===================&amp;gt;---------------------------------------------------] 28%
## [===================&amp;gt;---------------------------------------------------] 29%
## [====================&amp;gt;--------------------------------------------------] 29%
## [====================&amp;gt;--------------------------------------------------] 30%
## [=====================&amp;gt;-------------------------------------------------] 30%
## [=====================&amp;gt;-------------------------------------------------] 31%
## [=====================&amp;gt;-------------------------------------------------] 32%
## [======================&amp;gt;------------------------------------------------] 32%
## [======================&amp;gt;------------------------------------------------] 33%
## [=======================&amp;gt;-----------------------------------------------] 33%
## [=======================&amp;gt;-----------------------------------------------] 34%
## [========================&amp;gt;----------------------------------------------] 35%
## [========================&amp;gt;----------------------------------------------] 36%
## [=========================&amp;gt;---------------------------------------------] 36%
## [=========================&amp;gt;---------------------------------------------] 37%
## [==========================&amp;gt;--------------------------------------------] 37%
## [==========================&amp;gt;--------------------------------------------] 38%
## [==========================&amp;gt;--------------------------------------------] 39%
## [===========================&amp;gt;-------------------------------------------] 39%
## [===========================&amp;gt;-------------------------------------------] 40%
## [============================&amp;gt;------------------------------------------] 40%
## [============================&amp;gt;------------------------------------------] 41%
## [============================&amp;gt;------------------------------------------] 42%
## [=============================&amp;gt;-----------------------------------------] 42%
## [=============================&amp;gt;-----------------------------------------] 43%
## [==============================&amp;gt;----------------------------------------] 43%
## [==============================&amp;gt;----------------------------------------] 44%
## [===============================&amp;gt;---------------------------------------] 44%
## [===============================&amp;gt;---------------------------------------] 45%
## [===============================&amp;gt;---------------------------------------] 46%
## [================================&amp;gt;--------------------------------------] 46%
## [================================&amp;gt;--------------------------------------] 47%
## [=================================&amp;gt;-------------------------------------] 47%
## [=================================&amp;gt;-------------------------------------] 48%
## [==================================&amp;gt;------------------------------------] 49%
## [==================================&amp;gt;------------------------------------] 50%
## [===================================&amp;gt;-----------------------------------] 50%
## [===================================&amp;gt;-----------------------------------] 51%
## [====================================&amp;gt;----------------------------------] 52%
## [====================================&amp;gt;----------------------------------] 53%
## [=====================================&amp;gt;---------------------------------] 53%
## [=====================================&amp;gt;---------------------------------] 54%
## [======================================&amp;gt;--------------------------------] 54%
## [======================================&amp;gt;--------------------------------] 55%
## [======================================&amp;gt;--------------------------------] 56%
## [=======================================&amp;gt;-------------------------------] 56%
## [=======================================&amp;gt;-------------------------------] 57%
## [========================================&amp;gt;------------------------------] 57%
## [========================================&amp;gt;------------------------------] 58%
## [=========================================&amp;gt;-----------------------------] 58%
## [=========================================&amp;gt;-----------------------------] 59%
## [=========================================&amp;gt;-----------------------------] 60%
## [==========================================&amp;gt;----------------------------] 60%
## [==========================================&amp;gt;----------------------------] 61%
## [===========================================&amp;gt;---------------------------] 61%
## [===========================================&amp;gt;---------------------------] 62%
## [===========================================&amp;gt;---------------------------] 63%
## [============================================&amp;gt;--------------------------] 63%
## [============================================&amp;gt;--------------------------] 64%
## [=============================================&amp;gt;-------------------------] 64%
## [=============================================&amp;gt;-------------------------] 65%
## [==============================================&amp;gt;------------------------] 66%
## [==============================================&amp;gt;------------------------] 67%
## [===============================================&amp;gt;-----------------------] 67%
## [===============================================&amp;gt;-----------------------] 68%
## [================================================&amp;gt;----------------------] 68%
## [================================================&amp;gt;----------------------] 69%
## [================================================&amp;gt;----------------------] 70%
## [=================================================&amp;gt;---------------------] 70%
## [=================================================&amp;gt;---------------------] 71%
## [==================================================&amp;gt;--------------------] 71%
## [==================================================&amp;gt;--------------------] 72%
## [==================================================&amp;gt;--------------------] 73%
## [===================================================&amp;gt;-------------------] 73%
## [===================================================&amp;gt;-------------------] 74%
## [====================================================&amp;gt;------------------] 74%
## [====================================================&amp;gt;------------------] 75%
## [=====================================================&amp;gt;-----------------] 75%
## [=====================================================&amp;gt;-----------------] 76%
## [=====================================================&amp;gt;-----------------] 77%
## [======================================================&amp;gt;----------------] 77%
## [======================================================&amp;gt;----------------] 78%
## [=======================================================&amp;gt;---------------] 78%
## [=======================================================&amp;gt;---------------] 79%
## [========================================================&amp;gt;--------------] 80%
## [========================================================&amp;gt;--------------] 81%
## [=========================================================&amp;gt;-------------] 81%
## [=========================================================&amp;gt;-------------] 82%
## [==========================================================&amp;gt;------------] 82%
## [==========================================================&amp;gt;------------] 83%
## [==========================================================&amp;gt;------------] 84%
## [===========================================================&amp;gt;-----------] 84%
## [===========================================================&amp;gt;-----------] 85%
## [============================================================&amp;gt;----------] 85%
## [============================================================&amp;gt;----------] 86%
## [============================================================&amp;gt;----------] 87%
## [=============================================================&amp;gt;---------] 87%
## [=============================================================&amp;gt;---------] 88%
## [==============================================================&amp;gt;--------] 88%
## [==============================================================&amp;gt;--------] 89%
## [===============================================================&amp;gt;-------] 90%
## [===============================================================&amp;gt;-------] 91%
## [================================================================&amp;gt;------] 91%
## [================================================================&amp;gt;------] 92%
## [=================================================================&amp;gt;-----] 92%
## [=================================================================&amp;gt;-----] 93%
## [==================================================================&amp;gt;----] 94%
## [==================================================================&amp;gt;----] 95%
## [===================================================================&amp;gt;---] 95%
## [===================================================================&amp;gt;---] 96%
## [====================================================================&amp;gt;--] 97%
## [====================================================================&amp;gt;--] 98%
## [=====================================================================&amp;gt;-] 98%
## [=====================================================================&amp;gt;-] 99%
## [======================================================================&amp;gt;] 99%
## [======================================================================&amp;gt;] 100%
## [=======================================================================] 100%&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2019-03-29-visualising-model-response-with-easyalluvial_files/figure-html/pdp_caret-1.png&#34; width=&#34;960&#34; /&gt;&lt;/p&gt;
&lt;div id=&#34;a-note-on-feature-importance&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;A note on feature importance&lt;/h2&gt;
&lt;p&gt;Calculating feature importance in a dataset with strongly correlating variables will lead to inacurrate results. It usually means that two strongly correlating variables share the importance that would be accredited to them if only one of them was present in the data set. Further some feature importance calculation methods require the model to be trained with scaled, centered and potentially normalized (transformed to be more normally distributed) numerical variables in order to deliver meaningful results. We can use the &lt;code&gt;recipes&lt;/code&gt; package to perform these tasks. Using the below described workflow we can create the artifical dataspace with untransformed numerical values which will give us more meaningful output.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages( require(recipes) )


# filter correlating variables recipe- ------------------------------
# caret tends to complain if recipe filters any variables, therefore
# we use two recipes

rec_filt_corrs = recipe(df, lstat ~ . ) %&amp;gt;%
  step_corr( all_numeric()
             , - all_outcomes()
             , threshold = 0.7 ) %&amp;gt;%
  prep()


df_filt_corrs = bake(rec_filt_corrs, df)

# transformation recipe --------------------------------------------
rec_trans = recipe( df_filt_corrs, lstat ~ .) %&amp;gt;%
  step_center( all_numeric(), - all_outcomes() ) %&amp;gt;%
  step_scale( all_numeric(), - all_outcomes() ) %&amp;gt;%
  step_YeoJohnson( all_numeric(), - all_outcomes() ) %&amp;gt;%
  prep()

# train and plot ---------------------------------------------------
set.seed(1)
train = caret::train( rec_trans
                     , df_filt_corrs
                     , method = &amp;#39;earth&amp;#39;
                     , trControl = caret::trainControl( method = &amp;#39;cv&amp;#39;
                                                        , search = &amp;#39;random&amp;#39;)
                     , tuneLength = 100)

pred_train = predict(train, df_filt_corrs)

p = alluvial_model_response_caret(train, degree = 4, bins = 5
                                  , pred_train = pred_train
                                  , stratum_label_size = 2.8 )

p_grid = add_marginal_histograms(p, df, plot = F
                                 , pred_var = &amp;#39;lstat&amp;#39;
                                 , scale = 50) %&amp;gt;%
  add_imp_plot(p, df)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2019-03-29-visualising-model-response-with-easyalluvial_files/figure-html/unnamed-chunk-12-1.png&#34; width=&#34;1152&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;none-regression-models&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;None-regression models&lt;/h2&gt;
&lt;p&gt;Works the same way.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df = select(mtcars2, -ids)
m = randomForest::randomForest( am ~ ., df)
imp = m$importance
dspace = get_data_space(df, imp, degree = 3)

pred = predict(m, newdata = dspace,type = &amp;#39;response&amp;#39;)
p = alluvial_model_response(pred, dspace, imp, degree = 3)
p&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2019-03-29-visualising-model-response-with-easyalluvial_files/figure-html/unnamed-chunk-13-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;limitations&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Limitations&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;There is a loss of information when binning the numerical variables&lt;/li&gt;
&lt;li&gt;The combinations generated when making the grid might be outside the feature distribution space (generate combinations that are impossible)&lt;/li&gt;
&lt;li&gt;We only look at the combination of 4 features and disregard the others&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To alleviate this you can reduce the complexity of the model by reducing features (take out correlating variables) or use additional model exploration methods such as classical PDPs, ALE plots, Shapely values, etc, …&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Easyalluvial 0.2.0 released</title>
      <link>https://www.datisticsblog.com/2019/04/easyalluvial-0-2-0-released/</link>
      <pubDate>Mon, 01 Apr 2019 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2019/04/easyalluvial-0-2-0-released/</guid>
      <description>


&lt;p&gt;&lt;code&gt;easyalluvial&lt;/code&gt; allows you to build exploratory alluvial plots (sankey diagrams) with a single line of code while automatically binning numerical variables. In version &lt;code&gt;0.2.0&lt;/code&gt; marginal histograms improve the visibility of those numerical variables. Further a method has been added that creates model agnostic 4 dimensional partial dependence alluvial plots to visualise the response of statistical models.&lt;/p&gt;
&lt;div id=&#34;introduction&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;I am happy to announce the release of &lt;code&gt;easyalluvial 0.2.0&lt;/code&gt; with some exciting new features and some minor changes compared to version &lt;code&gt;0.1.8&lt;/code&gt; Some improvements were made on the default plotting options with improved colors and label size.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages( require(tidyverse) )
suppressPackageStartupMessages( require(easyalluvial) )&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;marginal-histograms&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Marginal Histograms&lt;/h1&gt;
&lt;p&gt;The automated binning of numerical variables hides their distribution. This new feature alleviates that.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p = alluvial_wide(mtcars2, max_variables = 9)

p_grid = add_marginal_histograms(p, mtcars2)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2019-04-01-easyalluvial-0-2-0-released_files/figure-html/unnamed-chunk-2-1.png&#34; width=&#34;960&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;partial-dependence-alluvial-plots-with-4-dimensions&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Partial Dependence Alluvial Plots with 4 dimensions&lt;/h1&gt;
&lt;p&gt;Alluvial plots are capable of displaying higher dimensional data on a plane, thus lend themselves to plot the response of a statistical model to changes in the input data across multiple dimensions. The practical limit here is 4 dimensions while conventional partial dependence plots are limited to 2 dimensions.&lt;/p&gt;
&lt;p&gt;Briefly the 4 variables with the highest feature importance for a given model are selected and 5 values spread over the variable range are selected for each. Then a grid of all possible combinations is created. All none-plotted variables are set to the values found in the first row of the training data set. Using this artificial data space model predictions are being generated. This process is then repeated for each row in the training data set and the overall model response is averaged in the end. Each of the possible combinations is plotted as a flow which is coloured by the bin corresponding to the average model response generated by that particular combination.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://christophm.github.io/interpretable-ml-book/&#34;&gt;more on partial dependence plots (ebook)&lt;/a&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df = select(mtcars2, -ids)

train = caret::train( disp ~ .
                      ,  df
                      , method = &amp;#39;rf&amp;#39;
                      , trControl = caret::trainControl( method = &amp;#39;none&amp;#39; )
                      , importance = TRUE )


p = alluvial_model_response_caret(train, degree = 4, method = &amp;#39;pdp&amp;#39;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [======================================================&amp;gt;----------------] 78%
## [=========================================================&amp;gt;-------------] 81%
## [===========================================================&amp;gt;-----------] 84%
## [=============================================================&amp;gt;---------] 88%
## [===============================================================&amp;gt;-------] 91%
## [==================================================================&amp;gt;----] 94%
## [====================================================================&amp;gt;--] 97%
## [=======================================================================] 100%&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p_grid = add_marginal_histograms(p, df, plot = F) %&amp;gt;%
  add_imp_plot(p, df)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2019-04-01-easyalluvial-0-2-0-released_files/figure-html/unnamed-chunk-3-1.png&#34; width=&#34;1152&#34; /&gt;&lt;/p&gt;
&lt;p&gt;We see that the top 4 important features of the model have been selected and that 5 values have been picked over the range of the numerical variables which together with the levels of the categorical variable have been used to construct a data grid of all possible combinations.&lt;/p&gt;
&lt;div id=&#34;step-by-step&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Step-by-Step&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;On the left we see the averaged model predictions that are generated by a specific combination of the 4 most important variables. You can find the combinations by tracing the coloured flows.&lt;/li&gt;
&lt;li&gt;The stratum label of the individual feature variables indicate the variable value and which fraction of the colored flows pass through it.&lt;/li&gt;
&lt;li&gt;On the right you see the feature importance of all variables and the proportion contributed by the plotted variables on the alluvial plot.&lt;/li&gt;
&lt;li&gt;On the top left you see how the distribution of the generated predictions compare to the distribution of the predicted variable (in this case disp) in the training data.&lt;/li&gt;
&lt;li&gt;The marginal histograms indicate the original distributions in the raining data and the lines indicate the location of the values picked for the data grid.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A more in-depth tutorial for this feature can be found on the &lt;a href=&#34;https://github.com/erblast/easyalluvial&#34;&gt;project’s github page&lt;/a&gt; which will also be vailable on this blog in a few days.&lt;/p&gt;
&lt;p&gt;If you are as enthusiastic about alluvial plots as me you will appreciate partial dependency alluvial plots because they can help us to get an immediate intuitive understanding how predictions of a certain range can be generated by the model. They can be understood by none-statistical stakeholders and invite the viewer to start exploring and question the decision making process of the model while also conveying an appreciation for the model complexity as flows branch out to the variables of lower feature importance. Ther are limitations though.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;limitations&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Limitations&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;There is a loss of information when binning the numerical variables&lt;/li&gt;
&lt;li&gt;The combinations generated when making the grid might be outside the feature distribution space (generate combinations that are impossible)&lt;/li&gt;
&lt;li&gt;We only look at the combination of 4 features and disregard the others&lt;/li&gt;
&lt;li&gt;For a better interpretability of the feature importance it is adivable to remove strongly correlating variables and to scale, center and transform (Yeo-Johnson, Box-Cox) numerical variables, depending on the statistical model.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To alleviate this you can reduce the complexity of the model by reducing features (take out correlating variables) or use additional model exploration methods such as classical PDPs, ALE plots, Shapely values, etc, …&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;we-do-not-have-to-use-caret&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;We do not have to use &lt;code&gt;caret&lt;/code&gt;&lt;/h4&gt;
&lt;p&gt;&lt;em&gt;Note: importance is calculated differently when using this implementation of random forest.&lt;/em&gt;&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df = select(mtcars2, -ids)
m = randomForest::randomForest( disp ~ ., df)
imp = m$importance

dspace = get_data_space(df, imp, degree = 4)

pred = get_pdp_predictions(df, imp
                           , m
                           , degree = 4
                           , bins = 5)


p = alluvial_model_response(pred, dspace, imp, degree = 4, method = &amp;#39;pdp&amp;#39;)

p_grid = add_marginal_histograms(p, df, plot = F) %&amp;gt;%
  add_imp_plot(p, df)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;changes-in-default-plotting-settings&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Changes in Default Plotting Settings&lt;/h1&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Default colors have been changed. The first 7 colors of &lt;code&gt;palette_qualitative()&lt;/code&gt; the function that provides the default colors have hand-picked for better contrast.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The stratum fill color of the variable determining the flow fill color in &lt;code&gt;alluvial_wide()&lt;/code&gt; hast been set to match the flow fill color.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;label text size can now be modified via &lt;code&gt;stratum_label_size&lt;/code&gt; parameter. Labels have gotten slightly bigger by default.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;more-changes&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;More changes&lt;/h1&gt;
&lt;p&gt;… &lt;a href=&#34;https://github.com/erblast/easyalluvial/blob/master/NEWS.md&#34;&gt;NEWS.md&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Tidymodels</title>
      <link>https://www.datisticsblog.com/2018/12/tidymodels/</link>
      <pubDate>Sat, 29 Dec 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/12/tidymodels/</guid>
      <description>

&lt;div id=&#34;TOC&#34;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#introduction&#34;&gt;Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#packages&#34;&gt;Packages&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#cran-availability-of-tidymodels-packages&#34;&gt;CRAN availability of tidymodels packages:&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#unified-modelling-syntax&#34;&gt;Unified Modelling Syntax&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#statistical-tests-and-model-selection&#34;&gt;Statistical Tests and Model Selection&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#resampling-feature-engineering-and-performance-metrics&#34;&gt;Resampling, Feature Engineering and Performance Metrics&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#modeling&#34;&gt;Modeling&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#data&#34;&gt;Data&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#response-variable-lstat&#34;&gt;Response Variable lstat&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#correlations&#34;&gt;Correlations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#lstat-vs-categorical-variables&#34;&gt;lstat vs categorical variables&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#preprocessing-with-recipe&#34;&gt;Preprocessing with recipe&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#summary-recipe&#34;&gt;Summary Recipe&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#resampling-with-rsample&#34;&gt;Resampling with rsample&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#modelling-with-caret&#34;&gt;Modelling with caret&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#wrapper&#34;&gt;Wrapper&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#apply-wrapper&#34;&gt;Apply Wrapper&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#assess-performance-with-yardstick&#34;&gt;Assess Performance with yardstick&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#parameters-as-string&#34;&gt;Parameters as string&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#get-best-performing-model-for-each-method&#34;&gt;Get best performing model for each method&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#get-cv-performance&#34;&gt;Get cv-performance&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#get-1se-stats&#34;&gt;Get 1SE stats&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#plot&#34;&gt;Plot&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;https://avatars0.githubusercontent.com/u/29100987?s=400&amp;amp;v=4&#34; style=&#34;width: 360px;height: 360px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;div id=&#34;introduction&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;RStudio is expanding the &lt;code&gt;tidyverse&lt;/code&gt; principles to modelling with R and is building up another metapackage called &lt;code&gt;tidymodels&lt;/code&gt;. There are a number of packages at different stages in their development. I am already familiar with &lt;code&gt;rsample&lt;/code&gt; and &lt;code&gt;recipes&lt;/code&gt; and have tried to implement them in a tidy &lt;code&gt;caret&lt;/code&gt;-based modelling workflow before.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;http://rpubs.com/erblast/370014&#34;&gt;rsample&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://rpubs.com/erblast/recipes&#34;&gt;recipes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://rpubs.com/erblast/caret&#34;&gt;caret&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://rpubs.com/erblast/rlm&#34;&gt;01 robust linear regression, &lt;code&gt;rlm&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://rpubs.com/erblast/nnet&#34;&gt;02 neuronal networks, &lt;code&gt;nnet&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;http://rpubs.com/erblast/mars&#34;&gt;03 multiviariate adaptive regession splines (MARS), &lt;code&gt;earth&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The goal of this post is to check up on all the different packages and try build up a regression modelling workflow using all the appropriate &lt;code&gt;tidymodels&lt;/code&gt; tools as soon as they become available at CRAN for I think that this indicates that the authors were confident enough that their package has reached an acceptable stage of maturity.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;packages&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Packages&lt;/h1&gt;
&lt;div id=&#34;cran-availability-of-tidymodels-packages&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;CRAN availability of tidymodels packages:&lt;/h2&gt;
&lt;table&gt;
&lt;colgroup&gt;
&lt;col width=&#34;13%&#34; /&gt;
&lt;col width=&#34;12%&#34; /&gt;
&lt;col width=&#34;74%&#34; /&gt;
&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th align=&#34;center&#34;&gt;package&lt;/th&gt;
&lt;th align=&#34;center&#34;&gt;CRAN&lt;/th&gt;
&lt;th&gt;description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;center&#34;&gt;&lt;a href=&#34;https://github.com/tidymodels/broom&#34;&gt;broom&lt;/a&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;&lt;img src=&#34;https://camo.githubusercontent.com/97cfe4eed016306ddef0c8c9f7b5117209864fa0/68747470733a2f2f7777772e722d706b672e6f72672f6261646765732f76657273696f6e2f62726f6f6d&#34; /&gt;&lt;/td&gt;
&lt;td&gt;Convert statistical analysis objects from R into tidy format&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;center&#34;&gt;&lt;a href=&#34;https://github.com/tidymodels/rsample&#34;&gt;rsample&lt;/a&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;&lt;img src=&#34;https://camo.githubusercontent.com/40d243e534462d1bb0f57582d6166bde2217600a/687474703a2f2f7777772e722d706b672e6f72672f6261646765732f76657273696f6e2f7273616d706c65&#34; /&gt;&lt;/td&gt;
&lt;td&gt;Classes and functions to create and summarize different types of resampling objects&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;center&#34;&gt;&lt;a href=&#34;https://github.com/tidymodels/dials&#34;&gt;dials&lt;/a&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;&lt;img src=&#34;https://camo.githubusercontent.com/043eff6bfe9f7e184992d7b1b98fb0a606cae637/687474703a2f2f7777772e722d706b672e6f72672f6261646765732f76657273696f6e2f6469616c73&#34; /&gt;&lt;/td&gt;
&lt;td&gt;Tools for creating tuning parameter values&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;center&#34;&gt;&lt;a href=&#34;https://github.com/tidymodels/textrecipes&#34;&gt;textrecipes&lt;/a&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;&lt;img src=&#34;https://camo.githubusercontent.com/2b21e19013ec07e871c8e97a5e39f1e40b28380e/687474703a2f2f7777772e722d706b672e6f72672f6261646765732f76657273696f6e2f7465787472656369706573&#34; /&gt;&lt;/td&gt;
&lt;td&gt;Extra recipes for Text Processing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;center&#34;&gt;&lt;a href=&#34;https://github.com/tidymodels/yardstick&#34;&gt;yardstick&lt;/a&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;&lt;img src=&#34;https://camo.githubusercontent.com/a5709f4f9006e7ea171215992f2169bf2287b5ea/687474703a2f2f7777772e722d706b672e6f72672f6261646765732f76657273696f6e2f79617264737469636b&#34; /&gt;&lt;/td&gt;
&lt;td&gt;Tidy methods for measuring model performance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;center&#34;&gt;&lt;a href=&#34;https://github.com/tidymodels/parsnip&#34;&gt;parsnip&lt;/a&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;NR&lt;/td&gt;
&lt;td&gt;A tidy unified interface to models&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;center&#34;&gt;&lt;a href=&#34;https://github.com/tidymodels/probably&#34;&gt;probably&lt;/a&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;NR&lt;/td&gt;
&lt;td&gt;Tools for post-processing class probability estimates&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;center&#34;&gt;&lt;a href=&#34;https://github.com/tidymodels/recipes&#34;&gt;recipes&lt;/a&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;&lt;img src=&#34;https://camo.githubusercontent.com/a4a610c9ff09c39f8259e20babd337729f4e64f4/687474703a2f2f7777772e722d706b672e6f72672f6261646765732f76657273696f6e2f72656369706573&#34; /&gt;&lt;/td&gt;
&lt;td&gt;A preprocessing engine to generate design matrices&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;center&#34;&gt;&lt;a href=&#34;https://github.com/tidymodels/embed&#34;&gt;embed&lt;/a&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;&lt;img src=&#34;https://camo.githubusercontent.com/f6f2e71cfecf8ef8ef5217c540242a6e00335c90/687474703a2f2f7777772e722d706b672e6f72672f6261646765732f76657273696f6e2f656d626564&#34; /&gt;&lt;/td&gt;
&lt;td&gt;Extra recipes for categorical predictor embeddings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;center&#34;&gt;&lt;a href=&#34;https://github.com/tidymodels/infer&#34;&gt;infer&lt;/a&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;&lt;img src=&#34;https://camo.githubusercontent.com/5b1585b43095a5e27649e6a8c3a8aedf87a63390/687474703a2f2f7777772e722d706b672e6f72672f6261646765732f76657273696f6e2f696e666572&#34; /&gt;&lt;/td&gt;
&lt;td&gt;An R package for tidyverse-friendly statistical inference&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;center&#34;&gt;&lt;a href=&#34;https://github.com/tidymodels/tidyposterior&#34;&gt;tidyposterior&lt;/a&gt;&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;&lt;img src=&#34;https://camo.githubusercontent.com/a27ef7d0f07997d04e5f98d2f8bc048ac29e0b4b/687474703a2f2f7777772e722d706b672e6f72672f6261646765732f76657273696f6e2f74696479706f73746572696f72&#34; /&gt;&lt;/td&gt;
&lt;td&gt;Bayesian comparisons of models using resampled statistics&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div id=&#34;unified-modelling-syntax&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Unified Modelling Syntax&lt;/h2&gt;
&lt;p&gt;The declared goal of the &lt;code&gt;tidymodels&lt;/code&gt; metapackage is to provide a unified modelling synthax similar to &lt;code&gt;scikit-learn&lt;/code&gt; in the &lt;code&gt;python&lt;/code&gt; domain or an improved version of &lt;code&gt;caret&lt;/code&gt; but adhering to the &lt;code&gt;tidyverse&lt;/code&gt; principles. &lt;code&gt;parsnip&lt;/code&gt; is going to be the core package while &lt;code&gt;dials&lt;/code&gt; will provide suitable objects and functions for parameter tuning. The amount of supported models is still a bit meager so we will not explore these packages any further for the moment.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;statistical-tests-and-model-selection&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Statistical Tests and Model Selection&lt;/h2&gt;
&lt;p&gt;The regular statistical test supported by &lt;code&gt;R&lt;/code&gt; have the same problem as the modelling implementations, they lack a uniform &lt;code&gt;tidyverse&lt;/code&gt; compatible synthax. Further traditional statistical tests have lately gotten a bit out of fashion. The following criticism keeps popping up:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Specific statistical requirements for each test.&lt;/strong&gt; The strategies for selecting the right statistical tests are a bit convoluted and a certain set of statistical requirements need to be full-filled for each of them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Interpretation of P Values.&lt;/strong&gt; There is a pickiness when it comes to interpreting P Values, the perfect definition eludes me and is completly useless to a none-statistician. Allen Downey has a refreshing practical approach to P values in which he uses a bayesian approach to show that indeed &lt;em&gt;from small p values (&amp;lt;= 0.01) one can conlude that the observed effect has a low probability to be the result of chance&lt;/em&gt; &lt;a href=&#34;http://allendowney.blogspot.com/2015/05/hypothesis-testing-is-only-mostly.html&#34;&gt;(post)&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Disregard of Effect Size.&lt;/strong&gt; If we have a large sample even irrelevant effects will result in low p-values and if we have a small sample only very large effects will result in low p-values. If we detect a relevant effect with a low p-value we cannot be sure that the magnitude of the effect is reproducible. Typically the effect size will decrease the larger the sample. The Null hypothesis does not incorporate a minimum effect size.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As a remedy for the issue of the convoluted statisical requirements for each test a workaround has again been proposed by Allen Downey. He proposes to simulate data that assumes that there is no connection between two hypothetical sets of data that we want to compare (the null hypothesis is true). ( &lt;a href=&#34;http://allendowney.blogspot.com/2011/05/there-is-only-one-test.html&#34;&gt;post1&lt;/a&gt;, &lt;a href=&#34;https://feedly.com/i/entry/B+zx48A60dYhZn8V2dBcpwOiRYnIVsqskPVFCv6/PS4=_1552b4aba08:50249e5:db10177e&#34;&gt;post2&lt;/a&gt; ). Similar to bootstrapping this method is none-parametric and we can use the simulated data to calculate a set of summary statistics. Then we can compare the distribution of these statistics against the actual value. &lt;code&gt;infer&lt;/code&gt; allows us to do just that and on-top offers a tidy synthax to the conventional &lt;code&gt;R&lt;/code&gt; implementations of standard statistical tests.&lt;/p&gt;
&lt;p&gt;However even the simulation technique does not really help us to judge the effect size properly. This is something that can be adressed using bayesian modelling techniques, which will provide you with a posterior distribution of your response variable which allows you to sufficiently judge the effect size.&lt;/p&gt;
&lt;p&gt;When using any k-fold cross-validation strategy for model training and validation we can apply statistical tests on each set of k performance metrics to select the best performing model. In general we run into the same issues as discussed above. In order to adress them we can either use the simulation technique of the &lt;code&gt;infer&lt;/code&gt;package or use &lt;code&gt;tidyposterior&lt;/code&gt; which uses Bayesian modelling to compare performance metrics which allows us to define a relevant effect size to test against.&lt;/p&gt;
&lt;p&gt;In general I think &lt;code&gt;tidyposterior&lt;/code&gt; is probably best practise, however to reduce complexity I am personally quite happy with the &lt;a href=&#34;https://stats.stackexchange.com/questions/138569/why-is-lambda-within-one-standard-error-from-the-minimum-is-a-recommended-valu&#34;&gt;&lt;strong&gt;1 SE rule&lt;/strong&gt;&lt;/a&gt;. Simply plotting the mean value with the SE and then picking the simplest model that is within 1SE of the model with the highest performance. Thus I will not include these packages in my modelling workflow for the moment.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;resampling-feature-engineering-and-performance-metrics&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Resampling, Feature Engineering and Performance Metrics&lt;/h2&gt;
&lt;p&gt;&lt;code&gt;rsample&lt;/code&gt;, &lt;code&gt;recipes&lt;/code&gt; and &lt;code&gt;yardstick&lt;/code&gt; are packages that give an overall complete impression and can be used with &lt;code&gt;caret&lt;/code&gt;. &lt;code&gt;rsample&lt;/code&gt; allows us to create cross validation pairs by indexing an existing dataframe and facilitates the use of modelling dataframes. If supports a variety of resampling methods such as not only limited to k-fold cross validation but also bootstrapping and nested cross validation. &lt;code&gt;recipes&lt;/code&gt; allows straight forward feature engineering and preprocessing and &lt;code&gt;yardstick&lt;/code&gt; allows us to easily calculate performance metrics from model predictions.&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;modeling&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Modeling&lt;/h1&gt;
&lt;p&gt;We will fit the following regression models to the Boston Housing Data Set&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;xgbTree&lt;/li&gt;
&lt;li&gt;lm&lt;/li&gt;
&lt;li&gt;randomForest&lt;/li&gt;
&lt;li&gt;MARS&lt;/li&gt;
&lt;li&gt;Cubist&lt;/li&gt;
&lt;li&gt;CART tree&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For tuning we will use a randomized parameter search in a 5-fold cross validation&lt;/p&gt;
&lt;p&gt;We will use the following packages:
-&lt;code&gt;recipes&lt;/code&gt;
-&lt;code&gt;resample&lt;/code&gt;
-&lt;code&gt;caret&lt;/code&gt;
-&lt;code&gt;yardstick&lt;/code&gt;
-&lt;code&gt;easyalluvial&lt;/code&gt; (for color palette)&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages( library(&amp;#39;mlbench&amp;#39;) )
suppressPackageStartupMessages( library(&amp;#39;tidyverse&amp;#39;) )
suppressPackageStartupMessages( library(&amp;#39;recipes&amp;#39;) )
suppressPackageStartupMessages( library(&amp;#39;caret&amp;#39;) )
suppressPackageStartupMessages( library(&amp;#39;Hmisc&amp;#39;) )
suppressPackageStartupMessages( library(&amp;#39;xgboost&amp;#39;) )


# ggplot default theme
theme_set(theme_minimal())

# Register mutiple cores for parallel processing
suppressPackageStartupMessages( library(parallel) )
suppressPackageStartupMessages( library(doParallel) )
cluster &amp;lt;- makeCluster(detectCores() - 1) ## convention to leave 1 core for OS
registerDoParallel(cluster)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;```&lt;/p&gt;
&lt;div id=&#34;data&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Data&lt;/h2&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;data(&amp;#39;BostonHousing&amp;#39;)
df = as_tibble( BostonHousing )
summary(df)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;##       crim                zn             indus       chas         nox        
##  Min.   : 0.00632   Min.   :  0.00   Min.   : 0.46   0:471   Min.   :0.3850  
##  1st Qu.: 0.08205   1st Qu.:  0.00   1st Qu.: 5.19   1: 35   1st Qu.:0.4490  
##  Median : 0.25651   Median :  0.00   Median : 9.69           Median :0.5380  
##  Mean   : 3.61352   Mean   : 11.36   Mean   :11.14           Mean   :0.5547  
##  3rd Qu.: 3.67708   3rd Qu.: 12.50   3rd Qu.:18.10           3rd Qu.:0.6240  
##  Max.   :88.97620   Max.   :100.00   Max.   :27.74           Max.   :0.8710  
##        rm             age              dis              rad        
##  Min.   :3.561   Min.   :  2.90   Min.   : 1.130   Min.   : 1.000  
##  1st Qu.:5.886   1st Qu.: 45.02   1st Qu.: 2.100   1st Qu.: 4.000  
##  Median :6.208   Median : 77.50   Median : 3.207   Median : 5.000  
##  Mean   :6.285   Mean   : 68.57   Mean   : 3.795   Mean   : 9.549  
##  3rd Qu.:6.623   3rd Qu.: 94.08   3rd Qu.: 5.188   3rd Qu.:24.000  
##  Max.   :8.780   Max.   :100.00   Max.   :12.127   Max.   :24.000  
##       tax           ptratio            b              lstat      
##  Min.   :187.0   Min.   :12.60   Min.   :  0.32   Min.   : 1.73  
##  1st Qu.:279.0   1st Qu.:17.40   1st Qu.:375.38   1st Qu.: 6.95  
##  Median :330.0   Median :19.05   Median :391.44   Median :11.36  
##  Mean   :408.2   Mean   :18.46   Mean   :356.67   Mean   :12.65  
##  3rd Qu.:666.0   3rd Qu.:20.20   3rd Qu.:396.23   3rd Qu.:16.95  
##  Max.   :711.0   Max.   :22.00   Max.   :396.90   Max.   :37.97  
##       medv      
##  Min.   : 5.00  
##  1st Qu.:17.02  
##  Median :21.20  
##  Mean   :22.53  
##  3rd Qu.:25.00  
##  Max.   :50.00&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;response-variable-lstat&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Response Variable lstat&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p_hist = ggplot(df) +
  geom_histogram( aes(lstat) ) +
  lims( x = c(0,40) )

p_ecdf = ggplot(df) +
  stat_ecdf(aes(lstat) ) +
  lims( x = c(0,40) )

gridExtra::grid.arrange( p_hist, p_ecdf )&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-12-29-tidymodels_files/figure-html/unnamed-chunk-4-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;correlations&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Correlations&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df_cor = df %&amp;gt;%
  select_if( is.numeric ) %&amp;gt;%
  gather( key = &amp;#39;variable&amp;#39;, value = &amp;#39;value&amp;#39;, - lstat) %&amp;gt;%
  group_by(variable) %&amp;gt;%
  nest() %&amp;gt;%
  mutate( cor = map_dbl(data, function(x) cor(x$lstat, x$value) ) ) %&amp;gt;%
  unnest(cols = c(data)) %&amp;gt;%
  ungroup() %&amp;gt;%
  mutate( variable = fct_reorder(variable, cor)
          , cor = round(cor,2) )

df_label = df_cor %&amp;gt;%
  group_by( variable, cor) %&amp;gt;%
  summarise( pos = max(value) *.9 )

ggplot( df_cor, aes(lstat, value) ) +
  geom_point( alpha = 0.2 ) +
  geom_smooth( method = &amp;#39;lm&amp;#39;) +
  geom_label( aes( x = 5, y = pos, label = cor)
             , df_label
             , color = &amp;#39;pink&amp;#39;) +
  facet_wrap(~variable, scales = &amp;#39;free_y&amp;#39;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## `geom_smooth()` using formula &amp;#39;y ~ x&amp;#39;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-12-29-tidymodels_files/figure-html/unnamed-chunk-5-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;lstat-vs-categorical-variables&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;lstat vs categorical variables&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df %&amp;gt;%
  select_if( is.factor ) %&amp;gt;%
  bind_cols( df[&amp;#39;lstat&amp;#39;] ) %&amp;gt;%
  gather( key = &amp;#39;variable&amp;#39;, value = &amp;#39;value&amp;#39;, - lstat) %&amp;gt;%
  ggplot( aes( x = value, y = lstat) ) +
  geom_violin() +
  geom_boxplot( alpha = 0.5 ) +
  ggpubr::stat_compare_means() +
  facet_wrap( ~ variable )&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-12-29-tidymodels_files/figure-html/unnamed-chunk-6-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;preprocessing-with-recipe&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Preprocessing with recipe&lt;/h2&gt;
&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;https://raw.githubusercontent.com/tidymodels/recipes/master/man/figures/logo.png&#34; style=&#34;width: 240px;height: 240px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note we are intentionally standardizing the response variable since the unit of lstat is irrelevant for this demo&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We will&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Yeo Johnson Transform&lt;/li&gt;
&lt;li&gt;Scale&lt;/li&gt;
&lt;li&gt;Center&lt;/li&gt;
&lt;li&gt;remove co-correlating variables (threshold 0.5)&lt;/li&gt;
&lt;li&gt;dummy encode&lt;/li&gt;
&lt;/ul&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;rec = recipe(df, lstat ~ . )

summary(rec)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## # A tibble: 14 x 4
##    variable type    role      source  
##    &amp;lt;chr&amp;gt;    &amp;lt;chr&amp;gt;   &amp;lt;chr&amp;gt;     &amp;lt;chr&amp;gt;   
##  1 crim     numeric predictor original
##  2 zn       numeric predictor original
##  3 indus    numeric predictor original
##  4 chas     nominal predictor original
##  5 nox      numeric predictor original
##  6 rm       numeric predictor original
##  7 age      numeric predictor original
##  8 dis      numeric predictor original
##  9 rad      numeric predictor original
## 10 tax      numeric predictor original
## 11 ptratio  numeric predictor original
## 12 b        numeric predictor original
## 13 medv     numeric predictor original
## 14 lstat    numeric outcome   original&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;rec = rec %&amp;gt;%
  step_scale( all_numeric() ) %&amp;gt;%
  step_center( all_numeric() ) %&amp;gt;%
  step_YeoJohnson( all_numeric() ) %&amp;gt;%
  step_corr( all_numeric(), - all_outcomes(), threshold = 0.5 ) %&amp;gt;%
  step_dummy( all_nominal() )&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;summary-recipe&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Summary Recipe&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;prep_rec = prep(rec, df)
prep_rec&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Data Recipe
## 
## Inputs:
## 
##       role #variables
##    outcome          1
##  predictor         13
## 
## Training data contained 506 data points and no missing data.
## 
## Operations:
## 
## Scaling for crim, zn, indus, nox, rm, age, dis, rad, ... [trained]
## Centering for crim, zn, indus, nox, rm, age, dis, rad, ... [trained]
## Yeo-Johnson transformation on crim, zn, indus, nox, rm, age, ... [trained]
## Correlation filter removed indus, nox, age, dis, tax, medv, crim [trained]
## Dummy variables from chas [trained]&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df_prep = bake(prep_rec, df )&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;resampling-with-rsample&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Resampling with rsample&lt;/h2&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;https://raw.githubusercontent.com/tidymodels/rsample/master/man/figures/logo.png&#34; style=&#34;width: 240px;height: 240px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;rs = rsample::vfold_cv(df, v = 5)

rsample::pretty.vfold_cv(rs)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [1] &amp;quot;5-fold cross-validation&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Convert to &lt;code&gt;caret&lt;/code&gt;-compatible object&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;rs_caret = rsample::rsample2caret(rs)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;modelling-with-caret&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Modelling with caret&lt;/h2&gt;
&lt;div id=&#34;wrapper&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Wrapper&lt;/h3&gt;
&lt;p&gt;We will be using randomized parameter search instead of grid search despite the &lt;a href=&#34;https://topepo.github.io/caret/random-hyperparameter-search.html&#34;&gt;author’s suggestions&lt;/a&gt;. It is purely for convenience since it will automatically pick parameters within a sensible range for each model. If we would not automate that we would have to look up the ranges in the documentation or determine them empirically.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;car = function( method, recipe, rsample, data){
  

  car = caret::train( recipe
                      , data
                      , method = method
                      , trControl = caret::trainControl(index = rsample$index
                                                        , indexOut = rsample$indexOut
                                                        , method = &amp;#39;cv&amp;#39;
                                                        , verboseIter = T
                                                        , savePredictions = T
                                                        , search = &amp;#39;random&amp;#39;)
                      , metric = &amp;#39;RMSE&amp;#39;
                      , tuneLength = 100
                       )
  
  return( car )
}

# c = car( &amp;#39;lm&amp;#39;, rec, rs_caret, df)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;apply-wrapper&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Apply Wrapper&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df_m = tibble( methods = c(&amp;#39;lm&amp;#39;, &amp;#39;rpart&amp;#39;, &amp;#39;cubist&amp;#39;, &amp;#39;parRF&amp;#39;, &amp;#39;earth&amp;#39;, &amp;#39;xgbTree&amp;#39;) )&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df_m = df_m %&amp;gt;%
  mutate( c = map(methods, car, rec, rs_caret, df ) )&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;assess-performance-with-yardstick&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Assess Performance with yardstick&lt;/h2&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;https://github.com/tidymodels/yardstick/raw/master/man/figures/logo.png&#34; style=&#34;width: 240px;height: 240px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df_pred = df_m %&amp;gt;%
  mutate( pred = map(c, &amp;#39;pred&amp;#39; )
          , pred = map(pred, as_tibble )
          , best_tune = map(c, &amp;#39;bestTune&amp;#39;) )
  
df_pred  &lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## # A tibble: 6 x 4
##   methods c          pred                   best_tune       
##   &amp;lt;chr&amp;gt;   &amp;lt;list&amp;gt;     &amp;lt;list&amp;gt;                 &amp;lt;list&amp;gt;          
## 1 lm      &amp;lt;tran.rcp&amp;gt; &amp;lt;tibble [506 × 5]&amp;gt;     &amp;lt;df[,1] [1 × 1]&amp;gt;
## 2 rpart   &amp;lt;tran.rcp&amp;gt; &amp;lt;tibble [18,216 × 5]&amp;gt;  &amp;lt;df[,1] [1 × 1]&amp;gt;
## 3 cubist  &amp;lt;tran.rcp&amp;gt; &amp;lt;tibble [48,070 × 6]&amp;gt;  &amp;lt;df[,2] [1 × 2]&amp;gt;
## 4 parRF   &amp;lt;tran.rcp&amp;gt; &amp;lt;tibble [3,036 × 5]&amp;gt;   &amp;lt;df[,1] [1 × 1]&amp;gt;
## 5 earth   &amp;lt;tran.rcp&amp;gt; &amp;lt;tibble [13,156 × 6]&amp;gt;  &amp;lt;df[,2] [1 × 2]&amp;gt;
## 6 xgbTree &amp;lt;tran.rcp&amp;gt; &amp;lt;tibble [50,600 × 11]&amp;gt; &amp;lt;df[,7] [1 × 7]&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;filter(df_pred, methods == &amp;#39;cubist&amp;#39;) %&amp;gt;%
  .$pred &lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## [[1]]
## # A tibble: 48,070 x 6
##        obs rowIndex    pred committees neighbors Resample
##      &amp;lt;dbl&amp;gt;    &amp;lt;int&amp;gt;   &amp;lt;dbl&amp;gt;      &amp;lt;int&amp;gt;     &amp;lt;int&amp;gt; &amp;lt;chr&amp;gt;   
##  1 -1.87          4 -1.32            3         5 Fold1   
##  2  0.740         8 -0.0712          3         5 Fold1   
##  3  1.55          9  0.616           3         5 Fold1   
##  4  0.855        11 -0.240           3         5 Fold1   
##  5 -0.351        15 -0.0309          3         5 Fold1   
##  6 -0.123        19  1.15            3         5 Fold1   
##  7  0.481        26  1.06            3         5 Fold1   
##  8  0.292        27  0.225           3         5 Fold1   
##  9  0.560        28  0.608           3         5 Fold1   
## 10 -0.0793       30 -0.0862          3         5 Fold1   
## # … with 48,060 more rows&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;parameters-as-string&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Parameters as string&lt;/h3&gt;
&lt;p&gt;We need to horizontally concat all parameter columns into two columns that are the same for all models otherwise we will not be able to unnest the predictions. We need to convert strings to symbols in order to use them for dplyr functions &lt;a href=&#34;https://cran.r-project.org/web/packages/dplyr/vignettes/programming.html&#34;&gt;(see programming with &lt;code&gt;dplyr&lt;/code&gt; )&lt;/a&gt;.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;params_as_str = function(df, params){
  
  symbols = map( names(params), as.name )
  
  df %&amp;gt;%
    mutate( desc_values = pmap_chr( list( !!! symbols), paste )
            , desc_params = paste( names(params), collapse = &amp;#39; &amp;#39; ) )
}

# params_as_str(df_pred$pred[[6]], df_pred$best_tune[[6]] )&lt;/code&gt;&lt;/pre&gt;
&lt;div id=&#34;apply-and-unnest&#34; class=&#34;section level5&#34;&gt;
&lt;h5&gt;Apply and unnest&lt;/h5&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df_pred = df_pred %&amp;gt;%
  mutate( pred = map2(pred, best_tune, params_as_str )
          , pred = map(pred, select, Resample, desc_params, desc_values, rowIndex, obs, pred)
          ) %&amp;gt;%
  unnest(pred)

df_pred&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## # A tibble: 133,584 x 9
##    methods c     Resample desc_params desc_values rowIndex     obs    pred
##    &amp;lt;chr&amp;gt;   &amp;lt;lis&amp;gt; &amp;lt;chr&amp;gt;    &amp;lt;chr&amp;gt;       &amp;lt;chr&amp;gt;          &amp;lt;int&amp;gt;   &amp;lt;dbl&amp;gt;   &amp;lt;dbl&amp;gt;
##  1 lm      &amp;lt;tra… Fold1    intercept   TRUE               4 -1.87   -0.815 
##  2 lm      &amp;lt;tra… Fold1    intercept   TRUE               8  0.740  -0.627 
##  3 lm      &amp;lt;tra… Fold1    intercept   TRUE               9  1.55   -0.177 
##  4 lm      &amp;lt;tra… Fold1    intercept   TRUE              11  0.855  -0.726 
##  5 lm      &amp;lt;tra… Fold1    intercept   TRUE              15 -0.351   0.0395
##  6 lm      &amp;lt;tra… Fold1    intercept   TRUE              19 -0.123   0.644 
##  7 lm      &amp;lt;tra… Fold1    intercept   TRUE              26  0.481   0.534 
##  8 lm      &amp;lt;tra… Fold1    intercept   TRUE              27  0.292   0.250 
##  9 lm      &amp;lt;tra… Fold1    intercept   TRUE              28  0.560   0.218 
## 10 lm      &amp;lt;tra… Fold1    intercept   TRUE              30 -0.0793 -0.331 
## # … with 133,574 more rows, and 1 more variable: best_tune &amp;lt;list&amp;gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;get-best-performing-model-for-each-method&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Get best performing model for each method&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df_best_models = df_pred %&amp;gt;%
  group_by( methods, desc_params, desc_values) %&amp;gt;%
  yardstick::rmse(obs, pred) %&amp;gt;%
  group_by( methods ) %&amp;gt;%
  mutate( rnk = rank(.estimate, ties.method = &amp;#39;first&amp;#39; ) ) %&amp;gt;%
  filter( rnk == 1 ) %&amp;gt;%
  select( - rnk ) %&amp;gt;%
  arrange(.estimate) %&amp;gt;%
  ungroup() %&amp;gt;%
  mutate( methods = fct_reorder(methods, .estimate) )

df_best_models&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## # A tibble: 6 x 6
##   methods desc_params          desc_values          .metric .estimator .estimate
##   &amp;lt;fct&amp;gt;   &amp;lt;chr&amp;gt;                &amp;lt;chr&amp;gt;                &amp;lt;chr&amp;gt;   &amp;lt;chr&amp;gt;          &amp;lt;dbl&amp;gt;
## 1 parRF   mtry                 2                    rmse    standard       0.512
## 2 xgbTree nrounds max_depth e… 638 4 0.02251800388… rmse    standard       0.540
## 3 cubist  committees neighbors 36 8                 rmse    standard       0.540
## 4 earth   nprune degree        8 2                  rmse    standard       0.563
## 5 rpart   cp                   0.00450606062062921  rmse    standard       0.592
## 6 lm      intercept            TRUE                 rmse    standard       0.624&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;get-cv-performance&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Get cv-performance&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;performance = yardstick::metric_set( yardstick::rmse, yardstick::rsq, yardstick::mae, yardstick::mape )

df_perf = df_best_models %&amp;gt;%
  select(methods, desc_params, desc_values) %&amp;gt;%
  left_join(df_pred) %&amp;gt;%
  group_by( methods, Resample) %&amp;gt;%
  performance(obs, pred) %&amp;gt;%
  mutate( methods = as.factor(methods)
          , methods = fct_relevel(methods, levels(df_best_models$methods) )) %&amp;gt;%
  group_by(methods, .metric) %&amp;gt;%
  mutate( me = mean(.estimate)
             , se = sd(.estimate)/sqrt(n()) )&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Joining, by = c(&amp;quot;methods&amp;quot;, &amp;quot;desc_params&amp;quot;, &amp;quot;desc_values&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;get-1se-stats&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Get 1SE stats&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df_1se = df_perf %&amp;gt;%
  group_by(methods, .metric, me, se) %&amp;gt;%
  summarise() %&amp;gt;%
  mutate(  ymin = me - se
          , ymax = me + se ) %&amp;gt;%
  group_by(.metric) %&amp;gt;%
  mutate( rnk = rank(me, ties.method = &amp;#39;first&amp;#39;)
          , rnk_desc = rank( desc(me), ties.method = &amp;#39;first&amp;#39;)
          ) %&amp;gt;%
  rename( best_method = methods ) %&amp;gt;%
  filter( (rnk == 1 &amp;amp; .metric != &amp;#39;rsq&amp;#39;) | (.metric == &amp;#39;rsq&amp;#39; &amp;amp; rnk_desc == 1) )

df_1se&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## # A tibble: 4 x 8
## # Groups:   .metric [4]
##   best_method .metric      me      se    ymin    ymax   rnk rnk_desc
##   &amp;lt;fct&amp;gt;       &amp;lt;chr&amp;gt;     &amp;lt;dbl&amp;gt;   &amp;lt;dbl&amp;gt;   &amp;lt;dbl&amp;gt;   &amp;lt;dbl&amp;gt; &amp;lt;int&amp;gt;    &amp;lt;int&amp;gt;
## 1 parRF       mae       0.394  0.0149   0.379   0.409     1        6
## 2 parRF       rmse      0.510  0.0221   0.488   0.532     1        6
## 3 parRF       rsq       0.703  0.0372   0.666   0.740     6        1
## 4 lm          mape    167.    32.0    135.    199.        1        6&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;plot&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Plot&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;len = levels(df_perf$methods) %&amp;gt;%
  length()

col_class = RColorBrewer::brewer.pal(&amp;#39;Greys&amp;#39;, n = 9) %&amp;gt;% rev()
col_folds = RColorBrewer::brewer.pal(&amp;#39;Dark2&amp;#39;, n = 8) %&amp;gt;%
  easyalluvial::palette_filter(greens = F, greys = F)

pal = c( col_class[2], col_folds[1:5], col_class[4], col_class[6] )

df_perf %&amp;gt;%
  left_join( select(df_1se, .metric, ymin, ymax, best_method) ) %&amp;gt;%
  mutate( classification = case_when( best_method == methods ~ &amp;#39;best&amp;#39;
                                      , me &amp;gt;= ymin &amp;amp; me &amp;lt;= ymax ~ &amp;#39;in&amp;#39;
                                      , T ~ &amp;#39;out&amp;#39; )
          ) %&amp;gt;%
  ggplot( aes(methods, .estimate) ) +
    geom_rect( aes(ymin = ymin, ymax = ymax )
               , xmin = 0, xmax = len
               , fill = col_class[7]
               , alpha = 0.05 ) +
    geom_line( aes( group = Resample, color = Resample)
               , size = .5, alpha = 1 ) +
    stat_summary( aes( color = classification)
                  , size = 1
                  , fun.data = function(x) mean_se( x, mult = 1) ) +
    scale_color_manual( values = pal ) +
    theme( legend.position = &amp;#39;none&amp;#39;) +
    labs( y = &amp;#39;&amp;#39;, x = &amp;#39;&amp;#39;, caption = &amp;#39;grey area: 1SE range of best model&amp;#39;
        , title = &amp;#39;CV Performance Metrics + SE&amp;#39;) +
    facet_wrap(~.metric, scales = &amp;#39;free_y&amp;#39;, ncol = 1) &lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Joining, by = &amp;quot;.metric&amp;quot;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-12-29-tidymodels_files/figure-html/unnamed-chunk-23-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Data exploration with alluvial plots - An introduction to easyalluvial</title>
      <link>https://www.datisticsblog.com/2018/10/intro_easyalluvial/</link>
      <pubDate>Wed, 31 Oct 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/10/intro_easyalluvial/</guid>
      <description>

&lt;div id=&#34;TOC&#34;&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#introduction&#34;&gt;Introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#easyalluvial&#34;&gt;easyalluvial&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#features&#34;&gt;Features&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#install&#34;&gt;Install&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#wide-format&#34;&gt;Wide Format&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#sample-data&#34;&gt;Sample data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#alluvial_wide&#34;&gt;alluvial_wide()&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#long-format&#34;&gt;Long Format&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#sample-data-1&#34;&gt;Sample Data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#alluvial_long&#34;&gt;alluvial_long()&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#general&#34;&gt;General&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;#missing-data&#34;&gt;Missing Data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#colors&#34;&gt;Colors&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#connect-flows-to-observations-in-original-data&#34;&gt;Connect Flows to observations in original data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;#ggplot2-manipulations&#34;&gt;ggplot2 manipulations&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;



&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;../../../easyalluvial_logo_square.png&#34; style=&#34;width: 360px;height: 360px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/br&gt;
&lt;br&gt;&lt;/br&gt;&lt;/p&gt;
&lt;div id=&#34;introduction&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;Alluvial plots are a form of &lt;a href=&#34;https://en.wikipedia.org/wiki/Sankey_diagram&#34;&gt;sankey diagrams&lt;/a&gt; that are a great tool for exploring categorical data. They group categorical data into flows that can easily be traced in the diagram. Other than sankey diagrams they are constrained to x-y dimensions, however their graphical grammar is a bit mor complex then that of a regular x-y plot. The &lt;a href=&#34;http://corybrunson.github.io/ggalluvial/&#34;&gt;&lt;code&gt;ggalluvial&lt;/code&gt;&lt;/a&gt; package made a great job of translating that grammar into ggplot2 synthax and gives you many option to tweak the appearance of a plot, nevertheless there still remains a multilayered complexity that makes it difficult to use &lt;code&gt;ggalluvial&lt;/code&gt; for explorative data analysis. &lt;code&gt;easyalluvial&lt;/code&gt; provides a simple interface to this package that allows you to put out a decent alluvial from any dataframe where data is stored in either long or wide format while automatically binning continuous data. It is meant to allow a quick visualisation of entire dataframes similar to the visualisations created by the &lt;a href=&#34;https://github.com/mtennekes/tabplot&#34;&gt;&lt;code&gt;tabplot&lt;/code&gt;&lt;/a&gt; package providing different colouring options which give it the flexibility needed for data exploration.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;easyalluvial&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;easyalluvial&lt;/h1&gt;
&lt;p&gt;&lt;a href=&#34;https://github.com/erblast/easyalluvial&#34;&gt;github repository&lt;/a&gt;&lt;/p&gt;
&lt;div id=&#34;features&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Features&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;plot alluvial graph with a single line of code of a given datafram&lt;/li&gt;
&lt;li&gt;support for wide and long data format &lt;a href=&#34;https://en.wikipedia.org/wiki/Wide_and_narrow_data&#34;&gt;(wiki, wide vs. long/narrow data)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;automatically transforms numerical to categorical data&lt;/li&gt;
&lt;li&gt;helper functions for variable selection&lt;/li&gt;
&lt;li&gt;convenient parameters for coloring and ordering&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;div id=&#34;install&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Install&lt;/h2&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;# install.packages(&amp;quot;devtools&amp;quot;)
devtools::install_github(&amp;quot;erblast/easyalluvial&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div id=&#34;wide-format&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Wide Format&lt;/h2&gt;
&lt;div id=&#34;sample-data&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Sample data&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressPackageStartupMessages( require(easyalluvial) )
suppressPackageStartupMessages( require(tidyverse) )&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;data_wide = as_tibble(mtcars)
categoricals = c(&amp;#39;cyl&amp;#39;, &amp;#39;vs&amp;#39;, &amp;#39;am&amp;#39;, &amp;#39;gear&amp;#39;, &amp;#39;carb&amp;#39;)
numericals = c(&amp;#39;mpg&amp;#39;, &amp;#39;cyl&amp;#39;, &amp;#39;disp&amp;#39;, &amp;#39;hp&amp;#39;, &amp;#39;drat&amp;#39;, &amp;#39;wt&amp;#39;, &amp;#39;qsec&amp;#39;)

data_wide = data_wide %&amp;gt;%
  mutate_at( vars(categoricals), as.factor ) %&amp;gt;%
  mutate( car_id = row_number() )&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Note: Using an external vector in selections is ambiguous.
## ℹ Use `all_of(categoricals)` instead of `categoricals` to silence this message.
## ℹ See &amp;lt;https://tidyselect.r-lib.org/reference/faq-external-vector.html&amp;gt;.
## This message is displayed once per session.&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;knitr::kable( head(data_wide) )&lt;/code&gt;&lt;/pre&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th align=&#34;right&#34;&gt;mpg&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;cyl&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;disp&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;hp&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;drat&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;wt&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;qsec&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;vs&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;am&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;gear&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;carb&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;car_id&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;right&#34;&gt;21.0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;6&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;160&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;110&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.90&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.620&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;16.46&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;4&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;4&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;right&#34;&gt;21.0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;6&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;160&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;110&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.90&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.875&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;17.02&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;4&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;4&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;right&#34;&gt;22.8&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;4&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;108&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;93&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.85&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.320&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;18.61&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;4&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;right&#34;&gt;21.4&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;6&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;258&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;110&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.08&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.215&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;19.44&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;3&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;right&#34;&gt;18.7&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;8&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;360&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;175&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.15&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.440&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;17.02&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;3&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;2&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;5&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;right&#34;&gt;18.1&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;6&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;225&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;105&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2.76&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.460&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;20.22&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;3&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;6&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div id=&#34;alluvial_wide&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;alluvial_wide()&lt;/h3&gt;
&lt;div id=&#34;binning-of-numerical-variables&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Binning of Numerical Variables&lt;/h4&gt;
&lt;p&gt;This function produces a simple alluvial plot of the given dataframe. Numerical variables are centered, scaled and yeo johnson transformed (transformed to resemble more of a normal distribution) by &lt;code&gt;easyalluvial::manip_bin_numerics()&lt;/code&gt;. Outliers as defined by the boxplot criteria ( see documentation for &lt;code&gt;grDevices::boxplot.stats()&lt;/code&gt;) are stunted to to the min and max values that are defined by the whiskers of the box plot. The so transformed numeric variables are then cut into 5 (default) equally ranged bins which are lebeled ‘LL’ (low-low), ‘ML’ (medium-low), ‘M’ (medium), ‘MH’ (medium-high), HH (high-high) by default.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;alluvial_wide(data_wide
              , bins = 5 # Default
              , bin_labels = c(&amp;#39;LL&amp;#39;,&amp;#39;ML&amp;#39;,&amp;#39;M&amp;#39;,&amp;#39;MH&amp;#39;,&amp;#39;HH&amp;#39;) # Default
              , fill_by = &amp;#39;all_flows&amp;#39;
              )&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-10-31-intro_easyalluvial_files/figure-html/unnamed-chunk-5-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;alluvial-plot-organisation&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Alluvial Plot Organisation&lt;/h4&gt;
&lt;p&gt;Each group of stacked bars represents a variable while the size of each segment represents how many observations in the dataframe belong to that level machting the segment label. The colored flows between the bar stack represent a group of observations that match the value for each variable indicated by the flow. The thickness of the flow indicates how many observations belong to that group.&lt;/p&gt;
&lt;p&gt;We see that each flow has more or less the same thickness and the statistical information in the plot caption tells us that we have 30 flows in total for 32 observations in the dataframe. Which means that almost each observation is unique in its combination of variable values.&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;reduce-the-number-of-variables&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Reduce the Number of Variables&lt;/h4&gt;
&lt;p&gt;In order to reduce the compexity we can use a helper function &lt;code&gt;plot_condensation()&lt;/code&gt; to get an idea which variables we want to include in our alluvial plot. Lets say we are especially interested in the &lt;code&gt;mpg&lt;/code&gt; (miles per gallon) variable and how it relates to the other variables. &lt;code&gt;plot_condensation&lt;/code&gt; will look for other variables it can combine &lt;code&gt;mpg&lt;/code&gt; with while trying to condense the data frame to a minimum.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;plot_condensation(data_wide, first = mpg)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-10-31-intro_easyalluvial_files/figure-html/unnamed-chunk-6-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;In general we want to condense the dataframe to 50% or less we might get a meaningfull alluvial when looking at &lt;code&gt;mpg, cyl, vs, am&lt;/code&gt; in that order.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;alluvial_wide( select(data_wide, mpg, cyl, vs, am), fill_by = &amp;#39;first_variable&amp;#39; )&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-10-31-intro_easyalluvial_files/figure-html/unnamed-chunk-7-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;reorder-levels&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Reorder Levels&lt;/h4&gt;
&lt;p&gt;We can see a clear pattern in the flows now, especially now that we have colored the flows by the &lt;code&gt;mpg&lt;/code&gt; variable. However some of the flows are unnecessarily criss-crossing. We can improve this by changing the order of the levels of the &lt;code&gt;cyl&lt;/code&gt; variable.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;alluvial_wide( select(data_wide, mpg, cyl, vs, am)
               , fill_by = &amp;#39;first_variable&amp;#39;
               , order_levels = c(&amp;#39;8&amp;#39;,&amp;#39;6&amp;#39;,&amp;#39;4&amp;#39;) )&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-10-31-intro_easyalluvial_files/figure-html/unnamed-chunk-8-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;If levels of several variables have levels of the same name we cannot order them individually per variable, this is a design choice (see documentation of &lt;code&gt;alluvial_wide()&lt;/code&gt; ). If we want to reorder them we need to assign individual level names first.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p_unordered = alluvial_wide( select(data_wide, mpg, disp, hp)
                              , fill_by = &amp;#39;first_variable&amp;#39; ) +
  labs( title = &amp;#39;Unordered&amp;#39;, caption = &amp;#39;\n\n&amp;#39; )

bin_labels = c(&amp;#39;mpg_LL&amp;#39;,&amp;#39;mpg_LM&amp;#39;,&amp;#39;mpg_M&amp;#39;,&amp;#39;mpg_MH&amp;#39;,&amp;#39;mpg_HH&amp;#39;)

p_ordered = data_wide %&amp;gt;%
  mutate( mpg = manip_bin_numerics(mpg, bin_labels = bin_labels)
          , mpg = fct_rev(mpg) ) %&amp;gt;%
  select( mpg, disp, hp) %&amp;gt;%
  alluvial_wide() +
  labs( title = &amp;#39;Ordered&amp;#39;)

gridExtra::grid.arrange( p_unordered, p_ordered, nrow = 1 )&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-10-31-intro_easyalluvial_files/figure-html/unnamed-chunk-9-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;long-format&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;Long Format&lt;/h2&gt;
&lt;p&gt;In certain cases we might want to start with a dataframe that is already in long format, this is mostly the case for time-series data where we want to track a categorical value over different time periods.&lt;/p&gt;
&lt;div id=&#34;sample-data-1&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Sample Data&lt;/h3&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;monthly_flights = nycflights13::flights %&amp;gt;%
  group_by(month, tailnum, origin, dest, carrier) %&amp;gt;%
  summarise() %&amp;gt;%
  group_by( tailnum, origin, dest, carrier) %&amp;gt;%
  count() %&amp;gt;%
  filter( n == 12 ) %&amp;gt;%
  select( - n ) %&amp;gt;%
  left_join( nycflights13::flights ) %&amp;gt;%
  .[complete.cases(.), ] %&amp;gt;%
  ungroup() %&amp;gt;%
  mutate( flight_id = pmap_chr(list(tailnum, origin, dest, carrier), paste )
          , qu = cut(month, 4)) %&amp;gt;%
  group_by(flight_id, carrier, origin, dest, qu ) %&amp;gt;%
  summarise( mean_arr_delay = mean(arr_delay) ) %&amp;gt;%
  ungroup() %&amp;gt;%
  mutate( mean_arr_delay = ifelse( mean_arr_delay &amp;lt; 10, &amp;#39;on_time&amp;#39;, &amp;#39;late&amp;#39; ) )&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Joining, by = c(&amp;quot;tailnum&amp;quot;, &amp;quot;origin&amp;quot;, &amp;quot;dest&amp;quot;, &amp;quot;carrier&amp;quot;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;  levels(monthly_flights$qu) = c(&amp;#39;Q1&amp;#39;, &amp;#39;Q2&amp;#39;, &amp;#39;Q3&amp;#39;, &amp;#39;Q4&amp;#39;)

  data_long = monthly_flights

  
knitr::kable( head( data_long) )&lt;/code&gt;&lt;/pre&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th align=&#34;left&#34;&gt;flight_id&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;carrier&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;origin&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;dest&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;qu&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;mean_arr_delay&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;N0EGMQ LGA BNA MQ&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;MQ&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;LGA&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;BNA&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Q1&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;on_time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;N0EGMQ LGA BNA MQ&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;MQ&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;LGA&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;BNA&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Q2&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;on_time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;N0EGMQ LGA BNA MQ&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;MQ&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;LGA&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;BNA&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Q3&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;on_time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;N0EGMQ LGA BNA MQ&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;MQ&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;LGA&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;BNA&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Q4&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;on_time&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;left&#34;&gt;N11150 EWR MCI EV&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;EV&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;EWR&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;MCI&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Q1&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;late&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;left&#34;&gt;N11150 EWR MCI EV&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;EV&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;EWR&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;MCI&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;Q2&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;late&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div id=&#34;alluvial_long&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;alluvial_long()&lt;/h3&gt;
&lt;p&gt;In long format we only need the column that contains the keys (timepoints, Q1, Q2, Q3, Q4) and the values (late, ontime), but we also need a column for the ID (flight_id) because in long format data for one flight is spread over 4 rows and the function needs to know which IDs to group to put into a flow. If ther is implicitly missing data so one flight_id has less than in this case four rows of data (one for each timepoint) it will be made explicit and labelled &lt;code&gt;&#39;NA&#39;&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;col_vector = c(&amp;#39;tomato&amp;#39;, &amp;#39;green3&amp;#39;)

alluvial_long(data_long
              , key = qu
              , value = mean_arr_delay
              , id = flight_id 
              , fill_by = &amp;#39;value&amp;#39;
              , col_vector_flow = col_vector
              , col_vector_value = col_vector
              )&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-10-31-intro_easyalluvial_files/figure-html/unnamed-chunk-11-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;We might be more interested which airline carrier had the most late flights, we can add it as an additional variable to the plot and use it for coloring. We can place this variable either on the left or on the right.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p_right = alluvial_long(data_long
              , key = qu
              , value = mean_arr_delay
              , id = flight_id 
              , fill = carrier
              , fill_by = &amp;#39;last_variable&amp;#39;
              , fill_right = T # Default
              ) +
  labs(title = &amp;#39;Color fill variable placed to the right&amp;#39;)


p_left = alluvial_long(data_long
              , key = qu
              , value = mean_arr_delay
              , id = flight_id 
              , fill = carrier
              , fill_by = &amp;#39;last_variable&amp;#39;
              , fill_right = F
              ) +
  labs(title = &amp;#39;Color fill variable placed to the left&amp;#39;
       , caption = &amp;#39;\n\n&amp;#39;)


gridExtra::grid.arrange( p_left, p_right, nrow = 1)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-10-31-intro_easyalluvial_files/figure-html/unnamed-chunk-12-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;div id=&#34;order-levels&#34; class=&#34;section level4&#34;&gt;
&lt;h4&gt;Order Levels&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;alluvial_long()&lt;/code&gt; takes three different &lt;code&gt;order_levels_*&lt;/code&gt; arguments, one for the keys (x-axis) one for the values (y-axis) and one for the fill variable. Here we want to demonstrate how to order the &lt;code&gt;carrier&lt;/code&gt; variable by number of flights.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;carriers_ordered_by_count = data_long %&amp;gt;%
  group_by(carrier) %&amp;gt;%
  count() %&amp;gt;%
  arrange( n ) %&amp;gt;%
  .[[&amp;#39;carrier&amp;#39;]]

alluvial_long(data_long
              , key = qu
              , value = mean_arr_delay
              , id = flight_id 
              , fill = carrier
              , fill_by = &amp;#39;last_variable&amp;#39;
              , order_levels_fill = carriers_ordered_by_count
              , fill_right = F
              ) +
  labs(title = &amp;#39;Carriers ordered by number of flights&amp;#39;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-10-31-intro_easyalluvial_files/figure-html/unnamed-chunk-13-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id=&#34;general&#34; class=&#34;section level2&#34;&gt;
&lt;h2&gt;General&lt;/h2&gt;
&lt;div id=&#34;missing-data&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Missing Data&lt;/h3&gt;
&lt;p&gt;Explicitly and implicitly missing data will automaticall be labeled as &lt;code&gt;&#39;NA&#39;&lt;/code&gt; and added as a level. The order of that level can be changed like any other. We will automatically generate implicitly missing data if we sample only a fraction of our long format dataframe, because then not every flight_id will have a value (late, on_time) assigned for each time point (Q1, Q2, Q3, Q4). We can replace &lt;code&gt;&#39;NA&#39;&lt;/code&gt; with any other string.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;col_vector = c( &amp;#39;tomato&amp;#39;, &amp;#39;grey&amp;#39;, &amp;#39;green3&amp;#39;)

data_na = data_long %&amp;gt;%
  select(flight_id, qu, mean_arr_delay) %&amp;gt;%
  sample_frac(0.9)

alluvial_long(data_na
              , key = qu
              , value = mean_arr_delay
              , id = flight_id
              , fill_by = &amp;#39;value&amp;#39;
              , NA_label = &amp;#39;None&amp;#39;
              , col_vector_value = col_vector
              , col_vector_flow = col_vector
              ) +
  labs(title = &amp;#39;Implicit NA values&amp;#39;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-10-31-intro_easyalluvial_files/figure-html/unnamed-chunk-14-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;colors&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Colors&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;alluvial_wide()&lt;/code&gt; and &lt;code&gt;alluvial_long&lt;/code&gt; take any sequence of either HEX code or string color values. &lt;code&gt;easyalluvial&lt;/code&gt; offers some convenience functions around constructing qualitative color pallettes for distinct values.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;palette_qualitative() %&amp;gt;%
  palette_filter(greys = F) %&amp;gt;%
  palette_plot_rgp()&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-10-31-intro_easyalluvial_files/figure-html/unnamed-chunk-15-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;connect-flows-to-observations-in-original-data&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Connect Flows to observations in original data&lt;/h3&gt;
&lt;p&gt;We might recognise interesting patterns in the alluvial plot that we want to follow up upon. For example which cars With medium-low &lt;code&gt;mpg&lt;/code&gt; and 8 &lt;code&gt;cyl&lt;/code&gt; and 0 &lt;code&gt;vs&lt;/code&gt; has an &lt;code&gt;am&lt;/code&gt; value of 1. Note that we are passing the &lt;code&gt;car_id&lt;/code&gt; variable.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p = alluvial_wide( select(data_wide, mpg, cyl, vs, am, car_id)
                   , id = car_id
                   , fill_by = &amp;#39;first_variable&amp;#39;
                   , order_levels = c(&amp;#39;8&amp;#39;,&amp;#39;6&amp;#39;,&amp;#39;4&amp;#39;) )

p&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-10-31-intro_easyalluvial_files/figure-html/unnamed-chunk-16-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;The plot objects returned by both functions have an attribute called &lt;code&gt;data_key&lt;/code&gt; which is an x-y table arranged like the alluvial plot one column containing the original ID. We can use the &lt;code&gt;car_id&lt;/code&gt; variable to rejoin the original dataframe.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p$data_key %&amp;gt;%
  filter( mpg == &amp;#39;ML&amp;#39;
          , cyl == 8
          , vs == 0 
          , am == 1 ) %&amp;gt;%
  # in order to convert factors to integers we have to convert them
  # to character first. Converting from factor returns the order of
  # the factor instead.
  mutate( car_id = as.character(car_id)
          , car_id = as.integer(car_id) ) %&amp;gt;%
  left_join(data_wide, by = &amp;#39;car_id&amp;#39;) %&amp;gt;%
  knitr::kable()&lt;/code&gt;&lt;/pre&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr class=&#34;header&#34;&gt;
&lt;th align=&#34;right&#34;&gt;car_id&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;mpg.x&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;cyl.x&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;vs.x&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;am.x&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;alluvial_id&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;n&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;mpg.y&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;cyl.y&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;disp&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;hp&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;drat&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;wt&lt;/th&gt;
&lt;th align=&#34;right&#34;&gt;qsec&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;vs.y&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;am.y&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;gear&lt;/th&gt;
&lt;th align=&#34;left&#34;&gt;carb&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class=&#34;odd&#34;&gt;
&lt;td align=&#34;right&#34;&gt;29&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;ML&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;8&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;11&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;15.8&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;8&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;351&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;264&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;4.22&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.17&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;14.5&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr class=&#34;even&#34;&gt;
&lt;td align=&#34;right&#34;&gt;31&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;ML&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;8&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;11&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;2&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;15.0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;8&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;301&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;335&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.54&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;3.57&lt;/td&gt;
&lt;td align=&#34;right&#34;&gt;14.6&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;0&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;1&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;5&lt;/td&gt;
&lt;td align=&#34;left&#34;&gt;8&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;div id=&#34;ggplot2-manipulations&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;ggplot2 manipulations&lt;/h3&gt;
&lt;p&gt;thanks to &lt;code&gt;ggalluvial&lt;/code&gt; the alluvial plots that &lt;code&gt;easyalluvial&lt;/code&gt; returns can be manipulated using &lt;code&gt;ggplot2&lt;/code&gt; synthax&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;p + 
  coord_flip() +
  theme_minimal() +
  ggtitle(&amp;#39;look at my minimal flip&amp;#39;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-10-31-intro_easyalluvial_files/figure-html/unnamed-chunk-18-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Revisiting jupyter notebooks</title>
      <link>https://www.datisticsblog.com/2018/10/revisiting-jupyter-notebooks/</link>
      <pubDate>Thu, 25 Oct 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/10/revisiting-jupyter-notebooks/</guid>
      <description>&lt;p&gt;There has been a lot of discussion about jupyter notebooks in the online channels I consume and the point of this post is to bring them together.&lt;/p&gt;

&lt;p&gt;Coming from R and beeing a heavy user of Rmarkdown files jupyter notebooks felt familiar right away but also a bit awkward. Datacamp made the effort of comparing the to feature by feature in a &lt;a href=&#34;https://www.datacamp.com/community/blog/jupyter-notebook-r&#34;&gt;blog post&lt;/a&gt; at the end of 2016. It is a bit out-dated but skimming through it most of it still holds to be true. With some exceptions. of course since there have been some developments on both sides. But more on that later&lt;/p&gt;

&lt;p&gt;In the end what we want from both tools are four things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://en.wikipedia.org/wiki/Literate_programming&#34;&gt;literate programming&lt;/a&gt;, meaning we can have natural language code comments and code output right next to our actual code and have all three components well seperated.&lt;/li&gt;
&lt;li&gt;create awesome code-enriched html content&lt;/li&gt;
&lt;li&gt;polyglot coding, the division of code in small executable chunks also allows us to run each chunk in a different programming language&lt;/li&gt;
&lt;li&gt;comofortable programming, being able to use IDE features, like code completion, visual representation of all variables, data and variable exploration, git-based version control&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both jupyter and Rmarkdown can be used for all these things, however there are some criticism on how jupyter performs in these categories. Most fameously summed up by Joel Grus at jupytercon this year in his &lt;a href=&#34;https://docs.google.com/presentation/d/1n2RlMdmv1p25Xy5thJUhkKGvjtV-dkAIsUXP-AL4ffI/edit#slide=id.g3b600ce1e2_0_0&#34;&gt;presentation&lt;/a&gt; and Owain Kenway in ths older &lt;a href=&#34;https://owainkenwayucl.github.io/2017/10/03/WhyIDontLikeNotebooks.html&#34;&gt;blogpost&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To sum this criticism up is that jupyter by design stores its output within the notebook file. The codeoutput can be saved at any time and then code chunks can be executed in any given order. When opening a jupyter notebook, there is no garantuee that execution of all code chunks will again result in the same output. Code output is saved as a binary addition to the underlying json a format that is not compatible with version control tools.&lt;/p&gt;

&lt;p&gt;Personally for me this is the reason why I am not using jupyter for programming. Unless I want to create some python-based html content as for this blog for example.&lt;/p&gt;

&lt;p&gt;However Brian Granger from project jupyter hase recently been on the &lt;a href=&#34;https://www.datacamp.com/community/podcast/project-jupyter-interactive-computing&#34;&gt;dataframed podcast&lt;/a&gt; and has talked about his vision of project jupyter. He mentioned to things that stuck with me.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;do not use jupyter notebooks use jupyter lab, because jupyter lab is more advanced and makes things better for you on the IDE side.&lt;/li&gt;
&lt;li&gt;at netflix they are running thousands of jupyter jobs a day.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So this made me very curious because it sounds like finally there is a well implemented solution to ensuring execution of code chunks in order. So I stumbled across this &lt;a href=&#34;https://medium.com/netflix-techblog/notebook-innovation-591ee3221233&#34;&gt;blog post&lt;/a&gt; in which netflix was showing their jupyter system landscape.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;https://cdn-images-1.medium.com/max/1000/1*WOEEJizYnO8ibtU2l9jWbA.jpeg&#34; alt=&#34;&#34; /&gt;&lt;/p&gt;

&lt;p&gt;This is quite outstanding, especially the tool &lt;a href=&#34;https://github.com/nteract/papermill&#34;&gt;&lt;code&gt;papermill&lt;/code&gt;&lt;/a&gt; caught my attention which allows you to pass parameters to notebooks. A feature I was dearly missing from Rmarkdown. The code output of a jupyter notebook run with a fixed set of parameters via papermill is sure to be reproducible. Also it makes jupyter notebooks production compatible so we do not have to copy paste all the notebook code into a .py file and rewrite the whole thing.&lt;/p&gt;

&lt;p&gt;On a second note the company nteract also develops &lt;a href=&#34;https://github.com/nteract/hydrogen&#34;&gt;&lt;code&gt;hydrogen&lt;/code&gt;&lt;/a&gt; one of the most popular &lt;code&gt;atom&lt;/code&gt; packages. (&lt;code&gt;atom&lt;/code&gt; is an open-source text editor which has become my new favourite IDE for python development)&lt;/p&gt;

&lt;p&gt;Parametrized reports are a feature that has been around in Rmarkdown for a while, but it might be difficult to set-up a similar R-Spark landscape that works as well as the python-Spark infrastructure.&lt;/p&gt;

&lt;p&gt;So I guess purists will probably always feel a bit cranky about jupyter and its json-based file format. But there seems to be a silver lining and we might finally be able to integrate jupyter more sensibly into our workflows.&lt;/p&gt;

&lt;p&gt;But still as Brian Granger mentioned on the &lt;a href=&#34;https://www.datacamp.com/community/podcast/project-jupyter-interactive-computing&#34;&gt;dataframed podcast&lt;/a&gt; there are no best-practice guidelines for jupyter notebooks at the moment and that is something that they are working on.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Polyglot conda environments - 3/3 - jupyter and rpy2</title>
      <link>https://www.datisticsblog.com/2018/08/conda3/</link>
      <pubDate>Thu, 30 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/08/conda3/</guid>
      <description>




&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;../../../conda_trinity.png&#34; style=&#34;width: 180px;height: 180px;&#34;&gt;
  
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/conda1/&#34;&gt;1 of 3: conda introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/conda2/&#34;&gt;2 of 3: conda command line&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/conda3/&#34;&gt;3 of 3: conda jupyter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- toc --&gt;

&lt;p&gt;Here we want to show how we can use &lt;code&gt;R&lt;/code&gt; and &lt;code&gt;python&lt;/code&gt; in the same jupyter notebook.&lt;/p&gt;

&lt;h1 id=&#34;jupyter-notebooks&#34;&gt;jupyter notebooks&lt;/h1&gt;

&lt;p&gt;We first need to create a conda and install &lt;code&gt;R&lt;/code&gt; and &lt;code&gt;python&lt;/code&gt; and &lt;code&gt;jupyter&lt;/code&gt;, then we need to activate that environment and run the &lt;code&gt;jupyter notebook&lt;/code&gt; command. When creating a new notebook you will automatically use the active conda environment as a kernel.&lt;/p&gt;

&lt;p&gt;For the sake of completeness you can also install the &lt;a href=&#34;https://github.com/IRkernel/IRkernel&#34;&gt;IRkernel&lt;/a&gt; and follow the instructions in order to start up a jupyter notebook using a R kernel.&lt;/p&gt;

&lt;p&gt;When installing the package &lt;code&gt;nb_conda&lt;/code&gt; you will be able to select a conda kernel from all the conda kernels on your system via the jupyter notebook GUI. For mixed environments you can select whether it should be a &lt;code&gt;R&lt;/code&gt; or a &lt;code&gt;python&lt;/code&gt; notebook. When you want to mix both languages inside one notebook &lt;code&gt;rpy2&lt;/code&gt; will always look for the R installation circumventing jupyter. It is therefore important that you activate the appropriate mixed environment before starting jupyter.&lt;/p&gt;

&lt;h1 id=&#34;mixing-r-and-python-with-rpy2&#34;&gt;mixing R and python with rpy2&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;rpy2&lt;/code&gt; allows us to mix &lt;code&gt;R&lt;/code&gt; and &lt;code&gt;python&lt;/code&gt; code in our jupyter notebook by using the &lt;code&gt;rmagic&lt;/code&gt; commands, which are part of the &lt;a href=&#34;https://rpy2.readthedocs.io/en/version_2.8.x/index.html&#34;&gt;&lt;code&gt;rpy2&lt;/code&gt; package&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;First we import the &lt;code&gt;ipython&lt;/code&gt; module from rpy2&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;%load_ext rpy2.ipython
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;The rpy2.ipython extension is already loaded. To reload it, use:
  %reload_ext rpy2.ipython
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We can execute a line of R code using the &lt;code&gt;%R&lt;/code&gt; prefix. The last returned variable is treated as cell output&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;%R X=c(1,4,5,7); sd(X); mean(X)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;array([4.25])
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;I would recommend using &lt;code&gt;conda&lt;/code&gt; which allows us to manage &lt;code&gt;python&lt;/code&gt; and &lt;code&gt;R&lt;/code&gt; packages in the same environment. The following code will check the &lt;code&gt;R&lt;/code&gt; version jupyter is using.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;%R d = as.data.frame( R.Version() )
%R d = d[&#39;version.string&#39;]
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;version.string&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;R version 3.4.3 (2017-11-30)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;We can get variables from the &lt;code&gt;R&lt;/code&gt; instance that &lt;code&gt;jupyter&lt;/code&gt; is running in the background using the &lt;code&gt;%Rget&lt;/code&gt; command as cell output.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;%Rget d
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;version.string&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;R version 3.4.3 (2017-11-30)&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;We can pass variables from the &lt;code&gt;python&lt;/code&gt; environment into the &lt;code&gt;R&lt;/code&gt; environment using &lt;code&gt;%R -i&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;import pandas as pd
df = pd.DataFrame( dict(a = [1,2,3], b = [4,5,6]) )

%R -i df
%R df_R = df
%Rget df_R
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;a&lt;/th&gt;
      &lt;th&gt;b&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;5&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;6&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Similarily we can pass variables from &lt;code&gt;R&lt;/code&gt; back to &lt;code&gt;python&lt;/code&gt; using  &lt;code&gt;%R -o&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;%R -o df_R
df_R
print( &#39;type of imported R object: &#39; + str( type(df_R) ) )
df_R
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;type of imported R object: &amp;lt;class &#39;pandas.core.frame.DataFrame&#39;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;a&lt;/th&gt;
      &lt;th&gt;b&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;5&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;6&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;We can also define an entire cell as R code using &lt;code&gt;%%R&lt;/code&gt; and run complex R code that uses external none-standard R packages. (Note for this code bit to run you need to create a conda environment from one of the &lt;code&gt;.yml&lt;/code&gt; files found &lt;a href=&#34;https://github.com/erblast/conda&#34;&gt;here&lt;/a&gt;).&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-r&#34;&gt;%%R -o df

require(tidyverse)
require(oetteR)

m = lm(price ~ carat + depth, ggplot2::diamonds)

df = tibble( obs = ggplot2::diamonds$price
           , pred = predict(m, newdata = ggplot2::diamonds) ) %&amp;gt;%
   f_prediction_intervall_raw( &#39;pred&#39;,&#39;obs&#39;, intervall = 0.975) %&amp;gt;%
   f_prediction_intervall_raw( &#39;pred&#39;,&#39;obs&#39;, intervall = 0.025)

p = f_plot_pretty_points( dplyr::sample_n(df, 500), &#39;pred&#39;, &#39;obs&#39; ) +
  geom_ribbon(mapping = aes(ymin = pred_PI2.5_raw
                            , ymax = pred_PI97.5_raw
                            , fill = &#39;lightsalmon&#39;)
              , data = df
              , color = NA
              , fill = &#39;lightsalmon&#39;
              , alpha = 0.1 ) + 
  geom_line(mapping = aes(x = pred
                          , y = pred_mean_raw
                          )
            , data = df
            , color = &#39;deepskyblue4&#39;
            #, size = 1
            ) +
  coord_cartesian( xlim=c(0,20000), ylim = c(0,20000))

# reorganize layers
p$layers = list(p$layers[[2]], p$layers[[1]], p$layers[[3]] )
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;print(df)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;# A tibble: 53,940 x 6

     obs  pred steps               pred_PI97.5_raw pred_mean_raw pred_PI2.5_raw

   &amp;lt;int&amp;gt; &amp;lt;dbl&amp;gt; &amp;lt;fctr&amp;gt;                        &amp;lt;dbl&amp;gt;         &amp;lt;dbl&amp;gt;          &amp;lt;dbl&amp;gt;

 1   337  -897 [ -897.30, -368.04)             645           492            338

 2   367  -879 [ -897.30, -368.04)             645           492            338

 3   367  -797 [ -897.30, -368.04)             645           492            338

 4   478  -789 [ -897.30, -368.04)             645           492            338

 5   386  -781 [ -897.30, -368.04)             645           492            338

 6   367  -767 [ -897.30, -368.04)             645           492            338

 7   425  -758 [ -897.30, -368.04)             645           492            338

 8   472  -758 [ -897.30, -368.04)             645           492            338

 9   367  -756 [ -897.30, -368.04)             645           492            338

10   472  -748 [ -897.30, -368.04)             645           492            338

# ... with 53,930 more rows
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&#34;plots&#34;&gt;Plots&lt;/h1&gt;

&lt;p&gt;We can plot &lt;code&gt;R&lt;/code&gt; graphics as follows using &lt;code&gt;%%R -w 5 -h 5 --units in -r 200&lt;/code&gt; which sets the output to  5 x 5 inches with a resoulution of 200 dpi. Note this only works as cell magic not as in-line magic.We are using the &lt;code&gt;ggplot2&lt;/code&gt; plot which we created in the previouse &lt;code&gt;R&lt;/code&gt; cell.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-r&#34;&gt;%%R -w 3 -h 3 --units in -r 200
p
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_16_0.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h1 id=&#34;htmlwidgets&#34;&gt;htmlwidgets&lt;/h1&gt;

&lt;h2 id=&#34;plotly&#34;&gt;plotly&lt;/h2&gt;

&lt;p&gt;We can convert &lt;code&gt;ggplot2&lt;/code&gt; plots to &lt;code&gt;plotly&lt;/code&gt; objects and save them as &lt;code&gt;html&lt;/code&gt; and embedd them in an iframe.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-r&#34;&gt;%%R
require(plotly)
pl = ggplotly(p, tooltip = c(&#39;~pred_mean_raw&#39;, &#39;~pred_PI2.5_raw&#39;, &#39;~pred_PI97.5_raw&#39;))
htmlwidgets::saveWidget(pl, &#39;pred_intervall.html&#39; )
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from IPython.display import IFrame

IFrame(&amp;quot;./pred_intervall.html&amp;quot;
      , width = 700
      , height = 700)
&lt;/code&gt;&lt;/pre&gt;

&lt;iframe width=&#34;700&#34; height=&#34;700&#34; frameborder=&#34;0&#34; scrolling=&#34;no&#34; src=&#34;pred_intervall.html&#34;&gt;&lt;/iframe&gt;

&lt;h2 id=&#34;dt&#34;&gt;DT&lt;/h2&gt;

&lt;p&gt;Similarly to &lt;code&gt;plotly&lt;/code&gt; we can embedd dynamic datatables from the &lt;code&gt;DT&lt;/code&gt; package&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-r&#34;&gt;%%R

dt = oetteR::f_datatable_universal( sample_n(df, 500) )
htmlwidgets::saveWidget(dt, &#39;table.html&#39; )
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;IFrame(&amp;quot;./table.html&amp;quot;
      , width = 1100
      , height = 600)
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&#34;tabplot&#34;&gt;tabplot&lt;/h1&gt;

&lt;p&gt;We can use other packages from &lt;code&gt;R&lt;/code&gt; to integrate other useful visualisations such as &lt;code&gt;tabplots&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-r&#34;&gt;%%R -h 5 -w 8 --units in -r 200

require(tabplot)

tableplot( select(ggplot2::diamonds, price, carat, everything()) )
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_24_0.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h1 id=&#34;ggalluvial&#34;&gt;ggalluvial&lt;/h1&gt;

&lt;pre&gt;&lt;code class=&#34;language-r&#34;&gt;%%R -h 5 -w 8 --units in -r 200

require(oetteR)

f_plot_alluvial( select(ggplot2::diamonds, price, carat, cut, clarity) )
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_26_0.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h1 id=&#34;ggpubr&#34;&gt;ggpubr&lt;/h1&gt;

&lt;pre&gt;&lt;code class=&#34;language-r&#34;&gt;%%R -h 5 -w 8 --units in -r 200

require(ggpubr)
require(oetteR)

# generates all possible compbinations and removes pairings with P val &amp;gt; thresh
compare = f_plot_generate_comparison_pairs(ggplot2::diamonds, &#39;price&#39;, &#39;cut&#39;, thresh = 0.05) 

ggviolin( data = ggplot2::diamonds
           , x = &#39;cut&#39;
           , y = &#39;price&#39;
           , color = &#39;cut&#39;
           , fill = &#39;cut&#39;
           , palette = f_plot_col_vector74()
           , add = &#39;boxplot&#39;
           , add.params = list( fill = &#39;white&#39;)
           ) + 
  stat_compare_means(comparisons = compare, label = &amp;quot;p.signif&amp;quot;)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_28_0.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>git command line documentation</title>
      <link>https://www.datisticsblog.com/page/gitdoc/</link>
      <pubDate>Wed, 29 Aug 2018 09:55:50 +0200</pubDate>
      
      <guid>https://www.datisticsblog.com/page/gitdoc/</guid>
      <description>

&lt;!-- toc --&gt;

&lt;h1 id=&#34;ide-vs-shell&#34;&gt;IDE vs Shell&lt;/h1&gt;

&lt;p&gt;So far I was not happy with all the IDEs (Rstudio/Gitkraken/Github desktop) that I have tested. They provide some convenient shortcuts but in the end they tended to screw things up for me. That is why I am writing this documentation.&lt;/p&gt;

&lt;h2 id=&#34;advantages-of-ides&#34;&gt;Advantages of IDEs&lt;/h2&gt;

&lt;p&gt;IDEs are much better at visualizing the branches and the commits. They are also much better for resolving merge conflicts (gitkraken).&lt;/p&gt;

&lt;h2 id=&#34;disadvantages-of-ides&#34;&gt;Disadvantages of IDEs&lt;/h2&gt;

&lt;p&gt;You are always missing a functionality that makes you switch to the Shell. It is better to be literate with the shell commands all together to speed up your workflow.&lt;/p&gt;

&lt;h1 id=&#34;the-git-repository&#34;&gt;The git repository&lt;/h1&gt;

&lt;p&gt;The git repository is your project folder, it contains some hidden files and folders that are used by git to track your commits and the branches. If you run git and open your repository you can set the folder to mirror commits or branches. This will actually change the files that you can find with your system explorer.&lt;/p&gt;

&lt;h1 id=&#34;introduce-yourself&#34;&gt;Introduce yourself&lt;/h1&gt;

&lt;pre&gt;&lt;code&gt;git config --global user.name &#39;Jennifer Bryan&#39;
git config --global user.email &#39;jenny@stat.ubc.ca&#39;
git config --global --list
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&#34;configure-proxy&#34;&gt;Configure Proxy&lt;/h1&gt;

&lt;pre&gt;&lt;code&gt;git config --global http.proxy http://@173.15.80.153:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&#34;setup-local-git-without-remote-repos-and-rstudio&#34;&gt;Setup local git without remote repos and RStudio&lt;/h1&gt;

&lt;p&gt;start with&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;setup .gitignore (see instruction further down)&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git add .
git commit -m &#39;message&#39;
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&#34;setup-local-git-repository-with-remote-repository&#34;&gt;Setup local git repository with remote repository&lt;/h1&gt;

&lt;h2 id=&#34;starting-with-a-local-repository&#34;&gt;starting with a local repository&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Setup a new project using the git option in Rstudio&lt;/li&gt;
&lt;li&gt;Create a new git repository on the github webpage&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;add-the-remote-repository&#34;&gt;add the remote repository&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;git remote add origin https://github.com/user/repo.git
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;verify&#34;&gt;verify&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;git remote -v
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;first-pull&#34;&gt;first pull&lt;/h3&gt;

&lt;p&gt;to get README or .gitognore&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;pull --allow-unrelated-histories
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;first-push&#34;&gt;first push&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;git push --set-upstream origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;starting-with-a-remote-repository&#34;&gt;starting with a remote repository&lt;/h2&gt;

&lt;p&gt;open the directory you want to clone the repository in right click and select &lt;code&gt;git bash here&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git clone https://github.com/erblast/oetteR.git
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&#34;gitignore&#34;&gt;.gitignore&lt;/h1&gt;

&lt;p&gt;The &lt;code&gt;.gitignore&lt;/code&gt; file contains a list of filenames that will be ignored and not and not tracked by git. When you are starting a git project it easy to skip this important file. It is however crucial to set it up before you start coding away. Once you are already deep in the project your workflow will be seriously disturbed when you keep having to do commits for file changes that you cannot control (for example &lt;code&gt;thumbs.db&lt;/code&gt;) or have to resolve merge conflicts in outputfiles of your code such as &lt;code&gt;*.pdf&lt;/code&gt; and &lt;code&gt;*.html&lt;/code&gt; files. You will find that adding filenames to &lt;code&gt;.gitignore&lt;/code&gt; that are already tracked will not work. You have to tediously add them manually in your git bash shell.&lt;/p&gt;

&lt;h2 id=&#34;setting-up-gitignore&#34;&gt;setting up &lt;code&gt;.gitignore&lt;/code&gt;&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Creating your git project with Rstudio will already add some R/Rstudio files to &lt;code&gt;.gitignore&lt;/code&gt;.&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/github/gitignore/blob/master/R.gitignore&#34;&gt;Here&lt;/a&gt; you can find a useful list of files to be added for R projects.&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;creating-gitignore-from-scratch&#34;&gt;Creating &lt;code&gt;.gitignore&lt;/code&gt; from scratch&lt;/h2&gt;

&lt;p&gt;windows will not let you create files with a file name starting with &amp;lsquo;.&amp;rsquo;
use the windows command line tool&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;rename gitignore.txt .gitignore
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;untracking-files-in-hindsight&#34;&gt;Untracking files in hindsight&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;untracking a single file&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git rm --cached [file_name]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;untracking all files in a directory&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git rm --cached inst/\*
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;untrack all files of a certain type&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git rm -r --cached **/*.html
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&#34;navigating-in-the-shell&#34;&gt;Navigating in the shell&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;switch between branches&lt;/strong&gt;
remember you create them only in the remote/origin repository&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git checkout branch
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;what&amp;rsquo;s going on?&lt;/strong&gt;
Carefull the status is not always up to date. It seems to not check if the branch was updated from somewhere else than the current computer. It hapenned several times that the reply to the command implied that the current branch is up-to-date with the origin branch but then a pull command would still retrieve changes.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;pull&#34;&gt;Pull&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Pull all&lt;/strong&gt;&lt;br /&gt;
this would be nice to have but it DOES NOT WORK, it fetches from all branches but MERGES ONLY THE ACTIVE BRANCH.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git pull --all
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;pull active branch&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git pull
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;pull and rebase&lt;/strong&gt;&lt;br /&gt;
If you expect changes in you remote repository for your active branch (if your working on a collaborative project), you can rebase before/while pulling.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git pull --rebase
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;see &lt;a href=&#34;http://kernowsoul.com/blog/2012/06/20/4-ways-to-avoid-merge-commits-in-git/&#34;&gt;http://kernowsoul.com/blog/2012/06/20/4-ways-to-avoid-merge-commits-in-git/&lt;/a&gt;, for setting this up permanently&lt;/p&gt;

&lt;h2 id=&#34;commit&#34;&gt;commit&lt;/h2&gt;

&lt;p&gt;Use &lt;code&gt;git status&lt;/code&gt; to see a if there are any changes to commit. Commit as often as you like, give resonable namings to you commits. A commit will not work if you do not supply a commit message. Git will let you rollback to any commit you made. Always use the &lt;code&gt;-m &amp;quot;text&amp;quot;&lt;/code&gt; operator when calling &lt;code&gt;git commit&lt;/code&gt;, otherwise you will end up will display confusing commit screen.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git commit -m &amp;quot;enter message here&amp;quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;if-you-see-the-confusing-commit-screen&#34;&gt;if you see the confusing commit screen&lt;/h3&gt;

&lt;p&gt;you forgot to type &lt;code&gt;-m &amp;quot;text&amp;quot;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;**hit &lt;code&gt;ESC&lt;/code&gt; **&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;:wq
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;undo-commits-reset&#34;&gt;Undo commits, reset&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Opt1: roll back to remote branch version&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git reset --hard origin/workbranch
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;code&gt;soft&lt;/code&gt; and &lt;code&gt;hard&lt;/code&gt; parameter determines whether to keep the changes or not&lt;/p&gt;

&lt;p&gt;&lt;code&gt;~1&lt;/code&gt; determines how many commits to go back in time&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Opt2: undo last commit keep all changes&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git reset --soft HEAD~1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Opt3: undo last commit discard all changes&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git reset --hard HEAD~1
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;**Opt4: go back to specific commit **&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git reset --hard 904jfd40f
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;should-i-amend-to-previous-commits&#34;&gt;Should I amend to previous commits?&lt;/h3&gt;

&lt;p&gt;No, dont do it. This only work if you have not pushed after your previous commit. If you have pushed you possibly get a merge conflict between origin and the local repository because the two commits are different. You can however fix this by rebasing the remote branch.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git rebase origin/master
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;push&#34;&gt;Push&lt;/h2&gt;

&lt;p&gt;Push local commits to remote&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git push
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Overwrite remote version&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git push origin branch_name -f
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;rebase&#34;&gt;Rebase&lt;/h2&gt;

&lt;p&gt;rebase to update your work branch from master DO NOT FORGET MASTER in the command. Your branch will not fully merge and stuff will be missing and you will get merge conflicts.
&lt;strong&gt;rebase active branch&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git rebase master
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;merge&#34;&gt;Merge&lt;/h2&gt;

&lt;p&gt;Merging can be the most annoying part of using git, I tend to have merge conflicts all the time and they are annoying to resolve. I will have an extra section on this further down.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;merge branch into master&lt;/strong&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git checkout master
git merge work_branch
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;merge-conflicts&#34;&gt;Merge conflicts&lt;/h2&gt;

&lt;p&gt;Those are tedious to resolve and eat up time that could better be spent coding. If you have them use &lt;code&gt;git status&lt;/code&gt; to see whats wrong. Open the files with an editor and find the highlighted conflicting code and edit it. (remove the highlights inserted by git and keep the code that is correct). If there is an delete you can either add &lt;code&gt;git add filename&lt;/code&gt; or remove (&lt;code&gt;git rm filename&lt;/code&gt;). I think it is best to use this manual approach for a while and develope a disciplined git workflow that makes you avoid these all together. Then when you think you got it right switch to gitkraken to handle your merge conflicts.&lt;/p&gt;

&lt;h2 id=&#34;restore-old-commit-versions&#34;&gt;Restore old commit versions&lt;/h2&gt;

&lt;p&gt;Checkout commit history of a certain branch&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git log master

git revert 2342jk23l4jl2hg23k4j2h34
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&#34;managing-branches&#34;&gt;Managing branches&lt;/h1&gt;

&lt;h2 id=&#34;create-branch&#34;&gt;Create branch&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;
git checkout -b [name_of_your_new_branch]

&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;delete-branch&#34;&gt;Delete branch&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;
git branch -d [name_of_your_new_branch]

&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;accidently-worked-on-the-wrong-branch&#34;&gt;Accidently worked on the wrong branch&lt;/h2&gt;

&lt;p&gt;Sometimes you want to commit your changes and realize that you were working in master instead of your release or feature branch&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git stash
git checkout branch123
git stash apply
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&#34;versioning&#34;&gt;Versioning&lt;/h1&gt;

&lt;p&gt;Your &lt;code&gt;master&lt;/code&gt; branch should always be the branch carrying the latest stable version. Branching off &lt;code&gt;master&lt;/code&gt; you have a &lt;code&gt;release&lt;/code&gt; branch  which carries the newest developments. From this you branch off the other branches working on different aspects of the next release. Once the &lt;code&gt;release&lt;/code&gt; branch is stable it can be merged with &lt;code&gt;master&lt;/code&gt;&lt;/p&gt;

&lt;h1 id=&#34;remove-files-from-the-history&#34;&gt;Remove files from the history&lt;/h1&gt;

&lt;p&gt;Sometimes you might need to remove files from prior commits, either you carelessly commited large binary files which are bloating up your history, or some of the history contains sensitive information like passwords.&lt;/p&gt;

&lt;p&gt;If you did not push to remote try undoing the commit using &lt;code&gt;git reset --soft&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This is an incredible hard thing to do. You will find lots of online ressources the most common being a command called &lt;code&gt;filter-branch&lt;/code&gt;. However removing files from git like this is a bit like rying to uninstall a program by removing the &lt;code&gt;run.exe&lt;/code&gt; from the installation folder. There will be a  lot of clutter and references which will not be removed. I recommend the following in this case.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;remove the files you want to remove from your current branch&lt;/li&gt;
&lt;li&gt;create an on-disk copy of your repository&lt;/li&gt;
&lt;li&gt;delete your branch locally and from the remote&lt;/li&gt;
&lt;li&gt;create a new branch&lt;/li&gt;
&lt;li&gt;restore your branch by copying all files from your on-disk copy&lt;/li&gt;
&lt;li&gt;commit all changes&lt;/li&gt;
&lt;li&gt;push to remote&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You cannot remove files from the master branch like this. Either if you do not need the history start a new repo, or figure out the &lt;code&gt;filter-branch&lt;/code&gt; command. This however needs some deeper knowledge on how &lt;code&gt;git&lt;/code&gt; acutally works.&lt;/p&gt;

&lt;h1 id=&#34;submodules&#34;&gt;Submodules&lt;/h1&gt;

&lt;p&gt;SUbmodules are great if you need to include code from another repository into your current repository that should be kept up to date.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git submodule add repo_adress
git submodule init
git submodule update
cd submodule
git checkout v1.0
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;remove-submodules&#34;&gt;Remove Submodules&lt;/h2&gt;

&lt;p&gt;If you dump another git repository into your currrent git repository because you might want to merge the two. Git will create a submodule that persits even if you delete all the git files from the repo that you want to fuze.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;git rm --cached submodule_path # delete reference to submodule HEAD (no trailing slash)
git rm .gitmodules             # if you have more than one submodules,
                               # you need to edit this file instead of deleting!
rm -rf submodule_path/.git     # make sure you have backup!!
git add submodule_path         # will add files instead of commit reference
git commit -m &amp;quot;remove submodule&amp;quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&#34;release-tags&#34;&gt;Release Tags&lt;/h1&gt;

&lt;p&gt;It is good practice to add a release tag after bumping up the version of your repository. It is the easiest to to this via the github website interface. However if you made a mistake and want to remove your current release because you made a typo github will not remove your release tag entirely but simply mark it as deleted which prevents you from creating a new tag with the same name. Thus we can use the following console command to delete it completely (&lt;a href=&#34;https://gist.github.com/mobilemind/7883996&#34;&gt;source&lt;/a&gt;).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;# delete local tag &#39;12345&#39;
git tag -d 12345
# delete remote tag &#39;12345&#39; (eg, GitHub version too)
git push origin :refs/tags/12345
&lt;/code&gt;&lt;/pre&gt;
</description>
    </item>
    
    <item>
      <title>Polyglot conda environments - 2/3 - command line documentation</title>
      <link>https://www.datisticsblog.com/2018/08/conda2/</link>
      <pubDate>Wed, 29 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/08/conda2/</guid>
      <description>




&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;../../../conda_trinity.png&#34; style=&#34;width: 180px;height: 180px;&#34;&gt;
  
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/conda1/&#34;&gt;1 of 3: conda introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/conda2/&#34;&gt;2 of 3: conda command line&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/conda3/&#34;&gt;3 of 3: conda jupyter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- toc --&gt;

&lt;h1 id=&#34;managing-conda-environments&#34;&gt;Managing conda environments&lt;/h1&gt;

&lt;h2 id=&#34;conda-navigator-gui&#34;&gt;conda navigator GUI&lt;/h2&gt;

&lt;p&gt;after installing the anaconda distribution you can run the navigator app, which allows you to create environments and manage
the installed packages. As always with these tools some commands will only work in the command line.&lt;/p&gt;

&lt;h1 id=&#34;command-line&#34;&gt;Command Line&lt;/h1&gt;

&lt;p&gt;condensated version of official &lt;a href=&#34;https://conda.io/docs/user-guide/tasks/manage-environments.html#removing-an-environment&#34;&gt;documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;https://conda.io/docs/_downloads/conda-cheatsheet.pdf&#34;&gt;conda cheat sheet&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&#34;check-installation&#34;&gt;Check installation&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;conda --version
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;create-an-environment&#34;&gt;Create an environment&lt;/h2&gt;

&lt;p&gt;that contains &lt;code&gt;python&lt;/code&gt; and &lt;code&gt;R&lt;/code&gt;, we are specifiying r-base because conda will install the microsoft R distribution by default.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;conda create --name myenv python=3.6 r-base=3.4.3
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;activate-environment&#34;&gt;Activate environment&lt;/h2&gt;

&lt;p&gt;will add your environment to your command line&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;conda activate myenv
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;on older versions of conda
will add your environment to your command line&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;source activate myenv
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;deactivate-environment&#34;&gt;Deactivate environment&lt;/h2&gt;

&lt;p&gt;will remove your environment from your command line&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;conda deactivate
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;remove-an-environment&#34;&gt;Remove an environment&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;conda env remove --name myenv
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;install-packages-and-apps&#34;&gt;Install packages and apps&lt;/h2&gt;

&lt;h3 id=&#34;install-macos-sdk&#34;&gt;Install MacOS SDK&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;anaconda&lt;/code&gt; not only contains packages but also apps and other programs. It also contains a set of compilers. For licensing reasons the MacOS SDK cannot be included and needs to be installed seperately as explained &lt;a href=&#34;https://conda.io/docs/user-guide/tasks/build-packages/compiler-tools.html&#34;&gt;here&lt;/a&gt;. MacOS SDK can be downloaded &lt;a href=&#34;https://github.com/phracker/MacOSX-SDKs&#34;&gt;here&lt;/a&gt; I suggest to download the version that matches the version number of your installed macOS.&lt;/p&gt;

&lt;p&gt;Add the following code to your &lt;code&gt;conda_build_config.yaml&lt;/code&gt; in your HOME directory (create new file if not present).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;CONDA_BUILD_SYSROOT:
  - /opt/MacOSX10.13.sdk        # [osx]
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;channels&#34;&gt;Channels&lt;/h3&gt;

&lt;p&gt;An important issue for &lt;code&gt;anaconda&lt;/code&gt; are the channels where we can find tha packages that we want to install in our &lt;code&gt;anaconda&lt;/code&gt; environments. Each environment contains a list of channels which will be searched from top to bottom for a package that we would like to install. &lt;code&gt;anaconda&lt;/code&gt; will always prioritize the channel over the version number thus might not always install the latest versions. Each environment starts with the channel &lt;code&gt;defaults&lt;/code&gt; which are the official channels&lt;/p&gt;

&lt;h5 id=&#34;add-a-channel-to-the-bottom-of-the-list&#34;&gt;Add a channel to the bottom of the list&lt;/h5&gt;

&lt;p&gt;You want to make sure that the defaults channels rank high thus I recommend appending all new channels.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;conda config --append channels conda-forge bioconductor
&lt;/code&gt;&lt;/pre&gt;

&lt;h5 id=&#34;add-a-channel-to-the-top-of-the-list&#34;&gt;Add a channel to the top of the list&lt;/h5&gt;

&lt;p&gt;here you want to add your own channel containing your anaconda builds.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;conda config --prepend channels anaconda_username
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;install-packages-without-build-compilation&#34;&gt;Install packages without build/compilation&lt;/h3&gt;

&lt;p&gt;&lt;em&gt;make sure the environment that you want to install to is active&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;we can install apps such as Rstudio, pip, etc (see anaconda launcher with the same synthax)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;do not use &lt;code&gt;R; install.packages()&lt;/code&gt;, packages installed that way cannot be tracked&lt;/em&gt;&lt;/p&gt;

&lt;h4 id=&#34;install-from-listed-channel&#34;&gt;Install from listed channel&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;conda install package_name
&lt;/code&gt;&lt;/pre&gt;

&lt;h4 id=&#34;install-from-pip-python-packages&#34;&gt;Install from pip (python packages)&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;conda install pip
pip install package_name
pip install git+repos_url
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;install-packages-with-build-compilation-r-packages&#34;&gt;Install packages with build/compilation (R packages)&lt;/h3&gt;

&lt;p&gt;This will be mostly required for &lt;code&gt;R&lt;/code&gt; packages that cannot be found on &lt;code&gt;anaconda&lt;/code&gt; ressources which unfortunately is true for most of the packages. Managing your &lt;code&gt;R&lt;/code&gt; packages with &lt;code&gt;anaconda&lt;/code&gt; takes a long time to set up if you already start with a large set of package requirements and can be efficient if you gradually build it up as you go. However you will not be cross platform compatible. You will have to more or less go through the same iterative steps on each platform you want to be compatible with. The reason is that &lt;code&gt;R&lt;/code&gt; packages containing &lt;code&gt;C++&lt;/code&gt; or &lt;code&gt;Fortran&lt;/code&gt; code need different compilers depending on the operating system that you use. Some of these compilers are not referenced directly but they reference to another &lt;code&gt;R&lt;/code&gt; package which is at the base of the dependency trail. There is the option of converting you package builds compiled on one platform to another which will work for the majority of the packages but not for all.&lt;/p&gt;

&lt;h4 id=&#34;workflow-outline-for-creating-an-r-environment&#34;&gt;Workflow outline for creating an &lt;code&gt;R&lt;/code&gt; environment&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;create an anaconda account where you will upload your packages to&lt;/li&gt;
&lt;li&gt;enable automatic uploading after package building&lt;/li&gt;
&lt;li&gt;create an environment inlcuding python, R, and r-essentials.&lt;/li&gt;
&lt;li&gt;add personal R channel to the top of you channels list&lt;/li&gt;
&lt;li&gt;add bioconductor and conda-forge to the end of your channels list&lt;/li&gt;
&lt;li&gt;identify a package that you want to add to your environment which is not available from an anaconda source&lt;/li&gt;
&lt;li&gt;download a skeleton from CRAN&lt;/li&gt;
&lt;li&gt;build/compile the package

&lt;ul&gt;
&lt;li&gt;anaconda will create test environment in which the package will be built based on the requirements saved in the skeleton. For &lt;code&gt;R&lt;/code&gt; packages it will only detect dependencies in the &lt;code&gt;DESCRIPTION&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;anaconda will look for the required packages in the channels and try to install whatever it finds. It will list all packages and sources it will install from. If it cannot find the necessary packages it will fail.&lt;/li&gt;
&lt;li&gt;anaconda might raise a dependency conflict remove the package you suspect to be the oldest and skeleton/build install again.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;Troubleshoot if compiling/building fails

&lt;ul&gt;
&lt;li&gt;Try to skim the error message for the incompatible package, however the error message is not always meaningful&lt;/li&gt;
&lt;li&gt;&lt;code&gt;R&lt;/code&gt; Packages from conda-forge and bioconductor are likely to be outdated get them from CRAN as skeleton instead&lt;/li&gt;
&lt;li&gt;&lt;code&gt;R&lt;/code&gt; packages have the &lt;code&gt;R&lt;/code&gt; version that they were compiled for attached to the version number. Check if that matches the &lt;code&gt;r-base&lt;/code&gt; version of your environment&lt;/li&gt;
&lt;li&gt;Packages that come from you own repository but have initially been built for another platform and contain &lt;code&gt;C++&lt;/code&gt; or &lt;code&gt;Fortran&lt;/code&gt; code must likely be rebuilt from skeleton for your present platform.&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;If building/compilation was successfull the package will be uploaded to our anaconda repository from where it can be installed&lt;/li&gt;
&lt;li&gt;repeat those steps until all packages have been successfully installed&lt;/li&gt;
&lt;li&gt;if you can run some test code, download the source code with the highest number of dependencies and run the inlcuded test.&lt;/li&gt;
&lt;li&gt;export an yml file and try to recreate the environment from it.&lt;/li&gt;
&lt;li&gt;Consider to repeat this process for the other platorms as well if you want your code to be completely portable&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;This process is very tedious however it will always work once you identify the incompatibilities&lt;/strong&gt;&lt;/p&gt;

&lt;h4 id=&#34;list-of-r-packages-that-contain-c-or-fortran-and-are-not-part-of-r-essentials&#34;&gt;List of R packages that contain &lt;code&gt;C++&lt;/code&gt; or &lt;code&gt;fortran&lt;/code&gt; and are not part of r-essentials&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;fastmatch&lt;/li&gt;
&lt;li&gt;ff&lt;/li&gt;
&lt;li&gt;ffbase&lt;/li&gt;
&lt;li&gt;bit&lt;/li&gt;
&lt;li&gt;spam&lt;/li&gt;
&lt;li&gt;maps&lt;/li&gt;
&lt;li&gt;dotcall64&lt;/li&gt;
&lt;li&gt;fields&lt;/li&gt;
&lt;li&gt;spam&lt;/li&gt;
&lt;li&gt;mda&lt;/li&gt;
&lt;li&gt;party&lt;/li&gt;
&lt;li&gt;cubist&lt;/li&gt;
&lt;li&gt;kknn&lt;/li&gt;
&lt;li&gt;gamlss&lt;/li&gt;
&lt;li&gt;rlang (part of r-essentials but better to install the newest version)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&#34;create-an-anaconda-account-and-login-activate-automated-upload&#34;&gt;Create an anaconda account and login, activate automated upload&lt;/h4&gt;

&lt;p&gt;create the account on &lt;a href=&#34;https://anaconda.org&#34;&gt;anaconda.org&lt;/a&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;anaconda login
conda config --set anaconda_upload yes
# anaconda logout
&lt;/code&gt;&lt;/pre&gt;

&lt;h4 id=&#34;download-skeleton-form-cran-github&#34;&gt;Download skeleton form CRAN/github&lt;/h4&gt;

&lt;h4 id=&#34;github-release-tags&#34;&gt;github release tags&lt;/h4&gt;

&lt;p&gt;anaconda will automatically checkout out the master branch with the latest release tag of packages from github. Often repository owners do not assign release tags or only if a major version increment has been made. Therefore it is best to fork the repository to a personal public github account and then apply any missing release tags.&lt;/p&gt;

&lt;h4 id=&#34;github-dependencies&#34;&gt;github dependencies&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;R&lt;/code&gt; packages from github do not have to pass any quality checks as they need to for being uploaded to CRAN. Therefore it can happen that not all dependencies from the &lt;code&gt;NAMESPACE&lt;/code&gt; file are also listed in the &lt;code&gt;DESCRIPTION&lt;/code&gt; file. In such a case the testing environment for creating a conda build will not be sufficient.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;conda skeleton cran rlang
conda skeleton cran https://github.com/erblast/ggplot2.git
&lt;/code&gt;&lt;/pre&gt;

&lt;h4 id=&#34;build-packages-from-skeleton&#34;&gt;Build packages from skeleton&lt;/h4&gt;

&lt;p&gt;we have to ad a &lt;code&gt;r-&lt;/code&gt; prefix to the package name and put the package name in &lt;em&gt;lowercase&lt;/em&gt; the build are R-version specific so it is best to specify it in the command.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;conda build r-rlang --R 3.5.1
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;check-package-installations&#34;&gt;Check package installations&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;conda list -name myenv pandas
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;exporting-an-environment-to-yml&#34;&gt;Exporting an environment to .yml&lt;/h3&gt;

&lt;p&gt;activate the environment that you want to export. It will save a &lt;code&gt;.yml&lt;/code&gt; file into the current working directory&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;conda env export -f myenv.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;build-environment-based-on-yml-file&#34;&gt;Build environment based on .yml file&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;conda env create -f environment.yml
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;clone-an-existing-environment&#34;&gt;Clone an existing environment&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;conda create --name myclone --clone myenv
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;convert-packages-to-other-formats-on-linux&#34;&gt;Convert packages to other formats on linux&lt;/h3&gt;

&lt;p&gt;This did only work for me when trying to convert from OS-64 to linux-64 for packages that did not need compilation.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Change to your conda-bld directory in the shell&lt;/em&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;for f in *.bz2; do conda convert -f --platform linux-64 -o .. $f; done
&lt;/code&gt;&lt;/pre&gt;
</description>
    </item>
    
    <item>
      <title>Polyglot conda environments - 1/3 - Introduction</title>
      <link>https://www.datisticsblog.com/2018/08/conda1/</link>
      <pubDate>Tue, 28 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/08/conda1/</guid>
      <description>




&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;../../../conda_trinity.png&#34; style=&#34;width: 180px;height: 180px;&#34;&gt;
  
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/conda1/&#34;&gt;1 of 3: conda introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/conda2/&#34;&gt;2 of 3: conda command line&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/conda3/&#34;&gt;3 of 3: conda jupyter&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- toc --&gt;

&lt;p&gt;In this series of posts we want to show how we can use conda environments for polyglot data science projects that use both
R and python.&lt;/p&gt;

&lt;h1 id=&#34;polyglot-environments&#34;&gt;Polyglot Environments&lt;/h1&gt;

&lt;p&gt;Polyglot environments are basically environments that use more than one programming language. For data science &lt;code&gt;R&lt;/code&gt; and
&lt;code&gt;python&lt;/code&gt; are the most popular programming languages and most projects decide on either using one or the other. Why should
we shoulder the extra effort of using &lt;code&gt;R&lt;/code&gt; and &lt;code&gt;python&lt;/code&gt; on the same project? Well there could be plenty of reasons:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Inclusiveness&lt;/strong&gt;, you can include new team members that come from the other language more quickly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reusability&lt;/strong&gt;, if you already have solved similar problems in the other language you can reuse the code.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Capability&lt;/strong&gt;, you increase the number of tools and packages that you can use for your project.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Your typical data science environment does not only include the code that you write but also the software that is
installed on you computer including the operating system as well as the hardware it is running on.
Typically it also consists of a data interface through which your data is loaded onto your system
and a reporting interface that communicates the results of your analysis.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;slide1.png&#34; alt=&#34;&#34; /&gt;&lt;/p&gt;

&lt;p&gt;In fact most data projects are already openly polyglot because they include SQL code to call data from
database via the data interface (the database drivers). But even if they are not underneath
the hood the interfaces and the packages you have installed will be using a variety of other
programming languages so technically the primary language that you chose for you data project
is primarily glue code for all the other languages that you are implicitly using.&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;slide2.png&#34; alt=&#34;&#34; /&gt;&lt;/p&gt;

&lt;p&gt;Both &lt;code&gt;R&lt;/code&gt; and &lt;code&gt;python&lt;/code&gt; make it easy for you to put your code in packages and to add documentation
and unittests. So using a second language can basically be seen as using yet another package.
Simply put the code of the secondary language into functional units that in the end require
minimal, easily readable code when called. Add some tests and documentation so also team members
that are inexperienced in the secondary language can understand, use and trust its code.&lt;/p&gt;

&lt;h1 id=&#34;reproducibilty&#34;&gt;Reproducibilty&lt;/h1&gt;

&lt;p&gt;Reproducibility is a challenge for each data science project. As illustrated before data science
environments are not isolated entities that run independently by themselves but they
are often connected to other systems from where they gather there data and to which they transmit
their results to. Therefore a variety of dependencies exist that are needed for the code to run properly.&lt;/p&gt;

&lt;h2 id=&#34;dependencies&#34;&gt;Dependencies&lt;/h2&gt;

&lt;h3 id=&#34;code-dependencies&#34;&gt;Code dependencies&lt;/h3&gt;

&lt;p&gt;These are the obvious dependencies which are easily avoided by adhering to good coding practices.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;file paths&lt;/li&gt;
&lt;li&gt;random numbers or randomized code outcome&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;software-dependencies&#34;&gt;Software dependencies&lt;/h3&gt;

&lt;p&gt;A typical data science project can depend on a number of installations on your machine. To name a few of them&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;R&lt;/code&gt; *&lt;/li&gt;
&lt;li&gt;&lt;code&gt;R packages&lt;/code&gt; *&lt;/li&gt;
&lt;li&gt;&lt;code&gt;python&lt;/code&gt; *&lt;/li&gt;
&lt;li&gt;&lt;code&gt;python packages&lt;/code&gt; *&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pip&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;Java&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;a C++ compiler&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;pandoc&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;latex&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;phantom js&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;database drivers&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The most important being &lt;code&gt;R&lt;/code&gt; and &lt;code&gt;python&lt;/code&gt; and the underlying packages which usually shoulder the workload of your code.&lt;/p&gt;

&lt;h3 id=&#34;system-hardware-dependencies&#34;&gt;System/Hardware dependencies&lt;/h3&gt;

&lt;p&gt;Then there is you machine in itself which has a specific get up:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OS (32bit, 64bit)&lt;/li&gt;
&lt;li&gt;environment variable&lt;/li&gt;
&lt;li&gt;Hardware (number of cores, RAM, GPU)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;connectivity-dependencies&#34;&gt;Connectivity dependencies&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Data interface (database drivers, clients to connect to Big Data infrastructure, REST API calls)&lt;/li&gt;
&lt;li&gt;Output interface (html reports, BI tools, git commit and push)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;strategies&#34;&gt;Strategies&lt;/h2&gt;

&lt;p&gt;&lt;img src=&#34;slide3.png&#34; alt=&#34;&#34; /&gt;&lt;/p&gt;

&lt;h3 id=&#34;programming-language-based-solutions&#34;&gt;Programming language-based solutions&lt;/h3&gt;

&lt;p&gt;There are a number of strategies to reproducibly preserve either your &lt;code&gt;python&lt;/code&gt; or your &lt;code&gt;R&lt;/code&gt; installation. For &lt;code&gt;R&lt;/code&gt; there is &lt;code&gt;packrat&lt;/code&gt; and &lt;code&gt;checkpoint&lt;/code&gt; and for &lt;code&gt;python&lt;/code&gt; there is the &lt;code&gt;pip freeze&lt;/code&gt; command, which preserves all packages and version in a &lt;code&gt;requirements.txt&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;However these solutions are focused on snapshotting the programming language installation and do not consider any of the other tools and system configurations that might be necessary to run your code.&lt;/p&gt;

&lt;h3 id=&#34;environment-based-solutions-anaconda-conda&#34;&gt;Environment-based solutions (anaconda/conda)&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;conda&lt;/code&gt; environments use a bit of a more holistic approach and strive to encapsulate apps and programming languages including the packages. They provide a strategy for handling &lt;code&gt;R&lt;/code&gt; and &lt;code&gt;python&lt;/code&gt; simultaneously and they have a set of packages for which they offer their own support for. Meaning you can download the packages from a &lt;code&gt;conda&lt;/code&gt; server and they are garanteed to be compatible with each other as long as they are being installed at the same time. However the &lt;code&gt;conda&lt;/code&gt; environments are not garanteed to be platform independent. The list of supported packages depends on the OS. However anaconda will make an effort to replicate the environment as closely as possible.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.anaconda.com/anaconda/packages/pkg-docs&#34;&gt;list of all &lt;code&gt;python&lt;/code&gt; packages managed by &lt;code&gt;anaconda&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://docs.anaconda.com/anaconda/packages/r-language-pkg-docs&#34;&gt;list of all &lt;code&gt;R&lt;/code&gt; packages managed by &lt;code&gt;anaconda&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;container-based-solutions&#34;&gt;Container-based solutions&lt;/h3&gt;

&lt;p&gt;The state of the art solution is a &lt;code&gt;docker&lt;/code&gt; container, which containerizes everything (tools, drivers, environment variables, etc), this eases pushing code into procuction  as explained &lt;a href=&#34;https://www.dataquest.io/blog/docker-data-science/&#34;&gt;here&lt;/a&gt;. There are even solutions for systems with specialized hardware configurations such as GPUs, as explained &lt;a href=&#34;https://indico.io/data-science-deployments-docker/&#34;&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&#34;conda-environments&#34;&gt;conda environments&lt;/h1&gt;

&lt;p&gt;&lt;img src=&#34;slide4.png&#34; alt=&#34;&#34; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;conda&lt;/code&gt; environments are very popular among &lt;code&gt;python&lt;/code&gt; users. &lt;code&gt;python&lt;/code&gt; packages are distributed on Pypi and are uncompiled,
thus installing the most common datascience packages can be quite tricky because there are a lot of things that can go wrong
when compiling code.
&lt;code&gt;conda&lt;/code&gt; allows you to create different environments on your hard drive that are independent from each other and into which
all kind of software can be installed and it is not limited to python. For software to be installed into a conda environments
it needs to be available as a precompiled conda build for the OS at hand on one of the official conda servers. Before
installing the new software conda will check whether all dependencies of the new package are already installed
or available on the conda servers. It will also check whether there might a dependency conflict with software that
is already installed. If all software that needed is available through conda sources the environment can easily
be recreated on another system with the same operating system by simply exporting a list of all the software that is installed.&lt;/p&gt;

&lt;h2 id=&#34;python-packages&#34;&gt;python packages&lt;/h2&gt;

&lt;p&gt;If python packages cannot be found on conda servers they can simply be installed via pip when called from within
the activated conda environment. conda will use its internal compiler if the package needs compilation.
This is a bit risky because the compilation step might not be as easily reproducible on another system.&lt;/p&gt;

&lt;h2 id=&#34;r-packages&#34;&gt;R packages&lt;/h2&gt;

&lt;p&gt;We can install R packages if there are not available from conda sources by making our own conda builds.
conda will create a build recipe based upon the information it finds on CRAN and then will use the
internal compiler to create a conda build which then can be uploaded to a conda server from which it can be retrieved and installed.
This is a bit tedious because for this to work we need to have already preinstalled all dependencies for a given packages. Thus we need to find the packages with no or few dependencies and work our way up.
It might be frustrating to start this process but it will almost always work. You can find detailed instructions in the next post.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Moving from R to python - 7/7 - automated machine learning</title>
      <link>https://www.datisticsblog.com/2018/08/r2py_automated_ml/</link>
      <pubDate>Mon, 27 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/08/r2py_automated_ml/</guid>
      <description>




&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;../../../r2py.png&#34; style=&#34;width: 180px;height: 180px;&#34;&gt;
  
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_ide/&#34;&gt;1 of 7: IDE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_pandas/&#34;&gt;2 of 7: pandas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_matplotlib_seaborn/&#34;&gt;3 of 7: matplotlib and seaborn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_plotly/&#34;&gt;4 of 7: plotly&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn/&#34;&gt;5 of 7: scikitlearn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn_advanced/&#34;&gt;6 of 7: advanced scikitlearn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_automated_ml/&#34;&gt;7 of 7: automated machine learning&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- toc --&gt;

&lt;h1 id=&#34;automated-machine-learning&#34;&gt;Automated Machine Learning&lt;/h1&gt;

&lt;p&gt;We have seen in the previous &lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn_advanced/&#34;&gt;post on advanced scikitlearn methods&lt;/a&gt; that using pipes in &lt;code&gt;scikitlearn&lt;/code&gt; allows us to write pretty generalizable code, however we still need to customize our  modelling pipeline to the algorithms that we want to use. However theoretically since &lt;code&gt;scikitlearn&lt;/code&gt; uses a unified synthax there is no reason why we should not try all the modelling algorithms supported by scikitlearn. We can also combine the modelling algorithm with various feature selection and preprocessing steps. The first limiting factor is that theoretically we need to define the hyperparameter space that is being searched for each model even if we are using randomized search. Which requires some manual coding the second limiting factor is computational power it will simply take a very long time to go through all possible combinations of pipes that we could build.&lt;/p&gt;

&lt;p&gt;Packages for automated machine learning have taken care of the manual work we would need to do to program the hyperparameter search and mitigate the problem of computational power by employing specific search strategies that allow us to preselect pipes that are likely to succeed and optimise hyperparameter search in a way that we do not have to test every single combinations.&lt;/p&gt;

&lt;h2 id=&#34;tpot&#34;&gt;&lt;code&gt;tpot&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;tpot&lt;/code&gt; is a data science assistant that iteratively constructs &lt;code&gt;sklearn&lt;/code&gt; pipelines and optimises them using genetic programming algorithms that are able to optimize multiple criteria simulaneously while minimizing complexity at the same time. It uses a package called &lt;a href=&#34;https://deap.readthedocs.io/en/master/&#34;&gt;deap&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Supports regression and classification&lt;/li&gt;
&lt;li&gt;Supports the usual performance metrics&lt;/li&gt;
&lt;li&gt;Is meant to run for hours to days&lt;/li&gt;
&lt;li&gt;We can inspect the process anytime and look at intermediate results&lt;/li&gt;
&lt;li&gt;We can limit algorithms and hyperparameter space (not so usefull at the moment because we have to sepcifiy the whole pyrameter range and basically get stuck doing grid search)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;tpot&lt;/code&gt; can generate python code to reconstruct the best models&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;load-data&#34;&gt;Load data&lt;/h3&gt;

&lt;p&gt;We have prepared the data that we are going to use in the previous &lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn_advanced/&#34;&gt;post on advanced scikitlearn methods&lt;/a&gt;. It is basically the titanic dataset with imputed numerical and categorical variables.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;import feather

df = feather.read_dataframe(&#39;./data/mapped_df.feather&#39;)

y = df[&#39;y&#39;]
X = df.drop(&#39;y&#39;, axis = 1)\
 .as_matrix()
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;C:\anaconda\envs\py36r343\lib\site-packages\ipykernel\__main__.py:6: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;run&#34;&gt;Run&lt;/h3&gt;

&lt;div class=&#34;alert info &#34;&gt;
  &lt;p&gt;We are using a limited version of &lt;code&gt;tpot&lt;/code&gt; which uses only fast algorithms&lt;/p&gt;
&lt;/div&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from tpot import TPOTClassifier

pipeline_optimizer = TPOTClassifier(generations=2
                                    , population_size=2
                                    , offspring_size = 5
                                    ## TPOT will evaluate population_size 
                                    ## + generations × offspring_size = pipelines 
                                    ## in total.
                                    , cv=5
                                    , random_state=42 ##seed
                                    , verbosity=2 ## print progressbar
                                    , n_jobs = 4
                                    , warm_start = True ## allows us to restart
                                    , scoring = &#39;roc_auc&#39;
                                    , config_dict = &#39;TPOT light&#39; ## only uses fast algorithms
                                   )

pipeline_optimizer.fit(X,y)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;HBox(children=(IntProgress(value=0, description=&#39;Optimization Progress&#39;, max=12), HTML(value=&#39;&#39;)))


Generation 1 - Current best internal CV score: 0.8616010162631975
Generation 2 - Current best internal CV score: 0.8628532835333793

Best pipeline: LogisticRegression(Normalizer(input_matrix, norm=l1), C=20.0, dual=False, penalty=l1)





TPOTClassifier(config_dict=&#39;TPOT light&#39;, crossover_rate=0.1, cv=5,
        disable_update_check=False, early_stop=None, generations=2,
        max_eval_time_mins=5, max_time_mins=None, memory=None,
        mutation_rate=0.9, n_jobs=4, offspring_size=5,
        periodic_checkpoint_folder=None, population_size=2,
        random_state=42, scoring=&#39;roc_auc&#39;, subsample=1.0, use_dask=False,
        verbosity=2, warm_start=True)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;pipeline_optimizer.score(X,y)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;0.8745406320902439
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;export-best-modelling-pipeline-as-python-code&#34;&gt;Export  best modelling pipeline as python code&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;pipeline_optimizer.export(&#39;./data/pipe.py&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;True
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;get-the-best-pipe&#34;&gt;Get the best pipe&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;pipeline_optimizer.fitted_pipeline_
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;Pipeline(memory=None,
     steps=[(&#39;normalizer&#39;, Normalizer(copy=True, norm=&#39;l1&#39;)), (&#39;logisticregression&#39;, LogisticRegression(C=20.0, class_weight=None, dual=False, fit_intercept=True,
          intercept_scaling=1, max_iter=100, multi_class=&#39;ovr&#39;, n_jobs=1,
          penalty=&#39;l1&#39;, random_state=None, solver=&#39;liblinear&#39;, tol=0.0001,
          verbose=0, warm_start=False))])
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;get-all-tested-pipes&#34;&gt;Get all tested pipes&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;pipeline_optimizer.evaluated_individuals_
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;{&#39;DecisionTreeClassifier(input_matrix, DecisionTreeClassifier__criterion=entropy, DecisionTreeClassifier__max_depth=2, DecisionTreeClassifier__min_samples_leaf=12, DecisionTreeClassifier__min_samples_split=4)&#39;: {&#39;crossover_count&#39;: 0,
  &#39;generation&#39;: &#39;INVALID&#39;,
  &#39;internal_cv_score&#39;: 0.8557279030479364,
  &#39;mutation_count&#39;: 2,
  &#39;operator_count&#39;: 1,
  &#39;predecessor&#39;: (&#39;DecisionTreeClassifier(input_matrix, DecisionTreeClassifier__criterion=entropy, DecisionTreeClassifier__max_depth=3, DecisionTreeClassifier__min_samples_leaf=12, DecisionTreeClassifier__min_samples_split=4)&#39;,)},
 &#39;DecisionTreeClassifier(input_matrix, DecisionTreeClassifier__criterion=entropy, DecisionTreeClassifier__max_depth=3, DecisionTreeClassifier__min_samples_leaf=12, DecisionTreeClassifier__min_samples_split=4)&#39;: {&#39;crossover_count&#39;: 0,
  &#39;generation&#39;: &#39;INVALID&#39;,
  &#39;internal_cv_score&#39;: 0.8616010162631975,
  &#39;mutation_count&#39;: 1,
  &#39;operator_count&#39;: 1,
  &#39;predecessor&#39;: (&#39;GaussianNB(input_matrix)&#39;,)},
 &#39;GaussianNB(input_matrix)&#39;: {&#39;crossover_count&#39;: 0,
  &#39;generation&#39;: 0,
  &#39;internal_cv_score&#39;: 0.816504621285001,
  &#39;mutation_count&#39;: 0,
  &#39;operator_count&#39;: 1,
  &#39;predecessor&#39;: (&#39;ROOT&#39;,)},
 &#39;KNeighborsClassifier(BernoulliNB(input_matrix, BernoulliNB__alpha=10.0, BernoulliNB__fit_prior=True), KNeighborsClassifier__n_neighbors=21, KNeighborsClassifier__p=1, KNeighborsClassifier__weights=distance)&#39;: {&#39;crossover_count&#39;: 0,
  &#39;generation&#39;: &#39;INVALID&#39;,
  &#39;internal_cv_score&#39;: 0.8499987059406567,
  &#39;mutation_count&#39;: 1,
  &#39;operator_count&#39;: 2,
  &#39;predecessor&#39;: (&#39;KNeighborsClassifier(input_matrix, KNeighborsClassifier__n_neighbors=21, KNeighborsClassifier__p=1, KNeighborsClassifier__weights=distance)&#39;,)},
 &#39;KNeighborsClassifier(BernoulliNB(input_matrix, BernoulliNB__alpha=100.0, BernoulliNB__fit_prior=True), KNeighborsClassifier__n_neighbors=21, KNeighborsClassifier__p=1, KNeighborsClassifier__weights=distance)&#39;: {&#39;crossover_count&#39;: 0,
  &#39;generation&#39;: &#39;INVALID&#39;,
  &#39;internal_cv_score&#39;: 0.8484891857167135,
  &#39;mutation_count&#39;: 1,
  &#39;operator_count&#39;: 2,
  &#39;predecessor&#39;: (&#39;KNeighborsClassifier(input_matrix, KNeighborsClassifier__n_neighbors=21, KNeighborsClassifier__p=1, KNeighborsClassifier__weights=distance)&#39;,)},
 &#39;KNeighborsClassifier(input_matrix, KNeighborsClassifier__n_neighbors=21, KNeighborsClassifier__p=1, KNeighborsClassifier__weights=distance)&#39;: {&#39;crossover_count&#39;: 0,
  &#39;generation&#39;: 0,
  &#39;internal_cv_score&#39;: 0.8470927552585381,
  &#39;mutation_count&#39;: 0,
  &#39;operator_count&#39;: 1,
  &#39;predecessor&#39;: (&#39;ROOT&#39;,)},
 &#39;KNeighborsClassifier(input_matrix, KNeighborsClassifier__n_neighbors=22, KNeighborsClassifier__p=1, KNeighborsClassifier__weights=distance)&#39;: {&#39;crossover_count&#39;: 0,
  &#39;generation&#39;: &#39;INVALID&#39;,
  &#39;internal_cv_score&#39;: 0.846680654239431,
  &#39;mutation_count&#39;: 1,
  &#39;operator_count&#39;: 1,
  &#39;predecessor&#39;: (&#39;KNeighborsClassifier(input_matrix, KNeighborsClassifier__n_neighbors=21, KNeighborsClassifier__p=1, KNeighborsClassifier__weights=distance)&#39;,)},
 &#39;LogisticRegression(MinMaxScaler(input_matrix), LogisticRegression__C=20.0, LogisticRegression__dual=False, LogisticRegression__penalty=l1)&#39;: {&#39;crossover_count&#39;: 0,
  &#39;generation&#39;: &#39;INVALID&#39;,
  &#39;internal_cv_score&#39;: 0.8584054700315054,
  &#39;mutation_count&#39;: 2,
  &#39;operator_count&#39;: 2,
  &#39;predecessor&#39;: (&#39;LogisticRegression(input_matrix, LogisticRegression__C=20.0, LogisticRegression__dual=False, LogisticRegression__penalty=l1)&#39;,)},
 &#39;LogisticRegression(Normalizer(input_matrix, Normalizer__norm=l1), LogisticRegression__C=20.0, LogisticRegression__dual=False, LogisticRegression__penalty=l1)&#39;: {&#39;crossover_count&#39;: 0,
  &#39;generation&#39;: &#39;INVALID&#39;,
  &#39;internal_cv_score&#39;: 0.8628532835333793,
  &#39;mutation_count&#39;: 2,
  &#39;operator_count&#39;: 2,
  &#39;predecessor&#39;: (&#39;LogisticRegression(input_matrix, LogisticRegression__C=20.0, LogisticRegression__dual=False, LogisticRegression__penalty=l1)&#39;,)},
 &#39;LogisticRegression(input_matrix, LogisticRegression__C=20.0, LogisticRegression__dual=False, LogisticRegression__penalty=l1)&#39;: {&#39;crossover_count&#39;: 0,
  &#39;generation&#39;: &#39;INVALID&#39;,
  &#39;internal_cv_score&#39;: 0.8584323502037432,
  &#39;mutation_count&#39;: 1,
  &#39;operator_count&#39;: 1,
  &#39;predecessor&#39;: (&#39;GaussianNB(input_matrix)&#39;,)},
 &#39;LogisticRegression(input_matrix, LogisticRegression__C=20.0, LogisticRegression__dual=False, LogisticRegression__penalty=l2)&#39;: {&#39;crossover_count&#39;: 0,
  &#39;generation&#39;: &#39;INVALID&#39;,
  &#39;internal_cv_score&#39;: 0.8586414616613588,
  &#39;mutation_count&#39;: 2,
  &#39;operator_count&#39;: 1,
  &#39;predecessor&#39;: (&#39;LogisticRegression(input_matrix, LogisticRegression__C=20.0, LogisticRegression__dual=False, LogisticRegression__penalty=l1)&#39;,)}}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;auto-sklearn&#34;&gt;&lt;code&gt;auto-sklearn&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;auto-skelarn&lt;/code&gt; uses bayesian methods to optimize computing time. We will add an example in a later version of this post&lt;/p&gt;

&lt;h2 id=&#34;summary&#34;&gt;Summary&lt;/h2&gt;

&lt;p&gt;Even though auto-sklearn still needs to be tested we could already obtain pretty decent results using &lt;code&gt;tpot&lt;/code&gt; with a ROC score of 0.87 which is higher then our previous attempts. Normally I would follow the following strategy to select a model.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Test all models on the same cv pairs&lt;/li&gt;
&lt;li&gt;Calculate mean and SEM for the performance metric of each variant&lt;/li&gt;
&lt;li&gt;Look at the model with the lowest mean&lt;/li&gt;
&lt;li&gt;Select the simplest model whose mean is still in the range of the overall lowest mean + SEM&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However &lt;code&gt;tpot&lt;/code&gt; does not give us the SEM values thus we cannot select the model which it presents us to be the best and compare it to simpler ones it might have fitted. Given that the &lt;code&gt;tpot&lt;/code&gt; algorithm is already minimizing the complexity we should simply accept the best model it returns. We should however then compare it to simpler models we can come up with to have a frame of reference to compare it to and of course we should check the &lt;code&gt;tpot&lt;/code&gt; model for plausibility.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Moving from R to python - 6/7 - advanced scikitlearn</title>
      <link>https://www.datisticsblog.com/2018/08/r2py_scikitlearn_advanced/</link>
      <pubDate>Sun, 26 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/08/r2py_scikitlearn_advanced/</guid>
      <description>




&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;../../../r2py.png&#34; style=&#34;width: 180px;height: 180px;&#34;&gt;
  
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_ide/&#34;&gt;1 of 7: IDE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_pandas/&#34;&gt;2 of 7: pandas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_matplotlib_seaborn/&#34;&gt;3 of 7: matplotlib and seaborn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_plotly/&#34;&gt;4 of 7: plotly&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn/&#34;&gt;5 of 7: scikitlearn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn_advanced/&#34;&gt;6 of 7: advanced scikitlearn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_automated_ml/&#34;&gt;7 of 7: automated machine learning&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- toc --&gt;

&lt;h1 id=&#34;advanced-scikitlearn&#34;&gt;Advanced scikitlearn&lt;/h1&gt;

&lt;p&gt;In the last post, we have seen some advantages of &lt;code&gt;scikitlearn&lt;/code&gt;. Most notably the seamless integration of parallel processing. I was struggeling a bit with the fact that &lt;code&gt;scikitlearn&lt;/code&gt; only accepts &lt;code&gt;numpy&lt;/code&gt; arrays as input and I was missing the &lt;code&gt;recipes&lt;/code&gt; package which makes initial data transformation in &lt;code&gt;R&lt;/code&gt; so much easier. Then I stumbled upon &lt;code&gt;sklearn-pandas&lt;/code&gt; which seamlessly integrates &lt;code&gt;pandas&lt;/code&gt; with &lt;code&gt;sklearn&lt;/code&gt; without having to worry about numpy arrays and it supports a pipe based workflow, which is a &lt;code&gt;sklearn&lt;/code&gt; feaure I have not started to explore yet.&lt;/p&gt;

&lt;p&gt;Apart from &lt;code&gt;sklearn-pandas&lt;/code&gt; there are a number of projects that use the synthax and structure of scikit learn, a collection of them can be found at&lt;/p&gt;

&lt;p&gt;-&lt;a href=&#34;https://github.com/scikit-learn-contrib/scikit-learn-contrib/blob/master/README.md&#34;&gt;http://contrib.scikit-learn.org/imbalanced-learn/stable/index.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;-&lt;a href=&#34;http://scikit-learn.org/stable/related_projects.html&#34;&gt;http://scikit-learn.org/stable/related_projects.html&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&#34;sklearn-pandas&#34;&gt;&lt;code&gt;sklearn-pandas&lt;/code&gt;&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/scikit-learn-contrib/sklearn-pandas&#34;&gt;github&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Core of this package is the &lt;code&gt;DataFrameMapper&lt;/code&gt; class which maps scikit learn Transformer classes to specific columns of a dataframe and outputs either a numpy array or dataframe.&lt;/p&gt;

&lt;p&gt;Additionally it provides a &lt;code&gt;CategoricalImputer&lt;/code&gt; which accepts categorical data, which I had to write myself before in the last post.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;import seaborn as sns
import numpy as np
import pandas as pd
import sklearn

from sklearn_pandas import DataFrameMapper, CategoricalImputer, gen_features

df = sns.load_dataset(&#39;titanic&#39;)

X = df.copy().drop([&#39;alive&#39;,&#39;survived&#39;], axis = &#39;columns&#39;)
y = df.survived

# we need to set up transformations for numerical and categorical columns
col_categorical = list( X.select_dtypes(exclude=np.number) )
col_numerical   = list( X.select_dtypes(include=np.number) )

#we need to convert to list of lists
col_categorical = [ [x] for x in col_categorical ]
col_numerical   = [ [x] for x in col_numerical ]

# we have two ways of passing the classes as a simple list or as list of dicts if we need to pass
# arguments as well
classes_categorical = [ CategoricalImputer, sklearn.preprocessing.LabelBinarizer ]
classes_numerical = [ {&#39;class&#39;:sklearn.preprocessing.Imputer, &#39;strategy&#39; : &#39;median&#39;}
                    , sklearn.preprocessing.StandardScaler
                    ]

# now that we have defined the columns and the classes of transformers we can use gen_features
# in order to generate a list of tuples suitable for DataFrameMapper

feature_def = gen_features(
    columns = col_categorical
    , classes = classes_categorical
)

feature_def_numerical = gen_features(
    columns = col_numerical
    , classes = classes_numerical
)

feature_def.extend(feature_def_numerical)

# when constructing the mapper we can specify whether we want a dataframe or a numpy array as output

mapper_df = DataFrameMapper( feature_def , df_out = True )

mapper_np = DataFrameMapper( feature_def , df_out = False )

mapped_df = mapper_df.fit_transform( df.copy() )

mapped_np = mapper_np.fit_transform( df.copy() )

print( mapped_np[1:10,1:20] )

mapped_df.head(10)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;[[1. 0. 0. 1. 0. 0. 0. 0. 1. 0. 0. 0. 1. 0. 0. 0. 0. 1. 0.]
 [0. 0. 1. 0. 0. 1. 0. 0. 1. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0.]
 [0. 0. 1. 1. 0. 0. 0. 0. 1. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0.]
 [0. 0. 1. 0. 0. 1. 0. 1. 0. 1. 0. 0. 1. 0. 0. 0. 0. 0. 0.]
 [0. 1. 0. 0. 0. 1. 0. 1. 0. 1. 0. 0. 1. 0. 0. 0. 0. 0. 1.]
 [0. 0. 1. 1. 0. 0. 0. 1. 0. 1. 0. 0. 0. 0. 1. 0. 0. 0. 0.]
 [0. 0. 1. 0. 0. 1. 1. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0.]
 [0. 0. 1. 0. 0. 1. 0. 0. 1. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0.]
 [1. 0. 0. 0. 1. 0. 1. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 1. 0.]]
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;sex&lt;/th&gt;
      &lt;th&gt;embarked_C&lt;/th&gt;
      &lt;th&gt;embarked_Q&lt;/th&gt;
      &lt;th&gt;embarked_S&lt;/th&gt;
      &lt;th&gt;class_First&lt;/th&gt;
      &lt;th&gt;class_Second&lt;/th&gt;
      &lt;th&gt;class_Third&lt;/th&gt;
      &lt;th&gt;who_child&lt;/th&gt;
      &lt;th&gt;who_man&lt;/th&gt;
      &lt;th&gt;who_woman&lt;/th&gt;
      &lt;th&gt;...&lt;/th&gt;
      &lt;th&gt;deck_G&lt;/th&gt;
      &lt;th&gt;embark_town_Cherbourg&lt;/th&gt;
      &lt;th&gt;embark_town_Queenstown&lt;/th&gt;
      &lt;th&gt;embark_town_Southampton&lt;/th&gt;
      &lt;th&gt;alone&lt;/th&gt;
      &lt;th&gt;pclass&lt;/th&gt;
      &lt;th&gt;age&lt;/th&gt;
      &lt;th&gt;sibsp&lt;/th&gt;
      &lt;th&gt;parch&lt;/th&gt;
      &lt;th&gt;fare&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.827377&lt;/td&gt;
      &lt;td&gt;-0.565736&lt;/td&gt;
      &lt;td&gt;0.432793&lt;/td&gt;
      &lt;td&gt;-0.473674&lt;/td&gt;
      &lt;td&gt;-0.502445&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;-1.566107&lt;/td&gt;
      &lt;td&gt;0.663861&lt;/td&gt;
      &lt;td&gt;0.432793&lt;/td&gt;
      &lt;td&gt;-0.473674&lt;/td&gt;
      &lt;td&gt;0.786845&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.827377&lt;/td&gt;
      &lt;td&gt;-0.258337&lt;/td&gt;
      &lt;td&gt;-0.474545&lt;/td&gt;
      &lt;td&gt;-0.473674&lt;/td&gt;
      &lt;td&gt;-0.488854&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;-1.566107&lt;/td&gt;
      &lt;td&gt;0.433312&lt;/td&gt;
      &lt;td&gt;0.432793&lt;/td&gt;
      &lt;td&gt;-0.473674&lt;/td&gt;
      &lt;td&gt;0.420730&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.827377&lt;/td&gt;
      &lt;td&gt;0.433312&lt;/td&gt;
      &lt;td&gt;-0.474545&lt;/td&gt;
      &lt;td&gt;-0.473674&lt;/td&gt;
      &lt;td&gt;-0.486337&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;5&lt;/th&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.827377&lt;/td&gt;
      &lt;td&gt;-0.104637&lt;/td&gt;
      &lt;td&gt;-0.474545&lt;/td&gt;
      &lt;td&gt;-0.473674&lt;/td&gt;
      &lt;td&gt;-0.478116&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;6&lt;/th&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;-1.566107&lt;/td&gt;
      &lt;td&gt;1.893459&lt;/td&gt;
      &lt;td&gt;-0.474545&lt;/td&gt;
      &lt;td&gt;-0.473674&lt;/td&gt;
      &lt;td&gt;0.395814&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;7&lt;/th&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.827377&lt;/td&gt;
      &lt;td&gt;-2.102733&lt;/td&gt;
      &lt;td&gt;2.247470&lt;/td&gt;
      &lt;td&gt;0.767630&lt;/td&gt;
      &lt;td&gt;-0.224083&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;8&lt;/th&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.827377&lt;/td&gt;
      &lt;td&gt;-0.181487&lt;/td&gt;
      &lt;td&gt;-0.474545&lt;/td&gt;
      &lt;td&gt;2.008933&lt;/td&gt;
      &lt;td&gt;-0.424256&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;9&lt;/th&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;0.0&lt;/td&gt;
      &lt;td&gt;-0.369365&lt;/td&gt;
      &lt;td&gt;-1.180535&lt;/td&gt;
      &lt;td&gt;0.432793&lt;/td&gt;
      &lt;td&gt;-0.473674&lt;/td&gt;
      &lt;td&gt;-0.042956&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;10 rows × 27 columns&lt;/p&gt;
&lt;/div&gt;

&lt;p&gt;the results are looking really good, its almost as good as &lt;code&gt;recipes&lt;/code&gt;. However if we wanted to apply a boxcox transformation on top of it we would have to write our own &lt;code&gt;scikit-learn&lt;/code&gt; like transformer. However the transformer will be added in a future version so I would not bother with that at the moment.&lt;/p&gt;

&lt;h2 id=&#34;to-sparse-or-not-to-sparse&#34;&gt;To sparse or not to sparse&lt;/h2&gt;

&lt;p&gt;In the &lt;code&gt;python&lt;/code&gt; data world data is considered to be &lt;em&gt;sparse&lt;/em&gt; or &lt;em&gt;dense&lt;/em&gt;. Which adresses the number of zeros in a matrix &lt;a href=&#34;https://en.wikipedia.org/wiki/Sparse_matrix&#34;&gt;wiki&lt;/a&gt;. &lt;em&gt;sparse&lt;/em&gt; means that you have a lot of them while &lt;em&gt;dense&lt;/em&gt; means the opposite. There is no particular threshold but we should be aware that some data transformatios like dummy encoding make our data more &lt;em&gt;sparse&lt;/em&gt;. A &lt;em&gt;sparse&lt;/em&gt; matrix can be stored in a more memory efficient format such similar as a compressed image file and some algorithms can computationally leaverage this format to reduce computing time. &lt;a href=&#34;http://scikit-learn.org/stable/auto_examples/linear_model/plot_lasso_dense_vs_sparse_data.html&#34;&gt;lasso&lt;/a&gt; and &lt;a href=&#34;https://medium.com/sbc-group-blog/to-sparse-or-not-to-sparse-691483f87a53&#34;&gt;boosting gradient style algorithms&lt;/a&gt; seem to be able to profit from the sparse data format while others &lt;a href=&#34;https://medium.com/sbc-group-blog/to-sparse-or-not-to-sparse-691483f87a53&#34;&gt;neural nets, knn&lt;/a&gt; do not, and some like &lt;a href=&#34;https://stackoverflow.com/questions/28384680/scikit-learns-pipeline-a-sparse-matrix-was-passed-but-dense-data-is-required&#34;&gt;randomForest&lt;/a&gt; require the regular dense format and will otherwise raise an error. We can use &lt;code&gt;SciPy&lt;/code&gt; to transform matrices to a dense format. We can measure the sparcity ratio as follows## Sparcity ratio&lt;/p&gt;

&lt;h3 id=&#34;sparcity-ratio&#34;&gt;Sparcity Ratio&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;def sparsity_ratio(X):
    return 1.0 - np.count_nonzero(X) / float(X.shape[0] * X.shape[1])
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;print(&#39;sparcity ratio original data:&#39;, round( sparsity_ratio(X), 2) )
print(&#39;sparcity ratio tranformed data:&#39;, round( sparsity_ratio(mapped_np), 2) )
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;sparcity ratio original data: 0.17
sparcity ratio tranformed data: 0.56
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The transformation have resulted in a matrix with a high sparcity thus we will test whether we might benefit from converting to a sparse matrix format&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from scipy import sparse
from time import time
from sklearn.tree import DecisionTreeClassifier


X_sparse = sparse.coo_matrix(mapped_np)

clf_sparse = DecisionTreeClassifier()
clf_dense = DecisionTreeClassifier()

t0 = time()
clf_sparse.fit(X_sparse, y)
print(&#39;exec time sparse:&#39;, round( time() - t0,3 ) )


t0 = time()
clf_dense.fit(mapped_np, y)
print(&#39;exec time dense :&#39;, round( time() - t0,3 ) )
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;exec time sparse: 0.019
exec time dense : 0.008
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We can see that our decision tree classifiert does not benefit from  a sparse data format.&lt;/p&gt;

&lt;h2 id=&#34;pipelines&#34;&gt;Pipelines&lt;/h2&gt;

&lt;p&gt;Pipelines are constructs that chain scikit preprocessing steps together and attaching an optional classifier or a regressor to the end.&lt;/p&gt;

&lt;p&gt;We can then use the pipe as we would use a regular model we can fit it and get predictions, we could get crossvalidated performance scores or perform parameter tuning. This has a couple of advantages.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The code becomes more compact and readable&lt;/li&gt;
&lt;li&gt;Instead of saving multiple transformers (scaling, boxcox ) we can simply store one to apply to future data&lt;/li&gt;
&lt;li&gt;We can tune several steps of the pipeline in one go (for example feature selector + model tuning parameters)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We are going to contruct two pipes one for preprocessing and one for model fitting. It makes sense to seperate these two because we the first one contains a defined sequence of steps and the last pipe we are going to use to tune certain parameters via cross validation.&lt;/p&gt;

&lt;p&gt;When performning the cross validation the transformers and estimators in the pipe will be applied &lt;strong&gt;after&lt;/strong&gt; splitting the data into cross validation pairs. Cross validation is computationally expensive and we only want to use it for steps which are likely to introduce bias and can lead to overfitting such as feature selection and hyperparameter tuning.&lt;/p&gt;

&lt;h3 id=&#34;preprocessing-pipeline&#34;&gt;Preprocessing Pipeline&lt;/h3&gt;

&lt;p&gt;We are going to apply the &lt;code&gt;sklearn-pandas&lt;/code&gt; dataframe mapper and a low variance feature filter.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from sklearn.model_selection import RandomizedSearchCV
from sklearn.model_selection import RepeatedKFold
from sklearn.tree import DecisionTreeClassifier
from sklearn.feature_selection import VarianceThreshold
from scipy import stats
import os


pipe_pre_process = sklearn.pipeline.Pipeline([
    (&#39;mapper&#39;, mapper_np ) 
    , (&#39;feats&#39;, VarianceThreshold() )
])


pipe_pre_process
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;Pipeline(memory=None,
     steps=[(&#39;mapper&#39;, DataFrameMapper(default=False, df_out=False,
        features=[([&#39;sex&#39;], [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;), LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]), ([&#39;embarked&#39;], [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;), LabelBinarizer(neg_la...h_std=True)])],
        input_df=False, sparse=False)), (&#39;feats&#39;, VarianceThreshold(threshold=0.0))])
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;pipe_pre_process.named_steps
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;{&#39;feats&#39;: VarianceThreshold(threshold=0.0),
 &#39;mapper&#39;: DataFrameMapper(default=False, df_out=False,
         features=[([&#39;sex&#39;], [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;), LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]), ([&#39;embarked&#39;], [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;), LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]), ([&#39;class&#39;], [CategoricalImp...es=&#39;NaN&#39;, strategy=&#39;median&#39;, verbose=0), StandardScaler(copy=True, with_mean=True, with_std=True)])],
         input_df=False, sparse=False)}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The parameters are saved as follows in a nested dictionary and are named after the following principle &lt;code&gt;step_name + &#39;__&#39; + argument&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;pipe_pre_process.get_params()
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;{&#39;feats&#39;: VarianceThreshold(threshold=0.0),
 &#39;feats__threshold&#39;: 0.0,
 &#39;mapper&#39;: DataFrameMapper(default=False, df_out=False,
         features=[([&#39;sex&#39;], [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;), LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]), ([&#39;embarked&#39;], [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;), LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]), ([&#39;class&#39;], [CategoricalImp...es=&#39;NaN&#39;, strategy=&#39;median&#39;, verbose=0), StandardScaler(copy=True, with_mean=True, with_std=True)])],
         input_df=False, sparse=False),
 &#39;mapper__default&#39;: False,
 &#39;mapper__df_out&#39;: False,
 &#39;mapper__features&#39;: [([&#39;sex&#39;],
   [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;),
    LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]),
  ([&#39;embarked&#39;],
   [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;),
    LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]),
  ([&#39;class&#39;],
   [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;),
    LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]),
  ([&#39;who&#39;],
   [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;),
    LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]),
  ([&#39;adult_male&#39;],
   [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;),
    LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]),
  ([&#39;deck&#39;],
   [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;),
    LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]),
  ([&#39;embark_town&#39;],
   [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;),
    LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]),
  ([&#39;alone&#39;],
   [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;),
    LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]),
  ([&#39;pclass&#39;],
   [Imputer(axis=0, copy=True, missing_values=&#39;NaN&#39;, strategy=&#39;median&#39;, verbose=0),
    StandardScaler(copy=True, with_mean=True, with_std=True)]),
  ([&#39;age&#39;],
   [Imputer(axis=0, copy=True, missing_values=&#39;NaN&#39;, strategy=&#39;median&#39;, verbose=0),
    StandardScaler(copy=True, with_mean=True, with_std=True)]),
  ([&#39;sibsp&#39;],
   [Imputer(axis=0, copy=True, missing_values=&#39;NaN&#39;, strategy=&#39;median&#39;, verbose=0),
    StandardScaler(copy=True, with_mean=True, with_std=True)]),
  ([&#39;parch&#39;],
   [Imputer(axis=0, copy=True, missing_values=&#39;NaN&#39;, strategy=&#39;median&#39;, verbose=0),
    StandardScaler(copy=True, with_mean=True, with_std=True)]),
  ([&#39;fare&#39;],
   [Imputer(axis=0, copy=True, missing_values=&#39;NaN&#39;, strategy=&#39;median&#39;, verbose=0),
    StandardScaler(copy=True, with_mean=True, with_std=True)])],
 &#39;mapper__input_df&#39;: False,
 &#39;mapper__sparse&#39;: False,
 &#39;memory&#39;: None,
 &#39;steps&#39;: [(&#39;mapper&#39;, DataFrameMapper(default=False, df_out=False,
           features=[([&#39;sex&#39;], [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;), LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]), ([&#39;embarked&#39;], [CategoricalImputer(copy=True, missing_values=&#39;NaN&#39;), LabelBinarizer(neg_label=0, pos_label=1, sparse_output=False)]), ([&#39;class&#39;], [CategoricalImp...es=&#39;NaN&#39;, strategy=&#39;median&#39;, verbose=0), StandardScaler(copy=True, with_mean=True, with_std=True)])],
           input_df=False, sparse=False)),
  (&#39;feats&#39;, VarianceThreshold(threshold=0.0))]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We can set a parameter&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;pipe_pre_process.set_params(feats__threshold = 0.05)
pipe_pre_process.named_steps.feats
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;VarianceThreshold(threshold=0.05)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then we fit the preprocessing pipe to the data&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;pipe_pre_process.fit(X)
X_proc = pipe_pre_process.fit_transform(X)

X_proc
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;array([[ 1.        ,  0.        ,  0.        , ...,  0.43279337,
        -0.47367361, -0.50244517],
       [ 0.        ,  1.        ,  0.        , ...,  0.43279337,
        -0.47367361,  0.78684529],
       [ 0.        ,  0.        ,  0.        , ..., -0.4745452 ,
        -0.47367361, -0.48885426],
       ...,
       [ 0.        ,  0.        ,  0.        , ...,  0.43279337,
         2.00893337, -0.17626324],
       [ 1.        ,  1.        ,  0.        , ..., -0.4745452 ,
        -0.47367361, -0.04438104],
       [ 1.        ,  0.        ,  1.        , ..., -0.4745452 ,
        -0.47367361, -0.49237783]])
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We will be using the pre processed data in another post so we are saving it to disc. We are storing it in feather format which is basically hdfs which has much faster in terms of reading and writing from and to disc.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;import feather
import os

if not os.path.isdir(&#39;./data&#39;):
    os.mkdir(&#39;./data&#39;)


df_feather = mapped_df.\
    assign( y = y )

feather.write_dataframe(df_feather, &#39;./data/mapped_df.feather&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;modelling-pipeline&#34;&gt;Modelling Pipeline&lt;/h3&gt;

&lt;p&gt;We will add a feature selection step, which choses variables based on a univariate test such as a chisquare test (which we cannot use here because it does not accept negative values) and ANOVA and then fit a decision tree.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;pipe_mod = sklearn.pipeline.Pipeline([
    (&#39;feats&#39;, sklearn.feature_selection.SelectKBest( k = 10) ) 
    , (&#39;tree&#39;, sklearn.tree.DecisionTreeClassifier() )
])
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We can apply the same &amp;lsquo;__&amp;rsquo; synthax as we used for setting the parameters of the pipe for constructing the dictionary for the sandomized hyperparameter search&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;param_dist = dict( tree__min_samples_split = stats.randint(2,250)
                 , tree__min_samples_leaf = stats.randint(1,500)
                 , tree__min_impurity_decrease = stats.uniform(0,1)
                 , tree__max_features = stats.uniform(0,1)
                 , feats__score_func = [sklearn.feature_selection.f_classif ## Anova
                                       , sklearn.feature_selection.mutual_info_classif] ) ## nearest n

n_iter = 500

random_search = RandomizedSearchCV(pipe_mod
                                   , param_dist
                                   , n_iter = n_iter
                                   , scoring = &#39;roc_auc&#39;
                                   , cv = RepeatedKFold( n_splits = 5, n_repeats = 3 )
                                   , verbose = True
                                   , n_jobs = 4 ## parallel processing
                                   , return_train_score = True
                                  )


random_search.fit(X = X_proc, y =  df.survived )
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;Fitting 15 folds for each of 500 candidates, totalling 7500 fits


[Parallel(n_jobs=4)]: Done  49 tasks      | elapsed:    5.8s
[Parallel(n_jobs=4)]: Done 740 tasks      | elapsed:   34.9s
[Parallel(n_jobs=4)]: Done 2005 tasks      | elapsed:  1.4min
[Parallel(n_jobs=4)]: Done 3737 tasks      | elapsed:  2.6min
[Parallel(n_jobs=4)]: Done 5556 tasks      | elapsed:  4.3min
[Parallel(n_jobs=4)]: Done 7241 tasks      | elapsed:  5.9min
[Parallel(n_jobs=4)]: Done 7493 out of 7500 | elapsed:  6.1min remaining:    0.2s
[Parallel(n_jobs=4)]: Done 7500 out of 7500 | elapsed:  6.1min finished





RandomizedSearchCV(cv=&amp;lt;sklearn.model_selection._split.RepeatedKFold object at 0x000001916A6DC9B0&amp;gt;,
          error_score=&#39;raise&#39;,
          estimator=Pipeline(memory=None,
     steps=[(&#39;feats&#39;, SelectKBest(k=10, score_func=&amp;lt;function f_classif at 0x000001916A6ABF28&amp;gt;)), (&#39;tree&#39;, DecisionTreeClassifier(class_weight=None, criterion=&#39;gini&#39;, max_depth=None,
            max_features=None, max_leaf_nodes=None,
            min_impurity_decrease=0.0, min_impurity_split=None,
            min_samples_leaf=1, min_samples_split=2,
            min_weight_fraction_leaf=0.0, presort=False, random_state=None,
            splitter=&#39;best&#39;))]),
          fit_params=None, iid=True, n_iter=500, n_jobs=4,
          param_distributions={&#39;tree__min_impurity_decrease&#39;: &amp;lt;scipy.stats._distn_infrastructure.rv_frozen object at 0x000001916A6DC160&amp;gt;, &#39;feats__score_func&#39;: [&amp;lt;function f_classif at 0x000001916A6ABF28&amp;gt;, &amp;lt;function mutual_info_classif at 0x000001916A6CD2F0&amp;gt;], &#39;tree__max_features&#39;: &amp;lt;scipy.stats._distn_infrastru...tree__min_samples_leaf&#39;: &amp;lt;scipy.stats._distn_infrastructure.rv_frozen object at 0x000001916A6D9FD0&amp;gt;},
          pre_dispatch=&#39;2*n_jobs&#39;, random_state=None, refit=True,
          return_train_score=True, scoring=&#39;roc_auc&#39;, verbose=True)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;random_search.best_estimator_
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;Pipeline(memory=None,
     steps=[(&#39;feats&#39;, SelectKBest(k=10,
      score_func=&amp;lt;function mutual_info_classif at 0x000001916A6CD2F0&amp;gt;)), (&#39;tree&#39;, DecisionTreeClassifier(class_weight=None, criterion=&#39;gini&#39;, max_depth=None,
            max_features=0.6995334988533182, max_leaf_nodes=None,
            min_impurity_decrease=0.00253...t=47, min_weight_fraction_leaf=0.0,
            presort=False, random_state=None, splitter=&#39;best&#39;))])
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;res = pd.DataFrame( random_search.cv_results_ )

res.sort_values(&#39;rank_test_score&#39;).head(10)
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;mean_fit_time&lt;/th&gt;
      &lt;th&gt;mean_score_time&lt;/th&gt;
      &lt;th&gt;mean_test_score&lt;/th&gt;
      &lt;th&gt;mean_train_score&lt;/th&gt;
      &lt;th&gt;param_feats__score_func&lt;/th&gt;
      &lt;th&gt;param_tree__max_features&lt;/th&gt;
      &lt;th&gt;param_tree__min_impurity_decrease&lt;/th&gt;
      &lt;th&gt;param_tree__min_samples_leaf&lt;/th&gt;
      &lt;th&gt;param_tree__min_samples_split&lt;/th&gt;
      &lt;th&gt;params&lt;/th&gt;
      &lt;th&gt;...&lt;/th&gt;
      &lt;th&gt;split7_test_score&lt;/th&gt;
      &lt;th&gt;split7_train_score&lt;/th&gt;
      &lt;th&gt;split8_test_score&lt;/th&gt;
      &lt;th&gt;split8_train_score&lt;/th&gt;
      &lt;th&gt;split9_test_score&lt;/th&gt;
      &lt;th&gt;split9_train_score&lt;/th&gt;
      &lt;th&gt;std_fit_time&lt;/th&gt;
      &lt;th&gt;std_score_time&lt;/th&gt;
      &lt;th&gt;std_test_score&lt;/th&gt;
      &lt;th&gt;std_train_score&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;206&lt;/th&gt;
      &lt;td&gt;0.360021&lt;/td&gt;
      &lt;td&gt;0.001642&lt;/td&gt;
      &lt;td&gt;0.851727&lt;/td&gt;
      &lt;td&gt;0.862858&lt;/td&gt;
      &lt;td&gt;&amp;lt;function mutual_info_classif at 0x000001916A6...&lt;/td&gt;
      &lt;td&gt;0.699533&lt;/td&gt;
      &lt;td&gt;0.00253909&lt;/td&gt;
      &lt;td&gt;33&lt;/td&gt;
      &lt;td&gt;47&lt;/td&gt;
      &lt;td&gt;{&#39;feats__score_func&#39;: &amp;lt;function mutual_info_cl...&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.772863&lt;/td&gt;
      &lt;td&gt;0.866083&lt;/td&gt;
      &lt;td&gt;0.847184&lt;/td&gt;
      &lt;td&gt;0.881330&lt;/td&gt;
      &lt;td&gt;0.867859&lt;/td&gt;
      &lt;td&gt;0.867060&lt;/td&gt;
      &lt;td&gt;0.031329&lt;/td&gt;
      &lt;td&gt;0.003972&lt;/td&gt;
      &lt;td&gt;0.036028&lt;/td&gt;
      &lt;td&gt;0.016553&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;88&lt;/th&gt;
      &lt;td&gt;0.004166&lt;/td&gt;
      &lt;td&gt;0.001308&lt;/td&gt;
      &lt;td&gt;0.829953&lt;/td&gt;
      &lt;td&gt;0.838292&lt;/td&gt;
      &lt;td&gt;&amp;lt;function f_classif at 0x000001916A6ABF28&amp;gt;&lt;/td&gt;
      &lt;td&gt;0.87121&lt;/td&gt;
      &lt;td&gt;0.0133541&lt;/td&gt;
      &lt;td&gt;89&lt;/td&gt;
      &lt;td&gt;210&lt;/td&gt;
      &lt;td&gt;{&#39;feats__score_func&#39;: &amp;lt;function f_classif at 0...&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.736742&lt;/td&gt;
      &lt;td&gt;0.809940&lt;/td&gt;
      &lt;td&gt;0.845372&lt;/td&gt;
      &lt;td&gt;0.858085&lt;/td&gt;
      &lt;td&gt;0.798939&lt;/td&gt;
      &lt;td&gt;0.825771&lt;/td&gt;
      &lt;td&gt;0.006909&lt;/td&gt;
      &lt;td&gt;0.003953&lt;/td&gt;
      &lt;td&gt;0.034927&lt;/td&gt;
      &lt;td&gt;0.019111&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;194&lt;/th&gt;
      &lt;td&gt;0.298661&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
      &lt;td&gt;0.811322&lt;/td&gt;
      &lt;td&gt;0.811516&lt;/td&gt;
      &lt;td&gt;&amp;lt;function mutual_info_classif at 0x000001916A6...&lt;/td&gt;
      &lt;td&gt;0.813777&lt;/td&gt;
      &lt;td&gt;0.0138638&lt;/td&gt;
      &lt;td&gt;124&lt;/td&gt;
      &lt;td&gt;79&lt;/td&gt;
      &lt;td&gt;{&#39;feats__score_func&#39;: &amp;lt;function mutual_info_cl...&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.713745&lt;/td&gt;
      &lt;td&gt;0.779844&lt;/td&gt;
      &lt;td&gt;0.815275&lt;/td&gt;
      &lt;td&gt;0.821707&lt;/td&gt;
      &lt;td&gt;0.798939&lt;/td&gt;
      &lt;td&gt;0.825771&lt;/td&gt;
      &lt;td&gt;0.029102&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
      &lt;td&gt;0.032071&lt;/td&gt;
      &lt;td&gt;0.018513&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;230&lt;/th&gt;
      &lt;td&gt;0.435979&lt;/td&gt;
      &lt;td&gt;0.003441&lt;/td&gt;
      &lt;td&gt;0.777916&lt;/td&gt;
      &lt;td&gt;0.776460&lt;/td&gt;
      &lt;td&gt;&amp;lt;function mutual_info_classif at 0x000001916A6...&lt;/td&gt;
      &lt;td&gt;0.407913&lt;/td&gt;
      &lt;td&gt;0.127602&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;215&lt;/td&gt;
      &lt;td&gt;{&#39;feats__score_func&#39;: &amp;lt;function mutual_info_cl...&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.754735&lt;/td&gt;
      &lt;td&gt;0.786423&lt;/td&gt;
      &lt;td&gt;0.768997&lt;/td&gt;
      &lt;td&gt;0.766081&lt;/td&gt;
      &lt;td&gt;0.750393&lt;/td&gt;
      &lt;td&gt;0.787890&lt;/td&gt;
      &lt;td&gt;0.268832&lt;/td&gt;
      &lt;td&gt;0.005945&lt;/td&gt;
      &lt;td&gt;0.019844&lt;/td&gt;
      &lt;td&gt;0.009008&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;285&lt;/th&gt;
      &lt;td&gt;0.312650&lt;/td&gt;
      &lt;td&gt;0.001333&lt;/td&gt;
      &lt;td&gt;0.777642&lt;/td&gt;
      &lt;td&gt;0.779836&lt;/td&gt;
      &lt;td&gt;&amp;lt;function mutual_info_classif at 0x000001916A6...&lt;/td&gt;
      &lt;td&gt;0.95935&lt;/td&gt;
      &lt;td&gt;0.0960747&lt;/td&gt;
      &lt;td&gt;234&lt;/td&gt;
      &lt;td&gt;36&lt;/td&gt;
      &lt;td&gt;{&#39;feats__score_func&#39;: &amp;lt;function mutual_info_cl...&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.713745&lt;/td&gt;
      &lt;td&gt;0.779844&lt;/td&gt;
      &lt;td&gt;0.779288&lt;/td&gt;
      &lt;td&gt;0.780731&lt;/td&gt;
      &lt;td&gt;0.750393&lt;/td&gt;
      &lt;td&gt;0.787890&lt;/td&gt;
      &lt;td&gt;0.020375&lt;/td&gt;
      &lt;td&gt;0.001885&lt;/td&gt;
      &lt;td&gt;0.025972&lt;/td&gt;
      &lt;td&gt;0.005002&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;347&lt;/th&gt;
      &lt;td&gt;0.003999&lt;/td&gt;
      &lt;td&gt;0.001600&lt;/td&gt;
      &lt;td&gt;0.777642&lt;/td&gt;
      &lt;td&gt;0.779836&lt;/td&gt;
      &lt;td&gt;&amp;lt;function f_classif at 0x000001916A6ABF28&amp;gt;&lt;/td&gt;
      &lt;td&gt;0.722103&lt;/td&gt;
      &lt;td&gt;0.0547579&lt;/td&gt;
      &lt;td&gt;104&lt;/td&gt;
      &lt;td&gt;224&lt;/td&gt;
      &lt;td&gt;{&#39;feats__score_func&#39;: &amp;lt;function f_classif at 0...&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.713745&lt;/td&gt;
      &lt;td&gt;0.779844&lt;/td&gt;
      &lt;td&gt;0.779288&lt;/td&gt;
      &lt;td&gt;0.780731&lt;/td&gt;
      &lt;td&gt;0.750393&lt;/td&gt;
      &lt;td&gt;0.787890&lt;/td&gt;
      &lt;td&gt;0.002529&lt;/td&gt;
      &lt;td&gt;0.001959&lt;/td&gt;
      &lt;td&gt;0.025972&lt;/td&gt;
      &lt;td&gt;0.005002&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;263&lt;/th&gt;
      &lt;td&gt;0.004570&lt;/td&gt;
      &lt;td&gt;0.001416&lt;/td&gt;
      &lt;td&gt;0.777642&lt;/td&gt;
      &lt;td&gt;0.779836&lt;/td&gt;
      &lt;td&gt;&amp;lt;function f_classif at 0x000001916A6ABF28&amp;gt;&lt;/td&gt;
      &lt;td&gt;0.83097&lt;/td&gt;
      &lt;td&gt;0.0618748&lt;/td&gt;
      &lt;td&gt;211&lt;/td&gt;
      &lt;td&gt;14&lt;/td&gt;
      &lt;td&gt;{&#39;feats__score_func&#39;: &amp;lt;function f_classif at 0...&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.713745&lt;/td&gt;
      &lt;td&gt;0.779844&lt;/td&gt;
      &lt;td&gt;0.779288&lt;/td&gt;
      &lt;td&gt;0.780731&lt;/td&gt;
      &lt;td&gt;0.750393&lt;/td&gt;
      &lt;td&gt;0.787890&lt;/td&gt;
      &lt;td&gt;0.006060&lt;/td&gt;
      &lt;td&gt;0.002616&lt;/td&gt;
      &lt;td&gt;0.025972&lt;/td&gt;
      &lt;td&gt;0.005002&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;459&lt;/th&gt;
      &lt;td&gt;0.005208&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
      &lt;td&gt;0.777642&lt;/td&gt;
      &lt;td&gt;0.779836&lt;/td&gt;
      &lt;td&gt;&amp;lt;function f_classif at 0x000001916A6ABF28&amp;gt;&lt;/td&gt;
      &lt;td&gt;0.93767&lt;/td&gt;
      &lt;td&gt;0.0945291&lt;/td&gt;
      &lt;td&gt;11&lt;/td&gt;
      &lt;td&gt;96&lt;/td&gt;
      &lt;td&gt;{&#39;feats__score_func&#39;: &amp;lt;function f_classif at 0...&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.713745&lt;/td&gt;
      &lt;td&gt;0.779844&lt;/td&gt;
      &lt;td&gt;0.779288&lt;/td&gt;
      &lt;td&gt;0.780731&lt;/td&gt;
      &lt;td&gt;0.750393&lt;/td&gt;
      &lt;td&gt;0.787890&lt;/td&gt;
      &lt;td&gt;0.009316&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
      &lt;td&gt;0.025972&lt;/td&gt;
      &lt;td&gt;0.005002&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;224&lt;/th&gt;
      &lt;td&gt;0.002137&lt;/td&gt;
      &lt;td&gt;0.001575&lt;/td&gt;
      &lt;td&gt;0.773051&lt;/td&gt;
      &lt;td&gt;0.774232&lt;/td&gt;
      &lt;td&gt;&amp;lt;function f_classif at 0x000001916A6ABF28&amp;gt;&lt;/td&gt;
      &lt;td&gt;0.509988&lt;/td&gt;
      &lt;td&gt;0.0569047&lt;/td&gt;
      &lt;td&gt;74&lt;/td&gt;
      &lt;td&gt;12&lt;/td&gt;
      &lt;td&gt;{&#39;feats__score_func&#39;: &amp;lt;function f_classif at 0...&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.754735&lt;/td&gt;
      &lt;td&gt;0.786423&lt;/td&gt;
      &lt;td&gt;0.779288&lt;/td&gt;
      &lt;td&gt;0.780731&lt;/td&gt;
      &lt;td&gt;0.750393&lt;/td&gt;
      &lt;td&gt;0.787890&lt;/td&gt;
      &lt;td&gt;0.001999&lt;/td&gt;
      &lt;td&gt;0.003991&lt;/td&gt;
      &lt;td&gt;0.021037&lt;/td&gt;
      &lt;td&gt;0.015873&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;472&lt;/th&gt;
      &lt;td&gt;0.004166&lt;/td&gt;
      &lt;td&gt;0.002083&lt;/td&gt;
      &lt;td&gt;0.771509&lt;/td&gt;
      &lt;td&gt;0.774650&lt;/td&gt;
      &lt;td&gt;&amp;lt;function f_classif at 0x000001916A6ABF28&amp;gt;&lt;/td&gt;
      &lt;td&gt;0.555193&lt;/td&gt;
      &lt;td&gt;0.0792222&lt;/td&gt;
      &lt;td&gt;173&lt;/td&gt;
      &lt;td&gt;195&lt;/td&gt;
      &lt;td&gt;{&#39;feats__score_func&#39;: &amp;lt;function f_classif at 0...&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.713745&lt;/td&gt;
      &lt;td&gt;0.779844&lt;/td&gt;
      &lt;td&gt;0.779288&lt;/td&gt;
      &lt;td&gt;0.780731&lt;/td&gt;
      &lt;td&gt;0.750393&lt;/td&gt;
      &lt;td&gt;0.787890&lt;/td&gt;
      &lt;td&gt;0.006909&lt;/td&gt;
      &lt;td&gt;0.005311&lt;/td&gt;
      &lt;td&gt;0.027898&lt;/td&gt;
      &lt;td&gt;0.013231&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;10 rows × 45 columns&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&#34;summary&#34;&gt;Summary&lt;/h2&gt;

&lt;p&gt;We can see that our maximum ROC score 0.86 is similar to what we obtained in the last post (0.85) where we took a more manual approach. However using &lt;code&gt;sklearn-pandas&lt;/code&gt; and pipes we were able to write code that is more generalizable and is less dependent on the actual dataset. We have more or less written a generalizable code for the preprocessing pipe however the code for the modelling pipe is quite specific for the model that we used. I f we wanted to train more models of a different type we would have to manually write pipes for them as well.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Moving from R to python - 5/7 - scikitlearn</title>
      <link>https://www.datisticsblog.com/2018/08/r2py_scikitlearn/</link>
      <pubDate>Sat, 25 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/08/r2py_scikitlearn/</guid>
      <description>




&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;../../../r2py.png&#34; style=&#34;width: 180px;height: 180px;&#34;&gt;
  
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_ide/&#34;&gt;1 of 7: IDE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_pandas/&#34;&gt;2 of 7: pandas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_matplotlib_seaborn/&#34;&gt;3 of 7: matplotlib and seaborn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_plotly/&#34;&gt;4 of 7: plotly&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn/&#34;&gt;5 of 7: scikitlearn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn_advanced/&#34;&gt;6 of 7: advanced scikitlearn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_automated_ml/&#34;&gt;7 of 7: automated machine learning&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- toc --&gt;

&lt;h1 id=&#34;scikitlearn&#34;&gt;scikitlearn&lt;/h1&gt;

&lt;p&gt;As I am starting out to read some &lt;code&gt;scikitlearn&lt;/code&gt; tutorials I immedialtely spot some differences between &lt;code&gt;scikitlearn&lt;/code&gt; and modelling in &lt;code&gt;R&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;for &lt;code&gt;scikitlearn&lt;/code&gt; data needs to be numerical, so all categorical data needs to be converted to dummy variables first.&lt;/li&gt;
&lt;li&gt;predictor and response variable have to be given in &amp;ldquo;matrix input&amp;rdquo;, there is no such thing as the formula input in &lt;code&gt;R&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;the nomenclature for the predictor matrix is &lt;code&gt;X&lt;/code&gt; and for the response &lt;code&gt;y&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here we would like to perform a rather complex chain of steps.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Feature Engineeering&lt;/strong&gt;&lt;br /&gt;
- Impute missing data&lt;br /&gt;
- Normalize numerical data&lt;br /&gt;
- Create dummy variables for categorical data&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Modelling&lt;/strong&gt;&lt;br /&gt;
- Fit a cross validated CART tree&lt;br /&gt;
- Use randomized parameter search to tune the tree&lt;br /&gt;
- Visualize the tree with the lowest error&lt;br /&gt;
- Visualize the ROC curve with SEM based on cv results&lt;/p&gt;

&lt;h1 id=&#34;sample-data&#34;&gt;Sample Data&lt;/h1&gt;

&lt;p&gt;We have to provide the data in x,y format and have to convert all categoricals before hand. There are some sample datasets that come with &lt;code&gt;scikitlearn&lt;/code&gt; but they are already pre-processed and contain no categorical variables. Here is an example&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from sklearn import datasets

boston = datasets.load_boston()

print(boston.data)
print(boston.feature_names)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;[[6.3200e-03 1.8000e+01 2.3100e+00 ... 1.5300e+01 3.9690e+02 4.9800e+00]
 [2.7310e-02 0.0000e+00 7.0700e+00 ... 1.7800e+01 3.9690e+02 9.1400e+00]
 [2.7290e-02 0.0000e+00 7.0700e+00 ... 1.7800e+01 3.9283e+02 4.0300e+00]
 ...
 [6.0760e-02 0.0000e+00 1.1930e+01 ... 2.1000e+01 3.9690e+02 5.6400e+00]
 [1.0959e-01 0.0000e+00 1.1930e+01 ... 2.1000e+01 3.9345e+02 6.4800e+00]
 [4.7410e-02 0.0000e+00 1.1930e+01 ... 2.1000e+01 3.9690e+02 7.8800e+00]]
[&#39;CRIM&#39; &#39;ZN&#39; &#39;INDUS&#39; &#39;CHAS&#39; &#39;NOX&#39; &#39;RM&#39; &#39;AGE&#39; &#39;DIS&#39; &#39;RAD&#39; &#39;TAX&#39; &#39;PTRATIO&#39;
 &#39;B&#39; &#39;LSTAT&#39;]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Usually our datasets will not come that neatly prepared and we wont have &lt;code&gt;numpy&lt;/code&gt; arrays but &lt;code&gt;pandas&lt;/code&gt; dataframes. So alternatively we will get our datasets from &lt;code&gt;seaborn&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;import seaborn as sns

df = sns.load_dataset(&#39;titanic&#39;)

df.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;survived&lt;/th&gt;
      &lt;th&gt;pclass&lt;/th&gt;
      &lt;th&gt;sex&lt;/th&gt;
      &lt;th&gt;age&lt;/th&gt;
      &lt;th&gt;sibsp&lt;/th&gt;
      &lt;th&gt;parch&lt;/th&gt;
      &lt;th&gt;fare&lt;/th&gt;
      &lt;th&gt;embarked&lt;/th&gt;
      &lt;th&gt;class&lt;/th&gt;
      &lt;th&gt;who&lt;/th&gt;
      &lt;th&gt;adult_male&lt;/th&gt;
      &lt;th&gt;deck&lt;/th&gt;
      &lt;th&gt;embark_town&lt;/th&gt;
      &lt;th&gt;alive&lt;/th&gt;
      &lt;th&gt;alone&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;male&lt;/td&gt;
      &lt;td&gt;22.0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;7.2500&lt;/td&gt;
      &lt;td&gt;S&lt;/td&gt;
      &lt;td&gt;Third&lt;/td&gt;
      &lt;td&gt;man&lt;/td&gt;
      &lt;td&gt;True&lt;/td&gt;
      &lt;td&gt;NaN&lt;/td&gt;
      &lt;td&gt;Southampton&lt;/td&gt;
      &lt;td&gt;no&lt;/td&gt;
      &lt;td&gt;False&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;female&lt;/td&gt;
      &lt;td&gt;38.0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;71.2833&lt;/td&gt;
      &lt;td&gt;C&lt;/td&gt;
      &lt;td&gt;First&lt;/td&gt;
      &lt;td&gt;woman&lt;/td&gt;
      &lt;td&gt;False&lt;/td&gt;
      &lt;td&gt;C&lt;/td&gt;
      &lt;td&gt;Cherbourg&lt;/td&gt;
      &lt;td&gt;yes&lt;/td&gt;
      &lt;td&gt;False&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;female&lt;/td&gt;
      &lt;td&gt;26.0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;7.9250&lt;/td&gt;
      &lt;td&gt;S&lt;/td&gt;
      &lt;td&gt;Third&lt;/td&gt;
      &lt;td&gt;woman&lt;/td&gt;
      &lt;td&gt;False&lt;/td&gt;
      &lt;td&gt;NaN&lt;/td&gt;
      &lt;td&gt;Southampton&lt;/td&gt;
      &lt;td&gt;yes&lt;/td&gt;
      &lt;td&gt;True&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;female&lt;/td&gt;
      &lt;td&gt;35.0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;53.1000&lt;/td&gt;
      &lt;td&gt;S&lt;/td&gt;
      &lt;td&gt;First&lt;/td&gt;
      &lt;td&gt;woman&lt;/td&gt;
      &lt;td&gt;False&lt;/td&gt;
      &lt;td&gt;C&lt;/td&gt;
      &lt;td&gt;Southampton&lt;/td&gt;
      &lt;td&gt;yes&lt;/td&gt;
      &lt;td&gt;False&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;male&lt;/td&gt;
      &lt;td&gt;35.0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;8.0500&lt;/td&gt;
      &lt;td&gt;S&lt;/td&gt;
      &lt;td&gt;Third&lt;/td&gt;
      &lt;td&gt;man&lt;/td&gt;
      &lt;td&gt;True&lt;/td&gt;
      &lt;td&gt;NaN&lt;/td&gt;
      &lt;td&gt;Southampton&lt;/td&gt;
      &lt;td&gt;no&lt;/td&gt;
      &lt;td&gt;True&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&#34;investigating-data-set&#34;&gt;Investigating Data Set&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df.dtypes
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;survived          int64
pclass            int64
sex              object
age             float64
sibsp             int64
parch             int64
fare            float64
embarked         object
class          category
who              object
adult_male         bool
deck           category
embark_town      object
alive            object
alone              bool
dtype: object
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In &lt;code&gt;R&lt;/code&gt; we would use &lt;code&gt;summary&lt;/code&gt; to look at the number of levels of each factor variable. In &lt;code&gt;python&lt;/code&gt; we would have to iterate over the categorical column names and use &lt;code&gt;pd.Series.value_counts()&lt;/code&gt; which is a bit cumbersome. However this approach also gives us a bit more control than we have with &lt;code&gt;summary()&lt;/code&gt; in &lt;code&gt;R&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;import pandas as pd
import numpy as np

def summary(df):
    
    print(&#39;categorical variables--------------------------------&#39;)
    
    for cat_var in df.select_dtypes(exclude = np.number).columns:

        counts = df[cat_var] \
            .value_counts( dropna= False ) \
            .to_frame()
        perc = df[cat_var] \
            .value_counts( dropna= False, normalize = True ) \
            .to_frame()
            
        print( df[cat_var].dtypes )
        print( counts.join(perc, lsuffix = &#39;_n&#39;, rsuffix = &#39;_perc&#39; ) )
        print(&#39;&#39;)
    
    print(&#39;numerical variables----------------------------------&#39;)
    
    print( df.describe() )
          
summary(df)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;categorical variables--------------------------------
object
        sex_n  sex_perc
male      577  0.647587
female    314  0.352413

object
     embarked_n  embarked_perc
S           644       0.722783
C           168       0.188552
Q            77       0.086420
NaN           2       0.002245

category
        class_n  class_perc
Third       491    0.551066
First       216    0.242424
Second      184    0.206510

object
       who_n  who_perc
man      537  0.602694
woman    271  0.304153
child     83  0.093154

bool
       adult_male_n  adult_male_perc
True            537         0.602694
False           354         0.397306

category
     deck_n  deck_perc
NaN     688   0.772166
C        59   0.066218
B        47   0.052750
D        33   0.037037
E        32   0.035915
A        15   0.016835
F        13   0.014590
G         4   0.004489

object
             embark_town_n  embark_town_perc
Southampton            644          0.722783
Cherbourg              168          0.188552
Queenstown              77          0.086420
NaN                      2          0.002245

object
     alive_n  alive_perc
no       549    0.616162
yes      342    0.383838

bool
       alone_n  alone_perc
True       537    0.602694
False      354    0.397306

numerical variables----------------------------------
         survived      pclass         age       sibsp       parch        fare
count  891.000000  891.000000  714.000000  891.000000  891.000000  891.000000
mean     0.383838    2.308642   29.699118    0.523008    0.381594   32.204208
std      0.486592    0.836071   14.526497    1.102743    0.806057   49.693429
min      0.000000    1.000000    0.420000    0.000000    0.000000    0.000000
25%      0.000000    2.000000   20.125000    0.000000    0.000000    7.910400
50%      0.000000    3.000000   28.000000    0.000000    0.000000   14.454200
75%      1.000000    3.000000   38.000000    1.000000    0.000000   31.000000
max      1.000000    3.000000   80.000000    8.000000    6.000000  512.329200
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;strong&gt;Some variables do have missing values which we have to impute.&lt;/strong&gt;&lt;/p&gt;

&lt;h1 id=&#34;feature-engineering&#34;&gt;Feature Engineering&lt;/h1&gt;

&lt;h2 id=&#34;impute-missing-values&#34;&gt;Impute missing values&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;scikit-learn&lt;/code&gt; has some standard imputation methods like mean and median. There is a package called &lt;code&gt;fancyimpute&lt;/code&gt; which can do knn imputing but has a huge list of required packages a lot of which require &lt;code&gt;C++&lt;/code&gt; compilation. We will therefore just use &lt;code&gt;scikti-learn&lt;/code&gt; to start with. Like everything in scikitlearn we can only use it for numerical data.&lt;/p&gt;

&lt;h3 id=&#34;encode-categorical-variables&#34;&gt;Encode categorical variables&lt;/h3&gt;

&lt;p&gt;The imputation methods included in scikitlearn require numerical data. In order to use them for categorical data we have to assign a number to each level, apply the imputation method and then convert the numbers back to their corresponding levels. In the development version of scikitlearn we can find &lt;code&gt;sklearn.preprocessing.CategoricalEncoder&lt;/code&gt; which apparently allows you to do easy onestep encoding and decoding. Then there is the package &lt;code&gt;sklearn-pandas&lt;/code&gt; which also has a CategoricalEncoder and bridges both packages and is recommended on the &lt;code&gt;pandas&lt;/code&gt; documentation homepage.&lt;/p&gt;

&lt;p&gt;For exercise purposes however we will build our own Categorical Encoder. We will use &lt;code&gt;pd.factorize()&lt;/code&gt; to convert the categorical columns to numerical, it returns a numerical array and an index which allows us to convert the array back to the categories. However there are some issues for this function.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;NaN&lt;/code&gt; will be represented with -1 in the array but dropped from the index in none &lt;code&gt;dtype == &#39;category&#39;&lt;/code&gt; columns. Which makes recoding awkward&lt;/li&gt;
&lt;li&gt;There is a bug for columns of &lt;code&gt;dtype == &#39;category&#39;&lt;/code&gt; which only returns a numerical index and makes it impossible to recode back to categories from it. This bug will be fixed in &lt;code&gt;pandas 0.23&lt;/code&gt; (as I am writing this the release version is &lt;code&gt;pandas 0.19&lt;/code&gt;). This means we have to implement an ugly fix into our Encoder Class :-(. &lt;a href=&#34;https://github.com/pandas-dev/pandas/pull/19938&#34;&gt;bugreport&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;NaN&lt;/code&gt; for columns of &lt;code&gt;dtype == &#39;category&#39;&lt;/code&gt; will not be encoded with a random integer within the range of the number of unique values. We need a consistent NaN integer for imputation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4 id=&#34;convert-all-none-numericals-to-dtype-category&#34;&gt;Convert all none-numericals to dtype category&lt;/h4&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;for col in df.select_dtypes(exclude = np.number).columns:
    df[col] = df[col].astype(&#39;object&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;h4 id=&#34;categorical-encoder&#34;&gt;Categorical Encoder&lt;/h4&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;class CategoricalEncoder:
    
    columns = list()
    dtypes = list()
    indeces = dict()
    
    
    def encode(self, df):
        
        # dont want the input object to change
        df = df.copy()
        
        self.columns = df.columns
        self.dtypes = df.dtypes
        
        assert len( df.select_dtypes(exclude = [np.number, &#39;object&#39;]).columns ) == 0 \
        , &#39;convert all none-numerical columns to object first&#39;
                
        for col in df.select_dtypes(exclude = np.number):
            df[col], self.indeces[col] = pd.factorize(df[col])
            #df[col] = df[col].astype(&#39;int&#39;) ## array is returned as float :-(
            
        return df
            
    def recode(self, df):
        
        df = df.copy()
        
        assert any( df.columns == self.columns), &#39;columns do not match original dataframe&#39;
        
        for col, ind in self.indeces.items():
            df[col] = [ np.nan if x == -1 else x for x in df[col] ] ## numpy converts array to float
            df[col] = [ ind[ int(x) ] if not np.isnan(x) else x for x in df[col] ] ## we need to convert back to int 
            
        df = df.loc[:,self.columns]
            
        for col, dtype in zip(df.columns, self.dtypes):
            df[col] = df[col].astype(dtype.name)
                     
        return df
&lt;/code&gt;&lt;/pre&gt;

&lt;h4 id=&#34;test-categorical-encoder&#34;&gt;Test Categorical Encoder&lt;/h4&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;Encoder = CategoricalEncoder()

df_enc = Encoder.encode(df)

df_rec = Encoder.recode(df_enc)

assert df.equals(df_rec), &#39;Encoder does not recode correctly&#39;
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;impute&#34;&gt;Impute&lt;/h3&gt;

&lt;p&gt;We will impute categroical with most frequent category and numericals with mean&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from sklearn.preprocessing import Imputer

Encoder = CategoricalEncoder()

df_enc = Encoder.encode(df)

df_imp = df_enc.copy()

# numericals
col_num = df.select_dtypes(include = np.number).columns
Imputer_mean = Imputer(strategy = &#39;mean&#39;)
df_imp.loc[:, col_num] = Imputer_mean.fit_transform( df_imp.loc[:, col_num] )

# categoricals
col_cat = df.select_dtypes(exclude = np.number).columns
Imputer_freq = Imputer(strategy = &#39;most_frequent&#39;, missing_values = -1)
df_imp.loc[:, col_cat]  = Imputer_freq.fit_transform( df_imp.loc[:, col_cat] )

df_imp_rec = Encoder.recode(df_imp)
 
assert not df_imp_rec.isna().as_matrix().any()
assert df_imp_rec.shape == df.shape
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;c:\anaconda\envs\py36r343\lib\site-packages\ipykernel\__main__.py:21: FutureWarning: Method .as_matrix will be removed in a future version. Use .values instead.
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;transforming-numerical-variables&#34;&gt;Transforming numerical variables&lt;/h2&gt;

&lt;h3 id=&#34;boxcox&#34;&gt;Boxcox&lt;/h3&gt;

&lt;h4 id=&#34;investigate-distributions&#34;&gt;Investigate distributions&lt;/h4&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from matplotlib import pyplot as plt
%matplotlib inline


def plot_hist_grid(df, x, y ):
    
    fig = plt.figure(figsize=(14, 12))

    for i, col in enumerate( df.select_dtypes( include = np.number).columns ):
        ax = fig.add_subplot(x,y,i+1)
        sns.distplot( df[col].dropna() )
        ax.set_title(col + &#39; distribution&#39;)

    fig.tight_layout() ## we need this so the histogram titles do not overlap

    
plot_hist_grid(df_imp_rec, 4, 2)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_19_1.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;p&gt;none of the numerical variables have a normal distribution, the best option here would be to use a &lt;code&gt;Boxcox&lt;/code&gt; or a &lt;code&gt;Yeo Johnson&lt;/code&gt; transformation if we plan on using a parametric model. Both algorithms return a lambda value that allows us to apply the same transformation to new data. Unfortunately the &lt;code&gt;python&lt;/code&gt; implementations are a bit limited at the moment. There is &lt;code&gt;sklearn.preprocessing.PowerTransformer&lt;/code&gt; in the newest development version of &lt;code&gt;scikit-learn&lt;/code&gt; whis supports &lt;code&gt;Boxcox&lt;/code&gt; transformations. Then there is &lt;code&gt;scipy.stats.boxcox&lt;/code&gt; which is a bit cumbersome and requires a lot of manual work. Also &lt;code&gt;Boxcox&lt;/code&gt; is a bit subborn and requires positive values. Probably feature &lt;code&gt;processing&lt;/code&gt; is something you want to keep doing in &lt;code&gt;R&lt;/code&gt; using &lt;code&gt;recipes&lt;/code&gt; or &lt;code&gt;caret&lt;/code&gt;.&lt;/p&gt;

&lt;h4 id=&#34;apply-boxcox-transformation&#34;&gt;Apply Boxcox transformation&lt;/h4&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from scipy.stats import boxcox

df_trans = df_imp_rec.copy()

# boxcox needs values &amp;gt; 0
for col in df_imp_rec.select_dtypes(include = np.number).columns:
    df_trans[col] = df_trans[col] + 0.01

# scipy.stats implementaion cannot handle NA values
# df_trans = df_trans.dropna()

lambdas = dict()

for col in df_imp_rec.select_dtypes(include = np.number).columns:
    df_trans[col], lambdas[col] = boxcox(df_trans[col])
    
print( pd.Series(lambdas) )

plot_hist_grid(df_trans, 4, 2)

df_trans.describe()
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;age         0.822999
fare        0.180913
parch      -0.767354
pclass      1.774717
sibsp      -0.484927
survived   -0.312346
dtype: float64


c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;survived&lt;/th&gt;
      &lt;th&gt;pclass&lt;/th&gt;
      &lt;th&gt;age&lt;/th&gt;
      &lt;th&gt;sibsp&lt;/th&gt;
      &lt;th&gt;parch&lt;/th&gt;
      &lt;th&gt;fare&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;count&lt;/th&gt;
      &lt;td&gt;891.000000&lt;/td&gt;
      &lt;td&gt;891.000000&lt;/td&gt;
      &lt;td&gt;891.000000&lt;/td&gt;
      &lt;td&gt;891.000000&lt;/td&gt;
      &lt;td&gt;891.000000&lt;/td&gt;
      &lt;td&gt;891.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;mean&lt;/th&gt;
      &lt;td&gt;-6.336364&lt;/td&gt;
      &lt;td&gt;2.172058&lt;/td&gt;
      &lt;td&gt;18.275863&lt;/td&gt;
      &lt;td&gt;-11.647712&lt;/td&gt;
      &lt;td&gt;-32.911718&lt;/td&gt;
      &lt;td&gt;3.910416&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;std&lt;/th&gt;
      &lt;td&gt;5.011771&lt;/td&gt;
      &lt;td&gt;1.456663&lt;/td&gt;
      &lt;td&gt;7.261755&lt;/td&gt;
      &lt;td&gt;8.111499&lt;/td&gt;
      &lt;td&gt;18.608375&lt;/td&gt;
      &lt;td&gt;1.965039&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;min&lt;/th&gt;
      &lt;td&gt;-10.289796&lt;/td&gt;
      &lt;td&gt;0.010039&lt;/td&gt;
      &lt;td&gt;-0.608408&lt;/td&gt;
      &lt;td&gt;-17.176613&lt;/td&gt;
      &lt;td&gt;-43.335522&lt;/td&gt;
      &lt;td&gt;-3.124792&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;25%&lt;/th&gt;
      &lt;td&gt;-10.289796&lt;/td&gt;
      &lt;td&gt;1.381702&lt;/td&gt;
      &lt;td&gt;14.257979&lt;/td&gt;
      &lt;td&gt;-17.176613&lt;/td&gt;
      &lt;td&gt;-43.335522&lt;/td&gt;
      &lt;td&gt;2.510059&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;50%&lt;/th&gt;
      &lt;td&gt;-10.289796&lt;/td&gt;
      &lt;td&gt;3.419353&lt;/td&gt;
      &lt;td&gt;18.590518&lt;/td&gt;
      &lt;td&gt;-17.176613&lt;/td&gt;
      &lt;td&gt;-43.335522&lt;/td&gt;
      &lt;td&gt;3.435259&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;75%&lt;/th&gt;
      &lt;td&gt;0.009935&lt;/td&gt;
      &lt;td&gt;3.419353&lt;/td&gt;
      &lt;td&gt;21.455870&lt;/td&gt;
      &lt;td&gt;0.009926&lt;/td&gt;
      &lt;td&gt;-43.335522&lt;/td&gt;
      &lt;td&gt;4.761225&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;max&lt;/th&gt;
      &lt;td&gt;0.009935&lt;/td&gt;
      &lt;td&gt;3.419353&lt;/td&gt;
      &lt;td&gt;43.544598&lt;/td&gt;
      &lt;td&gt;1.310322&lt;/td&gt;
      &lt;td&gt;0.974077&lt;/td&gt;
      &lt;td&gt;11.561796&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;&lt;img src=&#34;output_21_3.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h3 id=&#34;scale&#34;&gt;Scale&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from sklearn.preprocessing import StandardScaler

Scaler = StandardScaler()

cols_num = df_trans.select_dtypes(include = np.number).columns
df_trans.loc[:,cols_num] = Scaler.fit_transform( df_trans.loc[:,cols_num] )

plot_hist_grid(df_trans, 4, 2)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
c:\anaconda\envs\py36r343\lib\site-packages\matplotlib\axes\_axes.py:6462: UserWarning: The &#39;normed&#39; kwarg is deprecated, and has been replaced by the &#39;density&#39; kwarg.
  warnings.warn(&amp;quot;The &#39;normed&#39; kwarg is deprecated, and has been &amp;quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_23_1.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h2 id=&#34;final-feature-selection&#34;&gt;Final feature selection&lt;/h2&gt;

&lt;p&gt;Finally we have some duplicate information in our dataframe which we will drop.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df_fin = df_trans.drop([&#39;survived&#39;,&#39;pclass&#39;], axis = 1)
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;encoding-categorical-variables&#34;&gt;Encoding Categorical variables&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;R&lt;/code&gt; we did not have to worry much about encoding categorical data it would usually be taken care of by most modelling algorithms. In &lt;code&gt;python&lt;/code&gt; we have to do this manually.&lt;/p&gt;

&lt;p&gt;There is an excellent &lt;a href=&#34;http://pbpython.com/categorical-encoding.html&#34;&gt;guide&lt;/a&gt; from which I will try to replicate some of the examples. Digging into the topic a bit I also learned that there are more encoding techniques for categorical variabels than just the regular &lt;em&gt;dummy encoding&lt;/em&gt; which is used by &lt;code&gt;R&lt;/code&gt; as the gold standard. There is also &lt;em&gt;one hot encoding&lt;/em&gt; which creates for a categorical variable with &lt;em&gt;k&lt;/em&gt; categories &lt;em&gt;k&lt;/em&gt; binary columns (compared to &lt;em&gt;k-1&lt;/em&gt; columns for dummy encoding). Beyond those two methods there are plenty more as described in this &lt;a href=&#34;http://www.willmcginnis.com/2015/11/29/beyond-one-hot-an-exploration-of-categorical-variables/&#34;&gt;article&lt;/a&gt;. For these types of encodings the categorical values will be replaced with the summarized values of the response variable of all observations from the same category such as the sum or the mean.  This is similar to the weight of evidence encoding which is commonly used when developing credit risk score cards with logistic regression.&lt;/p&gt;

&lt;p&gt;Returning to the samply data we can see that we have duplicated information such as the columns sex, who, and  adult_male. Here we will select only one of each of those and  prefer categorical string encoding over variables that already have numerical or binary encoding.&lt;/p&gt;

&lt;h3 id=&#34;create-dummy-variables&#34;&gt;Create dummy variables&lt;/h3&gt;

&lt;p&gt;There is no algorithm in scikitlearn that creates dummy variables we therefore need to borrow this functionality from pandas.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df_dum = pd.get_dummies(df_fin
               , drop_first = True ## k-1 dummy variables
              )

df_dum.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;age&lt;/th&gt;
      &lt;th&gt;sibsp&lt;/th&gt;
      &lt;th&gt;parch&lt;/th&gt;
      &lt;th&gt;fare&lt;/th&gt;
      &lt;th&gt;sex_male&lt;/th&gt;
      &lt;th&gt;embarked_Q&lt;/th&gt;
      &lt;th&gt;embarked_S&lt;/th&gt;
      &lt;th&gt;class_Second&lt;/th&gt;
      &lt;th&gt;class_Third&lt;/th&gt;
      &lt;th&gt;who_man&lt;/th&gt;
      &lt;th&gt;...&lt;/th&gt;
      &lt;th&gt;deck_B&lt;/th&gt;
      &lt;th&gt;deck_C&lt;/th&gt;
      &lt;th&gt;deck_D&lt;/th&gt;
      &lt;th&gt;deck_E&lt;/th&gt;
      &lt;th&gt;deck_F&lt;/th&gt;
      &lt;th&gt;deck_G&lt;/th&gt;
      &lt;th&gt;embark_town_Queenstown&lt;/th&gt;
      &lt;th&gt;embark_town_Southampton&lt;/th&gt;
      &lt;th&gt;alive_yes&lt;/th&gt;
      &lt;th&gt;alone_True&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;-0.553605&lt;/td&gt;
      &lt;td&gt;1.437981&lt;/td&gt;
      &lt;td&gt;-0.560482&lt;/td&gt;
      &lt;td&gt;-0.776991&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;0.656833&lt;/td&gt;
      &lt;td&gt;1.437981&lt;/td&gt;
      &lt;td&gt;-0.560482&lt;/td&gt;
      &lt;td&gt;1.284747&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;-0.239527&lt;/td&gt;
      &lt;td&gt;-0.681996&lt;/td&gt;
      &lt;td&gt;-0.560482&lt;/td&gt;
      &lt;td&gt;-0.711671&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;0.438158&lt;/td&gt;
      &lt;td&gt;1.437981&lt;/td&gt;
      &lt;td&gt;-0.560482&lt;/td&gt;
      &lt;td&gt;0.968817&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;0.438158&lt;/td&gt;
      &lt;td&gt;-0.681996&lt;/td&gt;
      &lt;td&gt;-0.560482&lt;/td&gt;
      &lt;td&gt;-0.700078&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;5 rows × 22 columns&lt;/p&gt;
&lt;/div&gt;

&lt;h1 id=&#34;fitting-a-decision-tree&#34;&gt;Fitting a decision tree&lt;/h1&gt;

&lt;p&gt;We will fit an examplatory decision tree to the data. Not because it is the best model to use here but because decision trees can easily be visualised graphically and it is a good exercise to try that out. We will perform a 10 x 10-fold cross validation and a randomized parameter search.&lt;/p&gt;

&lt;h2 id=&#34;hyperparameter-tuning&#34;&gt;Hyperparameter Tuning&lt;/h2&gt;

&lt;p&gt;Traditionally one would use a grid search of all possible hyperparameter combinations in order to optimize model performance. Recently a number of more efficient algorithms have been developed.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;The submodel trick:&lt;/em&gt; For some ensemble methods one of the tuning parameters usually reflects the number of contrbuting models such as the number of trees in a random forest. In order to train a forest with 1000 trees we have in the process also to train models for all numbers of trees between 1:1000. The submodel trick simpoly implies that we are saving these intermediary models for evaluation. The submodel trick is used by many model implementations in the &lt;code&gt;caret&lt;/code&gt; package. Usually the implementation of the submodel trick outweighs the benefits of the other hyperparameter optimizations strategies.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Adaptive Resampling:&lt;/em&gt; In order to validate model performance we have to use k-fold cross validation, k usually depends on the size and variance in the data. Sometimes variance in the data is so high that each k-fold split of the data gives us different results, so we have to perform x times k-fold cross validaztion. For most of the hyperparameter combinations in a grid search however we can probably already predict after analysing just a few cross validation pairs that they will not produce better results than the best combination that we have found so far. Max Kuhn has presented to techniques for prediciting model performance after only a few resampling rounds in his &lt;a href=&#34;https://arxiv.org/pdf/1405.6974.pdf&#34;&gt;2014 paper&lt;/a&gt; which have been experimentally implemented in &lt;code&gt;caret&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Randomized Search:&lt;/em&gt; Experience in hyperparamter tuning has shown that only a few of the tunable parameters of a model actually have an influence on model performance. Which those parameters are however is largely influenced by the dataset. In a case where the model performance is largely dominated by a single parameter a randomized search covers a larger range of that parameter than a grid search as demonstrated in this [paper] and exemplified in the illustration below. (&lt;a href=&#34;http://www.jmlr.org/papers/volume13/bergstra12a/bergstra12a.pdf&#34;&gt;http://www.jmlr.org/papers/volume13/bergstra12a/bergstra12a.pdf&lt;/a&gt;). Randomized search is implemented in &lt;code&gt;caret&lt;/code&gt; as well as in &lt;code&gt;scikitlearn&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;img src=&#34;rand_search.png&#34; alt=&#34;&#34; /&gt;&lt;/p&gt;

&lt;h2 id=&#34;randomized-parameter-search&#34;&gt;Randomized parameter search&lt;/h2&gt;

&lt;p&gt;Instead of specifiying a range for certain parameters we will provide a distribution to sample from an the number of iterations the algorithm should use. We can get the distributions from the &lt;code&gt;scipy.stats&lt;/code&gt; package. Since we have no prior knowledge about which distributions to chose we simply chose &lt;code&gt;stats.randint&lt;/code&gt; for discrete values and &lt;code&gt;stats.uniform&lt;/code&gt; for contineous values.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from sklearn.tree import DecisionTreeClassifier
from sklearn.model_selection import RandomizedSearchCV
from sklearn.model_selection import RepeatedKFold
from scipy import stats


clf = DecisionTreeClassifier()

param_dist = {&#39;min_samples_split&#39;: stats.randint(2,250)
             , &#39;min_samples_leaf&#39;: stats.randint(1,500)
             , &#39;min_impurity_decrease&#39; : stats.uniform(0,1)
             , &#39;max_features&#39;: stats.uniform(0,1) }

n_iter = 2500

random_search = RandomizedSearchCV(clf
                                   , param_dist
                                   , n_iter = n_iter
                                   , scoring = &#39;roc_auc&#39;
                                   , cv = RepeatedKFold( n_splits = 10, n_repeats = 10 )
                                   , verbose = True
                                   , n_jobs = 4 ## parallel processing
                                   , return_train_score = True
                                  )

x = df_dum.drop(&#39;alive_yes&#39;, axis = 1)
y = df_dum[&#39;alive_yes&#39;]

random_search.fit(x,y)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;Fitting 100 folds for each of 2500 candidates, totalling 250000 fits


[Parallel(n_jobs=4)]: Done 142 tasks      | elapsed:    4.4s
[Parallel(n_jobs=4)]: Done 7538 tasks      | elapsed:   20.7s
[Parallel(n_jobs=4)]: Done 20038 tasks      | elapsed:   50.3s
[Parallel(n_jobs=4)]: Done 37538 tasks      | elapsed:  1.4min
[Parallel(n_jobs=4)]: Done 60038 tasks      | elapsed:  2.3min
[Parallel(n_jobs=4)]: Done 87538 tasks      | elapsed:  3.1min
[Parallel(n_jobs=4)]: Done 120038 tasks      | elapsed:  4.2min
[Parallel(n_jobs=4)]: Done 157538 tasks      | elapsed:  5.3min
[Parallel(n_jobs=4)]: Done 200038 tasks      | elapsed:  6.7min
[Parallel(n_jobs=4)]: Done 247538 tasks      | elapsed:  8.2min
[Parallel(n_jobs=4)]: Done 250000 out of 250000 | elapsed:  8.3min finished





RandomizedSearchCV(cv=&amp;lt;sklearn.model_selection._split.RepeatedKFold object at 0x0000026252BAB048&amp;gt;,
          error_score=&#39;raise&#39;,
          estimator=DecisionTreeClassifier(class_weight=None, criterion=&#39;gini&#39;, max_depth=None,
            max_features=None, max_leaf_nodes=None,
            min_impurity_decrease=0.0, min_impurity_split=None,
            min_samples_leaf=1, min_samples_split=2,
            min_weight_fraction_leaf=0.0, presort=False, random_state=None,
            splitter=&#39;best&#39;),
          fit_params=None, iid=True, n_iter=2500, n_jobs=4,
          param_distributions={&#39;max_features&#39;: &amp;lt;scipy.stats._distn_infrastructure.rv_frozen object at 0x0000026252BB9EB8&amp;gt;, &#39;min_samples_leaf&#39;: &amp;lt;scipy.stats._distn_infrastructure.rv_frozen object at 0x0000026252B4B898&amp;gt;, &#39;min_samples_split&#39;: &amp;lt;scipy.stats._distn_infrastructure.rv_frozen object at 0x00000262515C0208&amp;gt;, &#39;min_impurity_decrease&#39;: &amp;lt;scipy.stats._distn_infrastructure.rv_frozen object at 0x0000026252BB9BE0&amp;gt;},
          pre_dispatch=&#39;2*n_jobs&#39;, random_state=None, refit=True,
          return_train_score=True, scoring=&#39;roc_auc&#39;, verbose=True)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;res = pd.DataFrame( random_search.cv_results_ )

res.sort_values(&#39;rank_test_score&#39;).head(10)
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;mean_fit_time&lt;/th&gt;
      &lt;th&gt;mean_score_time&lt;/th&gt;
      &lt;th&gt;mean_test_score&lt;/th&gt;
      &lt;th&gt;mean_train_score&lt;/th&gt;
      &lt;th&gt;param_max_features&lt;/th&gt;
      &lt;th&gt;param_min_impurity_decrease&lt;/th&gt;
      &lt;th&gt;param_min_samples_leaf&lt;/th&gt;
      &lt;th&gt;param_min_samples_split&lt;/th&gt;
      &lt;th&gt;params&lt;/th&gt;
      &lt;th&gt;rank_test_score&lt;/th&gt;
      &lt;th&gt;...&lt;/th&gt;
      &lt;th&gt;split98_test_score&lt;/th&gt;
      &lt;th&gt;split98_train_score&lt;/th&gt;
      &lt;th&gt;split99_test_score&lt;/th&gt;
      &lt;th&gt;split99_train_score&lt;/th&gt;
      &lt;th&gt;split9_test_score&lt;/th&gt;
      &lt;th&gt;split9_train_score&lt;/th&gt;
      &lt;th&gt;std_fit_time&lt;/th&gt;
      &lt;th&gt;std_score_time&lt;/th&gt;
      &lt;th&gt;std_test_score&lt;/th&gt;
      &lt;th&gt;std_train_score&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;1128&lt;/th&gt;
      &lt;td&gt;0.003643&lt;/td&gt;
      &lt;td&gt;0.001576&lt;/td&gt;
      &lt;td&gt;0.849557&lt;/td&gt;
      &lt;td&gt;0.850829&lt;/td&gt;
      &lt;td&gt;0.922112&lt;/td&gt;
      &lt;td&gt;0.00837461&lt;/td&gt;
      &lt;td&gt;83&lt;/td&gt;
      &lt;td&gt;31&lt;/td&gt;
      &lt;td&gt;{&#39;max_features&#39;: 0.9221122085261761, &#39;min_samp...&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.828734&lt;/td&gt;
      &lt;td&gt;0.819121&lt;/td&gt;
      &lt;td&gt;0.901695&lt;/td&gt;
      &lt;td&gt;0.850536&lt;/td&gt;
      &lt;td&gt;0.863777&lt;/td&gt;
      &lt;td&gt;0.854140&lt;/td&gt;
      &lt;td&gt;0.006607&lt;/td&gt;
      &lt;td&gt;0.004447&lt;/td&gt;
      &lt;td&gt;0.041007&lt;/td&gt;
      &lt;td&gt;0.011566&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1633&lt;/th&gt;
      &lt;td&gt;0.003828&lt;/td&gt;
      &lt;td&gt;0.001679&lt;/td&gt;
      &lt;td&gt;0.847263&lt;/td&gt;
      &lt;td&gt;0.851479&lt;/td&gt;
      &lt;td&gt;0.768034&lt;/td&gt;
      &lt;td&gt;0.006899&lt;/td&gt;
      &lt;td&gt;29&lt;/td&gt;
      &lt;td&gt;222&lt;/td&gt;
      &lt;td&gt;{&#39;max_features&#39;: 0.7680338558114431, &#39;min_samp...&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.885823&lt;/td&gt;
      &lt;td&gt;0.849771&lt;/td&gt;
      &lt;td&gt;0.888136&lt;/td&gt;
      &lt;td&gt;0.839672&lt;/td&gt;
      &lt;td&gt;0.846749&lt;/td&gt;
      &lt;td&gt;0.834493&lt;/td&gt;
      &lt;td&gt;0.002111&lt;/td&gt;
      &lt;td&gt;0.002052&lt;/td&gt;
      &lt;td&gt;0.037894&lt;/td&gt;
      &lt;td&gt;0.010166&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2212&lt;/th&gt;
      &lt;td&gt;0.003988&lt;/td&gt;
      &lt;td&gt;0.001859&lt;/td&gt;
      &lt;td&gt;0.844536&lt;/td&gt;
      &lt;td&gt;0.849014&lt;/td&gt;
      &lt;td&gt;0.93337&lt;/td&gt;
      &lt;td&gt;0.0106538&lt;/td&gt;
      &lt;td&gt;83&lt;/td&gt;
      &lt;td&gt;63&lt;/td&gt;
      &lt;td&gt;{&#39;max_features&#39;: 0.9333697771766865, &#39;min_samp...&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.882846&lt;/td&gt;
      &lt;td&gt;0.851963&lt;/td&gt;
      &lt;td&gt;0.901695&lt;/td&gt;
      &lt;td&gt;0.850536&lt;/td&gt;
      &lt;td&gt;0.863777&lt;/td&gt;
      &lt;td&gt;0.854140&lt;/td&gt;
      &lt;td&gt;0.001951&lt;/td&gt;
      &lt;td&gt;0.002024&lt;/td&gt;
      &lt;td&gt;0.043665&lt;/td&gt;
      &lt;td&gt;0.014672&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;753&lt;/th&gt;
      &lt;td&gt;0.003812&lt;/td&gt;
      &lt;td&gt;0.001781&lt;/td&gt;
      &lt;td&gt;0.824468&lt;/td&gt;
      &lt;td&gt;0.835190&lt;/td&gt;
      &lt;td&gt;0.454209&lt;/td&gt;
      &lt;td&gt;0.00670731&lt;/td&gt;
      &lt;td&gt;54&lt;/td&gt;
      &lt;td&gt;112&lt;/td&gt;
      &lt;td&gt;{&#39;max_features&#39;: 0.4542091923263467, &#39;min_samp...&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.882846&lt;/td&gt;
      &lt;td&gt;0.857641&lt;/td&gt;
      &lt;td&gt;0.854237&lt;/td&gt;
      &lt;td&gt;0.798901&lt;/td&gt;
      &lt;td&gt;0.865067&lt;/td&gt;
      &lt;td&gt;0.859434&lt;/td&gt;
      &lt;td&gt;0.007824&lt;/td&gt;
      &lt;td&gt;0.004666&lt;/td&gt;
      &lt;td&gt;0.051183&lt;/td&gt;
      &lt;td&gt;0.024695&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1984&lt;/th&gt;
      &lt;td&gt;0.004388&lt;/td&gt;
      &lt;td&gt;0.001939&lt;/td&gt;
      &lt;td&gt;0.824068&lt;/td&gt;
      &lt;td&gt;0.829957&lt;/td&gt;
      &lt;td&gt;0.625724&lt;/td&gt;
      &lt;td&gt;0.000519658&lt;/td&gt;
      &lt;td&gt;150&lt;/td&gt;
      &lt;td&gt;142&lt;/td&gt;
      &lt;td&gt;{&#39;max_features&#39;: 0.6257243210055624, &#39;min_samp...&lt;/td&gt;
      &lt;td&gt;5&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.875541&lt;/td&gt;
      &lt;td&gt;0.848625&lt;/td&gt;
      &lt;td&gt;0.877119&lt;/td&gt;
      &lt;td&gt;0.836702&lt;/td&gt;
      &lt;td&gt;0.870485&lt;/td&gt;
      &lt;td&gt;0.816932&lt;/td&gt;
      &lt;td&gt;0.003914&lt;/td&gt;
      &lt;td&gt;0.002773&lt;/td&gt;
      &lt;td&gt;0.045516&lt;/td&gt;
      &lt;td&gt;0.022024&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;19&lt;/th&gt;
      &lt;td&gt;0.003757&lt;/td&gt;
      &lt;td&gt;0.001928&lt;/td&gt;
      &lt;td&gt;0.821358&lt;/td&gt;
      &lt;td&gt;0.830195&lt;/td&gt;
      &lt;td&gt;0.749645&lt;/td&gt;
      &lt;td&gt;0.0125087&lt;/td&gt;
      &lt;td&gt;74&lt;/td&gt;
      &lt;td&gt;176&lt;/td&gt;
      &lt;td&gt;{&#39;max_features&#39;: 0.7496448239892235, &#39;min_samp...&lt;/td&gt;
      &lt;td&gt;6&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.828734&lt;/td&gt;
      &lt;td&gt;0.819121&lt;/td&gt;
      &lt;td&gt;0.897740&lt;/td&gt;
      &lt;td&gt;0.847374&lt;/td&gt;
      &lt;td&gt;0.793344&lt;/td&gt;
      &lt;td&gt;0.778700&lt;/td&gt;
      &lt;td&gt;0.006965&lt;/td&gt;
      &lt;td&gt;0.005535&lt;/td&gt;
      &lt;td&gt;0.052542&lt;/td&gt;
      &lt;td&gt;0.023273&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1201&lt;/th&gt;
      &lt;td&gt;0.003417&lt;/td&gt;
      &lt;td&gt;0.001224&lt;/td&gt;
      &lt;td&gt;0.811420&lt;/td&gt;
      &lt;td&gt;0.813680&lt;/td&gt;
      &lt;td&gt;0.854926&lt;/td&gt;
      &lt;td&gt;0.0129389&lt;/td&gt;
      &lt;td&gt;135&lt;/td&gt;
      &lt;td&gt;171&lt;/td&gt;
      &lt;td&gt;{&#39;max_features&#39;: 0.8549262726597407, &#39;min_samp...&lt;/td&gt;
      &lt;td&gt;7&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.828734&lt;/td&gt;
      &lt;td&gt;0.819121&lt;/td&gt;
      &lt;td&gt;0.866102&lt;/td&gt;
      &lt;td&gt;0.815483&lt;/td&gt;
      &lt;td&gt;0.837461&lt;/td&gt;
      &lt;td&gt;0.818296&lt;/td&gt;
      &lt;td&gt;0.006255&lt;/td&gt;
      &lt;td&gt;0.003975&lt;/td&gt;
      &lt;td&gt;0.048909&lt;/td&gt;
      &lt;td&gt;0.017295&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;841&lt;/th&gt;
      &lt;td&gt;0.002967&lt;/td&gt;
      &lt;td&gt;0.001803&lt;/td&gt;
      &lt;td&gt;0.810736&lt;/td&gt;
      &lt;td&gt;0.812231&lt;/td&gt;
      &lt;td&gt;0.837255&lt;/td&gt;
      &lt;td&gt;0.0214463&lt;/td&gt;
      &lt;td&gt;96&lt;/td&gt;
      &lt;td&gt;61&lt;/td&gt;
      &lt;td&gt;{&#39;max_features&#39;: 0.8372554895640392, &#39;min_samp...&lt;/td&gt;
      &lt;td&gt;8&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.828734&lt;/td&gt;
      &lt;td&gt;0.819121&lt;/td&gt;
      &lt;td&gt;0.832203&lt;/td&gt;
      &lt;td&gt;0.774712&lt;/td&gt;
      &lt;td&gt;0.837461&lt;/td&gt;
      &lt;td&gt;0.818296&lt;/td&gt;
      &lt;td&gt;0.006010&lt;/td&gt;
      &lt;td&gt;0.004641&lt;/td&gt;
      &lt;td&gt;0.044853&lt;/td&gt;
      &lt;td&gt;0.017689&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;998&lt;/th&gt;
      &lt;td&gt;0.003285&lt;/td&gt;
      &lt;td&gt;0.001589&lt;/td&gt;
      &lt;td&gt;0.807049&lt;/td&gt;
      &lt;td&gt;0.808691&lt;/td&gt;
      &lt;td&gt;0.792215&lt;/td&gt;
      &lt;td&gt;0.0331625&lt;/td&gt;
      &lt;td&gt;47&lt;/td&gt;
      &lt;td&gt;234&lt;/td&gt;
      &lt;td&gt;{&#39;max_features&#39;: 0.7922151495137242, &#39;min_samp...&lt;/td&gt;
      &lt;td&gt;9&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.828734&lt;/td&gt;
      &lt;td&gt;0.819121&lt;/td&gt;
      &lt;td&gt;0.866102&lt;/td&gt;
      &lt;td&gt;0.815483&lt;/td&gt;
      &lt;td&gt;0.793344&lt;/td&gt;
      &lt;td&gt;0.778700&lt;/td&gt;
      &lt;td&gt;0.006297&lt;/td&gt;
      &lt;td&gt;0.004970&lt;/td&gt;
      &lt;td&gt;0.047764&lt;/td&gt;
      &lt;td&gt;0.018487&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1892&lt;/th&gt;
      &lt;td&gt;0.004287&lt;/td&gt;
      &lt;td&gt;0.001516&lt;/td&gt;
      &lt;td&gt;0.805288&lt;/td&gt;
      &lt;td&gt;0.806958&lt;/td&gt;
      &lt;td&gt;0.729024&lt;/td&gt;
      &lt;td&gt;0.0344067&lt;/td&gt;
      &lt;td&gt;126&lt;/td&gt;
      &lt;td&gt;116&lt;/td&gt;
      &lt;td&gt;{&#39;max_features&#39;: 0.7290237550895209, &#39;min_samp...&lt;/td&gt;
      &lt;td&gt;10&lt;/td&gt;
      &lt;td&gt;...&lt;/td&gt;
      &lt;td&gt;0.828734&lt;/td&gt;
      &lt;td&gt;0.819121&lt;/td&gt;
      &lt;td&gt;0.866102&lt;/td&gt;
      &lt;td&gt;0.815483&lt;/td&gt;
      &lt;td&gt;0.837461&lt;/td&gt;
      &lt;td&gt;0.818296&lt;/td&gt;
      &lt;td&gt;0.008426&lt;/td&gt;
      &lt;td&gt;0.004454&lt;/td&gt;
      &lt;td&gt;0.052977&lt;/td&gt;
      &lt;td&gt;0.018888&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;10 rows × 214 columns&lt;/p&gt;
&lt;/div&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from matplotlib import cm

params = [&#39;param_max_features&#39;
         , &#39;param_min_impurity_decrease&#39;
         , &#39;param_min_samples_split&#39;]


cmap = cm.get_cmap(&#39;Dark2&#39;)

fig = plt.figure( figsize=(14, 12) )

for i, param in enumerate(params):

    ax = fig.add_subplot(2,2,i+1)
    
    sns.regplot( x = param
               , y = &#39;mean_test_score&#39;
               , data = res # res.query(&#39;mean_test_score &amp;gt; 0.5&#39;) 
               , scatter_kws = { &#39;color&#39; :cmap(i) }
               , fit_reg = False
             )
    
    
    
    ax.set_title(param)

  
fig.tight_layout() ## we need this so the histogram titles do not overlap
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_32_0.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;p&gt;We can see that we only have a very narrow range for which min_impurity_decrease is optimal, the param_max_features value probably should be kept at maximum and min_samples_split probably does not have a large influence on performance.&lt;/p&gt;

&lt;h1 id=&#34;visualize-tree&#34;&gt;Visualize Tree&lt;/h1&gt;

&lt;p&gt;Scikitlearn allows us to export a decision tree graphic in GraphViz dot language format. We can interpret this format using &lt;code&gt;PyDotPlus&lt;/code&gt;. In order for this to work we need to &lt;a href=&#34;https://graphviz.gitlab.io/_pages/Download/Download_windows.html&#34;&gt;download&lt;/a&gt; and install &lt;code&gt;GraphViz&lt;/code&gt; and put the installation folder into the PATH variable as well as pip installing the &lt;code&gt;graphviz&lt;/code&gt; python package. See the &lt;a href=&#34;http://graphviz.readthedocs.io/en/stable/manual.html&#34;&gt;documentation&lt;/a&gt; for installation instructions. For this tree we loose some of the interpretability because of the scaling and the boxcox transformation.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;tree = random_search.best_estimator_

from sklearn.externals.six import StringIO  
from IPython.display import Image  
from sklearn.tree import export_graphviz
import pydotplus

dot_data = StringIO()

export_graphviz(tree
                , out_file = dot_data
                , filled = True
                , rounded = True
                , special_characters = True
                , feature_names = x.columns
                , class_names = [&#39;alive&#39;, &#39;dead&#39;] )

graph = pydotplus.graph_from_dot_data( dot_data.getvalue() )  

Image( graph.create_png() )
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_35_0.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h1 id=&#34;feature-importance&#34;&gt;Feature Importance&lt;/h1&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;pd.DataFrame({ &#39;features&#39; : x.columns, &#39;importance&#39;: tree.feature_importances_}) \
    .sort_values(&#39;importance&#39;, ascending = False)
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;features&lt;/th&gt;
      &lt;th&gt;importance&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;11&lt;/th&gt;
      &lt;td&gt;adult_male_True&lt;/td&gt;
      &lt;td&gt;0.730129&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;fare&lt;/td&gt;
      &lt;td&gt;0.136980&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;8&lt;/th&gt;
      &lt;td&gt;class_Third&lt;/td&gt;
      &lt;td&gt;0.132890&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;age&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;12&lt;/th&gt;
      &lt;td&gt;deck_B&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;19&lt;/th&gt;
      &lt;td&gt;embark_town_Southampton&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;18&lt;/th&gt;
      &lt;td&gt;embark_town_Queenstown&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;17&lt;/th&gt;
      &lt;td&gt;deck_G&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;16&lt;/th&gt;
      &lt;td&gt;deck_F&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;15&lt;/th&gt;
      &lt;td&gt;deck_E&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;14&lt;/th&gt;
      &lt;td&gt;deck_D&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;13&lt;/th&gt;
      &lt;td&gt;deck_C&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;10&lt;/th&gt;
      &lt;td&gt;who_woman&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;sibsp&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;9&lt;/th&gt;
      &lt;td&gt;who_man&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;7&lt;/th&gt;
      &lt;td&gt;class_Second&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;6&lt;/th&gt;
      &lt;td&gt;embarked_S&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;5&lt;/th&gt;
      &lt;td&gt;embarked_Q&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;sex_male&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;parch&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;20&lt;/th&gt;
      &lt;td&gt;alone_True&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h1 id=&#34;roc-curve&#34;&gt;ROC Curve&lt;/h1&gt;

&lt;p&gt;Lets visualize a ROC curve for the tree with the best parameters and all 10x10x cross validation sets. Loosely inspired by this example &lt;a href=&#34;http://scikit-learn.org/stable/auto_examples/model_selection/plot_roc_crossval.html#sphx-glr-auto-examples-model-selection-plot-roc-crossval-py&#34;&gt;code&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&#34;get-tpr-fpr-values-for-cv-pairs&#34;&gt;Get tpr, fpr values for cv pairs&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from sklearn.model_selection import cross_val_score
import sklearn

cv = sklearn.model_selection.RepeatedKFold(10,10)

tree = random_search.best_estimator_

results_df = pd.DataFrame( columns = [&#39;fold&#39;, &#39;fpr&#39;, &#39;tpr&#39;, &#39;thresh&#39;, &#39;auc&#39;] )


for i, split in enumerate(cv.split(x,y)):
    
    train, test = split
    
    tree = tree.fit(x.loc[train,:], y[train])
    
    pred_arr =  tree.predict_proba( x.loc[test,:] )
    # predict outputs probability for positive and negative outcome
    pred =  pd.DataFrame(pred_arr).loc[:,1]
    
    real = y[test]
    
    fpr, tpr, thresh = sklearn.metrics.roc_curve( y_true = real, y_score = pred)
    
    auc = sklearn.metrics.auc(fpr, tpr)
    
    rocs = pd.DataFrame({&#39;fold&#39;: i, &#39;fpr&#39;: fpr, &#39;tpr&#39;: tpr , &#39;thresh&#39;: thresh, &#39;auc&#39;: auc})
    
    results_df = pd.concat([results_df, rocs], axis = 0)
    
    results_df_reind = results_df.reset_index( inplace = False ) \
        .rename(columns = {&#39;index&#39;:&#39;seq&#39;})

results_df_reind.head(20)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;c:\anaconda\envs\py36r343\lib\site-packages\ipykernel\__main__.py:30: FutureWarning: Sorting because non-concatenation axis is not aligned. A future version
of pandas will change to not sort by default.

To accept the future behavior, pass &#39;sort=False&#39;.

To retain the current behavior and silence the warning, pass &#39;sort=True&#39;.
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;seq&lt;/th&gt;
      &lt;th&gt;auc&lt;/th&gt;
      &lt;th&gt;fold&lt;/th&gt;
      &lt;th&gt;fpr&lt;/th&gt;
      &lt;th&gt;thresh&lt;/th&gt;
      &lt;th&gt;tpr&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0.800735&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
      &lt;td&gt;1.957576&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0.800735&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0.032787&lt;/td&gt;
      &lt;td&gt;0.957576&lt;/td&gt;
      &lt;td&gt;0.517241&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;0.800735&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0.229508&lt;/td&gt;
      &lt;td&gt;0.490323&lt;/td&gt;
      &lt;td&gt;0.689655&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;0.800735&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0.426230&lt;/td&gt;
      &lt;td&gt;0.352459&lt;/td&gt;
      &lt;td&gt;0.827586&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;0.800735&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1.000000&lt;/td&gt;
      &lt;td&gt;0.100279&lt;/td&gt;
      &lt;td&gt;1.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;5&lt;/th&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0.877193&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
      &lt;td&gt;0.945455&lt;/td&gt;
      &lt;td&gt;0.531250&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;6&lt;/th&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0.877193&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0.105263&lt;/td&gt;
      &lt;td&gt;0.475309&lt;/td&gt;
      &lt;td&gt;0.656250&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;7&lt;/th&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;0.877193&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0.245614&lt;/td&gt;
      &lt;td&gt;0.325203&lt;/td&gt;
      &lt;td&gt;0.875000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;8&lt;/th&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;0.877193&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1.000000&lt;/td&gt;
      &lt;td&gt;0.105114&lt;/td&gt;
      &lt;td&gt;1.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;9&lt;/th&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0.887881&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
      &lt;td&gt;0.946746&lt;/td&gt;
      &lt;td&gt;0.464286&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;10&lt;/th&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0.887881&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;0.213115&lt;/td&gt;
      &lt;td&gt;0.472973&lt;/td&gt;
      &lt;td&gt;0.857143&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;11&lt;/th&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;0.887881&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;0.377049&lt;/td&gt;
      &lt;td&gt;0.357143&lt;/td&gt;
      &lt;td&gt;0.928571&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;12&lt;/th&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;0.887881&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;1.000000&lt;/td&gt;
      &lt;td&gt;0.108635&lt;/td&gt;
      &lt;td&gt;1.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;13&lt;/th&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0.845894&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
      &lt;td&gt;1.951515&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;14&lt;/th&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0.845894&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;0.019231&lt;/td&gt;
      &lt;td&gt;0.951515&lt;/td&gt;
      &lt;td&gt;0.432432&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;15&lt;/th&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;0.845894&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;0.115385&lt;/td&gt;
      &lt;td&gt;0.452229&lt;/td&gt;
      &lt;td&gt;0.702703&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;16&lt;/th&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;0.845894&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;0.288462&lt;/td&gt;
      &lt;td&gt;0.338710&lt;/td&gt;
      &lt;td&gt;0.837838&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;17&lt;/th&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;0.845894&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;1.000000&lt;/td&gt;
      &lt;td&gt;0.098315&lt;/td&gt;
      &lt;td&gt;1.000000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;18&lt;/th&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0.916837&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
      &lt;td&gt;0.944099&lt;/td&gt;
      &lt;td&gt;0.525000&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;19&lt;/th&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0.916837&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;0.081633&lt;/td&gt;
      &lt;td&gt;0.442308&lt;/td&gt;
      &lt;td&gt;0.825000&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;results_gr = results_df_reind.groupby(&#39;seq&#39;) \
    .agg({&#39;tpr&#39;:[&#39;mean&#39;, &#39;sem&#39;]
          , &#39;fpr&#39;:[&#39;mean&#39;, &#39;sem&#39;]
          , &#39;thresh&#39;:&#39;mean&#39; 
          } )  
    
results_gr
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead tr th {
        text-align: left;
    }
    .dataframe thead tr:last-of-type th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th colspan=&#34;2&#34; halign=&#34;left&#34;&gt;tpr&lt;/th&gt;
      &lt;th colspan=&#34;2&#34; halign=&#34;left&#34;&gt;fpr&lt;/th&gt;
      &lt;th&gt;thresh&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;mean&lt;/th&gt;
      &lt;th&gt;sem&lt;/th&gt;
      &lt;th&gt;mean&lt;/th&gt;
      &lt;th&gt;sem&lt;/th&gt;
      &lt;th&gt;mean&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;seq&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;0.178960&lt;/td&gt;
      &lt;td&gt;0.024876&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
      &lt;td&gt;1.577290&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;0.571897&lt;/td&gt;
      &lt;td&gt;0.016556&lt;/td&gt;
      &lt;td&gt;0.074479&lt;/td&gt;
      &lt;td&gt;0.007452&lt;/td&gt;
      &lt;td&gt;0.794128&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;0.785816&lt;/td&gt;
      &lt;td&gt;0.012450&lt;/td&gt;
      &lt;td&gt;0.266459&lt;/td&gt;
      &lt;td&gt;0.018996&lt;/td&gt;
      &lt;td&gt;0.430423&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;0.926658&lt;/td&gt;
      &lt;td&gt;0.008574&lt;/td&gt;
      &lt;td&gt;0.650176&lt;/td&gt;
      &lt;td&gt;0.033806&lt;/td&gt;
      &lt;td&gt;0.244318&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;0.993480&lt;/td&gt;
      &lt;td&gt;0.003889&lt;/td&gt;
      &lt;td&gt;0.965127&lt;/td&gt;
      &lt;td&gt;0.019782&lt;/td&gt;
      &lt;td&gt;0.116393&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;5&lt;/th&gt;
      &lt;td&gt;1.000000&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
      &lt;td&gt;1.000000&lt;/td&gt;
      &lt;td&gt;0.000000&lt;/td&gt;
      &lt;td&gt;0.104326&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&#34;plot-roc-curve&#34;&gt;Plot ROC Curve&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;cmap = cm.get_cmap(&#39;Dark2&#39;)

fig = plt.figure( figsize=(5, 5) )


plt.plot( results_gr.fpr[&#39;mean&#39;], results_gr.tpr[&#39;mean&#39;]
         , color = &#39;steelblue&#39;
         , lw = 4 
         , label = &#39;mean&#39;)

plt.plot( [0,1],[0,1]
         , color = &#39;lightgrey&#39;
         , linestyle=&#39;--&#39; ) 

plt.fill_between( results_gr.fpr[&#39;mean&#39;]
                 , results_gr.tpr[&#39;mean&#39;] - 2 * results_gr.tpr[&#39;sem&#39;]
                 , results_gr.tpr[&#39;mean&#39;] + 2 * results_gr.tpr[&#39;sem&#39;]
                 , alpha = 0.5 
                 , label = &#39;CI95&#39; )

plt.xlabel(&#39;False positive rate (fpr)&#39;)
plt.ylabel(&#39;True positive rate (tpr)&#39;)
plt.legend( loc = &#39;lower right&#39;)
plt.title(&#39;ROC Curve, AUC:{}&#39;.format( results_df_reind.auc.unique().mean().round(3) ))

plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_42_0.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Moving from R to python - 4/7 - plotly</title>
      <link>https://www.datisticsblog.com/2018/08/r2py_plotly/</link>
      <pubDate>Fri, 24 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/08/r2py_plotly/</guid>
      <description>




&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;../../../r2py.png&#34; style=&#34;width: 180px;height: 180px;&#34;&gt;
  
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_ide/&#34;&gt;1 of 7: IDE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_pandas/&#34;&gt;2 of 7: pandas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_matplotlib_seaborn/&#34;&gt;3 of 7: matplotlib and seaborn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_plotly/&#34;&gt;4 of 7: plotly&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn/&#34;&gt;5 of 7: scikitlearn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn_advanced/&#34;&gt;6 of 7: advanced scikitlearn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_automated_ml/&#34;&gt;7 of 7: automated machine learning&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- toc --&gt;

&lt;h1 id=&#34;plotly&#34;&gt;plotly&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;plotly&lt;/code&gt; can either render interactive graphs inside a &lt;code&gt;jupyter notebook&lt;/code&gt; or save plots as &lt;code&gt;html&lt;/code&gt; and open them inside a browser.&lt;/p&gt;

&lt;p&gt;we import two plot functions from &lt;code&gt;plotly.offline&lt;/code&gt;, &lt;code&gt;plot&lt;/code&gt; for offline plotting and &lt;code&gt;iplot&lt;/code&gt; for online plotting&lt;/p&gt;

&lt;h2 id=&#34;imports&#34;&gt;Imports&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;# plotly
import plotly.plotly as py
import plotly.graph_objs as go
import plotly.tools as tls 
from plotly.offline import download_plotlyjs, init_notebook_mode, plot, iplot, iplot_mpl

# matplotlib, seaborn
import seaborn as sns
from matplotlib import cm
from matplotlib import pyplot as plt
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;minimal-example&#34;&gt;Minimal Example&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;init_notebook_mode(connected = True)

trace = { &#39;x&#39;:[1,2], &#39;y&#39;:[1,2] }

data = [trace]

fig = go.Figure( data = data, layout = {} )

iplot(fig)
&lt;/code&gt;&lt;/pre&gt;

&lt;div class=&#34;alert info &#34;&gt;
  &lt;p&gt;The code above would be sufficient to generate show an interactive java script graph in a jupyter notebook. However java script get lost when notebooks are converted first to &lt;code&gt;.md&lt;/code&gt; and then to &lt;code&gt;.html&lt;/code&gt; therefore we use an iframe to embedd the graph instead.&lt;/p&gt;
&lt;/div&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from IPython.display import HTML
HTML(&#39;&amp;lt;iframe width=&amp;quot;900&amp;quot; height=&amp;quot;800&amp;quot; frameborder=&amp;quot;0&amp;quot; scrolling=&amp;quot;no&amp;quot; src=&amp;quot;//plot.ly/~datistics/1.embed&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;iframe width=&#34;900&#34; height=&#34;800&#34; frameborder=&#34;0&#34; scrolling=&#34;no&#34; src=&#34;//plot.ly/~datistics/1.embed&#34;&gt;&lt;/iframe&gt;

&lt;h2 id=&#34;scatterplot&#34;&gt;Scatterplot&lt;/h2&gt;

&lt;p&gt;as in matplotlib we have to add each group of elements. This time we use a for loop to iterate ofer the unique species and then store the traces in the data list. For the colors we get the Brewer palettes from matplotlib importing &lt;code&gt;cm&lt;/code&gt; (color maps). &lt;code&gt;plotly&lt;/code&gt; excepts either named colors (&amp;lsquo;red&amp;rsquo;, &amp;lsquo;green&amp;rsquo;, etc), HEX strings (&amp;lsquo;#FF0000&amp;rsquo;) or rgba/rgb strings &amp;lsquo;rgba(255,0,0,1)&amp;rsquo; as colors. Note that in &lt;code&gt;python&lt;/code&gt; 3 the old &lt;code&gt;%&lt;/code&gt; format operator for strings is deprecated.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df = sns.load_dataset(&#39;iris&#39;)

species = list( df.species.unique() )

colors_rgba = list( cm.Dark2( range(0,len(species),1) ) )
colors_str = [ &#39;rgba({},{},{},{})&#39;.format(r,g,b,a) for r,g,b,a in colors_rgba ]

data = []

for i, spec  in enumerate( species, 0 ) :
    
    df_spec = df.loc[ df[&#39;species&#39;] == spec, : ]
    
    trace = go.Scatter( x = df_spec.petal_length
                      , y = df_spec.petal_width
                      , mode = &#39;markers&#39;
                      , name = spec
                      , marker = dict( color = colors_str[i] )
                      )    
    data.append(trace)
    

fig = go.Figure( data = data, layout = {} )

iplot(fig)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;HTML(&#39;&amp;lt;iframe width=&amp;quot;900&amp;quot; height=&amp;quot;800&amp;quot; frameborder=&amp;quot;0&amp;quot; scrolling=&amp;quot;no&amp;quot; src=&amp;quot;//plot.ly/~datistics/3.embed&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;iframe width=&#34;900&#34; height=&#34;800&#34; frameborder=&#34;0&#34; scrolling=&#34;no&#34; src=&#34;//plot.ly/~datistics/3.embed&#34;&gt;&lt;/iframe&gt;

&lt;h2 id=&#34;convert-matplotlib-object-to-plotly-object&#34;&gt;Convert &lt;code&gt;matplotlib&lt;/code&gt; object to &lt;code&gt;plotly&lt;/code&gt; object&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;R&lt;/code&gt; we can convert most &lt;code&gt;ggplot2&lt;/code&gt; plots easily to &lt;code&gt;plotly&lt;/code&gt; plots. We can do something similar in &lt;code&gt;python&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;there are a few tweaks to consider which we cannot cover all here, but check out this (tutorial)[&lt;a href=&#34;http://nbviewer.jupyter.org/github/plotly/python-user-guide/blob/master/s6_matplotlylib/s6_matplotlylib.ipynb&#34;&gt;http://nbviewer.jupyter.org/github/plotly/python-user-guide/blob/master/s6_matplotlylib/s6_matplotlylib.ipynb&lt;/a&gt;]&lt;/p&gt;

&lt;h3 id=&#34;minimal-scatterplot&#34;&gt;Minimal Scatterplot&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;fig = plt.figure()

plt.plot(list( df.petal_length ), list(df.petal_width), &#39;o&#39; )

init_notebook_mode()

py_fig = tls.mpl_to_plotly(fig)

iplot_mpl(fig)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;HTML(&#39;&amp;lt;iframe width=&amp;quot;400&amp;quot; height=&amp;quot;300&amp;quot; frameborder=&amp;quot;0&amp;quot; scrolling=&amp;quot;no&amp;quot; src=&amp;quot;//plot.ly/~datistics/5.embed&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;iframe width=&#34;400&#34; height=&#34;300&#34; frameborder=&#34;0&#34; scrolling=&#34;no&#34; src=&#34;//plot.ly/~datistics/5.embed&#34;&gt;&lt;/iframe&gt;

&lt;h3 id=&#34;scatterplot-iteratively-constructed&#34;&gt;Scatterplot iteratively constructed&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;fig = plt.figure()

for i, spec  in enumerate( species, 0 ) :
    
    df_spec = df.loc[ df[&#39;species&#39;] == spec, : ]
    
    plt.plot( list( df_spec.petal_length ), list(df_spec.petal_width), &#39;o&#39; )


init_notebook_mode()

py_fig = tls.mpl_to_plotly(fig)

iplot_mpl(fig)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;HTML(&#39;&amp;lt;iframe width=&amp;quot;400&amp;quot; height=&amp;quot;300&amp;quot; frameborder=&amp;quot;0&amp;quot; scrolling=&amp;quot;no&amp;quot; src=&amp;quot;//plot.ly/~datistics/7.embed&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;iframe width=&#34;400&#34; height=&#34;300&#34; frameborder=&#34;0&#34; scrolling=&#34;no&#34; src=&#34;//plot.ly/~datistics/7.embed&#34;&gt;&lt;/iframe&gt;

&lt;h3 id=&#34;scatterplot-via-pandas&#34;&gt;Scatterplot via &lt;code&gt;pandas&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Here we also add a legend, but the legend does not translate well to the &lt;code&gt;plotly&lt;/code&gt; object, which we would have to edit manually to correct it.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;# old school

fig, ax = plt.subplots()

df.loc[ df[&#39;species&#39;] == &#39;setosa&#39;, : ].plot.scatter(&#39;petal_length&#39;, &#39;petal_width&#39;, label = &#39;setosa&#39;, color = &#39;blue&#39;, ax = ax)

# functional indexing
df.query(&#39;species == &amp;quot;versicolor&amp;quot;&#39;) \
    .plot.scatter( &#39;petal_length&#39;, &#39;petal_width&#39;
                  , label = &#39;versicolor&#39;
                  , color = &#39;orange&#39; 
                  , ax = ax )
    
df.query(&#39;species == &amp;quot;virginica&amp;quot;&#39;) \
    .plot.scatter( &#39;petal_length&#39;, &#39;petal_width&#39;
                  , label = &#39;virginica&#39;
                  , color = &#39;green&#39; 
                  , ax = ax ) 
    
init_notebook_mode()

py_fig = tls.mpl_to_plotly(fig)

# remove matplotlib default styling
iplot_mpl(fig, strip_style= True)

# keep matplotlib default styling
iplot_mpl(fig, strip_style= False)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;C:\anaconda3\lib\site-packages\plotly\matplotlylib\renderer.py:445: UserWarning:

Dang! That path collection is out of this world. I totally don&#39;t know what to do with it yet! Plotly can only import path collections linked to &#39;data&#39; coordinates

C:\anaconda3\lib\site-packages\plotly\matplotlylib\renderer.py:481: UserWarning:

I found a path object that I don&#39;t think is part of a bar chart. Ignoring.
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;HTML(&#39;&amp;lt;iframe width=&amp;quot;400&amp;quot; height=&amp;quot;300&amp;quot; frameborder=&amp;quot;0&amp;quot; scrolling=&amp;quot;no&amp;quot; src=&amp;quot;//plot.ly/~datistics/9.embed&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;iframe width=&#34;400&#34; height=&#34;300&#34; frameborder=&#34;0&#34; scrolling=&#34;no&#34; src=&#34;//plot.ly/~datistics/9.embed&#34;&gt;&lt;/iframe&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;HTML(&#39;&amp;lt;iframe width=&amp;quot;400&amp;quot; height=&amp;quot;300&amp;quot; frameborder=&amp;quot;0&amp;quot; scrolling=&amp;quot;no&amp;quot; src=&amp;quot;//plot.ly/~datistics/9.embed&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;iframe width=&#34;400&#34; height=&#34;300&#34; frameborder=&#34;0&#34; scrolling=&#34;no&#34; src=&#34;//plot.ly/~datistics/9.embed&#34;&gt;&lt;/iframe&gt;

&lt;h3 id=&#34;scatterplot-via-seaborn&#34;&gt;Scatterplot via &lt;code&gt;seaborn&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;Nice, but we loose the legend&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;sns.lmplot(x = &#39;petal_length&#39;, y = &#39;petal_width&#39;, data = df
           , hue = &#39;species&#39;
           , fit_reg = False)

init_notebook_mode()

# we need to get the figure like this for some reason
fig = plt.gcf()

py_fig = tls.mpl_to_plotly(fig)

iplot_mpl(fig, strip_style= False)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;HTML(&#39;&amp;lt;iframe width=&amp;quot;400&amp;quot; height=&amp;quot;400&amp;quot; frameborder=&amp;quot;0&amp;quot; scrolling=&amp;quot;no&amp;quot; src=&amp;quot;//plot.ly/~datistics/13.embed&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;iframe width=&#34;400&#34; height=&#34;400&#34; frameborder=&#34;0&#34; scrolling=&#34;no&#34; src=&#34;//plot.ly/~datistics/13.embed&#34;&gt;&lt;/iframe&gt;

&lt;h3 id=&#34;boxplot-via-seaborn-from-wide-format&#34;&gt;Boxplot via &lt;code&gt;seaborn&lt;/code&gt; from wide format&lt;/h3&gt;

&lt;p&gt;we loose the boxes&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;sns.boxplot(data=df)

init_notebook_mode()

# we need to get the figure like this for some reason
fig = plt.gcf()

py_fig = tls.mpl_to_plotly(fig)

iplot_mpl(fig, strip_style= False)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;HTML(&#39;&amp;lt;iframe width=&amp;quot;400&amp;quot; height=&amp;quot;800&amp;quot; frameborder=&amp;quot;0&amp;quot; scrolling=&amp;quot;no&amp;quot; src=&amp;quot;//plot.ly/~datistics/15.embed&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;iframe width=&#34;400&#34; height=&#34;300&#34; frameborder=&#34;0&#34; scrolling=&#34;no&#34; src=&#34;//plot.ly/~datistics/15.embed&#34;&gt;&lt;/iframe&gt;

&lt;h3 id=&#34;boxplot-via-seaborn-from-long-format&#34;&gt;Boxplot via &lt;code&gt;seaborn&lt;/code&gt; from long format&lt;/h3&gt;

&lt;p&gt;we still loose the boxes&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df_melt = df.melt(value_vars=[&#39;sepal_length&#39;, &#39;sepal_width&#39;, &#39;petal_length&#39;, &#39;petal_width&#39;]
                 , id_vars = &#39;species&#39;)


sns.boxplot(&#39;variable&#39;, &#39;value&#39;, data = df_melt, hue = &#39;species&#39;)

init_notebook_mode()

# we need to get the figure like this for some reason
fig = plt.gcf()

py_fig = tls.mpl_to_plotly(fig)

iplot_mpl(fig, strip_style= False)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;C:\anaconda3\lib\site-packages\plotly\matplotlylib\renderer.py:481: UserWarning:

I found a path object that I don&#39;t think is part of a bar chart. Ignoring.
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;HTML(&#39;&amp;lt;iframe width=&amp;quot;400&amp;quot; height=&amp;quot;300&amp;quot; frameborder=&amp;quot;0&amp;quot; scrolling=&amp;quot;no&amp;quot; src=&amp;quot;//plot.ly/~datistics/17.embed&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;iframe width=&#34;400&#34; height=&#34;300&#34; frameborder=&#34;0&#34; scrolling=&#34;no&#34; src=&#34;//plot.ly/~datistics/17.embed&#34;&gt;&lt;/iframe&gt;

&lt;h3 id=&#34;violin-plots-via-seaborn&#34;&gt;Violin plots via &lt;code&gt;seaborn&lt;/code&gt;&lt;/h3&gt;

&lt;div class=&#34;alert danger &#34;&gt;
  &lt;p&gt;Does not work&lt;/p&gt;
&lt;/div&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;# sns.violinplot(&#39;variable&#39;, &#39;value&#39;, data = df_melt
#               , hue = &#39;species&#39;
#               , inner = None ## removes inner boxes
#               , zorder = 1
#              )
#
# init_notebook_mode()
#
# # we need to get the figure like this for some reason
# fig = plt.gcf()
#
# py_fig = tls.mpl_to_plotly(fig)
#
# iplot_mpl(fig, strip_style= False)
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;factor-plot-via-seaborn&#34;&gt;Factor Plot via seaborn&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;ax = sns.factorplot(&#39;variable&#39;, &#39;value&#39;, data = df_melt
              , hue = &#39;species&#39;
              , col = &#39;species&#39;
              , kind = &#39;box&#39; )

ax.set_xticklabels(rotation = -45)

init_notebook_mode()

# we need to get the figure like this for some reason
fig = plt.gcf()

py_fig = tls.mpl_to_plotly(fig)

iplot_mpl(fig, strip_style= False)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;C:\anaconda3\lib\site-packages\plotly\matplotlylib\renderer.py:516: UserWarning:

Looks like the annotation(s) you are trying 
to draw lies/lay outside the given figure size.

Therefore, the resulting Plotly figure may not be 
large enough to view the full text. To adjust 
the size of the figure, use the &#39;width&#39; and 
&#39;height&#39; keys in the Layout object. Alternatively,
use the Margin object to adjust the figure&#39;s margins.

C:\anaconda3\lib\site-packages\plotly\matplotlylib\renderer.py:481: UserWarning:

I found a path object that I don&#39;t think is part of a bar chart. Ignoring.
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;HTML(&#39;&amp;lt;iframe width=&amp;quot;900&amp;quot; height=&amp;quot;300&amp;quot; frameborder=&amp;quot;0&amp;quot; scrolling=&amp;quot;no&amp;quot; src=&amp;quot;//plot.ly/~datistics/19.embed&amp;quot;&amp;gt;&amp;lt;/iframe&amp;gt;&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;iframe width=&#34;900&#34; height=&#34;300&#34; frameborder=&#34;0&#34; scrolling=&#34;no&#34; src=&#34;//plot.ly/~datistics/19.embed&#34;&gt;&lt;/iframe&gt;

&lt;h1 id=&#34;summary&#34;&gt;Summary&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;plotly&lt;/code&gt; plots look great if we use the original synthax. Converting &lt;code&gt;matplotlib&lt;/code&gt; objects to &lt;code&gt;plotly&lt;/code&gt; format is not worth it. They &lt;code&gt;plotly&lt;/code&gt; and the &lt;code&gt;matplotlib&lt;/code&gt; synthax have in common that they are quite cumbersome and that we need to use loops or very long repetitive code to pupulate the graphs. &lt;code&gt;seaborn&lt;/code&gt; tackles this by reducing looping and providing excellent default settings. However we will occasionally encounter glitches that we need to tackle by iteratively reconfiguring attributes of plot elements in &lt;code&gt;matplotlib&lt;/code&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Moving from R to python - 3/7 - matplotlib and seaborn</title>
      <link>https://www.datisticsblog.com/2018/08/r2py_matplotlib_seaborn/</link>
      <pubDate>Thu, 23 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/08/r2py_matplotlib_seaborn/</guid>
      <description>




&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;../../../r2py.png&#34; style=&#34;width: 180px;height: 180px;&#34;&gt;
  
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_ide/&#34;&gt;1 of 7: IDE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_pandas/&#34;&gt;2 of 7: pandas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_matplotlib_seaborn/&#34;&gt;3 of 7: matplotlib and seaborn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_plotly/&#34;&gt;4 of 7: plotly&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn/&#34;&gt;5 of 7: scikitlearn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn_advanced/&#34;&gt;6 of 7: advanced scikitlearn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_automated_ml/&#34;&gt;7 of 7: automated machine learning&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- toc --&gt;

&lt;h1 id=&#34;visualisations-in-python&#34;&gt;Visualisations in &lt;code&gt;python&lt;/code&gt;&lt;/h1&gt;

&lt;p&gt;In &lt;code&gt;R&lt;/code&gt; I am used to work with a combination of &lt;code&gt;ggplot2&lt;/code&gt; and &lt;code&gt;plotly&lt;/code&gt;. It seems that in &lt;code&gt;python&lt;/code&gt; you have &lt;code&gt;matplotlib&lt;/code&gt; which is fully integrated into &lt;code&gt;pandas&lt;/code&gt; and you have &lt;code&gt;seaborn&lt;/code&gt; which provides some pretty default setting for most of &lt;code&gt;matplotlib&lt;/code&gt;&amp;rsquo;s standard graph types.&lt;/p&gt;

&lt;p&gt;The main difference of &lt;code&gt;matplotlib&lt;/code&gt; to &lt;code&gt;ggplot2&lt;/code&gt; is that it is optimised for wide formatted data tables while &lt;code&gt;ggplot2&lt;/code&gt; is optimised for data in the long format. In matplotlib we we woul iterate over every column that we would want to add to our plot while in ggplot we would define x and y measurements and then select a grouping or facetting variable.&lt;/p&gt;

&lt;h1 id=&#34;seaborn&#34;&gt;&lt;code&gt;seaborn&lt;/code&gt;&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;seaborn&lt;/code&gt; is built on top of matplotlib it provides some pretty decent defaults for &lt;code&gt;matplotlib&lt;/code&gt; and has a stunning &lt;a href=&#34;https://seaborn.pydata.org/examples/index.html&#34;&gt;example gallery&lt;/a&gt;. &lt;code&gt;seaborn&lt;/code&gt; supports long and wide format as input.&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;https://elitedatascience.com/python-seaborn-tutorial&#34;&gt;tutorial&lt;/a&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;import pandas as pd
from matplotlib import pyplot as plt
%matplotlib inline
import seaborn as sns

df = sns.load_dataset(&#39;iris&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;scatter-plots&#34;&gt;Scatter Plots&lt;/h2&gt;

&lt;h3 id=&#34;sns-lmplot&#34;&gt;&lt;code&gt;sns.lmplot()&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;This is in fact a scatter plot function, we just have to turn of the regression fit.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;sns.lmplot(x = &#39;petal_length&#39;, y = &#39;petal_width&#39;, data = df
           , hue = &#39;species&#39;
           , fit_reg = False)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;seaborn.axisgrid.FacetGrid at 0x1fbd57e16a0&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_3_1.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h3 id=&#34;compare-to-matplotlib-method-plt-scatter&#34;&gt;Compare to &lt;code&gt;matplotlib&lt;/code&gt; method &lt;code&gt;plt.scatter()&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;is a lot more complicated, we have to add each species manually to an axes supplot object. This is very inconvenient.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;# old school
ax = df.loc[ df[&#39;species&#39;] == &#39;setosa&#39;, : ].plot.scatter(&#39;petal_length&#39;, &#39;petal_width&#39;, label = &#39;setosa&#39;, color = &#39;blue&#39;)

# functional indexing
ax = df.query(&#39;species == &amp;quot;versicolor&amp;quot;&#39;) \
    .plot.scatter( &#39;petal_length&#39;, &#39;petal_width&#39;
                  , label = &#39;versicolor&#39;
                  , color = &#39;orange&#39; 
                  , ax = ax )
    
ax = df.query(&#39;species == &amp;quot;virginica&amp;quot;&#39;) \
    .plot.scatter( &#39;petal_length&#39;, &#39;petal_width&#39;
                  , label = &#39;virginica&#39;
                  , color = &#39;green&#39; 
                  , ax = ax )
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_5_0.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h2 id=&#34;boxplots&#34;&gt;Boxplots&lt;/h2&gt;

&lt;h3 id=&#34;from-wide-format&#34;&gt;From wide format&lt;/h3&gt;

&lt;p&gt;here we cannot use hue to assign groups to colors&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;sns.boxplot(data=df)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;matplotlib.axes._subplots.AxesSubplot at 0x1fbd0345b00&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_7_1.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h3 id=&#34;from-short-format&#34;&gt;From short format&lt;/h3&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df_melt = df.melt(value_vars=[&#39;sepal_length&#39;, &#39;sepal_width&#39;, &#39;petal_length&#39;, &#39;petal_width&#39;]
                 , id_vars = &#39;species&#39;)


sns.boxplot(&#39;variable&#39;, &#39;value&#39;, data = df_melt, hue = &#39;species&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;matplotlib.axes._subplots.AxesSubplot at 0x1fbd4e51b00&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_9_1.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h2 id=&#34;overlay-plots&#34;&gt;Overlay Plots&lt;/h2&gt;

&lt;p&gt;We can easily overlay plots as follows. The problem is that nevertheless the plot order is a bot messed up and there is no option to change the color of the box outline to black. Probably in order to fix this we would need to iterate over the box outlines and set their color attribute to &amp;lsquo;black&amp;rsquo; which is a bit of a pain in the ass.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;sns.violinplot(&#39;variable&#39;, &#39;value&#39;, data = df_melt
               , hue = &#39;species&#39;
               , inner = None ## removes inner boxes
               , zorder = 1
              )

sns.boxplot(&#39;variable&#39;, &#39;value&#39;, data = df_melt
            , hue = &#39;species&#39;
            , palette = [&#39;#FFFFFF&#39;,&#39;#FFFFFF&#39;,&#39;#FFFFFF&#39;]
            , saturation = 1
            , zorder = -1 ## send boxplot to background
           )
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;matplotlib.axes._subplots.AxesSubplot at 0x1fbd4fcb588&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_11_1.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h2 id=&#34;factor-plots-facetting&#34;&gt;Factor Plots (facetting)&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;ax = sns.factorplot(&#39;variable&#39;, &#39;value&#39;, data = df_melt
              , hue = &#39;species&#39;
              , col = &#39;species&#39;
              , kind = &#39;box&#39; )

ax.set_xticklabels(rotation = -45)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;seaborn.axisgrid.FacetGrid at 0x1fbce3f4eb8&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_13_1.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h2 id=&#34;customize-plots-with-matplotlib&#34;&gt;Customize Plots with &lt;code&gt;matplotlib&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;All seaborn plots can be tweaked and edited using &lt;code&gt;matplolib&lt;/code&gt;, for example we can add a title and limit the range of the x-axis.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;sns.lmplot(x = &#39;petal_length&#39;, y = &#39;petal_width&#39;, data = df
           , hue = &#39;species&#39;
           , fit_reg = False)

plt.xlim(0,5)
plt.title(&#39;Look at my custom plot&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;Text(0.5,1,&#39;Look at my custom plot&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_15_1.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;p&gt;We can also fix the overlay plot from before&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;# instantiate axis and figure
fig, ax = plt.subplots()

ax = sns.violinplot(&#39;variable&#39;, &#39;value&#39;, data = df_melt
               , hue = &#39;species&#39;
               , inner = None ## removes inner boxes
               , ax = ax
               , legend_out = True
              )

ax = sns.boxplot(&#39;variable&#39;, &#39;value&#39;, data = df_melt
            , hue = &#39;species&#39;
            , palette = [&#39;#FFFFFF&#39;,&#39;#FFFFFF&#39;,&#39;#FFFFFF&#39;]
            , saturation = 1
            , ax = ax
           )

# the boxes are drawn onto the axis as artist objects
for artist in ax.artists:
    artist.set_edgecolor(&#39;black&#39;)
    artist.set_zorder(1)
    
# the caps and whiskers as line objects
for line in ax.lines:
    line.set_color(&#39;black&#39;)

# get legend handles and labels before drawing legend
# use only 3 of them for legend
handles, labels = ax.get_legend_handles_labels()
plt.legend(handles[0:3], labels[0:3]
          , bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;matplotlib.legend.Legend at 0x1fbd5510ba8&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_17_1.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h2 id=&#34;multiple-plots&#34;&gt;Multiple Plots&lt;/h2&gt;

&lt;p&gt;Having multiple plot as output from one code chunk in markdown is a bit tricky, in jupyter notebooks it is not.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;sns.violinplot(&#39;variable&#39;, &#39;value&#39;, data = df_melt
               , hue = &#39;species&#39;
               , inner = None ## removes inner boxes
              )
plt.show()

sns.boxplot(&#39;variable&#39;, &#39;value&#39;, data = df_melt
            , hue = &#39;species&#39;
            , saturation = 1
           )

plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_19_0.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;img src=&#34;output_19_1.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h1 id=&#34;summary&#34;&gt;Summary&lt;/h1&gt;

&lt;p&gt;Personally I find pure matplotlib very cumbersome. However &lt;code&gt;seaborn&lt;/code&gt; provides some nice defaults and supports the long data format. However if you want to plot something a bit more complicated then their showcase examples you get stuck tweaking the plots in &lt;code&gt;matplotlib&lt;/code&gt;. There is a python version of the &lt;code&gt;ggplot&lt;/code&gt; which I hear is quite popular and a newr package called &lt;code&gt;altair&lt;/code&gt; which is also meant to work on long format. However there does not seem anything in the &lt;code&gt;python&lt;/code&gt; world that beats pure &lt;code&gt;ggplot2&lt;/code&gt;. I will rather keep using the original, in a later post I will show you how you can mix up &lt;code&gt;R&lt;/code&gt; and &lt;code&gt;python&lt;/code&gt; code in a single jupyter notebook and how to pass variables between the two environments.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Moving from R to python - 2/7 - pandas</title>
      <link>https://www.datisticsblog.com/2018/08/r2py_pandas/</link>
      <pubDate>Wed, 22 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/08/r2py_pandas/</guid>
      <description>




&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;../../../r2py.png&#34; style=&#34;width: 180px;height: 180px;&#34;&gt;
  
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_ide/&#34;&gt;1 of 7: IDE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_pandas/&#34;&gt;2 of 7: pandas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_matplotlib_seaborn/&#34;&gt;3 of 7: matplotlib and seaborn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_plotly/&#34;&gt;4 of 7: plotly&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn/&#34;&gt;5 of 7: scikitlearn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn_advanced/&#34;&gt;6 of 7: advanced scikitlearn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_automated_ml/&#34;&gt;7 of 7: automated machine learning&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- toc --&gt;

&lt;h1 id=&#34;pandas-vs-tidyverse&#34;&gt;&lt;code&gt;pandas&lt;/code&gt; vs. tidyverse&lt;/h1&gt;

&lt;p&gt;In base &lt;code&gt;R&lt;/code&gt; matrices and dataframes have row name indexes which in my opinion are a bit annoying, because they add another layer of complexity to your data transformation. You naturally have to keep your column names in order and they sort of make you care about maintain sensible row names as well. So in the tidyverse row names have been declared a deprecated feature.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;pandas&lt;/code&gt; on the other hand indexing is brought to another level and they let you have multiple layers of row and column indexes. As far as I can tell most data reshaping methods such as &lt;code&gt;melt()&lt;/code&gt;, &lt;code&gt;stack()&lt;/code&gt;, &lt;code&gt;unstack()&lt;/code&gt; and &lt;code&gt;pivot()&lt;/code&gt; expect that you assign a unique index to each row.&lt;/p&gt;

&lt;p&gt;The advantage of multi indexing is apparently that it is easier to dice your data when you have more than 2 dimensions in you dataframe. However, I have been using &lt;code&gt;R&lt;/code&gt; for almost two years now and never needed more than 2 dimensions in my dataframe.&lt;/p&gt;

&lt;p&gt;Talking to data scientists that are well-experienced with &lt;code&gt;pandas&lt;/code&gt; I learned that hardly no-one seems to be using multi-indexes.&lt;/p&gt;

&lt;p&gt;The tidyverse is all about functional programming, pandas not so much. Nevertheless there are some possibilities which I will get into in this post.&lt;/p&gt;

&lt;h1 id=&#34;pandas-documentation&#34;&gt;pandas documentation&lt;/h1&gt;

&lt;p&gt;There is a comparison of the &lt;code&gt;pandas&lt;/code&gt; and the &lt;code&gt;R&lt;/code&gt; synthax in the &lt;code&gt;pandas&lt;/code&gt; &lt;a href=&#34;https://pandas.pydata.org/pandas-docs/stable/comparison_with_r.html&#34;&gt;documentation&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&#34;sample-data&#34;&gt;Sample Data&lt;/h1&gt;

&lt;p&gt;When looking at &lt;code&gt;pandas&lt;/code&gt; example code. The example usually starts by generating a dtaframe with random values sampled from a normal distribution. Coming from &lt;code&gt;R&lt;/code&gt; I am used to use acutal sample data like the iris data set which are part of base &lt;code&gt;R&lt;/code&gt;. We can use &lt;code&gt;pydataset&lt;/code&gt; to get similar sample data sets in &lt;code&gt;python&lt;/code&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;import seaborn as sns
import pandas as pd
import numpy as np

df = sns.load_dataset(&#39;iris&#39;)

print( df.head() )
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;   sepal_length  sepal_width  petal_length  petal_width species
0           5.1          3.5           1.4          0.2  setosa
1           4.9          3.0           1.4          0.2  setosa
2           4.7          3.2           1.3          0.2  setosa
3           4.6          3.1           1.5          0.2  setosa
4           5.0          3.6           1.4          0.2  setosa
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&#34;indexing&#34;&gt;Indexing&lt;/h1&gt;

&lt;p&gt;We have a numerical row index and the categorical variable Species with three unique values. In &lt;code&gt;R&lt;/code&gt; we would convert this to a factor variable and there is something similar in &lt;code&gt;python&lt;/code&gt; but it does not seem to be very pythonic to me.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df.index
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;RangeIndex(start=0, stop=150, step=1)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df.species.unique()
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;array([&#39;setosa&#39;, &#39;versicolor&#39;, &#39;virginica&#39;], dtype=object)
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Let&amp;rsquo;s move Species to the index&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df.set_index(&#39;species&#39;
             , inplace = True ## modifies existing object
             , append = True ## keeps exisiting index
             )

df.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;sepal_length&lt;/th&gt;
      &lt;th&gt;sepal_width&lt;/th&gt;
      &lt;th&gt;petal_length&lt;/th&gt;
      &lt;th&gt;petal_width&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;5.1&lt;/td&gt;
      &lt;td&gt;3.5&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;4.9&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;4.7&lt;/td&gt;
      &lt;td&gt;3.2&lt;/td&gt;
      &lt;td&gt;1.3&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;4.6&lt;/td&gt;
      &lt;td&gt;3.1&lt;/td&gt;
      &lt;td&gt;1.5&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;5.0&lt;/td&gt;
      &lt;td&gt;3.6&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;Let&amp;rsquo;s move Species back to the columns&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df.reset_index( inplace = True
               , level = &#39;species&#39; ## only reset Species
              )

df.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;sepal_length&lt;/th&gt;
      &lt;th&gt;sepal_width&lt;/th&gt;
      &lt;th&gt;petal_length&lt;/th&gt;
      &lt;th&gt;petal_width&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;5.1&lt;/td&gt;
      &lt;td&gt;3.5&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.9&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.7&lt;/td&gt;
      &lt;td&gt;3.2&lt;/td&gt;
      &lt;td&gt;1.3&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.6&lt;/td&gt;
      &lt;td&gt;3.1&lt;/td&gt;
      &lt;td&gt;1.5&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;5.0&lt;/td&gt;
      &lt;td&gt;3.6&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h1 id=&#34;reshape-data&#34;&gt;Reshape Data&lt;/h1&gt;

&lt;h2 id=&#34;stack-and-unstack&#34;&gt;&lt;code&gt;stack()&lt;/code&gt; and &lt;code&gt;unstack()&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;Once we set the index we can bring the dataframe from long to wide format&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df.set_index(&#39;species&#39;
             , inplace = True ## modifies existing object
             , append = True ## keeps exisiting index
             )

df_short = df.stack()  

df_short.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;   species              
0  setosa   sepal_length    5.1
            sepal_width     3.5
            petal_length    1.4
            petal_width     0.2
1  setosa   sepal_length    4.9
dtype: float64
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df_long = df_short.unstack()

df_long.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;sepal_length&lt;/th&gt;
      &lt;th&gt;sepal_width&lt;/th&gt;
      &lt;th&gt;petal_length&lt;/th&gt;
      &lt;th&gt;petal_width&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;5.1&lt;/td&gt;
      &lt;td&gt;3.5&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;4.9&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;4.7&lt;/td&gt;
      &lt;td&gt;3.2&lt;/td&gt;
      &lt;td&gt;1.3&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;4.6&lt;/td&gt;
      &lt;td&gt;3.1&lt;/td&gt;
      &lt;td&gt;1.5&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;5.0&lt;/td&gt;
      &lt;td&gt;3.6&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&#34;melt-and-pivot-table&#34;&gt;&lt;code&gt;melt()&lt;/code&gt; and &lt;code&gt;pivot_table()&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;We can use &lt;code&gt;melt()&lt;/code&gt; to select which columns we want to move into the long format. However, in the case of our dataset without an ID column we loose the information which value belongs to which row or individual plant.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df.reset_index( inplace = True
              , level = &#39;species&#39;) 

df_melt = df.melt( id_vars = &#39;species&#39; )

df_melt.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;variable&lt;/th&gt;
      &lt;th&gt;value&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;sepal_length&lt;/td&gt;
      &lt;td&gt;5.1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;sepal_length&lt;/td&gt;
      &lt;td&gt;4.9&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;sepal_length&lt;/td&gt;
      &lt;td&gt;4.7&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;sepal_length&lt;/td&gt;
      &lt;td&gt;4.6&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;sepal_length&lt;/td&gt;
      &lt;td&gt;5.0&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df[&#39;ID&#39;] = list( range( len(df) ) )

df.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;sepal_length&lt;/th&gt;
      &lt;th&gt;sepal_width&lt;/th&gt;
      &lt;th&gt;petal_length&lt;/th&gt;
      &lt;th&gt;petal_width&lt;/th&gt;
      &lt;th&gt;ID&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;5.1&lt;/td&gt;
      &lt;td&gt;3.5&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.9&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.7&lt;/td&gt;
      &lt;td&gt;3.2&lt;/td&gt;
      &lt;td&gt;1.3&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.6&lt;/td&gt;
      &lt;td&gt;3.1&lt;/td&gt;
      &lt;td&gt;1.5&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;5.0&lt;/td&gt;
      &lt;td&gt;3.6&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df_melt = df.melt( id_vars = [&#39;ID&#39;, &#39;species&#39;] )

df_melt.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;ID&lt;/th&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;variable&lt;/th&gt;
      &lt;th&gt;value&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;sepal_length&lt;/td&gt;
      &lt;td&gt;5.1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;sepal_length&lt;/td&gt;
      &lt;td&gt;4.9&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;sepal_length&lt;/td&gt;
      &lt;td&gt;4.7&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;sepal_length&lt;/td&gt;
      &lt;td&gt;4.6&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;sepal_length&lt;/td&gt;
      &lt;td&gt;5.0&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df_pivot_table = df_melt.pivot_table(columns=&#39;variable&#39;
                                        , values =&#39;value&#39;
                                        , index = [ &#39;ID&#39;, &#39;species&#39;]
                                        )

df_pivot_table.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;variable&lt;/th&gt;
      &lt;th&gt;petal_length&lt;/th&gt;
      &lt;th&gt;petal_width&lt;/th&gt;
      &lt;th&gt;sepal_length&lt;/th&gt;
      &lt;th&gt;sepal_width&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;ID&lt;/th&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;5.1&lt;/td&gt;
      &lt;td&gt;3.5&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;4.9&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;1.3&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;4.7&lt;/td&gt;
      &lt;td&gt;3.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;1.5&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;4.6&lt;/td&gt;
      &lt;td&gt;3.1&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;5.0&lt;/td&gt;
      &lt;td&gt;3.6&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h1 id=&#34;functional-programming-with-pandas&#34;&gt;Functional programming with pandas&lt;/h1&gt;

&lt;p&gt;Functional prgramming in &lt;code&gt;R&lt;/code&gt; for me has two main components. That is the pipe &lt;code&gt;%&amp;gt;%&lt;/code&gt; operator that let&amp;rsquo;s you string a number of functions together without having to come up with names for all the intermediate steps and the &lt;code&gt;purrr&lt;/code&gt; package which iterates over columns in a dataframe using them as arguments for a preassigned function whose results are stringed together to form a new column in the same dataframe.&lt;/p&gt;

&lt;p&gt;Functional Programming in &lt;code&gt;python&lt;/code&gt; is  a bit frowned upon and in general it seems to be preferred to build new columns using iterations using for loops. Nevertheless functions like map, filter and apply exist and I find no problem in using them to a similar extend like I would with &lt;code&gt;R&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&#34;dot-and-line-breaks-can-be-used-similar-to-the-r-pipe-operator&#34;&gt;dot &lt;code&gt;.&lt;/code&gt; and line breaks &lt;code&gt;\&lt;/code&gt; can be used similar to the R pipe operator &lt;code&gt;%&amp;gt;%&lt;/code&gt;&lt;/h2&gt;

&lt;p&gt;There are some implementations for pipes in &lt;code&gt;python&lt;/code&gt; but to me they are really ugly because they require you to put the whole pipe sequence in brackets which kind of breaks up the whole &lt;code&gt;python&lt;/code&gt; coding style which usually avoids having to put matching openeing and closing brackets spanning over multiple lines. However using the &lt;code&gt;.&lt;/code&gt; operator and code line breaks &lt;code&gt;\&lt;/code&gt; signifier we can do something very similar to the pipes in &lt;code&gt;R&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Let&amp;rsquo;s string together some commands we find in the &lt;code&gt;pandas&lt;/code&gt; &lt;a href=&#34;https://pandas.pydata.org/pandas-docs/stable/comparison_with_r.html&#34;&gt;documentation R vs dplyr section&lt;/a&gt;.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df_trans = df.loc[ : , [&#39;species&#39;, &#39;sepal_length&#39;, &#39;sepal_width&#39;]] \
    .query(&#39;sepal_length &amp;gt;= 4.7&#39;) \
    .groupby(&#39;species&#39;) \
    .mean() \
    .rename( axis = &#39;columns&#39;
           , mapper = lambda x: &#39;mean_&#39; + x ) \
    .assign( sepal_ratio_of_means = lambda x: x[&#39;mean_sepal_length&#39;] / x[&#39;mean_sepal_width&#39;] )
    
df_trans
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;mean_sepal_length&lt;/th&gt;
      &lt;th&gt;mean_sepal_width&lt;/th&gt;
      &lt;th&gt;sepal_ratio_of_means&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;5.119512&lt;/td&gt;
      &lt;td&gt;3.504878&lt;/td&gt;
      &lt;td&gt;1.460682&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;versicolor&lt;/th&gt;
      &lt;td&gt;5.936000&lt;/td&gt;
      &lt;td&gt;2.770000&lt;/td&gt;
      &lt;td&gt;2.142960&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;virginica&lt;/th&gt;
      &lt;td&gt;6.588000&lt;/td&gt;
      &lt;td&gt;2.974000&lt;/td&gt;
      &lt;td&gt;2.215198&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;p&gt;I think this reads really beautifully much better than the awkward pipe operator in &lt;code&gt;R&lt;/code&gt;. There are some setbacks to this approach though.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;there is no &amp;lsquo;.&amp;rsquo; operator that allows you to reference the piped object from within the pipe&lt;/li&gt;
&lt;li&gt;we have to use the full df[&amp;lsquo;column&amp;rsquo;] reference to call a column vector and cannot use the unquoted column name as in &lt;code&gt;dplyr&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;if we want to reference a column that has only been created inside the pipe we need to use a lambda function to reference it or start a new pipe.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1 id=&#34;using-multiple-columns-to-calculate-a-new-one&#34;&gt;Using multiple columns to calculate a new one&lt;/h1&gt;

&lt;h2 id=&#34;using-vectorized-calculations&#34;&gt;Using vectorized calculations&lt;/h2&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df_trans = df \
    .assign( petal_ratio = df[&#39;petal_width&#39;] / df[&#39;petal_length&#39;]
           , sepal_ratio = df[&#39;sepal_width&#39;] / df[&#39;petal_length&#39;]
           ) \
    .assign( overall_ratio = lambda x: x[&#39;petal_ratio&#39;] / x[&#39;sepal_ratio&#39;] )
    
    
df_trans.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;sepal_length&lt;/th&gt;
      &lt;th&gt;sepal_width&lt;/th&gt;
      &lt;th&gt;petal_length&lt;/th&gt;
      &lt;th&gt;petal_width&lt;/th&gt;
      &lt;th&gt;ID&lt;/th&gt;
      &lt;th&gt;petal_ratio&lt;/th&gt;
      &lt;th&gt;sepal_ratio&lt;/th&gt;
      &lt;th&gt;overall_ratio&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;5.1&lt;/td&gt;
      &lt;td&gt;3.5&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0.142857&lt;/td&gt;
      &lt;td&gt;2.500000&lt;/td&gt;
      &lt;td&gt;0.057143&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.9&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0.142857&lt;/td&gt;
      &lt;td&gt;2.142857&lt;/td&gt;
      &lt;td&gt;0.066667&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.7&lt;/td&gt;
      &lt;td&gt;3.2&lt;/td&gt;
      &lt;td&gt;1.3&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;0.153846&lt;/td&gt;
      &lt;td&gt;2.461538&lt;/td&gt;
      &lt;td&gt;0.062500&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.6&lt;/td&gt;
      &lt;td&gt;3.1&lt;/td&gt;
      &lt;td&gt;1.5&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;0.133333&lt;/td&gt;
      &lt;td&gt;2.066667&lt;/td&gt;
      &lt;td&gt;0.064516&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;5.0&lt;/td&gt;
      &lt;td&gt;3.6&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;0.142857&lt;/td&gt;
      &lt;td&gt;2.571429&lt;/td&gt;
      &lt;td&gt;0.055556&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&#34;using-none-vectorized-calculations&#34;&gt;Using none-vectorized calculations&lt;/h2&gt;

&lt;p&gt;These would be cases in which we would use either &lt;code&gt;map()&lt;/code&gt; or &lt;code&gt;pmap()&lt;/code&gt; from the &lt;code&gt;purrr&lt;/code&gt; package.&lt;/p&gt;

&lt;h3 id=&#34;single-column&#34;&gt;single column&lt;/h3&gt;

&lt;p&gt;We select the Series we want to transform and use the &lt;code&gt;apply()&lt;/code&gt; method.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;def range_sepal_length(x):
    if x &amp;gt; 5:
        return &#39;high&#39;
    elif x &amp;gt; 4.6:
        return &#39;medium&#39;
    else:
        return &#39;low&#39;

df_trans = df \
    .assign( sepal_length_ranges = df[&#39;sepal_length&#39;].apply(range_sepal_length) )
    
df_trans.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;sepal_length&lt;/th&gt;
      &lt;th&gt;sepal_width&lt;/th&gt;
      &lt;th&gt;petal_length&lt;/th&gt;
      &lt;th&gt;petal_width&lt;/th&gt;
      &lt;th&gt;ID&lt;/th&gt;
      &lt;th&gt;sepal_length_ranges&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;5.1&lt;/td&gt;
      &lt;td&gt;3.5&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;high&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.9&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;medium&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.7&lt;/td&gt;
      &lt;td&gt;3.2&lt;/td&gt;
      &lt;td&gt;1.3&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;medium&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.6&lt;/td&gt;
      &lt;td&gt;3.1&lt;/td&gt;
      &lt;td&gt;1.5&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;low&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;5.0&lt;/td&gt;
      &lt;td&gt;3.6&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;medium&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h3 id=&#34;multiple-columns&#34;&gt;multiple columns&lt;/h3&gt;

&lt;p&gt;We select from the dataframe only the columns that we want to use as arguments to our function call. We use &lt;code&gt;apply()&lt;/code&gt; again but this time we change axis to row (axis = 1) which means that it provides all values from a row as arguments to a function call.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df_trans = df \
    .assign( smallest_value = df.loc[:,[&#39;sepal_length&#39;,&#39;sepal_width&#39;,&#39;petal_length&#39;,&#39;petal_width&#39;]]\
                               .apply( min, axis = 1) )
    
df_trans.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;sepal_length&lt;/th&gt;
      &lt;th&gt;sepal_width&lt;/th&gt;
      &lt;th&gt;petal_length&lt;/th&gt;
      &lt;th&gt;petal_width&lt;/th&gt;
      &lt;th&gt;ID&lt;/th&gt;
      &lt;th&gt;smallest_value&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;5.1&lt;/td&gt;
      &lt;td&gt;3.5&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.9&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.7&lt;/td&gt;
      &lt;td&gt;3.2&lt;/td&gt;
      &lt;td&gt;1.3&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.6&lt;/td&gt;
      &lt;td&gt;3.1&lt;/td&gt;
      &lt;td&gt;1.5&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;5.0&lt;/td&gt;
      &lt;td&gt;3.6&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&#34;aggregating-grouping-summarizing&#34;&gt;Aggregating, Grouping, Summarizing&lt;/h2&gt;

&lt;p&gt;One of the most commen things to do when working with tables is grouping and summarizing data. In &lt;code&gt;dplyr&lt;/code&gt; and also in &lt;code&gt;SQL&lt;/code&gt; we define our set of grouping columns and then define a set of new columns that contain aggregates of some of the old columns. There are two ways to do this in &lt;code&gt;pandas&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;use a single window function on all none-grouped dataframe columns (see exapmple above)&lt;/li&gt;
&lt;li&gt;use a set of different window functions on a limited set of columns (one window function per column)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;one-window-function-per-column&#34;&gt;One window function per column&lt;/h3&gt;

&lt;p&gt;We can either change existing column or create new ones which we have to add as empty columns via assign first. We can use whatever window function is implemented in &lt;code&gt;pandas&lt;/code&gt; which we pass as strings in a dictionary or we can write lambda functions.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df_gr = df.loc[ : , [&#39;species&#39;, &#39;sepal_length&#39;, &#39;sepal_width&#39;]]  \
    .assign( set_of_lengths = df[&#39;sepal_length&#39;] ) \
    .groupby(&#39;species&#39;) \
    .aggregate( dict( sepal_length = &#39;mean&#39;
                     , sepal_width = &#39;median&#39;
                     , set_of_lengths = lambda x: set( round(x, 0) ) ) )
    
df_gr
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;sepal_length&lt;/th&gt;
      &lt;th&gt;sepal_width&lt;/th&gt;
      &lt;th&gt;set_of_lengths&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;setosa&lt;/th&gt;
      &lt;td&gt;5.006&lt;/td&gt;
      &lt;td&gt;3.4&lt;/td&gt;
      &lt;td&gt;{4.0, 5.0, 6.0}&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;versicolor&lt;/th&gt;
      &lt;td&gt;5.936&lt;/td&gt;
      &lt;td&gt;2.8&lt;/td&gt;
      &lt;td&gt;{5.0, 6.0, 7.0}&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;virginica&lt;/th&gt;
      &lt;td&gt;6.588&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
      &lt;td&gt;{8.0, 5.0, 6.0, 7.0}&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;div class=&#34;alert warning &#34;&gt;
  &lt;p&gt;Note that the grouping column is automatically moved to the index, we can revert this as follows:&lt;/p&gt;
&lt;/div&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df_gr.reset_index()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;sepal_length&lt;/th&gt;
      &lt;th&gt;sepal_width&lt;/th&gt;
      &lt;th&gt;set_of_lengths&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;5.006&lt;/td&gt;
      &lt;td&gt;3.4&lt;/td&gt;
      &lt;td&gt;{4.0, 5.0, 6.0}&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;versicolor&lt;/td&gt;
      &lt;td&gt;5.936&lt;/td&gt;
      &lt;td&gt;2.8&lt;/td&gt;
      &lt;td&gt;{5.0, 6.0, 7.0}&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;virginica&lt;/td&gt;
      &lt;td&gt;6.588&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
      &lt;td&gt;{8.0, 5.0, 6.0, 7.0}&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h1 id=&#34;other-data-transformation&#34;&gt;Other Data Transformation&lt;/h1&gt;

&lt;p&gt;There is a comparison of the &lt;code&gt;pandas&lt;/code&gt; and the &lt;code&gt;R&lt;/code&gt; synthax in the &lt;code&gt;pandas&lt;/code&gt; &lt;a href=&#34;https://pandas.pydata.org/pandas-docs/stable/comparison_with_r.html&#34;&gt;documentation&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&#34;query&#34;&gt;query()&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;query()&lt;/code&gt; can be used like &lt;code&gt;filter()&lt;/code&gt; in &lt;code&gt;R&lt;/code&gt;. Alternatively we could use boolean indexing but that gets a bit cumbersome if you want to filter on more than one column.&lt;/p&gt;

&lt;p&gt;However the string expression does not tolerate &amp;lsquo;.&amp;rsquo; in the column names thus we replace them before.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;better_columns = df.columns.str.replace(&#39;\.&#39;, &#39;_&#39;)

better_columns

df.columns = better_columns

df.head()

df.query(&#39;petal_width &amp;gt; 0.2 \
          &amp;amp; sepal_length &amp;lt; 5&#39;)
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;sepal_length&lt;/th&gt;
      &lt;th&gt;sepal_width&lt;/th&gt;
      &lt;th&gt;petal_length&lt;/th&gt;
      &lt;th&gt;petal_width&lt;/th&gt;
      &lt;th&gt;ID&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;6&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.6&lt;/td&gt;
      &lt;td&gt;3.4&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.3&lt;/td&gt;
      &lt;td&gt;6&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;41&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.5&lt;/td&gt;
      &lt;td&gt;2.3&lt;/td&gt;
      &lt;td&gt;1.3&lt;/td&gt;
      &lt;td&gt;0.3&lt;/td&gt;
      &lt;td&gt;41&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;45&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.8&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.3&lt;/td&gt;
      &lt;td&gt;45&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;57&lt;/th&gt;
      &lt;td&gt;versicolor&lt;/td&gt;
      &lt;td&gt;4.9&lt;/td&gt;
      &lt;td&gt;2.4&lt;/td&gt;
      &lt;td&gt;3.3&lt;/td&gt;
      &lt;td&gt;1.0&lt;/td&gt;
      &lt;td&gt;57&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;106&lt;/th&gt;
      &lt;td&gt;virginica&lt;/td&gt;
      &lt;td&gt;4.9&lt;/td&gt;
      &lt;td&gt;2.5&lt;/td&gt;
      &lt;td&gt;4.5&lt;/td&gt;
      &lt;td&gt;1.7&lt;/td&gt;
      &lt;td&gt;106&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&#34;transform&#34;&gt;transform()&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;transform&lt;/code&gt; can be used like the &lt;code&gt;group_by()&lt;/code&gt; - &lt;code&gt;mutate()&lt;/code&gt; combination in &lt;code&gt;R&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df = df.assign( max_petal_len_species = lambda x: x.groupby(&#39;species&#39;).transform(&#39;max&#39;)[&#39;petal_length&#39;] )
df.head()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;sepal_length&lt;/th&gt;
      &lt;th&gt;sepal_width&lt;/th&gt;
      &lt;th&gt;petal_length&lt;/th&gt;
      &lt;th&gt;petal_width&lt;/th&gt;
      &lt;th&gt;ID&lt;/th&gt;
      &lt;th&gt;max_petal_len_species&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;5.1&lt;/td&gt;
      &lt;td&gt;3.5&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;0&lt;/td&gt;
      &lt;td&gt;1.9&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.9&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;1.9&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.7&lt;/td&gt;
      &lt;td&gt;3.2&lt;/td&gt;
      &lt;td&gt;1.3&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;1.9&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;4.6&lt;/td&gt;
      &lt;td&gt;3.1&lt;/td&gt;
      &lt;td&gt;1.5&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;1.9&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;setosa&lt;/td&gt;
      &lt;td&gt;5.0&lt;/td&gt;
      &lt;td&gt;3.6&lt;/td&gt;
      &lt;td&gt;1.4&lt;/td&gt;
      &lt;td&gt;0.2&lt;/td&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;1.9&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df.tail()
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;species&lt;/th&gt;
      &lt;th&gt;sepal_length&lt;/th&gt;
      &lt;th&gt;sepal_width&lt;/th&gt;
      &lt;th&gt;petal_length&lt;/th&gt;
      &lt;th&gt;petal_width&lt;/th&gt;
      &lt;th&gt;ID&lt;/th&gt;
      &lt;th&gt;max_petal_len_species&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;145&lt;/th&gt;
      &lt;td&gt;virginica&lt;/td&gt;
      &lt;td&gt;6.7&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
      &lt;td&gt;5.2&lt;/td&gt;
      &lt;td&gt;2.3&lt;/td&gt;
      &lt;td&gt;145&lt;/td&gt;
      &lt;td&gt;6.9&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;146&lt;/th&gt;
      &lt;td&gt;virginica&lt;/td&gt;
      &lt;td&gt;6.3&lt;/td&gt;
      &lt;td&gt;2.5&lt;/td&gt;
      &lt;td&gt;5.0&lt;/td&gt;
      &lt;td&gt;1.9&lt;/td&gt;
      &lt;td&gt;146&lt;/td&gt;
      &lt;td&gt;6.9&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;147&lt;/th&gt;
      &lt;td&gt;virginica&lt;/td&gt;
      &lt;td&gt;6.5&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
      &lt;td&gt;5.2&lt;/td&gt;
      &lt;td&gt;2.0&lt;/td&gt;
      &lt;td&gt;147&lt;/td&gt;
      &lt;td&gt;6.9&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;148&lt;/th&gt;
      &lt;td&gt;virginica&lt;/td&gt;
      &lt;td&gt;6.2&lt;/td&gt;
      &lt;td&gt;3.4&lt;/td&gt;
      &lt;td&gt;5.4&lt;/td&gt;
      &lt;td&gt;2.3&lt;/td&gt;
      &lt;td&gt;148&lt;/td&gt;
      &lt;td&gt;6.9&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;149&lt;/th&gt;
      &lt;td&gt;virginica&lt;/td&gt;
      &lt;td&gt;5.9&lt;/td&gt;
      &lt;td&gt;3.0&lt;/td&gt;
      &lt;td&gt;5.1&lt;/td&gt;
      &lt;td&gt;1.8&lt;/td&gt;
      &lt;td&gt;149&lt;/td&gt;
      &lt;td&gt;6.9&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;h2 id=&#34;reindex&#34;&gt;reindex()&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;reindex()&lt;/code&gt; can be used to mimic the &lt;code&gt;complete()&lt;/code&gt; function in &lt;code&gt;R&lt;/code&gt; which can be used to expose implicitly missing values. We can use &lt;code&gt;reindex&lt;/code&gt; to write a python version of &lt;code&gt;complete()&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;def complete(df, cols):
        
    assert all( [ col in df.columns for col in cols] )

    df = df.set_index( cols, append = False )

    df_reset = df.reset_index()

    for i, name in enumerate(df.index.names):
        
        if i == 0:
            df_cross = pd.DataFrame( { name : df_reset[name].unique() } ) \
                .assign( key = 0 )
                
        else:
            df_cross_name = pd.DataFrame( { name : df_reset[name].unique() } ) \
                .assign( key = 0 )
                
            df_cross = df_cross.merge(df_cross_name, on = &#39;key&#39;)

    df_cross = df_cross.drop(&#39;key&#39;, axis = 1) \
        .set_index( df.index.names )
        
    df = df.reindex( df_cross.index )

    return df
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;df = pd.DataFrame( dict( numbers = [1,1,2,2,3,3,4,5]
                        , letters = [&#39;A&#39;,&#39;B&#39;,&#39;A&#39;,&#39;B&#39;,&#39;A&#39;,&#39;B&#39;,&#39;A&#39;,&#39;B&#39;]) ) \
    .assign( value = np.random.randn(8) )

df
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;numbers&lt;/th&gt;
      &lt;th&gt;letters&lt;/th&gt;
      &lt;th&gt;value&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th&gt;0&lt;/th&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;A&lt;/td&gt;
      &lt;td&gt;-0.866225&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;1&lt;/th&gt;
      &lt;td&gt;1&lt;/td&gt;
      &lt;td&gt;B&lt;/td&gt;
      &lt;td&gt;0.086730&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;2&lt;/th&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;A&lt;/td&gt;
      &lt;td&gt;-1.385008&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;3&lt;/th&gt;
      &lt;td&gt;2&lt;/td&gt;
      &lt;td&gt;B&lt;/td&gt;
      &lt;td&gt;1.729923&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;4&lt;/th&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;A&lt;/td&gt;
      &lt;td&gt;2.299604&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;5&lt;/th&gt;
      &lt;td&gt;3&lt;/td&gt;
      &lt;td&gt;B&lt;/td&gt;
      &lt;td&gt;0.271672&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;6&lt;/th&gt;
      &lt;td&gt;4&lt;/td&gt;
      &lt;td&gt;A&lt;/td&gt;
      &lt;td&gt;0.608976&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;7&lt;/th&gt;
      &lt;td&gt;5&lt;/td&gt;
      &lt;td&gt;B&lt;/td&gt;
      &lt;td&gt;-0.055641&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;complete(df, [&#39;numbers&#39;, &#39;letters&#39;])
&lt;/code&gt;&lt;/pre&gt;

&lt;div&gt;
&lt;style scoped&gt;
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }
    .dataframe tbody tr th {
        vertical-align: top;
    }
    .dataframe thead th {
        text-align: right;
    }
&lt;/style&gt;
&lt;table border=&#34;1&#34; class=&#34;dataframe&#34;&gt;
  &lt;thead&gt;
    &lt;tr style=&#34;text-align: right;&#34;&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
      &lt;th&gt;value&lt;/th&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;numbers&lt;/th&gt;
      &lt;th&gt;letters&lt;/th&gt;
      &lt;th&gt;&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
    &lt;tr&gt;
      &lt;th rowspan=&#34;2&#34; valign=&#34;top&#34;&gt;1&lt;/th&gt;
      &lt;th&gt;A&lt;/th&gt;
      &lt;td&gt;-0.866225&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;B&lt;/th&gt;
      &lt;td&gt;0.086730&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th rowspan=&#34;2&#34; valign=&#34;top&#34;&gt;2&lt;/th&gt;
      &lt;th&gt;A&lt;/th&gt;
      &lt;td&gt;-1.385008&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;B&lt;/th&gt;
      &lt;td&gt;1.729923&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th rowspan=&#34;2&#34; valign=&#34;top&#34;&gt;3&lt;/th&gt;
      &lt;th&gt;A&lt;/th&gt;
      &lt;td&gt;2.299604&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;B&lt;/th&gt;
      &lt;td&gt;0.271672&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th rowspan=&#34;2&#34; valign=&#34;top&#34;&gt;4&lt;/th&gt;
      &lt;th&gt;A&lt;/th&gt;
      &lt;td&gt;0.608976&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;B&lt;/th&gt;
      &lt;td&gt;NaN&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th rowspan=&#34;2&#34; valign=&#34;top&#34;&gt;5&lt;/th&gt;
      &lt;th&gt;A&lt;/th&gt;
      &lt;td&gt;NaN&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;th&gt;B&lt;/th&gt;
      &lt;td&gt;-0.055641&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title>Moving from R to python - 1/7 - IDE</title>
      <link>https://www.datisticsblog.com/2018/08/r2py_ide/</link>
      <pubDate>Tue, 21 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/08/r2py_ide/</guid>
      <description>




&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;../../../r2py.png&#34; style=&#34;width: 180px;height: 180px;&#34;&gt;
  
  
&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_ide/&#34;&gt;1 of 7: IDE&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_pandas/&#34;&gt;2 of 7: pandas&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_matplotlib_seaborn/&#34;&gt;3 of 7: matplotlib and seaborn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_plotly/&#34;&gt;4 of 7: plotly&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn/&#34;&gt;5 of 7: scikitlearn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_scikitlearn_advanced/&#34;&gt;6 of 7: advanced scikitlearn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://www.datisticsblog.com/2018/08/r2py_automated_ml/&#34;&gt;7 of 7: automated machine learning&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;!-- toc --&gt;

&lt;h1 id=&#34;introduction&#34;&gt;Introduction&lt;/h1&gt;

&lt;p&gt;Before I started with &lt;code&gt;R&lt;/code&gt; I used to do quite a lot of &lt;code&gt;python&lt;/code&gt; coding, however back in the days I was still using &lt;code&gt;python 2.7&lt;/code&gt; and was not really using a bona-fide data-centric workflow. In this series of notebooks I would like to document how my best-practices from using &lt;code&gt;R&lt;/code&gt; can be carried over to the &lt;code&gt;python&lt;/code&gt; universe.&lt;/p&gt;

&lt;h1 id=&#34;ide&#34;&gt;IDE&lt;/h1&gt;

&lt;p&gt;&lt;code&gt;R&lt;/code&gt; has with &lt;code&gt;RStudio&lt;/code&gt; one obvious candidate for the best IDE to use with &lt;code&gt;R&lt;/code&gt;. It has been developed just like &lt;code&gt;R&lt;/code&gt; especially for maintaining a data-centric workflow. We have&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;plotting&lt;/li&gt;
&lt;li&gt;interactive variable exploration&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git&lt;/code&gt; integration&lt;/li&gt;
&lt;li&gt;code completion&lt;/li&gt;
&lt;li&gt;code documentation&lt;/li&gt;
&lt;li&gt;package building&lt;/li&gt;
&lt;li&gt;unit testing&lt;/li&gt;
&lt;li&gt;markdown support&lt;/li&gt;
&lt;li&gt;package and reproducibility management&lt;/li&gt;
&lt;li&gt;execution of &lt;code&gt;python&lt;/code&gt; code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;python&lt;/code&gt; on the other hand has not been primarily developed for data science applications but has some great add-onn packages that can be used for scientific computation. There are a couple of &lt;code&gt;python&lt;/code&gt; IDE that mimick the &lt;code&gt;RStudio&lt;/code&gt; or the &lt;code&gt;Matlab&lt;/code&gt; interface such as &lt;code&gt;spyder&lt;/code&gt; and &lt;code&gt;rodeo&lt;/code&gt; they support plotting and interactive variable exploration and have great code completion but they lack &lt;code&gt;git&lt;/code&gt; and markdown support. The multi-purpose IDE &lt;code&gt;pycharm&lt;/code&gt; however seems to support also the other features that &lt;code&gt;RStudio&lt;/code&gt; is capable of. The professional version offers a &lt;code&gt;scientific mode&lt;/code&gt; that also mimicks the &lt;code&gt;RStudio&lt;/code&gt;interface to some degree and that provides a decent project structure.&lt;/p&gt;

&lt;p&gt;Here we will walk through the features mentioned above and see how they are implemented in &lt;code&gt;pycharm&lt;/code&gt;&lt;/p&gt;

&lt;h2 id=&#34;ploting-and-interactive-variable-exploration&#34;&gt;Ploting and interactive variable exploration&lt;/h2&gt;

&lt;p&gt;This requirement is fullfilled by all IDEs.&lt;/p&gt;

&lt;h2 id=&#34;git-integration&#34;&gt;&lt;code&gt;git&lt;/code&gt; integration&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;git&lt;/code&gt; integration is pretty straight forward with more options than in RStudio&lt;/p&gt;

&lt;h2 id=&#34;code-completion&#34;&gt;Code Completion&lt;/h2&gt;

&lt;p&gt;Code completion in &lt;code&gt;RStudio&lt;/code&gt; is pretty straight forward if you press &lt;kbd&gt;Tab&lt;/kbd&gt; your namespace is sensibly searched for variables and functions that you might be typing. When you are typing a function it automatically displays the function documentation and which parameters the function is accepting. When you are defining the parameters of a function and you hit &lt;kbd&gt;Tab&lt;/kbd&gt; &lt;code&gt;RStudio&lt;/code&gt; will show you a list of all parameters of the function that you have not defined yet. You can then select the parameter from the list  In &lt;code&gt;python&lt;/code&gt; code completion is done by packages like &lt;code&gt;jedi&lt;/code&gt; which seems to be what all the IDEs are using however code completion feels a bit different. &lt;code&gt;spyder&lt;/code&gt;&amp;rsquo;s code completion looks and works exactly like the one of &lt;code&gt;RStdio&lt;/code&gt;. &lt;code&gt;pycharm&lt;/code&gt; has code completion but it tends to be cluttered with irrelevant object and method names when it does not find anything in the local namespace. In order to get the parameters of the function we also have to use an additional shortcut &lt;kbd&gt;Ctrl&lt;/kbd&gt; + &lt;kbd&gt;P&lt;/kbd&gt; (on windows). This only displays the parameter but we cannot select anything and thus have to type it ourselves.&lt;/p&gt;

&lt;h2 id=&#34;code-documentation&#34;&gt;Code Documentation&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;R&lt;/code&gt; we can only document functions properly when writing a package using &lt;code&gt;roxygen2&lt;/code&gt; comments. We can call the documentation of a function using &lt;code&gt;?&lt;/code&gt; for example: &lt;code&gt;?myfunction()&lt;/code&gt;. This will display nicely as &lt;code&gt;html&lt;/code&gt; in an additional viewer window. In order to generate consistent &lt;code&gt;roxygen2&lt;/code&gt; comments we can use the &lt;code&gt;sinew&lt;/code&gt; package which will generate a sensible template from a finished function. Code examples can be copy pasted into the console or can be called via &lt;code&gt;example()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In python we can use &lt;code&gt;help(myfunction)&lt;/code&gt; or &lt;code&gt;my_function.__doc__&lt;/code&gt; to call the docstring associated with a function as console output.  In &lt;code&gt;pycharm&lt;/code&gt; we can place the caret inside the name of any function and press &lt;kbd&gt;ctrl&lt;/kbd&gt; + &lt;kbd&gt;Q&lt;/kbd&gt; in order to obtain a more well formated pop-up window containing the docstring.&lt;/p&gt;

&lt;p&gt;The docstring in &lt;code&gt;python&lt;/code&gt; can be written for any function and also makes sense outside of package writing. In &lt;code&gt;pycharm&lt;/code&gt; we can insert a docstring template in any definition of a function by placing the caret in the function name of the definition and hit &lt;kbd&gt;alt&lt;/kbd&gt; + &lt;kbd&gt;enter&lt;/kbd&gt; to get to a menu in which one option is to insert a docstring template based on the parameters of the function.&lt;/p&gt;

&lt;p&gt;There is a google style sheet for writing docstrings. &lt;a href=&#34;http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html&#34;&gt;link&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example code in the docstring should be started with &lt;code&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/code&gt; and the line below should reflect the return value&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
&amp;gt;&amp;gt;&amp;gt;&amp;gt; len(&#39;foo&#39;)
3
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Those examples can be run as unit tests by packages such as &lt;code&gt;doctest&lt;/code&gt;, &lt;code&gt;nose&lt;/code&gt; or &lt;code&gt;unittests&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href=&#34;https://www.pluralsight.com/guides/python/how-to-write-effective-docstrings&#34;&gt;see this blogpost&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&#34;package-building&#34;&gt;Package Building&lt;/h2&gt;

&lt;p&gt;package building and installation is very well integrated in &lt;code&gt;RStudio&lt;/code&gt;, there is a steep learning curve but we can compile doumentation run tests and check all from within &lt;code&gt;Rstudio&lt;/code&gt; and we have several option to create &lt;code&gt;latex&lt;/code&gt;,&lt;code&gt;pdf&lt;/code&gt; or &lt;code&gt;html&lt;/code&gt; documentation.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;python&lt;/code&gt; package building seems to be pretty straight forward. you basically just need a &lt;code&gt;__init__.py&lt;/code&gt; file in your directory and you have a package.&lt;/p&gt;

&lt;p&gt;But there are some standards and nomenclature best practices that are described &lt;a href=&#34;https://python-packaging.readthedocs.io/en/latest/minimal.html&#34;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&#34;unit-testing&#34;&gt;Unit Testing&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;R&lt;/code&gt; we use &lt;code&gt;testthat&lt;/code&gt; and the integrated &lt;code&gt;RStudio&lt;/code&gt; build tools to write and execute unit tests. In &lt;code&gt;python&lt;/code&gt; the standard package seems to be &lt;code&gt;unittest&lt;/code&gt; while there are a number of different packages for unit testing with a simpler synthax such as &lt;code&gt;py.test&lt;/code&gt;. As already mentioned &lt;code&gt;doctest&lt;/code&gt; will run python examples in your docstring.&lt;/p&gt;

&lt;p&gt;See this &lt;a href=&#34;http://docs.python-guide.org/en/latest/writing/tests/&#34;&gt;blogpost&lt;/a&gt; for more information.&lt;/p&gt;

&lt;h2 id=&#34;package-management-and-code-reproducibility&#34;&gt;Package Management and Code Reproducibility&lt;/h2&gt;

&lt;p&gt;Code reproducibililty and portability is a big issue in &lt;code&gt;R&lt;/code&gt; since there are so many packages that are constantly updated it is hard to track the dependencies for a specific analysis. &lt;code&gt;Rstudio&lt;/code&gt; relies on &lt;code&gt;packrat&lt;/code&gt; to ensure reproducibilty by saving all packages with each analysis or project which greatly increases the diskspace needed for a project. To tackle this I have actually written a package called (&lt;code&gt;updateR&lt;/code&gt;)[&lt;a href=&#34;https://github.com/erblast/updateR&#34;&gt;https://github.com/erblast/updateR&lt;/a&gt;] resorting to a workflow where I archive &lt;code&gt;R&lt;/code&gt; and all packages installed at this timepoint 4 times a year.&lt;/p&gt;

&lt;p&gt;In &lt;code&gt;python&lt;/code&gt; we seem to have different options. We can use &lt;code&gt;pip freeze&lt;/code&gt; to create a &lt;code&gt;requirements.txt&lt;/code&gt; file. We can use an &lt;code&gt;anaconda&lt;/code&gt; environment which we can share with our analyis or we can use &lt;code&gt;docker&lt;/code&gt;. All three options seem to be well supported by &lt;code&gt;pycharm&lt;/code&gt;.&lt;/p&gt;

&lt;h2 id=&#34;markdown-support&#34;&gt;Markdown Support&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;RStudio&lt;/code&gt; and markdown go hand in hand. &lt;code&gt;.Rmd&lt;/code&gt; are similar to &lt;code&gt;.md&lt;/code&gt; files and can contain executable code chunks in either &lt;code&gt;R&lt;/code&gt; or &lt;code&gt;python&lt;/code&gt; and can be rendered into numereous formats such as word, slides, dashboards, &lt;code&gt;html&lt;/code&gt;, ebooks, &lt;code&gt;pdf&lt;/code&gt; and blogposts. &lt;code&gt;.Rmd&lt;/code&gt; files are simple text files that contain a &lt;code&gt;YAML&lt;/code&gt; header that defines the rendering options. &lt;code&gt;RStudio&lt;/code&gt; even supports
one click publishing of &lt;code&gt;html&lt;/code&gt; content to &lt;code&gt;Rpubs&lt;/code&gt; a publication platform for &lt;code&gt;R&lt;/code&gt; code.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;python&lt;/code&gt; equivalent is &lt;code&gt;jupyter notebook&lt;/code&gt; which uses the &lt;code&gt;.ipynb&lt;/code&gt; format which is basically a &lt;code&gt;json&lt;/code&gt; file. The &lt;code&gt;json&lt;/code&gt; format does not easily display in a text editor so we always have to use an IDE of some sort to edit those files. The best method is to start a &lt;code&gt;jupyter notebook&lt;/code&gt; kernel from the command line and connect to it via a web browser. This starts an easy to use webinterface that allows for editing &lt;code&gt;.ipynb&lt;/code&gt; files and feels a bit like a &lt;code&gt;.Rmd&lt;/code&gt; editing in &lt;code&gt;RStudio&lt;/code&gt;. We have different cells and we can define the content of this cell as either being markdown or code of a variety of languages and we can see the output of the code being console output or a plot right below the cells. Pretty much the same as it is with &lt;code&gt;RStudio&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The difference is in the file format, the &lt;code&gt;Rmd&lt;/code&gt; format does not save any code output inside the file while &lt;code&gt;.ipynb&lt;/code&gt; even stores binary information inside the document. This makes the changes in &lt;code&gt;.ipynb&lt;/code&gt; files difficult to track for &lt;code&gt;git&lt;/code&gt; and practically disqualifies them from being part of an entire analysis or deployment process. We can use &lt;code&gt;Rmd&lt;/code&gt; files as actual bulding blocks of an entire analysis for which we can have &lt;code&gt;html&lt;/code&gt; reporting for each steps that can be legible to none-coders. The use-case for &lt;code&gt;jupyter notebook&lt;/code&gt; seems to be documentation of data exploration, tutorials or proof of concepts.&lt;/p&gt;

&lt;p&gt;As far as I can tell we can edit &lt;code&gt;.ipynb&lt;/code&gt; files inside &lt;code&gt;pycharm&lt;/code&gt; but I had difficulties saving the changes that I had made to the notebooks and ended up loosing a lot of work. It seems as if in &lt;code&gt;pycharm&lt;/code&gt; we need at least one code cell to save the file. I am more comfortable now working with the &lt;code&gt;jupyter notebook&lt;/code&gt; webinterface.&lt;/p&gt;

&lt;h2 id=&#34;execution-of-foreign-code&#34;&gt;Execution of foreign code&lt;/h2&gt;

&lt;p&gt;In &lt;code&gt;RStudio&lt;/code&gt; we can use the &lt;code&gt;reticulate&lt;/code&gt; package to execute &lt;code&gt;python&lt;/code&gt; code and to convert &lt;code&gt;python&lt;/code&gt; into &lt;code&gt;R&lt;/code&gt; objects. We can also define &lt;code&gt;python&lt;/code&gt; chunks inside &lt;code&gt;Rmd&lt;/code&gt; documents. However we can only get &lt;code&gt;python&lt;/code&gt; code completion or interactive variable exploration when we convert the &lt;code&gt;python&lt;/code&gt; objects to &lt;code&gt;R&lt;/code&gt; objects.&lt;/p&gt;

&lt;p&gt;Both &lt;code&gt;pycharm&lt;/code&gt; and &lt;code&gt;jupyter notebook&lt;/code&gt; support R. We can probably use &lt;code&gt;feather&lt;/code&gt; to pass dataframes between &lt;code&gt;R&lt;/code&gt; and &lt;code&gt;python&lt;/code&gt;.&lt;/p&gt;
</description>
    </item>
    
    <item>
      <title>Use jupyter notebooks to add posts to hugo blog</title>
      <link>https://www.datisticsblog.com/2018/08/post_with_jupyter/</link>
      <pubDate>Sat, 11 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/08/post_with_jupyter/</guid>
      <description>




&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;https://gitlab.eurecom.fr/zoe-apps/pytorch/avatar&#34; style=&#34;width: 180px;height: 180px;&#34;&gt;
  
  
&lt;/div&gt;


&lt;!-- toc --&gt;

&lt;div class=&#34;alert warning &#34;&gt;
  &lt;p&gt;&lt;p&gt;The file paths mentioned in this post only apply when the following configuration is set in your &amp;lsquo;.toml&amp;rsquo; file:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
[permalinks]
    post = &amp;quot;/:year/:month/:slug/&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;/p&gt;
&lt;/div&gt;

&lt;h1 id=&#34;hugo-jupyter&#34;&gt;hugo_jupyter&lt;/h1&gt;

&lt;p&gt;Starting this blog with &lt;code&gt;blogdown&lt;/code&gt; and &lt;code&gt;RStudio&lt;/code&gt; was pretty straight forward. I did not need to learn much about &lt;code&gt;hugo&lt;/code&gt; which is the static website generator that I used and the project is well-documented. However I would also like to add posts from &lt;code&gt;juypter notebooks&lt;/code&gt; which seems to be possible but let&amp;rsquo;s say less accessible. The tool I tried is &lt;a href=&#34;https://github.com/knowsuchagency/hugo_jupyter&#34;&gt;&lt;code&gt;hugo_jupyter&lt;/code&gt;&lt;/a&gt; which is supposed to work similar to &lt;code&gt;blogdown&lt;/code&gt;. It runs a local server of the website which automatically rerenders the site if changes are made in relevant folders. The same can also be achieved if executing this simple hugo command inside the parent folder of your site (You have to open your browser and copy paste the displayed local host address though).&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
hugo server
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;code&gt;hugo_jupyter&lt;/code&gt; will additionally watch a &lt;code&gt;./notebooks&lt;/code&gt; for changes in any jupyter notebooks it contains and convert them into &lt;code&gt;.md&lt;/code&gt; to &lt;code&gt;./content/posts&lt;/code&gt;. For this you have to manually add the &lt;code&gt;front-matter&lt;/code&gt; parameters title, date, slug, subtitle to the json metadata of your notebook using the jupyter GUI. Any other parameter that you add will not be passed to the &lt;code&gt;.md&lt;/code&gt; file of your post. Any graphical output produced by any of your cells will be dropped and replaced by a link in the markdown format &lt;code&gt;![image_description](image_path)&lt;/code&gt;. Then &lt;code&gt;hugo&lt;/code&gt; will render your &lt;code&gt;.md&lt;/code&gt; to &lt;code&gt;.html&lt;/code&gt; automatically adding to the image path it finds in the markdown synthax like this &lt;code&gt;yyyy/mm/slug/image_path&lt;/code&gt;. In order for this link to work we would need to place the image in &lt;code&gt;./static/yyyy/mm/slug&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;All in all this would require a lot of manual steps after conversion of the notebook to &lt;code&gt;.md&lt;/code&gt; format that I decided to only use the code of &lt;code&gt;hugo_jupyter&lt;/code&gt; that converts the notebook to &lt;code&gt;.md&lt;/code&gt; and make some changes to it so it also extracts images and places them in the appropriate &lt;code&gt;./static/yyyy/mm/slug&lt;/code&gt; path.&lt;/p&gt;

&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th align=&#34;center&#34;&gt;blogdown&lt;/th&gt;
&lt;th align=&#34;center&#34;&gt;hugo_jupyter&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;

&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;serve locally&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;yes&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;yes&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;encode front-matter parameters&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;yes&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;only 4&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;render graphical code output&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;yes&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;no&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;shortcode&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;as function&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;yes&lt;/td&gt;
&lt;/tr&gt;

&lt;tr&gt;
&lt;td&gt;markdown support&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;pandoc&lt;/td&gt;
&lt;td align=&#34;center&#34;&gt;hugo&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;

&lt;p&gt;(table generated with &lt;a href=&#34;https://www.tablesgenerator.com/&#34;&gt;https://www.tablesgenerator.com/&lt;/a&gt;)&lt;/p&gt;

&lt;h1 id=&#34;modified-workflow&#34;&gt;Modified workflow&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;I use the &lt;code&gt;hugo server&lt;/code&gt; command in the terminal&lt;/li&gt;
&lt;li&gt;I added a &lt;code&gt;.python&lt;/code&gt; folder with the render_notebooks.py file that contains the code added below which I modified from &lt;code&gt;hugo_jupyter&lt;/code&gt; to (i) render all output plots and put the &lt;code&gt;.png&lt;/code&gt; files in the appropriate paths and (ii) add front-matter parameters by passing them as kwargs to the render function.&lt;/li&gt;
&lt;li&gt;I can view all changes on my localhost server.&lt;/li&gt;
&lt;li&gt;Upload changes to github&lt;/li&gt;
&lt;li&gt;Netlify is linked to my github and automatically renders the whole page&lt;/li&gt;
&lt;/ol&gt;

&lt;pre&gt;&lt;code&gt;
from nbconvert import MarkdownExporter
from nbconvert.preprocessors import Preprocessor
from pathlib import Path
from traitlets.config import Config

import nbformat
import re

path = r&#39;./notebooks/adding_posts_with_juypter.ipynb&#39;

# here I customize some functions of the fabfile.py of the hugo_jupyter package

class CustomPreprocessor(Preprocessor):
    &amp;quot;&amp;quot;&amp;quot;Remove blank code cells and unnecessary whitespace.&amp;quot;&amp;quot;&amp;quot;2

    def preprocess(self, nb, resources):
        &amp;quot;&amp;quot;&amp;quot;
        Remove blank cells
        &amp;quot;&amp;quot;&amp;quot;
        for index, cell in enumerate(nb.cells):
            if cell.cell_type == &#39;code&#39; and not cell.source:
                nb.cells.pop(index)
            else:
                nb.cells[index], resources = self.preprocess_cell(cell, resources, index)
        return nb, resources

    def preprocess_cell(self, cell, resources, cell_index):
        &amp;quot;&amp;quot;&amp;quot;
        Remove extraneous whitespace from code cells&#39; source code
        &amp;quot;&amp;quot;&amp;quot;
        if cell.cell_type == &#39;code&#39;:
            cell.source = cell.source.strip()

        return cell, resources


def doctor(string: str) -&amp;gt; str:
    &amp;quot;&amp;quot;&amp;quot;Get rid of all the wacky newlines nbconvert adds to markdown output and return result.&amp;quot;&amp;quot;&amp;quot;
    post_code_newlines_patt = re.compile(r&#39;(```)(\n+)&#39;)
    inter_output_newlines_patt = re.compile(r&#39;(\s{4}\S+)(\n+)(\s{4})&#39;)

    post_code_filtered = re.sub(post_code_newlines_patt, r&#39;\1\n\n&#39;, string)
    inter_output_filtered = re.sub(inter_output_newlines_patt, r&#39;\1\n\3&#39;, post_code_filtered)

    return inter_output_filtered

def make_yaml_header(**kwargs):

    header = &#39;---\n&#39;

    for key, value in kwargs.items():
        if type(value) in [str, int , float ] :
            header += &#39;{} : {}\n&#39;.format(key, value)
        else:
            header += &#39;{}: \n&#39;.format(key)
            for item in value:
                header += &#39;  - {}\n&#39;.format(item)

    header += &#39;---\n&#39;

    return header


def notebook_to_markdown( path, date, slug, **kwargs ):
    &amp;quot;&amp;quot;&amp;quot;
    Convert notebook to Markdown format

    Args:
        path: str, path to notebook
        date: datestring in YYYY-MM-DD format
        slug: str, front-matter parameter, used to compose adress of blogpost
        kwargs: str, float, int, list, tuple, other front-matter parameters recommended to pass title

    &amp;quot;&amp;quot;&amp;quot;
    path_nb = Path(path)
    path_out = path_nb.parents[1] / &#39;static&#39;/ date.split(&#39;-&#39;)[0] / date.split(&#39;-&#39;)[1] / slug
    path_post = path_nb.parents[1] / &#39;content/post/&#39; / ( date + &#39;-&#39; + slug + &#39;.md&#39; )



    assert path_nb.exists()
    assert path_post.parent.exists()
    assert bool( re.match(&#39;[0-9]{4}-[0-1][0-9]-[0-3][0-9]&#39;, date) ), &#39;Incorrect date format, need YYYY-MM-DD&#39;

    # convert notebook to .md----------------------------------------------------

    with Path(path).open() as fp:
        notebook = nbformat.read(fp, as_version=4)

    c = Config()
    c.MarkdownExporter.preprocessors = [CustomPreprocessor]
    markdown_exporter = MarkdownExporter(config=c)

    markdown, resources = markdown_exporter.from_notebook_node(notebook)
    md = doctor(markdown)

    yaml = make_yaml_header(  date = date
                             , slug = slug
                             , **kwargs)

    md = yaml + md

    with path_post.open(&#39;w&#39;) as f:
        f.write(md)
    # write outputs as png --------------------------------------------------------

    if &#39;outputs&#39; in resources.keys():
        if not path_out.exists():
            path_out.mkdir(parents=True)
        for key in resources[&#39;outputs&#39;].keys():
            with (path_out / key).open(&#39;wb&#39;) as f:
                f.write( resources[&#39;outputs&#39;][key] )



if __name__ == &amp;quot;__main__&amp;quot;:

    path = r&#39;../notebooks/adding_posts_with_juypter.ipynb&#39;

    notebook_to_markdown( path = r&#39;../notebooks/adding_posts_with_juypter.ipynb&#39;
                          , date = &#39;2018-08-11&#39;
                          , slug = &#39;post_with_jupyter&#39;
                          , title = &#39;Adding posts as jupyter notebooks&#39;
                          , author = &#39;Bjoern Koneswarakantha&#39;
                          , categories = [&#39;R vs. python&#39;,&#39;blogging&#39;]
                          , tags = [&#39;R vs. python&#39;,&#39;hugo&#39;, &#39;python&#39;, &#39;R&#39;, &#39;hugo&#39;, &#39;hugo_jupyer&#39;]
                          , summary = &#39;Blogging with jupyter notebooks, hugo_jupyter and some tweaking. Comparison to\
                           R and blogdown&#39;
                          , thumbnailImagePosition = &#39;left&#39;
                          , thumbnailImage = &#39;https://gitlab.eurecom.fr/zoe-apps/pytorch/avatar&#39;
                         )
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&#34;poc-graphical-output&#34;&gt;POC Graphical output&lt;/h1&gt;

&lt;pre&gt;&lt;code class=&#34;language-python&#34;&gt;from matplotlib import pyplot as plt
%matplotlib inline
import seaborn as sns

df = sns.load_dataset(&#39;iris&#39;)


sns.lmplot(x = &#39;petal_length&#39;, y = &#39;petal_width&#39;, data = df
           , hue = &#39;species&#39;
           , fit_reg = False)
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;seaborn.axisgrid.FacetGrid at 0x251a9439518&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&#34;output_1_1.png&#34; alt=&#34;png&#34; /&gt;&lt;/p&gt;

&lt;h1 id=&#34;poc-shortcode&#34;&gt;POC shortcode&lt;/h1&gt;

&lt;div class=&#34;alert success &#34;&gt;
  &lt;p&gt;Look we can use shortcode to wrap text in tags&lt;/p&gt;
&lt;/div&gt;

&lt;span class=&#34;highlight-text orange&#34;&gt;
or higlight text
&lt;/span&gt;
</description>
    </item>
    
    <item>
      <title>Joyplot Logo</title>
      <link>https://www.datisticsblog.com/2018/08/joyplot-logo/</link>
      <pubDate>Fri, 03 Aug 2018 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/2018/08/joyplot-logo/</guid>
      <description>





&lt;div class=&#34;figure center&#34; &gt;
  
    &lt;img class=&#34;fig-img&#34; src=&#34;../../../logo.png&#34; style=&#34;width: 180px;height: 180px;&#34;&gt;
  
  
&lt;/div&gt;

&lt;p&gt;Welcome to my data science blog &lt;code&gt;datistics&lt;/code&gt; where I will gradually post all the vignettes and programming POC’s that I have written over the past two years. Most of them can be already found in my &lt;a href=&#34;https://github.com/erblast/&#34;&gt;github repository&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;I am using &lt;a href=&#34;https://github.com/rstudio/blogdown&#34;&gt;blogdown&lt;/a&gt; to create this blog and using &lt;code&gt;R&lt;/code&gt; and &lt;code&gt;RStudio&lt;/code&gt;. However I have recently taken up &lt;code&gt;python&lt;/code&gt; programming for work again, so my first challenge will be to also add posts in the form of jupyter notebooks.&lt;/p&gt;
&lt;p&gt;As for my first post I will add the code that I use to generate my page logo in &lt;code&gt;R&lt;/code&gt;.&lt;/p&gt;
&lt;div id=&#34;tweedie-distributions&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Tweedie distributions&lt;/h1&gt;
&lt;p&gt;We often encounter distributions that are not normal, I often encounter poisson and gamma distributions as well as distributions with an inflated zero value all of which belong to the family of tweedie distributions. When changing the parameter &lt;span class=&#34;math inline&#34;&gt;\(p\)&lt;/span&gt; which can take values between 0 and 2 ( p == 0 gaussian, p == 1 poisson, p == 2 gamma) we can sample the different tweedie distributions.&lt;/p&gt;
&lt;div class=&#34;alert warning &#34;&gt;
  &lt;p&gt;the &lt;code&gt;tweedie&lt;/code&gt; package only supports values for 1 &amp;lt;= p &amp;lt;= 2&lt;/p&gt;
&lt;/div&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;suppressWarnings({
  suppressPackageStartupMessages({
    require(tidyverse)
    require(tweedie)
    require(ggridges)
  })
})&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df = tibble( p = seq(1,2,0.1) ) %&amp;gt;%
  mutate( data = map(p, function(p) rtweedie(n = 500
                                             , mu = 1
                                             , phi = 1
                                             , power = p )  ) ) %&amp;gt;%
  unnest(data)

df %&amp;gt;%
  ggplot( aes(x = data) )+
    geom_histogram(bins = 100, fill = &amp;#39;#77773c&amp;#39;) +
    facet_wrap(~p, scales = &amp;#39;free_y&amp;#39;)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-08-03-first-post_files/figure-html/tweedie-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;joyplot&#34; class=&#34;section level1&#34;&gt;
&lt;h1&gt;Joyplot&lt;/h1&gt;
&lt;p&gt;We will now transform these distributions into a joyplot in the style of the Joy Divisions album Unknown Pleasurs cover art.&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style=&#34;width:100px; height:130px&#34;; align=&#34;center&#34;&gt;
![](https://www.officialmerchandise.com/assets/products/57683/large/joy-division-unknown-pleasures-poster-p8(1).jpg)
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;We will use &lt;code&gt;ggridges&lt;/code&gt; formerly known as &lt;code&gt;ggjoy&lt;/code&gt;.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;joyplot = function(df){

  p = df %&amp;gt;%
    ggplot(aes(x = data, y = as.factor(p), fill = ..x.. ) ) +
      geom_density_ridges_gradient( color = &amp;#39;white&amp;#39;
                                   , size = 0.5
                                   , scale = 3) +
      theme( panel.background = element_rect(fill = &amp;#39;white&amp;#39;)
             , panel.grid = element_blank()
             , aspect.ratio = 1
             , axis.title = element_blank()
             , axis.text = element_blank()
             , axis.ticks = element_blank()
             , legend.position = &amp;#39;none&amp;#39;) +
     xlim(-1,5) +
     scale_fill_viridis_c(option = &amp;quot;inferno&amp;quot;) 
  
  return(p)

}

joyplot(df)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Picking joint bandwidth of 0.236&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-08-03-first-post_files/figure-html/joyplot1-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;I order to distribute them a bit better over the x-axis we will transform them using a sine wave pattern.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;df = tibble( p = seq(1,2,0.05)
             , rwn = row_number(p)
             , sin = sin(rwn) ) %&amp;gt;%
  mutate( data = map(p, function(p) rtweedie(500
                                             , mu = 1
                                             , phi = 1
                                             , power = p)  ) ) %&amp;gt;%
  unnest(data) %&amp;gt;%
  filter( data &amp;lt;= 4) %&amp;gt;%
  mutate( data = ( 4 * abs( sin(rwn) ) ) - data )


joyplot(df)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Picking joint bandwidth of 0.205&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;https://www.datisticsblog.com/post/2018-08-03-first-post_files/figure-html/joyplot2-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;/div&gt;
</description>
    </item>
    
    <item>
      <title></title>
      <link>https://www.datisticsblog.com/page/docker/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/page/docker/</guid>
      <description>

&lt;h1 id=&#34;cheat-sheet&#34;&gt;Cheat Sheet&lt;/h1&gt;

&lt;h2 id=&#34;docker-cli&#34;&gt;docker CLI&lt;/h2&gt;

&lt;p&gt;The official tutorial is very dev-ops heavy most of it is not so important for datascience
extracts from &lt;a href=&#34;https://docs.docker.com/get-started/&#34;&gt;official tutorial&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This &lt;a href=&#34;https://ropenscilabs.github.io/r-docker-tutorial/&#34;&gt;R docker tutorial&lt;/a&gt; is much better&lt;/p&gt;

&lt;h3 id=&#34;list-docker-cli-commands&#34;&gt;List Docker CLI commands&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;docker
docker container --help
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;display-docker-version-and-info&#34;&gt;Display Docker version and info&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;docker --version
docker version
docker info
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;execute-docker-image&#34;&gt;Execute Docker image&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;docker run hello-world
docker run --rm -it sample_image /bin/bash # run in interactive mode and quit container when exiting attach shell
docker run --rm -it -v local_path:container_path sample_image /bin/bash  # attach volume
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;list-docker-images&#34;&gt;List Docker images&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;docker image ls
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;list-docker-containers-running-all-all-in-quiet-mode&#34;&gt;List Docker containers (running, all, all in quiet mode)&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;docker container ls
docker container ls --all
docker container ls -aq
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;managing-images-and-running-containers&#34;&gt;Managing Images and running containers&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;docker build -t friendlyhello .  # Create image using this directory&#39;s Dockerfile
docker run -p 4000:80 friendlyhello  # Run &amp;quot;friendlyhello&amp;quot; mapping port 4000 to 80
docker run -d -p 4000:80 friendlyhello         # Same thing, but in detached mode
docker container ls                                # List all running containers
docker container ls -a             # List all containers, even those not running
docker container stop &amp;lt;hash&amp;gt;           # Gracefully stop the specified container
docker container kill &amp;lt;hash&amp;gt;         # Force shutdown of the specified container
docker container rm &amp;lt;hash&amp;gt;        # Remove specified container from this machine
docker container rm $(docker container ls -a -q)         # Remove all containers
docker image ls -a                             # List all images on this machine
docker image rm &amp;lt;image id&amp;gt;            # Remove specified image from this machine
docker image rm $(docker image ls -a -q)   # Remove all images from this machine
docker login             # Log in this CLI session using your Docker credentials
docker tag &amp;lt;image&amp;gt; username/repository:tag  # Tag &amp;lt;image&amp;gt; for upload to registry
docker push username/repository:tag            # Upload tagged image to registry
docker run username/repository:tag                   # Run image from a registry
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;dockerfile&#34;&gt;Dockerfile&lt;/h2&gt;

&lt;h3 id=&#34;install-linux-modules&#34;&gt;Install linux modules&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;&amp;amp;&amp;amp;&lt;/code&gt; chains two commands&lt;/li&gt;
&lt;li&gt;&lt;code&gt;\&lt;/code&gt; continue command on next line&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-y&lt;/code&gt; passes yes to user input
&lt;code&gt;
RUN apt-get update &amp;amp;&amp;amp; \
apt-get -y install build-essential &amp;amp;&amp;amp; \
apt-get -y install openssh-client
&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3 id=&#34;install-into-conda-environment&#34;&gt;Install into conda environment&lt;/h3&gt;

&lt;pre&gt;&lt;code&gt;FROM continuumio/miniconda3:latest #conda/miniconda3 does not work

# install ssh and compilers
RUN apt-get update &amp;amp;&amp;amp; \
    apt-get -y install build-essential &amp;amp;&amp;amp; \
    apt-get -y install openssh-client

RUN conda update -n base -c defaults conda
RUN conda install git

RUN conda create --name my_env python=3.6
RUN conda install -n my_env pyarrow=0.11.1
ENV PATH /opt/conda/envs/my_env/bin:$PATH
RUN /bin/bash -c &amp;quot;source activate idwimpala&amp;quot;
RUN pip install hdfs==2.1.0
&lt;/code&gt;&lt;/pre&gt;

&lt;h3 id=&#34;run-cmd-entrypoint&#34;&gt;RUN, CMD, ENTRYPOINT&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;RUN&lt;/code&gt; executes line, execution can be stored in image&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ENTRYPOINT&lt;/code&gt; executes when container starts up&lt;/li&gt;
&lt;li&gt;&lt;code&gt;CMD&lt;/code&gt; default command when container starts up, can be overwritten&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href=&#34;https://goinbigdata.com/docker-run-vs-cmd-vs-entrypoint/&#34;&gt;blogpost&lt;/a&gt;&lt;/p&gt;

&lt;h2 id=&#34;run-rstudio&#34;&gt;Run RStudio&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;-p 8787:8787&lt;/code&gt; defines port&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-e PASSWORD=&#39;123&#39;&lt;/code&gt; sets environmen variable PASSWORD before running container&lt;/li&gt;
&lt;li&gt;&lt;code&gt;-d&lt;/code&gt; detached mode, runs in background&lt;/li&gt;
&lt;li&gt;&lt;code&gt;/init&lt;/code&gt; initiates RStudio
&lt;code&gt;
docker run --rm -it -p 8787:8787 -v local_path:/home/rstudio/container_path -e PASSWORD=&#39;123&#39; -d rocker/verse /init
&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&#34;run-jupyter-notebook&#34;&gt;Run jupyter notebook&lt;/h2&gt;

&lt;h2 id=&#34;deploy-services&#34;&gt;Deploy Services&lt;/h2&gt;

&lt;p&gt;specifications such as remote image location, ressource allocation and number of instances
can be specified in &lt;code&gt;docker-compose.yml&lt;/code&gt;&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;docker swarm init         # needs to be executed in order to deploy the services
docker stack ls                                            # List stacks or apps
docker stack deploy -c &amp;lt;composefile&amp;gt; &amp;lt;appname&amp;gt;  # Run the specified Compose file
docker service ls                 # List running services associated with an app
docker service ps &amp;lt;service&amp;gt;                  # List tasks associated with an app
docker inspect &amp;lt;task or container&amp;gt;                   # Inspect task or container
docker container ls -q                                      # List container IDs
docker stack rm &amp;lt;appname&amp;gt;                             # Tear down an application
docker swarm leave --force      # Take down a single node swarm from the manager
&lt;/code&gt;&lt;/pre&gt;
</description>
    </item>
    
    <item>
      <title></title>
      <link>https://www.datisticsblog.com/page/tableau/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>https://www.datisticsblog.com/page/tableau/</guid>
      <description>

&lt;h1 id=&#34;level-of-detail-expressions&#34;&gt;Level of detail expressions&lt;/h1&gt;

&lt;p&gt;It happens often that you want to create calculated fields that aggregate data but you need them to be independent of the dimensions in your figure. You can do this by using the level of detail expressions.&lt;/p&gt;

&lt;h2 id=&#34;fixed&#34;&gt;Fixed&lt;/h2&gt;

&lt;p&gt;Use a fixed set of dimensions&lt;/p&gt;

&lt;p&gt;Total population per country:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{FIXED continent, country : SUM(population) }
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;exclude&#34;&gt;Exclude&lt;/h2&gt;

&lt;p&gt;Ignore a specific dimension in the vis&lt;/p&gt;

&lt;p&gt;Total population per country:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{EXCLUDE city : SUM(population)}
&lt;/code&gt;&lt;/pre&gt;

&lt;h2 id=&#34;include&#34;&gt;Include&lt;/h2&gt;

&lt;p&gt;Add a specific dimension in the vis&lt;/p&gt;

&lt;p&gt;Total population per country:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{INCLUDE country : SUM(population)}
&lt;/code&gt;&lt;/pre&gt;

&lt;h1 id=&#34;min-1-trick&#34;&gt;Min(1) trick&lt;/h1&gt;

&lt;p&gt;&lt;a href=&#34;http://datapsientist.blogspot.com/2014/10/tableau-trick-for-work-min1.html&#34;&gt;http://datapsientist.blogspot.com/2014/10/tableau-trick-for-work-min1.html&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&#34;creating-a-parameter-control-to-sort-by-dimension&#34;&gt;Creating a Parameter Control to Sort By Dimension&lt;/h1&gt;

&lt;p&gt;&lt;a href=&#34;https://kb.tableau.com/articles/howto/creating-a-parameter-control-to-sort-by-dimension&#34;&gt;https://kb.tableau.com/articles/howto/creating-a-parameter-control-to-sort-by-dimension&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&#34;send-parameters-from-workbook-to-workbook-via-url&#34;&gt;Send parameters from workbook to workbook via URL&lt;/h1&gt;

&lt;p&gt;&lt;a href=&#34;https://community.tableau.com/thread/202493&#34;&gt;https://community.tableau.com/thread/202493&lt;/a&gt;&lt;/p&gt;

&lt;h1 id=&#34;workaround-for-nested-containers&#34;&gt;Workaround for Nested Containers&lt;/h1&gt;

&lt;p&gt;&lt;a href=&#34;https://community.tableau.com/thread/178426&#34;&gt;https://community.tableau.com/thread/178426&lt;/a&gt;&lt;/p&gt;
</description>
    </item>
    
  </channel>
</rss>
