<?xml version="1.0" encoding="UTF-8"?>
<rss  xmlns:atom="http://www.w3.org/2005/Atom" 
      xmlns:media="http://search.yahoo.com/mrss/" 
      xmlns:content="http://purl.org/rss/1.0/modules/content/" 
      xmlns:dc="http://purl.org/dc/elements/1.1/" 
      version="2.0">
<channel>
<title>Muhammad Yaseen</title>
<link>https://myaseen208.com/blogs/</link>
<atom:link href="https://myaseen208.com/blogs/index.xml" rel="self" type="application/rss+xml"/>
<description>Thoughts on Statistics, Data Science, R, Python, and Machine Learning.</description>
<image>
<url>https://myaseen208.com/assets/img/MYaseen208.webp</url>
<title>Muhammad Yaseen</title>
<link>https://myaseen208.com/blogs/</link>
</image>
<generator>quarto-1.9.37</generator>
<lastBuildDate>Tue, 05 May 2026 04:00:00 GMT</lastBuildDate>
<item>
  <title>A Comprehensive Statistical Analysis of the Holy Quran</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2025-06-28_Quran/</link>
  <description><![CDATA[ <div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://yihui.org/knitr/">knitr</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/knitr/man/read_chunk.html">read_chunk</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"100Analysis.R"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
</div>
<section id="semantic-analysis-of-quran" class="level1" data-number="1"><h1 data-number="1">
<span class="header-section-number">1</span> Semantic Analysis of Quran</h1>
</section><section id="surah-level-analysis" class="level1" data-number="2"><h1 data-number="2">
<span class="header-section-number">2</span> Surah Level Analysis</h1>
<section id="surah-level-statistics" class="level2" data-number="2.1"><h2 data-number="2.1" class="anchored" data-anchor-id="surah-level-statistics">
<span class="header-section-number">2.1</span> Surah Level Statistics</h2>
<section id="number-of-ayats-words-and-characters" class="level3" data-number="2.1.1"><h3 data-number="2.1.1" class="anchored" data-anchor-id="number-of-ayats-words-and-characters">
<span class="header-section-number">2.1.1</span> Number of Ayats, Words, and Characters</h3>
</section><section id="top-10-longest-surahs-by-ayat-count" class="level3" data-number="2.1.2"><h3 data-number="2.1.2" class="anchored" data-anchor-id="top-10-longest-surahs-by-ayat-count">
<span class="header-section-number">2.1.2</span> Top 10 longest Surahs by Ayat count</h3>
</section></section></section><section id="summary-by-revelation-type-meccan-vs-medinan" class="level1" data-number="3"><h1 data-number="3">
<span class="header-section-number">3</span> Summary by revelation type (Meccan vs Medinan)</h1>
<p><br><br></p>
</section><section id="word-level-analysis" class="level1" data-number="4"><h1 data-number="4">
<span class="header-section-number">4</span> Word Level Analysis</h1>
<p><br><br></p>
<p><br><br></p>


</section><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2026,
  author = {Yaseen, Muhammad},
  title = {A {Comprehensive} {Statistical} {Analysis} of the {Holy}
    {Quran}},
  date = {2026-05-05},
  url = {https://myaseen208.com/blogs/2025-06-28_Quran/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2026" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2026. <span>“A Comprehensive Statistical Analysis of
the Holy Quran.”</span> May 5. <a href="https://myaseen208.com/blogs/2025-06-28_Quran/">https://myaseen208.com/blogs/2025-06-28_Quran/</a>.
</div></div></section></div> ]]></description>
  <category>R</category>
  <category>Quran</category>
  <category>Text Analysis</category>
  <category>Data Science</category>
  <category>Arabic</category>
  <category>NLP</category>
  <guid>https://myaseen208.com/blogs/2025-06-28_Quran/</guid>
  <pubDate>Tue, 05 May 2026 04:00:00 GMT</pubDate>
</item>
<item>
  <title>Batting Performance of Babar Azam and Virat Kohli</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2025-04-04_Cricket/</link>
  <description><![CDATA[ <section id="test-batting-performance-of-babar-azam" class="level1"><h1>Test Batting Performance of Babar Azam</h1>
<div id="fig-BabarAzam" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-BabarAzam-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="./fig/BabarAzam.jpg" class="lightbox" data-gallery="quarto-lightbox-gallery-1" title="Figure&nbsp;1: Babar Azam"><img src="https://myaseen208.com/blogs/2025-04-04_Cricket/fig/BabarAzam.jpg" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-BabarAzam-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Babar Azam
</figcaption></figure>
</div>
<div class="quarto-video ratio ratio-16x9"><iframe data-external="1" src="https://www.youtube.com/embed/7Xaomn9UKog" title="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>
<section id="overall-performance" class="level2"><h2 class="anchored" data-anchor-id="overall-performance">Overall Performance</h2>
<p><strong>Mat:</strong> Number of Matches played</p>
<p><strong>Inns:</strong> Number of Innings played</p>
<p><strong>NO:</strong> Number of NOT OUT</p>
<p><strong>Runs:</strong> Runs scored</p>
<p><strong>HS:</strong> Highest Runs Scored</p>
<p><strong>Ave:</strong> Average</p>
<p><strong>BF:</strong> Balls Faced</p>
<p><strong>SR:</strong> Strike Rate</p>
<p><strong>Hundreds:</strong> Number of Hundreds Scored</p>
<p><strong>Fifties:</strong> Number of Fifties Scored</p>
<p><strong>Fours:</strong> Number of Fours hitted</p>
<p><strong>Sixes:</strong> Number of Sixes hitted</p>
</section><section id="performance-by-years" class="level2"><h2 class="anchored" data-anchor-id="performance-by-years">Performance by Years</h2>
<div class="cell">
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-left">
<figure class="figure"><p><a href="index_files/figure-html/BATBAOut2Plot1-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-2" title="Test Batting Performance of Babar Azam over the years"><img src="https://myaseen208.com/blogs/2025-04-04_Cricket/index_files/figure-html/BATBAOut2Plot1-1.png" class="img-fluid figure-img" width="672" alt="Test Batting Performance of Babar Azam over the years"></a></p>
<figcaption>Test Batting Performance of Babar Azam over the years</figcaption></figure>
</div>
</div>
</div>
</section><section id="performance-versus-different-oppositions" class="level2"><h2 class="anchored" data-anchor-id="performance-versus-different-oppositions">Performance versus different oppositions</h2>
<div class="cell">
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-left">
<figure class="figure"><p><a href="index_files/figure-html/BATBAOut3Plot1-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-3" title="Test Batting Performance of Babar Azam over the years by each inning"><img src="https://myaseen208.com/blogs/2025-04-04_Cricket/index_files/figure-html/BATBAOut3Plot1-1.png" class="img-fluid figure-img" width="672" alt="Test Batting Performance of Babar Azam over the years by each inning"></a></p>
<figcaption>Test Batting Performance of Babar Azam over the years by each inning</figcaption></figure>
</div>
</div>
</div>
</section><section id="performance-by-years-and-innings" class="level2"><h2 class="anchored" data-anchor-id="performance-by-years-and-innings">Performance by Years and Innings</h2>
<div class="cell">
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-left">
<figure class="figure"><p><a href="index_files/figure-html/BATBAOut4Plot1-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-4" title="Test Batting Performance of Babar Azam versus different oppositions"><img src="https://myaseen208.com/blogs/2025-04-04_Cricket/index_files/figure-html/BATBAOut4Plot1-1.png" class="img-fluid figure-img" width="672" alt="Test Batting Performance of Babar Azam versus different oppositions"></a></p>
<figcaption>Test Batting Performance of Babar Azam versus different oppositions</figcaption></figure>
</div>
</div>
</div>
</section></section><section id="test-batting-performance-of-virat-kohli" class="level1"><h1>Test Batting Performance of Virat Kohli</h1>
<div id="fig-ViratKohli" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-ViratKohli-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="./fig/ViratKohli.jpg" class="lightbox" data-gallery="quarto-lightbox-gallery-5" title="Figure&nbsp;2: Virat Kohli"><img src="https://myaseen208.com/blogs/2025-04-04_Cricket/fig/ViratKohli.jpg" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-ViratKohli-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: Virat Kohli
</figcaption></figure>
</div>
<!-- TODO: Replace with the correct Virat Kohli video URL — the Babar Azam URL was a placeholder -->
<div class="quarto-video ratio ratio-16x9"><iframe data-external="1" src="https://www.youtube.com/embed/VIRAT_VIDEO_ID" title="" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe></div>
<section id="overall-performance-1" class="level2"><h2 class="anchored" data-anchor-id="overall-performance-1">Overall Performance</h2>
<p><strong>Mat:</strong> Number of Matches played</p>
<p><strong>Inns:</strong> Number of Innings played</p>
<p><strong>NO:</strong> Number of NOT OUT</p>
<p><strong>Runs:</strong> Runs scored</p>
<p><strong>HS:</strong> Highest Runs Scored</p>
<p><strong>Ave:</strong> Average</p>
<p><strong>BF:</strong> Balls Faced</p>
<p><strong>SR:</strong> Strike Rate</p>
<p><strong>Hundreds:</strong> Number of Hundreds Scored</p>
<p><strong>Fifties:</strong> Number of Fifties Scored</p>
<p><strong>Fours:</strong> Number of Fours hitted</p>
<p><strong>Sixes:</strong> Number of Sixes hitted</p>
</section><section id="performance-by-years-1" class="level2"><h2 class="anchored" data-anchor-id="performance-by-years-1">Performance by Years</h2>
<div class="cell">
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-left">
<figure class="figure"><p><a href="index_files/figure-html/VKTBAOut2Plot1-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-6" title="Test Batting Performance of Virat Kohli over the years"><img src="https://myaseen208.com/blogs/2025-04-04_Cricket/index_files/figure-html/VKTBAOut2Plot1-1.png" class="img-fluid figure-img" width="672" alt="Test Batting Performance of Virat Kohli over the years"></a></p>
<figcaption>Test Batting Performance of Virat Kohli over the years</figcaption></figure>
</div>
</div>
</div>
</section><section id="performance-versus-different-oppositions-1" class="level2"><h2 class="anchored" data-anchor-id="performance-versus-different-oppositions-1">Performance versus different oppositions</h2>
<div class="cell">
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-left">
<figure class="figure"><p><a href="index_files/figure-html/VKTBAOut3Plot1-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-7" title="Test Batting Performance of Virat Kohli over the years by each inning"><img src="https://myaseen208.com/blogs/2025-04-04_Cricket/index_files/figure-html/VKTBAOut3Plot1-1.png" class="img-fluid figure-img" width="672" alt="Test Batting Performance of Virat Kohli over the years by each inning"></a></p>
<figcaption>Test Batting Performance of Virat Kohli over the years by each inning</figcaption></figure>
</div>
</div>
</div>
</section><section id="performance-by-years-and-innings-1" class="level2"><h2 class="anchored" data-anchor-id="performance-by-years-and-innings-1">Performance by Years and Innings</h2>
<div class="cell">
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-left">
<figure class="figure"><p><a href="index_files/figure-html/VKTBAOut4Plot1-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-8" title="Test Batting Performance of Virat Kohli versus different oppositions"><img src="https://myaseen208.com/blogs/2025-04-04_Cricket/index_files/figure-html/VKTBAOut4Plot1-1.png" class="img-fluid figure-img" width="672" alt="Test Batting Performance of Virat Kohli versus different oppositions"></a></p>
<figcaption>Test Batting Performance of Virat Kohli versus different oppositions</figcaption></figure>
</div>
</div>
</div>


</section></section><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2025,
  author = {Yaseen, Muhammad},
  title = {Batting {Performance} of {Babar} {Azam} and {Virat} {Kohli}},
  date = {2025-04-04},
  url = {https://myaseen208.com/blogs/2025-04-04_Cricket/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2025" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2025. <span>“Batting Performance of Babar Azam and
Virat Kohli.”</span> April 4. <a href="https://myaseen208.com/blogs/2025-04-04_Cricket/">https://myaseen208.com/blogs/2025-04-04_Cricket/</a>.
</div></div></section></div> ]]></description>
  <guid>https://myaseen208.com/blogs/2025-04-04_Cricket/</guid>
  <pubDate>Fri, 04 Apr 2025 04:00:00 GMT</pubDate>
  <media:content url="https://myaseen208.com/blogs/2025-04-04_Cricket/fig/BabarAzam.jpg" medium="image" type="image/jpeg"/>
</item>
<item>
  <title>Pakistan Population Census</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2025-04-04_PakPC/</link>
  <description><![CDATA[ <section id="introduction" class="level1"><h1>Introduction</h1>
<p>The <a href="https://www.pbs.gov.pk/">Pakistan Bureau of Statistics (PBS)</a> holds the pivotal responsibility of orchestrating, collating, and disseminating the outcomes of the population census within the nation. On the significant date of August 5, 2023, the Council of Common Interests (CCI) accorded its approval for the findings derived from the Census of 2023, a comprehensive endeavor led by the PBS to capture the demographic landscape of Pakistan. To facilitate widespread access to this crucial data, the PBS published the conclusive results of the Census 2023 on its <a href="https://www.pbs.gov.pk/">official website</a> in a PDF format, albeit one that is not machine-readable.</p>
<p>However, this presentation in PDF form poses a significant challenge to researchers and analysts aiming to delve into the insights embedded within this valuable data. The intricacies of extracting, processing, and interpreting information from a non-machine-readable format like PDF hinder the swift utilization of this data for in-depth analysis. Recognizing this impediment, a strategic solution has been crafted in the form of an <code>R</code> programming language package termed <a href="https://github.com/myaseen208/PakPC2023">PakPC2023</a>.</p>
<p>The <a href="https://github.com/myaseen208/PakPC2023">PakPC2023</a> <code>R</code> package has been meticulously developed to surmount the obstacles presented by the non-machine-readable PDF format. This specialized software acts as a bridge, effectively converting the cumbersome PDF-based Census 2023 data into a format that is amenable for analysis within the <code>R</code> software environment. Researchers, analysts, and data enthusiasts can seamlessly install the <a href="https://github.com/myaseen208/PakPC2023">PakPC2023</a> package from the Comprehensive <code>R</code> Archive Network (CRAN), a repository that serves as a hub for <code>R</code> packages, ensuring easy accessibility to this innovative tool.</p>
<p>By implementing the <a href="https://github.com/myaseen208/PakPC2023">PakPC2023</a> package, the door is opened for researchers to harness the power of the Census 2023 data in an efficient and effective manner. This strategic initiative not only streamlines the process of accessing and utilizing the census data but also empowers researchers to unlock valuable insights and trends that lie within, contributing to informed decision-making and comprehensive socio-economic understanding.</p>
<p>This dashboard allows you to explore datasets from the Pakistan Population Census of 2017 and 2023. Choose a dataset from the sidebar to generate tables and graphs.</p>
<section id="province-level-analysis" class="level2"><h2 class="anchored" data-anchor-id="province-level-analysis">Province Level Analysis</h2>
<div class="cell">
<div class="cell-output-display">
<div class="datatables html-widget html-fill-item" id="htmlwidget-c2a0e6b247b042ff4dae" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-c2a0e6b247b042ff4dae">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18"],["Pakistan","Pakistan","Pakistan","Punjab","Punjab","Punjab","Sindh","Sindh","Sindh","KP","KP","KP","Balochistan","Balochistan","Balochistan","ICT","ICT","ICT"],["All","Rural","Urban","All","Rural","Urban","All","Rural","Urban","All","Rural","Urban","All","Rural","Urban","All","Rural","Urban"],[38340566,23323551,15017015,19855902,11719520,8136382,9871620,4744589,5127031,5883007,4969183,913824,2318519,1664015,654504,411518,226244,185274],[241499431,147748707,93750724,127688922,75715270,51973652,55696147,25771071,29925076,40856097,34724801,6131296,14894402,10282574,4611828,2363863,1254991,1108872],[6.3,6.33,6.24,6.430000000000001,6.46,6.39,5.64,5.430000000000001,5.84,6.94,6.99,6.71,6.42,6.18,7.05,5.74,5.55,5.99],[207684626,132013789,75670837,109989655,69442450,40547205,47854510,23021876,24832634,35501964,29626670,5875294,12335129,8928428,3406701,2003368,994365,1009003],[2.55,1.9,3.65,2.53,1.46,4.24,2.57,1.9,3.17,2.38,2.69,0.72,3.2,2.39,5.19,2.8,3.97,1.59]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>Region<\/th>\n      <th>Area<\/th>\n      <th>Households<\/th>\n      <th>Pop2023<\/th>\n      <th>AHS<\/th>\n      <th>Pop2017<\/th>\n      <th>GR<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[3,4,5,6,7]},{"orderable":false,"targets":0},{"name":" ","targets":0},{"name":"Region","targets":1},{"name":"Area","targets":2},{"name":"Households","targets":3},{"name":"Pop2023","targets":4},{"name":"AHS","targets":5},{"name":"Pop2017","targets":6},{"name":"GR","targets":7}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
<div id="fig-Plot1" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-Plot1-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2025-04-04_PakPC/fig/Plot1.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-1" title="Figure&nbsp;1: Population by Regions"><img src="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot1.webp" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Plot1-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Population by Regions
</figcaption></figure>
</div>
<p>The visual representation presented in Figure&nbsp;1 provides a comprehensive overview of the population distribution across various regions of Pakistan. This data has been meticulously collected from the Pakistan Population Census of 2023, serving as an accurate reflection of the demographic landscape of the country.</p>
<p>A closer examination of the graph reveals that the province of Punjab emerges as the most populous region, boasting an impressive population count of approximately 128 million individuals.</p>
<p>Following closely, the province of Sindh contributes significantly to the nation’s population with approximately 56 million residents.</p>
<p>Turning our attention towards the remaining regions, Khyber Pakhtunkhwa stands as a substantial population center with around 41 million inhabitants, further emphasizing its role in the overall demographic makeup of Pakistan. On the other hand, Balochistan, while having a comparably smaller population, still contributes notably with around 15 million people.</p>
<p>It is noteworthy that the data showcased in Figure&nbsp;1 not only underscores the population sizes of these regions but also underscores the diversity and complexity of Pakistan’s demographic distribution. This information serves as a valuable resource for policymakers, researchers, and anyone interested in gaining insights into the population dynamics of Pakistan.</p>
<div id="fig-Plot2" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-Plot2-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2025-04-04_PakPC/fig/Plot2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-2" title="Figure&nbsp;2: Population by Regions &amp; Area"><img src="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot2.webp" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Plot2-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: Population by Regions &amp; Area
</figcaption></figure>
</div>
<p>Figure&nbsp;2 illustrates the distribution of Pakistan’s population across various regions and areas, providing insights drawn from the Pakistan Population Census 2023. The data underscores a significant urban-rural divide within the country, shedding light on the demographic landscape.</p>
<p>Notably, the data reveals that a substantial portion of Pakistan’s population resides in rural areas, accounting for a staggering figure of more than 147.75 million individuals. In contrast, the urban population stands at slightly over 93.75 million. This distribution underscores the predominance of rural living conditions in Pakistan.”),</p>
<p>Examining the regional disparities, the province of Punjab emerges as the leader in terms of rural population, boasting an impressive count of over 75.71 million inhabitants in rural settings. Sindh, on the other hand, leads the pack in urban population, hosting a significant urban community of over 29.92 million individuals.</p>
<p>The data presented within Figure&nbsp;2 serves to accentuate the pronounced urban-rural divide prevalent within Pakistan. The statistics reaffirm the prevalence of rural living conditions, with Punjab standing out as the province with the highest rural population, surpassing the 75.71 million mark.</p>
<p>The second spot in terms of rural population is claimed by Sindh, hosting more than 25.77 million residents in rural areas. In contrast, Balochistan registers as the province with the lowest rural population, counting slightly over 4.61 million individuals.</p>
<p>Shifting the focus to urban populations, Punjab once again takes the lead, this time in the urban category, as it accommodates a substantial urban populace exceeding 52.00 million. Sindh follows closely, contributing to the urban landscape with over 29.90 million inhabitants. In stark contrast, Khyber Pakhtunkhwa and Balochistan exhibit the smallest urban populations, each recording figures slightly surpassing 6.10 million and 4.60 million individuals, respectively.</p>
<p>In conclusion, Figure&nbsp;2 casts a spotlight on the demographic distribution within Pakistan, drawing attention to the prevailing urban-rural divide. The robust presentation of data underscores the dominance of rural populations, particularly in provinces like Punjab and Sindh, while also providing valuable insights into the urban landscape across various regions of the country.</p>
<div id="fig-Plot11" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-Plot11-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2025-04-04_PakPC/fig/Plot11.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-3" title="Figure&nbsp;3: Average Annual Population Growth Rate by Regions"><img src="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot11.webp" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Plot11-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;3: Average Annual Population Growth Rate by Regions
</figcaption></figure>
</div>
<div id="fig-Plot12" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-Plot12-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2025-04-04_PakPC/fig/Plot12.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-4" title="Figure&nbsp;4: Average Annual Population Growth Rate by Regions &amp; Area"><img src="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot12.webp" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Plot12-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;4: Average Annual Population Growth Rate by Regions &amp; Area
</figcaption></figure>
</div>
</section><section id="division-level-analysis" class="level2"><h2 class="anchored" data-anchor-id="division-level-analysis">Division Level Analysis</h2>
<div class="cell">
<div class="cell-output-display">
<div class="datatables html-widget html-fill-item" id="htmlwidget-9695962747982c7db00e" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-9695962747982c7db00e">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"],["Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","KP","KP","KP","KP","KP","KP","KP","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","ICT"],["Bahawalpur","Dera Ghazi Khan","Faisalabad","Gujranwala","Lahore","Multan","Rawalpindi","Sahiwal","Sargodha","Hyderabad","Karachi","Larkana","Mirpur Khas","Shaheed Benazirabad","Sukkur","Bannu","Dera Ismail Khan","Hazara","Kohat","Malakand","Mardan","Peshawar","Kalat","Loralai","Mekran","Nasirabad","Quetta","Rakhshan","Sibi","Zhob","ICT"],[2060013,1955041,2527950,2775775,3498991,2281317,1871806,1341588,1543421,2246096,3439220,1208563,863467,1061799,1052475,414765,519548,1003686,473606,1345243,679939,1446220,433209,135679,421059,283860,565181,154461,171016,154054,411518],[13400009,12892465,16228526,18778868,22772710,14085102,11406496,8533471,9591275,11659246,20382881,7093706,4619624,5930649,6010041,3092078,3188779,6188736,3752436,9959399,4639498,10035171,2721018,870000,1875872,2044021,4259163,1040001,1156748,927579,2363863],[6.5,6.59,6.42,6.77,6.51,6.17,6.09,6.359999999999999,6.21,5.19,5.930000000000001,5.87,5.35,5.59,5.71,7.46,6.14,6.17,7.92,7.4,6.819999999999999,6.94,6.28,6.41,4.46,7.2,7.54,6.73,6.76,6.02,5.74],[11452594,11021214,14185231,16120861,19389856,12268173,10006624,7378065,8167037,10596049,16024894,6190926,4224945,5275426,5542270,2652867,2795853,5323155,3205114,8603594,3998876,8922505,2174722,735691,1484788,1661077,3764730,743942,963941,806238,2003368],[2.66,2.66,2.27,2.58,2.72,2.33,2.21,2.46,2.72,1.61,4.1,2.3,1.5,1.98,1.36,2.59,2.22,2.55,2.67,2.48,2.51,1.98,3.82,2.84,3.98,3.53,2.08,5.76,3.09,2.37,2.8]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>Region<\/th>\n      <th>Division<\/th>\n      <th>Households<\/th>\n      <th>Pop2023<\/th>\n      <th>AHS<\/th>\n      <th>Pop2017<\/th>\n      <th>GR<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[3,4,5,6,7]},{"orderable":false,"targets":0},{"name":" ","targets":0},{"name":"Region","targets":1},{"name":"Division","targets":2},{"name":"Households","targets":3},{"name":"Pop2023","targets":4},{"name":"AHS","targets":5},{"name":"Pop2017","targets":6},{"name":"GR","targets":7}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
<div id="fig-Plot3" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-Plot3-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2025-04-04_PakPC/fig/Plot3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-5" title="Figure&nbsp;5: Population by Regions &amp; Division"><img src="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot3.webp" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Plot3-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;5: Population by Regions &amp; Division
</figcaption></figure>
</div>
<div id="fig-Plot13" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-Plot13-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2025-04-04_PakPC/fig/Plot13.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-6" title="Figure&nbsp;6: Average Annual Population Growth Rate by Regions &amp; Division"><img src="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot13.webp" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Plot13-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;6: Average Annual Population Growth Rate by Regions &amp; Division
</figcaption></figure>
</div>
</section><section id="district-level-analysis" class="level2"><h2 class="anchored" data-anchor-id="district-level-analysis">District Level Analysis</h2>
<div class="cell">
<div class="cell-output-display">
<div class="datatables html-widget html-fill-item" id="htmlwidget-eeff44ee2e127394d731" style="width:100%;height:auto;"></div>
<script type="application/json" data-for="htmlwidget-eeff44ee2e127394d731">{"x":{"filter":"none","vertical":false,"data":[["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95","96","97","98","99","100","101","102","103","104","105","106","107","108","109","110","111","112","113","114","115","116","117","118","119","120","121","122","123","124","125","126","127","128","129","130","131","132","133","134","135","136"],["Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Punjab","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","Sindh","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","KP","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","Balochistan","ICT"],["Bahawalpur","Bahawalpur","Bahawalpur","Dera Ghazi Khan","Dera Ghazi Khan","Dera Ghazi Khan","Dera Ghazi Khan","Faisalabad","Faisalabad","Faisalabad","Faisalabad","Gujranwala","Gujranwala","Gujranwala","Gujranwala","Gujranwala","Gujranwala","Lahore","Lahore","Lahore","Lahore","Multan","Multan","Multan","Multan","Rawalpindi","Rawalpindi","Rawalpindi","Rawalpindi","Sahiwal","Sahiwal","Sahiwal","Sargodha","Sargodha","Sargodha","Sargodha","Hyderabad","Hyderabad","Hyderabad","Hyderabad","Hyderabad","Hyderabad","Hyderabad","Hyderabad","Hyderabad","Karachi","Karachi","Karachi","Karachi","Karachi","Karachi","Karachi","Larkana","Larkana","Larkana","Larkana","Larkana","Mirpur Khas","Mirpur Khas","Mirpur Khas","Shaheed Benazirabad","Shaheed Benazirabad","Shaheed Benazirabad","Sukkur","Sukkur","Sukkur","Bannu","Bannu","Bannu","Dera Ismail Khan","Dera Ismail Khan","Dera Ismail Khan","Hazara","Hazara","Hazara","Hazara","Hazara","Hazara","Hazara","Hazara","Kohat","Kohat","Kohat","Kohat","Kohat","Malakand","Malakand","Malakand","Malakand","Malakand","Malakand","Malakand","Malakand","Malakand","Mardan","Mardan","Peshawar","Peshawar","Peshawar","Peshawar","Peshawar","Kalat","Kalat","Kalat","Kalat","Kalat","Kalat","Loralai","Loralai","Loralai","Loralai","Mekran","Mekran","Mekran","Nasirabad","Nasirabad","Nasirabad","Nasirabad","Nasirabad","Quetta","Quetta","Quetta","Quetta","Rakhshan","Rakhshan","Rakhshan","Rakhshan","Sibi","Sibi","Sibi","Sibi","Sibi","Zhob","Zhob","Zhob","ICT"],["Bahawalnagar","Bahawalpur","Rahim Yar Khan","Dera Ghazi Khan","Layyah","Muzaffargarh","Rajanpur","Chiniot","Faisalabad","Jhang","Toba Tek Singh","Gujranwala","Gujrat","Hafizabad","Mandi Bahauddin","Narowal","Sialkot","Kasur","Lahore","Nankana Sahib","Sheikhupura","Khanewal","Lodhran","Multan","Vehari","Attock","Chakwal","Jhelum","Rawalpindi","Okara","Pakpattan","Sahiwal","Bhakkar","Khushab","Mianwali","Sargodha","Badin","Dadu","Hyderabad","Jamshoro","Matiari","Sujawal","Tando Allahyar","Tando Muhammad Khan","Thatta","Karachi Central","Karachi East","Karachi South","Karachi West","Keamari","Korangi","Malir","Jacobabad","Kambar Shahdad Kot","Kashmore","Larkana","Shikarpur","Mirpur Khas","Tharparkar","Umer Kot","Naushahro Feroze","Sanghar","Shaheed Benazirabad","Ghotki","Khairpur","Sukkur","Bannu","Lakki Marwat","North Waziristan","Dera Ismail Khan","South Waziristan","Tank","Abbottabad","Batagram","Haripur","Kolai Palas Kohistan","Lower Kohistan","Mansehra","Torghar","Upper Kohistan","Hangu","Karak","Kohat","Kurram","Orakzai","Bajaur","Buner","Lower Chitral","Lower Dir","Malakand Protected Area","Shangla","Swat","Upper Chitral","Upper Dir","Mardan","Swabi","Charsadda","Khyber","Mohmand","Nowshera","Peshawar","Awaran","Kalat","Khuzdar","Lasbela","Mastung","Surab","Barkhan","Duki","Loralai","Musakhel","Gwadar","Kech","Panjgur","Jaffarabad","Jhal Magsi","Kachhi","Nasirabad","Sohbatpur","Chaman","Killa Abdullah","Pishin","Quetta","Chagai","Kharan","Nushki","Washuk","Dera Bugti","Harnai","Kohlu","Sibi","Ziarat","Killa Saifullah","Sherani","Zhob","ICT"],[558333,674155,827525,454711,341276,804783,354271,256660,1384668,494761,391861,849524,489589,197277,286168,281628,671589,645838,2012526,247121,593506,526609,324020,887304,543384,354235,288997,229227,999347,550057,344744,446787,313559,248449,296614,684799,398066,340665,448479,213639,158559,158917,177534,143956,206281,652776,665452,426224,465197,319555,493504,416512,195161,267684,208980,321837,214901,313141,327677,222649,319938,407265,334596,331132,452588,268755,183246,131894,99625,270189,178665,70694,237020,86224,192658,40393,52318,294113,29417,71543,61163,96026,169734,94575,52108,181721,118692,46050,202899,113159,125551,381246,26368,149557,400904,279035,263993,166829,63982,259911,691505,27808,33415,161594,115635,43736,51021,23069,43069,38284,31257,50376,253526,117157,81580,30967,50035,87540,33738,61942,67308,147241,288690,38234,35879,31268,49080,62298,16400,38115,31303,22900,70021,36108,47925,411518],[3550342,4284964,5564703,3393705,2102386,5015325,2381049,1563024,9075819,3077720,2511963,5959750,3219375,1319909,1829486,1950954,4499394,4084286,13004135,1634871,4049418,3364077,1928299,5362305,3430421,2170423,1734854,1382308,6118911,3515490,2136170,2881811,1957470,1501089,1798268,4334448,1947081,1742320,2432540,1117308,849383,839292,922012,726119,1083191,3822325,3950031,2329764,2679380,2068451,3128971,2403959,1174097,1514869,1233957,1784453,1386330,1681386,1778407,1159831,1777082,2308465,1845102,1772609,2597535,1639897,1357890,1040856,693332,1829811,888675,470293,1419072,554133,1174783,280162,340017,1797177,200445,422947,528902,815878,1234661,785434,387561,1287960,1016869,320407,1650183,826250,891252,2687384,195528,1083566,2744898,1894600,1835504,1146267,553933,1740705,4758762,178958,272506,997214,680977,313271,278092,210249,205044,272432,182275,305160,1060931,509781,594558,203368,442612,563377,240106,466218,361971,835482,2595492,269192,260352,207834,302623,355274,127571,260220,224148,189535,380200,191687,355692,2363863],[6.359999999999999,6.359999999999999,6.72,7.46,6.159999999999999,6.23,6.72,6.09,6.55,6.22,6.41,7.02,6.58,6.69,6.39,6.930000000000001,6.7,6.319999999999999,6.46,6.619999999999999,6.819999999999999,6.39,5.95,6.04,6.31,6.13,6,6.03,6.119999999999999,6.39,6.2,6.45,6.24,6.04,6.06,6.33,4.89,5.109999999999999,5.42,5.23,5.359999999999999,5.28,5.19,5.04,5.25,5.859999999999999,5.94,5.470000000000001,5.76,6.470000000000001,6.34,5.77,6.02,5.659999999999999,5.9,5.54,6.45,5.37,5.430000000000001,5.21,5.55,5.67,5.51,5.35,5.74,6.1,7.41,7.89,6.96,6.77,4.970000000000001,6.649999999999999,5.99,6.430000000000001,6.1,6.94,6.5,6.109999999999999,6.81,5.91,8.65,8.5,7.27,8.300000000000001,7.44,7.09,8.57,6.96,8.129999999999999,7.3,7.1,7.05,7.42,7.25,6.85,6.79,6.95,6.87,8.66,6.7,6.88,6.44,8.16,6.17,5.89,7.159999999999999,5.45,9.109999999999999,4.76,7.119999999999999,5.83,6.06,4.18,4.35,7.29,6.57,8.850000000000001,6.44,7.119999999999999,7.53,5.38,5.67,8.99,7.04,7.26,6.649999999999999,6.17,5.7,7.78,6.83,7.159999999999999,8.279999999999999,5.430000000000001,5.31,7.42,5.74],[2975656,3669176,4807762,2872631,1823995,4328549,1996039,1368659,7882444,2742633,2191495,5011066,2756289,1156954,1594039,1707575,3894938,3454881,11119985,1354986,3460004,2920233,1699693,4746166,2902081,1886378,1495463,1222403,5402380,3040826,1824228,2513011,1647852,1280372,1542601,3696212,1804958,1550390,2199928,993908,770040,779062,838527,677098,982138,2971382,2875315,1769230,2077228,1829837,2577556,1924346,1007009,1338035,1090336,1521786,1233760,1504440,1647036,1073469,1612047,2049873,1613506,1648708,2405190,1488372,1210183,902138,540546,1693594,675215,427044,1333089,476749,1001515,276325,202935,1555742,171349,305451,518811,705362,1111266,615372,254303,1090987,895460,278328,1436082,717806,759609,2308624,169297,947401,2373399,1625477,1610960,984246,474345,1520995,4331959,121821,211201,798896,576271,265676,200857,171025,152977,244446,167243,262253,907182,315353,513972,148900,309932,487847,200426,434561,323793,736903,2269473,226517,162766,178947,175712,313110,97052,213933,179751,160095,342932,152952,310354,2003368],[3,2.63,2.47,2.83,2.4,2.49,2.99,2.24,2.38,1.95,2.31,2.94,2.63,2.23,2.33,2.25,2.44,2.84,2.65,3.19,2.66,2.39,2.13,2.06,2.83,2.37,2.51,2.08,2.1,2.45,2.67,2.31,2.92,2.69,2.6,2.7,1.27,1.97,1.69,1.98,1.65,1.25,1.6,1.18,1.65,4.3,5.45,4.71,4.35,2.07,3.29,3.79,2.6,2.1,2.09,2.7,1.97,1.88,1.29,1.3,1.64,2.01,2.27,1.22,1.29,1.63,1.94,2.42,4.25,1.3,4.7,1.63,1.05,2.55,2.7,0.23,9.01,2.44,2.66,5.59,0.32,2.46,1.78,4.159999999999999,7.3,2.81,2.15,2.38,2.35,2.38,2.71,2.57,2.44,2.27,2.46,2.59,2.2,2.58,2.63,2.28,1.58,6.64,4.35,3.78,2.83,2.79,5.59,3.51,5.02,1.83,1.45,2.56,2.65,8.360000000000001,2.46,5.35,6.14,2.43,3.06,1.18,1.88,2.12,2.27,2.93,8.17,2.53,9.51,2.13,4.68,3.33,3.76,2.86,1.74,3.84,2.3,2.8]],"container":"<table class=\"display\">\n  <thead>\n    <tr>\n      <th> <\/th>\n      <th>Region<\/th>\n      <th>Division<\/th>\n      <th>District<\/th>\n      <th>Households<\/th>\n      <th>Pop2023<\/th>\n      <th>AHS<\/th>\n      <th>Pop2017<\/th>\n      <th>GR<\/th>\n    <\/tr>\n  <\/thead>\n<\/table>","options":{"columnDefs":[{"className":"dt-right","targets":[4,5,6,7,8]},{"orderable":false,"targets":0},{"name":" ","targets":0},{"name":"Region","targets":1},{"name":"Division","targets":2},{"name":"District","targets":3},{"name":"Households","targets":4},{"name":"Pop2023","targets":5},{"name":"AHS","targets":6},{"name":"Pop2017","targets":7},{"name":"GR","targets":8}],"order":[],"autoWidth":false,"orderClasses":false}},"evals":[],"jsHooks":[]}</script>
</div>
</div>
<div id="fig-Plot4" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-Plot4-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2025-04-04_PakPC/fig/Plot4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-7" title="Figure&nbsp;7: Population by Division &amp; District for Punjab"><img src="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot4.webp" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Plot4-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;7: Population by Division &amp; District for Punjab
</figcaption></figure>
</div>
<div id="fig-Plot5" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-Plot5-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2025-04-04_PakPC/fig/Plot5.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-8" title="Figure&nbsp;8: Population by Division &amp; District for Sindh"><img src="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot5.webp" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Plot5-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;8: Population by Division &amp; District for Sindh
</figcaption></figure>
</div>
<div id="fig-Plot6" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-Plot6-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2025-04-04_PakPC/fig/Plot6.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-9" title="Figure&nbsp;9: Population by Division &amp; District for KP"><img src="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot6.webp" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Plot6-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;9: Population by Division &amp; District for KP
</figcaption></figure>
</div>
<div id="fig-Plot7" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-Plot7-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2025-04-04_PakPC/fig/Plot7.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-10" title="Figure&nbsp;10: Population by Division &amp; District for Balochistan"><img src="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot7.webp" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Plot7-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;10: Population by Division &amp; District for Balochistan
</figcaption></figure>
</div>
<div id="fig-Plot14" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-Plot14-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2025-04-04_PakPC/fig/Plot14.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-11" title="Figure&nbsp;11: Average Annual Population Growth Rate by Division &amp; District for Punjab"><img src="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot14.webp" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Plot14-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;11: Average Annual Population Growth Rate by Division &amp; District for Punjab
</figcaption></figure>
</div>
<div id="fig-Plot15" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-Plot15-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2025-04-04_PakPC/fig/Plot15.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-12" title="Figure&nbsp;12: Average Annual Population Growth Rate by Division &amp; District for Sindh"><img src="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot15.webp" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Plot15-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;12: Average Annual Population Growth Rate by Division &amp; District for Sindh
</figcaption></figure>
</div>
<div id="fig-Plot16" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-Plot16-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2025-04-04_PakPC/fig/Plot16.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-13" title="Figure&nbsp;13: Average Annual Population Growth Rate by Division &amp; District for KP"><img src="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot16.webp" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Plot16-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;13: Average Annual Population Growth Rate by Division &amp; District for KP
</figcaption></figure>
</div>
<div id="fig-Plot17" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-Plot17-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2025-04-04_PakPC/fig/Plot17.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-14" title="Figure&nbsp;14: Average Annual Population Growth Rate by Division &amp; District for Balochistan"><img src="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot17.webp" class="img-fluid figure-img" style="width:100.0%"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-Plot17-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;14: Average Annual Population Growth Rate by Division &amp; District for Balochistan
</figcaption></figure>
</div>


</section></section><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2023,
  author = {Yaseen, Muhammad},
  title = {Pakistan {Population} {Census}},
  date = {2023-08-15},
  url = {https://myaseen208.com/blogs/2025-04-04_PakPC/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2023" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2023. <span>“Pakistan Population Census.”</span>
August 15. <a href="https://myaseen208.com/blogs/2025-04-04_PakPC/">https://myaseen208.com/blogs/2025-04-04_PakPC/</a>.
</div></div></section></div> ]]></description>
  <category>R</category>
  <category>Statistics</category>
  <category>Research</category>
  <guid>https://myaseen208.com/blogs/2025-04-04_PakPC/</guid>
  <pubDate>Tue, 15 Aug 2023 04:00:00 GMT</pubDate>
  <media:content url="https://myaseen208.com/assets/img/blogs/2025-04-04_PakPC/fig/Plot1.webp" medium="image" type="image/webp"/>
</item>
<item>
  <title>An Introduction to R Programming Language</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2023-04-18_IntroR/</link>
  <description><![CDATA[ <section id="introduction" class="level2"><h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<blockquote class="blockquote">
<p><strong>R</strong> is a free, open-source programming language and software environment for statistical computing, bioinformatics, visualization and general computing. <strong>R</strong> provides a wide variety of statistical and graphical techniques, and is highly extensible. The latest version of <strong>R</strong> can be obtained from <a href="https://cran.r-project.org/bin/windows/base/">https://cran.r-project.org/bin/windows/base/</a>.</p>
</blockquote>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://cran.r-project.org/bin/windows/base/" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;R</a> <a href="https://cran.r-project.org/bin/windows/base/">R for Windows (32/64 bit)</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://www.rstudio.com/products/rstudio/download/" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;RStudio</a> <a href="https://www.rstudio.com/products/rstudio/download/">RStudio</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;Manual</a> <a href="https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf">An Introduction to R</a> &nbsp;
</h4>
<p>&nbsp;</p>
<iframe width="100%" height="900" src="https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf" title="https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf"></iframe>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://cran.r-project.org/doc/contrib/Short-refcard.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;Ref Card</a> <a href="https://cran.r-project.org/doc/contrib/Short-refcard.pdf">R Reference Card</a> &nbsp;
</h4>
<p>&nbsp;</p>
<iframe width="100%" height="900" src="https://cran.r-project.org/doc/contrib/Short-refcard.pdf" title="https://cran.r-project.org/doc/contrib/Short-refcard.pdf"></iframe>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://github.com/myaseen208/R-Workshop/raw/master/2009NewYorkTimes.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;New York Times</a> <a href="https://github.com/myaseen208/R-Workshop/raw/master/2009NewYorkTimes.pdf">New York Times</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://github.com/myaseen208/R-Workshop/raw/master/2015NatureArticle.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;Nature Article</a> <a href="https://github.com/myaseen208/R-Workshop/raw/master/2015NatureArticle.pdf">Nature Article</a> &nbsp;
</h4>
<p>&nbsp; &nbsp;</p>
</section><section id="slides" class="level2"><h2 class="anchored" data-anchor-id="slides">Slides</h2>
<p>The Slides may be accessed from <a href="https://myaseen208.com/slides/2023-04-17_IntroR/IntroR.html#/title-slide">Slides</a>.</p>
<p>Press f for Fullscreen view.</p>
<iframe width="780" height="500" src="https://myaseen208.com/slides/2023-04-17_IntroR/IntroR.html#/title-slide" title="https://myaseen208.com/slides/2023-04-17_IntroR/IntroR.html#/title-slide"></iframe>


</section><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2023,
  author = {Yaseen, Muhammad},
  title = {An {Introduction} to {R} {Programming} {Language}},
  date = {2023-04-18},
  url = {https://myaseen208.com/blogs/2023-04-18_IntroR/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2023" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2023. <span>“An Introduction to R Programming
Language.”</span> April 18. <a href="https://myaseen208.com/blogs/2023-04-18_IntroR/">https://myaseen208.com/blogs/2023-04-18_IntroR/</a>.
</div></div></section></div> ]]></description>
  <category>R</category>
  <category>Statistics</category>
  <category>Research</category>
  <guid>https://myaseen208.com/blogs/2023-04-18_IntroR/</guid>
  <pubDate>Tue, 18 Apr 2023 04:00:00 GMT</pubDate>
</item>
<item>
  <title>Statistics: The Art &amp; Science of Learning from Data</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2022-05-20_TUF/</link>
  <description><![CDATA[ <div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">knitr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/knitr/man/read_chunk.html">read_chunk</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2022-05-20_TUF.R"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
</div>
<section id="introduction" class="level1"><h1>Introduction</h1>
<section id="statistics" class="level2"><h2 class="anchored" data-anchor-id="statistics">Statistics</h2>
<blockquote class="blockquote">
<ul>
<li>Statistics is the science of uncertainty &amp; variability</li>
<li>Statistics turns data into information</li>
<li>Data -&gt; Information -&gt; Knowledge -&gt; Wisdom</li>
<li>Data Driven Decisions (3Ds)</li>
<li>Statistics is the interpretation of Science</li>
<li>Statistics is the Art &amp; Science of learning from data</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section><section id="variable" class="level2"><h2 class="anchored" data-anchor-id="variable">Variable</h2>
<blockquote class="blockquote">
<ul>
<li>Characteristic that may vary from individual to individual</li>
<li>Height, Weight, CGPA etc</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section><section id="measurement" class="level2"><h2 class="anchored" data-anchor-id="measurement">Measurement</h2>
<blockquote class="blockquote">
<ul>
<li>Process of assigning numbers or labels to objects or states in accordance with logically accepted rules</li>
</ul>
</blockquote>
<div id="fig-TrafficSignals" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-TrafficSignals-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2022-05-20_TUF/fig/TrafficSignals.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-1" title="Figure&nbsp;1: Measurement"><img src="https://myaseen208.com/assets/img/blogs/2022-05-20_TUF/fig/TrafficSignals.webp" class="img-fluid figure-img"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-TrafficSignals-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1: Measurement
</figcaption></figure>
</div>
<p>&nbsp;</p>
</section><section id="measurement-scales" class="level2"><h2 class="anchored" data-anchor-id="measurement-scales">Measurement Scales</h2>
<blockquote class="blockquote">
<ul>
<li>
<strong>Nominal Scale:</strong> Obersvations may be classified into mutually exclusive &amp; exhaustive classes or categories</li>
<li>
<strong>Ordinal Scale:</strong> Obersvations may be ranked</li>
<li>
<strong>Interval Scale:</strong> Difference between obersvations is meaningful</li>
<li>
<strong>Ratio Scale:</strong> Ratio between obersvations is meaningful &amp; true zero point</li>
</ul>
</blockquote>
<div id="fig-MeasurementScales1" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-MeasurementScales1-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2022-05-20_TUF/fig/TypesofMeasurementScales.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-2" title="Figure&nbsp;2: Measurement Scales"><img src="https://myaseen208.com/assets/img/blogs/2022-05-20_TUF/fig/TypesofMeasurementScales.webp" class="img-fluid figure-img"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-MeasurementScales1-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2: Measurement Scales
</figcaption></figure>
</div>
<p>&nbsp;</p>
</section></section><section id="exploring-data-with-graphs-numerical-summaries" class="level1"><h1>Exploring Data with Graphs &amp; Numerical Summaries</h1>
<section id="graphs" class="level2"><h2 class="anchored" data-anchor-id="graphs">Graphs</h2>
</section><section id="numerical-summaries" class="level2"><h2 class="anchored" data-anchor-id="numerical-summaries">Numerical Summaries</h2>
<section id="example" class="level3"><h3 class="anchored" data-anchor-id="example">Example</h3>
<blockquote class="blockquote">
<p>The following data shows the ID, Gender (Male, Female), Age, Race (Mexican American, Non-Hispanic Black, Non-Hispanic White, Other Hispanic, Other/Mixed), BMI, and BMI.Cat (Under Weight, Normal Weight, Over Weight, Obese) from the National Health and Nutrition Examination Survey (NHANES). The survey is conducted by the National Center for Health Statistics (NCHS), and data are publicly available at: <a href="https://www.cdc.gov/nchs/nhanes.htm">https://www.cdc.gov/nchs/nhanes.htm</a> . NHANES data are reported in well over one thousand peer-reviewed journal publications every year.</p>
</blockquote>
</section></section></section><section id="descriptive-statistics" class="level1"><h1>Descriptive Statistics</h1>
<blockquote class="blockquote">
<ul>
<li>Number of Observations</li>
<li>Measures of Central Tendency</li>
<li>Measures of Central Dispersion</li>
<li>Measures of Skewness</li>
<li>Measures of Kurtosis</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-1" class="level3"><h3 class="anchored" data-anchor-id="example-1">Example</h3>
<blockquote class="blockquote">
<p>The following data shows the ID, Gender (Male, Female), Age, Race (Mexican American, Non-Hispanic Black, Non-Hispanic White, Other Hispanic, Other/Mixed), BMI, and BMI.Cat (Under Weight, Normal Weight, Over Weight, Obese) from the National Health and Nutrition Examination Survey (NHANES). The survey is conducted by the National Center for Health Statistics (NCHS), and data are publicly available at: <a href="https://www.cdc.gov/nchs/nhanes.htm">https://www.cdc.gov/nchs/nhanes.htm</a> . NHANES data are reported in well over one thousand peer-reviewed journal publications every year.</p>
</blockquote>
</section></section><section id="correlation-analysis" class="level1"><h1>Correlation Analysis</h1>
<section id="example-2" class="level3"><h3 class="anchored" data-anchor-id="example-2">Example</h3>
<blockquote class="blockquote">
<p>The following data shows the ID, Gender (Male, Female), Age, Race (Mexican American, Non-Hispanic Black, Non-Hispanic White, Other Hispanic, Other/Mixed), BMI, and BMI.Cat (Under Weight, Normal Weight, Over Weight, Obese) from the National Health and Nutrition Examination Survey (NHANES). The survey is conducted by the National Center for Health Statistics (NCHS), and data are publicly available at: <a href="https://www.cdc.gov/nchs/nhanes.htm">https://www.cdc.gov/nchs/nhanes.htm</a> . NHANES data are reported in well over one thousand peer-reviewed journal publications every year.</p>
</blockquote>
<p>&nbsp;</p>
</section></section><section id="an-introduction-to-linear-models" class="level1"><h1>An Introduction to Linear Models</h1>
<section id="regression-analysis" class="level2"><h2 class="anchored" data-anchor-id="regression-analysis">Regression Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on quantitative explanatory variable(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<div id="fig-PopRegFn" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-PopRegFn-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2022-05-20_TUF/fig/PopRegFn.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-3" title="Figure&nbsp;3: Population Regression Function"><img src="https://myaseen208.com/assets/img/blogs/2022-05-20_TUF/fig/PopRegFn.webp" class="img-fluid figure-img"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-PopRegFn-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;3: Population Regression Function
</figcaption></figure>
</div>
<p>&nbsp;</p>
<section id="example-3" class="level3"><h3 class="anchored" data-anchor-id="example-3">Example</h3>
<blockquote class="blockquote">
<p>The following data shows the ID, Gender (Male, Female), Age, Race (Mexican American, Non-Hispanic Black, Non-Hispanic White, Other Hispanic, Other/Mixed), BMI, and BMI.Cat (Under Weight, Normal Weight, Over Weight, Obese) from the National Health and Nutrition Examination Survey (NHANES). The survey is conducted by the National Center for Health Statistics (NCHS), and data are publicly available at: <a href="https://www.cdc.gov/nchs/nhanes.htm">https://www.cdc.gov/nchs/nhanes.htm</a> . NHANES data are reported in well over one thousand peer-reviewed journal publications every year.</p>
</blockquote>
</section></section><section id="analysis-of-variance-anova" class="level2"><h2 class="anchored" data-anchor-id="analysis-of-variance-anova">Analysis of Variance (ANOVA)</h2>
<blockquote class="blockquote">
<ul>
<li>Comparing means of Normal dependent variable for levels of different factor(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<div id="fig-ANOVANormalMeans" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-ANOVANormalMeans-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2022-05-20_TUF/fig/ANOVANormalMeans.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-4" title="Figure&nbsp;4: Analysis of Variance"><img src="https://myaseen208.com/assets/img/blogs/2022-05-20_TUF/fig/ANOVANormalMeans.webp" class="img-fluid figure-img"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-ANOVANormalMeans-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;4: Analysis of Variance
</figcaption></figure>
</div>
<p>&nbsp;</p>
<section id="example-4" class="level3"><h3 class="anchored" data-anchor-id="example-4">Example</h3>
<blockquote class="blockquote">
<p>The following data shows the ID, Gender (Male, Female), Age, Race (Mexican American, Non-Hispanic Black, Non-Hispanic White, Other Hispanic, Other/Mixed), BMI, and BMI.Cat (Under Weight, Normal Weight, Over Weight, Obese) from the National Health and Nutrition Examination Survey (NHANES). The survey is conducted by the National Center for Health Statistics (NCHS), and data are publicly available at: <a href="https://www.cdc.gov/nchs/nhanes.htm">https://www.cdc.gov/nchs/nhanes.htm</a> . NHANES data are reported in well over one thousand peer-reviewed journal publications every year.</p>
</blockquote>
</section></section><section id="analysis-of-covariance-ancova" class="level2"><h2 class="anchored" data-anchor-id="analysis-of-covariance-ancova">Analysis of Covariance (ANCOVA)</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on quantitative explanatory variable(s)</li>
<li>Comparing means of Normal dependent variable for levels of different factor(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<div id="fig-ANCOVA" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-ANCOVA-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2022-05-20_TUF/fig/ANCOVA.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-5" title="Figure&nbsp;5: Analysis of Covariance"><img src="https://myaseen208.com/assets/img/blogs/2022-05-20_TUF/fig/ANCOVA.webp" class="img-fluid figure-img"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-ANCOVA-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;5: Analysis of Covariance
</figcaption></figure>
</div>
<p>&nbsp;</p>
<section id="example-5" class="level3"><h3 class="anchored" data-anchor-id="example-5">Example</h3>
<blockquote class="blockquote">
<p>The following data shows the ID, Gender (Male, Female), Age, Race (Mexican American, Non-Hispanic Black, Non-Hispanic White, Other Hispanic, Other/Mixed), BMI, and BMI.Cat (Under Weight, Normal Weight, Over Weight, Obese) from the National Health and Nutrition Examination Survey (NHANES). The survey is conducted by the National Center for Health Statistics (NCHS), and data are publicly available at: <a href="https://www.cdc.gov/nchs/nhanes.htm">https://www.cdc.gov/nchs/nhanes.htm</a> . NHANES data are reported in well over one thousand peer-reviewed journal publications every year.</p>
</blockquote>
</section></section></section><section id="r-software" class="level1"><h1>R Software</h1>
<div class="callout callout-style-default callout-note no-icon callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<span class="screen-reader-only">Note</span>R Software
</div>
</div>
<div class="callout-body-container callout-body">
<p><code>R</code> is a free, open-source programming language and software environment for statistical computing, bioinformatics, visualization and general computing. <code>R</code> provides a wide variety of statistical and graphical techniques, and is highly extensible. The latest version of <code>R</code> can be obtained from <a href="https://cran.r-project.org/bin/" style="font-size: 13pt;">https://cran.r-project.org/bin/</a>.</p>
</div>
</div>
<section id="rstudio" class="level2"><h2 class="anchored" data-anchor-id="rstudio">RStudio</h2>
<div class="callout callout-style-default callout-note no-icon callout-titled">
<div class="callout-header d-flex align-content-center">
<div class="callout-icon-container">
<i class="callout-icon no-icon"></i>
</div>
<div class="callout-title-container flex-fill">
<span class="screen-reader-only">Note</span>RStudio
</div>
</div>
<div class="callout-body-container callout-body">
<p><code>RStudio</code> is a powerful integrated development environment (IDE) for <code>R</code>, and it can be downloaded from <a href="https://www.rstudio.com/products/rstudio/download/" style="font-size: 13pt;">https://www.rstudio.com/products/rstudio/download/</a>.</p>
</div>
</div>
<div id="fig-IntroR" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-IntroR-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<iframe width="100%" height="600" src="https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf">
</iframe>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-IntroR-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;6: An Introduction to R
</figcaption></figure>
</div>
<section id="r-short-reference-card" class="level3"><h3 class="anchored" data-anchor-id="r-short-reference-card">R Short Reference Card</h3>
<div id="fig-RefCardR" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-RefCardR-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<iframe width="100%" height="600" src="https://cran.r-project.org/doc/contrib/Short-refcard.pdf">
</iframe>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-RefCardR-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;7: R Short Reference Card
</figcaption></figure>
</div>
</section><section id="new-york-times-article-on-r" class="level3"><h3 class="anchored" data-anchor-id="new-york-times-article-on-r">2009 New York Times Article on R</h3>
<div id="fig-NYTR" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-NYTR-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<iframe width="100%" height="600" src="./fig/2009NewYorkTimes.pdf">
</iframe>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-NYTR-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;8: 2009 New York Times Article on R
</figcaption></figure>
</div>
</section><section id="nature-article-on-r" class="level3"><h3 class="anchored" data-anchor-id="nature-article-on-r">2015 Nature Article on R</h3>
<div id="fig-NatureArticleR" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-NatureArticleR-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<iframe width="100%" height="600" src="./fig/2015NatureArticle.pdf">
</iframe>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig" id="fig-NatureArticleR-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;9: 2015 Nature Article on R
</figcaption></figure>
</div>


</section></section></section><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2022,
  author = {Yaseen, Muhammad and Yaseen, Muhammad},
  title = {Statistics: {The} {Art} \&amp; {Science} of {Learning} from
    {Data}},
  date = {2022-05-20},
  url = {https://myaseen208.com/blogs/2022-05-20_TUF/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2022" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad, and Muhammad Yaseen. 2022. <span>“Statistics: The Art
&amp; Science of Learning from Data.”</span> May 20. <a href="https://myaseen208.com/blogs/2022-05-20_TUF/">https://myaseen208.com/blogs/2022-05-20_TUF/</a>.
</div></div></section></div> ]]></description>
  <category>Data Science</category>
  <category>Statistics</category>
  <category>Biostatistics</category>
  <category>Bioinformatics</category>
  <category>Research</category>
  <category>R</category>
  <guid>https://myaseen208.com/blogs/2022-05-20_TUF/</guid>
  <pubDate>Fri, 20 May 2022 04:00:00 GMT</pubDate>
  <media:content url="https://myaseen208.com/assets/img/blogs/2022-05-20_TUF/fig/TrafficSignals.webp" medium="image" type="image/webp"/>
</item>
<item>
  <title>Design &amp; Analysis of Field Experiments using R</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2020-02-06_UAF/</link>
  <description><![CDATA[ <section id="introduction" class="level2"><h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<blockquote class="blockquote">
<p><strong>R</strong> is a free, open-source programming language and software environment for statistical computing, bioinformatics, visualization and general computing. <strong>R</strong> provides a wide variety of statistical and graphical techniques, and is highly extensible. The latest version of <strong>R</strong> can be obtained from <a href="https://cran.r-project.org/bin/windows/base/">https://cran.r-project.org/bin/windows/base/</a>.</p>
</blockquote>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://cran.r-project.org/bin/windows/base/" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;R</a> <a href="https://cran.r-project.org/bin/windows/base/">R for Windows (32/64 bit)</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://www.rstudio.com/products/rstudio/download/" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;RStudio</a> <a href="https://www.rstudio.com/products/rstudio/download/">RStudio</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;Manual</a> <a href="https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf">An Introduction to R</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://cran.r-project.org/doc/contrib/Short-refcard.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;Ref Card</a> <a href="https://cran.r-project.org/doc/contrib/Short-refcard.pdf">R Reference Card</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://github.com/myaseen208/R-Workshop/raw/master/2009NewYorkTimes.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;New York Times</a> <a href="https://github.com/myaseen208/R-Workshop/raw/master/2009NewYorkTimes.pdf">New York Times</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://github.com/myaseen208/R-Workshop/raw/master/2015NatureArticle.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;Nature Article</a> <a href="https://github.com/myaseen208/R-Workshop/raw/master/2015NatureArticle.pdf">Nature Article</a> &nbsp;
</h4>
<p>&nbsp;</p>
</section><section id="regression-analysis" class="level2"><h2 class="anchored" data-anchor-id="regression-analysis">Regression Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on quantitative explanatory variable(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<div id="fig-PopRegFn" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-PopRegFn-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2020-02-06_UAF/fig/PopRegFn.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-1" title="Figure&nbsp;1: "><img src="https://myaseen208.com/assets/img/blogs/2020-02-06_UAF/fig/PopRegFn.webp" class="img-fluid figure-img"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig quarto-uncaptioned" id="fig-PopRegFn-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1
</figcaption></figure>
</div>
<p>&nbsp;</p>
</section><section id="simple-linear-regression" class="level2"><h2 class="anchored" data-anchor-id="simple-linear-regression">Simple Linear Regression</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on a quantitative explanatory variable</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example" class="level3"><h3 class="anchored" data-anchor-id="example">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Fertilizer (Kg/acre)</th>
<th>Production (Bushels/acre)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>100</td>
<td>70</td>
</tr>
<tr class="even">
<td>200</td>
<td>70</td>
</tr>
<tr class="odd">
<td>400</td>
<td>80</td>
</tr>
<tr class="even">
<td>500</td>
<td>100</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Fertilizer (Kg/acre)</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Production (Bushels/acre)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">400</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">500</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Production</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Production</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Fertilizer Production
1        100         70
2        200         70
3        400         80
4        500        100</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Production</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fertilizer"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Production"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p1-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-2"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/reg.p1-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Production</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Production ~ Fertilizer, data = df1)

Residuals:
 1  2  3  4 
 4 -3 -7  6 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)  
(Intercept) 59.00000    7.95299   7.419   0.0177 *
Fertilizer   0.07000    0.02345   2.985   0.0963 .
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 7.416 on 2 degrees of freedom
Multiple R-squared:  0.8167,    Adjusted R-squared:  0.725 
F-statistic: 8.909 on 1 and 2 DF,  p-value: 0.0963</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Production
           Df Sum Sq Mean Sq F value Pr(&gt;F)  
Fertilizer  1    490     490  8.9091 0.0963 .
Residuals   2    110      55                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section><section id="example-1" class="level3"><h3 class="anchored" data-anchor-id="example-1">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Fertilizer</th>
<th>Yield</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>0.3</td>
<td>10</td>
</tr>
<tr class="even">
<td>0.6</td>
<td>15</td>
</tr>
<tr class="odd">
<td>0.9</td>
<td>30</td>
</tr>
<tr class="even">
<td>1.2</td>
<td>35</td>
</tr>
<tr class="odd">
<td>1.5</td>
<td>25</td>
</tr>
<tr class="even">
<td>1.8</td>
<td>30</td>
</tr>
<tr class="odd">
<td>2.1</td>
<td>50</td>
</tr>
<tr class="even">
<td>2.4</td>
<td>45</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb8" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.3</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.6</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.9</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">35</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">45</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df2</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df2</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Fert Yield
1  0.3    10
2  0.6    15
3  0.9    30
4  1.2    35
5  1.5    25
6  1.8    30
7  2.1    50
8  2.4    45</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb10" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df2</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fertilizer"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p2-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-3"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/reg.p2-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb11" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fert, data = df2)

Residuals:
   Min     1Q Median     3Q    Max 
-7.441 -4.018 -2.441  7.351  7.798 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)   
(Intercept)    8.036      5.504   1.460   0.1946   
Fert          16.270      3.633   4.478   0.0042 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 7.064 on 6 degrees of freedom
Multiple R-squared:  0.7697,    Adjusted R-squared:  0.7313 
F-statistic: 20.05 on 1 and 6 DF,  p-value: 0.004202</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb13" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value   Pr(&gt;F)   
Fert       1 1000.6  1000.6  20.052 0.004202 **
Residuals  6  299.4    49.9                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section><section id="example-2" class="level3"><h3 class="anchored" data-anchor-id="example-2">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Weekly Income ($)</th>
<th>Weekly Expenditures ($)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>80</td>
<td>70</td>
</tr>
<tr class="even">
<td>100</td>
<td>65</td>
</tr>
<tr class="odd">
<td>120</td>
<td>90</td>
</tr>
<tr class="even">
<td>140</td>
<td>95</td>
</tr>
<tr class="odd">
<td>160</td>
<td>110</td>
</tr>
<tr class="even">
<td>180</td>
<td>115</td>
</tr>
<tr class="odd">
<td>200</td>
<td>120</td>
</tr>
<tr class="even">
<td>220</td>
<td>140</td>
</tr>
<tr class="odd">
<td>240</td>
<td>155</td>
</tr>
<tr class="even">
<td>260</td>
<td>150</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb15" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Weekly Income ($) of a Family</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Weekly Expenditures ($) of a Family</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Income</span>       <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/seq.html">seq</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>from <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, to <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">260</span>, by <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Expenditures</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">65</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">90</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">95</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">110</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">115</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">120</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">140</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">155</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">150</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Income</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Expenditures</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Income Expenditures
1      80           70
2     100           65
3     120           90
4     140           95
5     160          110
6     180          115
7     200          120
8     220          140
9     240          155
10    260          150</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb17" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p3</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Income</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Expenditures</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_x_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/dollar_format.html">dollar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/dollar_format.html">dollar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Weekly income, $"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Weekly consumption expenditures, $"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p3-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-4"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/reg.p3-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb18" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm3</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Expenditures</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Income</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Expenditures ~ Income, data = df3)

Residuals:
    Min      1Q  Median      3Q     Max 
-10.364  -4.977   1.409   4.364   8.364 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept) 24.45455    6.41382   3.813  0.00514 ** 
Income       0.50909    0.03574  14.243 5.75e-07 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 6.493 on 8 degrees of freedom
Multiple R-squared:  0.9621,    Adjusted R-squared:  0.9573 
F-statistic: 202.9 on 1 and 8 DF,  p-value: 5.753e-07</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb20" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Expenditures
          Df Sum Sq Mean Sq F value    Pr(&gt;F)    
Income     1 8552.7  8552.7  202.87 5.753e-07 ***
Residuals  8  337.3    42.2                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="multiple-linear-regression" class="level2"><h2 class="anchored" data-anchor-id="multiple-linear-regression">Multiple Linear Regression</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on two or more quantitative explanatory variables</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-3" class="level3"><h3 class="anchored" data-anchor-id="example-3">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Fertilizer (Kg)</th>
<th>Rainfall (mm)</th>
<th>Yield (Kg)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>100</td>
<td>10</td>
<td>40</td>
</tr>
<tr class="even">
<td>200</td>
<td>20</td>
<td>50</td>
</tr>
<tr class="odd">
<td>300</td>
<td>10</td>
<td>50</td>
</tr>
<tr class="even">
<td>400</td>
<td>30</td>
<td>70</td>
</tr>
<tr class="odd">
<td>500</td>
<td>20</td>
<td>65</td>
</tr>
<tr class="even">
<td>600</td>
<td>20</td>
<td>65</td>
</tr>
<tr class="odd">
<td>700</td>
<td>30</td>
<td>80</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb22" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Fertilizer (Kg)</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Rainfall (mm)</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Yield (Kg)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/seq.html">seq</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>from <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, to <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">700</span>, by <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rainfall</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">40</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">65</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">65</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rainfall</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Fertilizer Rainfall Yield
1        100       10    40
2        200       20    50
3        300       10    50
4        400       30    70
5        500       20    65
6        600       20    65
7        700       30    80</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb24" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rainfall</span>, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.8</span>, size <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_viridis.html">scale_color_viridis_c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_minimal</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p4-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-5"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/reg.p4-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb25" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm4</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rainfall</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fertilizer + Rainfall, data = df4)

Residuals:
      1       2       3       4       5       6       7 
-0.2381 -2.3810  2.1429  1.6667  1.1905 -2.6190  0.2381 

Coefficients:
             Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept) 28.095238   2.491482  11.277 0.000352 ***
Fertilizer   0.038095   0.005832   6.532 0.002838 ** 
Rainfall     0.833333   0.154303   5.401 0.005690 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.315 on 4 degrees of freedom
Multiple R-squared:  0.9814,    Adjusted R-squared:  0.972 
F-statistic: 105.3 on 2 and 4 DF,  p-value: 0.0003472</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb27" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
           Df Sum Sq Mean Sq F value    Pr(&gt;F)    
Fertilizer  1 972.32  972.32 181.500 0.0001756 ***
Rainfall    1 156.25  156.25  29.167 0.0056899 ** 
Residuals   4  21.43    5.36                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb29" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">lm.beta</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/lm.beta/man/lm.beta.html">lm.beta</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fertilizer + Rainfall, data = df4)

Standardized Coefficients::
(Intercept)  Fertilizer    Rainfall 
         NA   0.5944301   0.4914732 </code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="polynomial-regression-analysis" class="level2"><h2 class="anchored" data-anchor-id="polynomial-regression-analysis">Polynomial Regression Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying non-linear dependency of a normal response on quantitative explanatory variable(s)</li>
</ul>
</blockquote>
<section id="example-4" class="level3"><h3 class="anchored" data-anchor-id="example-4">Example</h3>
<blockquote class="blockquote">
<p>An experiment was conducted to evaluate the effects of different levels of nitrogen. Three levels of nitrogen: 0, 10 and 20 grams per plot were used in the experiment. Each treatment was replicated twice and data is given below:</p>
</blockquote>
<table class="caption-top table">
<thead><tr class="header">
<th>Nitrogen</th>
<th>Yield</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>0</td>
<td>5</td>
</tr>
<tr class="even">
<td>0</td>
<td>7</td>
</tr>
<tr class="odd">
<td>10</td>
<td>15</td>
</tr>
<tr class="even">
<td>10</td>
<td>17</td>
</tr>
<tr class="odd">
<td>20</td>
<td>9</td>
</tr>
<tr class="even">
<td>20</td>
<td>11</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb31" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">11</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Nitrogen Yield
1        0     5
2        0     7
3       10    15
4       10    17
5       20     9
6       20    11</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb33" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nitrogen"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p5-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-6"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/reg.p5-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb34" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/AsIs.html">I</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># fm5 &lt;- lm(formula = Yield ~ poly(x = Nitrogen, degree = 2, raw = TRUE), data = df5)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Nitrogen + I(Nitrogen^2), data = df5)

Residuals:
 1  2  3  4  5  6 
-1  1 -1  1 -1  1 

Coefficients:
              Estimate Std. Error t value Pr(&gt;|t|)   
(Intercept)    6.00000    1.00000   6.000  0.00927 **
Nitrogen       1.80000    0.25495   7.060  0.00584 **
I(Nitrogen^2) -0.08000    0.01225  -6.532  0.00729 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.414 on 3 degrees of freedom
Multiple R-squared:  0.9441,    Adjusted R-squared:  0.9068 
F-statistic: 25.33 on 2 and 3 DF,  p-value: 0.01322</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb36" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
              Df Sum Sq Mean Sq F value   Pr(&gt;F)   
Nitrogen       1 16.000  16.000   8.000 0.066276 . 
I(Nitrogen^2)  1 85.333  85.333  42.667 0.007292 **
Residuals      3  6.000   2.000                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="analysis-of-variance-anova" class="level2"><h2 class="anchored" data-anchor-id="analysis-of-variance-anova">Analysis of Variance (ANOVA)</h2>
<blockquote class="blockquote">
<ul>
<li>Comparing means of Normal dependent variable for levels of different factor(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<div id="fig-ANOVANormalMeans" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-ANOVANormalMeans-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2020-02-06_UAF/fig/ANOVANormalMeans.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-7" title="Figure&nbsp;2: "><img src="https://myaseen208.com/assets/img/blogs/2020-02-06_UAF/fig/ANOVANormalMeans.webp" class="img-fluid figure-img"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig quarto-uncaptioned" id="fig-ANOVANormalMeans-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2
</figcaption></figure>
</div>
<p>&nbsp;</p>
<section id="example-5" class="level3"><h3 class="anchored" data-anchor-id="example-5">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Yield</th>
<th>Variety</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>5</td>
<td>V1</td>
</tr>
<tr class="even">
<td>6</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>7</td>
<td>V1</td>
</tr>
<tr class="even">
<td>15</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>16</td>
<td>V2</td>
</tr>
<tr class="even">
<td>17</td>
<td>V2</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb38" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V1"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V2"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span>     <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Yield Variety
1     5      V1
2     6      V1
3     7      V1
4    15      V2
5    16      V2
6    17      V2</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb40" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p6</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Variety"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p6</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/anova.p6-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-8"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/anova.p6-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb41" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm6</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm6</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Variety, data = df6)

Residuals:
         1          2          3          4          5          6 
-1.000e+00 -4.774e-15  1.000e+00 -1.000e+00 -1.110e-16  1.000e+00 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)   6.0000     0.5774   10.39 0.000484 ***
VarietyV2    10.0000     0.8165   12.25 0.000255 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1 on 4 degrees of freedom
Multiple R-squared:  0.974, Adjusted R-squared:  0.9675 
F-statistic:   150 on 1 and 4 DF,  p-value: 0.0002552</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb43" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm6</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value    Pr(&gt;F)    
Variety    1    150     150     150 0.0002552 ***
Residuals  4      4       1                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section><section id="example-6" class="level3"><h3 class="anchored" data-anchor-id="example-6">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Yield</th>
<th>Variety</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>5</td>
<td>V1</td>
</tr>
<tr class="even">
<td>7</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>15</td>
<td>V2</td>
</tr>
<tr class="even">
<td>17</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>17</td>
<td>V3</td>
</tr>
<tr class="even">
<td>19</td>
<td>V3</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb45" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">19</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V1"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V2"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V3"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span>     <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Yield Variety
1     5      V1
2     7      V1
3    15      V2
4    17      V2
5    17      V3
6    19      V3</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb47" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p7</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Variety"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p7</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/anova.p7-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-9"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/anova.p7-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb48" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm7</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm7</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Variety, data = df7)

Residuals:
 1  2  3  4  5  6 
-1  1 -1  1 -1  1 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)   
(Intercept)    6.000      1.000   6.000  0.00927 **
VarietyV2     10.000      1.414   7.071  0.00582 **
VarietyV3     12.000      1.414   8.485  0.00344 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.414 on 3 degrees of freedom
Multiple R-squared:  0.965, Adjusted R-squared:  0.9416 
F-statistic: 41.33 on 2 and 3 DF,  p-value: 0.006553</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb50" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm7</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value   Pr(&gt;F)   
Variety    2 165.33  82.667  41.333 0.006553 **
Residuals  3   6.00   2.000                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="analysis-of-covariance-ancova" class="level2"><h2 class="anchored" data-anchor-id="analysis-of-covariance-ancova">Analysis of Covariance (ANCOVA)</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on quantitative explanatory variable(s)</li>
<li>Comparing means of Normal dependent variable for levels of different factor(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<div id="fig-ANCOVA" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-ANCOVA-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2020-02-06_UAF/fig/ANCOVA.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-10" title="Figure&nbsp;3: "><img src="https://myaseen208.com/assets/img/blogs/2020-02-06_UAF/fig/ANCOVA.webp" class="img-fluid figure-img"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig quarto-uncaptioned" id="fig-ANCOVA-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;3
</figcaption></figure>
</div>
<p>&nbsp;</p>
<section id="example-7" class="level3"><h3 class="anchored" data-anchor-id="example-7">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Yield</th>
<th>Fert</th>
<th>Variety</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>51</td>
<td>80</td>
<td>V1</td>
</tr>
<tr class="even">
<td>52</td>
<td>80</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>53</td>
<td>90</td>
<td>V1</td>
</tr>
<tr class="even">
<td>54</td>
<td>90</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>56</td>
<td>100</td>
<td>V1</td>
</tr>
<tr class="even">
<td>57</td>
<td>100</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>55</td>
<td>80</td>
<td>V2</td>
</tr>
<tr class="even">
<td>56</td>
<td>80</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>58</td>
<td>90</td>
<td>V2</td>
</tr>
<tr class="even">
<td>59</td>
<td>90</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>62</td>
<td>100</td>
<td>V2</td>
</tr>
<tr class="even">
<td>63</td>
<td>100</td>
<td>V2</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb52" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">51</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">52</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">53</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">54</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">56</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">57</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">55</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">56</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">58</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">59</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">62</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">63</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>     <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">90</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, each <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V1"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V2"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, ordered <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span>         <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Yield Fert Variety
1     51   80      V1
2     52   80      V1
3     53   90      V1
4     54   90      V1
5     56  100      V1
6     57  100      V1
7     55   80      V2
8     56   80      V2
9     58   90      V2
10    59   90      V2
11    62  100      V2
12    63  100      V2</code></pre>
</div>
</div>
</section><section id="same-intercepts-but-different-slopes" class="level3"><h3 class="anchored" data-anchor-id="same-intercepts-but-different-slopes">Same intercepts but different slopes</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb54" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm8</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fert + Variety, data = df8)

Residuals:
    Min      1Q  Median      3Q     Max 
-0.8333 -0.8333  0.1667  0.1667  1.1667 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept) 26.83333    2.54557   10.54 2.30e-06 ***
Fert         0.30000    0.02805   10.69 2.04e-06 ***
VarietyV2    5.00000    0.45812   10.91 1.72e-06 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.7935 on 9 degrees of freedom
Multiple R-squared:  0.9629,    Adjusted R-squared:  0.9546 
F-statistic: 116.7 on 2 and 9 DF,  p-value: 3.657e-07</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb56" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value    Pr(&gt;F)    
Fert       1 72.000   72.00  114.35 2.042e-06 ***
Variety    1 75.000   75.00  119.12 1.720e-06 ***
Residuals  9  5.667    0.63                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb58" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p8</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_path.html">geom_line</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/predict.html">predict</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fert"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/ancova.p8-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-11"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/ancova.p8-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<p>&nbsp;</p>
</section><section id="different-intercepts-and-different-slopes" class="level3"><h3 class="anchored" data-anchor-id="different-intercepts-and-different-slopes">Different intercepts and different slopes</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb59" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm9</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fert * Variety, data = df8)

Residuals:
     Min       1Q   Median       3Q      Max 
-0.83333 -0.33333 -0.08333  0.66667  0.66667 

Coefficients:
               Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)    31.33333    3.05903  10.243 7.09e-06 ***
Fert            0.25000    0.03385   7.385 7.73e-05 ***
VarietyV2      -4.00000    4.32612  -0.925   0.3822    
Fert:VarietyV2  0.10000    0.04787   2.089   0.0701 .  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.677 on 8 degrees of freedom
Multiple R-squared:  0.976, Adjusted R-squared:  0.967 
F-statistic: 108.4 on 3 and 8 DF,  p-value: 8.11e-07</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb61" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
             Df Sum Sq Mean Sq  F value    Pr(&gt;F)    
Fert          1 72.000  72.000 157.0909 1.538e-06 ***
Variety       1 75.000  75.000 163.6364 1.315e-06 ***
Fert:Variety  1  2.000   2.000   4.3636   0.07013 .  
Residuals     8  3.667   0.458                       
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb63" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p9</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_path.html">geom_line</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/predict.html">predict</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fert"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/ancova.p9-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-12"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/ancova.p9-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section></section><section id="correlation-analysis" class="level2"><h2 class="anchored" data-anchor-id="correlation-analysis">Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Quantitative Variables</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section><section id="simple-correlation-analysis" class="level2"><h2 class="anchored" data-anchor-id="simple-correlation-analysis">Simple Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Two Quantitative Variables</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cleft(X_%7B1%7D,X_%7B2%7D%5Cright)"></li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-8" class="level3"><h3 class="anchored" data-anchor-id="example-8">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Sparrow Wing length (cm)</th>
<th>Sparrow Tail length (cm)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>10.4</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.8</td>
<td>7.6</td>
</tr>
<tr class="odd">
<td>11.1</td>
<td>7.9</td>
</tr>
<tr class="even">
<td>10.2</td>
<td>7.2</td>
</tr>
<tr class="odd">
<td>10.3</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.2</td>
<td>7.1</td>
</tr>
<tr class="odd">
<td>10.7</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.5</td>
<td>7.2</td>
</tr>
<tr class="odd">
<td>10.8</td>
<td>7.8</td>
</tr>
<tr class="even">
<td>11.2</td>
<td>7.7</td>
</tr>
<tr class="odd">
<td>10.6</td>
<td>7.8</td>
</tr>
<tr class="even">
<td>11.4</td>
<td>8.3</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb64" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">11.1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.3</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">11.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.6</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">11.4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.6</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.9</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">8.3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   WingLength TailLength
1        10.4        7.4
2        10.8        7.6
3        11.1        7.9
4        10.2        7.2
5        10.3        7.4
6        10.2        7.1
7        10.7        7.4
8        10.5        7.2
9        10.8        7.8
10       11.2        7.7
11       10.6        7.8
12       11.4        8.3</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb66" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p10</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Sparrow Wing Length (cm)"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Sparrow Tail Length (cm)"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/corr.p10-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-13"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/corr.p10-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb67" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/cor.html">cor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 0.8703546</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb69" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/cor.test.html">cor.test</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
    Pearson's product-moment correlation

data:  df10$WingLength and df10$TailLength
t = 5.5893, df = 10, p-value = 0.0002311
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.5923111 0.9631599
sample estimates:
      cor 
0.8703546 </code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="partial-correlation-analysis" class="level2"><h2 class="anchored" data-anchor-id="partial-correlation-analysis">Partial Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Quantitative Variables while holding/keeping all other constants</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cleft(X_%7B1%7D,X_%7B2%7D%5Cright)%7CX_%7B3%7D"></li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-9" class="level3"><h3 class="anchored" data-anchor-id="example-9">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Leaf Area (cm^2)</th>
<th>Leaf Moisture (%)</th>
<th>Total Shoot Length (cm)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>72</td>
<td>80</td>
<td>307</td>
</tr>
<tr class="even">
<td>174</td>
<td>75</td>
<td>529</td>
</tr>
<tr class="odd">
<td>116</td>
<td>81</td>
<td>632</td>
</tr>
<tr class="even">
<td>78</td>
<td>83</td>
<td>527</td>
</tr>
<tr class="odd">
<td>134</td>
<td>79</td>
<td>442</td>
</tr>
<tr class="even">
<td>95</td>
<td>81</td>
<td>525</td>
</tr>
<tr class="odd">
<td>113</td>
<td>80</td>
<td>481</td>
</tr>
<tr class="even">
<td>98</td>
<td>81</td>
<td>710</td>
</tr>
<tr class="odd">
<td>148</td>
<td>74</td>
<td>422</td>
</tr>
<tr class="even">
<td>42</td>
<td>78</td>
<td>345</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb71" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafArea</span>    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">72</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">174</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">116</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">78</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">134</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">95</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">113</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">98</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">148</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">42</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafMoist</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">75</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">81</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">83</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">79</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">81</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">81</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">74</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">78</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">58</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TotShLength</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">307</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">529</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">632</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">527</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">442</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">525</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">481</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">710</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">422</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">345</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df11</span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafArea</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafMoist</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TotShLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df11</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   LeafArea LeafMoist TotShLength
1        72        75         307
2       174        81         529
3       116        83         632
4        78        79         527
5       134        81         442
6        95        80         525
7       113        81         481
8        98        74         710
9       148        78         422
10       42        58         345</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb73" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ppcor</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/ppcor/man/pcor.html">pcor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df11</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$estimate
                LeafArea LeafMoist  TotShLength
LeafArea     1.000000000 0.6509096 -0.007012236
LeafMoist    0.650909618 1.0000000  0.324334659
TotShLength -0.007012236 0.3243347  1.000000000

$p.value
              LeafArea  LeafMoist TotShLength
LeafArea    0.00000000 0.05760462   0.9857154
LeafMoist   0.05760462 0.00000000   0.3944839
TotShLength 0.98571537 0.39448385   0.0000000

$statistic
               LeafArea LeafMoist TotShLength
LeafArea     0.00000000  2.268502 -0.01855309
LeafMoist    2.26850175  0.000000  0.90714704
TotShLength -0.01855309  0.907147  0.00000000

$n
[1] 10

$gp
[1] 1

$method
[1] "pearson"</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="multiple-correlation-analysis" class="level2"><h2 class="anchored" data-anchor-id="multiple-correlation-analysis">Multiple Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between a Quantitative Variable and set of other Quantitative Variables</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cleft(X_%7B1%7D,%5Cleft%5BX_%7B2%7D,X_%7B3%7D%5Cright%5D%5Cright)"></li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-10" class="level3"><h3 class="anchored" data-anchor-id="example-10">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Leaf Area (cm^2)</th>
<th>Leaf Moisture (%)</th>
<th>Total Shoot Length (cm)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>72</td>
<td>80</td>
<td>307</td>
</tr>
<tr class="even">
<td>174</td>
<td>75</td>
<td>529</td>
</tr>
<tr class="odd">
<td>116</td>
<td>81</td>
<td>632</td>
</tr>
<tr class="even">
<td>78</td>
<td>83</td>
<td>527</td>
</tr>
<tr class="odd">
<td>134</td>
<td>79</td>
<td>442</td>
</tr>
<tr class="even">
<td>95</td>
<td>81</td>
<td>525</td>
</tr>
<tr class="odd">
<td>113</td>
<td>80</td>
<td>481</td>
</tr>
<tr class="even">
<td>98</td>
<td>81</td>
<td>710</td>
</tr>
<tr class="odd">
<td>148</td>
<td>74</td>
<td>422</td>
</tr>
<tr class="even">
<td>42</td>
<td>78</td>
<td>345</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb75" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm12</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TotShLength</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafArea</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafMoist</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df11</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/MathFun.html">sqrt</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm12</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">r.squared</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 0.421277</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="completely-randomized-design-crd" class="level2"><h2 class="anchored" data-anchor-id="completely-randomized-design-crd">Completely Randomized Design (CRD)</h2>
<blockquote class="blockquote">
<ul>
<li>Used when experimental material is homogeneous</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-11" class="level3"><h3 class="anchored" data-anchor-id="example-11">Example</h3>
<blockquote class="blockquote">
<p>The following table shows some of the results of an experiment on the effects of applications of sulphur in reducing scab disease of potatoes. The object in applying sulphur is to increase the acidity of the soil, since scab does not thrive in very acid soil. In addition to untreated plots which serve as a control, 3 amounts of dressing were compared—300, 600, and 900 lb. per acre. Both a fall and a spring application of each amount was tested, so that in all there were seven distinct treatments. The sulphur was spread by hand on the surface of the soil, and then diced into a depth of about 4 inches. The quantity to be analyzed is the “scab index”. That is roughly speaking, the percentage of the surface area of the potato that is infected with scab. It is obtained by examining 100 potatoes at random from each plot, grading each potato on a scale from 0 to 100% infected, and taking the average.</p>
</blockquote>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb77" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ScabIndex</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span>      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">29</span>, </span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">32</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">26</span>, </span>
<span>         <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">21</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">19</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span></span>
<span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/factor.html">factor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>          x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, times <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>        , labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"O"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"F3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"S3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"F6"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"S6"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"F9"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"S9"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df13</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ScabIndex</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df13</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Trt ScabIndex
1    O        12
2    O        10
3    O        24
4    O        29
5    O        30
6    O        18
7    O        32
8    O        26
9   F3         9
10  F3         9
11  F3        16
12  F3         4
13  S3        30
14  S3         7
15  S3        21
16  S3         9
17  F6        16
18  F6        10
19  F6        18
20  F6        18
21  S6        18
22  S6        24
23  S6        12
24  S6        19
25  F9        10
26  F9         4
27  F9         4
28  F9         5
29  S9        17
30  S9         7
31  S9        16
32  S9        17</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb79" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p13</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df13</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ScabIndex</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Treatment"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Scab Index"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p13</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/crd.p13-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-14"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/crd.p13-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb80" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm13</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ScabIndex</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df13</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm13</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = ScabIndex ~ Trt, data = df13)

Residuals:
    Min      1Q  Median      3Q     Max 
-12.625  -4.844   0.625   3.594  13.250 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)   22.625      2.369   9.549 8.08e-10 ***
TrtF3        -13.125      4.104  -3.198 0.003734 ** 
TrtS3         -5.875      4.104  -1.432 0.164666    
TrtF6         -7.125      4.104  -1.736 0.094858 .  
TrtS6         -4.375      4.104  -1.066 0.296601    
TrtF9        -16.875      4.104  -4.112 0.000372 ***
TrtS9         -8.375      4.104  -2.041 0.051977 .  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 6.702 on 25 degrees of freedom
Multiple R-squared:  0.4641,    Adjusted R-squared:  0.3355 
F-statistic: 3.608 on 6 and 25 DF,  p-value: 0.01026</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb82" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm13</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: ScabIndex
          Df  Sum Sq Mean Sq F value  Pr(&gt;F)  
Trt        6  972.34 162.057  3.6081 0.01026 *
Residuals 25 1122.88  44.915                  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="randomized-complete-block-design-rcbd" class="level2"><h2 class="anchored" data-anchor-id="randomized-complete-block-design-rcbd">Randomized Complete Block Design (RCBD)</h2>
<blockquote class="blockquote">
<ul>
<li>Used when experimental material is heterogenous in one direction</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-12" class="level3"><h3 class="anchored" data-anchor-id="example-12">Example</h3>
<blockquote class="blockquote">
<p>Yield : Yield of barley, SoilType : Soil Type, and Trt : 5 sources and a control</p>
</blockquote>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb84" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>             <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">32.1</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">35.6</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">41.9</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">35.4</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30.1</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.5</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">37.1</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30.8</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">25.4</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">27.4</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">33.8</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.1</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24.1</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">33.0</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">35.6</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.4</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">26.1</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.0</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">33.8</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.9</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">23.2</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24.8</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">26.7</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">26.7</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">SoilType</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span></span>
<span>               , labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"I"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"II"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"III"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"IV"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, ordered <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span></span>
<span>               , labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"(NH4)2SO4"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NH4NO3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"CO(NH2)2"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Ca(NO3)2"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NaNO3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Control"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, ordered <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df14</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">SoilType</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df14</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Yield SoilType       Trt
1   32.1        I (NH4)2SO4
2   35.6        I    NH4NO3
3   41.9        I  CO(NH2)2
4   35.4        I  Ca(NO3)2
5   30.1        I     NaNO3
6   31.5        I   Control
7   37.1       II (NH4)2SO4
8   30.8       II    NH4NO3
9   25.4       II  CO(NH2)2
10  27.4       II  Ca(NO3)2
11  33.8       II     NaNO3
12  31.1       II   Control
13  24.1      III (NH4)2SO4
14  33.0      III    NH4NO3
15  35.6      III  CO(NH2)2
16  31.4      III  Ca(NO3)2
17  26.1      III     NaNO3
18  31.0      III   Control
19  33.8       IV (NH4)2SO4
20  31.9       IV    NH4NO3
21  23.2       IV  CO(NH2)2
22  24.8       IV  Ca(NO3)2
23  26.7       IV     NaNO3
24  26.7       IV   Control</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb86" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p14</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df14</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Treatment"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p14</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/rcbd.p14-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-15"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/rcbd.p14-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb87" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm14</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">SoilType</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df14</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm14</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ SoilType + Trt, data = df14)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.0208 -2.4229  0.0792  2.1354  6.7958 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)   35.354      2.826  12.511 2.44e-09 ***
SoilTypeII    -3.500      2.664  -1.314   0.2087    
SoilTypeIII   -4.233      2.664  -1.589   0.1329    
SoilTypeIV    -6.583      2.664  -2.471   0.0259 *  
TrtNH4NO3      1.050      3.263   0.322   0.7521    
TrtCO(NH2)2   -0.250      3.263  -0.077   0.9399    
TrtCa(NO3)2   -2.025      3.263  -0.621   0.5442    
TrtNaNO3      -2.600      3.263  -0.797   0.4380    
TrtControl    -1.700      3.263  -0.521   0.6100    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.615 on 15 degrees of freedom
Multiple R-squared:  0.3512,    Adjusted R-squared:  0.005215 
F-statistic: 1.015 on 8 and 15 DF,  p-value: 0.4653</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb89" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm14</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value Pr(&gt;F)
SoilType   3 133.62  44.539  2.0915 0.1443
Trt        5  39.31   7.862  0.3692 0.8618
Residuals 15 319.43  21.295               </code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="latin-square-design" class="level2"><h2 class="anchored" data-anchor-id="latin-square-design">Latin Square Design</h2>
<blockquote class="blockquote">
<ul>
<li>Used when experimental material is heterogenous in two perpendicular directions</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-13" class="level3"><h3 class="anchored" data-anchor-id="example-13">Example</h3>
<blockquote class="blockquote">
<p>The following table shows the field layout and yield of a 5×5 Latin square experiment on the effect of spacing on yield of millet plants. Five levels of spacing were used. The data on yield (grams/plot) was recorded and is given below:</p>
</blockquote>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb91" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">257</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">230</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">279</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">287</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">202</span>,</span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">245</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">283</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">245</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">280</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">260</span>,</span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">182</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">252</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">280</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">246</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">250</span>,</span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">203</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">204</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">227</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">193</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">259</span>,</span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">231</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">271</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">266</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">334</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">338</span></span>
<span>           <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Row</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/factor.html">factor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, each <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Col</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/factor.html">factor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, times <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>          <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span></span>
<span>        , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span></span>
<span>        , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span></span>
<span>        , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span></span>
<span>        , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span></span>
<span>         <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df15</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Row</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Col</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df15</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Yield Row Col Trt
1    257   1   1   B
2    230   1   2   E
3    279   1   3   A
4    287   1   4   C
5    202   1   5   D
6    245   2   1   D
7    283   2   2   A
8    245   2   3   E
9    280   2   4   B
10   260   2   5   C
11   182   3   1   E
12   252   3   2   B
13   280   3   3   C
14   246   3   4   D
15   250   3   5   A
16   203   4   1   A
17   204   4   2   C
18   227   4   3   D
19   193   4   4   E
20   259   4   5   B
21   231   5   1   C
22   271   5   2   D
23   266   5   3   B
24   334   5   4   A
25   338   5   5   E</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb93" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p15</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df15</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Treatment"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p15</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/latin.p15-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-16"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/latin.p15-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb94" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm15</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Row</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Col</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df15</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm15</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Row + Col + Trt, data = df15)

Residuals:
   Min     1Q Median     3Q    Max 
-44.68 -12.48   1.12  16.52  54.92 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)   240.08      23.43  10.247 2.75e-07 ***
Row2           11.60      20.55   0.565   0.5828    
Row3           -9.00      20.55  -0.438   0.6692    
Row4          -33.80      20.55  -1.645   0.1259    
Row5           37.00      20.55   1.801   0.0969 .  
Col2           24.40      20.55   1.187   0.2580    
Col3           35.80      20.55   1.742   0.1070    
Col4           44.40      20.55   2.161   0.0516 .  
Col5           38.20      20.55   1.859   0.0877 .  
TrtB           -7.00      20.55  -0.341   0.7393    
TrtC          -17.40      20.55  -0.847   0.4137    
TrtD          -31.60      20.55  -1.538   0.1500    
TrtE          -32.20      20.55  -1.567   0.1431    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 32.49 on 12 degrees of freedom
Multiple R-squared:  0.6536,    Adjusted R-squared:  0.3073 
F-statistic: 1.887 on 12 and 12 DF,  p-value: 0.1426</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb96" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm15</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df  Sum Sq Mean Sq F value  Pr(&gt;F)  
Row        4 13601.4  3400.3  3.2212 0.05164 .
Col        4  6146.2  1536.5  1.4556 0.27581  
Trt        4  4156.6  1039.1  0.9844 0.45229  
Residuals 12 12667.3  1055.6                  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
</section></section><section id="factorial-experiment-under-rcbd" class="level2"><h2 class="anchored" data-anchor-id="factorial-experiment-under-rcbd">Factorial Experiment under RCBD</h2>
<ol type="1">
<li>Three strains of perennial ryegrass were grown as swards at each of the fertilizer levels. The three strains were S23, Kent &amp; a control. The fertilizer levels were heavy &amp; average. The experiment was laid out under randomized complete block design. The mid summer dry matter yields, in units of 10 lb/acre were as follows. Analyze the data &amp; construct a table of means with appropriate standard errors. Draw any graphs you deem fit to explain the results &amp; write a short report on the conclusions to be drawn from this experiment.</li>
</ol>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb98" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">DMY</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">299</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">318</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">284</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">279</span>,</span>
<span>    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">247</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">202</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">171</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">183</span>,</span>
<span>    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">403</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">439</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">355</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">324</span>,</span>
<span>    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">222</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">170</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">192</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">176</span>,</span>
<span>    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">382</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">353</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">383</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">310</span>,</span>
<span>    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">233</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">216</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">143</span></span>
<span>    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Blk</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"I"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"II"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"III"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"IV"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"S23"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Control"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Kent"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Heavy"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Average"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">DMY</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Blk</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   DMY Blk    Vart    Manu
1  299   I     S23   Heavy
2  318  II     S23   Heavy
3  284 III     S23   Heavy
4  279  IV     S23   Heavy
5  247   I     S23 Average
6  202  II     S23 Average
7  171 III     S23 Average
8  183  IV     S23 Average
9  403   I Control   Heavy
10 439  II Control   Heavy
11 355 III Control   Heavy
12 324  IV Control   Heavy
13 222   I Control Average
14 170  II Control Average
15 192 III Control Average
16 176  IV Control Average
17 382   I    Kent   Heavy
18 353  II    Kent   Heavy
19 383 III    Kent   Heavy
20 310  IV    Kent   Heavy
21 233   I    Kent Average
22 216  II    Kent Average
23 200 III    Kent Average
24 143  IV    Kent Average</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb100" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">DMY</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Blk</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: DMY
          Df Sum Sq Mean Sq  F value    Pr(&gt;F)    
Blk        3  12814    4271   7.1611  0.003294 ** 
Vart       2   6196    3098   5.1935  0.019324 *  
Manu       1 131128  131128 219.8375 2.287e-10 ***
Vart:Manu  2   9590    4795   8.0389  0.004239 ** 
Residuals 15   8947     596                       
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb102" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmip.html">emmip</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-3-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-17"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/unnamed-chunk-3-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb103" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmip.html">emmip</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-4-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-18"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/unnamed-chunk-4-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb104" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code> Vart    emmean   SE df lower.CL upper.CL
 S23        248 8.63 15      229      266
 Control    285 8.63 15      267      304
 Kent       278 8.63 15      259      296

Results are averaged over the levels of: Blk, Manu 
Confidence level used: 0.95 </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb106" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code> Manu    emmean   SE df lower.CL upper.CL
 Heavy      344 7.05 15      329      359
 Average    196 7.05 15      181      211

Results are averaged over the levels of: Blk, Vart 
Confidence level used: 0.95 </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb108" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Vart = S23:
 Manu    emmean   SE df lower.CL upper.CL
 Heavy      295 12.2 15      269      321
 Average    201 12.2 15      175      227

Vart = Control:
 Manu    emmean   SE df lower.CL upper.CL
 Heavy      380 12.2 15      354      406
 Average    190 12.2 15      164      216

Vart = Kent:
 Manu    emmean   SE df lower.CL upper.CL
 Heavy      357 12.2 15      331      383
 Average    198 12.2 15      172      224

Results are averaged over the levels of: Blk 
Confidence level used: 0.95 </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb110" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Manu = Heavy:
 Vart    emmean   SE df lower.CL upper.CL
 S23        295 12.2 15      269      321
 Control    380 12.2 15      354      406
 Kent       357 12.2 15      331      383

Manu = Average:
 Vart    emmean   SE df lower.CL upper.CL
 S23        201 12.2 15      175      227
 Control    190 12.2 15      164      216
 Kent       198 12.2 15      172      224

Results are averaged over the levels of: Blk 
Confidence level used: 0.95 </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb112" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">pairwise</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$emmeans
 Vart    emmean   SE df lower.CL upper.CL
 S23        248 8.63 15      229      266
 Control    285 8.63 15      267      304
 Kent       278 8.63 15      259      296

Results are averaged over the levels of: Blk, Manu 
Confidence level used: 0.95 

$contrasts
 contrast       estimate   SE df t.ratio p.value
 S23 - Control    -37.25 12.2 15  -3.050  0.0208
 S23 - Kent       -29.62 12.2 15  -2.426  0.0689
 Control - Kent     7.62 12.2 15   0.624  0.8092

Results are averaged over the levels of: Blk, Manu 
P value adjustment: tukey method for comparing a family of 3 estimates </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb114" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">pairwise</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$emmeans
 Manu    emmean   SE df lower.CL upper.CL
 Heavy      344 7.05 15      329      359
 Average    196 7.05 15      181      211

Results are averaged over the levels of: Blk, Vart 
Confidence level used: 0.95 

$contrasts
 contrast        estimate   SE df t.ratio p.value
 Heavy - Average      148 9.97 15  14.827 &lt;0.0001

Results are averaged over the levels of: Blk, Vart </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb116" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">pairwise</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$emmeans
Manu = Heavy:
 Vart    emmean   SE df lower.CL upper.CL
 S23        295 12.2 15      269      321
 Control    380 12.2 15      354      406
 Kent       357 12.2 15      331      383

Manu = Average:
 Vart    emmean   SE df lower.CL upper.CL
 S23        201 12.2 15      175      227
 Control    190 12.2 15      164      216
 Kent       198 12.2 15      172      224

Results are averaged over the levels of: Blk 
Confidence level used: 0.95 

$contrasts
Manu = Heavy:
 contrast       estimate   SE df t.ratio p.value
 S23 - Control    -85.25 17.3 15  -4.936  0.0005
 S23 - Kent       -62.00 17.3 15  -3.590  0.0071
 Control - Kent    23.25 17.3 15   1.346  0.3927

Manu = Average:
 contrast       estimate   SE df t.ratio p.value
 S23 - Control     10.75 17.3 15   0.622  0.8102
 S23 - Kent         2.75 17.3 15   0.159  0.9861
 Control - Kent    -8.00 17.3 15  -0.463  0.8893

Results are averaged over the levels of: Blk 
P value adjustment: tukey method for comparing a family of 3 estimates </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb118" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">pairwise</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$emmeans
Vart = S23:
 Manu    emmean   SE df lower.CL upper.CL
 Heavy      295 12.2 15      269      321
 Average    201 12.2 15      175      227

Vart = Control:
 Manu    emmean   SE df lower.CL upper.CL
 Heavy      380 12.2 15      354      406
 Average    190 12.2 15      164      216

Vart = Kent:
 Manu    emmean   SE df lower.CL upper.CL
 Heavy      357 12.2 15      331      383
 Average    198 12.2 15      172      224

Results are averaged over the levels of: Blk 
Confidence level used: 0.95 

$contrasts
Vart = S23:
 contrast        estimate   SE df t.ratio p.value
 Heavy - Average     94.2 17.3 15   5.458 &lt;0.0001

Vart = Control:
 contrast        estimate   SE df t.ratio p.value
 Heavy - Average    190.2 17.3 15  11.016 &lt;0.0001

Vart = Kent:
 contrast        estimate   SE df t.ratio p.value
 Heavy - Average    159.0 17.3 15   9.207 &lt;0.0001

Results are averaged over the levels of: Blk </code></pre>
</div>
</div>
</section><section id="stability-analysis" class="level2"><h2 class="anchored" data-anchor-id="stability-analysis">Stability Analysis</h2>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb120" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://myaseen208.com/stability/">stability</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>help <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">stability</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/utils/data.html">data</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ge_data</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
</div>
<section id="individual-analysis-of-variance-for-each-location" class="level3"><h3 class="anchored" data-anchor-id="individual-analysis-of-variance-for-each-location">Individual Analysis of Variance for each Location</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb121" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield.indiv_anova</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span>         <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://myaseen208.com/stability/reference/indiv_anova.html">indiv_anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            .data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ge_data</span></span>
<span>          , .y    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span></span>
<span>          , .rep  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rep</span></span>
<span>          , .gen  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gen</span></span>
<span>          , .env  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Env</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield.indiv_anova</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$`Analysis of Variance for FSD`
            Df   Sum Sq Mean Sq F value Pr(&gt;F)    
Gen         59 45524231  771597   32.62 &lt;2e-16 ***
Residuals   60  1419180   23653                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for FSDR`
            Df   Sum Sq Mean Sq F value   Pr(&gt;F)    
Gen         59 14019781  237623   2.724 7.91e-05 ***
Residuals   60  5234860   87248                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for Okara`
            Df   Sum Sq Mean Sq F value   Pr(&gt;F)    
Gen         59 26802597  454281   3.538 1.22e-06 ***
Residuals   60  7703642  128394                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for Sargodha`
            Df   Sum Sq Mean Sq F value  Pr(&gt;F)    
Gen         59 38381469  650533   4.254 4.3e-08 ***
Residuals   60  9175301  152922                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for Gujranwala`
            Df   Sum Sq Mean Sq F value   Pr(&gt;F)    
Gen         59 41863914  709558   4.687 6.55e-09 ***
Residuals   60  9082956  151383                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for KotNaina`
            Df   Sum Sq Mean Sq F value   Pr(&gt;F)    
Gen         59 26692263  452411     4.3 3.51e-08 ***
Residuals   60  6313095  105218                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for KSK`
            Df   Sum Sq Mean Sq F value   Pr(&gt;F)    
Gen         59 17890629  303231   3.472 1.68e-06 ***
Residuals   60  5239575   87326                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for Khanewal`
            Df   Sum Sq Mean Sq F value   Pr(&gt;F)    
Gen         59 15125214  256360   2.451 0.000345 ***
Residuals   60  6274965  104583                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for Sahiwal`
            Df   Sum Sq Mean Sq F value   Pr(&gt;F)    
Gen         59 26109918  442541   4.095 8.82e-08 ***
Residuals   60  6484679  108078                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for Bhakkar`
            Df   Sum Sq Mean Sq F value  Pr(&gt;F)   
Gen         59 10870598  184247   1.862 0.00885 **
Residuals   60  5936717   98945                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for Bahawalnagar`
            Df  Sum Sq Mean Sq F value Pr(&gt;F)  
Gen         59 9718292  164717   1.716 0.0196 *
Residuals   60 5760765   96013                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

attr(,"subheadings")
 [1] "Analysis of Variance for FSD"         
 [2] "Analysis of Variance for FSDR"        
 [3] "Analysis of Variance for Okara"       
 [4] "Analysis of Variance for Sargodha"    
 [5] "Analysis of Variance for Gujranwala"  
 [6] "Analysis of Variance for KotNaina"    
 [7] "Analysis of Variance for KSK"         
 [8] "Analysis of Variance for Khanewal"    
 [9] "Analysis of Variance for Sahiwal"     
[10] "Analysis of Variance for Bhakkar"     
[11] "Analysis of Variance for Bahawalnagar"</code></pre>
</div>
</div>
</section><section id="combined-analysis-of-variance" class="level3"><h3 class="anchored" data-anchor-id="combined-analysis-of-variance">Combined Analysis of Variance</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb123" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">YieldANOVA</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span>     <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://myaseen208.com/stability/reference/add_anova.html">add_anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            .data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ge_data</span></span>
<span>          , .y    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span></span>
<span>          , .rep  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rep</span></span>
<span>          , .gen  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gen</span></span>
<span>          , .env  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Env</span></span>
<span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">YieldANOVA</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$anova
Analysis of Variance Table

Response: .data[[Y]]
           Df    Sum Sq  Mean Sq F value    Pr(&gt;F)    
Env        10 263940496 26394050 68.0551 1.995e-08 ***
Rep(Env)   11   4266167   387833                      
Gen        59  71662431  1214617 12.2482 &lt; 2.2e-16 ***
Gen:Env   590 201336476   341248  3.4411 &lt; 2.2e-16 ***
Residuals 649  64359568    99167                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
</section><section id="additive-main-effects-and-multiplicative-interaction-ammi-analysis" class="level3"><h3 class="anchored" data-anchor-id="additive-main-effects-and-multiplicative-interaction-ammi-analysis">Additive Main Effects and Multiplicative Interaction (AMMI) Analysis</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb125" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield.ammi</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span>     <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://myaseen208.com/stability/reference/ammi.html">ammi</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            .data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ge_data</span></span>
<span>          , .y    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span></span>
<span>          , .rep  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rep</span></span>
<span>          , .gen  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gen</span></span>
<span>          , .env  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Env</span></span>
<span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield.ammi</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$anova
Analysis of Variance Table

Response: .data[[Y]]
           Df    Sum Sq  Mean Sq F value    Pr(&gt;F)    
Env        10 263940496 26394050 68.0551 1.995e-08 ***
Rep(Env)   11   4266167   387833                      
Gen        59  71662431  1214617 12.2482 &lt; 2.2e-16 ***
Gen:Env   590 201336476   341248  3.4411 &lt; 2.2e-16 ***
Residuals 649  64359568    99167                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$pc.anova
# A tibble: 11 × 9
   PC     SingVal  Percent accumPerc    Df       SS  Mean.Sq  F.value   Pr..F.
   &lt;chr&gt;    &lt;dbl&gt;    &lt;dbl&gt;     &lt;dbl&gt; &lt;dbl&gt;    &lt;dbl&gt;    &lt;dbl&gt;    &lt;dbl&gt;    &lt;dbl&gt;
 1 PC1   4.50e+ 3 2.01e+ 1      20.1    68 4.04e+ 7 5.95e+ 5 6.00e+ 0 0       
 2 PC2   4.17e+ 3 1.73e+ 1      37.4    66 3.49e+ 7 5.28e+ 5 5.33e+ 0 0       
 3 PC3   4.05e+ 3 1.63e+ 1      53.7    64 3.27e+ 7 5.12e+ 5 5.16e+ 0 0       
 4 PC4   3.49e+ 3 1.21e+ 1      65.8    62 2.44e+ 7 3.93e+ 5 3.96e+ 0 0       
 5 PC5   3.38e+ 3 1.13e+ 1      77.1    60 2.29e+ 7 3.81e+ 5 3.84e+ 0 0       
 6 PC6   3.11e+ 3 9.63e+ 0      86.7    58 1.94e+ 7 3.34e+ 5 3.37e+ 0 4.02e-14
 7 PC7   2.30e+ 3 5.25e+ 0      92.0    56 1.06e+ 7 1.89e+ 5 1.90e+ 0 1.45e- 4
 8 PC8   2.03e+ 3 4.10e+ 0      96.1    54 8.25e+ 6 1.53e+ 5 1.54e+ 0 9.52e- 3
 9 PC9   1.52e+ 3 2.30e+ 0      98.4    52 4.63e+ 6 8.91e+ 4 8.98e- 1 6.77e- 1
10 PC10  1.28e+ 3 1.63e+ 0     100      50 3.27e+ 6 6.55e+ 4 6.60e- 1 9.66e- 1
11 PC11  2.08e-11 4.32e-28     100      48 8.69e-22 1.81e-23 1.83e-28 1   e+ 0</code></pre>
</div>
</div>
</section><section id="additive-main-effects-and-multiplicative-interaction-ammi-biplot-analysis" class="level3"><h3 class="anchored" data-anchor-id="additive-main-effects-and-multiplicative-interaction-ammi-biplot-analysis">Additive Main Effects and Multiplicative Interaction (AMMI) Biplot Analysis</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb127" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://myaseen208.com/stability/reference/ammi_biplot.html">ammi_biplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            .data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ge_data</span></span>
<span>          , .y    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span></span>
<span>          , .rep  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rep</span></span>
<span>          , .gen  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gen</span></span>
<span>          , .env  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Env</span></span>
<span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$aami.biplot</code></pre>
</div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-17-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-19"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/unnamed-chunk-17-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
$MeanPC1Plot</code></pre>
</div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-17-2.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-20"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/unnamed-chunk-17-2.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section><section id="genotype-plus-genotypes-by-environment-gge-interaction-biplot-analysis" class="level3"><h3 class="anchored" data-anchor-id="genotype-plus-genotypes-by-environment-gge-interaction-biplot-analysis">Genotype plus Genotypes by Environment (GGE) Interaction Biplot Analysis</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb130" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://myaseen208.com/stability/reference/gge_biplot.html">gge_biplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            .data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ge_data</span></span>
<span>          , .y    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span></span>
<span>          , .rep  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rep</span></span>
<span>          , .gen  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gen</span></span>
<span>          , .env  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Env</span></span>
<span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$gge.biplot</code></pre>
</div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-18-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-21"><img src="https://myaseen208.com/blogs/2020-02-06_UAF/index_files/figure-html/unnamed-chunk-18-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>


</section></section><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2020,
  author = {Yaseen, Muhammad},
  title = {Design \&amp; {Analysis} of {Field} {Experiments} Using {R}},
  date = {2020-03-06},
  url = {https://myaseen208.com/blogs/2020-02-06_UAF/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2020" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2020. <span>“Design &amp; Analysis of Field
Experiments Using R.”</span> March 6. <a href="https://myaseen208.com/blogs/2020-02-06_UAF/">https://myaseen208.com/blogs/2020-02-06_UAF/</a>.
</div></div></section></div> ]]></description>
  <category>R</category>
  <category>Statistics</category>
  <category>Research</category>
  <guid>https://myaseen208.com/blogs/2020-02-06_UAF/</guid>
  <pubDate>Fri, 06 Mar 2020 05:00:00 GMT</pubDate>
  <media:content url="https://myaseen208.com/assets/img/blogs/2020-02-06_UAF/fig/PopRegFn.webp" medium="image" type="image/webp"/>
</item>
<item>
  <title>Training Course on Capacity Building of NARS Scientists in Advance Analytical Techniques</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2019-11-25_NARC/</link>
  <description><![CDATA[ <section id="introduction" class="level2"><h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<blockquote class="blockquote">
<p><strong>R</strong> is a free, open-source programming language and software environment for statistical computing, bioinformatics, visualization and general computing. <strong>R</strong> provides a wide variety of statistical and graphical techniques, and is highly extensible. The latest version of <strong>R</strong> can be obtained from <a href="https://cran.r-project.org/bin/windows/base/">https://cran.r-project.org/bin/windows/base/</a>.</p>
</blockquote>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://cran.r-project.org/bin/windows/base/" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;R</a> <a href="https://cran.r-project.org/bin/windows/base/">R for Windows (32/64 bit)</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://www.rstudio.com/products/rstudio/download/" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;RStudio</a> <a href="https://www.rstudio.com/products/rstudio/download/">RStudio</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;Manual</a> <a href="https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf">An Introduction to R</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://cran.r-project.org/doc/contrib/Short-refcard.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;Ref Card</a> <a href="https://cran.r-project.org/doc/contrib/Short-refcard.pdf">R Reference Card</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://github.com/myaseen208/R-Workshop/raw/master/2009NewYorkTimes.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;New York Times</a> <a href="https://github.com/myaseen208/R-Workshop/raw/master/2009NewYorkTimes.pdf">New York Times</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://github.com/myaseen208/R-Workshop/raw/master/2015NatureArticle.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;Nature Article</a> <a href="https://github.com/myaseen208/R-Workshop/raw/master/2015NatureArticle.pdf">Nature Article</a> &nbsp;
</h4>
<p>&nbsp;</p>
</section><section id="regression-analysis" class="level2"><h2 class="anchored" data-anchor-id="regression-analysis">Regression Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on quantitative explanatory variable(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<div id="fig-PopRegFn" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-PopRegFn-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2019-11-25_NARC/fig/PopRegFn.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-1" title="Figure&nbsp;1: "><img src="https://myaseen208.com/assets/img/blogs/2019-11-25_NARC/fig/PopRegFn.webp" class="img-fluid figure-img"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig quarto-uncaptioned" id="fig-PopRegFn-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1
</figcaption></figure>
</div>
<p>&nbsp;</p>
</section><section id="simple-linear-regression" class="level2"><h2 class="anchored" data-anchor-id="simple-linear-regression">Simple Linear Regression</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on a quantitative explanatory variable</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example" class="level3"><h3 class="anchored" data-anchor-id="example">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Fertilizer (Kg/acre)</th>
<th>Production (Bushels/acre)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>100</td>
<td>70</td>
</tr>
<tr class="even">
<td>200</td>
<td>70</td>
</tr>
<tr class="odd">
<td>400</td>
<td>80</td>
</tr>
<tr class="even">
<td>500</td>
<td>100</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Fertilizer (Kg/acre)</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Production (Bushels/acre)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">400</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">500</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Production</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Production</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Fertilizer Production
1        100         70
2        200         70
3        400         80
4        500        100</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Production</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fertilizer"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Production"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p1-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-2"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/reg.p1-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Production</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Production ~ Fertilizer, data = df1)

Residuals:
 1  2  3  4 
 4 -3 -7  6 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)  
(Intercept) 59.00000    7.95299   7.419   0.0177 *
Fertilizer   0.07000    0.02345   2.985   0.0963 .
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 7.416 on 2 degrees of freedom
Multiple R-squared:  0.8167,    Adjusted R-squared:  0.725 
F-statistic: 8.909 on 1 and 2 DF,  p-value: 0.0963</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Production
           Df Sum Sq Mean Sq F value Pr(&gt;F)  
Fertilizer  1    490     490  8.9091 0.0963 .
Residuals   2    110      55                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section><section id="example-1" class="level3"><h3 class="anchored" data-anchor-id="example-1">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Fertilizer</th>
<th>Yield</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>0.3</td>
<td>10</td>
</tr>
<tr class="even">
<td>0.6</td>
<td>15</td>
</tr>
<tr class="odd">
<td>0.9</td>
<td>30</td>
</tr>
<tr class="even">
<td>1.2</td>
<td>35</td>
</tr>
<tr class="odd">
<td>1.5</td>
<td>25</td>
</tr>
<tr class="even">
<td>1.8</td>
<td>30</td>
</tr>
<tr class="odd">
<td>2.1</td>
<td>50</td>
</tr>
<tr class="even">
<td>2.4</td>
<td>45</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb8" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.3</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.6</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.9</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">35</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">45</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df2</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df2</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Fert Yield
1  0.3    10
2  0.6    15
3  0.9    30
4  1.2    35
5  1.5    25
6  1.8    30
7  2.1    50
8  2.4    45</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb10" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df2</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fertilizer"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p2-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-3"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/reg.p2-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb11" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fert, data = df2)

Residuals:
   Min     1Q Median     3Q    Max 
-7.441 -4.018 -2.441  7.351  7.798 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)   
(Intercept)    8.036      5.504   1.460   0.1946   
Fert          16.270      3.633   4.478   0.0042 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 7.064 on 6 degrees of freedom
Multiple R-squared:  0.7697,    Adjusted R-squared:  0.7313 
F-statistic: 20.05 on 1 and 6 DF,  p-value: 0.004202</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb13" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value   Pr(&gt;F)   
Fert       1 1000.6  1000.6  20.052 0.004202 **
Residuals  6  299.4    49.9                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section><section id="example-2" class="level3"><h3 class="anchored" data-anchor-id="example-2">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Weekly Income ($)</th>
<th>Weekly Expenditures ($)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>80</td>
<td>70</td>
</tr>
<tr class="even">
<td>100</td>
<td>65</td>
</tr>
<tr class="odd">
<td>120</td>
<td>90</td>
</tr>
<tr class="even">
<td>140</td>
<td>95</td>
</tr>
<tr class="odd">
<td>160</td>
<td>110</td>
</tr>
<tr class="even">
<td>180</td>
<td>115</td>
</tr>
<tr class="odd">
<td>200</td>
<td>120</td>
</tr>
<tr class="even">
<td>220</td>
<td>140</td>
</tr>
<tr class="odd">
<td>240</td>
<td>155</td>
</tr>
<tr class="even">
<td>260</td>
<td>150</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb15" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Weekly Income ($) of a Family</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Weekly Expenditures ($) of a Family</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Income</span>       <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/seq.html">seq</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>from <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, to <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">260</span>, by <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Expenditures</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">65</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">90</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">95</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">110</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">115</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">120</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">140</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">155</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">150</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Income</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Expenditures</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Income Expenditures
1      80           70
2     100           65
3     120           90
4     140           95
5     160          110
6     180          115
7     200          120
8     220          140
9     240          155
10    260          150</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb17" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p3</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Income</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Expenditures</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_x_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/dollar_format.html">dollar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/dollar_format.html">dollar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Weekly income, $"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Weekly consumption expenditures, $"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p3-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-4"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/reg.p3-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb18" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm3</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Expenditures</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Income</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Expenditures ~ Income, data = df3)

Residuals:
    Min      1Q  Median      3Q     Max 
-10.364  -4.977   1.409   4.364   8.364 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept) 24.45455    6.41382   3.813  0.00514 ** 
Income       0.50909    0.03574  14.243 5.75e-07 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 6.493 on 8 degrees of freedom
Multiple R-squared:  0.9621,    Adjusted R-squared:  0.9573 
F-statistic: 202.9 on 1 and 8 DF,  p-value: 5.753e-07</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb20" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Expenditures
          Df Sum Sq Mean Sq F value    Pr(&gt;F)    
Income     1 8552.7  8552.7  202.87 5.753e-07 ***
Residuals  8  337.3    42.2                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="multiple-linear-regression" class="level2"><h2 class="anchored" data-anchor-id="multiple-linear-regression">Multiple Linear Regression</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on two or more quantitative explanatory variables</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-3" class="level3"><h3 class="anchored" data-anchor-id="example-3">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Fertilizer (Kg)</th>
<th>Rainfall (mm)</th>
<th>Yield (Kg)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>100</td>
<td>10</td>
<td>40</td>
</tr>
<tr class="even">
<td>200</td>
<td>20</td>
<td>50</td>
</tr>
<tr class="odd">
<td>300</td>
<td>10</td>
<td>50</td>
</tr>
<tr class="even">
<td>400</td>
<td>30</td>
<td>70</td>
</tr>
<tr class="odd">
<td>500</td>
<td>20</td>
<td>65</td>
</tr>
<tr class="even">
<td>600</td>
<td>20</td>
<td>65</td>
</tr>
<tr class="odd">
<td>700</td>
<td>30</td>
<td>80</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb22" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Fertilizer (Kg)</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Rainfall (mm)</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Yield (Kg)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/seq.html">seq</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>from <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, to <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">700</span>, by <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rainfall</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">40</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">65</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">65</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rainfall</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Fertilizer Rainfall Yield
1        100       10    40
2        200       20    50
3        300       10    50
4        400       30    70
5        500       20    65
6        600       20    65
7        700       30    80</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb24" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rainfall</span>, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.8</span>, size <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_viridis.html">scale_color_viridis_c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_minimal</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p4-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-5"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/reg.p4-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb25" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm4</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rainfall</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fertilizer + Rainfall, data = df4)

Residuals:
      1       2       3       4       5       6       7 
-0.2381 -2.3810  2.1429  1.6667  1.1905 -2.6190  0.2381 

Coefficients:
             Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept) 28.095238   2.491482  11.277 0.000352 ***
Fertilizer   0.038095   0.005832   6.532 0.002838 ** 
Rainfall     0.833333   0.154303   5.401 0.005690 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.315 on 4 degrees of freedom
Multiple R-squared:  0.9814,    Adjusted R-squared:  0.972 
F-statistic: 105.3 on 2 and 4 DF,  p-value: 0.0003472</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb27" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
           Df Sum Sq Mean Sq F value    Pr(&gt;F)    
Fertilizer  1 972.32  972.32 181.500 0.0001756 ***
Rainfall    1 156.25  156.25  29.167 0.0056899 ** 
Residuals   4  21.43    5.36                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb29" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">lm.beta</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/lm.beta/man/lm.beta.html">lm.beta</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fertilizer + Rainfall, data = df4)

Standardized Coefficients::
(Intercept)  Fertilizer    Rainfall 
         NA   0.5944301   0.4914732 </code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="polynomial-regression-analysis" class="level2"><h2 class="anchored" data-anchor-id="polynomial-regression-analysis">Polynomial Regression Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying non-linear dependency of a normal response on quantitative explanatory variable(s)</li>
</ul>
</blockquote>
<section id="example-4" class="level3"><h3 class="anchored" data-anchor-id="example-4">Example</h3>
<blockquote class="blockquote">
<p>An experiment was conducted to evaluate the effects of different levels of nitrogen. Three levels of nitrogen: 0, 10 and 20 grams per plot were used in the experiment. Each treatment was replicated twice and data is given below:</p>
</blockquote>
<table class="caption-top table">
<thead><tr class="header">
<th>Nitrogen</th>
<th>Yield</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>0</td>
<td>5</td>
</tr>
<tr class="even">
<td>0</td>
<td>7</td>
</tr>
<tr class="odd">
<td>10</td>
<td>15</td>
</tr>
<tr class="even">
<td>10</td>
<td>17</td>
</tr>
<tr class="odd">
<td>20</td>
<td>9</td>
</tr>
<tr class="even">
<td>20</td>
<td>11</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb31" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">11</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Nitrogen Yield
1        0     5
2        0     7
3       10    15
4       10    17
5       20     9
6       20    11</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb33" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nitrogen"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p5-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-6"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/reg.p5-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb34" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/AsIs.html">I</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># fm5 &lt;- lm(formula = Yield ~ poly(x = Nitrogen, degree = 2, raw = TRUE), data = df5)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Nitrogen + I(Nitrogen^2), data = df5)

Residuals:
 1  2  3  4  5  6 
-1  1 -1  1 -1  1 

Coefficients:
              Estimate Std. Error t value Pr(&gt;|t|)   
(Intercept)    6.00000    1.00000   6.000  0.00927 **
Nitrogen       1.80000    0.25495   7.060  0.00584 **
I(Nitrogen^2) -0.08000    0.01225  -6.532  0.00729 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.414 on 3 degrees of freedom
Multiple R-squared:  0.9441,    Adjusted R-squared:  0.9068 
F-statistic: 25.33 on 2 and 3 DF,  p-value: 0.01322</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb36" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
              Df Sum Sq Mean Sq F value   Pr(&gt;F)   
Nitrogen       1 16.000  16.000   8.000 0.066276 . 
I(Nitrogen^2)  1 85.333  85.333  42.667 0.007292 **
Residuals      3  6.000   2.000                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="analysis-of-variance-anova" class="level2"><h2 class="anchored" data-anchor-id="analysis-of-variance-anova">Analysis of Variance (ANOVA)</h2>
<blockquote class="blockquote">
<ul>
<li>Comparing means of Normal dependent variable for levels of different factor(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<div id="fig-ANOVANormalMeans" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-ANOVANormalMeans-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2019-11-25_NARC/fig/ANOVANormalMeans.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-7" title="Figure&nbsp;2: "><img src="https://myaseen208.com/assets/img/blogs/2019-11-25_NARC/fig/ANOVANormalMeans.webp" class="img-fluid figure-img"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig quarto-uncaptioned" id="fig-ANOVANormalMeans-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2
</figcaption></figure>
</div>
<p>&nbsp;</p>
<section id="example-5" class="level3"><h3 class="anchored" data-anchor-id="example-5">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Yield</th>
<th>Variety</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>5</td>
<td>V1</td>
</tr>
<tr class="even">
<td>6</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>7</td>
<td>V1</td>
</tr>
<tr class="even">
<td>15</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>16</td>
<td>V2</td>
</tr>
<tr class="even">
<td>17</td>
<td>V2</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb38" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V1"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V2"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span>     <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Yield Variety
1     5      V1
2     6      V1
3     7      V1
4    15      V2
5    16      V2
6    17      V2</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb40" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p6</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Variety"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p6</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/anova.p6-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-8"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/anova.p6-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb41" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm6</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm6</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Variety, data = df6)

Residuals:
         1          2          3          4          5          6 
-1.000e+00 -4.774e-15  1.000e+00 -1.000e+00 -1.110e-16  1.000e+00 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)   6.0000     0.5774   10.39 0.000484 ***
VarietyV2    10.0000     0.8165   12.25 0.000255 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1 on 4 degrees of freedom
Multiple R-squared:  0.974, Adjusted R-squared:  0.9675 
F-statistic:   150 on 1 and 4 DF,  p-value: 0.0002552</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb43" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm6</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value    Pr(&gt;F)    
Variety    1    150     150     150 0.0002552 ***
Residuals  4      4       1                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section><section id="example-6" class="level3"><h3 class="anchored" data-anchor-id="example-6">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Yield</th>
<th>Variety</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>5</td>
<td>V1</td>
</tr>
<tr class="even">
<td>7</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>15</td>
<td>V2</td>
</tr>
<tr class="even">
<td>17</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>17</td>
<td>V3</td>
</tr>
<tr class="even">
<td>19</td>
<td>V3</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb45" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">19</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V1"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V2"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V3"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span>     <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Yield Variety
1     5      V1
2     7      V1
3    15      V2
4    17      V2
5    17      V3
6    19      V3</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb47" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p7</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Variety"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p7</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/anova.p7-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-9"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/anova.p7-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb48" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm7</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm7</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Variety, data = df7)

Residuals:
 1  2  3  4  5  6 
-1  1 -1  1 -1  1 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)   
(Intercept)    6.000      1.000   6.000  0.00927 **
VarietyV2     10.000      1.414   7.071  0.00582 **
VarietyV3     12.000      1.414   8.485  0.00344 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.414 on 3 degrees of freedom
Multiple R-squared:  0.965, Adjusted R-squared:  0.9416 
F-statistic: 41.33 on 2 and 3 DF,  p-value: 0.006553</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb50" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm7</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value   Pr(&gt;F)   
Variety    2 165.33  82.667  41.333 0.006553 **
Residuals  3   6.00   2.000                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="analysis-of-covariance-ancova" class="level2"><h2 class="anchored" data-anchor-id="analysis-of-covariance-ancova">Analysis of Covariance (ANCOVA)</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on quantitative explanatory variable(s)</li>
<li>Comparing means of Normal dependent variable for levels of different factor(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<div id="fig-ANCOVA" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-ANCOVA-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2019-11-25_NARC/fig/ANCOVA.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-10" title="Figure&nbsp;3: "><img src="https://myaseen208.com/assets/img/blogs/2019-11-25_NARC/fig/ANCOVA.webp" class="img-fluid figure-img"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig quarto-uncaptioned" id="fig-ANCOVA-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;3
</figcaption></figure>
</div>
<p>&nbsp;</p>
<section id="example-7" class="level3"><h3 class="anchored" data-anchor-id="example-7">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Yield</th>
<th>Fert</th>
<th>Variety</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>51</td>
<td>80</td>
<td>V1</td>
</tr>
<tr class="even">
<td>52</td>
<td>80</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>53</td>
<td>90</td>
<td>V1</td>
</tr>
<tr class="even">
<td>54</td>
<td>90</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>56</td>
<td>100</td>
<td>V1</td>
</tr>
<tr class="even">
<td>57</td>
<td>100</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>55</td>
<td>80</td>
<td>V2</td>
</tr>
<tr class="even">
<td>56</td>
<td>80</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>58</td>
<td>90</td>
<td>V2</td>
</tr>
<tr class="even">
<td>59</td>
<td>90</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>62</td>
<td>100</td>
<td>V2</td>
</tr>
<tr class="even">
<td>63</td>
<td>100</td>
<td>V2</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb52" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">51</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">52</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">53</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">54</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">56</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">57</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">55</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">56</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">58</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">59</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">62</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">63</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>     <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">90</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, each <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V1"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V2"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, ordered <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span>         <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Yield Fert Variety
1     51   80      V1
2     52   80      V1
3     53   90      V1
4     54   90      V1
5     56  100      V1
6     57  100      V1
7     55   80      V2
8     56   80      V2
9     58   90      V2
10    59   90      V2
11    62  100      V2
12    63  100      V2</code></pre>
</div>
</div>
</section><section id="same-intercepts-but-different-slopes" class="level3"><h3 class="anchored" data-anchor-id="same-intercepts-but-different-slopes">Same intercepts but different slopes</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb54" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm8</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fert + Variety, data = df8)

Residuals:
    Min      1Q  Median      3Q     Max 
-0.8333 -0.8333  0.1667  0.1667  1.1667 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept) 26.83333    2.54557   10.54 2.30e-06 ***
Fert         0.30000    0.02805   10.69 2.04e-06 ***
VarietyV2    5.00000    0.45812   10.91 1.72e-06 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.7935 on 9 degrees of freedom
Multiple R-squared:  0.9629,    Adjusted R-squared:  0.9546 
F-statistic: 116.7 on 2 and 9 DF,  p-value: 3.657e-07</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb56" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value    Pr(&gt;F)    
Fert       1 72.000   72.00  114.35 2.042e-06 ***
Variety    1 75.000   75.00  119.12 1.720e-06 ***
Residuals  9  5.667    0.63                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb58" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p8</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_path.html">geom_line</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/predict.html">predict</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fert"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/ancova.p8-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-11"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/ancova.p8-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<p>&nbsp;</p>
</section><section id="different-intercepts-and-different-slopes" class="level3"><h3 class="anchored" data-anchor-id="different-intercepts-and-different-slopes">Different intercepts and different slopes</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb59" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm9</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fert * Variety, data = df8)

Residuals:
     Min       1Q   Median       3Q      Max 
-0.83333 -0.33333 -0.08333  0.66667  0.66667 

Coefficients:
               Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)    31.33333    3.05903  10.243 7.09e-06 ***
Fert            0.25000    0.03385   7.385 7.73e-05 ***
VarietyV2      -4.00000    4.32612  -0.925   0.3822    
Fert:VarietyV2  0.10000    0.04787   2.089   0.0701 .  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.677 on 8 degrees of freedom
Multiple R-squared:  0.976, Adjusted R-squared:  0.967 
F-statistic: 108.4 on 3 and 8 DF,  p-value: 8.11e-07</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb61" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
             Df Sum Sq Mean Sq  F value    Pr(&gt;F)    
Fert          1 72.000  72.000 157.0909 1.538e-06 ***
Variety       1 75.000  75.000 163.6364 1.315e-06 ***
Fert:Variety  1  2.000   2.000   4.3636   0.07013 .  
Residuals     8  3.667   0.458                       
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb63" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p9</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_path.html">geom_line</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/predict.html">predict</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fert"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/ancova.p9-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-12"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/ancova.p9-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section></section><section id="correlation-analysis" class="level2"><h2 class="anchored" data-anchor-id="correlation-analysis">Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Quantitative Variables</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section><section id="simple-correlation-analysis" class="level2"><h2 class="anchored" data-anchor-id="simple-correlation-analysis">Simple Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Two Quantitative Variables</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cleft(X_%7B1%7D,X_%7B2%7D%5Cright)"></li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-8" class="level3"><h3 class="anchored" data-anchor-id="example-8">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Sparrow Wing length (cm)</th>
<th>Sparrow Tail length (cm)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>10.4</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.8</td>
<td>7.6</td>
</tr>
<tr class="odd">
<td>11.1</td>
<td>7.9</td>
</tr>
<tr class="even">
<td>10.2</td>
<td>7.2</td>
</tr>
<tr class="odd">
<td>10.3</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.2</td>
<td>7.1</td>
</tr>
<tr class="odd">
<td>10.7</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.5</td>
<td>7.2</td>
</tr>
<tr class="odd">
<td>10.8</td>
<td>7.8</td>
</tr>
<tr class="even">
<td>11.2</td>
<td>7.7</td>
</tr>
<tr class="odd">
<td>10.6</td>
<td>7.8</td>
</tr>
<tr class="even">
<td>11.4</td>
<td>8.3</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb64" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">11.1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.3</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">11.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.6</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">11.4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.6</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.9</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">8.3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   WingLength TailLength
1        10.4        7.4
2        10.8        7.6
3        11.1        7.9
4        10.2        7.2
5        10.3        7.4
6        10.2        7.1
7        10.7        7.4
8        10.5        7.2
9        10.8        7.8
10       11.2        7.7
11       10.6        7.8
12       11.4        8.3</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb66" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p10</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Sparrow Wing Length (cm)"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Sparrow Tail Length (cm)"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/corr.p10-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-13"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/corr.p10-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb67" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/cor.html">cor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 0.8703546</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb69" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/cor.test.html">cor.test</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
    Pearson's product-moment correlation

data:  df10$WingLength and df10$TailLength
t = 5.5893, df = 10, p-value = 0.0002311
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.5923111 0.9631599
sample estimates:
      cor 
0.8703546 </code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="partial-correlation-analysis" class="level2"><h2 class="anchored" data-anchor-id="partial-correlation-analysis">Partial Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Quantitative Variables while holding/keeping all other constants</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cleft(X_%7B1%7D,X_%7B2%7D%5Cright)%7CX_%7B3%7D"></li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-9" class="level3"><h3 class="anchored" data-anchor-id="example-9">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Leaf Area (cm^2)</th>
<th>Leaf Moisture (%)</th>
<th>Total Shoot Length (cm)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>72</td>
<td>80</td>
<td>307</td>
</tr>
<tr class="even">
<td>174</td>
<td>75</td>
<td>529</td>
</tr>
<tr class="odd">
<td>116</td>
<td>81</td>
<td>632</td>
</tr>
<tr class="even">
<td>78</td>
<td>83</td>
<td>527</td>
</tr>
<tr class="odd">
<td>134</td>
<td>79</td>
<td>442</td>
</tr>
<tr class="even">
<td>95</td>
<td>81</td>
<td>525</td>
</tr>
<tr class="odd">
<td>113</td>
<td>80</td>
<td>481</td>
</tr>
<tr class="even">
<td>98</td>
<td>81</td>
<td>710</td>
</tr>
<tr class="odd">
<td>148</td>
<td>74</td>
<td>422</td>
</tr>
<tr class="even">
<td>42</td>
<td>78</td>
<td>345</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb71" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafArea</span>    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">72</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">174</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">116</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">78</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">134</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">95</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">113</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">98</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">148</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">42</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafMoist</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">75</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">81</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">83</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">79</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">81</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">81</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">74</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">78</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">58</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TotShLength</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">307</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">529</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">632</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">527</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">442</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">525</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">481</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">710</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">422</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">345</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df11</span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafArea</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafMoist</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TotShLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df11</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   LeafArea LeafMoist TotShLength
1        72        75         307
2       174        81         529
3       116        83         632
4        78        79         527
5       134        81         442
6        95        80         525
7       113        81         481
8        98        74         710
9       148        78         422
10       42        58         345</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb73" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ppcor</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/ppcor/man/pcor.html">pcor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df11</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$estimate
                LeafArea LeafMoist  TotShLength
LeafArea     1.000000000 0.6509096 -0.007012236
LeafMoist    0.650909618 1.0000000  0.324334659
TotShLength -0.007012236 0.3243347  1.000000000

$p.value
              LeafArea  LeafMoist TotShLength
LeafArea    0.00000000 0.05760462   0.9857154
LeafMoist   0.05760462 0.00000000   0.3944839
TotShLength 0.98571537 0.39448385   0.0000000

$statistic
               LeafArea LeafMoist TotShLength
LeafArea     0.00000000  2.268502 -0.01855309
LeafMoist    2.26850175  0.000000  0.90714704
TotShLength -0.01855309  0.907147  0.00000000

$n
[1] 10

$gp
[1] 1

$method
[1] "pearson"</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="multiple-correlation-analysis" class="level2"><h2 class="anchored" data-anchor-id="multiple-correlation-analysis">Multiple Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between a Quantitative Variable and set of other Quantitative Variables</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cleft(X_%7B1%7D,%5Cleft%5BX_%7B2%7D,X_%7B3%7D%5Cright%5D%5Cright)"></li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-10" class="level3"><h3 class="anchored" data-anchor-id="example-10">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Leaf Area (cm^2)</th>
<th>Leaf Moisture (%)</th>
<th>Total Shoot Length (cm)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>72</td>
<td>80</td>
<td>307</td>
</tr>
<tr class="even">
<td>174</td>
<td>75</td>
<td>529</td>
</tr>
<tr class="odd">
<td>116</td>
<td>81</td>
<td>632</td>
</tr>
<tr class="even">
<td>78</td>
<td>83</td>
<td>527</td>
</tr>
<tr class="odd">
<td>134</td>
<td>79</td>
<td>442</td>
</tr>
<tr class="even">
<td>95</td>
<td>81</td>
<td>525</td>
</tr>
<tr class="odd">
<td>113</td>
<td>80</td>
<td>481</td>
</tr>
<tr class="even">
<td>98</td>
<td>81</td>
<td>710</td>
</tr>
<tr class="odd">
<td>148</td>
<td>74</td>
<td>422</td>
</tr>
<tr class="even">
<td>42</td>
<td>78</td>
<td>345</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb75" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm12</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TotShLength</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafArea</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafMoist</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df11</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/MathFun.html">sqrt</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm12</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">r.squared</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 0.421277</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="completely-randomized-design-crd" class="level2"><h2 class="anchored" data-anchor-id="completely-randomized-design-crd">Completely Randomized Design (CRD)</h2>
<blockquote class="blockquote">
<ul>
<li>Used when experimental material is homogeneous</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-11" class="level3"><h3 class="anchored" data-anchor-id="example-11">Example</h3>
<blockquote class="blockquote">
<p>The following table shows some of the results of an experiment on the effects of applications of sulphur in reducing scab disease of potatoes. The object in applying sulphur is to increase the acidity of the soil, since scab does not thrive in very acid soil. In addition to untreated plots which serve as a control, 3 amounts of dressing were compared—300, 600, and 900 lb. per acre. Both a fall and a spring application of each amount was tested, so that in all there were seven distinct treatments. The sulphur was spread by hand on the surface of the soil, and then diced into a depth of about 4 inches. The quantity to be analyzed is the “scab index”. That is roughly speaking, the percentage of the surface area of the potato that is infected with scab. It is obtained by examining 100 potatoes at random from each plot, grading each potato on a scale from 0 to 100% infected, and taking the average.</p>
</blockquote>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb77" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ScabIndex</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span>      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">29</span>, </span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">32</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">26</span>, </span>
<span>         <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">21</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">19</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span></span>
<span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/factor.html">factor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>          x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, times <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>        , labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"O"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"F3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"S3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"F6"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"S6"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"F9"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"S9"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df13</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ScabIndex</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df13</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Trt ScabIndex
1    O        12
2    O        10
3    O        24
4    O        29
5    O        30
6    O        18
7    O        32
8    O        26
9   F3         9
10  F3         9
11  F3        16
12  F3         4
13  S3        30
14  S3         7
15  S3        21
16  S3         9
17  F6        16
18  F6        10
19  F6        18
20  F6        18
21  S6        18
22  S6        24
23  S6        12
24  S6        19
25  F9        10
26  F9         4
27  F9         4
28  F9         5
29  S9        17
30  S9         7
31  S9        16
32  S9        17</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb79" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p13</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df13</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ScabIndex</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Treatment"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Scab Index"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p13</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/crd.p13-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-14"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/crd.p13-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb80" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm13</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ScabIndex</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df13</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm13</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = ScabIndex ~ Trt, data = df13)

Residuals:
    Min      1Q  Median      3Q     Max 
-12.625  -4.844   0.625   3.594  13.250 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)   22.625      2.369   9.549 8.08e-10 ***
TrtF3        -13.125      4.104  -3.198 0.003734 ** 
TrtS3         -5.875      4.104  -1.432 0.164666    
TrtF6         -7.125      4.104  -1.736 0.094858 .  
TrtS6         -4.375      4.104  -1.066 0.296601    
TrtF9        -16.875      4.104  -4.112 0.000372 ***
TrtS9         -8.375      4.104  -2.041 0.051977 .  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 6.702 on 25 degrees of freedom
Multiple R-squared:  0.4641,    Adjusted R-squared:  0.3355 
F-statistic: 3.608 on 6 and 25 DF,  p-value: 0.01026</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb82" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm13</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: ScabIndex
          Df  Sum Sq Mean Sq F value  Pr(&gt;F)  
Trt        6  972.34 162.057  3.6081 0.01026 *
Residuals 25 1122.88  44.915                  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="randomized-complete-block-design-rcbd" class="level2"><h2 class="anchored" data-anchor-id="randomized-complete-block-design-rcbd">Randomized Complete Block Design (RCBD)</h2>
<blockquote class="blockquote">
<ul>
<li>Used when experimental material is heterogenous in one direction</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-12" class="level3"><h3 class="anchored" data-anchor-id="example-12">Example</h3>
<blockquote class="blockquote">
<p>Yield : Yield of barley, SoilType : Soil Type, and Trt : 5 sources and a control</p>
</blockquote>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb84" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>             <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">32.1</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">35.6</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">41.9</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">35.4</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30.1</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.5</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">37.1</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30.8</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">25.4</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">27.4</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">33.8</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.1</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24.1</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">33.0</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">35.6</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.4</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">26.1</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.0</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">33.8</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.9</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">23.2</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24.8</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">26.7</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">26.7</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">SoilType</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span></span>
<span>               , labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"I"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"II"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"III"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"IV"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, ordered <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span></span>
<span>               , labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"(NH4)2SO4"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NH4NO3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"CO(NH2)2"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Ca(NO3)2"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NaNO3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Control"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, ordered <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df14</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">SoilType</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df14</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Yield SoilType       Trt
1   32.1        I (NH4)2SO4
2   35.6        I    NH4NO3
3   41.9        I  CO(NH2)2
4   35.4        I  Ca(NO3)2
5   30.1        I     NaNO3
6   31.5        I   Control
7   37.1       II (NH4)2SO4
8   30.8       II    NH4NO3
9   25.4       II  CO(NH2)2
10  27.4       II  Ca(NO3)2
11  33.8       II     NaNO3
12  31.1       II   Control
13  24.1      III (NH4)2SO4
14  33.0      III    NH4NO3
15  35.6      III  CO(NH2)2
16  31.4      III  Ca(NO3)2
17  26.1      III     NaNO3
18  31.0      III   Control
19  33.8       IV (NH4)2SO4
20  31.9       IV    NH4NO3
21  23.2       IV  CO(NH2)2
22  24.8       IV  Ca(NO3)2
23  26.7       IV     NaNO3
24  26.7       IV   Control</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb86" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p14</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df14</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Treatment"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p14</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/rcbd.p14-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-15"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/rcbd.p14-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb87" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm14</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">SoilType</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df14</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm14</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ SoilType + Trt, data = df14)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.0208 -2.4229  0.0792  2.1354  6.7958 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)   35.354      2.826  12.511 2.44e-09 ***
SoilTypeII    -3.500      2.664  -1.314   0.2087    
SoilTypeIII   -4.233      2.664  -1.589   0.1329    
SoilTypeIV    -6.583      2.664  -2.471   0.0259 *  
TrtNH4NO3      1.050      3.263   0.322   0.7521    
TrtCO(NH2)2   -0.250      3.263  -0.077   0.9399    
TrtCa(NO3)2   -2.025      3.263  -0.621   0.5442    
TrtNaNO3      -2.600      3.263  -0.797   0.4380    
TrtControl    -1.700      3.263  -0.521   0.6100    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.615 on 15 degrees of freedom
Multiple R-squared:  0.3512,    Adjusted R-squared:  0.005215 
F-statistic: 1.015 on 8 and 15 DF,  p-value: 0.4653</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb89" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm14</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value Pr(&gt;F)
SoilType   3 133.62  44.539  2.0915 0.1443
Trt        5  39.31   7.862  0.3692 0.8618
Residuals 15 319.43  21.295               </code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="latin-square-design" class="level2"><h2 class="anchored" data-anchor-id="latin-square-design">Latin Square Design</h2>
<blockquote class="blockquote">
<ul>
<li>Used when experimental material is heterogenous in two perpendicular directions</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-13" class="level3"><h3 class="anchored" data-anchor-id="example-13">Example</h3>
<blockquote class="blockquote">
<p>The following table shows the field layout and yield of a 5×5 Latin square experiment on the effect of spacing on yield of millet plants. Five levels of spacing were used. The data on yield (grams/plot) was recorded and is given below:</p>
</blockquote>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb91" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">257</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">230</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">279</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">287</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">202</span>,</span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">245</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">283</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">245</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">280</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">260</span>,</span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">182</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">252</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">280</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">246</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">250</span>,</span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">203</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">204</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">227</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">193</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">259</span>,</span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">231</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">271</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">266</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">334</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">338</span></span>
<span>           <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Row</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/factor.html">factor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, each <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Col</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/factor.html">factor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, times <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>          <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span></span>
<span>        , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span></span>
<span>        , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span></span>
<span>        , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span></span>
<span>        , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span></span>
<span>         <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df15</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Row</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Col</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df15</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Yield Row Col Trt
1    257   1   1   B
2    230   1   2   E
3    279   1   3   A
4    287   1   4   C
5    202   1   5   D
6    245   2   1   D
7    283   2   2   A
8    245   2   3   E
9    280   2   4   B
10   260   2   5   C
11   182   3   1   E
12   252   3   2   B
13   280   3   3   C
14   246   3   4   D
15   250   3   5   A
16   203   4   1   A
17   204   4   2   C
18   227   4   3   D
19   193   4   4   E
20   259   4   5   B
21   231   5   1   C
22   271   5   2   D
23   266   5   3   B
24   334   5   4   A
25   338   5   5   E</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb93" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p15</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df15</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Treatment"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p15</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/latin.p15-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-16"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/latin.p15-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb94" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm15</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Row</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Col</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df15</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm15</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Row + Col + Trt, data = df15)

Residuals:
   Min     1Q Median     3Q    Max 
-44.68 -12.48   1.12  16.52  54.92 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)   240.08      23.43  10.247 2.75e-07 ***
Row2           11.60      20.55   0.565   0.5828    
Row3           -9.00      20.55  -0.438   0.6692    
Row4          -33.80      20.55  -1.645   0.1259    
Row5           37.00      20.55   1.801   0.0969 .  
Col2           24.40      20.55   1.187   0.2580    
Col3           35.80      20.55   1.742   0.1070    
Col4           44.40      20.55   2.161   0.0516 .  
Col5           38.20      20.55   1.859   0.0877 .  
TrtB           -7.00      20.55  -0.341   0.7393    
TrtC          -17.40      20.55  -0.847   0.4137    
TrtD          -31.60      20.55  -1.538   0.1500    
TrtE          -32.20      20.55  -1.567   0.1431    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 32.49 on 12 degrees of freedom
Multiple R-squared:  0.6536,    Adjusted R-squared:  0.3073 
F-statistic: 1.887 on 12 and 12 DF,  p-value: 0.1426</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb96" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm15</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df  Sum Sq Mean Sq F value  Pr(&gt;F)  
Row        4 13601.4  3400.3  3.2212 0.05164 .
Col        4  6146.2  1536.5  1.4556 0.27581  
Trt        4  4156.6  1039.1  0.9844 0.45229  
Residuals 12 12667.3  1055.6                  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
</section></section><section id="factorial-experiment-under-rcbd" class="level2"><h2 class="anchored" data-anchor-id="factorial-experiment-under-rcbd">Factorial Experiment under RCBD</h2>
<ol type="1">
<li>Three strains of perennial ryegrass were grown as swards at each of the fertilizer levels. The three strains were S23, Kent &amp; a control. The fertilizer levels were heavy &amp; average. The experiment was laid out under randomized complete block design. The mid summer dry matter yields, in units of 10 lb/acre were as follows. Analyze the data &amp; construct a table of means with appropriate standard errors. Draw any graphs you deem fit to explain the results &amp; write a short report on the conclusions to be drawn from this experiment.</li>
</ol>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb98" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">DMY</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">299</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">318</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">284</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">279</span>,</span>
<span>    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">247</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">202</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">171</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">183</span>,</span>
<span>    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">403</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">439</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">355</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">324</span>,</span>
<span>    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">222</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">170</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">192</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">176</span>,</span>
<span>    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">382</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">353</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">383</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">310</span>,</span>
<span>    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">233</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">216</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">143</span></span>
<span>    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Blk</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"I"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"II"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"III"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"IV"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"S23"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Control"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Kent"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Heavy"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Average"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">DMY</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Blk</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   DMY Blk    Vart    Manu
1  299   I     S23   Heavy
2  318  II     S23   Heavy
3  284 III     S23   Heavy
4  279  IV     S23   Heavy
5  247   I     S23 Average
6  202  II     S23 Average
7  171 III     S23 Average
8  183  IV     S23 Average
9  403   I Control   Heavy
10 439  II Control   Heavy
11 355 III Control   Heavy
12 324  IV Control   Heavy
13 222   I Control Average
14 170  II Control Average
15 192 III Control Average
16 176  IV Control Average
17 382   I    Kent   Heavy
18 353  II    Kent   Heavy
19 383 III    Kent   Heavy
20 310  IV    Kent   Heavy
21 233   I    Kent Average
22 216  II    Kent Average
23 200 III    Kent Average
24 143  IV    Kent Average</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb100" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">DMY</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Blk</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: DMY
          Df Sum Sq Mean Sq  F value    Pr(&gt;F)    
Blk        3  12814    4271   7.1611  0.003294 ** 
Vart       2   6196    3098   5.1935  0.019324 *  
Manu       1 131128  131128 219.8375 2.287e-10 ***
Vart:Manu  2   9590    4795   8.0389  0.004239 ** 
Residuals 15   8947     596                       
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb102" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmip.html">emmip</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-3-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-17"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/unnamed-chunk-3-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb103" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmip.html">emmip</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-4-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-18"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/unnamed-chunk-4-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb104" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code> Vart    emmean   SE df lower.CL upper.CL
 S23        248 8.63 15      229      266
 Control    285 8.63 15      267      304
 Kent       278 8.63 15      259      296

Results are averaged over the levels of: Blk, Manu 
Confidence level used: 0.95 </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb106" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code> Manu    emmean   SE df lower.CL upper.CL
 Heavy      344 7.05 15      329      359
 Average    196 7.05 15      181      211

Results are averaged over the levels of: Blk, Vart 
Confidence level used: 0.95 </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb108" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Vart = S23:
 Manu    emmean   SE df lower.CL upper.CL
 Heavy      295 12.2 15      269      321
 Average    201 12.2 15      175      227

Vart = Control:
 Manu    emmean   SE df lower.CL upper.CL
 Heavy      380 12.2 15      354      406
 Average    190 12.2 15      164      216

Vart = Kent:
 Manu    emmean   SE df lower.CL upper.CL
 Heavy      357 12.2 15      331      383
 Average    198 12.2 15      172      224

Results are averaged over the levels of: Blk 
Confidence level used: 0.95 </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb110" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Manu = Heavy:
 Vart    emmean   SE df lower.CL upper.CL
 S23        295 12.2 15      269      321
 Control    380 12.2 15      354      406
 Kent       357 12.2 15      331      383

Manu = Average:
 Vart    emmean   SE df lower.CL upper.CL
 S23        201 12.2 15      175      227
 Control    190 12.2 15      164      216
 Kent       198 12.2 15      172      224

Results are averaged over the levels of: Blk 
Confidence level used: 0.95 </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb112" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">pairwise</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$emmeans
 Vart    emmean   SE df lower.CL upper.CL
 S23        248 8.63 15      229      266
 Control    285 8.63 15      267      304
 Kent       278 8.63 15      259      296

Results are averaged over the levels of: Blk, Manu 
Confidence level used: 0.95 

$contrasts
 contrast       estimate   SE df t.ratio p.value
 S23 - Control    -37.25 12.2 15  -3.050  0.0208
 S23 - Kent       -29.62 12.2 15  -2.426  0.0689
 Control - Kent     7.62 12.2 15   0.624  0.8092

Results are averaged over the levels of: Blk, Manu 
P value adjustment: tukey method for comparing a family of 3 estimates </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb114" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">pairwise</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$emmeans
 Manu    emmean   SE df lower.CL upper.CL
 Heavy      344 7.05 15      329      359
 Average    196 7.05 15      181      211

Results are averaged over the levels of: Blk, Vart 
Confidence level used: 0.95 

$contrasts
 contrast        estimate   SE df t.ratio p.value
 Heavy - Average      148 9.97 15  14.827 &lt;0.0001

Results are averaged over the levels of: Blk, Vart </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb116" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">pairwise</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$emmeans
Manu = Heavy:
 Vart    emmean   SE df lower.CL upper.CL
 S23        295 12.2 15      269      321
 Control    380 12.2 15      354      406
 Kent       357 12.2 15      331      383

Manu = Average:
 Vart    emmean   SE df lower.CL upper.CL
 S23        201 12.2 15      175      227
 Control    190 12.2 15      164      216
 Kent       198 12.2 15      172      224

Results are averaged over the levels of: Blk 
Confidence level used: 0.95 

$contrasts
Manu = Heavy:
 contrast       estimate   SE df t.ratio p.value
 S23 - Control    -85.25 17.3 15  -4.936  0.0005
 S23 - Kent       -62.00 17.3 15  -3.590  0.0071
 Control - Kent    23.25 17.3 15   1.346  0.3927

Manu = Average:
 contrast       estimate   SE df t.ratio p.value
 S23 - Control     10.75 17.3 15   0.622  0.8102
 S23 - Kent         2.75 17.3 15   0.159  0.9861
 Control - Kent    -8.00 17.3 15  -0.463  0.8893

Results are averaged over the levels of: Blk 
P value adjustment: tukey method for comparing a family of 3 estimates </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb118" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rvlenth.github.io/emmeans/reference/emmeans.html">emmeans</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">pairwise</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Manu</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Vart</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$emmeans
Vart = S23:
 Manu    emmean   SE df lower.CL upper.CL
 Heavy      295 12.2 15      269      321
 Average    201 12.2 15      175      227

Vart = Control:
 Manu    emmean   SE df lower.CL upper.CL
 Heavy      380 12.2 15      354      406
 Average    190 12.2 15      164      216

Vart = Kent:
 Manu    emmean   SE df lower.CL upper.CL
 Heavy      357 12.2 15      331      383
 Average    198 12.2 15      172      224

Results are averaged over the levels of: Blk 
Confidence level used: 0.95 

$contrasts
Vart = S23:
 contrast        estimate   SE df t.ratio p.value
 Heavy - Average     94.2 17.3 15   5.458 &lt;0.0001

Vart = Control:
 contrast        estimate   SE df t.ratio p.value
 Heavy - Average    190.2 17.3 15  11.016 &lt;0.0001

Vart = Kent:
 contrast        estimate   SE df t.ratio p.value
 Heavy - Average    159.0 17.3 15   9.207 &lt;0.0001

Results are averaged over the levels of: Blk </code></pre>
</div>
</div>
</section><section id="stability-analysis" class="level2"><h2 class="anchored" data-anchor-id="stability-analysis">Stability Analysis</h2>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb120" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://myaseen208.com/stability/">stability</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>help <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">stability</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/utils/data.html">data</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ge_data</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
</div>
<section id="individual-analysis-of-variance-for-each-location" class="level3"><h3 class="anchored" data-anchor-id="individual-analysis-of-variance-for-each-location">Individual Analysis of Variance for each Location</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb121" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield.indiv_anova</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span>         <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://myaseen208.com/stability/reference/indiv_anova.html">indiv_anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            .data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ge_data</span></span>
<span>          , .y    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span></span>
<span>          , .rep  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rep</span></span>
<span>          , .gen  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gen</span></span>
<span>          , .env  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Env</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield.indiv_anova</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$`Analysis of Variance for FSD`
            Df   Sum Sq Mean Sq F value Pr(&gt;F)    
Gen         59 45524231  771597   32.62 &lt;2e-16 ***
Residuals   60  1419180   23653                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for FSDR`
            Df   Sum Sq Mean Sq F value   Pr(&gt;F)    
Gen         59 14019781  237623   2.724 7.91e-05 ***
Residuals   60  5234860   87248                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for Okara`
            Df   Sum Sq Mean Sq F value   Pr(&gt;F)    
Gen         59 26802597  454281   3.538 1.22e-06 ***
Residuals   60  7703642  128394                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for Sargodha`
            Df   Sum Sq Mean Sq F value  Pr(&gt;F)    
Gen         59 38381469  650533   4.254 4.3e-08 ***
Residuals   60  9175301  152922                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for Gujranwala`
            Df   Sum Sq Mean Sq F value   Pr(&gt;F)    
Gen         59 41863914  709558   4.687 6.55e-09 ***
Residuals   60  9082956  151383                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for KotNaina`
            Df   Sum Sq Mean Sq F value   Pr(&gt;F)    
Gen         59 26692263  452411     4.3 3.51e-08 ***
Residuals   60  6313095  105218                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for KSK`
            Df   Sum Sq Mean Sq F value   Pr(&gt;F)    
Gen         59 17890629  303231   3.472 1.68e-06 ***
Residuals   60  5239575   87326                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for Khanewal`
            Df   Sum Sq Mean Sq F value   Pr(&gt;F)    
Gen         59 15125214  256360   2.451 0.000345 ***
Residuals   60  6274965  104583                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for Sahiwal`
            Df   Sum Sq Mean Sq F value   Pr(&gt;F)    
Gen         59 26109918  442541   4.095 8.82e-08 ***
Residuals   60  6484679  108078                     
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for Bhakkar`
            Df   Sum Sq Mean Sq F value  Pr(&gt;F)   
Gen         59 10870598  184247   1.862 0.00885 **
Residuals   60  5936717   98945                   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$`Analysis of Variance for Bahawalnagar`
            Df  Sum Sq Mean Sq F value Pr(&gt;F)  
Gen         59 9718292  164717   1.716 0.0196 *
Residuals   60 5760765   96013                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

attr(,"subheadings")
 [1] "Analysis of Variance for FSD"         
 [2] "Analysis of Variance for FSDR"        
 [3] "Analysis of Variance for Okara"       
 [4] "Analysis of Variance for Sargodha"    
 [5] "Analysis of Variance for Gujranwala"  
 [6] "Analysis of Variance for KotNaina"    
 [7] "Analysis of Variance for KSK"         
 [8] "Analysis of Variance for Khanewal"    
 [9] "Analysis of Variance for Sahiwal"     
[10] "Analysis of Variance for Bhakkar"     
[11] "Analysis of Variance for Bahawalnagar"</code></pre>
</div>
</div>
</section><section id="combined-analysis-of-variance" class="level3"><h3 class="anchored" data-anchor-id="combined-analysis-of-variance">Combined Analysis of Variance</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb123" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">YieldANOVA</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span>     <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://myaseen208.com/stability/reference/add_anova.html">add_anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            .data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ge_data</span></span>
<span>          , .y    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span></span>
<span>          , .rep  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rep</span></span>
<span>          , .gen  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gen</span></span>
<span>          , .env  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Env</span></span>
<span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">YieldANOVA</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$anova
Analysis of Variance Table

Response: .data[[Y]]
           Df    Sum Sq  Mean Sq F value    Pr(&gt;F)    
Env        10 263940496 26394050 68.0551 1.995e-08 ***
Rep(Env)   11   4266167   387833                      
Gen        59  71662431  1214617 12.2482 &lt; 2.2e-16 ***
Gen:Env   590 201336476   341248  3.4411 &lt; 2.2e-16 ***
Residuals 649  64359568    99167                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
</section><section id="additive-main-effects-and-multiplicative-interaction-ammi-analysis" class="level3"><h3 class="anchored" data-anchor-id="additive-main-effects-and-multiplicative-interaction-ammi-analysis">Additive Main Effects and Multiplicative Interaction (AMMI) Analysis</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb125" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield.ammi</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span>     <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://myaseen208.com/stability/reference/ammi.html">ammi</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            .data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ge_data</span></span>
<span>          , .y    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span></span>
<span>          , .rep  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rep</span></span>
<span>          , .gen  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gen</span></span>
<span>          , .env  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Env</span></span>
<span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield.ammi</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$anova
Analysis of Variance Table

Response: .data[[Y]]
           Df    Sum Sq  Mean Sq F value    Pr(&gt;F)    
Env        10 263940496 26394050 68.0551 1.995e-08 ***
Rep(Env)   11   4266167   387833                      
Gen        59  71662431  1214617 12.2482 &lt; 2.2e-16 ***
Gen:Env   590 201336476   341248  3.4411 &lt; 2.2e-16 ***
Residuals 649  64359568    99167                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

$pc.anova
# A tibble: 11 × 9
   PC     SingVal  Percent accumPerc    Df       SS  Mean.Sq  F.value   Pr..F.
   &lt;chr&gt;    &lt;dbl&gt;    &lt;dbl&gt;     &lt;dbl&gt; &lt;dbl&gt;    &lt;dbl&gt;    &lt;dbl&gt;    &lt;dbl&gt;    &lt;dbl&gt;
 1 PC1   4.50e+ 3 2.01e+ 1      20.1    68 4.04e+ 7 5.95e+ 5 6.00e+ 0 0       
 2 PC2   4.17e+ 3 1.73e+ 1      37.4    66 3.49e+ 7 5.28e+ 5 5.33e+ 0 0       
 3 PC3   4.05e+ 3 1.63e+ 1      53.7    64 3.27e+ 7 5.12e+ 5 5.16e+ 0 0       
 4 PC4   3.49e+ 3 1.21e+ 1      65.8    62 2.44e+ 7 3.93e+ 5 3.96e+ 0 0       
 5 PC5   3.38e+ 3 1.13e+ 1      77.1    60 2.29e+ 7 3.81e+ 5 3.84e+ 0 0       
 6 PC6   3.11e+ 3 9.63e+ 0      86.7    58 1.94e+ 7 3.34e+ 5 3.37e+ 0 4.02e-14
 7 PC7   2.30e+ 3 5.25e+ 0      92.0    56 1.06e+ 7 1.89e+ 5 1.90e+ 0 1.45e- 4
 8 PC8   2.03e+ 3 4.10e+ 0      96.1    54 8.25e+ 6 1.53e+ 5 1.54e+ 0 9.52e- 3
 9 PC9   1.52e+ 3 2.30e+ 0      98.4    52 4.63e+ 6 8.91e+ 4 8.98e- 1 6.77e- 1
10 PC10  1.28e+ 3 1.63e+ 0     100      50 3.27e+ 6 6.55e+ 4 6.60e- 1 9.66e- 1
11 PC11  2.08e-11 4.32e-28     100      48 8.69e-22 1.81e-23 1.83e-28 1   e+ 0</code></pre>
</div>
</div>
</section><section id="additive-main-effects-and-multiplicative-interaction-ammi-biplot-analysis" class="level3"><h3 class="anchored" data-anchor-id="additive-main-effects-and-multiplicative-interaction-ammi-biplot-analysis">Additive Main Effects and Multiplicative Interaction (AMMI) Biplot Analysis</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb127" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://myaseen208.com/stability/reference/ammi_biplot.html">ammi_biplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            .data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ge_data</span></span>
<span>          , .y    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span></span>
<span>          , .rep  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rep</span></span>
<span>          , .gen  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gen</span></span>
<span>          , .env  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Env</span></span>
<span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$aami.biplot</code></pre>
</div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-17-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-19"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/unnamed-chunk-17-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
<div class="cell-output cell-output-stdout">
<pre><code>
$MeanPC1Plot</code></pre>
</div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-17-2.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-20"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/unnamed-chunk-17-2.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section><section id="genotype-plus-genotypes-by-environment-gge-interaction-biplot-analysis" class="level3"><h3 class="anchored" data-anchor-id="genotype-plus-genotypes-by-environment-gge-interaction-biplot-analysis">Genotype plus Genotypes by Environment (GGE) Interaction Biplot Analysis</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb130" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://myaseen208.com/stability/reference/gge_biplot.html">gge_biplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            .data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ge_data</span></span>
<span>          , .y    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span></span>
<span>          , .rep  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rep</span></span>
<span>          , .gen  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gen</span></span>
<span>          , .env  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Env</span></span>
<span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$gge.biplot</code></pre>
</div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-18-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-21"><img src="https://myaseen208.com/blogs/2019-11-25_NARC/index_files/figure-html/unnamed-chunk-18-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>


</section></section><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2019,
  author = {Yaseen, Muhammad},
  title = {Training {Course} on {Capacity} {Building} of {NARS}
    {Scientists} in {Advance} {Analytical} {Techniques}},
  date = {2019-11-25},
  url = {https://myaseen208.com/blogs/2019-11-25_NARC/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2019" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2019. <span>“Training Course on Capacity Building of
NARS Scientists in Advance Analytical Techniques.”</span> November 25.
<a href="https://myaseen208.com/blogs/2019-11-25_NARC/">https://myaseen208.com/blogs/2019-11-25_NARC/</a>.
</div></div></section></div> ]]></description>
  <category>R</category>
  <category>Statistics</category>
  <category>Research</category>
  <guid>https://myaseen208.com/blogs/2019-11-25_NARC/</guid>
  <pubDate>Mon, 25 Nov 2019 05:00:00 GMT</pubDate>
  <media:content url="https://myaseen208.com/assets/img/blogs/2019-11-25_NARC/fig/PopRegFn.webp" medium="image" type="image/webp"/>
</item>
<item>
  <title>How to write a Research Paper and Hands on Training of SPSS - A Statistical Tool</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2019-04-18-UOL/</link>
  <description><![CDATA[ 




<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
</section>
<section id="statistics" class="level2">
<h2 class="anchored" data-anchor-id="statistics">Statistics</h2>
<blockquote class="blockquote">
<ul>
<li>Statistics deals with uncertainty &amp; variability</li>
<li>Statistics turns data into information</li>
<li>Data -&gt; Information -&gt; Knowledge -&gt; Wisdom</li>
<li>Statistics is the interpretation of Science</li>
<li>Statistics is the Art &amp; Science of learning from data</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/DS2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-1"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/DS2.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
<section id="variable" class="level2">
<h2 class="anchored" data-anchor-id="variable">Variable</h2>
<blockquote class="blockquote">
<ul>
<li>Characteristic that may vary from individual to individual</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section>
<section id="measurement" class="level2">
<h2 class="anchored" data-anchor-id="measurement">Measurement</h2>
<blockquote class="blockquote">
<ul>
<li>Process of assigning numbers or labels to objects or states in accordance with logically accepted rules</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section>
<section id="measurement-scales" class="level2">
<h2 class="anchored" data-anchor-id="measurement-scales">Measurement Scales</h2>
<blockquote class="blockquote">
<ul>
<li><strong>Nominal Scale:</strong> Obersvations may be classified into mutually exclusive &amp; exhaustive categories</li>
<li><strong>Ordinal Scale:</strong> Obersvations may be ranked</li>
<li><strong>Interval Scale:</strong> Difference between obersvations is meaningful</li>
<li><strong>Ratio Scale:</strong> Ratio between obersvations is meaningful &amp; true zero point</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section>
<section id="descriptive-statistics" class="level2">
<h2 class="anchored" data-anchor-id="descriptive-statistics">Descriptive Statistics</h2>
<blockquote class="blockquote">
<ul>
<li>No of observations</li>
<li>Measures of Central Tendency</li>
<li>Measures of Dispersion</li>
<li>Measures of Skewness</li>
<li>Measures of Kurtosis</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example" class="level3">
<h3 class="anchored" data-anchor-id="example">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Fertilizer (Kg/acre)</th>
<th>Production (Bushels/acre)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>100</td>
<td>70</td>
</tr>
<tr class="even">
<td>200</td>
<td>70</td>
</tr>
<tr class="odd">
<td>400</td>
<td>80</td>
</tr>
<tr class="even">
<td>500</td>
<td>100</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/DS2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-2"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/DS2.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; Descriptive Statistics &gt; Descriptives …</strong></em></p>
<p>&nbsp; <img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/DS2.webp" class="img-fluid"></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/DS3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-3"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/DS3.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/DS4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-4"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/DS4.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/DS5.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-5"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/DS5.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/DS6.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-6"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/DS6.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/DS7.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-7"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/DS7.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
</section>
<section id="boxwhisker-diagram" class="level2">
<h2 class="anchored" data-anchor-id="boxwhisker-diagram">Boxwhisker Diagram</h2>
<blockquote class="blockquote">
<ul>
<li>Pictorial display of five number summary (Minimum, Q1, Q2, Q3 and Maximum)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-1" class="level3">
<h3 class="anchored" data-anchor-id="example-1">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Yield</th>
<th>Variety</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>5</td>
<td>V1</td>
</tr>
<tr class="even">
<td>6</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>7</td>
<td>V1</td>
</tr>
<tr class="even">
<td>15</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>16</td>
<td>V2</td>
</tr>
<tr class="even">
<td>17</td>
<td>V2</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/BoxPlot2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-8"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/BoxPlot2.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><em><strong>Graphs &gt; Legacy Dialogs &gt; Scatter/Boxplot …</strong></em></p>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/BoxPlot2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-9"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/BoxPlot2.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/BoxPlot3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-10"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/BoxPlot3.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/BoxPlot4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-11"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/BoxPlot4.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/BoxPlot5.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-12"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/BoxPlot5.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
</section>
<section id="regression-analysis" class="level2">
<h2 class="anchored" data-anchor-id="regression-analysis">Regression Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on quantitative explanatory variable(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/PopRegFn.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-13"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/PopRegFn.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
<section id="simple-linear-regression" class="level2">
<h2 class="anchored" data-anchor-id="simple-linear-regression">Simple Linear Regression</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on a quantitative explanatory variable</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-2" class="level3">
<h3 class="anchored" data-anchor-id="example-2">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Fertilizer (Kg/acre)</th>
<th>Production (Bushels/acre)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>100</td>
<td>70</td>
</tr>
<tr class="even">
<td>200</td>
<td>70</td>
</tr>
<tr class="odd">
<td>400</td>
<td>80</td>
</tr>
<tr class="even">
<td>500</td>
<td>100</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/SLR1.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-14"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/SLR1.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><em><strong>Graphs &gt; Legacy Dialogs &gt; Scatter/Dot …</strong></em></p>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/ScatterPlot1.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-15"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/ScatterPlot1.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/ScatterPlot2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-16"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/ScatterPlot2.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/ScatterPlot3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-17"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/ScatterPlot3.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/ScatterPlot4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-18"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/ScatterPlot4.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; Regression &gt; Linear …</strong></em></p>
<p>&nbsp;</p>
<p><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/SLR2.webp" class="img-fluid"> <img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/SLR3.webp" class="img-fluid"></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/SLR4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-19"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/SLR4.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/SLR5.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-20"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/SLR5.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/SLR6.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-21"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/SLR6.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/SLR7.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-22"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/SLR7.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
<section id="exercise" class="level3">
<h3 class="anchored" data-anchor-id="exercise">Exercise</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Fertilizer</th>
<th>Yield</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>0.3</td>
<td>10</td>
</tr>
<tr class="even">
<td>0.6</td>
<td>15</td>
</tr>
<tr class="odd">
<td>0.9</td>
<td>30</td>
</tr>
<tr class="even">
<td>1.2</td>
<td>35</td>
</tr>
<tr class="odd">
<td>1.5</td>
<td>25</td>
</tr>
<tr class="even">
<td>1.8</td>
<td>30</td>
</tr>
<tr class="odd">
<td>2.1</td>
<td>50</td>
</tr>
<tr class="even">
<td>2.4</td>
<td>45</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
<section id="exercise-1" class="level3">
<h3 class="anchored" data-anchor-id="exercise-1">Exercise</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Weekly Income ($)</th>
<th>Weekly Expenditures ($)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>80</td>
<td>70</td>
</tr>
<tr class="even">
<td>100</td>
<td>65</td>
</tr>
<tr class="odd">
<td>120</td>
<td>90</td>
</tr>
<tr class="even">
<td>140</td>
<td>95</td>
</tr>
<tr class="odd">
<td>160</td>
<td>110</td>
</tr>
<tr class="even">
<td>180</td>
<td>115</td>
</tr>
<tr class="odd">
<td>200</td>
<td>120</td>
</tr>
<tr class="even">
<td>220</td>
<td>140</td>
</tr>
<tr class="odd">
<td>240</td>
<td>155</td>
</tr>
<tr class="even">
<td>260</td>
<td>150</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
</section>
<section id="multiple-linear-regression" class="level2">
<h2 class="anchored" data-anchor-id="multiple-linear-regression">Multiple Linear Regression</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on two or more quantitative explanatory variables</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-3" class="level3">
<h3 class="anchored" data-anchor-id="example-3">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Fertilizer (Kg)</th>
<th>Rainfall (mm)</th>
<th>Yield (Kg)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>100</td>
<td>10</td>
<td>40</td>
</tr>
<tr class="even">
<td>200</td>
<td>20</td>
<td>50</td>
</tr>
<tr class="odd">
<td>300</td>
<td>10</td>
<td>50</td>
</tr>
<tr class="even">
<td>400</td>
<td>30</td>
<td>70</td>
</tr>
<tr class="odd">
<td>500</td>
<td>20</td>
<td>65</td>
</tr>
<tr class="even">
<td>600</td>
<td>20</td>
<td>65</td>
</tr>
<tr class="odd">
<td>700</td>
<td>30</td>
<td>80</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><a href="./fig/MLR1.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-23"><img src="https://myaseen208.com/blogs/2019-04-18-UOL/fig/MLR1.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; Regression &gt; Linear …</strong></em></p>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/MLR2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-24"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/MLR2.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/MLR3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-25"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/MLR3.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/MLR4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-26"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/MLR4.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/MLR5.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-27"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/MLR5.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/MLR6.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-28"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/MLR6.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
</section>
<section id="correlation-analysis" class="level2">
<h2 class="anchored" data-anchor-id="correlation-analysis">Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Quantitative Variables</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section>
<section id="simple-correlation-analysis" class="level2">
<h2 class="anchored" data-anchor-id="simple-correlation-analysis">Simple Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Two Quantitative Variables</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cleft(X_%7B1%7D,X_%7B2%7D%5Cright)"></li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-4" class="level3">
<h3 class="anchored" data-anchor-id="example-4">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Sparrow Wing length (cm)</th>
<th>Sparrow Tail length (cm)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>10.4</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.8</td>
<td>7.6</td>
</tr>
<tr class="odd">
<td>11.1</td>
<td>7.9</td>
</tr>
<tr class="even">
<td>10.2</td>
<td>7.2</td>
</tr>
<tr class="odd">
<td>10.3</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.2</td>
<td>7.1</td>
</tr>
<tr class="odd">
<td>10.7</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.5</td>
<td>7.2</td>
</tr>
<tr class="odd">
<td>10.8</td>
<td>7.8</td>
</tr>
<tr class="even">
<td>11.2</td>
<td>7.7</td>
</tr>
<tr class="odd">
<td>10.6</td>
<td>7.8</td>
</tr>
<tr class="even">
<td>11.4</td>
<td>8.3</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/Corr1.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-29"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/Corr1.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; Correlate &gt; Bivariate …</strong></em></p>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/Corr2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-30"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/Corr2.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/Corr3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-31"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/Corr3.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/Corr4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-32"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/Corr4.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
</section>
<section id="partial-correlation-analysis" class="level2">
<h2 class="anchored" data-anchor-id="partial-correlation-analysis">Partial Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Quantitative Variables while holding/keeping all other constants</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cleft(X_%7B1%7D,X_%7B2%7D%5Cright)%7CX_%7B3%7D"></li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-5" class="level3">
<h3 class="anchored" data-anchor-id="example-5">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Leaf Area (cm^2)</th>
<th>Leaf Moisture (%)</th>
<th>Total Shoot Length (cm)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>72</td>
<td>80</td>
<td>307</td>
</tr>
<tr class="even">
<td>174</td>
<td>75</td>
<td>529</td>
</tr>
<tr class="odd">
<td>116</td>
<td>81</td>
<td>632</td>
</tr>
<tr class="even">
<td>78</td>
<td>83</td>
<td>527</td>
</tr>
<tr class="odd">
<td>134</td>
<td>79</td>
<td>442</td>
</tr>
<tr class="even">
<td>95</td>
<td>81</td>
<td>525</td>
</tr>
<tr class="odd">
<td>113</td>
<td>80</td>
<td>481</td>
</tr>
<tr class="even">
<td>98</td>
<td>81</td>
<td>710</td>
</tr>
<tr class="odd">
<td>148</td>
<td>74</td>
<td>422</td>
</tr>
<tr class="even">
<td>42</td>
<td>78</td>
<td>345</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/PartCorr1.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-33"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/PartCorr1.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; Correlate &gt; Partial …</strong></em></p>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/PartCorr2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-34"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/PartCorr2.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/PartCorr3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-35"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/PartCorr3.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2019-04-18-UOL/fig/PartCorr4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-36"><img src="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/PartCorr4.webp" class="img-fluid"></a></p>


</section>
</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2019,
  author = {Yaseen, Muhammad},
  title = {How to Write a {Research} {Paper} and {Hands} on {Training}
    of {SPSS} - {A} {Statistical} {Tool}},
  date = {2019-04-18},
  url = {https://myaseen208.com/blogs/2019-04-18-UOL/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2019" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2019. <span>“How to Write a Research Paper and Hands
on Training of SPSS - A Statistical Tool.”</span> April 18. <a href="https://myaseen208.com/blogs/2019-04-18-UOL/">https://myaseen208.com/blogs/2019-04-18-UOL/</a>.
</div></div></section></div> ]]></description>
  <category>Data Science</category>
  <category>Statistics</category>
  <category>Research</category>
  <category>SPSS</category>
  <guid>https://myaseen208.com/blogs/2019-04-18-UOL/</guid>
  <pubDate>Thu, 18 Apr 2019 04:00:00 GMT</pubDate>
  <media:content url="https://myaseen208.com/assets/img/blogs/2019-04-18-UOL/fig/DS2.webp" medium="image" type="image/webp"/>
</item>
<item>
  <title>Improving Quality in Textile Industry using Six Sigma with R</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2019-SixSigmawithR/</link>
  <description><![CDATA[ <p><a href="../../assets/img/blogs/2019-SixSigmawithR/fig/SixSigmaR3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-1"><img src="https://myaseen208.com/assets/img/blogs/2019-SixSigmawithR/fig/SixSigmaR3.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2019-SixSigmawithR/fig/2019-SixSigmaR.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-2"><img src="https://myaseen208.com/assets/img/blogs/2019-SixSigmawithR/fig/2019-SixSigmaR.webp" class="img-fluid"></a></p>



<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2019,
  author = {Yaseen, Muhammad},
  title = {Improving {Quality} in {Textile} {Industry} Using {Six}
    {Sigma} with {R}},
  date = {2019-01-12},
  url = {https://myaseen208.com/blogs/2019-SixSigmawithR/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2019" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2019. <span>“Improving Quality in Textile Industry
Using Six Sigma with R.”</span> January 12. <a href="https://myaseen208.com/blogs/2019-SixSigmawithR/">https://myaseen208.com/blogs/2019-SixSigmawithR/</a>.
</div></div></section></div> ]]></description>
  <category>Six Sigma</category>
  <category>Quality Control</category>
  <category>DMAIC</category>
  <category>R</category>
  <category>Statistics</category>
  <category>Data Science</category>
  <guid>https://myaseen208.com/blogs/2019-SixSigmawithR/</guid>
  <pubDate>Sat, 12 Jan 2019 05:00:00 GMT</pubDate>
  <media:content url="https://myaseen208.com/assets/img/blogs/2019-SixSigmawithR/fig/SixSigmaR3.webp" medium="image" type="image/webp"/>
</item>
<item>
  <title>Regression Analysis with Python</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2018-09-20_RegPython/</link>
  <description><![CDATA[ <section id="introduction" class="level1"><h1>Introduction</h1>
<blockquote class="blockquote">
<ul>
<li>In God we trust, all others must bring data. (W. Edwards Deming)</li>
<li>In Data we trust, all others must bring data.</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section><section id="statistics" class="level1"><h1>Statistics</h1>
<blockquote class="blockquote">
<ul>
<li>Statistics is the science of uncertainty &amp; variability</li>
<li>Statistics turns data into information</li>
<li>Data -&gt; Information -&gt; Knowledge -&gt; Wisdom</li>
<li>Data Driven Decisions (3Ds)</li>
<li>Statistics is the interpretation of Science</li>
<li>Statistics is the Art &amp; Science of learning from data</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section><section id="variable" class="level1"><h1>Variable</h1>
<blockquote class="blockquote">
<ul>
<li>Characteristic that may vary from individual to individual</li>
<li>Height, Weight, CGPA etc</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section><section id="measurement" class="level1"><h1>Measurement</h1>
<blockquote class="blockquote">
<ul>
<li>Process of assigning numbers or labels to objects or states in accordance with logically accepted rules</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section><section id="measurement-scales" class="level1"><h1>Measurement Scales</h1>
<blockquote class="blockquote">
<ul>
<li>
<strong>Nominal Scale:</strong> Obersvations may be classified into mutually exclusive &amp; exhaustive classes or categories</li>
<li>
<strong>Ordinal Scale:</strong> Obersvations may be ranked</li>
<li>
<strong>Interval Scale:</strong> Difference between obersvations is meaningful</li>
<li>
<strong>Ratio Scale:</strong> Ratio between obersvations is meaningful &amp; true zero point</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section><section id="regression-analysis" class="level1"><h1>Regression Analysis</h1>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on quantitative explanatory variable(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="../../assets/img/blogs/2018-09-20_RegPython/fig/PopRegFn.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-1" title="Population Regression Function"><img src="https://myaseen208.com/assets/img/blogs/2018-09-20_RegPython/fig/PopRegFn.webp" class="img-fluid quarto-figure quarto-figure-center figure-img" style="width:100.0%" alt="Population Regression Function"></a></p>
</figure>
</div>
<figcaption>Population Regression Function</figcaption></figure>
</div>
</div>
</div>
<p>&nbsp;</p>
</section><section id="simple-linear-regression" class="level1"><h1>Simple Linear Regression</h1>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on a quantitative explanatory variable</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example" class="level2"><h2 class="anchored" data-anchor-id="example">Example</h2>
<table class="caption-top table">
<thead><tr class="header">
<th>Weekly Income ($)</th>
<th>Weekly Expenditures ($)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>80</td>
<td>70</td>
</tr>
<tr class="even">
<td>100</td>
<td>65</td>
</tr>
<tr class="odd">
<td>120</td>
<td>90</td>
</tr>
<tr class="even">
<td>140</td>
<td>95</td>
</tr>
<tr class="odd">
<td>160</td>
<td>110</td>
</tr>
<tr class="even">
<td>180</td>
<td>115</td>
</tr>
<tr class="odd">
<td>200</td>
<td>120</td>
</tr>
<tr class="even">
<td>220</td>
<td>140</td>
</tr>
<tr class="odd">
<td>240</td>
<td>155</td>
</tr>
<tr class="even">
<td>260</td>
<td>150</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb1" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb1-1">Income <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">120</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">140</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">160</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">180</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">220</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">240</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">260</span>]</span>
<span id="cb1-2">Expend <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">65</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">90</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">95</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">110</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">115</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">120</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">140</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">155</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">150</span>]</span></code></pre></div></div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb2" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb2-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> pandas <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> pd</span>
<span id="cb2-2">df1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> pd.DataFrame(</span>
<span id="cb2-3"> {</span>
<span id="cb2-4">   <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Income"</span>: Income</span>
<span id="cb2-5"> , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Expend"</span>: Expend</span>
<span id="cb2-6"> }</span>
<span id="cb2-7"> )</span>
<span id="cb2-8"></span>
<span id="cb2-9"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(df1)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Income  Expend
0      80      70
1     100      65
2     120      90
3     140      95
4     160     110
5     180     115
6     200     120
7     220     140
8     240     155
9     260     150</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb4" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb4-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> matplotlib <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> pyplot <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> plt</span>
<span id="cb4-2">fig <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> plt.figure()</span>
<span id="cb4-3">plt.scatter(</span>
<span id="cb4-4">  df1[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Income"</span>]</span>
<span id="cb4-5">, df1[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Expend"</span>]</span>
<span id="cb4-6">, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"green"</span></span>
<span id="cb4-7">, marker <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"o"</span></span>
<span id="cb4-8">)</span>
<span id="cb4-9">plt.title(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Scatter plot of Weekly Income (</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">$) and Weekly Expenditures (</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">$)"</span>)</span>
<span id="cb4-10">plt.xlabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Weekly Income (</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">$)"</span>)</span>
<span id="cb4-11">plt.ylabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Weekly Expenditures (</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">$)"</span>)</span>
<span id="cb4-12">plt.show()</span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-5-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-2"><img src="https://myaseen208.com/blogs/2018-09-20_RegPython/index_files/figure-html/unnamed-chunk-5-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb5" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb5-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> statsmodels.formula.api <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> ols</span>
<span id="cb5-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> statsmodels.stats.anova <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> anova_lm</span>
<span id="cb5-3">Reg1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> ols(formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Expend ~ Income"</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> df1)</span>
<span id="cb5-4">Fit1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Reg1.fit()</span>
<span id="cb5-5"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit1.summary())</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>                            OLS Regression Results                            
==============================================================================
Dep. Variable:                 Expend   R-squared:                       0.962
Model:                            OLS   Adj. R-squared:                  0.957
Method:                 Least Squares   F-statistic:                     202.9
Date:                Wed, 29 Apr 2026   Prob (F-statistic):           5.75e-07
Time:                        14:14:27   Log-Likelihood:                -31.781
No. Observations:                  10   AIC:                             67.56
Df Residuals:                       8   BIC:                             68.17
Df Model:                           1                                         
Covariance Type:            nonrobust                                         
==============================================================================
                 coef    std err          t      P&gt;|t|      [0.025      0.975]
------------------------------------------------------------------------------
Intercept     24.4545      6.414      3.813      0.005       9.664      39.245
Income         0.5091      0.036     14.243      0.000       0.427       0.592
==============================================================================
Omnibus:                        1.060   Durbin-Watson:                   2.680
Prob(Omnibus):                  0.589   Jarque-Bera (JB):                0.777
Skew:                          -0.398   Prob(JB):                        0.678
Kurtosis:                       1.891   Cond. No.                         561.
==============================================================================

Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb7" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb7-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit1.params)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Intercept    24.454545
Income        0.509091
dtype: float64</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb9" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb9-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit1.fittedvalues)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>0     65.181818
1     75.363636
2     85.545455
3     95.727273
4    105.909091
5    116.090909
6    126.272727
7    136.454545
8    146.636364
9    156.818182
dtype: float64</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb11" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb11-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit1.resid)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>0     4.818182
1   -10.363636
2     4.454545
3    -0.727273
4     4.090909
5    -1.090909
6    -6.272727
7     3.545455
8     8.363636
9    -6.818182
dtype: float64</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb13" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb13-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit1.bse)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Intercept    6.413817
Income       0.035743
dtype: float64</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb15" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb15-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit1.centered_tss)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>8890.0</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb17" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb17-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(anova_lm(Fit1))</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>           df       sum_sq      mean_sq           F        PR(&gt;F)
Income    1.0  8552.727273  8552.727273  202.867925  5.752746e-07
Residual  8.0   337.272727    42.159091         NaN           NaN</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb19" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb19-1">fig <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> plt.figure()</span>
<span id="cb19-2">plt.scatter(</span>
<span id="cb19-3">  df1[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Income"</span>]</span>
<span id="cb19-4">, df1[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Expend"</span>]</span>
<span id="cb19-5">, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"green"</span></span>
<span id="cb19-6">, marker <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"o"</span></span>
<span id="cb19-7">)</span>
<span id="cb19-8">plt.plot(df1[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Income"</span>], Fit1.fittedvalues)</span>
<span id="cb19-9">plt.title(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Regression plot of Weekly Income (</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">$) and Weekly Expenditures (</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">$)"</span>)</span>
<span id="cb19-10">plt.xlabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Weekly Income (</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">$)"</span>)</span>
<span id="cb19-11">plt.ylabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Weekly Expenditures (</span><span class="er" style="color: #AD0000;
background-color: null;
font-style: inherit;">\</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">$)"</span>)</span>
<span id="cb19-12">plt.show()</span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-13-3.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-3"><img src="https://myaseen208.com/blogs/2018-09-20_RegPython/index_files/figure-html/unnamed-chunk-13-3.svg" class="img-fluid quarto-figure quarto-figure-center figure-img"></a></p>
</figure>
</div>
</div>
</div>
</section></section><section id="multiple-linear-regression" class="level1"><h1>Multiple Linear Regression</h1>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on two or more quantitative explanatory variables</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-1" class="level2"><h2 class="anchored" data-anchor-id="example-1">Example</h2>
<table class="caption-top table">
<thead><tr class="header">
<th>Fertilizer (Kg)</th>
<th>Rainfall (mm)</th>
<th>Yield (Kg)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>100</td>
<td>10</td>
<td>40</td>
</tr>
<tr class="even">
<td>200</td>
<td>20</td>
<td>50</td>
</tr>
<tr class="odd">
<td>300</td>
<td>10</td>
<td>50</td>
</tr>
<tr class="even">
<td>400</td>
<td>30</td>
<td>70</td>
</tr>
<tr class="odd">
<td>500</td>
<td>20</td>
<td>65</td>
</tr>
<tr class="even">
<td>600</td>
<td>20</td>
<td>65</td>
</tr>
<tr class="odd">
<td>700</td>
<td>30</td>
<td>80</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb20" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb20-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb20-2">Fertilizer <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.arange(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">800</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>)</span>
<span id="cb20-3">Rainfall   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>]</span>
<span id="cb20-4">Yield      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">40</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">65</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">65</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>]</span></code></pre></div></div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb21" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb21-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> pandas <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> pd</span>
<span id="cb21-2">df2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> pd.DataFrame(</span>
<span id="cb21-3"> {</span>
<span id="cb21-4">   <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fertilizer"</span>: Fertilizer</span>
<span id="cb21-5"> , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Rainfall"</span>: Rainfall</span>
<span id="cb21-6"> , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span>: Yield</span>
<span id="cb21-7"> }</span>
<span id="cb21-8"> )</span>
<span id="cb21-9"></span>
<span id="cb21-10"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(df2)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Fertilizer  Rainfall  Yield
0         100        10     40
1         200        20     50
2         300        10     50
3         400        30     70
4         500        20     65
5         600        20     65
6         700        30     80</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb23" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb23-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> mpl_toolkits.mplot3d <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> Axes3D</span>
<span id="cb23-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> matplotlib <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> pyplot <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> plt</span>
<span id="cb23-3">fig <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> plt.figure()</span>
<span id="cb23-4">ax <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> fig.add_subplot(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">111</span>, projection <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"3d"</span>)</span>
<span id="cb23-5">ax.scatter(</span>
<span id="cb23-6">  df2[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fertilizer"</span>]</span>
<span id="cb23-7">, df2[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Rainfall"</span>]</span>
<span id="cb23-8">, df2[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span>]</span>
<span id="cb23-9">, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"green"</span></span>
<span id="cb23-10">, marker <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"o"</span></span>
<span id="cb23-11">, alpha  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="cb23-12">)</span>
<span id="cb23-13">ax.set_xlabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fertilizer"</span>)</span>
<span id="cb23-14">ax.set_ylabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Rainfall"</span>)</span>
<span id="cb23-15">ax.set_zlabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span>)</span>
<span id="cb23-16">plt.show()</span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-16-5.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-4"><img src="https://myaseen208.com/blogs/2018-09-20_RegPython/index_files/figure-html/unnamed-chunk-16-5.svg" class="img-fluid quarto-figure quarto-figure-center figure-img"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb24" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb24-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> statsmodels.formula.api <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> ols</span>
<span id="cb24-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> statsmodels.stats.anova <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> anova_lm</span>
<span id="cb24-3">Reg2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> ols(formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield ~ Fertilizer + Rainfall"</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> df2)</span>
<span id="cb24-4">Fit2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Reg2.fit()</span>
<span id="cb24-5"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit2.summary())</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>                            OLS Regression Results                            
==============================================================================
Dep. Variable:                  Yield   R-squared:                       0.981
Model:                            OLS   Adj. R-squared:                  0.972
Method:                 Least Squares   F-statistic:                     105.3
Date:                Wed, 29 Apr 2026   Prob (F-statistic):           0.000347
Time:                        14:14:28   Log-Likelihood:                -13.848
No. Observations:                   7   AIC:                             33.70
Df Residuals:                       4   BIC:                             33.53
Df Model:                           2                                         
Covariance Type:            nonrobust                                         
==============================================================================
                 coef    std err          t      P&gt;|t|      [0.025      0.975]
------------------------------------------------------------------------------
Intercept     28.0952      2.491     11.277      0.000      21.178      35.013
Fertilizer     0.0381      0.006      6.532      0.003       0.022       0.054
Rainfall       0.8333      0.154      5.401      0.006       0.405       1.262
==============================================================================
Omnibus:                          nan   Durbin-Watson:                   2.249
Prob(Omnibus):                    nan   Jarque-Bera (JB):                0.705
Skew:                          -0.408   Prob(JB):                        0.703
Kurtosis:                       1.677   Cond. No.                     1.28e+03
==============================================================================

Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.
[2] The condition number is large, 1.28e+03. This might indicate that there are
strong multicollinearity or other numerical problems.</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb26" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb26-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit2.params)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Intercept     28.095238
Fertilizer     0.038095
Rainfall       0.833333
dtype: float64</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb28" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb28-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit2.fittedvalues)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>0    40.238095
1    52.380952
2    47.857143
3    68.333333
4    63.809524
5    67.619048
6    79.761905
dtype: float64</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb30" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb30-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit2.resid)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>0   -0.238095
1   -2.380952
2    2.142857
3    1.666667
4    1.190476
5   -2.619048
6    0.238095
dtype: float64</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb32" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb32-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit2.bse)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Intercept     2.491482
Fertilizer    0.005832
Rainfall      0.154303
dtype: float64</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb34" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb34-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit2.centered_tss)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>1150.0</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb36" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb36-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(anova_lm(Fit2))</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>             df      sum_sq     mean_sq           F    PR(&gt;F)
Fertilizer  1.0  972.321429  972.321429  181.500000  0.000176
Rainfall    1.0  156.250000  156.250000   29.166667  0.005690
Residual    4.0   21.428571    5.357143         NaN       NaN</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb38" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb38-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> mpl_toolkits.mplot3d <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> Axes3D</span>
<span id="cb38-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> matplotlib <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> pyplot <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> plt</span>
<span id="cb38-3"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> numpy <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> np</span>
<span id="cb38-4"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> pandas <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> pd</span>
<span id="cb38-5"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> matplotlib <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> cm</span>
<span id="cb38-6"></span>
<span id="cb38-7">fig <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> plt.figure()</span>
<span id="cb38-8">ax <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> fig.add_subplot(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">111</span>, projection<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"3d"</span>)</span>
<span id="cb38-9"></span>
<span id="cb38-10">ax.scatter(</span>
<span id="cb38-11">    df2[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fertilizer"</span>],</span>
<span id="cb38-12">    df2[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Rainfall"</span>],</span>
<span id="cb38-13">    df2[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span>],</span>
<span id="cb38-14">    color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"green"</span>,</span>
<span id="cb38-15">    marker<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"o"</span>,</span>
<span id="cb38-16">    alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span></span>
<span id="cb38-17">)</span>
<span id="cb38-18"></span>
<span id="cb38-19">ax.set_xlabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fertilizer"</span>)</span>
<span id="cb38-20">ax.set_ylabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Rainfall"</span>)</span>
<span id="cb38-21">ax.set_zlabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span>)</span>
<span id="cb38-22"></span>
<span id="cb38-23">x_surf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.arange(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">720</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>)</span>
<span id="cb38-24">y_surf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.arange(<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">32</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>)</span>
<span id="cb38-25">x_surf, y_surf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> np.meshgrid(x_surf, y_surf)</span>
<span id="cb38-26"></span>
<span id="cb38-27">exog <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> pd.DataFrame({</span>
<span id="cb38-28">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fertilizer"</span>: x_surf.ravel(),</span>
<span id="cb38-29">    <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Rainfall"</span>: y_surf.ravel()</span>
<span id="cb38-30">})</span>
<span id="cb38-31"></span>
<span id="cb38-32">out <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Fit2.predict(exog<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>exog)</span>
<span id="cb38-33"></span>
<span id="cb38-34"><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># ✅ Convert to numpy before reshaping</span></span>
<span id="cb38-35">z_surf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> out.to_numpy().reshape(x_surf.shape)</span>
<span id="cb38-36"></span>
<span id="cb38-37">ax.plot_surface(</span>
<span id="cb38-38">    x_surf,</span>
<span id="cb38-39">    y_surf,</span>
<span id="cb38-40">    z_surf,</span>
<span id="cb38-41">    rstride<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,</span>
<span id="cb38-42">    cstride<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,</span>
<span id="cb38-43">    color<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"None"</span>,</span>
<span id="cb38-44">    alpha<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.4</span></span>
<span id="cb38-45">)</span>
<span id="cb38-46"></span>
<span id="cb38-47">plt.show()</span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-24-7.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-5"><img src="https://myaseen208.com/blogs/2018-09-20_RegPython/index_files/figure-html/unnamed-chunk-24-7.svg" class="img-fluid quarto-figure quarto-figure-center figure-img"></a></p>
</figure>
</div>
</div>
</div>
</section></section><section id="polynomial-regression-analysis" class="level1"><h1>Polynomial Regression Analysis</h1>
<blockquote class="blockquote">
<ul>
<li>Quantifying non-linear dependency of a normal response on quantitative explanatory variable(s)</li>
</ul>
</blockquote>
<section id="example-2" class="level2"><h2 class="anchored" data-anchor-id="example-2">Example</h2>
<blockquote class="blockquote">
<p>An experiment was conducted to evaluate the effects of different levels of nitrogen. Three levels of nitrogen: 0, 10 and 20 grams per plot were used in the experiment. Each treatment was replicated twice and data is given below:</p>
</blockquote>
<table class="caption-top table">
<thead><tr class="header">
<th>Nitrogen</th>
<th>Yield</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>0</td>
<td>5</td>
</tr>
<tr class="even">
<td>0</td>
<td>7</td>
</tr>
<tr class="odd">
<td>10</td>
<td>15</td>
</tr>
<tr class="even">
<td>10</td>
<td>17</td>
</tr>
<tr class="odd">
<td>20</td>
<td>9</td>
</tr>
<tr class="even">
<td>20</td>
<td>11</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb39" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb39-1">Nitrogen <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>]</span>
<span id="cb39-2">Yield    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> [<span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>,  <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>, <span class="dv" style="color: #AD0000;
background-color: null;
font-style: inherit;">11</span>]</span></code></pre></div></div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb40" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb40-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> pandas <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> pd</span>
<span id="cb40-2">df3 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> pd.DataFrame(</span>
<span id="cb40-3"> {</span>
<span id="cb40-4">   <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nitrogen"</span>: Nitrogen</span>
<span id="cb40-5"> , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span>: Yield</span>
<span id="cb40-6"> }</span>
<span id="cb40-7"> )</span>
<span id="cb40-8"></span>
<span id="cb40-9"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(df3)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Nitrogen  Yield
0         0      5
1         0      7
2        10     15
3        10     17
4        20      9
5        20     11</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb42" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb42-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> matplotlib <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> pyplot <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">as</span> plt</span>
<span id="cb42-2">fig <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> plt.figure()</span>
<span id="cb42-3">plt.scatter(</span>
<span id="cb42-4">  df3[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nitrogen"</span>]</span>
<span id="cb42-5">, df3[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span>]</span>
<span id="cb42-6">, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"green"</span></span>
<span id="cb42-7">, marker <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"o"</span></span>
<span id="cb42-8">)</span>
<span id="cb42-9">plt.title(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Scatter plot of Nitrogen and Yield"</span>)</span>
<span id="cb42-10">plt.xlabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nitrogen"</span>)</span>
<span id="cb42-11">plt.ylabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span>)</span>
<span id="cb42-12">plt.show()</span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-27-9.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-6"><img src="https://myaseen208.com/blogs/2018-09-20_RegPython/index_files/figure-html/unnamed-chunk-27-9.svg" class="img-fluid quarto-figure quarto-figure-center figure-img"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb43" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb43-1"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> statsmodels.formula.api <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> ols</span>
<span id="cb43-2"><span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">from</span> statsmodels.stats.anova <span class="im" style="color: #00769E;
background-color: null;
font-style: inherit;">import</span> anova_lm</span>
<span id="cb43-3">Reg3 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> ols(formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield ~ Nitrogen + I(Nitrogen**2)"</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> df3)</span>
<span id="cb43-4">Fit3 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> Reg3.fit()</span>
<span id="cb43-5"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit3.summary())</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>                            OLS Regression Results                            
==============================================================================
Dep. Variable:                  Yield   R-squared:                       0.944
Model:                            OLS   Adj. R-squared:                  0.907
Method:                 Least Squares   F-statistic:                     25.33
Date:                Wed, 29 Apr 2026   Prob (F-statistic):             0.0132
Time:                        14:14:29   Log-Likelihood:                -8.5136
No. Observations:                   6   AIC:                             23.03
Df Residuals:                       3   BIC:                             22.40
Df Model:                           2                                         
Covariance Type:            nonrobust                                         
====================================================================================
                       coef    std err          t      P&gt;|t|      [0.025      0.975]
------------------------------------------------------------------------------------
Intercept            6.0000      1.000      6.000      0.009       2.818       9.182
Nitrogen             1.8000      0.255      7.060      0.006       0.989       2.611
I(Nitrogen ** 2)    -0.0800      0.012     -6.532      0.007      -0.119      -0.041
==============================================================================
Omnibus:                          nan   Durbin-Watson:                   3.333
Prob(Omnibus):                    nan   Jarque-Bera (JB):                1.000
Skew:                           0.000   Prob(JB):                        0.607
Kurtosis:                       1.000   Cond. No.                         418.
==============================================================================

Notes:
[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb45" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb45-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit3.params)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Intercept           6.00
Nitrogen            1.80
I(Nitrogen ** 2)   -0.08
dtype: float64</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb47" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb47-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit3.fittedvalues)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>0     6.0
1     6.0
2    16.0
3    16.0
4    10.0
5    10.0
dtype: float64</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb49" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb49-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit3.resid)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>0   -1.0
1    1.0
2   -1.0
3    1.0
4   -1.0
5    1.0
dtype: float64</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb51" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb51-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit3.bse)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Intercept           1.000000
Nitrogen            0.254951
I(Nitrogen ** 2)    0.012247
dtype: float64</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb53" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb53-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(Fit3.centered_tss)</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>107.33333333333334</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb55" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb55-1"><span class="bu" style="color: null;
background-color: null;
font-style: inherit;">print</span>(anova_lm(Fit3))</span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>                   df     sum_sq    mean_sq          F    PR(&gt;F)
Nitrogen          1.0  16.000000  16.000000   8.000000  0.066276
I(Nitrogen ** 2)  1.0  85.333333  85.333333  42.666667  0.007292
Residual          3.0   6.000000   2.000000        NaN       NaN</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode cell-code" id="cb57" style="background: #f1f3f5;"><pre class="sourceCode python code-with-copy"><code class="sourceCode python"><span id="cb57-1">fig <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> plt.figure()</span>
<span id="cb57-2">plt.scatter(</span>
<span id="cb57-3">  df3[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nitrogen"</span>]</span>
<span id="cb57-4">, df3[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span>]</span>
<span id="cb57-5">, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"green"</span></span>
<span id="cb57-6">, marker <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"o"</span></span>
<span id="cb57-7">)</span>
<span id="cb57-8">plt.plot(df3[<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nitrogen"</span>], Fit3.fittedvalues)</span>
<span id="cb57-9">plt.title(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Regression plot of Nitrogen and Yield"</span>)</span>
<span id="cb57-10">plt.xlabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nitrogen"</span>)</span>
<span id="cb57-11">plt.ylabel(<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span>)</span>
<span id="cb57-12">plt.show()</span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-35-11.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-7"><img src="https://myaseen208.com/blogs/2018-09-20_RegPython/index_files/figure-html/unnamed-chunk-35-11.svg" class="img-fluid quarto-figure quarto-figure-center figure-img"></a></p>
</figure>
</div>
</div>
</div>


</section></section><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2018,
  author = {Yaseen, Muhammad and Yaseen, Muhammad},
  title = {Regression {Analysis} with {Python}},
  date = {2018-09-20},
  url = {https://myaseen208.com/blogs/2018-09-20_RegPython/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2018" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad, and Muhammad Yaseen. 2018. <span>“Regression Analysis
with Python.”</span> September 20. <a href="https://myaseen208.com/blogs/2018-09-20_RegPython/">https://myaseen208.com/blogs/2018-09-20_RegPython/</a>.
</div></div></section></div> ]]></description>
  <category>Python</category>
  <category>Statistics</category>
  <category>Regression Analysis</category>
  <guid>https://myaseen208.com/blogs/2018-09-20_RegPython/</guid>
  <pubDate>Thu, 20 Sep 2018 04:00:00 GMT</pubDate>
</item>
<item>
  <title>Bioinformatics with R</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2018-09-20_BioInfoR/</link>
  <description><![CDATA[ <section id="statistics" class="level1"><h1>Statistics</h1>
<blockquote class="blockquote">
<ul>
<li>Statistics is the science of uncertainty &amp; variability</li>
<li>Statistics turns data into information</li>
<li>Data -&gt; Information -&gt; Knowledge -&gt; Wisdom</li>
<li>Data Driven Decisions (3Ds)</li>
<li>Statistics is the interpretation of Science</li>
<li>Statistics is the Art &amp; Science of learning from data</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section><section id="variable" class="level1"><h1>Variable</h1>
<blockquote class="blockquote">
<ul>
<li>Characteristic that may vary from individual to individual</li>
<li>Height, Weight, CGPA etc</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section><section id="measurement" class="level1"><h1>Measurement</h1>
<blockquote class="blockquote">
<ul>
<li>Process of assigning numbers or labels to objects or states in accordance with logically accepted rules</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section><section id="measurement-scales" class="level1"><h1>Measurement Scales</h1>
<blockquote class="blockquote">
<ul>
<li>
<strong>Nominal Scale:</strong> Obersvations may be classified into mutually exclusive &amp; exhaustive classes or categories</li>
<li>
<strong>Ordinal Scale:</strong> Obersvations may be ranked</li>
<li>
<strong>Interval Scale:</strong> Difference between obersvations is meaningful</li>
<li>
<strong>Ratio Scale:</strong> Ratio between obersvations is meaningful &amp; true zero point</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="nominal-data" class="level2"><h2 class="anchored" data-anchor-id="nominal-data">Nominal Data</h2>
<section id="example" class="level3"><h3 class="anchored" data-anchor-id="example">Example</h3>
<blockquote class="blockquote">
<p>The following data shows the gender of a sample of twenty students from the University of Agriculture, Faisalabad.</p>
</blockquote>
<p>&nbsp;</p>
<table class="caption-top table">
<thead><tr class="header">
<th>Student</th>
<th>Gender</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>1</td>
<td>Male</td>
</tr>
<tr class="even">
<td>2</td>
<td>Male</td>
</tr>
<tr class="odd">
<td>3</td>
<td>Female</td>
</tr>
<tr class="even">
<td>4</td>
<td>Female</td>
</tr>
<tr class="odd">
<td>5</td>
<td>Female</td>
</tr>
<tr class="even">
<td>6</td>
<td>Female</td>
</tr>
<tr class="odd">
<td>7</td>
<td>Male</td>
</tr>
<tr class="even">
<td>8</td>
<td>Male</td>
</tr>
<tr class="odd">
<td>9</td>
<td>Male</td>
</tr>
<tr class="even">
<td>10</td>
<td>Male</td>
</tr>
<tr class="odd">
<td>11</td>
<td>Female</td>
</tr>
<tr class="even">
<td>12</td>
<td>Female</td>
</tr>
<tr class="odd">
<td>13</td>
<td>Male</td>
</tr>
<tr class="even">
<td>14</td>
<td>Male</td>
</tr>
<tr class="odd">
<td>15</td>
<td>Female</td>
</tr>
<tr class="even">
<td>16</td>
<td>Female</td>
</tr>
<tr class="odd">
<td>17</td>
<td>Male</td>
</tr>
<tr class="even">
<td>18</td>
<td>Male</td>
</tr>
<tr class="odd">
<td>19</td>
<td>Male</td>
</tr>
<tr class="even">
<td>20</td>
<td>Male</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://tidyverse.tidyverse.org">tidyverse</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://tibble.tidyverse.org/reference/tibble.html">tibble</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    Student <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/seq.html">seq</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>from <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, to <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, by <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , Gender  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Male"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Female"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Male"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Female"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Male"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Female"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Male"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 20 × 2
   Student Gender
     &lt;dbl&gt; &lt;chr&gt; 
 1       1 Male  
 2       2 Male  
 3       3 Female
 4       4 Female
 5       5 Female
 6       6 Female
 7       7 Male  
 8       8 Male  
 9       9 Male  
10      10 Male  
11      11 Female
12      12 Female
13      13 Male  
14      14 Male  
15      15 Female
16      16 Female
17      17 Male  
18      18 Male  
19      19 Male  
20      20 Male  </code></pre>
</div>
</div>
<section id="frequency-table" class="level4"><h4 class="anchored" data-anchor-id="frequency-table">Frequency Table</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1Freq</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>      <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/count.html">count</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gender</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/rename.html">rename</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>f <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">n</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>        rf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>      , pf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">rf</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>  </span>
<span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1Freq</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 2 × 4
  Gender     f    rf    pf
  &lt;chr&gt;  &lt;int&gt; &lt;dbl&gt; &lt;dbl&gt;
1 Female     8   0.4    40
2 Male      12   0.6    60</code></pre>
</div>
</div>
</section><section id="simple-bar-chart" class="level4"><h4 class="anchored" data-anchor-id="simple-bar-chart">Simple Bar Chart</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb5" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span></span>
<span>    ,  mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gender</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Simple Bar Chart"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gender"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-3-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-1"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-3-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="example-1" class="level3"><h3 class="anchored" data-anchor-id="example-1">Example</h3>
<blockquote class="blockquote">
<p>Following data presents the number of nucleotides of gene sequence (A, C, G, T). This is illustrated by the Zyxin gene which plays an important role in cell adhesion (Golub et al, 1999). The accession number (X94991.1) of one of its variants can be found in a data base like NCBI (UniGene). Given data will be used to illustrate the construction of pie chart from the frequency table of four nucleotides.</p>
</blockquote>
<table class="caption-top table">
<thead><tr class="header">
<th>A</th>
<th>C</th>
<th>G</th>
<th>T</th>
</tr></thead>
<tbody><tr class="odd">
<td>410</td>
<td>789</td>
<td>573</td>
<td>394</td>
</tr></tbody>
</table>
<blockquote class="blockquote">
<p>Data from the GenBank can also be imported directly by the following code.</p>
</blockquote>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># library(ape)</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># df2 &lt;- table(read.GenBank(c("X94991.1"),as.character=TRUE))</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># df2</span></span></code></pre></div></div>
</div>
<section id="frequency-table-1" class="level4"><h4 class="anchored" data-anchor-id="frequency-table-1">Frequency Table</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb7" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://tibble.tidyverse.org/reference/tibble.html">tibble</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    G.Sequence   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"G"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"T"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , Nucleotides  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">410</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">789</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">573</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">394</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 4 × 2
  G.Sequence Nucleotides
  &lt;chr&gt;            &lt;dbl&gt;
1 A                  410
2 C                  789
3 G                  573
4 T                  394</code></pre>
</div>
</div>
</section><section id="simple-bar-chart-1" class="level4"><h4 class="anchored" data-anchor-id="simple-bar-chart-1">Simple Bar Chart</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb9" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>        data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span></span>
<span>      , mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">G.Sequence</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nucleotides</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>stat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"identity"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Simple Bar Chart"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gene Sequence"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-6-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-2"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-6-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section></section></section><section id="ordinal-data" class="level2"><h2 class="anchored" data-anchor-id="ordinal-data">Ordinal Data</h2>
<section id="example-2" class="level3"><h3 class="anchored" data-anchor-id="example-2">Example</h3>
<blockquote class="blockquote">
<p>The following data shows the grades of a sample of twenty students from the University of Agriculture, Faisalabad.</p>
</blockquote>
<p>&nbsp;</p>
<table class="caption-top table">
<thead><tr class="header">
<th>Student</th>
<th>Grade</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>1</td>
<td>A</td>
</tr>
<tr class="even">
<td>2</td>
<td>B</td>
</tr>
<tr class="odd">
<td>3</td>
<td>B</td>
</tr>
<tr class="even">
<td>4</td>
<td>C</td>
</tr>
<tr class="odd">
<td>5</td>
<td>A</td>
</tr>
<tr class="even">
<td>6</td>
<td>D</td>
</tr>
<tr class="odd">
<td>7</td>
<td>F</td>
</tr>
<tr class="even">
<td>8</td>
<td>C</td>
</tr>
<tr class="odd">
<td>9</td>
<td>B</td>
</tr>
<tr class="even">
<td>10</td>
<td>D</td>
</tr>
<tr class="odd">
<td>11</td>
<td>F</td>
</tr>
<tr class="even">
<td>12</td>
<td>A</td>
</tr>
<tr class="odd">
<td>13</td>
<td>B</td>
</tr>
<tr class="even">
<td>14</td>
<td>B</td>
</tr>
<tr class="odd">
<td>15</td>
<td>C</td>
</tr>
<tr class="even">
<td>16</td>
<td>D</td>
</tr>
<tr class="odd">
<td>17</td>
<td>C</td>
</tr>
<tr class="even">
<td>18</td>
<td>B</td>
</tr>
<tr class="odd">
<td>19</td>
<td>C</td>
</tr>
<tr class="even">
<td>20</td>
<td>D</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb10" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://tibble.tidyverse.org/reference/tibble.html">tibble</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    Student <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/seq.html">seq</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>from <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, to <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, by <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , Grade  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"F"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"F"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>,  <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 20 × 2
   Student Grade
     &lt;dbl&gt; &lt;chr&gt;
 1       1 A    
 2       2 B    
 3       3 B    
 4       4 C    
 5       5 A    
 6       6 D    
 7       7 F    
 8       8 C    
 9       9 B    
10      10 D    
11      11 F    
12      12 A    
13      13 B    
14      14 B    
15      15 C    
16      16 D    
17      17 C    
18      18 B    
19      19 C    
20      20 D    </code></pre>
</div>
</div>
<section id="frequency-table-2" class="level4"><h4 class="anchored" data-anchor-id="frequency-table-2">Frequency Table</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb12" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4Freq</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>      <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/count.html">count</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Grade</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/rename.html">rename</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>f <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">n</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>        rf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>      , pf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">rf</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span></span>
<span>      , cf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/cumsum.html">cumsum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4Freq</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 5 × 5
  Grade     f    rf    pf    cf
  &lt;chr&gt; &lt;int&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;int&gt;
1 A         3  0.15    15     3
2 B         6  0.3     30     9
3 C         5  0.25    25    14
4 D         4  0.2     20    18
5 F         2  0.1     10    20</code></pre>
</div>
</div>
</section><section id="simple-bar-chart-2" class="level4"><h4 class="anchored" data-anchor-id="simple-bar-chart-2">Simple Bar Chart</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb14" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span></span>
<span>    ,  mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Grade</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Simple Bar Chart"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Grades"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-9-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-3"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-9-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<p>&nbsp;</p>
</section></section></section><section id="two-way-contingency-table" class="level2"><h2 class="anchored" data-anchor-id="two-way-contingency-table">Two Way Contingency Table</h2>
<section id="example-3" class="level3"><h3 class="anchored" data-anchor-id="example-3">Example</h3>
<blockquote class="blockquote">
<p>The following data shows the gender and residental status of a sample of twenty students from the University of Agriculture, Faisalabad.</p>
</blockquote>
<p>&nbsp;</p>
<table class="caption-top table">
<thead><tr class="header">
<th>Student</th>
<th>Gender</th>
<th>RS</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>1</td>
<td>Male</td>
<td>Boarding</td>
</tr>
<tr class="even">
<td>2</td>
<td>Male</td>
<td>Non-Boarding</td>
</tr>
<tr class="odd">
<td>3</td>
<td>Female</td>
<td>Non-Boarding</td>
</tr>
<tr class="even">
<td>4</td>
<td>Female</td>
<td>Boarding</td>
</tr>
<tr class="odd">
<td>5</td>
<td>Female</td>
<td>Boarding</td>
</tr>
<tr class="even">
<td>6</td>
<td>Female</td>
<td>Non-Boarding</td>
</tr>
<tr class="odd">
<td>7</td>
<td>Male</td>
<td>Non-Boarding</td>
</tr>
<tr class="even">
<td>8</td>
<td>Male</td>
<td>Boarding</td>
</tr>
<tr class="odd">
<td>9</td>
<td>Male</td>
<td>Non-Boarding</td>
</tr>
<tr class="even">
<td>10</td>
<td>Male</td>
<td>Non-Boarding</td>
</tr>
<tr class="odd">
<td>11</td>
<td>Female</td>
<td>Non-Boarding</td>
</tr>
<tr class="even">
<td>12</td>
<td>Female</td>
<td>Boarding</td>
</tr>
<tr class="odd">
<td>13</td>
<td>Male</td>
<td>Non-Boarding</td>
</tr>
<tr class="even">
<td>14</td>
<td>Male</td>
<td>Non-Boarding</td>
</tr>
<tr class="odd">
<td>15</td>
<td>Female</td>
<td>Non-Boarding</td>
</tr>
<tr class="even">
<td>16</td>
<td>Female</td>
<td>Non-Boarding</td>
</tr>
<tr class="odd">
<td>17</td>
<td>Male</td>
<td>Non-Boarding</td>
</tr>
<tr class="even">
<td>18</td>
<td>Male</td>
<td>Non-Boarding</td>
</tr>
<tr class="odd">
<td>19</td>
<td>Male</td>
<td>Non-Boarding</td>
</tr>
<tr class="even">
<td>20</td>
<td>Male</td>
<td>Boarding</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb15" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://tibble.tidyverse.org/reference/tibble.html">tibble</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    Student <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/seq.html">seq</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>from <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, to <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, by <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , Gender  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Male"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Female"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Male"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Female"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Male"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Female"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Male"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , RS      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 20 × 3
   Student Gender RS   
     &lt;dbl&gt; &lt;chr&gt;  &lt;chr&gt;
 1       1 Male   B    
 2       2 Male   NB   
 3       3 Female NB   
 4       4 Female B    
 5       5 Female B    
 6       6 Female NB   
 7       7 Male   NB   
 8       8 Male   B    
 9       9 Male   NB   
10      10 Male   NB   
11      11 Female NB   
12      12 Female B    
13      13 Male   NB   
14      14 Male   NB   
15      15 Female NB   
16      16 Female NB   
17      17 Male   NB   
18      18 Male   NB   
19      19 Male   NB   
20      20 Male   B    </code></pre>
</div>
</div>
<section id="cross-tables" class="level4"><h4 class="anchored" data-anchor-id="cross-tables">Cross Tables</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb17" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/count.html">count</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gender</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/rename.html">rename</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>f <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">n</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 2 × 2
  Gender     f
  &lt;chr&gt;  &lt;int&gt;
1 Female     8
2 Male      12</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb19" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/count.html">count</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">RS</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/rename.html">rename</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>f <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">n</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 2 × 2
  RS        f
  &lt;chr&gt; &lt;int&gt;
1 B         6
2 NB       14</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb21" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/count.html">count</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gender</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">RS</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/rename.html">rename</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>f <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">n</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 4 × 3
  Gender RS        f
  &lt;chr&gt;  &lt;chr&gt; &lt;int&gt;
1 Female B         3
2 Female NB        5
3 Male   B         3
4 Male   NB        9</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb23" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://github.com/sfirke/janitor">janitor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5CrossTab</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>      <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">janitor</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://sfirke.github.io/janitor/reference/tabyl.html">tabyl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>dat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">.</span>, var1 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gender</span>, var2 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">RS</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">janitor</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://sfirke.github.io/janitor/reference/adorn_totals.html">adorn_totals</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>dat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">.</span>, where <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"row"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"col"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5CrossTab</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code> Gender B NB Total
 Female 3  5     8
   Male 3  9    12
  Total 6 14    20</code></pre>
</div>
</div>
</section><section id="simple-bar-charts" class="level4"><h4 class="anchored" data-anchor-id="simple-bar-charts">Simple Bar Charts</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb25" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span></span>
<span>    ,  mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gender</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Simple Bar Chart"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gender"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-15-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-4"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-15-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb26" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span></span>
<span>    ,  mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">RS</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Simple Bar Chart"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Residental Status"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-16-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-5"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-16-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section><section id="multiple-bar-charts" class="level4"><h4 class="anchored" data-anchor-id="multiple-bar-charts">Multiple Bar Charts</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb27" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span></span>
<span>    ,  mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gender</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">RS</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>position <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"dodge"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Multiple Bar Chart"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gender"</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Residental Status"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-17-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-6"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-17-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb28" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span></span>
<span>    ,  mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">RS</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gender</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>position <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"dodge"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Multiple Bar Chart"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Residental Status"</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gender"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-18-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-7"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-18-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section><section id="component-bar-charts" class="level4"><h4 class="anchored" data-anchor-id="component-bar-charts">Component Bar Charts</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb29" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span></span>
<span>    ,  mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gender</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">RS</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Component Bar Chart"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gender"</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Residental Status"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-19-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-8"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-19-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb30" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span></span>
<span>    ,  mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">RS</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Gender</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Component Bar Chart"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Residental Status"</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gender"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-20-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-9"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-20-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section></section><section id="example-4" class="level3"><h3 class="anchored" data-anchor-id="example-4">Example</h3>
<blockquote class="blockquote">
<p>Source: OMB Statistical Policy Working Paper 22. https://www.hhs.gov/sites/default/files/spwp22.pdf Following data set consists of information concerning delinquent children. Recorded variables are Number of Delinquent Children by County and Education Level of Household Head.</p>
</blockquote>
<section id="cross-tables-1" class="level4"><h4 class="anchored" data-anchor-id="cross-tables-1">Cross Tables</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb31" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://tibble.tidyverse.org/reference/tibble.html">tibble</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>  Delinquent <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Alpha"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Beta"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gamma"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Delta"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>, EduLevel   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Low"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Medium"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"High"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Very High"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>, Freq       <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 16 × 3
   Delinquent EduLevel   Freq
   &lt;fct&gt;      &lt;fct&gt;     &lt;dbl&gt;
 1 Alpha      Low          15
 2 Alpha      Medium        0
 3 Alpha      High          5
 4 Alpha      Very High     0
 5 Beta       Low          20
 6 Beta       Medium       10
 7 Beta       High         10
 8 Beta       Very High    15
 9 Gamma      Low           5
10 Gamma      Medium       10
11 Gamma      High         10
12 Gamma      Very High     0
13 Delta      Low          10
14 Delta      Medium       15
15 Delta      High          5
16 Delta      Very High     5</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb33" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/xtabs.html">xtabs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">.</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Freq</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Delinquent</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Delinquent
Alpha  Beta Gamma Delta 
   20    55    25    35 </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb35" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/xtabs.html">xtabs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">.</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Freq</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">EduLevel</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>EduLevel
      Low    Medium      High Very High 
       50        35        30        20 </code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb37" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/xtabs.html">xtabs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">.</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Freq</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Delinquent</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">EduLevel</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>          EduLevel
Delinquent Low Medium High Very High
     Alpha  15      0    5         0
     Beta   20     10   10        15
     Gamma   5     10   10         0
     Delta  10     15    5         5</code></pre>
</div>
</div>
</section><section id="multiple-bar-charts-1" class="level4"><h4 class="anchored" data-anchor-id="multiple-bar-charts-1">Multiple Bar Charts</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb39" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span></span>
<span>    ,  mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Delinquent</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Freq</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">EduLevel</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>stat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"identity"</span>, position <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"dodge"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Multiple Bar Chart"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Delinquent"</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Education Level"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-25-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-10"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-25-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb40" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span></span>
<span>    ,  mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">EduLevel</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Freq</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Delinquent</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>stat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"identity"</span>, position <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"dodge"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Multiple Bar Chart"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Education Level"</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Delinquent"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-26-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-11"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-26-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section><section id="component-bar-charts-1" class="level4"><h4 class="anchored" data-anchor-id="component-bar-charts-1">Component Bar Charts</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb41" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span></span>
<span>    ,  mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Delinquent</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Freq</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">EduLevel</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>stat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"identity"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Component Bar Chart"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Delinquent"</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Education Level"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-27-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-12"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-27-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb42" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span></span>
<span>    ,  mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">EduLevel</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Freq</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Delinquent</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>stat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"identity"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Component Bar Chart"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Education Level"</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Delinquent"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-28-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-13"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-28-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section></section></section><section id="count-data" class="level2"><h2 class="anchored" data-anchor-id="count-data">Count Data</h2>
<section id="example-5" class="level3"><h3 class="anchored" data-anchor-id="example-5">Example</h3>
<blockquote class="blockquote">
<p>The following data shows the number of notebook a sample of twenty students keeping.</p>
</blockquote>
<p>&nbsp;</p>
<table class="caption-top table">
<thead><tr class="header">
<th>Student</th>
<th>Notebook</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>1</td>
<td>3</td>
</tr>
<tr class="even">
<td>2</td>
<td>1</td>
</tr>
<tr class="odd">
<td>3</td>
<td>0</td>
</tr>
<tr class="even">
<td>4</td>
<td>2</td>
</tr>
<tr class="odd">
<td>5</td>
<td>2</td>
</tr>
<tr class="even">
<td>6</td>
<td>4</td>
</tr>
<tr class="odd">
<td>7</td>
<td>5</td>
</tr>
<tr class="even">
<td>8</td>
<td>1</td>
</tr>
<tr class="odd">
<td>9</td>
<td>1</td>
</tr>
<tr class="even">
<td>10</td>
<td>2</td>
</tr>
<tr class="odd">
<td>11</td>
<td>3</td>
</tr>
<tr class="even">
<td>12</td>
<td>4</td>
</tr>
<tr class="odd">
<td>13</td>
<td>2</td>
</tr>
<tr class="even">
<td>14</td>
<td>5</td>
</tr>
<tr class="odd">
<td>15</td>
<td>1</td>
</tr>
<tr class="even">
<td>16</td>
<td>5</td>
</tr>
<tr class="odd">
<td>17</td>
<td>4</td>
</tr>
<tr class="even">
<td>18</td>
<td>2</td>
</tr>
<tr class="odd">
<td>19</td>
<td>2</td>
</tr>
<tr class="even">
<td>20</td>
<td>3</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb43" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://tibble.tidyverse.org/reference/tibble.html">tibble</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    Student  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/seq.html">seq</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>from <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, to <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, by <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , Notebook <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 20 × 2
   Student Notebook
     &lt;dbl&gt;    &lt;dbl&gt;
 1       1        3
 2       2        1
 3       3        0
 4       4        2
 5       5        2
 6       6        4
 7       7        5
 8       8        1
 9       9        1
10      10        2
11      11        3
12      12        4
13      13        2
14      14        5
15      15        1
16      16        5
17      17        4
18      18        2
19      19        2
20      20        3</code></pre>
</div>
</div>
<section id="frequency-table-3" class="level4"><h4 class="anchored" data-anchor-id="frequency-table-3">Frequency Table</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb45" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7Freq</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>      <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/count.html">count</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/rename.html">rename</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>f <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">n</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>        rf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>      , pf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">rf</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span></span>
<span>      , cf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/cumsum.html">cumsum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7Freq</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 6 × 5
  Notebook     f    rf    pf    cf
     &lt;dbl&gt; &lt;int&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;int&gt;
1        0     1  0.05     5     1
2        1     4  0.2     20     5
3        2     6  0.3     30    11
4        3     3  0.15    15    14
5        4     3  0.15    15    17
6        5     3  0.15    15    20</code></pre>
</div>
</div>
</section><section id="simple-bar-chart-3" class="level4"><h4 class="anchored" data-anchor-id="simple-bar-chart-3">Simple Bar Chart</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb47" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span></span>
<span>    ,  mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Simple Bar Chart"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Notebooks"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-31-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-14"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-31-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<p>&nbsp;</p>
</section></section></section><section id="continuous-data" class="level2"><h2 class="anchored" data-anchor-id="continuous-data">Continuous Data</h2>
<section id="example-6" class="level3"><h3 class="anchored" data-anchor-id="example-6">Example</h3>
<blockquote class="blockquote">
<p>The following data is the final plant height (cm) of thirty plants of wheat. 87 91 89 88 89 91 87 92 90 98 95 97 96 100 101 96 98 99 98 100 102 99 101 105 103 107 105 106 107 112</p>
</blockquote>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb48" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tibble</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://tibble.tidyverse.org/reference/tibble.html">tibble</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>  PlantHeight <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">87</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">91</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">89</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">88</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">89</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">91</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">87</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">92</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">90</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">98</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">95</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">97</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">96</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">101</span>,</span>
<span>  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">96</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">98</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">99</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">98</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">102</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">99</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">101</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">105</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">103</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">107</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">105</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">106</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">107</span>,    <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">112</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 30 × 1
   PlantHeight
         &lt;dbl&gt;
 1          87
 2          91
 3          89
 4          88
 5          89
 6          91
 7          87
 8          92
 9          90
10          98
# ℹ 20 more rows</code></pre>
</div>
</div>
<section id="frequency-distribution" class="level4"><h4 class="anchored" data-anchor-id="frequency-distribution">Frequency Distribution</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb50" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df9</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    R <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Extremes.html">max</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Extremes.html">min</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Round.html">floor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Log.html">log10</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/length.html">length</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , h <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">R</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">k</span></span>
<span>    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8Freq</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>          Classes <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/cut.html">cut</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>                         x              <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span></span>
<span>                       , breaks         <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">k</span></span>
<span>                       , include.lowest <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span></span>
<span>                       , right          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span></span>
<span>                       <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/count.html">count</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Classes</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tidyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://tidyr.tidyverse.org/reference/separate.html">separate</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>col <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Classes</span>, into <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"LB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"UB"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, sep <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">","</span>, remove <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/rename.html">rename</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>f <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">n</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    LB <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">readr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://readr.tidyverse.org/reference/parse_number.html">parse_number</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LB</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , UB <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">readr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://readr.tidyverse.org/reference/parse_number.html">parse_number</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">UB</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , rf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , pf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span></span>
<span>  , cf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/cumsum.html">cumsum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , MidPoint <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LB</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">UB</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> </span>
<span>  </span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8Freq</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 5 × 8
  Classes      LB    UB     f    rf    pf    cf MidPoint
  &lt;fct&gt;     &lt;dbl&gt; &lt;dbl&gt; &lt;int&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;int&gt;    &lt;dbl&gt;
1 [87,92)      87    92     8 0.267  26.7     8     89.5
2 [92,97)      92    97     4 0.133  13.3    12     94.5
3 [97,102)     97   102    10 0.333  33.3    22     99.5
4 [102,107)   102   107     5 0.167  16.7    27    104. 
5 [107,112]   107   112     3 0.1    10      30    110. </code></pre>
</div>
</div>
</section><section id="histogram" class="level4"><h4 class="anchored" data-anchor-id="histogram">Histogram</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb52" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span></span>
<span>     , mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_histogram.html">geom_histogram</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Histogram for Plant Height"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Plant Height"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-34-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-15"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-34-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb53" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8Freq</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">MidPoint</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_path.html">geom_line</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency for Plant Height"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Mid Point"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-35-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-16"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-35-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb54" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8Freq</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">MidPoint</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">cf</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_path.html">geom_line</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Cummulative Frequency Polygon"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Mid Point"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Cummulative Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-36-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-17"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-36-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section><section id="stem-and-leaf-plot" class="level4"><h4 class="anchored" data-anchor-id="stem-and-leaf-plot">Stem and Leaf Plot</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb55" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/graphics/stem.html">stem</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span>, scale <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, width <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, atom <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-08</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
  The decimal point is 1 digit(s) to the right of the |

   8 | 77899
   9 | 0112
   9 | 566788899
  10 | 001123
  10 | 55677
  11 | 2</code></pre>
</div>
</div>
</section><section id="box-plot" class="level4"><h4 class="anchored" data-anchor-id="box-plot">Box Plot</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb57" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span> , <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span> y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-38-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-18"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-38-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="example-7" class="level3"><h3 class="anchored" data-anchor-id="example-7">Example</h3>
<blockquote class="blockquote">
<p>The golub table contains gene expression values from 3051 genes taken from 38 Leukemia patients. Twenty seven patients are diagnosed as acute lymphoblastic leukemia (ALL) and eleven as acute myeloid leukemia (AML). The golub.gnames table contains information on the gene, including gene index, manufacturing ID, and biological name. Following table presents the gene expression value by their tumor type.</p>
</blockquote>
<table class="caption-top table">
<thead><tr class="header">
<th>tumortype</th>
<th>genevalue</th>
<th>tumortype</th>
<th>genevalue</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>ALL</td>
<td>2.10892</td>
<td>ALL</td>
<td>1.78352</td>
</tr>
<tr class="even">
<td>ALL</td>
<td>1.52405</td>
<td>ALL</td>
<td>0.45827</td>
</tr>
<tr class="odd">
<td>ALL</td>
<td>1.96403</td>
<td>ALL</td>
<td>2.18119</td>
</tr>
<tr class="even">
<td>ALL</td>
<td>2.33597</td>
<td>ALL</td>
<td>2.31428</td>
</tr>
<tr class="odd">
<td>ALL</td>
<td>1.85111</td>
<td>ALL</td>
<td>1.99927</td>
</tr>
<tr class="even">
<td>ALL</td>
<td>1.99391</td>
<td>ALL</td>
<td>1.36844</td>
</tr>
<tr class="odd">
<td>ALL</td>
<td>2.06597</td>
<td>ALL</td>
<td>2.37351</td>
</tr>
<tr class="even">
<td>ALL</td>
<td>1.81649</td>
<td>ALL</td>
<td>1.83485</td>
</tr>
<tr class="odd">
<td>ALL</td>
<td>2.17622</td>
<td>AML</td>
<td>0.88941</td>
</tr>
<tr class="even">
<td>ALL</td>
<td>1.80861</td>
<td>AML</td>
<td>1.45014</td>
</tr>
<tr class="odd">
<td>ALL</td>
<td>2.44562</td>
<td>AML</td>
<td>0.42904</td>
</tr>
<tr class="even">
<td>ALL</td>
<td>1.90496</td>
<td>AML</td>
<td>0.82667</td>
</tr>
<tr class="odd">
<td>ALL</td>
<td>2.76610</td>
<td>AML</td>
<td>0.63637</td>
</tr>
<tr class="even">
<td>ALL</td>
<td>1.32551</td>
<td>AML</td>
<td>1.02250</td>
</tr>
<tr class="odd">
<td>ALL</td>
<td>2.59385</td>
<td>AML</td>
<td>0.12758</td>
</tr>
<tr class="even">
<td>ALL</td>
<td>1.92776</td>
<td>AML</td>
<td>-0.74333</td>
</tr>
<tr class="odd">
<td>ALL</td>
<td>1.10546</td>
<td>AML</td>
<td>0.73784</td>
</tr>
<tr class="even">
<td>ALL</td>
<td>1.27645</td>
<td>AML</td>
<td>0.49470</td>
</tr>
<tr class="odd">
<td>ALL</td>
<td>1.83051</td>
<td>AML</td>
<td>1.12058</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb58" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://tibble.tidyverse.org/reference/tibble.html">tibble</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>   genevalue <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>              <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.10892</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.52405</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.96403</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.33597</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.85111</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.99391</span></span>
<span>            , <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.06597</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.81649</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.17622</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.80861</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.44562</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.90496</span></span>
<span>            , <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.76610</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.32551</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.59385</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.92776</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.10546</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.27645</span></span>
<span>            , <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.83051</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.78352</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.45827</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.18119</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.31428</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.99927</span></span>
<span>            , <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.36844</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.37351</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.83485</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.88941</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.45014</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.42904</span></span>
<span>            , <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.82667</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.63637</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.02250</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.12758</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.74333</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.73784</span></span>
<span>            , <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.49470</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.12058</span></span>
<span>            <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , tumortype <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"ALL"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"AML"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">27</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">11</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 38 × 2
   genevalue tumortype
       &lt;dbl&gt; &lt;chr&gt;    
 1      2.11 ALL      
 2      1.52 ALL      
 3      1.96 ALL      
 4      2.34 ALL      
 5      1.85 ALL      
 6      1.99 ALL      
 7      2.07 ALL      
 8      1.82 ALL      
 9      2.18 ALL      
10      1.81 ALL      
# ℹ 28 more rows</code></pre>
</div>
</div>
<section id="frequency-distribution-1" class="level4"><h4 class="anchored" data-anchor-id="frequency-distribution-1">Frequency Distribution</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb60" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df11</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    R <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Extremes.html">max</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Extremes.html">min</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Round.html">floor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3.3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Log.html">log10</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/length.html">length</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , h <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">R</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">k</span></span>
<span>    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10Freq</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>          Classes <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/cut.html">cut</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>                         x              <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span></span>
<span>                       , breaks         <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df11</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">k</span></span>
<span>                       , include.lowest <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span></span>
<span>                       , right          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span></span>
<span>                       <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/count.html">count</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Classes</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tidyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://tidyr.tidyverse.org/reference/separate.html">separate</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>col <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Classes</span>, into <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"LB"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"UB"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, sep <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">","</span>, remove <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/rename.html">rename</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>f <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">n</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    LB <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">readr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://readr.tidyverse.org/reference/parse_number.html">parse_number</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LB</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , UB <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">readr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://readr.tidyverse.org/reference/parse_number.html">parse_number</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">UB</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , rf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , pf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span></span>
<span>  , cf <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/cumsum.html">cumsum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  , MidPoint <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LB</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">UB</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> </span>
<span>  </span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10Freq</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 6 × 8
  Classes             LB     UB     f     rf    pf    cf MidPoint
  &lt;fct&gt;            &lt;dbl&gt;  &lt;dbl&gt; &lt;int&gt;  &lt;dbl&gt; &lt;dbl&gt; &lt;int&gt;    &lt;dbl&gt;
1 [-0.747,-0.158) -0.747 -0.158     1 0.0263  2.63     1   -0.452
2 [-0.158,0.426)  -0.158  0.426     1 0.0263  2.63     2    0.134
3 [0.426,1.01)     0.426  1.01      7 0.184  18.4      9    0.718
4 [1.01,1.6)       1.01   1.6       8 0.211  21.1     17    1.31 
5 [1.6,2.18)       1.6    2.18     15 0.395  39.5     32    1.89 
6 [2.18,2.77]      2.18   2.77      6 0.158  15.8     38    2.48 </code></pre>
</div>
</div>
</section><section id="histogram-1" class="level4"><h4 class="anchored" data-anchor-id="histogram-1">Histogram</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb62" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>       data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span></span>
<span>     , mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_histogram.html">geom_histogram</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Histogram for Gene Value"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Gene Value"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-41-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-19"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-41-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb63" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10Freq</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">MidPoint</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">f</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_path.html">geom_line</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency for Gene Value"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Mid Point"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-42-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-20"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-42-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb64" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10Freq</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">MidPoint</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">cf</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_path.html">geom_line</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>    <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Cummulative Frequency Polygon"</span>, x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Mid Point"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Cummulative Frequency"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>plot.title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/element.html">element_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>hjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-43-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-21"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-43-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section><section id="stem-and-leaf-plot-1" class="level4"><h4 class="anchored" data-anchor-id="stem-and-leaf-plot-1">Stem and Leaf Plot</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb65" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/graphics/stem.html">stem</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span>, scale <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, width <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, atom <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1e-08</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
  The decimal point is at the |

  -0 | 7
  -0 | 
   0 | 14
   0 | 556789
   1 | 011334
   1 | 5588888999
   2 | 00011223344
   2 | 68</code></pre>
</div>
</div>
</section><section id="box-plot-1" class="level4"><h4 class="anchored" data-anchor-id="box-plot-1">Box Plot</h4>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb67" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span> , <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tumortype</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/unnamed-chunk-45-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-22"><img src="https://myaseen208.com/blogs/2018-09-20_BioInfoR/index_files/figure-html/unnamed-chunk-45-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<p>&nbsp;</p>
</section></section></section></section><section id="measures-of-centeral-tendency" class="level1"><h1>Measures of Centeral Tendency</h1>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb68" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            n       <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/length.html">length</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Mean    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/mean.html">mean</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Median  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/median.html">median</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Minimum <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Extremes.html">min</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> </span>
<span>          , Maximum <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Extremes.html">max</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> </span>
<span>          , Q1      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/quantile.html">quantile</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span>, probs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.25</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Q2      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/quantile.html">quantile</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span>, probs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.50</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Q3      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/quantile.html">quantile</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span>, probs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.75</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 1 × 8
      n  Mean Median Minimum Maximum    Q1    Q2    Q3
  &lt;int&gt; &lt;dbl&gt;  &lt;dbl&gt;   &lt;dbl&gt;   &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
1    20   2.6      2       0       5  1.75     2     4</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb70" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            n       <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/length.html">length</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Mean    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/mean.html">mean</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Median  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/median.html">median</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Minimum <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Extremes.html">min</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> </span>
<span>          , Maximum <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Extremes.html">max</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> </span>
<span>          , Q1      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/quantile.html">quantile</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span>, probs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.25</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Q2      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/quantile.html">quantile</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span>, probs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.50</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Q3      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/quantile.html">quantile</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span>, probs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.75</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 1 × 8
      n  Mean Median Minimum Maximum    Q1    Q2    Q3
  &lt;int&gt; &lt;dbl&gt;  &lt;dbl&gt;   &lt;dbl&gt;   &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
1    30  97.6     98      87     112  91.2    98  102.</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb72" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tumortype</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            n       <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/length.html">length</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Mean    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/mean.html">mean</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Median  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/median.html">median</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Minimum <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Extremes.html">min</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> </span>
<span>          , Maximum <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Extremes.html">max</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> </span>
<span>          , Q1      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/quantile.html">quantile</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span>, probs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.25</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Q2      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/quantile.html">quantile</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span>, probs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.50</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Q3      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/quantile.html">quantile</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span>, probs <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.75</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 2 × 9
  tumortype     n  Mean Median Minimum Maximum    Q1    Q2    Q3
  &lt;chr&gt;     &lt;int&gt; &lt;dbl&gt;  &lt;dbl&gt;   &lt;dbl&gt;   &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt; &lt;dbl&gt;
1 ALL          27 1.89   1.93    0.458    2.77 1.80  1.93  2.18 
2 AML          11 0.636  0.738  -0.743    1.45 0.462 0.738 0.956</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section><section id="measures-of-dispersion" class="level1"><h1>Measures of Dispersion</h1>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb74" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            IQR      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/IQR.html">IQR</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Variance <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/cor.html">var</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          ,  SD      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/sd.html">sd</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 1 × 3
    IQR Variance    SD
  &lt;dbl&gt;    &lt;dbl&gt; &lt;dbl&gt;
1  2.25     2.25  1.50</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb76" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            IQR      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/IQR.html">IQR</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Variance <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/cor.html">var</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          ,  SD      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/sd.html">sd</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 1 × 3
    IQR Variance    SD
  &lt;dbl&gt;    &lt;dbl&gt; &lt;dbl&gt;
1  10.5     45.0  6.71</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb78" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tumortype</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            IQR      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/IQR.html">IQR</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          , Variance <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/cor.html">var</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          ,  SD      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/sd.html">sd</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 2 × 4
  tumortype   IQR Variance    SD
  &lt;chr&gt;     &lt;dbl&gt;    &lt;dbl&gt; &lt;dbl&gt;
1 ALL       0.383    0.241 0.491
2 AML       0.494    0.338 0.582</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section><section id="measures-of-skewness" class="level1"><h1>Measures of Skewness</h1>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb80" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>           SK <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/mean.html">mean</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/context.html">n</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/sd.html">sd</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 1 × 1
     SK
  &lt;dbl&gt;
1 0.217</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb82" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>           SK <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/mean.html">mean</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/context.html">n</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/sd.html">sd</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 1 × 1
      SK
   &lt;dbl&gt;
1 0.0574</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb84" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tumortype</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>           SK <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/mean.html">mean</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/context.html">n</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/sd.html">sd</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 2 × 2
  tumortype     SK
  &lt;chr&gt;      &lt;dbl&gt;
1 ALL       -0.802
2 AML       -0.937</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section><section id="measures-of-skewness-1" class="level1"><h1>Measures of Skewness</h1>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb86" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            K <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/mean.html">mean</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/context.html">n</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/sd.html">sd</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Notebook</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 1 × 1
      K
  &lt;dbl&gt;
1 -1.19</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb88" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            K <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/mean.html">mean</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/context.html">n</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/sd.html">sd</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PlantHeight</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 1 × 1
       K
   &lt;dbl&gt;
1 -0.960</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb90" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tumortype</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>            K <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/mean.html">mean</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/context.html">n</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/sd.html">sd</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">genevalue</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 2 × 2
  tumortype     K
  &lt;chr&gt;     &lt;dbl&gt;
1 ALL       0.855
2 AML       0.345</code></pre>
</div>
</div>


</section><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2018,
  author = {Yaseen, Muhammad and Yaseen, Muhammad},
  title = {Bioinformatics with {R}},
  date = {2018-09-20},
  url = {https://myaseen208.com/blogs/2018-09-20_BioInfoR/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2018" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad, and Muhammad Yaseen. 2018. <span>“Bioinformatics with
R.”</span> September 20. <a href="https://myaseen208.com/blogs/2018-09-20_BioInfoR/">https://myaseen208.com/blogs/2018-09-20_BioInfoR/</a>.
</div></div></section></div> ]]></description>
  <category>R</category>
  <category>Statistics</category>
  <category>Bioinformatics</category>
  <guid>https://myaseen208.com/blogs/2018-09-20_BioInfoR/</guid>
  <pubDate>Thu, 20 Sep 2018 04:00:00 GMT</pubDate>
</item>
<item>
  <title>An Introduction to Statistics using SPSS</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2018-08-16-PASTIC-NTU/</link>
  <description><![CDATA[ 




<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p><a href="../../assets/img/blogs/2018-08-16-PASTIC-NTU/fig/2018-08-16_PASTIC-NTU.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-1"><img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/2018-08-16_PASTIC-NTU.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
<section id="statistics" class="level2">
<h2 class="anchored" data-anchor-id="statistics">Statistics</h2>
<blockquote class="blockquote">
<ul>
<li>Statistics is the science of uncertainty &amp; variability</li>
<li>Statistics turns data into information</li>
<li>Data -&gt; Information -&gt; Knowledge -&gt; Wisdom</li>
<li>Statistics is the interpretation of Science</li>
<li>Statistics is the Art &amp; Science of learning from data</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section>
<section id="variable" class="level2">
<h2 class="anchored" data-anchor-id="variable">Variable</h2>
<blockquote class="blockquote">
<ul>
<li>Characteristic that may vary from individual to individual</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section>
<section id="measurement" class="level2">
<h2 class="anchored" data-anchor-id="measurement">Measurement</h2>
<blockquote class="blockquote">
<ul>
<li>Process of assigning numbers or labels to objects or states in accordance with logically accepted rules</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section>
<section id="measurement-scales" class="level2">
<h2 class="anchored" data-anchor-id="measurement-scales">Measurement Scales</h2>
<blockquote class="blockquote">
<ul>
<li><strong>Nominal Scale:</strong> Obersvations may be classified into mutually exclusive &amp; exhaustive categories</li>
<li><strong>Ordinal Scale:</strong> Obersvations may be ranked</li>
<li><strong>Interval Scale:</strong> Difference between obersvations is meaningful</li>
<li><strong>Ratio Scale:</strong> Ratio between obersvations is meaningful &amp; true zero point</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section>
<section id="descriptive-statistics" class="level2">
<h2 class="anchored" data-anchor-id="descriptive-statistics">Descriptive Statistics</h2>
<blockquote class="blockquote">
<ul>
<li>No of observations</li>
<li>Measures of Central Tendency</li>
<li>Measures of Dispersion</li>
<li>Measures of Skewness</li>
<li>Measures of Kurtosis</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example" class="level3">
<h3 class="anchored" data-anchor-id="example">Example</h3>
<blockquote class="blockquote">
<p>Following data presents a subset of Yarn strength and Elongation percentage from an experiment to test yarn strength and extension of blue jeans designed under Conducted in Sudan Textile Factory Method.</p>
</blockquote>
<p>&nbsp;</p>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Single Strength</th>
<th>Elongation</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>419.7</td>
<td>3.22</td>
</tr>
<tr class="even">
<td>442.7</td>
<td>2.78</td>
</tr>
<tr class="odd">
<td>457.4</td>
<td>1.60</td>
</tr>
<tr class="even">
<td>435.2</td>
<td>1.88</td>
</tr>
<tr class="odd">
<td>404.1</td>
<td>1.88</td>
</tr>
<tr class="even">
<td>479.1</td>
<td>2.34</td>
</tr>
<tr class="odd">
<td>450.8</td>
<td>2.44</td>
</tr>
<tr class="even">
<td>432.7</td>
<td>2.12</td>
</tr>
<tr class="odd">
<td>378.1</td>
<td>2.88</td>
</tr>
<tr class="even">
<td>413.3</td>
<td>2.37</td>
</tr>
<tr class="odd">
<td>365.1</td>
<td>1.40</td>
</tr>
<tr class="even">
<td>492.0</td>
<td>2.02</td>
</tr>
<tr class="odd">
<td>389.5</td>
<td>2.02</td>
</tr>
<tr class="even">
<td>467.8</td>
<td>1.92</td>
</tr>
<tr class="odd">
<td>442.3</td>
<td>2.44</td>
</tr>
<tr class="even">
<td>444.3</td>
<td>1.74</td>
</tr>
</tbody>
</table>
</section>
<section id="reference" class="level3">
<h3 class="anchored" data-anchor-id="reference">Reference</h3>
<blockquote class="blockquote">
<p>Mousa, A.H.N. (1978). Analysis of the Effect of Size Formulation Variations on Yarn Tenacity and Elongation. <em>Textile Research Journal</em>, <strong>48</strong>, 713-717.</p>
</blockquote>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/01Descriptive.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; Descriptive Statistics &gt; Descriptives …</strong></em></p>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/02Descriptive.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/03Descriptive.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/04Descriptive.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/05Descriptive.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/06Descriptive.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/07Descriptive.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
</section>
</section>
<section id="boxwhisker-diagram" class="level2">
<h2 class="anchored" data-anchor-id="boxwhisker-diagram">Boxwhisker Diagram</h2>
<blockquote class="blockquote">
<ul>
<li>Pictorial display of five number summary (Minimum, Q1, Q2, Q3 and Maximum)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-1" class="level3">
<h3 class="anchored" data-anchor-id="example-1">Example</h3>
<blockquote class="blockquote">
<p>Effact of Two drying methods (Line Dry and Tumble Dry) are to be compared for some kind of shrinkage of some particular brand of fabric. Following data was observed from an experiment:</p>
</blockquote>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Drying Method</th>
<th>Length Shrinkage</th>
<th>Drying Method</th>
<th>Length Shrinkage</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Line Dry</td>
<td>1.0</td>
<td>Tumble Dry</td>
<td>2.8</td>
</tr>
<tr class="even">
<td>Line Dry</td>
<td>1.5</td>
<td>Tumble Dry</td>
<td>3.0</td>
</tr>
<tr class="odd">
<td>Line Dry</td>
<td>2.1</td>
<td>Tumble Dry</td>
<td>3.0</td>
</tr>
<tr class="even">
<td>Line Dry</td>
<td>2.1</td>
<td>Tumble Dry</td>
<td>2.9</td>
</tr>
<tr class="odd">
<td>Line Dry</td>
<td>5.4</td>
<td>Tumble Dry</td>
<td>6.8</td>
</tr>
<tr class="even">
<td>Line Dry</td>
<td>5.4</td>
<td>Tumble Dry</td>
<td>6.5</td>
</tr>
<tr class="odd">
<td>Line Dry</td>
<td>2.8</td>
<td>Tumble Dry</td>
<td>2.9</td>
</tr>
<tr class="even">
<td>Line Dry</td>
<td>3.0</td>
<td>Tumble Dry</td>
<td>3.6</td>
</tr>
<tr class="odd">
<td>Line Dry</td>
<td>1.4</td>
<td>Tumble Dry</td>
<td>3.5</td>
</tr>
<tr class="even">
<td>Line Dry</td>
<td>1.8</td>
<td>Tumble Dry</td>
<td>3.7</td>
</tr>
<tr class="odd">
<td>Line Dry</td>
<td>2.3</td>
<td>Tumble Dry</td>
<td>3.5</td>
</tr>
<tr class="even">
<td>Line Dry</td>
<td>2.2</td>
<td>Tumble Dry</td>
<td>3.5</td>
</tr>
<tr class="odd">
<td>Line Dry</td>
<td>7.0</td>
<td>Tumble Dry</td>
<td>7.9</td>
</tr>
<tr class="even">
<td>Line Dry</td>
<td>7.2</td>
<td>Tumble Dry</td>
<td>8.0</td>
</tr>
<tr class="odd">
<td>Line Dry</td>
<td>4.2</td>
<td>Tumble Dry</td>
<td>4.0</td>
</tr>
<tr class="even">
<td>Line Dry</td>
<td>4.5</td>
<td>Tumble Dry</td>
<td>4.8</td>
</tr>
<tr class="odd">
<td>Line Dry</td>
<td>1.8</td>
<td>Tumble Dry</td>
<td>4.0</td>
</tr>
<tr class="even">
<td>Line Dry</td>
<td>1.9</td>
<td>Tumble Dry</td>
<td>4.2</td>
</tr>
<tr class="odd">
<td>Line Dry</td>
<td>2.5</td>
<td>Tumble Dry</td>
<td>3.9</td>
</tr>
<tr class="even">
<td>Line Dry</td>
<td>2.2</td>
<td>Tumble Dry</td>
<td>3.7</td>
</tr>
<tr class="odd">
<td>Line Dry</td>
<td>7.5</td>
<td>Tumble Dry</td>
<td>8.6</td>
</tr>
<tr class="even">
<td>Line Dry</td>
<td>7.9</td>
<td>Tumble Dry</td>
<td>8.8</td>
</tr>
<tr class="odd">
<td>Line Dry</td>
<td>4.8</td>
<td>Tumble Dry</td>
<td>4.7</td>
</tr>
<tr class="even">
<td>Line Dry</td>
<td>5.2</td>
<td>Tumble Dry</td>
<td>5.3</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
<section id="reference-1" class="level3">
<h3 class="anchored" data-anchor-id="reference-1">Reference</h3>
<blockquote class="blockquote">
<p>Higgins, L., Anand, S.C., Holmes, D.A., Hall, M.E., and Underly, K. (2003). Effects of Various Home Laundering on the Dimensional Stability, Wrinkling, and Other Properties of Plain Woven Cotton Fabrics: Part II: Effect of Rinse Cycle Softener and Drying Method and of Tumble Sheet Softener and Tumble Drying Time. <em>Textile Research Journal</em>, <strong>73</strong>, 407-420.</p>
</blockquote>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/01Boxplot.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
<p><em><strong>Graphs &gt; Legacy Dialogs &gt; Boxplot …</strong></em></p>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/02Boxplot.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/03Boxplot.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/04Boxplot.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/05Boxplot.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
</section>
</section>
<section id="scatter-plot" class="level2">
<h2 class="anchored" data-anchor-id="scatter-plot">Scatter Plot</h2>
<blockquote class="blockquote">
<ul>
<li>Two dimensional graph to show the relationship among two variables</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-2" class="level3">
<h3 class="anchored" data-anchor-id="example-2">Example</h3>
<blockquote class="blockquote">
<p>An Experiment was conducted to test ballistic tests for some fabric. To test the effect, bullet volicity and depth of trauma was observed. Some obser vations as example are given in the following table. Each measurement is based on 6 replicates.</p>
</blockquote>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Bullet Velocity</th>
<th>Trauma Depth</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>372.83</td>
<td>3.87</td>
</tr>
<tr class="even">
<td>370.67</td>
<td>5.20</td>
</tr>
<tr class="odd">
<td>370.50</td>
<td>4.85</td>
</tr>
<tr class="even">
<td>369.33</td>
<td>7.12</td>
</tr>
<tr class="odd">
<td>371.67</td>
<td>2.73</td>
</tr>
<tr class="even">
<td>370.50</td>
<td>5.75</td>
</tr>
<tr class="odd">
<td>369.67</td>
<td>5.32</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
<section id="reference-2" class="level3">
<h3 class="anchored" data-anchor-id="reference-2">Reference</h3>
<blockquote class="blockquote">
<p>Karahan, M. (2008). Comparison of Ballistic Performance and Energy Absorption Capabilities of Woven and Unidirectional Aramid Fabrics. <em>Textile Research Journal</em>, <strong>78</strong>, 718-730.</p>
</blockquote>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/01Scatterplot.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
<p><em><strong>Graphs &gt; Legacy Dialogs &gt; Scatter/Dot …</strong></em></p>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/02Scatterplot.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/03Scatterplot.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/04Scatterplot.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/05Scatterplot.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
</section>
</section>
<section id="regression-analysis" class="level2">
<h2 class="anchored" data-anchor-id="regression-analysis">Regression Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on quantitative explanatory variable(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-08-16-PASTIC-NTU/fig/PopRegFn.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-2"><img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/PopRegFn.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
<section id="simple-linear-regression" class="level2">
<h2 class="anchored" data-anchor-id="simple-linear-regression">Simple Linear Regression</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on a quantitative explanatory variable</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-3" class="level3">
<h3 class="anchored" data-anchor-id="example-3">Example</h3>
<blockquote class="blockquote">
<p>An Experiment was conducted to test ballistic tests for some fabric. To test the effect, bullet volicity and depth of trauma was observed. Some obser vations as example are given in the following table. Each measurement is based on 6 replicates.</p>
</blockquote>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Bullet Velocity</th>
<th>Trauma Depth</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>372.83</td>
<td>3.87</td>
</tr>
<tr class="even">
<td>370.67</td>
<td>5.20</td>
</tr>
<tr class="odd">
<td>370.50</td>
<td>4.85</td>
</tr>
<tr class="even">
<td>369.33</td>
<td>7.12</td>
</tr>
<tr class="odd">
<td>371.67</td>
<td>2.73</td>
</tr>
<tr class="even">
<td>370.50</td>
<td>5.75</td>
</tr>
<tr class="odd">
<td>369.67</td>
<td>5.32</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
<section id="reference-3" class="level3">
<h3 class="anchored" data-anchor-id="reference-3">Reference</h3>
<blockquote class="blockquote">
<p>Karahan, M. (2008). Comparison of Ballistic Performance and Energy Absorption Capabilities of Woven and Unidirectional Aramid Fabrics. <em>Textile Research Journal</em>, <strong>78</strong>, 718-730.</p>
</blockquote>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/01SLR.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; Regression &gt; Linear …</strong></em></p>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/02SLR.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/03SLR.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/04SLR.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/05SLR.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
</section>
</section>
<section id="multiple-linear-regression" class="level2">
<h2 class="anchored" data-anchor-id="multiple-linear-regression">Multiple Linear Regression</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on two or more quantitative explanatory variables</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-4" class="level3">
<h3 class="anchored" data-anchor-id="example-4">Example</h3>
<blockquote class="blockquote">
<p>Following data presents a Factorial experiment relating yarn strength and elongation to 3 factors: Corn Starch, Nordux, and Fats. Conducted in Sudan Textile Factory Method.</p>
</blockquote>
<table class="caption-top table">
<colgroup>
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
<col style="width: 20%">
</colgroup>
<thead>
<tr class="header">
<th>Corn Starch</th>
<th>Nordux</th>
<th>Fats</th>
<th>Single Strength</th>
<th>Enolgation</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>85</td>
<td>50</td>
<td>30.25</td>
<td>419.7</td>
<td>3.22</td>
</tr>
<tr class="even">
<td>140</td>
<td>50</td>
<td>30.25</td>
<td>442.7</td>
<td>2.78</td>
</tr>
<tr class="odd">
<td>85</td>
<td>100</td>
<td>30.25</td>
<td>457.4</td>
<td>1.60</td>
</tr>
<tr class="even">
<td>140</td>
<td>100</td>
<td>30.25</td>
<td>435.2</td>
<td>1.88</td>
</tr>
<tr class="odd">
<td>85</td>
<td>50</td>
<td>30.00</td>
<td>404.1</td>
<td>1.88</td>
</tr>
<tr class="even">
<td>140</td>
<td>50</td>
<td>30.00</td>
<td>479.1</td>
<td>2.34</td>
</tr>
<tr class="odd">
<td>85</td>
<td>100</td>
<td>30.00</td>
<td>450.8</td>
<td>2.44</td>
</tr>
<tr class="even">
<td>140</td>
<td>100</td>
<td>30.00</td>
<td>432.7</td>
<td>2.12</td>
</tr>
<tr class="odd">
<td>85</td>
<td>50</td>
<td>30.25</td>
<td>378.1</td>
<td>2.88</td>
</tr>
<tr class="even">
<td>140</td>
<td>50</td>
<td>30.25</td>
<td>413.3</td>
<td>2.37</td>
</tr>
<tr class="odd">
<td>85</td>
<td>100</td>
<td>30.25</td>
<td>365.1</td>
<td>1.40</td>
</tr>
<tr class="even">
<td>140</td>
<td>100</td>
<td>30.25</td>
<td>492.0</td>
<td>2.02</td>
</tr>
<tr class="odd">
<td>85</td>
<td>50</td>
<td>30.00</td>
<td>389.5</td>
<td>2.02</td>
</tr>
<tr class="even">
<td>140</td>
<td>50</td>
<td>30.00</td>
<td>467.8</td>
<td>1.92</td>
</tr>
<tr class="odd">
<td>85</td>
<td>100</td>
<td>30.00</td>
<td>442.3</td>
<td>2.44</td>
</tr>
<tr class="even">
<td>140</td>
<td>100</td>
<td>30.00</td>
<td>444.3</td>
<td>1.74</td>
</tr>
</tbody>
</table>
</section>
<section id="reference-4" class="level3">
<h3 class="anchored" data-anchor-id="reference-4">Reference</h3>
<blockquote class="blockquote">
<p>Mousa, A.H.N. (1978). Analysis of the Effect of Size Formulation Variations on Yarn Tenacity and Elongation. <em>Textile Research Journal</em>, <strong>48</strong>, 713-717.</p>
</blockquote>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/01MLR.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; Regression &gt; Linear …</strong></em></p>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/02MLR.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/03MLR.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/04MLR.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
</section>
</section>
<section id="polynomial-regression-analysis" class="level2">
<h2 class="anchored" data-anchor-id="polynomial-regression-analysis">Polynomial Regression Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying non-linear dependency of a normal response on quantitative explanatory variable(s)</li>
</ul>
</blockquote>
<section id="example-5" class="level3">
<h3 class="anchored" data-anchor-id="example-5">Example</h3>
<blockquote class="blockquote">
<p>The Relationship Between Air Layers and Evaporative Resistance of Male Chinese Clothing is to be observed from Measurements of total air volume and total evaporative resistance of 39 Chinese clothing ensembles the following data.</p>
</blockquote>
<table class="caption-top table">
<colgroup>
<col style="width: 18%">
<col style="width: 30%">
<col style="width: 20%">
<col style="width: 30%">
</colgroup>
<thead>
<tr class="header">
<th>Air Volume</th>
<th>Evaporative Resistance</th>
<th>Air Volume</th>
<th>Evaporative Resistance</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>22.99</td>
<td>13.7</td>
<td>32.29</td>
<td>21.2</td>
</tr>
<tr class="even">
<td>27.98</td>
<td>16.8</td>
<td>33.60</td>
<td>21.1</td>
</tr>
<tr class="odd">
<td>24.41</td>
<td>16.5</td>
<td>34.83</td>
<td>21.0</td>
</tr>
<tr class="even">
<td>33.21</td>
<td>17.3</td>
<td>36.37</td>
<td>22.9</td>
</tr>
<tr class="odd">
<td>42.07</td>
<td>18.5</td>
<td>38.52</td>
<td>21.2</td>
</tr>
<tr class="even">
<td>44.30</td>
<td>19.0</td>
<td>30.02</td>
<td>19.3</td>
</tr>
<tr class="odd">
<td>46.00</td>
<td>18.0</td>
<td>50.18</td>
<td>23.4</td>
</tr>
<tr class="even">
<td>93.06</td>
<td>23.2</td>
<td>32.70</td>
<td>20.5</td>
</tr>
<tr class="odd">
<td>26.19</td>
<td>18.8</td>
<td>33.57</td>
<td>20.2</td>
</tr>
<tr class="even">
<td>30.76</td>
<td>17.5</td>
<td>64.02</td>
<td>24.4</td>
</tr>
<tr class="odd">
<td>28.76</td>
<td>19.4</td>
<td>60.16</td>
<td>23.2</td>
</tr>
<tr class="even">
<td>30.30</td>
<td>21.2</td>
<td>35.85</td>
<td>22.3</td>
</tr>
<tr class="odd">
<td>49.43</td>
<td>20.5</td>
<td>39.89</td>
<td>22.7</td>
</tr>
<tr class="even">
<td>28.06</td>
<td>20.1</td>
<td>47.83</td>
<td>24.3</td>
</tr>
<tr class="odd">
<td>33.61</td>
<td>21.2</td>
<td>30.60</td>
<td>18.1</td>
</tr>
<tr class="even">
<td>28.93</td>
<td>19.5</td>
<td>35.19</td>
<td>23.0</td>
</tr>
<tr class="odd">
<td>20.07</td>
<td>18.5</td>
<td>45.72</td>
<td>23.6</td>
</tr>
<tr class="even">
<td>84.67</td>
<td>21.1</td>
<td>74.20</td>
<td>26.6</td>
</tr>
<tr class="odd">
<td>27.95</td>
<td>20.2</td>
<td>65.07</td>
<td>30.2</td>
</tr>
<tr class="even">
<td>31.07</td>
<td>22.4</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
<section id="reference-5" class="level3">
<h3 class="anchored" data-anchor-id="reference-5">Reference</h3>
<blockquote class="blockquote">
<p>Wang, F., Peng, H., and Shi, W. (2016). The Relationship Between Air Layers and Evaporative Resistance of Male Chinese Clothing. <em>Applied Ergonomics</em>, <strong>56</strong>, 194-202.</p>
</blockquote>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/01PolyReg.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/02PolyReg.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; Regression &gt; Curve Estimation …</strong></em></p>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/03PolyReg.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/04PolyReg.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/05PolyReg.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/06PolyReg.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
</section>
</section>
<section id="analysis-of-variance-anova" class="level2">
<h2 class="anchored" data-anchor-id="analysis-of-variance-anova">Analysis of Variance (ANOVA)</h2>
<blockquote class="blockquote">
<ul>
<li>Comparing means of Normal dependent variable for levels of different factor(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-08-16-PASTIC-NTU/fig/ANOVANormalMeans.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-3"><img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/ANOVANormalMeans.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<section id="example-6" class="level3">
<h3 class="anchored" data-anchor-id="example-6">Example</h3>
<blockquote class="blockquote">
<p>Experiment comparing tensile strength and extension of blue jeans that were designed manually and with laser beams. Data from 20 pairs of jeans per design method is presented in the table.</p>
</blockquote>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Method</th>
<th>Jean ID</th>
<th>Sample ID</th>
<th>Strength</th>
<th>Extension</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>1</td>
<td>1</td>
<td>1</td>
<td>1266</td>
<td>68.06</td>
</tr>
<tr class="even">
<td>1</td>
<td>2</td>
<td>1</td>
<td>1099</td>
<td>61.54</td>
</tr>
<tr class="odd">
<td>1</td>
<td>3</td>
<td>1</td>
<td>1068</td>
<td>40.48</td>
</tr>
<tr class="even">
<td>1</td>
<td>4</td>
<td>1</td>
<td>1266</td>
<td>59.83</td>
</tr>
<tr class="odd">
<td>1</td>
<td>5</td>
<td>1</td>
<td>968</td>
<td>55.89</td>
</tr>
<tr class="even">
<td>1</td>
<td>6</td>
<td>1</td>
<td>1039</td>
<td>54.12</td>
</tr>
<tr class="odd">
<td>1</td>
<td>7</td>
<td>1</td>
<td>1194</td>
<td>77.09</td>
</tr>
<tr class="even">
<td>1</td>
<td>8</td>
<td>1</td>
<td>926</td>
<td>61.80</td>
</tr>
<tr class="odd">
<td>1</td>
<td>9</td>
<td>1</td>
<td>1009</td>
<td>58.31</td>
</tr>
<tr class="even">
<td>1</td>
<td>10</td>
<td>1</td>
<td>1048</td>
<td>71.61</td>
</tr>
<tr class="odd">
<td>1</td>
<td>11</td>
<td>1</td>
<td>1203</td>
<td>74.40</td>
</tr>
<tr class="even">
<td>1</td>
<td>12</td>
<td>1</td>
<td>884</td>
<td>63.38</td>
</tr>
<tr class="odd">
<td>1</td>
<td>13</td>
<td>1</td>
<td>1069</td>
<td>59.08</td>
</tr>
<tr class="even">
<td>1</td>
<td>14</td>
<td>1</td>
<td>1034</td>
<td>73.21</td>
</tr>
<tr class="odd">
<td>1</td>
<td>15</td>
<td>1</td>
<td>1021</td>
<td>78.60</td>
</tr>
<tr class="even">
<td>1</td>
<td>16</td>
<td>1</td>
<td>1022</td>
<td>57.44</td>
</tr>
<tr class="odd">
<td>1</td>
<td>17</td>
<td>1</td>
<td>1071</td>
<td>88.92</td>
</tr>
<tr class="even">
<td>1</td>
<td>18</td>
<td>1</td>
<td>1089</td>
<td>76.77</td>
</tr>
<tr class="odd">
<td>1</td>
<td>19</td>
<td>1</td>
<td>1197</td>
<td>74.78</td>
</tr>
<tr class="even">
<td>1</td>
<td>20</td>
<td>1</td>
<td>1035</td>
<td>71.11</td>
</tr>
<tr class="odd">
<td>2</td>
<td>21</td>
<td>1</td>
<td>1279</td>
<td>75.52</td>
</tr>
<tr class="even">
<td>2</td>
<td>22</td>
<td>1</td>
<td>1197</td>
<td>71.44</td>
</tr>
<tr class="odd">
<td>2</td>
<td>23</td>
<td>1</td>
<td>1083</td>
<td>44.16</td>
</tr>
<tr class="even">
<td>2</td>
<td>24</td>
<td>1</td>
<td>1418</td>
<td>70.56</td>
</tr>
<tr class="odd">
<td>2</td>
<td>25</td>
<td>1</td>
<td>1273</td>
<td>69.13</td>
</tr>
<tr class="even">
<td>2</td>
<td>26</td>
<td>1</td>
<td>1232</td>
<td>62.52</td>
</tr>
<tr class="odd">
<td>2</td>
<td>27</td>
<td>1</td>
<td>1293</td>
<td>72.62</td>
</tr>
<tr class="even">
<td>2</td>
<td>28</td>
<td>1</td>
<td>1121</td>
<td>68.96</td>
</tr>
<tr class="odd">
<td>2</td>
<td>29</td>
<td>1</td>
<td>1286</td>
<td>71.03</td>
</tr>
<tr class="even">
<td>2</td>
<td>30</td>
<td>1</td>
<td>1416</td>
<td>69.34</td>
</tr>
<tr class="odd">
<td>2</td>
<td>31</td>
<td>1</td>
<td>1285</td>
<td>81.79</td>
</tr>
<tr class="even">
<td>2</td>
<td>32</td>
<td>1</td>
<td>1268</td>
<td>69.29</td>
</tr>
<tr class="odd">
<td>2</td>
<td>33</td>
<td>1</td>
<td>1365</td>
<td>73.73</td>
</tr>
<tr class="even">
<td>2</td>
<td>34</td>
<td>1</td>
<td>1309</td>
<td>75.01</td>
</tr>
<tr class="odd">
<td>2</td>
<td>35</td>
<td>1</td>
<td>1343</td>
<td>75.95</td>
</tr>
<tr class="even">
<td>2</td>
<td>36</td>
<td>1</td>
<td>1292</td>
<td>72.64</td>
</tr>
<tr class="odd">
<td>2</td>
<td>37</td>
<td>1</td>
<td>1234</td>
<td>73.73</td>
</tr>
<tr class="even">
<td>2</td>
<td>38</td>
<td>1</td>
<td>1226</td>
<td>75.97</td>
</tr>
<tr class="odd">
<td>2</td>
<td>39</td>
<td>1</td>
<td>1229</td>
<td>71.60</td>
</tr>
<tr class="even">
<td>2</td>
<td>40</td>
<td>1</td>
<td>1254</td>
<td>70.48</td>
</tr>
<tr class="odd">
<td>1</td>
<td>1</td>
<td>2</td>
<td>1140</td>
<td>63.04</td>
</tr>
<tr class="even">
<td>1</td>
<td>2</td>
<td>2</td>
<td>1104</td>
<td>65.20</td>
</tr>
<tr class="odd">
<td>1</td>
<td>3</td>
<td>2</td>
<td>1051</td>
<td>50.62</td>
</tr>
<tr class="even">
<td>1</td>
<td>4</td>
<td>2</td>
<td>1128</td>
<td>56.21</td>
</tr>
<tr class="odd">
<td>1</td>
<td>5</td>
<td>2</td>
<td>1044</td>
<td>53.51</td>
</tr>
<tr class="even">
<td>1</td>
<td>6</td>
<td>2</td>
<td>1303</td>
<td>59.53</td>
</tr>
<tr class="odd">
<td>1</td>
<td>7</td>
<td>2</td>
<td>1081</td>
<td>60.75</td>
</tr>
<tr class="even">
<td>1</td>
<td>8</td>
<td>2</td>
<td>958</td>
<td>60.60</td>
</tr>
<tr class="odd">
<td>1</td>
<td>9</td>
<td>2</td>
<td>1058</td>
<td>69.80</td>
</tr>
<tr class="even">
<td>1</td>
<td>10</td>
<td>2</td>
<td>1077</td>
<td>62.05</td>
</tr>
<tr class="odd">
<td>1</td>
<td>11</td>
<td>2</td>
<td>956</td>
<td>72.87</td>
</tr>
<tr class="even">
<td>1</td>
<td>12</td>
<td>2</td>
<td>1010</td>
<td>59.41</td>
</tr>
<tr class="odd">
<td>1</td>
<td>13</td>
<td>2</td>
<td>1062</td>
<td>61.71</td>
</tr>
<tr class="even">
<td>1</td>
<td>14</td>
<td>2</td>
<td>1073</td>
<td>71.51</td>
</tr>
<tr class="odd">
<td>1</td>
<td>15</td>
<td>2</td>
<td>1027</td>
<td>68.16</td>
</tr>
<tr class="even">
<td>1</td>
<td>16</td>
<td>2</td>
<td>1048</td>
<td>60.76</td>
</tr>
<tr class="odd">
<td>1</td>
<td>17</td>
<td>2</td>
<td>1101</td>
<td>63.70</td>
</tr>
<tr class="even">
<td>1</td>
<td>18</td>
<td>2</td>
<td>1076</td>
<td>80.69</td>
</tr>
<tr class="odd">
<td>1</td>
<td>19</td>
<td>2</td>
<td>1081</td>
<td>69.65</td>
</tr>
<tr class="even">
<td>1</td>
<td>20</td>
<td>2</td>
<td>1084</td>
<td>68.45</td>
</tr>
<tr class="odd">
<td>2</td>
<td>21</td>
<td>2</td>
<td>1205</td>
<td>71.44</td>
</tr>
<tr class="even">
<td>2</td>
<td>22</td>
<td>2</td>
<td>1214</td>
<td>69.00</td>
</tr>
<tr class="odd">
<td>2</td>
<td>23</td>
<td>2</td>
<td>1055</td>
<td>47.05</td>
</tr>
<tr class="even">
<td>2</td>
<td>24</td>
<td>2</td>
<td>1402</td>
<td>74.50</td>
</tr>
<tr class="odd">
<td>2</td>
<td>25</td>
<td>2</td>
<td>1310</td>
<td>72.76</td>
</tr>
<tr class="even">
<td>2</td>
<td>26</td>
<td>2</td>
<td>1324</td>
<td>73.01</td>
</tr>
<tr class="odd">
<td>2</td>
<td>27</td>
<td>2</td>
<td>1303</td>
<td>79.82</td>
</tr>
<tr class="even">
<td>2</td>
<td>28</td>
<td>2</td>
<td>1083</td>
<td>65.43</td>
</tr>
<tr class="odd">
<td>2</td>
<td>29</td>
<td>2</td>
<td>1391</td>
<td>69.84</td>
</tr>
<tr class="even">
<td>2</td>
<td>30</td>
<td>2</td>
<td>1225</td>
<td>74.16</td>
</tr>
<tr class="odd">
<td>2</td>
<td>31</td>
<td>2</td>
<td>1396</td>
<td>79.49</td>
</tr>
<tr class="even">
<td>2</td>
<td>32</td>
<td>2</td>
<td>1273</td>
<td>75.30</td>
</tr>
<tr class="odd">
<td>2</td>
<td>33</td>
<td>2</td>
<td>1326</td>
<td>66.65</td>
</tr>
<tr class="even">
<td>2</td>
<td>34</td>
<td>2</td>
<td>1393</td>
<td>79.21</td>
</tr>
<tr class="odd">
<td>2</td>
<td>35</td>
<td>2</td>
<td>1172</td>
<td>73.57</td>
</tr>
<tr class="even">
<td>2</td>
<td>36</td>
<td>2</td>
<td>1241</td>
<td>71.80</td>
</tr>
<tr class="odd">
<td>2</td>
<td>37</td>
<td>2</td>
<td>1292</td>
<td>77.70</td>
</tr>
<tr class="even">
<td>2</td>
<td>38</td>
<td>2</td>
<td>1354</td>
<td>73.83</td>
</tr>
<tr class="odd">
<td>2</td>
<td>39</td>
<td>2</td>
<td>1299</td>
<td>73.59</td>
</tr>
<tr class="even">
<td>2</td>
<td>40</td>
<td>2</td>
<td>1202</td>
<td>68.45</td>
</tr>
<tr class="odd">
<td>1</td>
<td>1</td>
<td>3</td>
<td>1104</td>
<td>61.40</td>
</tr>
<tr class="even">
<td>1</td>
<td>2</td>
<td>3</td>
<td>1113</td>
<td>63.44</td>
</tr>
<tr class="odd">
<td>1</td>
<td>3</td>
<td>3</td>
<td>1063</td>
<td>50.48</td>
</tr>
<tr class="even">
<td>1</td>
<td>4</td>
<td>3</td>
<td>1200</td>
<td>63.08</td>
</tr>
<tr class="odd">
<td>1</td>
<td>5</td>
<td>3</td>
<td>1006</td>
<td>66.70</td>
</tr>
<tr class="even">
<td>1</td>
<td>6</td>
<td>3</td>
<td>860</td>
<td>46.39</td>
</tr>
<tr class="odd">
<td>1</td>
<td>7</td>
<td>3</td>
<td>936</td>
<td>62.76</td>
</tr>
<tr class="even">
<td>1</td>
<td>8</td>
<td>3</td>
<td>967</td>
<td>64.72</td>
</tr>
<tr class="odd">
<td>1</td>
<td>9</td>
<td>3</td>
<td>1018</td>
<td>61.55</td>
</tr>
<tr class="even">
<td>1</td>
<td>10</td>
<td>3</td>
<td>1191</td>
<td>69.50</td>
</tr>
<tr class="odd">
<td>1</td>
<td>11</td>
<td>3</td>
<td>987</td>
<td>73.45</td>
</tr>
<tr class="even">
<td>1</td>
<td>12</td>
<td>3</td>
<td>1155</td>
<td>79.59</td>
</tr>
<tr class="odd">
<td>1</td>
<td>13</td>
<td>3</td>
<td>982</td>
<td>57.91</td>
</tr>
<tr class="even">
<td>1</td>
<td>14</td>
<td>3</td>
<td>1064</td>
<td>70.86</td>
</tr>
<tr class="odd">
<td>1</td>
<td>15</td>
<td>3</td>
<td>1112</td>
<td>68.17</td>
</tr>
<tr class="even">
<td>1</td>
<td>16</td>
<td>3</td>
<td>1040</td>
<td>63.46</td>
</tr>
<tr class="odd">
<td>1</td>
<td>17</td>
<td>3</td>
<td>1075</td>
<td>61.44</td>
</tr>
<tr class="even">
<td>1</td>
<td>18</td>
<td>3</td>
<td>1081</td>
<td>73.51</td>
</tr>
<tr class="odd">
<td>1</td>
<td>19</td>
<td>3</td>
<td>1045</td>
<td>71.19</td>
</tr>
<tr class="even">
<td>1</td>
<td>20</td>
<td>3</td>
<td>1077</td>
<td>69.33</td>
</tr>
<tr class="odd">
<td>2</td>
<td>21</td>
<td>3</td>
<td>1283</td>
<td>78.62</td>
</tr>
<tr class="even">
<td>2</td>
<td>22</td>
<td>3</td>
<td>1154</td>
<td>63.06</td>
</tr>
<tr class="odd">
<td>2</td>
<td>23</td>
<td>3</td>
<td>1117</td>
<td>42.43</td>
</tr>
<tr class="even">
<td>2</td>
<td>24</td>
<td>3</td>
<td>1335</td>
<td>71.45</td>
</tr>
<tr class="odd">
<td>2</td>
<td>25</td>
<td>3</td>
<td>1277</td>
<td>73.41</td>
</tr>
<tr class="even">
<td>2</td>
<td>26</td>
<td>3</td>
<td>1313</td>
<td>71.44</td>
</tr>
<tr class="odd">
<td>2</td>
<td>27</td>
<td>3</td>
<td>1361</td>
<td>74.27</td>
</tr>
<tr class="even">
<td>2</td>
<td>28</td>
<td>3</td>
<td>1104</td>
<td>70.42</td>
</tr>
<tr class="odd">
<td>2</td>
<td>29</td>
<td>3</td>
<td>1450</td>
<td>72.40</td>
</tr>
<tr class="even">
<td>2</td>
<td>30</td>
<td>3</td>
<td>1323</td>
<td>75.00</td>
</tr>
<tr class="odd">
<td>2</td>
<td>31</td>
<td>3</td>
<td>1315</td>
<td>74.82</td>
</tr>
<tr class="even">
<td>2</td>
<td>32</td>
<td>3</td>
<td>1321</td>
<td>77.76</td>
</tr>
<tr class="odd">
<td>2</td>
<td>33</td>
<td>3</td>
<td>1315</td>
<td>66.90</td>
</tr>
<tr class="even">
<td>2</td>
<td>34</td>
<td>3</td>
<td>1386</td>
<td>77.64</td>
</tr>
<tr class="odd">
<td>2</td>
<td>35</td>
<td>3</td>
<td>1165</td>
<td>75.60</td>
</tr>
<tr class="even">
<td>2</td>
<td>36</td>
<td>3</td>
<td>1198</td>
<td>69.73</td>
</tr>
<tr class="odd">
<td>2</td>
<td>37</td>
<td>3</td>
<td>1223</td>
<td>69.42</td>
</tr>
<tr class="even">
<td>2</td>
<td>38</td>
<td>3</td>
<td>1289</td>
<td>80.39</td>
</tr>
<tr class="odd">
<td>2</td>
<td>39</td>
<td>3</td>
<td>1339</td>
<td>71.40</td>
</tr>
<tr class="even">
<td>2</td>
<td>40</td>
<td>3</td>
<td>1266</td>
<td>72.36</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
<section id="reference-6" class="level3">
<h3 class="anchored" data-anchor-id="reference-6">Reference</h3>
<blockquote class="blockquote">
<p>Ondogan, Z., Pamuk, O., Ondogan, E.N., and Ozguney, A. (2005). Improving the Appearance of All Textile Products from Clothing to Home Textile Using Laser Technology. <em>Optics and Laser Technology</em>, <strong>37</strong>, 631-637.</p>
</blockquote>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/01ANOVA.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; General Linear Model &gt; Univariate …</strong></em></p>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/02ANOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/03ANOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/04ANOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/05ANOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/06ANOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/07ANOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/08ANOVA.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
</section>
<section id="example-7" class="level3">
<h3 class="anchored" data-anchor-id="example-7">Example</h3>
<blockquote class="blockquote">
<p>The analysis of variance of cotton yarn fineness is customer satisfaction with quality textile product. The purpose of this study is to minimize the faults of finished cotton fabric by maintaining actual yarn count during producing in ring frame. If the analysis shows the mean count difference due to shift and machine number then action should be taken to maintain required count of yarn. This action may be taken by setting of actual draft, uniform linear density of finisher draw frame sliver and maintaining proper atmospheric condition in ring and back section. The 210 data for yarn count of 30 KH (30 carded Hosiery) was summarized as follows:</p>
</blockquote>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Machine Number</th>
<th>Shift</th>
<th>YarnCount</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>1</td>
<td>A</td>
<td>29.52</td>
</tr>
<tr class="even">
<td>2</td>
<td>A</td>
<td>29.58</td>
</tr>
<tr class="odd">
<td>3</td>
<td>A</td>
<td>28.62</td>
</tr>
<tr class="even">
<td>4</td>
<td>A</td>
<td>30.50</td>
</tr>
<tr class="odd">
<td>5</td>
<td>A</td>
<td>29.03</td>
</tr>
<tr class="even">
<td>6</td>
<td>A</td>
<td>29.75</td>
</tr>
<tr class="odd">
<td>7</td>
<td>A</td>
<td>31.28</td>
</tr>
<tr class="even">
<td>1</td>
<td>B</td>
<td>30.91</td>
</tr>
<tr class="odd">
<td>2</td>
<td>B</td>
<td>29.33</td>
</tr>
<tr class="even">
<td>3</td>
<td>B</td>
<td>29.32</td>
</tr>
<tr class="odd">
<td>4</td>
<td>B</td>
<td>30.04</td>
</tr>
<tr class="even">
<td>5</td>
<td>B</td>
<td>30.33</td>
</tr>
<tr class="odd">
<td>6</td>
<td>B</td>
<td>30.91</td>
</tr>
<tr class="even">
<td>7</td>
<td>B</td>
<td>29.95</td>
</tr>
<tr class="odd">
<td>1</td>
<td>C</td>
<td>30.14</td>
</tr>
<tr class="even">
<td>2</td>
<td>C</td>
<td>30.00</td>
</tr>
<tr class="odd">
<td>3</td>
<td>C</td>
<td>29.98</td>
</tr>
<tr class="even">
<td>4</td>
<td>C</td>
<td>28.99</td>
</tr>
<tr class="odd">
<td>5</td>
<td>C</td>
<td>29.82</td>
</tr>
<tr class="even">
<td>6</td>
<td>C</td>
<td>29.85</td>
</tr>
<tr class="odd">
<td>7</td>
<td>C</td>
<td>30.05</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
<section id="reference-7" class="level3">
<h3 class="anchored" data-anchor-id="reference-7">Reference</h3>
<blockquote class="blockquote">
<p>Hossen, J., Haque, E., Khan, S.K., and Saha, S. (2012). Analysis of cotton yarn count variation by two way ANOVA. Conference: Annals of the University of Oradea, Fascicle of Textiles, Leatherwork. <em>At Annals of the University of Oradea</em>, <strong>XIII-02</strong>.</p>
</blockquote>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/01RCBD.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; General Linear Model &gt; Univariate …</strong></em></p>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/02RCBD.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/03RCBD.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/04RCBD.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/05RCBD.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/06RCBD.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/07RCBD.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/08RCBD.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/09RCBD.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/10RCBD.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/11RCBD.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
</section>
</section>
<section id="analysis-of-covariance-ancova" class="level2">
<h2 class="anchored" data-anchor-id="analysis-of-covariance-ancova">Analysis of Covariance (ANCOVA)</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on quantitative explanatory variable(s)</li>
<li>Comparing means of Normal dependent variable for levels of different factor(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-08-16-PASTIC-NTU/fig/ANCOVA.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-4"><img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/ANCOVA.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<section id="example-8" class="level3">
<h3 class="anchored" data-anchor-id="example-8">Example</h3>
<blockquote class="blockquote">
<p>Results of Experiment measuring top shrinkage under 3 treatments (untreated, ether-extracted, ether/alcohol extracted), measured at 3 levels of pH (2, 6, 10) is given in the following table.</p>
</blockquote>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Treatment</th>
<th>pH</th>
<th>Shrinkage</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>Untreated</td>
<td>2</td>
<td>42.8</td>
</tr>
<tr class="even">
<td>Untreated</td>
<td>6</td>
<td>46.2</td>
</tr>
<tr class="odd">
<td>Untreated</td>
<td>10</td>
<td>45.6</td>
</tr>
<tr class="even">
<td>Untreated</td>
<td>2</td>
<td>43.0</td>
</tr>
<tr class="odd">
<td>Untreated</td>
<td>6</td>
<td>47.0</td>
</tr>
<tr class="even">
<td>Untreated</td>
<td>10</td>
<td>43.8</td>
</tr>
<tr class="odd">
<td>Untreated</td>
<td>2</td>
<td>43.5</td>
</tr>
<tr class="even">
<td>Untreated</td>
<td>6</td>
<td>45.2</td>
</tr>
<tr class="odd">
<td>Untreated</td>
<td>10</td>
<td>45.7</td>
</tr>
<tr class="even">
<td>Ether Extract</td>
<td>2</td>
<td>33.6</td>
</tr>
<tr class="odd">
<td>Ether Extract</td>
<td>6</td>
<td>40.4</td>
</tr>
<tr class="even">
<td>Ether Extract</td>
<td>10</td>
<td>40.1</td>
</tr>
<tr class="odd">
<td>Ether Extract</td>
<td>2</td>
<td>35.0</td>
</tr>
<tr class="even">
<td>Ether Extract</td>
<td>6</td>
<td>39.4</td>
</tr>
<tr class="odd">
<td>Ether Extract</td>
<td>10</td>
<td>39.5</td>
</tr>
<tr class="even">
<td>Ether Extract</td>
<td>2</td>
<td>36.2</td>
</tr>
<tr class="odd">
<td>Ether Extract</td>
<td>6</td>
<td>37.9</td>
</tr>
<tr class="even">
<td>Ether Extract</td>
<td>10</td>
<td>39.2</td>
</tr>
<tr class="odd">
<td>ether/alcohol extracted</td>
<td>2</td>
<td>35.6</td>
</tr>
<tr class="even">
<td>ether/alcohol extracted</td>
<td>6</td>
<td>35.2</td>
</tr>
<tr class="odd">
<td>ether/alcohol extracted</td>
<td>10</td>
<td>36.6</td>
</tr>
<tr class="even">
<td>ether/alcohol extracted</td>
<td>2</td>
<td>34.8</td>
</tr>
<tr class="odd">
<td>ether/alcohol extracted</td>
<td>6</td>
<td>33.0</td>
</tr>
<tr class="even">
<td>ether/alcohol extracted</td>
<td>10</td>
<td>32.3</td>
</tr>
<tr class="odd">
<td>ether/alcohol extracted</td>
<td>2</td>
<td>34.8</td>
</tr>
<tr class="even">
<td>ether/alcohol extracted</td>
<td>6</td>
<td>32.3</td>
</tr>
<tr class="odd">
<td>ether/alcohol extracted</td>
<td>10</td>
<td>35.6</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
<section id="reference-8" class="level3">
<h3 class="anchored" data-anchor-id="reference-8">Reference</h3>
<blockquote class="blockquote">
<p>Lindberg, J. (1953). Relationship Between Various Surface Properties of Wool Fibers: Part II: Frictional Properties. <em>Textile Research Journal</em>, <strong>23</strong>, 225-237.</p>
</blockquote>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/01ANCOVA.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
</section>
<section id="same-slopes-but-different-intercepts" class="level3">
<h3 class="anchored" data-anchor-id="same-slopes-but-different-intercepts">Same Slopes but different Intercepts</h3>
<p><em><strong>Analyze &gt; General Linear Model &gt; Univariate …</strong></em></p>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/02ANCOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/03ANCOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/04ANCOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/05ANCOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/06ANCOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/07ANCOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/08ANCOVA.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
</section>
<section id="different-intercepts-and-different-slopes" class="level3">
<h3 class="anchored" data-anchor-id="different-intercepts-and-different-slopes">Different Intercepts and different Slopes</h3>
<p><em><strong>Analyze &gt; General Linear Model &gt; Univariate …</strong></em></p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/09ANCOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/10ANCOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/11ANCOVA.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/12ANCOVA.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
</section>
</section>
<section id="factorial-experiments" class="level2">
<h2 class="anchored" data-anchor-id="factorial-experiments">Factorial Experiments</h2>
<blockquote class="blockquote">
<ul>
<li>Treatments are the combinations of the levels of different factors</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-9" class="level3">
<h3 class="anchored" data-anchor-id="example-9">Example</h3>
<blockquote class="blockquote">
<p>Following data presents the number of warp breaks per loom, where a loom corresponds to a fixed length of yarn for two factors, Wool Type with Two levels (A,B) and Tension with three levels.(Low, Medium, High). Analyze the data with interaction.</p>
</blockquote>
<table class="caption-top table">
<thead>
<tr class="header">
<th>WoolType</th>
<th>Tension</th>
<th>Yarn Breaks</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>A</td>
<td>L</td>
<td>26</td>
</tr>
<tr class="even">
<td>A</td>
<td>L</td>
<td>30</td>
</tr>
<tr class="odd">
<td>A</td>
<td>L</td>
<td>54</td>
</tr>
<tr class="even">
<td>A</td>
<td>L</td>
<td>25</td>
</tr>
<tr class="odd">
<td>A</td>
<td>L</td>
<td>70</td>
</tr>
<tr class="even">
<td>A</td>
<td>L</td>
<td>52</td>
</tr>
<tr class="odd">
<td>A</td>
<td>L</td>
<td>51</td>
</tr>
<tr class="even">
<td>A</td>
<td>L</td>
<td>26</td>
</tr>
<tr class="odd">
<td>A</td>
<td>L</td>
<td>67</td>
</tr>
<tr class="even">
<td>A</td>
<td>M</td>
<td>18</td>
</tr>
<tr class="odd">
<td>A</td>
<td>M</td>
<td>21</td>
</tr>
<tr class="even">
<td>A</td>
<td>M</td>
<td>29</td>
</tr>
<tr class="odd">
<td>A</td>
<td>M</td>
<td>17</td>
</tr>
<tr class="even">
<td>A</td>
<td>M</td>
<td>12</td>
</tr>
<tr class="odd">
<td>A</td>
<td>M</td>
<td>18</td>
</tr>
<tr class="even">
<td>A</td>
<td>M</td>
<td>35</td>
</tr>
<tr class="odd">
<td>A</td>
<td>M</td>
<td>30</td>
</tr>
<tr class="even">
<td>A</td>
<td>M</td>
<td>36</td>
</tr>
<tr class="odd">
<td>A</td>
<td>H</td>
<td>36</td>
</tr>
<tr class="even">
<td>A</td>
<td>H</td>
<td>21</td>
</tr>
<tr class="odd">
<td>A</td>
<td>H</td>
<td>24</td>
</tr>
<tr class="even">
<td>A</td>
<td>H</td>
<td>18</td>
</tr>
<tr class="odd">
<td>A</td>
<td>H</td>
<td>10</td>
</tr>
<tr class="even">
<td>A</td>
<td>H</td>
<td>43</td>
</tr>
<tr class="odd">
<td>A</td>
<td>H</td>
<td>28</td>
</tr>
<tr class="even">
<td>A</td>
<td>H</td>
<td>15</td>
</tr>
<tr class="odd">
<td>A</td>
<td>H</td>
<td>26</td>
</tr>
<tr class="even">
<td>B</td>
<td>L</td>
<td>27</td>
</tr>
<tr class="odd">
<td>B</td>
<td>L</td>
<td>14</td>
</tr>
<tr class="even">
<td>B</td>
<td>L</td>
<td>29</td>
</tr>
<tr class="odd">
<td>B</td>
<td>L</td>
<td>19</td>
</tr>
<tr class="even">
<td>B</td>
<td>L</td>
<td>29</td>
</tr>
<tr class="odd">
<td>B</td>
<td>L</td>
<td>31</td>
</tr>
<tr class="even">
<td>B</td>
<td>L</td>
<td>41</td>
</tr>
<tr class="odd">
<td>B</td>
<td>L</td>
<td>20</td>
</tr>
<tr class="even">
<td>B</td>
<td>L</td>
<td>44</td>
</tr>
<tr class="odd">
<td>B</td>
<td>M</td>
<td>42</td>
</tr>
<tr class="even">
<td>B</td>
<td>M</td>
<td>26</td>
</tr>
<tr class="odd">
<td>B</td>
<td>M</td>
<td>19</td>
</tr>
<tr class="even">
<td>B</td>
<td>M</td>
<td>16</td>
</tr>
<tr class="odd">
<td>B</td>
<td>M</td>
<td>39</td>
</tr>
<tr class="even">
<td>B</td>
<td>M</td>
<td>28</td>
</tr>
<tr class="odd">
<td>B</td>
<td>M</td>
<td>21</td>
</tr>
<tr class="even">
<td>B</td>
<td>M</td>
<td>39</td>
</tr>
<tr class="odd">
<td>B</td>
<td>M</td>
<td>29</td>
</tr>
<tr class="even">
<td>B</td>
<td>H</td>
<td>20</td>
</tr>
<tr class="odd">
<td>B</td>
<td>H</td>
<td>21</td>
</tr>
<tr class="even">
<td>B</td>
<td>H</td>
<td>24</td>
</tr>
<tr class="odd">
<td>B</td>
<td>H</td>
<td>17</td>
</tr>
<tr class="even">
<td>B</td>
<td>H</td>
<td>13</td>
</tr>
<tr class="odd">
<td>B</td>
<td>H</td>
<td>15</td>
</tr>
<tr class="even">
<td>B</td>
<td>H</td>
<td>15</td>
</tr>
<tr class="odd">
<td>B</td>
<td>H</td>
<td>16</td>
</tr>
<tr class="even">
<td>B</td>
<td>H</td>
<td>28</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
<section id="reference-9" class="level3">
<h3 class="anchored" data-anchor-id="reference-9">Reference</h3>
<blockquote class="blockquote">
<p>Tippett, L. H. C. (1950). Technological Applications of Statistics. John Wiley &amp; Sons, New York, USA.</p>
</blockquote>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/01Factorial.webp" class="img-fluid">
</center>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; General Linear Model &gt; Univariate …</strong></em></p>
<p>&nbsp;</p>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/02Factorial.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/03Factorial.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/04Factorial.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/05Factorial.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/06Factorial.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/07Factorial.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/08Factorial.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/09Factorial.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/10Factorial.webp" class="img-fluid">
</center>
<center>
<img src="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/11Factorial.webp" class="img-fluid">
</center>


</section>
</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2018,
  author = {Yaseen, Muhammad},
  title = {An {Introduction} to {Statistics} Using {SPSS}},
  date = {2018-08-16},
  url = {https://myaseen208.com/blogs/2018-08-16-PASTIC-NTU/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2018" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2018. <span>“An Introduction to Statistics Using
SPSS.”</span> August 16. <a href="https://myaseen208.com/blogs/2018-08-16-PASTIC-NTU/">https://myaseen208.com/blogs/2018-08-16-PASTIC-NTU/</a>.
</div></div></section></div> ]]></description>
  <category>Data Science</category>
  <category>Statistics</category>
  <category>Research</category>
  <category>SPSS</category>
  <guid>https://myaseen208.com/blogs/2018-08-16-PASTIC-NTU/</guid>
  <pubDate>Thu, 16 Aug 2018 04:00:00 GMT</pubDate>
  <media:content url="https://myaseen208.com/assets/img/blogs/2018-08-16-PASTIC-NTU/fig/2018-08-16_PASTIC-NTU.webp" medium="image" type="image/webp"/>
</item>
<item>
  <title>Emerging Technologies in Research: Google Apps and SPSS</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2018-05-15-PASTIC-FSD/</link>
  <description><![CDATA[ 




<section id="introduction" class="level2">
<h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/2018-05-15_PASTIC-FSD_SPSS.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-1"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/2018-05-15_PASTIC-FSD_SPSS.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
<section id="statistics" class="level2">
<h2 class="anchored" data-anchor-id="statistics">Statistics</h2>
<blockquote class="blockquote">
<ul>
<li>Statistics deals with uncertainty &amp; variability</li>
<li>Statistics turns data into information</li>
<li>Data -&gt; Information -&gt; Knowledge -&gt; Wisdom</li>
<li>Statistics is the interpretation of Science</li>
<li>Statistics is the Art &amp; Science of learning from data</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-2"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS2.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
<section id="variable" class="level2">
<h2 class="anchored" data-anchor-id="variable">Variable</h2>
<blockquote class="blockquote">
<ul>
<li>Characteristic that may vary from individual to individual</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section>
<section id="measurement" class="level2">
<h2 class="anchored" data-anchor-id="measurement">Measurement</h2>
<blockquote class="blockquote">
<ul>
<li>Process of assigning numbers or labels to objects or states in accordance with logically accepted rules</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section>
<section id="measurement-scales" class="level2">
<h2 class="anchored" data-anchor-id="measurement-scales">Measurement Scales</h2>
<blockquote class="blockquote">
<ul>
<li><strong>Nominal Scale:</strong> Obersvations may be classified into mutually exclusive &amp; exhaustive categories</li>
<li><strong>Ordinal Scale:</strong> Obersvations may be ranked</li>
<li><strong>Interval Scale:</strong> Difference between obersvations is meaningful</li>
<li><strong>Ratio Scale:</strong> Ratio between obersvations is meaningful &amp; true zero point</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section>
<section id="descriptive-statistics" class="level2">
<h2 class="anchored" data-anchor-id="descriptive-statistics">Descriptive Statistics</h2>
<blockquote class="blockquote">
<ul>
<li>No of observations</li>
<li>Measures of Central Tendency</li>
<li>Measures of Dispersion</li>
<li>Measures of Skewness</li>
<li>Measures of Kurtosis</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example" class="level3">
<h3 class="anchored" data-anchor-id="example">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Fertilizer (Kg/acre)</th>
<th>Production (Bushels/acre)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>100</td>
<td>70</td>
</tr>
<tr class="even">
<td>200</td>
<td>70</td>
</tr>
<tr class="odd">
<td>400</td>
<td>80</td>
</tr>
<tr class="even">
<td>500</td>
<td>100</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-3"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS2.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; Descriptive Statistics &gt; Descriptives …</strong></em></p>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-4"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS2.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-5"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS3.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-6"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS4.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS5.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-7"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS5.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS6.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-8"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS6.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS7.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-9"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/DS7.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
</section>
<section id="boxwhisker-diagram" class="level2">
<h2 class="anchored" data-anchor-id="boxwhisker-diagram">Boxwhisker Diagram</h2>
<blockquote class="blockquote">
<ul>
<li>Pictorial display of five number summary (Minimum, Q1, Q2, Q3 and Maximum)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-1" class="level3">
<h3 class="anchored" data-anchor-id="example-1">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Yield</th>
<th>Variety</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>5</td>
<td>V1</td>
</tr>
<tr class="even">
<td>6</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>7</td>
<td>V1</td>
</tr>
<tr class="even">
<td>15</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>16</td>
<td>V2</td>
</tr>
<tr class="even">
<td>17</td>
<td>V2</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/BoxPlot2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-10"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/BoxPlot2.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><em><strong>Graphs &gt; Legacy Dialogs &gt; Scatter/Boxplot …</strong></em></p>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/BoxPlot2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-11"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/BoxPlot2.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/BoxPlot3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-12"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/BoxPlot3.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/BoxPlot4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-13"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/BoxPlot4.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/BoxPlot5.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-14"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/BoxPlot5.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
</section>
<section id="regression-analysis" class="level2">
<h2 class="anchored" data-anchor-id="regression-analysis">Regression Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on quantitative explanatory variable(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/PopRegFn.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-15"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/PopRegFn.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
<section id="simple-linear-regression" class="level2">
<h2 class="anchored" data-anchor-id="simple-linear-regression">Simple Linear Regression</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on a quantitative explanatory variable</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-2" class="level3">
<h3 class="anchored" data-anchor-id="example-2">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Fertilizer (Kg/acre)</th>
<th>Production (Bushels/acre)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>100</td>
<td>70</td>
</tr>
<tr class="even">
<td>200</td>
<td>70</td>
</tr>
<tr class="odd">
<td>400</td>
<td>80</td>
</tr>
<tr class="even">
<td>500</td>
<td>100</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/SLR1.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-16"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/SLR1.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><em><strong>Graphs &gt; Legacy Dialogs &gt; Scatter/Dot …</strong></em></p>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ScatterPlot1.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-17"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ScatterPlot1.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ScatterPlot2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-18"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ScatterPlot2.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ScatterPlot3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-19"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ScatterPlot3.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ScatterPlot4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-20"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ScatterPlot4.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; Regression &gt; Linear …</strong></em></p>
<p>&nbsp;</p>
<p><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/SLR2.webp" class="img-fluid"> <img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/SLR3.webp" class="img-fluid"></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/SLR4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-21"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/SLR4.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/SLR5.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-22"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/SLR5.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/SLR6.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-23"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/SLR6.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/SLR7.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-24"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/SLR7.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
<section id="exercise" class="level3">
<h3 class="anchored" data-anchor-id="exercise">Exercise</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Fertilizer</th>
<th>Yield</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>0.3</td>
<td>10</td>
</tr>
<tr class="even">
<td>0.6</td>
<td>15</td>
</tr>
<tr class="odd">
<td>0.9</td>
<td>30</td>
</tr>
<tr class="even">
<td>1.2</td>
<td>35</td>
</tr>
<tr class="odd">
<td>1.5</td>
<td>25</td>
</tr>
<tr class="even">
<td>1.8</td>
<td>30</td>
</tr>
<tr class="odd">
<td>2.1</td>
<td>50</td>
</tr>
<tr class="even">
<td>2.4</td>
<td>45</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
<section id="exercise-1" class="level3">
<h3 class="anchored" data-anchor-id="exercise-1">Exercise</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Weekly Income ($)</th>
<th>Weekly Expenditures ($)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>80</td>
<td>70</td>
</tr>
<tr class="even">
<td>100</td>
<td>65</td>
</tr>
<tr class="odd">
<td>120</td>
<td>90</td>
</tr>
<tr class="even">
<td>140</td>
<td>95</td>
</tr>
<tr class="odd">
<td>160</td>
<td>110</td>
</tr>
<tr class="even">
<td>180</td>
<td>115</td>
</tr>
<tr class="odd">
<td>200</td>
<td>120</td>
</tr>
<tr class="even">
<td>220</td>
<td>140</td>
</tr>
<tr class="odd">
<td>240</td>
<td>155</td>
</tr>
<tr class="even">
<td>260</td>
<td>150</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
</section>
<section id="multiple-linear-regression" class="level2">
<h2 class="anchored" data-anchor-id="multiple-linear-regression">Multiple Linear Regression</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on two or more quantitative explanatory variables</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-3" class="level3">
<h3 class="anchored" data-anchor-id="example-3">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Fertilizer (Kg)</th>
<th>Rainfall (mm)</th>
<th>Yield (Kg)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>100</td>
<td>10</td>
<td>40</td>
</tr>
<tr class="even">
<td>200</td>
<td>20</td>
<td>50</td>
</tr>
<tr class="odd">
<td>300</td>
<td>10</td>
<td>50</td>
</tr>
<tr class="even">
<td>400</td>
<td>30</td>
<td>70</td>
</tr>
<tr class="odd">
<td>500</td>
<td>20</td>
<td>65</td>
</tr>
<tr class="even">
<td>600</td>
<td>20</td>
<td>65</td>
</tr>
<tr class="odd">
<td>700</td>
<td>30</td>
<td>80</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; Regression &gt; Linear …</strong></em></p>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/MLR2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-25"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/MLR2.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/MLR3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-26"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/MLR3.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/MLR4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-27"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/MLR4.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/MLR5.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-28"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/MLR5.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/MLR6.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-29"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/MLR6.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
</section>
<section id="polynomial-regression-analysis" class="level2">
<h2 class="anchored" data-anchor-id="polynomial-regression-analysis">Polynomial Regression Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying non-linear dependency of a normal response on quantitative explanatory variable(s)</li>
</ul>
</blockquote>
<section id="example-4" class="level3">
<h3 class="anchored" data-anchor-id="example-4">Example</h3>
<blockquote class="blockquote">
<p>An experiment was conducted to evaluate the effects of different levels of nitrogen. Three levels of nitrogen: 0, 10 and 20 grams per plot were used in the experiment. Each treatment was replicated twice and data is given below:</p>
</blockquote>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Nitrogen</th>
<th>Yield</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>0</td>
<td>5</td>
</tr>
<tr class="even">
<td>0</td>
<td>7</td>
</tr>
<tr class="odd">
<td>10</td>
<td>15</td>
</tr>
<tr class="even">
<td>10</td>
<td>17</td>
</tr>
<tr class="odd">
<td>20</td>
<td>9</td>
</tr>
<tr class="even">
<td>20</td>
<td>11</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
</section>
<section id="analysis-of-variance-anova" class="level2">
<h2 class="anchored" data-anchor-id="analysis-of-variance-anova">Analysis of Variance (ANOVA)</h2>
<blockquote class="blockquote">
<ul>
<li>Comparing means of Normal dependent variable for levels of different factor(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANOVANormalMeans.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-30"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANOVANormalMeans.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<section id="example-5" class="level3">
<h3 class="anchored" data-anchor-id="example-5">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Yield</th>
<th>Variety</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>5</td>
<td>V1</td>
</tr>
<tr class="even">
<td>6</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>7</td>
<td>V1</td>
</tr>
<tr class="even">
<td>15</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>16</td>
<td>V2</td>
</tr>
<tr class="even">
<td>17</td>
<td>V2</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANOVA1.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-31"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANOVA1.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><em><strong>General Linear Model &gt; Univariate …</strong></em></p>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANOVA2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-32"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANOVA2.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANOVA3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-33"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANOVA3.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANOVA4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-34"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANOVA4.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANOVA5.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-35"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANOVA5.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANOVA5.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-36"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANOVA5.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
<section id="exercise-2" class="level3">
<h3 class="anchored" data-anchor-id="exercise-2">Exercise</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Yield</th>
<th>Variety</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>5</td>
<td>V1</td>
</tr>
<tr class="even">
<td>7</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>15</td>
<td>V2</td>
</tr>
<tr class="even">
<td>17</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>17</td>
<td>V3</td>
</tr>
<tr class="even">
<td>19</td>
<td>V3</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
</section>
<section id="analysis-of-covariance-ancova" class="level2">
<h2 class="anchored" data-anchor-id="analysis-of-covariance-ancova">Analysis of Covariance (ANCOVA)</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on quantitative explanatory variable(s)</li>
<li>Comparing means of Normal dependent variable for levels of different factor(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANCOVA.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-37"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/ANCOVA.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<section id="example-6" class="level3">
<h3 class="anchored" data-anchor-id="example-6">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Yield</th>
<th>Fert</th>
<th>Variety</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>51</td>
<td>80</td>
<td>V1</td>
</tr>
<tr class="even">
<td>52</td>
<td>80</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>53</td>
<td>90</td>
<td>V1</td>
</tr>
<tr class="even">
<td>54</td>
<td>90</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>56</td>
<td>100</td>
<td>V1</td>
</tr>
<tr class="even">
<td>57</td>
<td>100</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>55</td>
<td>80</td>
<td>V2</td>
</tr>
<tr class="even">
<td>56</td>
<td>80</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>58</td>
<td>90</td>
<td>V2</td>
</tr>
<tr class="even">
<td>59</td>
<td>90</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>62</td>
<td>100</td>
<td>V2</td>
</tr>
<tr class="even">
<td>63</td>
<td>100</td>
<td>V2</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
</section>
<section id="same-intercepts-but-different-slopes" class="level3">
<h3 class="anchored" data-anchor-id="same-intercepts-but-different-slopes">Same intercepts but different slopes</h3>
<p>&nbsp;</p>
</section>
<section id="different-intercepts-and-different-slopes" class="level3">
<h3 class="anchored" data-anchor-id="different-intercepts-and-different-slopes">Different intercepts and different slopes</h3>
</section>
</section>
<section id="correlation-analysis" class="level2">
<h2 class="anchored" data-anchor-id="correlation-analysis">Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Quantitative Variables</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section>
<section id="simple-correlation-analysis" class="level2">
<h2 class="anchored" data-anchor-id="simple-correlation-analysis">Simple Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Two Quantitative Variables</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cleft(X_%7B1%7D,X_%7B2%7D%5Cright)"></li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-7" class="level3">
<h3 class="anchored" data-anchor-id="example-7">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Sparrow Wing length (cm)</th>
<th>Sparrow Tail length (cm)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>10.4</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.8</td>
<td>7.6</td>
</tr>
<tr class="odd">
<td>11.1</td>
<td>7.9</td>
</tr>
<tr class="even">
<td>10.2</td>
<td>7.2</td>
</tr>
<tr class="odd">
<td>10.3</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.2</td>
<td>7.1</td>
</tr>
<tr class="odd">
<td>10.7</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.5</td>
<td>7.2</td>
</tr>
<tr class="odd">
<td>10.8</td>
<td>7.8</td>
</tr>
<tr class="even">
<td>11.2</td>
<td>7.7</td>
</tr>
<tr class="odd">
<td>10.6</td>
<td>7.8</td>
</tr>
<tr class="even">
<td>11.4</td>
<td>8.3</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/Corr1.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-38"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/Corr1.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; Correlate &gt; Bivariate …</strong></em></p>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/Corr2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-39"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/Corr2.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/Corr3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-40"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/Corr3.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/Corr4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-41"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/Corr4.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
</section>
<section id="partial-correlation-analysis" class="level2">
<h2 class="anchored" data-anchor-id="partial-correlation-analysis">Partial Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Quantitative Variables while holding/keeping all other constants</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cleft(X_%7B1%7D,X_%7B2%7D%5Cright)%7CX_%7B3%7D"></li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-8" class="level3">
<h3 class="anchored" data-anchor-id="example-8">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Leaf Area (cm^2)</th>
<th>Leaf Moisture (%)</th>
<th>Total Shoot Length (cm)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>72</td>
<td>80</td>
<td>307</td>
</tr>
<tr class="even">
<td>174</td>
<td>75</td>
<td>529</td>
</tr>
<tr class="odd">
<td>116</td>
<td>81</td>
<td>632</td>
</tr>
<tr class="even">
<td>78</td>
<td>83</td>
<td>527</td>
</tr>
<tr class="odd">
<td>134</td>
<td>79</td>
<td>442</td>
</tr>
<tr class="even">
<td>95</td>
<td>81</td>
<td>525</td>
</tr>
<tr class="odd">
<td>113</td>
<td>80</td>
<td>481</td>
</tr>
<tr class="even">
<td>98</td>
<td>81</td>
<td>710</td>
</tr>
<tr class="odd">
<td>148</td>
<td>74</td>
<td>422</td>
</tr>
<tr class="even">
<td>42</td>
<td>78</td>
<td>345</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/PartCorr1.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-42"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/PartCorr1.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
<p><em><strong>Analyze &gt; Correlate &gt; Partial …</strong></em></p>
<p>&nbsp;</p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/PartCorr2.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-43"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/PartCorr2.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/PartCorr3.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-44"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/PartCorr3.webp" class="img-fluid"></a></p>
<p><a href="../../assets/img/blogs/2018-05-15-PASTIC-FSD/fig/PartCorr4.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-45"><img src="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/PartCorr4.webp" class="img-fluid"></a></p>
<p>&nbsp;</p>
</section>
</section>
<section id="multiple-correlation-analysis" class="level2">
<h2 class="anchored" data-anchor-id="multiple-correlation-analysis">Multiple Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between a Quantitative Variable and set of other Quantitative Variables</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cleft(X_%7B1%7D,%5Cleft%5BX_%7B2%7D,X_%7B3%7D%5Cright%5D%5Cright)"></li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-9" class="level3">
<h3 class="anchored" data-anchor-id="example-9">Example</h3>
<table class="caption-top table">
<thead>
<tr class="header">
<th>Leaf Area (cm^2)</th>
<th>Leaf Moisture (%)</th>
<th>Total Shoot Length (cm)</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td>72</td>
<td>80</td>
<td>307</td>
</tr>
<tr class="even">
<td>174</td>
<td>75</td>
<td>529</td>
</tr>
<tr class="odd">
<td>116</td>
<td>81</td>
<td>632</td>
</tr>
<tr class="even">
<td>78</td>
<td>83</td>
<td>527</td>
</tr>
<tr class="odd">
<td>134</td>
<td>79</td>
<td>442</td>
</tr>
<tr class="even">
<td>95</td>
<td>81</td>
<td>525</td>
</tr>
<tr class="odd">
<td>113</td>
<td>80</td>
<td>481</td>
</tr>
<tr class="even">
<td>98</td>
<td>81</td>
<td>710</td>
</tr>
<tr class="odd">
<td>148</td>
<td>74</td>
<td>422</td>
</tr>
<tr class="even">
<td>42</td>
<td>78</td>
<td>345</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</section>
</section>
<section id="completely-randomized-design-crd" class="level2">
<h2 class="anchored" data-anchor-id="completely-randomized-design-crd">Completely Randomized Design (CRD)</h2>
<blockquote class="blockquote">
<ul>
<li>Used when experimental material is homogeneous</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-10" class="level3">
<h3 class="anchored" data-anchor-id="example-10">Example</h3>
<blockquote class="blockquote">
<p>The following table shows some of the results of an experiment on the effects of applications of sulphur in reducing scab disease of potatoes. The object in applying sulphur is to increase the acidity of the soil, since scab does not thrive in very acid soil. In addition to untreated plots which serve as a control, 3 amounts of dressing were compared—300, 600, and 900 lb. per acre. Both a fall and a spring application of each amount was tested, so that in all there were seven distinct treatments. The sulphur was spread by hand on the surface of the soil, and then diced into a depth of about 4 inches. The quantity to be analyzed is the “scab index”. That is roughly speaking, the percentage of the surface area of the potato that is infected with scab. It is obtained by examining 100 potatoes at random from each plot, grading each potato on a scale from 0 to 100% infected, and taking the average.</p>
</blockquote>
<p>&nbsp;</p>
</section>
</section>
<section id="randomized-complete-block-design-rcbd" class="level2">
<h2 class="anchored" data-anchor-id="randomized-complete-block-design-rcbd">Randomized Complete Block Design (RCBD)</h2>
<blockquote class="blockquote">
<ul>
<li>Used when experimental material is heterogenous in one direction</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-11" class="level3">
<h3 class="anchored" data-anchor-id="example-11">Example</h3>
<blockquote class="blockquote">
<p>Yield : Yield of barley, SoilType : Soil Type, and Trt : 5 sources and a control</p>
</blockquote>
<p>&nbsp;</p>
</section>
</section>
<section id="latin-square-design" class="level2">
<h2 class="anchored" data-anchor-id="latin-square-design">Latin Square Design</h2>
<blockquote class="blockquote">
<ul>
<li>Used when experimental material is heterogenous in two perpendicular directions</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-12" class="level3">
<h3 class="anchored" data-anchor-id="example-12">Example</h3>
<blockquote class="blockquote">
<p>The following table shows the field layout and yield of a 5×5 Latin square experiment on the effect of spacing on yield of millet plants. Five levels of spacing were used. The data on yield (grams/plot) was recorded and is given below:</p>
</blockquote>


</section>
</section>

<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2018,
  author = {Yaseen, Muhammad},
  title = {Emerging {Technologies} in {Research:} {Google} {Apps} and
    {SPSS}},
  date = {2018-05-15},
  url = {https://myaseen208.com/blogs/2018-05-15-PASTIC-FSD/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2018" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2018. <span>“Emerging Technologies in Research: Google
Apps and SPSS.”</span> May 15. <a href="https://myaseen208.com/blogs/2018-05-15-PASTIC-FSD/">https://myaseen208.com/blogs/2018-05-15-PASTIC-FSD/</a>.
</div></div></section></div> ]]></description>
  <category>Data Science</category>
  <category>Statistics</category>
  <category>Research</category>
  <category>Google Apps</category>
  <category>SPSS</category>
  <guid>https://myaseen208.com/blogs/2018-05-15-PASTIC-FSD/</guid>
  <pubDate>Tue, 15 May 2018 04:00:00 GMT</pubDate>
  <media:content url="https://myaseen208.com/assets/img/blogs/2018-05-15-PASTIC-FSD/fig/2018-05-15_PASTIC-FSD_SPSS.webp" medium="image" type="image/webp"/>
</item>
<item>
  <title>Spatial Analysis of Pakistan Population Census 2017</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2018-05-13_ppcSpatial/</link>
  <description><![CDATA[ 




<p>The latest version of the ppcSpatial package for R is now on <a href="https://cran.r-project.org/package=ppcSpatial">CRAN</a>. It performs spatial analysis for exploration of Pakistan Population Census 2017 (<a href="http://www.pbscensus.gov.pk/" class="uri">http://www.pbscensus.gov.pk/</a>). It uses data from R package <a href="https://cran.r-project.org/package=PakPC2017">PakPC2017</a>.</p>
<p>&nbsp;</p>
<p>The Spatial map is <iframe src="../../PakPopCensus2017/PakPopCensus2017Districts.html" width="600" height="500" frameborder="0" style="border:0" allowfullscreen=""></iframe></p>
<p>and full view is <a href="../../PakPopCensus2017/PakPopCensus2017Districts.html">here</a>.</p>
<p>&nbsp;</p>
<p>A video showing some functionality of the package is</p>
<div class="quarto-figure quarto-figure-left">
<figure class="figure">
<p><img src="https://myaseen208.com/assets/img/software/ppcSpatial/ppcSpatial.webp" class="img-fluid figure-img"></p>
<figcaption>ppcSpatial package video thumbnail</figcaption>
</figure>
</div>



<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2018,
  author = {Yaseen, Muhammad},
  title = {Spatial {Analysis} of {Pakistan} {Population} {Census} 2017},
  date = {2018-05-13},
  url = {https://myaseen208.com/blogs/2018-05-13_ppcSpatial/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2018" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2018. <span>“Spatial Analysis of Pakistan Population
Census 2017.”</span> May 13. <a href="https://myaseen208.com/blogs/2018-05-13_ppcSpatial/">https://myaseen208.com/blogs/2018-05-13_ppcSpatial/</a>.
</div></div></section></div> ]]></description>
  <category>R</category>
  <category>ppcSpatial</category>
  <category>Pakistan Population Census 2017</category>
  <guid>https://myaseen208.com/blogs/2018-05-13_ppcSpatial/</guid>
  <pubDate>Sun, 13 May 2018 04:00:00 GMT</pubDate>
</item>
<item>
  <title>An introduction to R for Agricultural Research</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2018-05-09_ARRI/</link>
  <description><![CDATA[ <section id="introduction" class="level2"><h2 class="anchored" data-anchor-id="introduction">Introduction</h2>
<blockquote class="blockquote">
<p><strong>R</strong> is a free, open-source programming language and software environment for statistical computing, bioinformatics, visualization and general computing. <strong>R</strong> provides a wide variety of statistical and graphical techniques, and is highly extensible. The latest version of <strong>R</strong> is 3.5.0 which can be obtained from <a href="https://cran.r-project.org/bin/windows/base/">https://cran.r-project.org/bin/windows/base/</a>.</p>
</blockquote>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://cran.r-project.org/bin/windows/base/" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;R</a> <a href="https://cran.r-project.org/bin/windows/base/">R-3.5.0 for Windows (32/64 bit)</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://www.rstudio.com/products/rstudio/download/" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;RStudio</a> <a href="https://www.rstudio.com/products/rstudio/download/">RStudio</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;Manual</a> <a href="https://cran.r-project.org/doc/manuals/r-release/R-intro.pdf">An Introduction to R</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://cran.r-project.org/doc/contrib/Short-refcard.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;Ref Card</a> <a href="https://cran.r-project.org/doc/contrib/Short-refcard.pdf">R Reference Card</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://github.com/myaseen208/R-Workshop/raw/master/2009NewYorkTimes.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;New York Times</a> <a href="https://github.com/myaseen208/R-Workshop/raw/master/2009NewYorkTimes.pdf">New York Times</a> &nbsp;
</h4>
<p>&nbsp;</p>
<h4 class="anchored">
<a href="https://github.com/myaseen208/R-Workshop/raw/master/2015NatureArticle.pdf" class="badge badge-small"><i class="fa fa-file-pdf-o"></i>&nbsp;&nbsp;Nature Article</a> <a href="https://github.com/myaseen208/R-Workshop/raw/master/2015NatureArticle.pdf">Nature Article</a> &nbsp;
</h4>
<p>&nbsp;</p>
</section><section id="regression-analysis" class="level2"><h2 class="anchored" data-anchor-id="regression-analysis">Regression Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on quantitative explanatory variable(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<div id="fig-PopRegFn" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-PopRegFn-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2018-05-09_ARRI/fig/PopRegFn.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-1" title="Figure&nbsp;1: "><img src="https://myaseen208.com/assets/img/blogs/2018-05-09_ARRI/fig/PopRegFn.webp" class="img-fluid figure-img"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig quarto-uncaptioned" id="fig-PopRegFn-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;1
</figcaption></figure>
</div>
<p>&nbsp;</p>
</section><section id="simple-linear-regression" class="level2"><h2 class="anchored" data-anchor-id="simple-linear-regression">Simple Linear Regression</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on a quantitative explanatory variable</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example" class="level3"><h3 class="anchored" data-anchor-id="example">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Fertilizer (Kg/acre)</th>
<th>Production (Bushels/acre)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>100</td>
<td>70</td>
</tr>
<tr class="even">
<td>200</td>
<td>70</td>
</tr>
<tr class="odd">
<td>400</td>
<td>80</td>
</tr>
<tr class="even">
<td>500</td>
<td>100</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Fertilizer (Kg/acre)</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Production (Bushels/acre)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">200</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">400</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">500</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Production</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Production</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Fertilizer Production
1        100         70
2        200         70
3        400         80
4        500        100</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb3" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Production</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fertilizer"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Production"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p1-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-2"><img src="https://myaseen208.com/blogs/2018-05-09_ARRI/index_files/figure-html/reg.p1-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Production</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Production ~ Fertilizer, data = df1)

Residuals:
 1  2  3  4 
 4 -3 -7  6 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)  
(Intercept) 59.00000    7.95299   7.419   0.0177 *
Fertilizer   0.07000    0.02345   2.985   0.0963 .
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 7.416 on 2 degrees of freedom
Multiple R-squared:  0.8167,    Adjusted R-squared:  0.725 
F-statistic: 8.909 on 1 and 2 DF,  p-value: 0.0963</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Production
           Df Sum Sq Mean Sq F value Pr(&gt;F)  
Fertilizer  1    490     490  8.9091 0.0963 .
Residuals   2    110      55                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section><section id="example-1" class="level3"><h3 class="anchored" data-anchor-id="example-1">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Fertilizer</th>
<th>Yield</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>0.3</td>
<td>10</td>
</tr>
<tr class="even">
<td>0.6</td>
<td>15</td>
</tr>
<tr class="odd">
<td>0.9</td>
<td>30</td>
</tr>
<tr class="even">
<td>1.2</td>
<td>35</td>
</tr>
<tr class="odd">
<td>1.5</td>
<td>25</td>
</tr>
<tr class="even">
<td>1.8</td>
<td>30</td>
</tr>
<tr class="odd">
<td>2.1</td>
<td>50</td>
</tr>
<tr class="even">
<td>2.4</td>
<td>45</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb8" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.3</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.6</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.9</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">35</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">45</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df2</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df2</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Fert Yield
1  0.3    10
2  0.6    15
3  0.9    30
4  1.2    35
5  1.5    25
6  1.8    30
7  2.1    50
8  2.4    45</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb10" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df2</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fertilizer"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p2-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-3"><img src="https://myaseen208.com/blogs/2018-05-09_ARRI/index_files/figure-html/reg.p2-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb11" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm2</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fert, data = df2)

Residuals:
   Min     1Q Median     3Q    Max 
-7.441 -4.018 -2.441  7.351  7.798 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)   
(Intercept)    8.036      5.504   1.460   0.1946   
Fert          16.270      3.633   4.478   0.0042 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 7.064 on 6 degrees of freedom
Multiple R-squared:  0.7697,    Adjusted R-squared:  0.7313 
F-statistic: 20.05 on 1 and 6 DF,  p-value: 0.004202</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb13" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value   Pr(&gt;F)   
Fert       1 1000.6  1000.6  20.052 0.004202 **
Residuals  6  299.4    49.9                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section><section id="example-2" class="level3"><h3 class="anchored" data-anchor-id="example-2">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Weekly Income ($)</th>
<th>Weekly Expenditures ($)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>80</td>
<td>70</td>
</tr>
<tr class="even">
<td>100</td>
<td>65</td>
</tr>
<tr class="odd">
<td>120</td>
<td>90</td>
</tr>
<tr class="even">
<td>140</td>
<td>95</td>
</tr>
<tr class="odd">
<td>160</td>
<td>110</td>
</tr>
<tr class="even">
<td>180</td>
<td>115</td>
</tr>
<tr class="odd">
<td>200</td>
<td>120</td>
</tr>
<tr class="even">
<td>220</td>
<td>140</td>
</tr>
<tr class="odd">
<td>240</td>
<td>155</td>
</tr>
<tr class="even">
<td>260</td>
<td>150</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb15" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Weekly Income ($) of a Family</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Weekly Expenditures ($) of a Family</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Income</span>       <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/seq.html">seq</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>from <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, to <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">260</span>, by <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Expenditures</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">65</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">90</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">95</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">110</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">115</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">120</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">140</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">155</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">150</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Income</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Expenditures</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Income Expenditures
1      80           70
2     100           65
3     120           90
4     140           95
5     160          110
6     180          115
7     200          120
8     220          140
9     240          155
10    260          150</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb17" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p3</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Income</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Expenditures</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_x_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/dollar_format.html">dollar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/dollar_format.html">dollar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Weekly income, $"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Weekly consumption expenditures, $"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p3-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-4"><img src="https://myaseen208.com/blogs/2018-05-09_ARRI/index_files/figure-html/reg.p3-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb18" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm3</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Expenditures</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Income</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Expenditures ~ Income, data = df3)

Residuals:
    Min      1Q  Median      3Q     Max 
-10.364  -4.977   1.409   4.364   8.364 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept) 24.45455    6.41382   3.813  0.00514 ** 
Income       0.50909    0.03574  14.243 5.75e-07 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 6.493 on 8 degrees of freedom
Multiple R-squared:  0.9621,    Adjusted R-squared:  0.9573 
F-statistic: 202.9 on 1 and 8 DF,  p-value: 5.753e-07</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb20" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Expenditures
          Df Sum Sq Mean Sq F value    Pr(&gt;F)    
Income     1 8552.7  8552.7  202.87 5.753e-07 ***
Residuals  8  337.3    42.2                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="multiple-linear-regression" class="level2"><h2 class="anchored" data-anchor-id="multiple-linear-regression">Multiple Linear Regression</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on two or more quantitative explanatory variables</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-3" class="level3"><h3 class="anchored" data-anchor-id="example-3">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Fertilizer (Kg)</th>
<th>Rainfall (mm)</th>
<th>Yield (Kg)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>100</td>
<td>10</td>
<td>40</td>
</tr>
<tr class="even">
<td>200</td>
<td>20</td>
<td>50</td>
</tr>
<tr class="odd">
<td>300</td>
<td>10</td>
<td>50</td>
</tr>
<tr class="even">
<td>400</td>
<td>30</td>
<td>70</td>
</tr>
<tr class="odd">
<td>500</td>
<td>20</td>
<td>65</td>
</tr>
<tr class="even">
<td>600</td>
<td>20</td>
<td>65</td>
</tr>
<tr class="odd">
<td>700</td>
<td>30</td>
<td>80</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb22" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Fertilizer (Kg)</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Rainfall (mm)</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Yield (Kg)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/seq.html">seq</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>from <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span>, to <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">700</span>, by <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rainfall</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">40</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">50</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">70</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">65</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">65</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rainfall</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Fertilizer Rainfall Yield
1        100       10    40
2        200       20    50
3        300       10    50
4        400       30    70
5        500       20    65
6        600       20    65
7        700       30    80</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb24" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rainfall</span>, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>alpha <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.8</span>, size <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_viridis.html">scale_color_viridis_c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_minimal</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p4-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-5"><img src="https://myaseen208.com/blogs/2018-05-09_ARRI/index_files/figure-html/reg.p4-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb25" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm4</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fertilizer</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Rainfall</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fertilizer + Rainfall, data = df4)

Residuals:
      1       2       3       4       5       6       7 
-0.2381 -2.3810  2.1429  1.6667  1.1905 -2.6190  0.2381 

Coefficients:
             Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept) 28.095238   2.491482  11.277 0.000352 ***
Fertilizer   0.038095   0.005832   6.532 0.002838 ** 
Rainfall     0.833333   0.154303   5.401 0.005690 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.315 on 4 degrees of freedom
Multiple R-squared:  0.9814,    Adjusted R-squared:  0.972 
F-statistic: 105.3 on 2 and 4 DF,  p-value: 0.0003472</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb27" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
           Df Sum Sq Mean Sq F value    Pr(&gt;F)    
Fertilizer  1 972.32  972.32 181.500 0.0001756 ***
Rainfall    1 156.25  156.25  29.167 0.0056899 ** 
Residuals   4  21.43    5.36                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb29" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">lm.beta</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/lm.beta/man/lm.beta.html">lm.beta</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fertilizer + Rainfall, data = df4)

Standardized Coefficients::
(Intercept)  Fertilizer    Rainfall 
         NA   0.5944301   0.4914732 </code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="polynomial-regression-analysis" class="level2"><h2 class="anchored" data-anchor-id="polynomial-regression-analysis">Polynomial Regression Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying non-linear dependency of a normal response on quantitative explanatory variable(s)</li>
</ul>
</blockquote>
<section id="example-4" class="level3"><h3 class="anchored" data-anchor-id="example-4">Example</h3>
<blockquote class="blockquote">
<p>An experiment was conducted to evaluate the effects of different levels of nitrogen. Three levels of nitrogen: 0, 10 and 20 grams per plot were used in the experiment. Each treatment was replicated twice and data is given below:</p>
</blockquote>
<table class="caption-top table">
<thead><tr class="header">
<th>Nitrogen</th>
<th>Yield</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>0</td>
<td>5</td>
</tr>
<tr class="even">
<td>0</td>
<td>7</td>
</tr>
<tr class="odd">
<td>10</td>
<td>15</td>
</tr>
<tr class="even">
<td>10</td>
<td>17</td>
</tr>
<tr class="odd">
<td>20</td>
<td>9</td>
</tr>
<tr class="even">
<td>20</td>
<td>11</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb31" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">20</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">11</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Nitrogen Yield
1        0     5
2        0     7
3       10    15
4       10    17
5       20     9
6       20    11</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb33" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Nitrogen"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/reg.p5-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-6"><img src="https://myaseen208.com/blogs/2018-05-09_ARRI/index_files/figure-html/reg.p5-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb34" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm5</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/AsIs.html">I</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Nitrogen</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">^</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># fm5 &lt;- lm(formula = Yield ~ poly(x = Nitrogen, degree = 2, raw = TRUE), data = df5)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Nitrogen + I(Nitrogen^2), data = df5)

Residuals:
 1  2  3  4  5  6 
-1  1 -1  1 -1  1 

Coefficients:
              Estimate Std. Error t value Pr(&gt;|t|)   
(Intercept)    6.00000    1.00000   6.000  0.00927 **
Nitrogen       1.80000    0.25495   7.060  0.00584 **
I(Nitrogen^2) -0.08000    0.01225  -6.532  0.00729 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.414 on 3 degrees of freedom
Multiple R-squared:  0.9441,    Adjusted R-squared:  0.9068 
F-statistic: 25.33 on 2 and 3 DF,  p-value: 0.01322</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb36" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
              Df Sum Sq Mean Sq F value   Pr(&gt;F)   
Nitrogen       1 16.000  16.000   8.000 0.066276 . 
I(Nitrogen^2)  1 85.333  85.333  42.667 0.007292 **
Residuals      3  6.000   2.000                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="analysis-of-variance-anova" class="level2"><h2 class="anchored" data-anchor-id="analysis-of-variance-anova">Analysis of Variance (ANOVA)</h2>
<blockquote class="blockquote">
<ul>
<li>Comparing means of Normal dependent variable for levels of different factor(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<div id="fig-ANOVANormalMeans" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-ANOVANormalMeans-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2018-05-09_ARRI/fig/ANOVANormalMeans.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-7" title="Figure&nbsp;2: "><img src="https://myaseen208.com/assets/img/blogs/2018-05-09_ARRI/fig/ANOVANormalMeans.webp" class="img-fluid figure-img"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig quarto-uncaptioned" id="fig-ANOVANormalMeans-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;2
</figcaption></figure>
</div>
<p>&nbsp;</p>
<section id="example-5" class="level3"><h3 class="anchored" data-anchor-id="example-5">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Yield</th>
<th>Variety</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>5</td>
<td>V1</td>
</tr>
<tr class="even">
<td>6</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>7</td>
<td>V1</td>
</tr>
<tr class="even">
<td>15</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>16</td>
<td>V2</td>
</tr>
<tr class="even">
<td>17</td>
<td>V2</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb38" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V1"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V2"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span>     <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Yield Variety
1     5      V1
2     6      V1
3     7      V1
4    15      V2
5    16      V2
6    17      V2</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb40" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p6</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Variety"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p6</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/anova.p6-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-8"><img src="https://myaseen208.com/blogs/2018-05-09_ARRI/index_files/figure-html/anova.p6-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb41" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm6</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df6</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm6</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Variety, data = df6)

Residuals:
         1          2          3          4          5          6 
-1.000e+00 -4.774e-15  1.000e+00 -1.000e+00 -1.110e-16  1.000e+00 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)   6.0000     0.5774   10.39 0.000484 ***
VarietyV2    10.0000     0.8165   12.25 0.000255 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1 on 4 degrees of freedom
Multiple R-squared:  0.974, Adjusted R-squared:  0.9675 
F-statistic:   150 on 1 and 4 DF,  p-value: 0.0002552</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb43" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm6</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value    Pr(&gt;F)    
Variety    1    150     150     150 0.0002552 ***
Residuals  4      4       1                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section><section id="example-6" class="level3"><h3 class="anchored" data-anchor-id="example-6">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Yield</th>
<th>Variety</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>5</td>
<td>V1</td>
</tr>
<tr class="even">
<td>7</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>15</td>
<td>V2</td>
</tr>
<tr class="even">
<td>17</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>17</td>
<td>V3</td>
</tr>
<tr class="even">
<td>19</td>
<td>V3</td>
</tr>
</tbody>
</table>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb45" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">15</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">19</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V1"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V2"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V3"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span>     <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  Yield Variety
1     5      V1
2     7      V1
3    15      V2
4    17      V2
5    17      V3
6    19      V3</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb47" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p7</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Variety"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p7</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/anova.p7-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-9"><img src="https://myaseen208.com/blogs/2018-05-09_ARRI/index_files/figure-html/anova.p7-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb48" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm7</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df7</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm7</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Variety, data = df7)

Residuals:
 1  2  3  4  5  6 
-1  1 -1  1 -1  1 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)   
(Intercept)    6.000      1.000   6.000  0.00927 **
VarietyV2     10.000      1.414   7.071  0.00582 **
VarietyV3     12.000      1.414   8.485  0.00344 **
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 1.414 on 3 degrees of freedom
Multiple R-squared:  0.965, Adjusted R-squared:  0.9416 
F-statistic: 41.33 on 2 and 3 DF,  p-value: 0.006553</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb50" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm7</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value   Pr(&gt;F)   
Variety    2 165.33  82.667  41.333 0.006553 **
Residuals  3   6.00   2.000                    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="analysis-of-covariance-ancova" class="level2"><h2 class="anchored" data-anchor-id="analysis-of-covariance-ancova">Analysis of Covariance (ANCOVA)</h2>
<blockquote class="blockquote">
<ul>
<li>Quantifying dependency of a normal response on quantitative explanatory variable(s)</li>
<li>Comparing means of Normal dependent variable for levels of different factor(s)</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<div id="fig-ANCOVA" class="quarto-float quarto-figure quarto-figure-left anchored">
<figure class="quarto-float quarto-float-fig figure"><div aria-describedby="fig-ANCOVA-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
<a href="../../assets/img/blogs/2018-05-09_ARRI/fig/ANCOVA.webp" class="lightbox" data-gallery="quarto-lightbox-gallery-10" title="Figure&nbsp;3: "><img src="https://myaseen208.com/assets/img/blogs/2018-05-09_ARRI/fig/ANCOVA.webp" class="img-fluid figure-img"></a>
</div>
<figcaption class="quarto-float-caption-bottom quarto-float-caption quarto-float-fig quarto-uncaptioned" id="fig-ANCOVA-caption-0ceaefa1-69ba-4598-a22c-09a6ac19f8ca">
Figure&nbsp;3
</figcaption></figure>
</div>
<p>&nbsp;</p>
<section id="example-7" class="level3"><h3 class="anchored" data-anchor-id="example-7">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Yield</th>
<th>Fert</th>
<th>Variety</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>51</td>
<td>80</td>
<td>V1</td>
</tr>
<tr class="even">
<td>52</td>
<td>80</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>53</td>
<td>90</td>
<td>V1</td>
</tr>
<tr class="even">
<td>54</td>
<td>90</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>56</td>
<td>100</td>
<td>V1</td>
</tr>
<tr class="even">
<td>57</td>
<td>100</td>
<td>V1</td>
</tr>
<tr class="odd">
<td>55</td>
<td>80</td>
<td>V2</td>
</tr>
<tr class="even">
<td>56</td>
<td>80</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>58</td>
<td>90</td>
<td>V2</td>
</tr>
<tr class="even">
<td>59</td>
<td>90</td>
<td>V2</td>
</tr>
<tr class="odd">
<td>62</td>
<td>100</td>
<td>V2</td>
</tr>
<tr class="even">
<td>63</td>
<td>100</td>
<td>V2</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb52" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">51</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">52</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">53</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">54</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">56</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">57</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">55</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">56</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">58</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">59</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">62</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">63</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>     <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">90</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">100</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, each <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V1"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"V2"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, ordered <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span>         <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Yield Fert Variety
1     51   80      V1
2     52   80      V1
3     53   90      V1
4     54   90      V1
5     56  100      V1
6     57  100      V1
7     55   80      V2
8     56   80      V2
9     58   90      V2
10    59   90      V2
11    62  100      V2
12    63  100      V2</code></pre>
</div>
</div>
</section><section id="same-intercepts-but-different-slopes" class="level3"><h3 class="anchored" data-anchor-id="same-intercepts-but-different-slopes">Same intercepts but different slopes</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb54" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm8</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fert + Variety, data = df8)

Residuals:
    Min      1Q  Median      3Q     Max 
-0.8333 -0.8333  0.1667  0.1667  1.1667 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept) 26.83333    2.54557   10.54 2.30e-06 ***
Fert         0.30000    0.02805   10.69 2.04e-06 ***
VarietyV2    5.00000    0.45812   10.91 1.72e-06 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.7935 on 9 degrees of freedom
Multiple R-squared:  0.9629,    Adjusted R-squared:  0.9546 
F-statistic: 116.7 on 2 and 9 DF,  p-value: 3.657e-07</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb56" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value    Pr(&gt;F)    
Fert       1 72.000   72.00  114.35 2.042e-06 ***
Variety    1 75.000   75.00  119.12 1.720e-06 ***
Residuals  9  5.667    0.63                      
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb58" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p8</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_path.html">geom_line</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/predict.html">predict</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fert"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/ancova.p8-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-11"><img src="https://myaseen208.com/blogs/2018-05-09_ARRI/index_files/figure-html/ancova.p8-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<p>&nbsp;</p>
</section><section id="different-intercepts-and-different-slopes" class="level3"><h3 class="anchored" data-anchor-id="different-intercepts-and-different-slopes">Different intercepts and different slopes</h3>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb59" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm9</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Fert * Variety, data = df8)

Residuals:
     Min       1Q   Median       3Q      Max 
-0.83333 -0.33333 -0.08333  0.66667  0.66667 

Coefficients:
               Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)    31.33333    3.05903  10.243 7.09e-06 ***
Fert            0.25000    0.03385   7.385 7.73e-05 ***
VarietyV2      -4.00000    4.32612  -0.925   0.3822    
Fert:VarietyV2  0.10000    0.04787   2.089   0.0701 .  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.677 on 8 degrees of freedom
Multiple R-squared:  0.976, Adjusted R-squared:  0.967 
F-statistic: 108.4 on 3 and 8 DF,  p-value: 8.11e-07</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb61" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
             Df Sum Sq Mean Sq  F value    Pr(&gt;F)    
Fert          1 72.000  72.000 157.0909 1.538e-06 ***
Variety       1 75.000  75.000 163.6364 1.315e-06 ***
Fert:Variety  1  2.000   2.000   4.3636   0.07013 .  
Residuals     8  3.667   0.458                       
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb63" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p9</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df8</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Fert</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Variety</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_path.html">geom_line</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/predict.html">predict</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Fert"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/ancova.p9-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-12"><img src="https://myaseen208.com/blogs/2018-05-09_ARRI/index_files/figure-html/ancova.p9-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section></section><section id="correlation-analysis" class="level2"><h2 class="anchored" data-anchor-id="correlation-analysis">Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Quantitative Variables</li>
</ul>
</blockquote>
<p>&nbsp;</p>
</section><section id="simple-correlation-analysis" class="level2"><h2 class="anchored" data-anchor-id="simple-correlation-analysis">Simple Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Two Quantitative Variables</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cleft(X_%7B1%7D,X_%7B2%7D%5Cright)"></li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-8" class="level3"><h3 class="anchored" data-anchor-id="example-8">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Sparrow Wing length (cm)</th>
<th>Sparrow Tail length (cm)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>10.4</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.8</td>
<td>7.6</td>
</tr>
<tr class="odd">
<td>11.1</td>
<td>7.9</td>
</tr>
<tr class="even">
<td>10.2</td>
<td>7.2</td>
</tr>
<tr class="odd">
<td>10.3</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.2</td>
<td>7.1</td>
</tr>
<tr class="odd">
<td>10.7</td>
<td>7.4</td>
</tr>
<tr class="even">
<td>10.5</td>
<td>7.2</td>
</tr>
<tr class="odd">
<td>10.8</td>
<td>7.8</td>
</tr>
<tr class="even">
<td>11.2</td>
<td>7.7</td>
</tr>
<tr class="odd">
<td>10.6</td>
<td>7.8</td>
</tr>
<tr class="even">
<td>11.4</td>
<td>8.3</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb64" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">11.1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.3</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.5</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">11.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10.6</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">11.4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.6</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.9</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.1</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.2</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.7</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7.8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">8.3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   WingLength TailLength
1        10.4        7.4
2        10.8        7.6
3        11.1        7.9
4        10.2        7.2
5        10.3        7.4
6        10.2        7.1
7        10.7        7.4
8        10.5        7.2
9        10.8        7.8
10       11.2        7.7
11       10.6        7.8
12       11.4        8.3</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb66" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p10</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Sparrow Wing Length (cm)"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Sparrow Tail Length (cm)"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/corr.p10-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-13"><img src="https://myaseen208.com/blogs/2018-05-09_ARRI/index_files/figure-html/corr.p10-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb67" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/cor.html">cor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 0.8703546</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb69" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/cor.test.html">cor.test</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">WingLength</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TailLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
    Pearson's product-moment correlation

data:  df10$WingLength and df10$TailLength
t = 5.5893, df = 10, p-value = 0.0002311
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 0.5923111 0.9631599
sample estimates:
      cor 
0.8703546 </code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="partial-correlation-analysis" class="level2"><h2 class="anchored" data-anchor-id="partial-correlation-analysis">Partial Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between Quantitative Variables while holding/keeping all other constants</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cleft(X_%7B1%7D,X_%7B2%7D%5Cright)%7CX_%7B3%7D"></li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-9" class="level3"><h3 class="anchored" data-anchor-id="example-9">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Leaf Area (cm^2)</th>
<th>Leaf Moisture (%)</th>
<th>Total Shoot Length (cm)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>72</td>
<td>80</td>
<td>307</td>
</tr>
<tr class="even">
<td>174</td>
<td>75</td>
<td>529</td>
</tr>
<tr class="odd">
<td>116</td>
<td>81</td>
<td>632</td>
</tr>
<tr class="even">
<td>78</td>
<td>83</td>
<td>527</td>
</tr>
<tr class="odd">
<td>134</td>
<td>79</td>
<td>442</td>
</tr>
<tr class="even">
<td>95</td>
<td>81</td>
<td>525</td>
</tr>
<tr class="odd">
<td>113</td>
<td>80</td>
<td>481</td>
</tr>
<tr class="even">
<td>98</td>
<td>81</td>
<td>710</td>
</tr>
<tr class="odd">
<td>148</td>
<td>74</td>
<td>422</td>
</tr>
<tr class="even">
<td>42</td>
<td>78</td>
<td>345</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb71" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafArea</span>    <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">72</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">174</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">116</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">78</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">134</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">95</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">113</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">98</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">148</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">42</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafMoist</span>   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">75</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">81</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">83</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">79</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">81</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">80</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">81</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">74</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">78</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">58</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TotShLength</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">307</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">529</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">632</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">527</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">442</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">525</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">481</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">710</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">422</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">345</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df11</span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafArea</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafMoist</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TotShLength</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df11</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   LeafArea LeafMoist TotShLength
1        72        75         307
2       174        81         529
3       116        83         632
4        78        79         527
5       134        81         442
6        95        80         525
7       113        81         481
8        98        74         710
9       148        78         422
10       42        58         345</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb73" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ppcor</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/ppcor/man/pcor.html">pcor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df11</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$estimate
                LeafArea LeafMoist  TotShLength
LeafArea     1.000000000 0.6509096 -0.007012236
LeafMoist    0.650909618 1.0000000  0.324334659
TotShLength -0.007012236 0.3243347  1.000000000

$p.value
              LeafArea  LeafMoist TotShLength
LeafArea    0.00000000 0.05760462   0.9857154
LeafMoist   0.05760462 0.00000000   0.3944839
TotShLength 0.98571537 0.39448385   0.0000000

$statistic
               LeafArea LeafMoist TotShLength
LeafArea     0.00000000  2.268502 -0.01855309
LeafMoist    2.26850175  0.000000  0.90714704
TotShLength -0.01855309  0.907147  0.00000000

$n
[1] 10

$gp
[1] 1

$method
[1] "pearson"</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="multiple-correlation-analysis" class="level2"><h2 class="anchored" data-anchor-id="multiple-correlation-analysis">Multiple Correlation Analysis</h2>
<blockquote class="blockquote">
<ul>
<li>Linear Relationship between a Quantitative Variable and set of other Quantitative Variables</li>
<li><img src="https://latex.codecogs.com/png.latex?%5Cleft(X_%7B1%7D,%5Cleft%5BX_%7B2%7D,X_%7B3%7D%5Cright%5D%5Cright)"></li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-10" class="level3"><h3 class="anchored" data-anchor-id="example-10">Example</h3>
<table class="caption-top table">
<thead><tr class="header">
<th>Leaf Area (cm^2)</th>
<th>Leaf Moisture (%)</th>
<th>Total Shoot Length (cm)</th>
</tr></thead>
<tbody>
<tr class="odd">
<td>72</td>
<td>80</td>
<td>307</td>
</tr>
<tr class="even">
<td>174</td>
<td>75</td>
<td>529</td>
</tr>
<tr class="odd">
<td>116</td>
<td>81</td>
<td>632</td>
</tr>
<tr class="even">
<td>78</td>
<td>83</td>
<td>527</td>
</tr>
<tr class="odd">
<td>134</td>
<td>79</td>
<td>442</td>
</tr>
<tr class="even">
<td>95</td>
<td>81</td>
<td>525</td>
</tr>
<tr class="odd">
<td>113</td>
<td>80</td>
<td>481</td>
</tr>
<tr class="even">
<td>98</td>
<td>81</td>
<td>710</td>
</tr>
<tr class="odd">
<td>148</td>
<td>74</td>
<td>422</td>
</tr>
<tr class="even">
<td>42</td>
<td>78</td>
<td>345</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb75" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm12</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">TotShLength</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafArea</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">LeafMoist</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df11</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/MathFun.html">sqrt</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm12</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">r.squared</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 0.421277</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="completely-randomized-design-crd" class="level2"><h2 class="anchored" data-anchor-id="completely-randomized-design-crd">Completely Randomized Design (CRD)</h2>
<blockquote class="blockquote">
<ul>
<li>Used when experimental material is homogeneous</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-11" class="level3"><h3 class="anchored" data-anchor-id="example-11">Example</h3>
<blockquote class="blockquote">
<p>The following table shows some of the results of an experiment on the effects of applications of sulphur in reducing scab disease of potatoes. The object in applying sulphur is to increase the acidity of the soil, since scab does not thrive in very acid soil. In addition to untreated plots which serve as a control, 3 amounts of dressing were compared—300, 600, and 900 lb. per acre. Both a fall and a spring application of each amount was tested, so that in all there were seven distinct treatments. The sulphur was spread by hand on the surface of the soil, and then diced into a depth of about 4 inches. The quantity to be analyzed is the “scab index”. That is roughly speaking, the percentage of the surface area of the potato that is infected with scab. It is obtained by examining 100 potatoes at random from each plot, grading each potato on a scale from 0 to 100% infected, and taking the average.</p>
</blockquote>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb77" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ScabIndex</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span>      <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">29</span>, </span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">32</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">26</span>, </span>
<span>         <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">21</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">12</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">19</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>,</span>
<span>        <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">16</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">17</span></span>
<span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/factor.html">factor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>          x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>, times <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>        , labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"O"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"F3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"S3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"F6"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"S6"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"F9"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"S9"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>        <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df13</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ScabIndex</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df13</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Trt ScabIndex
1    O        12
2    O        10
3    O        24
4    O        29
5    O        30
6    O        18
7    O        32
8    O        26
9   F3         9
10  F3         9
11  F3        16
12  F3         4
13  S3        30
14  S3         7
15  S3        21
16  S3         9
17  F6        16
18  F6        10
19  F6        18
20  F6        18
21  S6        18
22  S6        24
23  S6        12
24  S6        19
25  F9        10
26  F9         4
27  F9         4
28  F9         5
29  S9        17
30  S9         7
31  S9        16
32  S9        17</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb79" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p13</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df13</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ScabIndex</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Treatment"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Scab Index"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p13</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/crd.p13-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-14"><img src="https://myaseen208.com/blogs/2018-05-09_ARRI/index_files/figure-html/crd.p13-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb80" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm13</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ScabIndex</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df13</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm13</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = ScabIndex ~ Trt, data = df13)

Residuals:
    Min      1Q  Median      3Q     Max 
-12.625  -4.844   0.625   3.594  13.250 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)   22.625      2.369   9.549 8.08e-10 ***
TrtF3        -13.125      4.104  -3.198 0.003734 ** 
TrtS3         -5.875      4.104  -1.432 0.164666    
TrtF6         -7.125      4.104  -1.736 0.094858 .  
TrtS6         -4.375      4.104  -1.066 0.296601    
TrtF9        -16.875      4.104  -4.112 0.000372 ***
TrtS9         -8.375      4.104  -2.041 0.051977 .  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 6.702 on 25 degrees of freedom
Multiple R-squared:  0.4641,    Adjusted R-squared:  0.3355 
F-statistic: 3.608 on 6 and 25 DF,  p-value: 0.01026</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb82" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm13</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: ScabIndex
          Df  Sum Sq Mean Sq F value  Pr(&gt;F)  
Trt        6  972.34 162.057  3.6081 0.01026 *
Residuals 25 1122.88  44.915                  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="randomized-complete-block-design-rcbd" class="level2"><h2 class="anchored" data-anchor-id="randomized-complete-block-design-rcbd">Randomized Complete Block Design (RCBD)</h2>
<blockquote class="blockquote">
<ul>
<li>Used when experimental material is heterogenous in one direction</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-12" class="level3"><h3 class="anchored" data-anchor-id="example-12">Example</h3>
<blockquote class="blockquote">
<p>Yield : Yield of barley, SoilType : Soil Type, and Trt : 5 sources and a control</p>
</blockquote>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb84" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>             <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">32.1</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">35.6</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">41.9</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">35.4</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30.1</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.5</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">37.1</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">30.8</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">25.4</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">27.4</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">33.8</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.1</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24.1</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">33.0</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">35.6</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.4</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">26.1</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.0</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">33.8</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31.9</span></span>
<span>          ,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">23.2</span>,  <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">24.8</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">26.7</span>,   <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">26.7</span></span>
<span>          <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">SoilType</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span></span>
<span>               , labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"I"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"II"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"III"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"IV"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, ordered <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>      <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/gl.html">gl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>n <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>, k <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, length <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span></span>
<span>               , labels <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"(NH4)2SO4"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NH4NO3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"CO(NH2)2"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Ca(NO3)2"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"NaNO3"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Control"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, ordered <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df14</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">SoilType</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df14</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Yield SoilType       Trt
1   32.1        I (NH4)2SO4
2   35.6        I    NH4NO3
3   41.9        I  CO(NH2)2
4   35.4        I  Ca(NO3)2
5   30.1        I     NaNO3
6   31.5        I   Control
7   37.1       II (NH4)2SO4
8   30.8       II    NH4NO3
9   25.4       II  CO(NH2)2
10  27.4       II  Ca(NO3)2
11  33.8       II     NaNO3
12  31.1       II   Control
13  24.1      III (NH4)2SO4
14  33.0      III    NH4NO3
15  35.6      III  CO(NH2)2
16  31.4      III  Ca(NO3)2
17  26.1      III     NaNO3
18  31.0      III   Control
19  33.8       IV (NH4)2SO4
20  31.9       IV    NH4NO3
21  23.2       IV  CO(NH2)2
22  24.8       IV  Ca(NO3)2
23  26.7       IV     NaNO3
24  26.7       IV   Control</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb86" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p14</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df14</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Treatment"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p14</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/rcbd.p14-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-15"><img src="https://myaseen208.com/blogs/2018-05-09_ARRI/index_files/figure-html/rcbd.p14-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb87" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm14</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">SoilType</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df14</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm14</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ SoilType + Trt, data = df14)

Residuals:
    Min      1Q  Median      3Q     Max 
-7.0208 -2.4229  0.0792  2.1354  6.7958 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)   35.354      2.826  12.511 2.44e-09 ***
SoilTypeII    -3.500      2.664  -1.314   0.2087    
SoilTypeIII   -4.233      2.664  -1.589   0.1329    
SoilTypeIV    -6.583      2.664  -2.471   0.0259 *  
TrtNH4NO3      1.050      3.263   0.322   0.7521    
TrtCO(NH2)2   -0.250      3.263  -0.077   0.9399    
TrtCa(NO3)2   -2.025      3.263  -0.621   0.5442    
TrtNaNO3      -2.600      3.263  -0.797   0.4380    
TrtControl    -1.700      3.263  -0.521   0.6100    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 4.615 on 15 degrees of freedom
Multiple R-squared:  0.3512,    Adjusted R-squared:  0.005215 
F-statistic: 1.015 on 8 and 15 DF,  p-value: 0.4653</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb89" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm14</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df Sum Sq Mean Sq F value Pr(&gt;F)
SoilType   3 133.62  44.539  2.0915 0.1443
Trt        5  39.31   7.862  0.3692 0.8618
Residuals 15 319.43  21.295               </code></pre>
</div>
</div>
<p>&nbsp;</p>
</section></section><section id="latin-square-design" class="level2"><h2 class="anchored" data-anchor-id="latin-square-design">Latin Square Design</h2>
<blockquote class="blockquote">
<ul>
<li>Used when experimental material is heterogenous in two perpendicular directions</li>
</ul>
</blockquote>
<p>&nbsp;</p>
<section id="example-13" class="level3"><h3 class="anchored" data-anchor-id="example-13">Example</h3>
<blockquote class="blockquote">
<p>The following table shows the field layout and yield of a 5×5 Latin square experiment on the effect of spacing on yield of millet plants. Five levels of spacing were used. The data on yield (grams/plot) was recorded and is given below:</p>
</blockquote>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb91" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">257</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">230</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">279</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">287</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">202</span>,</span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">245</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">283</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">245</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">280</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">260</span>,</span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">182</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">252</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">280</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">246</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">250</span>,</span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">203</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">204</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">227</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">193</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">259</span>,</span>
<span>           <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">231</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">271</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">266</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">334</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">338</span></span>
<span>           <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Row</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/factor.html">factor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, each <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Col</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/factor.html">factor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, times <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>          <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span></span>
<span>        , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span></span>
<span>        , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span></span>
<span>        , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span></span>
<span>        , <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"C"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"D"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"B"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"A"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"E"</span></span>
<span>         <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df15</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Row</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Col</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df15</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>   Yield Row Col Trt
1    257   1   1   B
2    230   1   2   E
3    279   1   3   A
4    287   1   4   C
5    202   1   5   D
6    245   2   1   D
7    283   2   2   A
8    245   2   3   E
9    280   2   4   B
10   260   2   5   C
11   182   3   1   E
12   252   3   2   B
13   280   3   3   C
14   246   3   4   D
15   250   3   5   A
16   203   4   1   A
17   204   4   2   C
18   227   4   3   D
19   193   4   4   E
20   259   4   5   B
21   231   5   1   C
22   271   5   2   D
23   266   5   3   B
24   334   5   4   A
25   338   5   5   E</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb93" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p15</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df15</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> </span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_boxplot.html">geom_boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/labs.html">labs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Treatment"</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Yield"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggtheme.html">theme_bw</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/print.html">print</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">p15</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="quarto-figure quarto-figure-center">
<figure class="figure"><p><a href="index_files/figure-html/latin.p15-1.svg" class="lightbox" data-gallery="quarto-lightbox-gallery-16"><img src="https://myaseen208.com/blogs/2018-05-09_ARRI/index_files/figure-html/latin.p15-1.svg" class="img-fluid quarto-figure quarto-figure-center figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb94" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm15</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Yield</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Row</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Col</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Trt</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df15</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm15</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Yield ~ Row + Col + Trt, data = df15)

Residuals:
   Min     1Q Median     3Q    Max 
-44.68 -12.48   1.12  16.52  54.92 

Coefficients:
            Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept)   240.08      23.43  10.247 2.75e-07 ***
Row2           11.60      20.55   0.565   0.5828    
Row3           -9.00      20.55  -0.438   0.6692    
Row4          -33.80      20.55  -1.645   0.1259    
Row5           37.00      20.55   1.801   0.0969 .  
Col2           24.40      20.55   1.187   0.2580    
Col3           35.80      20.55   1.742   0.1070    
Col4           44.40      20.55   2.161   0.0516 .  
Col5           38.20      20.55   1.859   0.0877 .  
TrtB           -7.00      20.55  -0.341   0.7393    
TrtC          -17.40      20.55  -0.847   0.4137    
TrtD          -31.60      20.55  -1.538   0.1500    
TrtE          -32.20      20.55  -1.567   0.1431    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 32.49 on 12 degrees of freedom
Multiple R-squared:  0.6536,    Adjusted R-squared:  0.3073 
F-statistic: 1.887 on 12 and 12 DF,  p-value: 0.1426</code></pre>
</div>
</div>
<div class="cell" data-layout-align="center">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb96" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/anova.html">anova</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fm15</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>Analysis of Variance Table

Response: Yield
          Df  Sum Sq Mean Sq F value  Pr(&gt;F)  
Row        4 13601.4  3400.3  3.2212 0.05164 .
Col        4  6146.2  1536.5  1.4556 0.27581  
Trt        4  4156.6  1039.1  0.9844 0.45229  
Residuals 12 12667.3  1055.6                  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1</code></pre>
</div>
</div>


</section></section><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2018,
  author = {Yaseen, Muhammad},
  title = {An Introduction to {R} for {Agricultural} {Research}},
  date = {2018-05-09},
  url = {https://myaseen208.com/blogs/2018-05-09_ARRI/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2018" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2018. <span>“An Introduction to R for Agricultural
Research.”</span> May 9. <a href="https://myaseen208.com/blogs/2018-05-09_ARRI/">https://myaseen208.com/blogs/2018-05-09_ARRI/</a>.
</div></div></section></div> ]]></description>
  <category>R</category>
  <category>Statistics</category>
  <category>Research</category>
  <guid>https://myaseen208.com/blogs/2018-05-09_ARRI/</guid>
  <pubDate>Wed, 09 May 2018 04:00:00 GMT</pubDate>
  <media:content url="https://myaseen208.com/assets/img/blogs/2018-05-09_ARRI/fig/PopRegFn.webp" medium="image" type="image/webp"/>
</item>
<item>
  <title>ppcSpatial: Spatial Analysis of Pakistan Population Census</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2018-04-30_ppcSpatial/</link>
  <description><![CDATA[ 




<p>The latest version of the ppcSpatial package for R is now on <a href="https://cran.r-project.org/package=ppcSpatial">CRAN</a>. It performs spatial analysis for exploration of Pakistan Population Census 2017 (<a href="http://www.pbscensus.gov.pk/" class="uri">http://www.pbscensus.gov.pk/</a>). It uses data from R package <a href="https://cran.r-project.org/package=PakPC2017">PakPC2017</a>.</p>
<p>A video showing some functionality of the package is</p>
<div class="quarto-figure quarto-figure-left">
<figure class="figure">
<p><img src="https://myaseen208.com/assets/img/software/ppcSpatial/ppcSpatial.webp" class="img-fluid figure-img"></p>
<figcaption>ppcSpatial package video thumbnail</figcaption>
</figure>
</div>



<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2018,
  author = {Yaseen, Muhammad},
  title = {ppcSpatial: {Spatial} {Analysis} of {Pakistan} {Population}
    {Census}},
  date = {2018-04-30},
  url = {https://myaseen208.com/blogs/2018-04-30_ppcSpatial/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2018" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2018. <span>“ppcSpatial: Spatial Analysis of Pakistan
Population Census.”</span> April 30. <a href="https://myaseen208.com/blogs/2018-04-30_ppcSpatial/">https://myaseen208.com/blogs/2018-04-30_ppcSpatial/</a>.
</div></div></section></div> ]]></description>
  <category>R</category>
  <category>ppcSpatial</category>
  <category>Pakistan Population Census 2017</category>
  <guid>https://myaseen208.com/blogs/2018-04-30_ppcSpatial/</guid>
  <pubDate>Mon, 30 Apr 2018 04:00:00 GMT</pubDate>
  <media:content url="https://myaseen208.com/assets/img/software/ppcSpatial/ppcSpatial.webp" medium="image" type="image/webp"/>
</item>
<item>
  <title>VetResearchLMM v1.0.0 on CRAN</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2018-04-23_VetResearchLMM/</link>
  <description><![CDATA[ 




<p>The latest version of the VetResearchLMM package for R is now on <a href="https://cran.r-project.org/package=VetResearchLMM">CRAN</a>. This package provides R Codes and Datasets for Duchateau, L. and Janssen, P. and Rowlands, G. J. (1998). Linear Mixed Models. An Introduction with applications in Veterinary Research. International Livestock Research Institute. The latest version of the package is prepare for new version of <a href="https://cran.r-project.org/package=lmerTest">lmerTest</a>.</p>



<div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2018,
  author = {Yaseen, Muhammad},
  title = {VetResearchLMM V1.0.0 on {CRAN}},
  date = {2018-04-23},
  url = {https://myaseen208.com/blogs/2018-04-23_VetResearchLMM/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2018" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2018. <span>“VetResearchLMM V1.0.0 on CRAN.”</span>
April 23. <a href="https://myaseen208.com/blogs/2018-04-23_VetResearchLMM/">https://myaseen208.com/blogs/2018-04-23_VetResearchLMM/</a>.
</div></div></section></div> ]]></description>
  <category>Statistics</category>
  <category>R</category>
  <category>Linear Mixed Models</category>
  <category>Veterinary Research</category>
  <guid>https://myaseen208.com/blogs/2018-04-23_VetResearchLMM/</guid>
  <pubDate>Mon, 23 Apr 2018 04:00:00 GMT</pubDate>
</item>
<item>
  <title>Diallel Analysis with R</title>
  <dc:creator>Muhammad Yaseen</dc:creator>
  <link>https://myaseen208.com/blogs/2018-04-21_DiallelAnalysisR/</link>
  <description><![CDATA[ <p>The latest versin 0.1.1 of <a href="https://cran.r-project.org/web/packages/DiallelAnalysisR/index.html">DiallelAnalysisR</a> is aviable on <a href="https://cran.r-project.org/web/packages/DiallelAnalysisR/index.html">CRAN</a>. It performs Diallel Analysis with R using Griffing’s and Hayman’s approaches. Four different methods (1: Method-I (Parents + F1’s + reciprocals); 2: Method-II (Parents and one set of F1’s); 3: Method-III (One set of F1’s and reciprocals); 4: Method-IV (One set of F1’s only)) and two methods (1: Fixed Effects Model; 2: Random Effects Model) can be applied using Griffing’s approach.</p>
<p><strong>DiallelAnalysisR</strong> has functions to perform Diallel Analysis with R using Griffing’s and Hayman’s approaches. Four different Methods:</p>
<ol type="1">
<li>Method-I (Parents + F1’s + reciprocals)</li>
<li>Method-II (Parents and one set of F1’s)</li>
<li>Method-III (One set of F1’s and reciprocals)</li>
<li>Method-IV (One set of F1’s only))</li>
</ol>
<p>and two Models:</p>
<ol type="1">
<li>Fixed Effects Model</li>
<li>Random Effects Model</li>
</ol>
<p>can be applied using Griffing’s approach.</p>
<section id="installation" class="level2"><h2 class="anchored" data-anchor-id="installation">Installation</h2>
</section><section id="stable-version" class="level2"><h2 class="anchored" data-anchor-id="stable-version">Stable Version</h2>
<p>Stable version of the package avialabe on <a href="https://cran.r-project.org/web/packages/DiallelAnalysisR/index.html">CRAN</a> can be installed using:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://myaseen208.com/DiallelAnalysisR/">DiallelAnalysisR</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
</div>
</section><section id="development-version" class="level2"><h2 class="anchored" data-anchor-id="development-version">Development Version</h2>
<p>Development version of the package avialabe on <a href="https://github.com/myaseen208/DiallelAnalysisR">Github</a> can be installed using:</p>
<p>Use the project package environment or install instructions from the package repository.</p>
</section><section id="license" class="level2"><h2 class="anchored" data-anchor-id="license">License</h2>
<p>This package is free and open source software, licensed under GPL.</p>


</section><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{yaseen2018,
  author = {Yaseen, Muhammad},
  title = {Diallel {Analysis} with {R}},
  date = {2018-04-21},
  url = {https://myaseen208.com/blogs/2018-04-21_DiallelAnalysisR/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-yaseen2018" class="csl-entry quarto-appendix-citeas">
Yaseen, Muhammad. 2018. <span>“Diallel Analysis with R.”</span> April
21. <a href="https://myaseen208.com/blogs/2018-04-21_DiallelAnalysisR/">https://myaseen208.com/blogs/2018-04-21_DiallelAnalysisR/</a>.
</div></div></section></div> ]]></description>
  <category>Diallel Analysis</category>
  <category>R</category>
  <guid>https://myaseen208.com/blogs/2018-04-21_DiallelAnalysisR/</guid>
  <pubDate>Sat, 21 Apr 2018 04:00:00 GMT</pubDate>
</item>
<item>
  <title>Data Analysis with R: Introduction of R Language</title>
  <dc:creator>Muhammad Arfan Dilber</dc:creator>
  <link>https://myaseen208.com/blogs/2018-03-25_Maldives_R/</link>
  <description><![CDATA[ <section id="the-workspace" class="level2"><h2 class="anchored" data-anchor-id="the-workspace">The Workspace</h2>
<p>The workspace is your current R working environment and includes any user-defined objects (vectors, matrices, data frames, lists, functions). At the end of an R session, the user can save an image of the current workspace that is automatically reloaded the next time R is started.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb1" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/getwd.html">getwd</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># Use here::here() for project-relative paths.</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/save.html">save.image</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"># To save workspace image.</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/save.html">save</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span>, file <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mydat.RData"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rm.html">rm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>list <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/ls.html">ls</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/load.html">load</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mydat.RData"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span></span></code></pre></div></div>
</div>
</section><section id="data-types" class="level2"><h2 class="anchored" data-anchor-id="data-types">Data types</h2>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb2" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.56</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/class.html">class</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "numeric"</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb4" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 2.56</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb6" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">y</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/integer.html">as.integer</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/class.html">class</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">y</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "integer"</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb8" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">y</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 2</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb10" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">z</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/integer.html">as.integer</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2.56</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">z</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 2</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb12" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/integer.html">is.integer</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">z</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] TRUE</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb14" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/integer.html">as.integer</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/integer.html">is.integer</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">z</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 1</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb16" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/integer.html">as.integer</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/integer.html">is.integer</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">z</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 0</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb18" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/integer.html">as.integer</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/integer.html">is.integer</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 0</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb20" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Round.html">round</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span>,digits <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 2.6</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb22" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">y</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Male"</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/class.html">class</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">y</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "character"</code></pre>
</div>
</div>
</section><section id="vectors" class="level2"><h2 class="anchored" data-anchor-id="vectors">Vectors</h2>
<p>A vector is a sequence of data elements of the same basic type. A combine function c() is used to form the vector. Here are examples of each type of vector:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb24" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 1 2 3 4</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb26" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">y</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"a"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"b"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"c"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"d"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">y</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "a" "b" "c" "d"</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb28" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span>,<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">y</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "1" "2" "3" "4" "a" "b" "c" "d"</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb30" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/length.html">length</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">y</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 4</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb32" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">y</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">]</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "b" "d"</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb34" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">y</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">]</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "b" "c" "d"</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb36" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">y</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">]</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] "a" "b" "d"</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb38" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/names.html">names</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"first"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"second"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"third"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fourth"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code> first second  third fourth 
     1      2      3      4 </code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb40" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"second"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fourth"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">]</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>second fourth 
     2      4 </code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb42" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">]</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code> first second  third fourth 
     1      5      3      4 </code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb44" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code> first second  third fourth 
     2     10      6      8 </code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb46" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/seq.html">seq</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>from <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>, to <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, by <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 1 3 5 7 9</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb48" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>, time <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code> [1] 5 5 5 5 5 5 5 5 5 5</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb50" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Male"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Female"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>,time <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code> [1] "Male"   "Female" "Male"   "Female" "Male"   "Female" "Male"   "Female"
 [9] "Male"   "Female" "Male"   "Female" "Male"   "Female" "Male"   "Female"
[17] "Male"   "Female" "Male"   "Female"</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb52" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Male"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Female"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, each <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code> [1] "Male"   "Male"   "Male"   "Male"   "Male"   "Male"   "Male"   "Male"  
 [9] "Male"   "Male"   "Female" "Female" "Female" "Female" "Female" "Female"
[17] "Female" "Female" "Female" "Female"</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb54" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/rep.html">rep</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/seq.html">seq</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>from <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>, to <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span>, by <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.25</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, time <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>  [1] 2.00 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00 5.25 5.50
 [16] 5.75 6.00 6.25 6.50 6.75 7.00 7.25 7.50 7.75 8.00 8.25 8.50 8.75 9.00 2.00
 [31] 2.25 2.50 2.75 3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00 5.25 5.50 5.75
 [46] 6.00 6.25 6.50 6.75 7.00 7.25 7.50 7.75 8.00 8.25 8.50 8.75 9.00 2.00 2.25
 [61] 2.50 2.75 3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00 5.25 5.50 5.75 6.00
 [76] 6.25 6.50 6.75 7.00 7.25 7.50 7.75 8.00 8.25 8.50 8.75 9.00 2.00 2.25 2.50
 [91] 2.75 3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00 5.25 5.50 5.75 6.00 6.25
[106] 6.50 6.75 7.00 7.25 7.50 7.75 8.00 8.25 8.50 8.75 9.00 2.00 2.25 2.50 2.75
[121] 3.00 3.25 3.50 3.75 4.00 4.25 4.50 4.75 5.00 5.25 5.50 5.75 6.00 6.25 6.50
[136] 6.75 7.00 7.25 7.50 7.75 8.00 8.25 8.50 8.75 9.00</code></pre>
</div>
</div>
</section><section id="matrices" class="level2"><h2 class="anchored" data-anchor-id="matrices">Matrices</h2>
<p>A matrix is a collection of data elements arranged in a two dimensional rectangular layout. Matrices are created with the matrix function.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb56" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">A</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>,</span>
<span>  nrow <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>,</span>
<span>  ncol <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>,</span>
<span>  byrow <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">B</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">4</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">7</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">8</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>,</span>
<span>  nrow <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>,</span>
<span>  ncol <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>,</span>
<span>  byrow <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">FALSE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">B</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>     [,1] [,2] [,3]
[1,]    1    4    7
[2,]    2    5    8
[3,]    3    6    9</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb58" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">A</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>     [,1] [,2]
[1,]    1    2
[2,]    3    4</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb60" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">A</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>,<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">]</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 3 4</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb62" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">A</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">]</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 2 4</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb64" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">A</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">]</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 4</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb66" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/t.html">t</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">A</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>     [,1] [,2]
[1,]    1    3
[2,]    2    4</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb68" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/det.html">det</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">A</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] -2</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb70" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/diag.html">diag</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">A</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 1 4</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb72" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">B</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">A</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">A</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">B</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>     [,1] [,2]
[1,]    2    4
[2,]    6    8</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb74" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Asquared</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">A</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/matmult.html">%*%</a></span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">A</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Asquared</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>     [,1] [,2]
[1,]    7   10
[2,]   15   22</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb76" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Ainv</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/solve.html">solve</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">A</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Ainv</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>     [,1] [,2]
[1,] -2.0  1.0
[2,]  1.5 -0.5</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb78" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Aev</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/eigen.html">eigen</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">A</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Aev</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>eigen() decomposition
$values
[1]  5.3722813 -0.3722813

$vectors
           [,1]       [,2]
[1,] -0.4159736 -0.8245648
[2,] -0.9093767  0.5657675</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb80" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Aev</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">values</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1]  5.3722813 -0.3722813</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb82" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Aev</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">vectors</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>           [,1]       [,2]
[1,] -0.4159736 -0.8245648
[2,] -0.9093767  0.5657675</code></pre>
</div>
</div>
</section><section id="lists" class="level2"><h2 class="anchored" data-anchor-id="lists">Lists</h2>
<p>Lists are the most complex of the R data types. Basically, a list is an ordered collection of objects (components). A list allows you to gather a variety of (possibly unrelated) objects under one name. For example, a list may contain a combination of vectors, matrices, data frames, and even other lists. A list is created with the list() function.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb84" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"My First List"</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">h</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">25</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">26</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">18</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">39</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">j</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/matrix.html">matrix</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span>, nrow <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">k</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"one"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"two"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"three"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">mylist</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/list.html">list</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>title <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span>, ages <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">h</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">j</span>,<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">k</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">mylist</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>$title
[1] "My First List"

$ages
[1] 25 26 18 39

[[3]]
     [,1] [,2]
[1,]    1    6
[2,]    2    7
[3,]    3    8
[4,]    4    9
[5,]    5   10

[[4]]
[1] "one"   "two"   "three"</code></pre>
</div>
</div>
</section><section id="data-frames" class="level2"><h2 class="anchored" data-anchor-id="data-frames">Data Frames</h2>
<p>A Data Frame is used for storing data tables. It is a list of vectors of equal length. Different columns can contain different type of data (numeric,character, etc.). A data frame is created with the data.frame() function:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb86" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/data.frame.html">data.frame</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span>,<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">y</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>        x y
first   2 a
second 10 b
third   6 c
fourth  8 d</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb88" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/nrow.html">nrow</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 4</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb90" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/nrow.html">ncol</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] 2</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb92" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">y</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/match.html">%in%</a></span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"a"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"d"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>,<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">]</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>       x y
first  2 a
fourth 8 d</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb94" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">]</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/match.html">%in%</a></span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"b"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"c"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>,<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">]</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">df1</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>        x y
second 10 b
third   6 c</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb96" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://github.com/MYaseen208/PakPC2017">PakPC2017</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/utils/data.html">data</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 6 × 6
  Province Division   District   Tehsil            Pop1998 Pop2017
  &lt;chr&gt;    &lt;chr&gt;      &lt;chr&gt;      &lt;chr&gt;               &lt;dbl&gt;   &lt;dbl&gt;
1 Punjab   Bahawalpur Bahawalpur Hasilpur           317513  456006
2 Punjab   Bahawalpur Bahawalpur Khairpur Tamewali  183903  262628
3 Punjab   Bahawalpur Bahawalpur Yazman             168950  262175
4 Punjab   Bahawalpur Bahawalpur Ahmadpur East      718297 1078683
5 Punjab   Bahawalpur Bahawalpur Bahawalpur City    419542  681696
6 Punjab   Bahawalpur Bahawalpur Bahawalpur Saddar  387038  574950</code></pre>
</div>
</div>
</section><section id="readingwriting-data-fromto-files-importexport-data" class="level2"><h2 class="anchored" data-anchor-id="readingwriting-data-fromto-files-importexport-data">Reading/writing data from/to files (Import/Export Data)</h2>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb98" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://readxl.tidyverse.org">readxl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">spi</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://readxl.tidyverse.org/reference/read_excel.html">read_excel</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">here</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://here.r-lib.org/reference/here.html">here</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"blogs"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2018-03-25_Maldives_R"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"data"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"spi.xls"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">DT</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/DT/man/datatable.html">datatable</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">spi</span>,fillContainer <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>, editable <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/utils/write.table.html">write.csv</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Population.csv"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
</div>
</section><section id="connecting-to-the-database" class="level2"><h2 class="anchored" data-anchor-id="connecting-to-the-database">Connecting to the database</h2>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb99" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org">dplyr</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">con</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">DBI</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dbi.r-dbi.org/reference/dbConnect.html">dbConnect</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">odbc</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">odbc</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>,</span>
<span>                      dsn <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mydata"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">table13</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/tbl.html">tbl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">con</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"RPI"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">table13</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#tehsil&lt;-PakPC2017::PakPC2017Tehsil</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#copy_to(con,tehsil,"tehsil",</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#        temporary = FALSE</span></span>
<span><span class="co" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">#      )</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">DBI</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dbi.r-dbi.org/reference/dbDisconnect.html">dbDisconnect</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">con</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
</div>
</section><section id="numerical-or-graphical-summaries-of-data." class="level2"><h2 class="anchored" data-anchor-id="numerical-or-graphical-summaries-of-data.">Numerical or Graphical Summaries of data.</h2>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb100" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://github.com/MYaseen208/PakPC2017">PakPC2017</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>      Province        Division        District         Tehsil   
 Length   :543   Length   :543   Length   :543   Length   :543  
 N.unique :  5   N.unique : 29   N.unique :129   N.unique :538  
 N.blank  :  0   N.blank  :  0   N.blank  :  0   N.blank  :  0  
 Min.nchar:  4   Min.nchar:  4   Min.nchar:  4   Min.nchar:  3  
 Max.nchar: 18   Max.nchar: 19   Max.nchar: 19   Max.nchar: 28  
                                                                
                                                                
    Pop1998           Pop2017       
 Min.   :   3024   Min.   :   2665  
 1st Qu.:  57502   1st Qu.:  89801  
 Median : 157142   Median : 254647  
 Mean   : 240553   Mean   : 377084  
 3rd Qu.: 298074   3rd Qu.: 447854  
 Max.   :2219399   Max.   :4269079  
                   NAs    :1        </code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb102" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/graphics/pairs.html">pairs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">]</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/summary1-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-1"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/summary1-1.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb103" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/cor.html">cor</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">[</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">:</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">6</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">]</span>, use <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"complete"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>          Pop1998   Pop2017
Pop1998 1.0000000 0.9788354
Pop2017 0.9788354 1.0000000</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb105" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">popLm</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/lm.html">lm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>formula <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop1998</span>, data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">popLm</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Pop2017 ~ Pop1998, data = PakPC2017Tehsil)

Coefficients:
(Intercept)      Pop1998  
  -3445.895        1.579  </code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb107" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/residuals.html">resid</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">popLm</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>         1          2          3          4          5          6          7 
-42044.030 -24391.708  -1227.192 -52385.341  22496.260 -32911.295 -36767.021 
         8          9         10 
-92325.684 -73938.014  10353.258 </code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb109" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/fitted.values.html">fitted</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">popLm</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>        1         2         3         4         5         6         7         8 
 498050.0  287019.7  263402.2 1131068.3  659199.7  607861.3  851910.0  783546.7 
        9        10 
 599536.0  143090.7 </code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb111" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/summary.html">summary</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">popLm</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>
Call:
lm(formula = Pop2017 ~ Pop1998, data = PakPC2017Tehsil)

Residuals:
    Min      1Q  Median      3Q     Max 
-299426  -29128    -355   18117 1071215 

Coefficients:
              Estimate Std. Error t value Pr(&gt;|t|)    
(Intercept) -3.446e+03  5.391e+03  -0.639    0.523    
Pop1998      1.579e+00  1.421e-02 111.147   &lt;2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 96960 on 540 degrees of freedom
  (1 observation deleted due to missingness)
Multiple R-squared:  0.9581,    Adjusted R-squared:  0.958 
F-statistic: 1.235e+04 on 1 and 540 DF,  p-value: &lt; 2.2e-16</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb113" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/graphics/par.html">par</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mfrow <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/graphics/plot.default.html">plot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">popLm</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/summary1-2.png" class="lightbox" data-gallery="quarto-lightbox-gallery-2"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/summary1-2.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section><section id="summarize-data" class="level2"><h2 class="anchored" data-anchor-id="summarize-data">Summarize Data</h2>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb114" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://github.com/MYaseen208/PakPC2017">PakPC2017</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org">dplyr</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
</div>
</section><section id="bar-charts-and-dot-charts" class="level2"><h2 class="anchored" data-anchor-id="bar-charts-and-dot-charts">Bar charts and Dot charts</h2>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb115" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://github.com/MYaseen208/PakPC2017">PakPC2017</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/utils/data.html">data</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"PakPC2017Tehsil"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 6 × 6
  Province Division   District   Tehsil            Pop1998 Pop2017
  &lt;chr&gt;    &lt;chr&gt;      &lt;chr&gt;      &lt;chr&gt;               &lt;dbl&gt;   &lt;dbl&gt;
1 Punjab   Bahawalpur Bahawalpur Hasilpur           317513  456006
2 Punjab   Bahawalpur Bahawalpur Khairpur Tamewali  183903  262628
3 Punjab   Bahawalpur Bahawalpur Yazman             168950  262175
4 Punjab   Bahawalpur Bahawalpur Ahmadpur East      718297 1078683
5 Punjab   Bahawalpur Bahawalpur Bahawalpur City    419542  681696
6 Punjab   Bahawalpur Bahawalpur Bahawalpur Saddar  387038  574950</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb117" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">province</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/tapply.html">tapply</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span>,<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Province</span>,<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">sum</span>,na.rm<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/graphics/par.html">par</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mfrow <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/graphics/dotchart.html">dotchart</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">province</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/graphics/barplot.html">barplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">province</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/graphics/boxplot.html">boxplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Province</span>,data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/graphics/pie.html">pie</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">province</span>, col <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/grDevices/palettes.html">rainbow</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/length.html">length</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">province</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/graphics/plot.default.html">plot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">province</span>, type <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"o"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">pop</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/graphics/hist.html">hist</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">pop</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/dataFrame1-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-3"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/dataFrame1-1.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb118" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/graphics/hist.html">hist</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">pop</span>, breaks <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/seq.html">seq</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Extremes.html">min</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">pop</span>,na.rm <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>,<span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/Extremes.html">max</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">pop</span>,na.rm <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, length.out <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">31</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/dataFrame1-2.png" class="lightbox" data-gallery="quarto-lightbox-gallery-4"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/dataFrame1-2.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<section id="ggplot2-package" class="level3"><h3 class="anchored" data-anchor-id="ggplot2-package">ggplot2 package</h3>
</section></section><section id="the-mpg-data-frame" class="level2"><h2 class="anchored" data-anchor-id="the-mpg-data-frame">The mpg Data Frame</h2>
<p>A data frame is a rectangular collection of variables (in the columns) and observations (in the rows). mpg contains observations collected by the US Environment Protection Agency on 38 models of cars; To learn more about mpg, open its help page by running ?mpg.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb119" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">mpg</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">displ</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">hwy</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/mpg-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-5"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/mpg-1.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb120" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">mpg</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">displ</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">hwy</span>, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">class</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/mpg1-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-6"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/mpg1-1.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb121" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">mpg</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">displ</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">hwy</span>, size <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">class</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/mpg2-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-7"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/mpg2-1.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb122" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">mpg</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">displ</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">hwy</span>, shape <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">class</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/mpg3-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-8"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/mpg3-1.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb123" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">mpg</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">displ</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">hwy</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"blue"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/mpg4-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-9"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/mpg4-1.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb124" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">mpg</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_smooth.html">geom_smooth</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">displ</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">hwy</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/mpg5-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-10"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/mpg5-1.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb125" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">mpg</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_smooth.html">geom_smooth</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">displ</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">hwy</span>, linetype <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">drv</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/mpg6-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-11"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/mpg6-1.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb126" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">mpg</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">displ</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">hwy</span>, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">drv</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_smooth.html">geom_smooth</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">displ</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">hwy</span>, linetype <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">drv</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/mpg7-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-12"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/mpg7-1.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb127" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">mpg</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">displ</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">hwy</span>, color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">drv</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_smooth.html">geom_smooth</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/mpg8-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-13"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/mpg8-1.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb128" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">mpg</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">displ</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">hwy</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">drv</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_smooth.html">geom_smooth</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>linetype <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">drv</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/mpg9-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-14"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/mpg9-1.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section><section id="data-transformation" class="level2"><h2 class="anchored" data-anchor-id="data-transformation">Data Transformation</h2>
<p>To explore the basic data manipulation we’ll use PakPC2017::PakPC2017Tehsil. This data frame contains the popualtion of all 543 tehsils of Pakistan. The data comes from Pakistan Bureau of Statistics, Population Census 2017, and is documented in ?PakPc2017Tehsil.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb129" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://github.com/MYaseen208/PakPC2017">PakPC2017</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org">dplyr</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://tibble.tidyverse.org/reference/as_tibble.html">as_tibble</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 543 × 6
   Province Division   District     Tehsil            Pop1998 Pop2017
   &lt;chr&gt;    &lt;chr&gt;      &lt;chr&gt;        &lt;chr&gt;               &lt;dbl&gt;   &lt;dbl&gt;
 1 Punjab   Bahawalpur Bahawalpur   Hasilpur           317513  456006
 2 Punjab   Bahawalpur Bahawalpur   Khairpur Tamewali  183903  262628
 3 Punjab   Bahawalpur Bahawalpur   Yazman             168950  262175
 4 Punjab   Bahawalpur Bahawalpur   Ahmadpur East      718297 1078683
 5 Punjab   Bahawalpur Bahawalpur   Bahawalpur City    419542  681696
 6 Punjab   Bahawalpur Bahawalpur   Bahawalpur Saddar  387038  574950
 7 Punjab   Bahawalpur Bahawalnagar Bahawalnagar       541553  815143
 8 Punjab   Bahawalpur Bahawalnagar Chishtian          498270  691221
 9 Punjab   Bahawalpur Bahawalnagar Haroonabad         381767  525598
10 Punjab   Bahawalpur Bahawalnagar Fort Abbas          92777  153444
# ℹ 533 more rows</code></pre>
</div>
</div>
</section><section id="filter-rows-with-filter" class="level2"><h2 class="anchored" data-anchor-id="filter-rows-with-filter">Filter Rows with filter()</h2>
<p>filter() allows you to subset observations based on their vaues. The first argument is the name of the data frame. The second and subsequent arguments are the expressions that filter the data frame. For example, we can select all tehsils of Division Faisalabad:</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb131" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Faisalabad"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 17 × 6
   Province Division   District       Tehsil            Pop1998 Pop2017
   &lt;chr&gt;    &lt;chr&gt;      &lt;chr&gt;          &lt;chr&gt;               &lt;dbl&gt;   &lt;dbl&gt;
 1 Punjab   Faisalabad Faisalabad     Faisalabad City   2140346 3237961
 2 Punjab   Faisalabad Faisalabad     Faisalabad Saddar  924110 1465411
 3 Punjab   Faisalabad Faisalabad     Chak Jhumra        253806  332461
 4 Punjab   Faisalabad Faisalabad     Sammundri          508637  643068
 5 Punjab   Faisalabad Faisalabad     Tandlianwala       540802  702733
 6 Punjab   Faisalabad Faisalabad     Jaranwala         1061846 1492276
 7 Punjab   Faisalabad Jhang          Jhang              999130 1465472
 8 Punjab   Faisalabad Jhang          18 Hazari          200036  295801
 9 Punjab   Faisalabad Jhang          Shorkot            373790  548626
10 Punjab   Faisalabad Jhang          Ahmadpur Sial      296465  433517
11 Punjab   Faisalabad Chiniot        Chiniot            382876  556147
12 Punjab   Faisalabad Chiniot        Lalian             309494  439323
13 Punjab   Faisalabad Chiniot        Bhawana            272754  374270
14 Punjab   Faisalabad Toba Tek Singh Toba Tek Singh     554231  739826
15 Punjab   Faisalabad Toba Tek Singh Gojra              495096  656007
16 Punjab   Faisalabad Toba Tek Singh Kamalia            283674  371851
17 Punjab   Faisalabad Toba Tek Singh Pir Mahal          288592  422331</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb133" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">newD</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/grep.html">grepl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"F"</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">newd2</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/grep.html">grepl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"abad"</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">$</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
</div>
<p>If you want to save the result, you’ll need to use the assignment operator, &lt;-: fsdDivision&lt;-filter(tehsil, Division == “Faisalabad”)</p>
</section><section id="comparisons" class="level2"><h2 class="anchored" data-anchor-id="comparisons">Comparisons</h2>
<p>To use filtering effectively, you have to know how to select the observations that you want using the comparison operators. R provides the standard suite: &gt;, &gt;=, &lt;, &lt;=, != (not equal), and == (equal).</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb134" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1000000</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 35 × 6
   Province Division   District       Tehsil            Pop1998 Pop2017
   &lt;chr&gt;    &lt;chr&gt;      &lt;chr&gt;          &lt;chr&gt;               &lt;dbl&gt;   &lt;dbl&gt;
 1 Punjab   Bahawalpur Bahawalpur     Ahmadpur East      718297 1078683
 2 Punjab   Bahawalpur Rahim Yar Khan Rahim Yar Khan     986614 1530330
 3 Punjab   Bahawalpur Rahim Yar Khan Sadiqabad          771511 1264752
 4 Punjab   Faisalabad Faisalabad     Faisalabad City   2140346 3237961
 5 Punjab   Faisalabad Faisalabad     Faisalabad Saddar  924110 1465411
 6 Punjab   Faisalabad Faisalabad     Jaranwala         1061846 1492276
 7 Punjab   Faisalabad Jhang          Jhang              999130 1465472
 8 Punjab   Sahiwal    Sahiwal        Sahiwal           1056132 1491553
 9 Punjab   Sahiwal    Sahiwal        Chichawatni        787062 1026007
10 Punjab   Sahiwal    Okara          Okara              862364 1205655
# ℹ 25 more rows</code></pre>
</div>
</div>
</section><section id="logical-operators" class="level2"><h2 class="anchored" data-anchor-id="logical-operators">Logical Operators</h2>
<p>Multiple arguments to filter() are combined with “and”: every experessio must be true in order for a row to be included in the output. For other types of combinations, you’ll need to use Boolean operators yourself: &amp; is “and”, | is “or”, and ! is “not”.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb136" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2000000</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">|</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop1998</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1000000</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 15 × 6
   Province           Division   District    Tehsil           Pop1998 Pop2017
   &lt;chr&gt;              &lt;chr&gt;      &lt;chr&gt;       &lt;chr&gt;              &lt;dbl&gt;   &lt;dbl&gt;
 1 Punjab             Faisalabad Faisalabad  Faisalabad City  2140346 3237961
 2 Punjab             Faisalabad Faisalabad  Jaranwala        1061846 1492276
 3 Punjab             Sahiwal    Sahiwal     Sahiwal          1056132 1491553
 4 Punjab             Sahiwal    Okara       Depalpur         1030836 1374912
 5 Punjab             Multan     Multan      Multan City      1381478 2258570
 6 Punjab             Sargodha   Sargodha    Sargodha         1081459 1537866
 7 Punjab             Lahore     Lahore      Lahore City      2219399 3655774
 8 Punjab             Lahore     Lahore      Model Town       1409228 2698235
 9 Punjab             Lahore     Lahore      Shalimar         1434823 2280308
10 Punjab             Lahore     Sheikhupura Sheikhupura      1049264 1555424
11 Punjab             Gujranwala Gujranwala  Gujranwal Saddar 1812137 2807054
12 Punjab             Gujranwala Gujrat      Gujrat           1093088 1497865
13 Punjab             Gujranwala Sialkot     Sialkot          1207744 1794658
14 Punjab             Rawalpindi Rawalpindi  Rawalpindi       1927612 3258547
15 Khyber Pakhtunkhwa Peshawar   Peshawar    Peshawar         2026851 4269079</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb138" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1000000</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop1998</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1000000</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 15 × 6
   Province           Division   District    Tehsil           Pop1998 Pop2017
   &lt;chr&gt;              &lt;chr&gt;      &lt;chr&gt;       &lt;chr&gt;              &lt;dbl&gt;   &lt;dbl&gt;
 1 Punjab             Faisalabad Faisalabad  Faisalabad City  2140346 3237961
 2 Punjab             Faisalabad Faisalabad  Jaranwala        1061846 1492276
 3 Punjab             Sahiwal    Sahiwal     Sahiwal          1056132 1491553
 4 Punjab             Sahiwal    Okara       Depalpur         1030836 1374912
 5 Punjab             Multan     Multan      Multan City      1381478 2258570
 6 Punjab             Sargodha   Sargodha    Sargodha         1081459 1537866
 7 Punjab             Lahore     Lahore      Lahore City      2219399 3655774
 8 Punjab             Lahore     Lahore      Model Town       1409228 2698235
 9 Punjab             Lahore     Lahore      Shalimar         1434823 2280308
10 Punjab             Lahore     Sheikhupura Sheikhupura      1049264 1555424
11 Punjab             Gujranwala Gujranwala  Gujranwal Saddar 1812137 2807054
12 Punjab             Gujranwala Gujrat      Gujrat           1093088 1497865
13 Punjab             Gujranwala Sialkot     Sialkot          1207744 1794658
14 Punjab             Rawalpindi Rawalpindi  Rawalpindi       1927612 3258547
15 Khyber Pakhtunkhwa Peshawar   Peshawar    Peshawar         2026851 4269079</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb140" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2000000</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&amp;</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">!</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop1998</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&gt;=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1000000</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 0 × 6
# ℹ 6 variables: Province &lt;chr&gt;, Division &lt;chr&gt;, District &lt;chr&gt;, Tehsil &lt;chr&gt;,
#   Pop1998 &lt;dbl&gt;, Pop2017 &lt;dbl&gt;</code></pre>
</div>
</div>
</section><section id="missing-values" class="level2"><h2 class="anchored" data-anchor-id="missing-values">Missing Values</h2>
<p>One important feature of R that can make comparison tricky is missing values, or NAs (“not available”). NA represents an unknown value so missing values are “contagious”; almost any operation involving an unknown value will also be unknown: is.na() is used to determine the missing value.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb142" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] NA</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb144" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">/</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] NA</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb146" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">*</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1] NA</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb148" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">NA</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">5</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/NA.html">is.na</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">x</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code>[1]  TRUE FALSE FALSE</code></pre>
</div>
</div>
</section><section id="arrange-rows-with-arrange" class="level2"><h2 class="anchored" data-anchor-id="arrange-rows-with-arrange">Arrange Rows with arrange()</h2>
<p>The vale of x is NA arrange() works similarly to filter() except that instead of selecting rows, it changes their order. It takes a data frame and a set of column names to order by.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb150" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/arrange.html">arrange</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 543 × 6
   Province    Division  District      Tehsil            Pop1998 Pop2017
   &lt;chr&gt;       &lt;chr&gt;     &lt;chr&gt;         &lt;chr&gt;               &lt;dbl&gt;   &lt;dbl&gt;
 1 Balochistan Sibi      Sibi          Sangan               3024    2665
 2 Fata        Fata      Bajaur Agency Bar Chamer Kand      3247    2868
 3 Balochistan Zhob      Zhob          Kashatoo             5165    5180
 4 Balochistan Kalat     Kalat         Gazg                 3979    5726
 5 Sindh       Karachi   Karachi West  Manora Cantonment   10008    5874
 6 Balochistan Sibi      Sibi          Kotmandai            8057    7587
 7 Balochistan Nasirabad Jhal Magsi    Mirpur              11562    9444
 8 Balochistan Sibi      Harnai        Shahrig             17170    9454
 9 Sindh       Hyderabad Sujawal       Kharo Chan Taluka    9956   10235
10 Balochistan Sibi      Dera Bugti    Sangsillah          13700   10265
# ℹ 533 more rows</code></pre>
</div>
</div>
<p>Use desc() to reorder by a column in descending order.</p>
</section><section id="select-columns-with-select" class="level2"><h2 class="anchored" data-anchor-id="select-columns-with-select">Select Columns with select()</h2>
<p>It’s not uncommon to get datasets with hundreds or even thousands of variables. In this case, the first challenge is often narrowing in on the variables you’re actually interested in. select() allows you to rapidly zoom in on a useful subset using operations based on the names of the variables.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb152" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span>,<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Province</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Tehsil</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 543 × 3
   Province Tehsil            Pop2017
   &lt;chr&gt;    &lt;chr&gt;               &lt;dbl&gt;
 1 Punjab   Hasilpur           456006
 2 Punjab   Khairpur Tamewali  262628
 3 Punjab   Yazman             262175
 4 Punjab   Ahmadpur East     1078683
 5 Punjab   Bahawalpur City    681696
 6 Punjab   Bahawalpur Saddar  574950
 7 Punjab   Bahawalnagar       815143
 8 Punjab   Chishtian          691221
 9 Punjab   Haroonabad         525598
10 Punjab   Fort Abbas         153444
# ℹ 533 more rows</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb154" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span>,<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Province</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Tehsil</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 543 × 3
   Division   District     Pop1998
   &lt;chr&gt;      &lt;chr&gt;          &lt;dbl&gt;
 1 Bahawalpur Bahawalpur    317513
 2 Bahawalpur Bahawalpur    183903
 3 Bahawalpur Bahawalpur    168950
 4 Bahawalpur Bahawalpur    718297
 5 Bahawalpur Bahawalpur    419542
 6 Bahawalpur Bahawalpur    387038
 7 Bahawalpur Bahawalnagar  541553
 8 Bahawalpur Bahawalnagar  498270
 9 Bahawalpur Bahawalnagar  381767
10 Bahawalpur Bahawalnagar   92777
# ℹ 533 more rows</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb156" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span>,<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://tidyselect.r-lib.org/reference/everything.html">everything</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 543 × 6
   Pop2017 Province Division   District     Tehsil            Pop1998
     &lt;dbl&gt; &lt;chr&gt;    &lt;chr&gt;      &lt;chr&gt;        &lt;chr&gt;               &lt;dbl&gt;
 1  456006 Punjab   Bahawalpur Bahawalpur   Hasilpur           317513
 2  262628 Punjab   Bahawalpur Bahawalpur   Khairpur Tamewali  183903
 3  262175 Punjab   Bahawalpur Bahawalpur   Yazman             168950
 4 1078683 Punjab   Bahawalpur Bahawalpur   Ahmadpur East      718297
 5  681696 Punjab   Bahawalpur Bahawalpur   Bahawalpur City    419542
 6  574950 Punjab   Bahawalpur Bahawalpur   Bahawalpur Saddar  387038
 7  815143 Punjab   Bahawalpur Bahawalnagar Bahawalnagar       541553
 8  691221 Punjab   Bahawalpur Bahawalnagar Chishtian          498270
 9  525598 Punjab   Bahawalpur Bahawalnagar Haroonabad         381767
10  153444 Punjab   Bahawalpur Bahawalnagar Fort Abbas          92777
# ℹ 533 more rows</code></pre>
</div>
</div>
</section><section id="add-new-variables-with-mutate" class="level2"><h2 class="anchored" data-anchor-id="add-new-variables-with-mutate">Add New Variables with mutate()</h2>
<p>Besides selecting sets of existing columns, it’s often useful to add new columns that are functions of existing columns. That’s the job of mutate(). mutate() always adds new columns at the end of your dataset. When you’re in RStudio use View() to see all columns.</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb158" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span>, diff <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop1998</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 543 × 7
   Province Division   District     Tehsil            Pop1998 Pop2017   diff
   &lt;chr&gt;    &lt;chr&gt;      &lt;chr&gt;        &lt;chr&gt;               &lt;dbl&gt;   &lt;dbl&gt;  &lt;dbl&gt;
 1 Punjab   Bahawalpur Bahawalpur   Hasilpur           317513  456006 138493
 2 Punjab   Bahawalpur Bahawalpur   Khairpur Tamewali  183903  262628  78725
 3 Punjab   Bahawalpur Bahawalpur   Yazman             168950  262175  93225
 4 Punjab   Bahawalpur Bahawalpur   Ahmadpur East      718297 1078683 360386
 5 Punjab   Bahawalpur Bahawalpur   Bahawalpur City    419542  681696 262154
 6 Punjab   Bahawalpur Bahawalpur   Bahawalpur Saddar  387038  574950 187912
 7 Punjab   Bahawalpur Bahawalnagar Bahawalnagar       541553  815143 273590
 8 Punjab   Bahawalpur Bahawalnagar Chishtian          498270  691221 192951
 9 Punjab   Bahawalpur Bahawalnagar Haroonabad         381767  525598 143831
10 Punjab   Bahawalpur Bahawalnagar Fort Abbas          92777  153444  60667
# ℹ 533 more rows</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb160" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span>, diff <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop1998</span>, add <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop1998</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 543 × 8
   Province Division   District     Tehsil         Pop1998 Pop2017   diff    add
   &lt;chr&gt;    &lt;chr&gt;      &lt;chr&gt;        &lt;chr&gt;            &lt;dbl&gt;   &lt;dbl&gt;  &lt;dbl&gt;  &lt;dbl&gt;
 1 Punjab   Bahawalpur Bahawalpur   Hasilpur        317513  456006 138493 7.74e5
 2 Punjab   Bahawalpur Bahawalpur   Khairpur Tame…  183903  262628  78725 4.47e5
 3 Punjab   Bahawalpur Bahawalpur   Yazman          168950  262175  93225 4.31e5
 4 Punjab   Bahawalpur Bahawalpur   Ahmadpur East   718297 1078683 360386 1.80e6
 5 Punjab   Bahawalpur Bahawalpur   Bahawalpur Ci…  419542  681696 262154 1.10e6
 6 Punjab   Bahawalpur Bahawalpur   Bahawalpur Sa…  387038  574950 187912 9.62e5
 7 Punjab   Bahawalpur Bahawalnagar Bahawalnagar    541553  815143 273590 1.36e6
 8 Punjab   Bahawalpur Bahawalnagar Chishtian       498270  691221 192951 1.19e6
 9 Punjab   Bahawalpur Bahawalnagar Haroonabad      381767  525598 143831 9.07e5
10 Punjab   Bahawalpur Bahawalnagar Fort Abbas       92777  153444  60667 2.46e5
# ℹ 533 more rows</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb162" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">newData</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/mutate.html">mutate</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">tehsil</span>, new <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/ifelse.html">ifelse</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Province</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Punjab"</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span>,</span>
<span>                            <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/ifelse.html">ifelse</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Province</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">==</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Sindh"</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">2</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">3</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">newData</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 543 × 7
   Province Division   District     Tehsil            Pop1998 Pop2017   new
   &lt;chr&gt;    &lt;chr&gt;      &lt;chr&gt;        &lt;chr&gt;               &lt;dbl&gt;   &lt;dbl&gt; &lt;dbl&gt;
 1 Punjab   Bahawalpur Bahawalpur   Hasilpur           317513  456006     1
 2 Punjab   Bahawalpur Bahawalpur   Khairpur Tamewali  183903  262628     1
 3 Punjab   Bahawalpur Bahawalpur   Yazman             168950  262175     1
 4 Punjab   Bahawalpur Bahawalpur   Ahmadpur East      718297 1078683     1
 5 Punjab   Bahawalpur Bahawalpur   Bahawalpur City    419542  681696     1
 6 Punjab   Bahawalpur Bahawalpur   Bahawalpur Saddar  387038  574950     1
 7 Punjab   Bahawalpur Bahawalnagar Bahawalnagar       541553  815143     1
 8 Punjab   Bahawalpur Bahawalnagar Chishtian          498270  691221     1
 9 Punjab   Bahawalpur Bahawalnagar Haroonabad         381767  525598     1
10 Punjab   Bahawalpur Bahawalnagar Fort Abbas          92777  153444     1
# ℹ 533 more rows</code></pre>
</div>
</div>
</section><section id="pakpc2017tehsil-data-frame" class="level2"><h2 class="anchored" data-anchor-id="pakpc2017tehsil-data-frame">PakPC2017Tehsil Data Frame</h2>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb164" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">plotUnit</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span>  <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Province</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    Pop2017 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span>, na.rm <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>    , Pop1998 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop1998</span>, na.rm <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/match.html">%in%</a></span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Faisalabad"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Lahore"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tidyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://tidyr.tidyverse.org/reference/gather.html">gather</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    key   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Census"</span></span>
<span>    , value <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Population"</span></span>
<span>    , <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Pop2017"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Pop1998"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/utils/head.html">head</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">plotUnit</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output cell-output-stdout">
<pre><code># A tibble: 4 × 4
# Groups:   Province [1]
  Province Division   Census  Population
  &lt;chr&gt;    &lt;chr&gt;      &lt;chr&gt;        &lt;dbl&gt;
1 Punjab   Faisalabad Pop2017   14177081
2 Punjab   Lahore     Pop2017   19398081
3 Punjab   Faisalabad Pop1998    9885685
4 Punjab   Lahore     Pop1998   12015649</code></pre>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb166" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">plotUnit</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Population</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/PakPC2017-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-15"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/PakPC2017-1.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb167" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">plotUnit</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Population</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_col</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/PakPC2017-2.png" class="lightbox" data-gallery="quarto-lightbox-gallery-16"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/PakPC2017-2.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb168" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">plotUnit</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Population</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_col</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>labels<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/comma.html">comma</a></span>, expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/PakPC2017-3.png" class="lightbox" data-gallery="quarto-lightbox-gallery-17"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/PakPC2017-3.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb169" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">plotUnit</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Population</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>stat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"identity"</span>, position <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/position_dodge.html">position_dodge</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>width <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>labels<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/comma.html">comma</a></span>, expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/PakPC2017-4.png" class="lightbox" data-gallery="quarto-lightbox-gallery-18"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/PakPC2017-4.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb170" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">plotUnit</span>,</span>
<span>          mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Population</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Census</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>stat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"identity"</span>, position <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/position_dodge.html">position_dodge</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>width <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>labels<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/comma.html">comma</a></span>, expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/PakPC2017-5.png" class="lightbox" data-gallery="quarto-lightbox-gallery-19"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/PakPC2017-5.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb171" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">plotUnit</span>,</span>
<span>          mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Population</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Census</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>stat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"identity"</span>, position <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/position_dodge.html">position_dodge</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>width <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>labels<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/comma.html">comma</a></span>, expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_text.html">geom_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/comma.html">comma</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Population</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>,</span>
<span>            position<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/position_dodge.html">position_dodge</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>width <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, vjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/PakPC2017-6.png" class="lightbox" data-gallery="quarto-lightbox-gallery-20"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/PakPC2017-6.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb172" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">plotUnit</span>,</span>
<span>          mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Population</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Census</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>stat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"identity"</span>, position <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/position_dodge.html">position_dodge</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>width <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>labels<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/comma.html">comma</a></span>, expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_text.html">geom_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/comma.html">comma</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Population</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>,</span>
<span>            position<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/position_dodge.html">position_dodge</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>width <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, vjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/facet_wrap.html">facet_wrap</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Province</span>, scales <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"free_x"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/PakPC2017-7.png" class="lightbox" data-gallery="quarto-lightbox-gallery-21"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/PakPC2017-7.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb173" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">plotUnit</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span></span>
<span>  <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/group_by.html">group_by</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Province</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/summarise.html">summarize</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    Pop2017 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span>, na.rm <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>    , Pop1998 <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/sum.html">sum</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop1998</span>, na.rm <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">dplyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://dplyr.tidyverse.org/reference/filter.html">filter</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/match.html">%in%</a></span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Faisalabad"</span>,<span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Lahore"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Karachi"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Quetta"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">tidyr</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://tidyr.tidyverse.org/reference/gather.html">gather</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span></span>
<span>    key   <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Census"</span></span>
<span>    , value <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Population"</span></span>
<span>    , <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Province</span>, <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">-</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span></span>
<span>  <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">plotUnit</span>,</span>
<span>          mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Division</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Population</span>, fill <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Census</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_bar.html">geom_bar</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>stat <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"identity"</span>, position <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/position_dodge.html">position_dodge</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>width <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">.9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/scale_continuous.html">scale_y_continuous</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>labels<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/comma.html">comma</a></span>, expand <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/c.html">c</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>, <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_text.html">geom_text</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>label<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">scales</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://scales.r-lib.org/reference/comma.html">comma</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Population</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>,</span>
<span>            position<span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/position_dodge.html">position_dodge</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>width <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.9</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, vjust <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0.8</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/facet_wrap.html">facet_wrap</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">~</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Province</span>, scales <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"free_x"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/PakPC2017-8.png" class="lightbox" data-gallery="quarto-lightbox-gallery-22"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/PakPC2017-8.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb174" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Pakistan</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Province</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">g</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">ResStatus</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/theme.html">theme</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>legend.position <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"top"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/PakPC2017-9.png" class="lightbox" data-gallery="quarto-lightbox-gallery-23"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/PakPC2017-9.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section><section id="scatter-plot" class="level2"><h2 class="anchored" data-anchor-id="scatter-plot">Scatter Plot</h2>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb175" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">PakPC2017Tehsil</span>, <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop1998</span>,<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Pop2017</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_smooth.html">geom_smooth</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>method <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">lm</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div>
<figure class="figure"><p><a href="index_files/figure-html/scatter-1.png" class="lightbox" data-gallery="quarto-lightbox-gallery-24"><img src="https://myaseen208.com/blogs/2018-03-25_Maldives_R/index_files/figure-html/scatter-1.png" class="img-fluid figure-img" width="672"></a></p>
</figure>
</div>
</div>
</div>
</section><section id="dygraphs" class="level2"><h2 class="anchored" data-anchor-id="dygraphs">dygraphs</h2>
<p>The dygraphs package is an R interface to the dygraphs JavaScript charting library. It provides rich facilities for charting time-series data in R</p>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb176" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://github.com/rstudio/dygraphs">dygraphs</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/dygraphs/man/dygraph.html">dygraph</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">nhtemp</span>, main <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"New Haven Temperatures"</span>, ylab <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Temp (F)"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="dygraphs html-widget html-fill-item" id="htmlwidget-59786ac3c192e31e6275" style="width:100%;height:464px;"></div>
<script type="application/json" data-for="htmlwidget-59786ac3c192e31e6275">{"x":{"attrs":{"title":"New Haven Temperatures","ylabel":"Temp (F)","labels":["year","V1"],"legend":"auto","retainDateWindow":false,"axes":{"x":{"pixelsPerLabel":60}}},"scale":"yearly","annotations":[],"shadings":[],"events":[],"format":"date","data":[["1912-01-01T00:00:00.000Z","1913-01-01T00:00:00.000Z","1914-01-01T00:00:00.000Z","1915-01-01T00:00:00.000Z","1916-01-01T00:00:00.000Z","1917-01-01T00:00:00.000Z","1918-01-01T00:00:00.000Z","1919-01-01T00:00:00.000Z","1920-01-01T00:00:00.000Z","1921-01-01T00:00:00.000Z","1922-01-01T00:00:00.000Z","1923-01-01T00:00:00.000Z","1924-01-01T00:00:00.000Z","1925-01-01T00:00:00.000Z","1926-01-01T00:00:00.000Z","1927-01-01T00:00:00.000Z","1928-01-01T00:00:00.000Z","1929-01-01T00:00:00.000Z","1930-01-01T00:00:00.000Z","1931-01-01T00:00:00.000Z","1932-01-01T00:00:00.000Z","1933-01-01T00:00:00.000Z","1934-01-01T00:00:00.000Z","1935-01-01T00:00:00.000Z","1936-01-01T00:00:00.000Z","1937-01-01T00:00:00.000Z","1938-01-01T00:00:00.000Z","1939-01-01T00:00:00.000Z","1940-01-01T00:00:00.000Z","1941-01-01T00:00:00.000Z","1942-01-01T00:00:00.000Z","1943-01-01T00:00:00.000Z","1944-01-01T00:00:00.000Z","1945-01-01T00:00:00.000Z","1946-01-01T00:00:00.000Z","1947-01-01T00:00:00.000Z","1948-01-01T00:00:00.000Z","1949-01-01T00:00:00.000Z","1950-01-01T00:00:00.000Z","1951-01-01T00:00:00.000Z","1952-01-01T00:00:00.000Z","1953-01-01T00:00:00.000Z","1954-01-01T00:00:00.000Z","1955-01-01T00:00:00.000Z","1956-01-01T00:00:00.000Z","1957-01-01T00:00:00.000Z","1958-01-01T00:00:00.000Z","1959-01-01T00:00:00.000Z","1960-01-01T00:00:00.000Z","1961-01-01T00:00:00.000Z","1962-01-01T00:00:00.000Z","1963-01-01T00:00:00.000Z","1964-01-01T00:00:00.000Z","1965-01-01T00:00:00.000Z","1966-01-01T00:00:00.000Z","1967-01-01T00:00:00.000Z","1968-01-01T00:00:00.000Z","1969-01-01T00:00:00.000Z","1970-01-01T00:00:00.000Z","1971-01-01T00:00:00.000Z"],[49.9,52.3,49.4,51.1,49.4,47.9,49.8,50.9,49.3,51.9,50.8,49.6,49.3,50.6,48.4,50.7,50.9,50.6,51.5,52.8,51.8,51.1,49.8,50.2,50.4,51.6,51.8,50.9,48.8,51.7,51,50.6,51.7,51.5,52.1,51.3,51,54,51.4,52.7,53.1,54.6,52,52,50.9,52.6,50.2,52.6,51.6,51.9,50.5,50.9,51.7,51.4,51.7,50.8,51.9,51.8,51.9,53]]},"evals":[],"jsHooks":[]}</script>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb177" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">lungDeaths</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/cbind.html">cbind</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">mdeaths</span>, <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">fdeaths</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/dygraphs/man/dygraph.html">dygraph</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">lungDeaths</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="dygraphs html-widget html-fill-item" id="htmlwidget-5ee5ad0b49a2280b3f87" style="width:100%;height:464px;"></div>
<script type="application/json" data-for="htmlwidget-5ee5ad0b49a2280b3f87">{"x":{"attrs":{"labels":["month","mdeaths","fdeaths"],"legend":"auto","retainDateWindow":false,"axes":{"x":{"pixelsPerLabel":60}}},"scale":"monthly","annotations":[],"shadings":[],"events":[],"format":"date","data":[["1974-01-01T00:00:00.000Z","1974-02-01T00:00:00.000Z","1974-03-01T00:00:00.000Z","1974-04-01T00:00:00.000Z","1974-05-01T00:00:00.000Z","1974-06-01T00:00:00.000Z","1974-07-01T00:00:00.000Z","1974-08-01T00:00:00.000Z","1974-09-01T00:00:00.000Z","1974-10-01T00:00:00.000Z","1974-11-01T00:00:00.000Z","1974-12-01T00:00:00.000Z","1975-01-01T00:00:00.000Z","1975-02-01T00:00:00.000Z","1975-03-01T00:00:00.000Z","1975-04-01T00:00:00.000Z","1975-05-01T00:00:00.000Z","1975-06-01T00:00:00.000Z","1975-07-01T00:00:00.000Z","1975-08-01T00:00:00.000Z","1975-09-01T00:00:00.000Z","1975-10-01T00:00:00.000Z","1975-11-01T00:00:00.000Z","1975-12-01T00:00:00.000Z","1976-01-01T00:00:00.000Z","1976-02-01T00:00:00.000Z","1976-03-01T00:00:00.000Z","1976-04-01T00:00:00.000Z","1976-05-01T00:00:00.000Z","1976-06-01T00:00:00.000Z","1976-07-01T00:00:00.000Z","1976-08-01T00:00:00.000Z","1976-09-01T00:00:00.000Z","1976-10-01T00:00:00.000Z","1976-11-01T00:00:00.000Z","1976-12-01T00:00:00.000Z","1977-01-01T00:00:00.000Z","1977-02-01T00:00:00.000Z","1977-03-01T00:00:00.000Z","1977-04-01T00:00:00.000Z","1977-05-01T00:00:00.000Z","1977-06-01T00:00:00.000Z","1977-07-01T00:00:00.000Z","1977-08-01T00:00:00.000Z","1977-09-01T00:00:00.000Z","1977-10-01T00:00:00.000Z","1977-11-01T00:00:00.000Z","1977-12-01T00:00:00.000Z","1978-01-01T00:00:00.000Z","1978-02-01T00:00:00.000Z","1978-03-01T00:00:00.000Z","1978-04-01T00:00:00.000Z","1978-05-01T00:00:00.000Z","1978-06-01T00:00:00.000Z","1978-07-01T00:00:00.000Z","1978-08-01T00:00:00.000Z","1978-09-01T00:00:00.000Z","1978-10-01T00:00:00.000Z","1978-11-01T00:00:00.000Z","1978-12-01T00:00:00.000Z","1979-01-01T00:00:00.000Z","1979-02-01T00:00:00.000Z","1979-03-01T00:00:00.000Z","1979-04-01T00:00:00.000Z","1979-05-01T00:00:00.000Z","1979-06-01T00:00:00.000Z","1979-07-01T00:00:00.000Z","1979-08-01T00:00:00.000Z","1979-09-01T00:00:00.000Z","1979-10-01T00:00:00.000Z","1979-11-01T00:00:00.000Z","1979-12-01T00:00:00.000Z"],[2134,1863,1877,1877,1492,1249,1280,1131,1209,1492,1621,1846,2103,2137,2153,1833,1403,1288,1186,1133,1053,1347,1545,2066,2020,2750,2283,1479,1189,1160,1113,970,999,1208,1467,2059,2240,1634,1722,1801,1246,1162,1087,1013,959,1179,1229,1655,2019,2284,1942,1423,1340,1187,1098,1004,970,1140,1110,1812,2263,1820,1846,1531,1215,1075,1056,975,940,1081,1294,1341],[901,689,827,677,522,406,441,393,387,582,578,666,830,752,785,664,467,438,421,412,343,440,531,771,767,1141,896,532,447,420,376,330,357,445,546,764,862,660,663,643,502,392,411,348,387,385,411,638,796,853,737,546,530,446,431,362,387,430,425,679,821,785,727,612,478,429,405,379,393,411,487,574]]},"evals":[],"jsHooks":[]}</script>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb178" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/dygraphs/man/dygraph.html">dygraph</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">lungDeaths</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/dygraphs/man/dyRangeSelector.html">dyRangeSelector</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="dygraphs html-widget html-fill-item" id="htmlwidget-64c2414d252490ec0116" style="width:100%;height:464px;"></div>
<script type="application/json" data-for="htmlwidget-64c2414d252490ec0116">{"x":{"attrs":{"labels":["month","mdeaths","fdeaths"],"legend":"auto","retainDateWindow":false,"axes":{"x":{"pixelsPerLabel":60}},"showRangeSelector":true,"rangeSelectorHeight":40,"rangeSelectorPlotFillColor":" #A7B1C4","rangeSelectorPlotStrokeColor":"#808FAB","interactionModel":"Dygraph.Interaction.defaultModel"},"scale":"monthly","annotations":[],"shadings":[],"events":[],"format":"date","data":[["1974-01-01T00:00:00.000Z","1974-02-01T00:00:00.000Z","1974-03-01T00:00:00.000Z","1974-04-01T00:00:00.000Z","1974-05-01T00:00:00.000Z","1974-06-01T00:00:00.000Z","1974-07-01T00:00:00.000Z","1974-08-01T00:00:00.000Z","1974-09-01T00:00:00.000Z","1974-10-01T00:00:00.000Z","1974-11-01T00:00:00.000Z","1974-12-01T00:00:00.000Z","1975-01-01T00:00:00.000Z","1975-02-01T00:00:00.000Z","1975-03-01T00:00:00.000Z","1975-04-01T00:00:00.000Z","1975-05-01T00:00:00.000Z","1975-06-01T00:00:00.000Z","1975-07-01T00:00:00.000Z","1975-08-01T00:00:00.000Z","1975-09-01T00:00:00.000Z","1975-10-01T00:00:00.000Z","1975-11-01T00:00:00.000Z","1975-12-01T00:00:00.000Z","1976-01-01T00:00:00.000Z","1976-02-01T00:00:00.000Z","1976-03-01T00:00:00.000Z","1976-04-01T00:00:00.000Z","1976-05-01T00:00:00.000Z","1976-06-01T00:00:00.000Z","1976-07-01T00:00:00.000Z","1976-08-01T00:00:00.000Z","1976-09-01T00:00:00.000Z","1976-10-01T00:00:00.000Z","1976-11-01T00:00:00.000Z","1976-12-01T00:00:00.000Z","1977-01-01T00:00:00.000Z","1977-02-01T00:00:00.000Z","1977-03-01T00:00:00.000Z","1977-04-01T00:00:00.000Z","1977-05-01T00:00:00.000Z","1977-06-01T00:00:00.000Z","1977-07-01T00:00:00.000Z","1977-08-01T00:00:00.000Z","1977-09-01T00:00:00.000Z","1977-10-01T00:00:00.000Z","1977-11-01T00:00:00.000Z","1977-12-01T00:00:00.000Z","1978-01-01T00:00:00.000Z","1978-02-01T00:00:00.000Z","1978-03-01T00:00:00.000Z","1978-04-01T00:00:00.000Z","1978-05-01T00:00:00.000Z","1978-06-01T00:00:00.000Z","1978-07-01T00:00:00.000Z","1978-08-01T00:00:00.000Z","1978-09-01T00:00:00.000Z","1978-10-01T00:00:00.000Z","1978-11-01T00:00:00.000Z","1978-12-01T00:00:00.000Z","1979-01-01T00:00:00.000Z","1979-02-01T00:00:00.000Z","1979-03-01T00:00:00.000Z","1979-04-01T00:00:00.000Z","1979-05-01T00:00:00.000Z","1979-06-01T00:00:00.000Z","1979-07-01T00:00:00.000Z","1979-08-01T00:00:00.000Z","1979-09-01T00:00:00.000Z","1979-10-01T00:00:00.000Z","1979-11-01T00:00:00.000Z","1979-12-01T00:00:00.000Z"],[2134,1863,1877,1877,1492,1249,1280,1131,1209,1492,1621,1846,2103,2137,2153,1833,1403,1288,1186,1133,1053,1347,1545,2066,2020,2750,2283,1479,1189,1160,1113,970,999,1208,1467,2059,2240,1634,1722,1801,1246,1162,1087,1013,959,1179,1229,1655,2019,2284,1942,1423,1340,1187,1098,1004,970,1140,1110,1812,2263,1820,1846,1531,1215,1075,1056,975,940,1081,1294,1341],[901,689,827,677,522,406,441,393,387,582,578,666,830,752,785,664,467,438,421,412,343,440,531,771,767,1141,896,532,447,420,376,330,357,445,546,764,862,660,663,643,502,392,411,348,387,385,411,638,796,853,737,546,530,446,431,362,387,430,425,679,821,785,727,612,478,429,405,379,393,411,487,574]]},"evals":["attrs.interactionModel"],"jsHooks":[]}</script>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb179" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/dygraphs/man/dygraph.html">dygraph</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">lungDeaths</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/dygraphs/man/dySeries.html">dySeries</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"mdeaths"</span>, label <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Male"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/dygraphs/man/dySeries.html">dySeries</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"fdeaths"</span>, label <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"Female"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/dygraphs/man/dyOptions.html">dyOptions</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>stackedGraph <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;"><a href="https://magrittr.tidyverse.org/reference/pipe.html">%&gt;%</a></span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/dygraphs/man/dyRangeSelector.html">dyRangeSelector</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>height <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">10</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="dygraphs html-widget html-fill-item" id="htmlwidget-94e3c9c24c220871443b" style="width:100%;height:464px;"></div>
<script type="application/json" data-for="htmlwidget-94e3c9c24c220871443b">{"x":{"attrs":{"labels":["month","Male","Female"],"legend":"auto","retainDateWindow":false,"axes":{"x":{"pixelsPerLabel":60,"drawAxis":true},"y":{"drawAxis":true}},"series":{"Male":{"axis":"y"},"Female":{"axis":"y"}},"stackedGraph":true,"fillGraph":false,"fillAlpha":0.15,"stepPlot":false,"drawPoints":false,"pointSize":1,"drawGapEdgePoints":false,"connectSeparatedPoints":false,"strokeWidth":1,"strokeBorderColor":"white","colorValue":0.5,"colorSaturation":1,"includeZero":false,"drawAxesAtZero":false,"logscale":false,"axisTickSize":3,"axisLineColor":"black","axisLineWidth":0.3,"axisLabelColor":"black","axisLabelFontSize":14,"axisLabelWidth":60,"drawGrid":true,"gridLineWidth":0.3,"rightGap":5,"digitsAfterDecimal":2,"labelsKMB":false,"labelsKMG2":false,"labelsUTC":false,"maxNumberWidth":6,"animatedZooms":false,"mobileDisableYTouch":true,"disableZoom":false,"showRangeSelector":true,"rangeSelectorHeight":10,"rangeSelectorPlotFillColor":" #A7B1C4","rangeSelectorPlotStrokeColor":"#808FAB","interactionModel":"Dygraph.Interaction.defaultModel"},"scale":"monthly","annotations":[],"shadings":[],"events":[],"format":"date","data":[["1974-01-01T00:00:00.000Z","1974-02-01T00:00:00.000Z","1974-03-01T00:00:00.000Z","1974-04-01T00:00:00.000Z","1974-05-01T00:00:00.000Z","1974-06-01T00:00:00.000Z","1974-07-01T00:00:00.000Z","1974-08-01T00:00:00.000Z","1974-09-01T00:00:00.000Z","1974-10-01T00:00:00.000Z","1974-11-01T00:00:00.000Z","1974-12-01T00:00:00.000Z","1975-01-01T00:00:00.000Z","1975-02-01T00:00:00.000Z","1975-03-01T00:00:00.000Z","1975-04-01T00:00:00.000Z","1975-05-01T00:00:00.000Z","1975-06-01T00:00:00.000Z","1975-07-01T00:00:00.000Z","1975-08-01T00:00:00.000Z","1975-09-01T00:00:00.000Z","1975-10-01T00:00:00.000Z","1975-11-01T00:00:00.000Z","1975-12-01T00:00:00.000Z","1976-01-01T00:00:00.000Z","1976-02-01T00:00:00.000Z","1976-03-01T00:00:00.000Z","1976-04-01T00:00:00.000Z","1976-05-01T00:00:00.000Z","1976-06-01T00:00:00.000Z","1976-07-01T00:00:00.000Z","1976-08-01T00:00:00.000Z","1976-09-01T00:00:00.000Z","1976-10-01T00:00:00.000Z","1976-11-01T00:00:00.000Z","1976-12-01T00:00:00.000Z","1977-01-01T00:00:00.000Z","1977-02-01T00:00:00.000Z","1977-03-01T00:00:00.000Z","1977-04-01T00:00:00.000Z","1977-05-01T00:00:00.000Z","1977-06-01T00:00:00.000Z","1977-07-01T00:00:00.000Z","1977-08-01T00:00:00.000Z","1977-09-01T00:00:00.000Z","1977-10-01T00:00:00.000Z","1977-11-01T00:00:00.000Z","1977-12-01T00:00:00.000Z","1978-01-01T00:00:00.000Z","1978-02-01T00:00:00.000Z","1978-03-01T00:00:00.000Z","1978-04-01T00:00:00.000Z","1978-05-01T00:00:00.000Z","1978-06-01T00:00:00.000Z","1978-07-01T00:00:00.000Z","1978-08-01T00:00:00.000Z","1978-09-01T00:00:00.000Z","1978-10-01T00:00:00.000Z","1978-11-01T00:00:00.000Z","1978-12-01T00:00:00.000Z","1979-01-01T00:00:00.000Z","1979-02-01T00:00:00.000Z","1979-03-01T00:00:00.000Z","1979-04-01T00:00:00.000Z","1979-05-01T00:00:00.000Z","1979-06-01T00:00:00.000Z","1979-07-01T00:00:00.000Z","1979-08-01T00:00:00.000Z","1979-09-01T00:00:00.000Z","1979-10-01T00:00:00.000Z","1979-11-01T00:00:00.000Z","1979-12-01T00:00:00.000Z"],[2134,1863,1877,1877,1492,1249,1280,1131,1209,1492,1621,1846,2103,2137,2153,1833,1403,1288,1186,1133,1053,1347,1545,2066,2020,2750,2283,1479,1189,1160,1113,970,999,1208,1467,2059,2240,1634,1722,1801,1246,1162,1087,1013,959,1179,1229,1655,2019,2284,1942,1423,1340,1187,1098,1004,970,1140,1110,1812,2263,1820,1846,1531,1215,1075,1056,975,940,1081,1294,1341],[901,689,827,677,522,406,441,393,387,582,578,666,830,752,785,664,467,438,421,412,343,440,531,771,767,1141,896,532,447,420,376,330,357,445,546,764,862,660,663,643,502,392,411,348,387,385,411,638,796,853,737,546,530,446,431,362,387,430,425,679,821,785,727,612,478,429,405,379,393,411,487,574]],"fixedtz":false,"tzone":""},"evals":["attrs.interactionModel"],"jsHooks":[]}</script>
</div>
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb180" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Year</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/seq.html">seq</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>from <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/as.Date.html">as.Date</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"1990/1/1"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, to <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/base/as.Date.html">as.Date</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2018/1/1"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span>, by <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"years"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">prod</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/r/stats/Normal.html">rnorm</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">29</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">0</span>,<span class="fl" style="color: #AD0000;
background-color: null;
font-style: inherit;">1</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">timeSeries</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">xts</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/xts/man/xts.html">xts</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">prod</span>,<span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">Year</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/dygraphs/man/dygraph.html">dygraph</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">timeSeries</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="dygraphs html-widget html-fill-item" id="htmlwidget-8b28fccb1b14344f8605" style="width:100%;height:464px;"></div>
<script type="application/json" data-for="htmlwidget-8b28fccb1b14344f8605">{"x":{"attrs":{"labels":["year","V1"],"legend":"auto","retainDateWindow":false,"axes":{"x":{"pixelsPerLabel":60}}},"scale":"yearly","annotations":[],"shadings":[],"events":[],"format":"date","data":[["1990-01-01T00:00:00.000Z","1991-01-01T00:00:00.000Z","1992-01-01T00:00:00.000Z","1993-01-01T00:00:00.000Z","1994-01-01T00:00:00.000Z","1995-01-01T00:00:00.000Z","1996-01-01T00:00:00.000Z","1997-01-01T00:00:00.000Z","1998-01-01T00:00:00.000Z","1999-01-01T00:00:00.000Z","2000-01-01T00:00:00.000Z","2001-01-01T00:00:00.000Z","2002-01-01T00:00:00.000Z","2003-01-01T00:00:00.000Z","2004-01-01T00:00:00.000Z","2005-01-01T00:00:00.000Z","2006-01-01T00:00:00.000Z","2007-01-01T00:00:00.000Z","2008-01-01T00:00:00.000Z","2009-01-01T00:00:00.000Z","2010-01-01T00:00:00.000Z","2011-01-01T00:00:00.000Z","2012-01-01T00:00:00.000Z","2013-01-01T00:00:00.000Z","2014-01-01T00:00:00.000Z","2015-01-01T00:00:00.000Z","2016-01-01T00:00:00.000Z","2017-01-01T00:00:00.000Z","2018-01-01T00:00:00.000Z"],[2.31356644176633,0.7953163722267933,0.5763012735616274,-1.680340662613964,-0.3353393897312458,1.35062912332092,0.3463393637330436,-2.230965214090517,-0.5429549253033756,0.4695353936861326,0.02343066478687821,-1.312104593481295,0.9802235872723423,-0.1220721020475458,-0.05874340341723835,0.9103401675765448,-0.03148145851501784,0.2402301536864014,1.060758914137779,-0.4968716391553752,-0.221676984980439,-1.010204973297416,1.766689019851677,-1.851366004377037,0.09339640015618254,-0.6481975402682221,-0.830944164196168,0.02306819728831412,-0.3202345926801177]]},"evals":[],"jsHooks":[]}</script>
</div>
</div>
</section><section id="plotly" class="level2"><h2 class="anchored" data-anchor-id="plotly">plotly</h2>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb181" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org">ggplot2</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://plotly-r.com">plotly</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">myPlot</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/ggplot.html">ggplot</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>data <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">mpg</span>, mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>x <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">displ</span>, y <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">hwy</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_point.html">geom_point</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>color <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">drv</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">+</span></span>
<span>  <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/geom_smooth.html">geom_smooth</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>mapping <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://ggplot2.tidyverse.org/reference/aes.html">aes</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span>linetype <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">drv</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/plotly/man/ggplotly.html">ggplotly</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">myPlot</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
<div class="cell-output-display">
<div class="plotly html-widget html-fill-item" id="htmlwidget-283df73d5b38d8ab2158" style="width:100%;height:464px;"></div>
<script type="application/json" data-for="htmlwidget-283df73d5b38d8ab2158">{"x":{"data":[{"x":[1.8,1.8,2,2,2.7999999999999998,2.7999999999999998,3.1000000000000001,3.1000000000000001,2.7999999999999998,3.1000000000000001,4.2000000000000002,5.2999999999999998,5.2999999999999998,5.7000000000000002,6.5,3.7000000000000002,3.7000000000000002,3.8999999999999999,3.8999999999999999,4.7000000000000002,4.7000000000000002,4.7000000000000002,5.2000000000000002,5.2000000000000002,3.8999999999999999,4.7000000000000002,4.7000000000000002,4.7000000000000002,5.2000000000000002,5.7000000000000002,5.9000000000000004,4.7000000000000002,4.7000000000000002,4.7000000000000002,4.7000000000000002,4.7000000000000002,4.7000000000000002,5.2000000000000002,5.2000000000000002,5.7000000000000002,5.9000000000000004,4,4,4,4,4.5999999999999996,5,4.2000000000000002,4.2000000000000002,4.5999999999999996,4.5999999999999996,4.5999999999999996,5.4000000000000004,5.4000000000000004,3,3.7000000000000002,4,4.7000000000000002,4.7000000000000002,4.7000000000000002,5.7000000000000002,6.0999999999999996,4,4.2000000000000002,4.4000000000000004,4.5999999999999996,4,4,4.5999999999999996,5,3.2999999999999998,3.2999999999999998,4,5.5999999999999996,2.5,2.5,2.5,2.5,2.5,2.5,2.2000000000000002,2.2000000000000002,2.5,2.5,2.5,2.5,2.5,2.5,2.7000000000000002,2.7000000000000002,3.3999999999999999,3.3999999999999999,4,4.7000000000000002,4.7000000000000002,5.7000000000000002,2.7000000000000002,2.7000000000000002,2.7000000000000002,3.3999999999999999,3.3999999999999999,4,4],"y":[26,25,28,27,25,25,25,25,24,25,23,19,14,15,17,19,18,17,17,19,19,12,17,15,17,17,12,17,16,18,15,16,12,17,17,16,12,15,16,17,15,17,19,17,19,19,17,17,17,16,16,17,15,17,22,19,20,17,12,19,18,14,15,18,18,15,17,19,19,17,17,17,20,18,25,24,27,25,26,23,26,26,26,26,25,27,25,27,20,20,19,17,20,17,15,18,20,20,22,17,19,18,20],"text":["displ: 1.8<br />hwy: 26<br />drv: 4","displ: 1.8<br />hwy: 25<br />drv: 4","displ: 2.0<br />hwy: 28<br />drv: 4","displ: 2.0<br />hwy: 27<br />drv: 4","displ: 2.8<br />hwy: 25<br />drv: 4","displ: 2.8<br />hwy: 25<br />drv: 4","displ: 3.1<br />hwy: 25<br />drv: 4","displ: 3.1<br />hwy: 25<br />drv: 4","displ: 2.8<br />hwy: 24<br />drv: 4","displ: 3.1<br />hwy: 25<br />drv: 4","displ: 4.2<br />hwy: 23<br />drv: 4","displ: 5.3<br />hwy: 19<br />drv: 4","displ: 5.3<br />hwy: 14<br />drv: 4","displ: 5.7<br />hwy: 15<br />drv: 4","displ: 6.5<br />hwy: 17<br />drv: 4","displ: 3.7<br />hwy: 19<br />drv: 4","displ: 3.7<br />hwy: 18<br />drv: 4","displ: 3.9<br />hwy: 17<br />drv: 4","displ: 3.9<br />hwy: 17<br />drv: 4","displ: 4.7<br />hwy: 19<br />drv: 4","displ: 4.7<br />hwy: 19<br />drv: 4","displ: 4.7<br />hwy: 12<br />drv: 4","displ: 5.2<br />hwy: 17<br />drv: 4","displ: 5.2<br />hwy: 15<br />drv: 4","displ: 3.9<br />hwy: 17<br />drv: 4","displ: 4.7<br />hwy: 17<br />drv: 4","displ: 4.7<br />hwy: 12<br />drv: 4","displ: 4.7<br />hwy: 17<br />drv: 4","displ: 5.2<br />hwy: 16<br />drv: 4","displ: 5.7<br />hwy: 18<br />drv: 4","displ: 5.9<br />hwy: 15<br />drv: 4","displ: 4.7<br />hwy: 16<br />drv: 4","displ: 4.7<br />hwy: 12<br />drv: 4","displ: 4.7<br />hwy: 17<br />drv: 4","displ: 4.7<br />hwy: 17<br />drv: 4","displ: 4.7<br />hwy: 16<br />drv: 4","displ: 4.7<br />hwy: 12<br />drv: 4","displ: 5.2<br />hwy: 15<br />drv: 4","displ: 5.2<br />hwy: 16<br />drv: 4","displ: 5.7<br />hwy: 17<br />drv: 4","displ: 5.9<br />hwy: 15<br />drv: 4","displ: 4.0<br />hwy: 17<br />drv: 4","displ: 4.0<br />hwy: 19<br />drv: 4","displ: 4.0<br />hwy: 17<br />drv: 4","displ: 4.0<br />hwy: 19<br />drv: 4","displ: 4.6<br />hwy: 19<br />drv: 4","displ: 5.0<br />hwy: 17<br />drv: 4","displ: 4.2<br />hwy: 17<br />drv: 4","displ: 4.2<br />hwy: 17<br />drv: 4","displ: 4.6<br />hwy: 16<br />drv: 4","displ: 4.6<br />hwy: 16<br />drv: 4","displ: 4.6<br />hwy: 17<br />drv: 4","displ: 5.4<br />hwy: 15<br />drv: 4","displ: 5.4<br />hwy: 17<br />drv: 4","displ: 3.0<br />hwy: 22<br />drv: 4","displ: 3.7<br />hwy: 19<br />drv: 4","displ: 4.0<br />hwy: 20<br />drv: 4","displ: 4.7<br />hwy: 17<br />drv: 4","displ: 4.7<br />hwy: 12<br />drv: 4","displ: 4.7<br />hwy: 19<br />drv: 4","displ: 5.7<br />hwy: 18<br />drv: 4","displ: 6.1<br />hwy: 14<br />drv: 4","displ: 4.0<br />hwy: 15<br />drv: 4","displ: 4.2<br />hwy: 18<br />drv: 4","displ: 4.4<br />hwy: 18<br />drv: 4","displ: 4.6<br />hwy: 15<br />drv: 4","displ: 4.0<br />hwy: 17<br />drv: 4","displ: 4.0<br />hwy: 19<br />drv: 4","displ: 4.6<br />hwy: 19<br />drv: 4","displ: 5.0<br />hwy: 17<br />drv: 4","displ: 3.3<br />hwy: 17<br />drv: 4","displ: 3.3<br />hwy: 17<br />drv: 4","displ: 4.0<br />hwy: 20<br />drv: 4","displ: 5.6<br />hwy: 18<br />drv: 4","displ: 2.5<br />hwy: 25<br />drv: 4","displ: 2.5<br />hwy: 24<br />drv: 4","displ: 2.5<br />hwy: 27<br />drv: 4","displ: 2.5<br />hwy: 25<br />drv: 4","displ: 2.5<br />hwy: 26<br />drv: 4","displ: 2.5<br />hwy: 23<br />drv: 4","displ: 2.2<br />hwy: 26<br />drv: 4","displ: 2.2<br />hwy: 26<br />drv: 4","displ: 2.5<br />hwy: 26<br />drv: 4","displ: 2.5<br />hwy: 26<br />drv: 4","displ: 2.5<br />hwy: 25<br />drv: 4","displ: 2.5<br />hwy: 27<br />drv: 4","displ: 2.5<br />hwy: 25<br />drv: 4","displ: 2.5<br />hwy: 27<br />drv: 4","displ: 2.7<br />hwy: 20<br />drv: 4","displ: 2.7<br />hwy: 20<br />drv: 4","displ: 3.4<br />hwy: 19<br />drv: 4","displ: 3.4<br />hwy: 17<br />drv: 4","displ: 4.0<br />hwy: 20<br />drv: 4","displ: 4.7<br />hwy: 17<br />drv: 4","displ: 4.7<br />hwy: 15<br />drv: 4","displ: 5.7<br />hwy: 18<br />drv: 4","displ: 2.7<br />hwy: 20<br />drv: 4","displ: 2.7<br />hwy: 20<br />drv: 4","displ: 2.7<br />hwy: 22<br />drv: 4","displ: 3.4<br />hwy: 17<br />drv: 4","displ: 3.4<br />hwy: 19<br />drv: 4","displ: 4.0<br />hwy: 18<br />drv: 4","displ: 4.0<br />hwy: 20<br />drv: 4"],"type":"scatter","mode":"markers","marker":{"autocolorscale":false,"color":"rgba(248,118,109,1)","opacity":1,"size":5.6692913385826778,"symbol":"circle","line":{"width":1.8897637795275593,"color":"rgba(248,118,109,1)"}},"hoveron":"points","name":"(4,1)","legendgroup":"(4,1)","showlegend":true,"xaxis":"x","yaxis":"y","hoverinfo":"text","frame":null},{"x":[1.8,1.8,2,2,2.7999999999999998,2.7999999999999998,3.1000000000000001,2.3999999999999999,2.3999999999999999,3.1000000000000001,3.5,3.6000000000000001,2.3999999999999999,3,3.2999999999999998,3.2999999999999998,3.2999999999999998,3.2999999999999998,3.2999999999999998,3.7999999999999998,3.7999999999999998,3.7999999999999998,4,1.6000000000000001,1.6000000000000001,1.6000000000000001,1.6000000000000001,1.6000000000000001,1.8,1.8,1.8,2,2.3999999999999999,2.3999999999999999,2.3999999999999999,2.3999999999999999,2.5,2.5,3.2999999999999998,2,2,2,2,2.7000000000000002,2.7000000000000002,2.7000000000000002,2.3999999999999999,2.3999999999999999,2.5,2.5,3.5,3.5,3,3,3.5,3.1000000000000001,3.7999999999999998,3.7999999999999998,3.7999999999999998,5.2999999999999998,2.2000000000000002,2.2000000000000002,2.3999999999999999,2.3999999999999999,3,3,3.5,2.2000000000000002,2.2000000000000002,2.3999999999999999,2.3999999999999999,3,3,3.2999999999999998,1.8,1.8,1.8,1.8,1.8,2,2,2,2,2.7999999999999998,1.8999999999999999,2,2,2,2,2.5,2.5,2.7999999999999998,2.7999999999999998,1.8999999999999999,1.8999999999999999,2,2,2.5,2.5,1.8,1.8,2,2,2.7999999999999998,2.7999999999999998,3.6000000000000001],"y":[29,29,31,30,26,26,27,27,30,26,29,26,24,24,22,22,24,24,17,22,21,23,23,33,32,32,29,32,34,36,36,29,26,27,30,31,26,26,28,26,29,28,27,24,24,24,29,27,31,32,27,26,26,25,25,26,26,27,28,25,29,27,31,31,26,26,28,27,29,31,31,26,26,27,30,33,35,37,35,29,26,29,29,24,44,29,26,29,29,29,29,23,24,44,41,29,26,28,29,29,29,28,29,26,26,26],"text":["displ: 1.8<br />hwy: 29<br />drv: f","displ: 1.8<br />hwy: 29<br />drv: f","displ: 2.0<br />hwy: 31<br />drv: f","displ: 2.0<br />hwy: 30<br />drv: f","displ: 2.8<br />hwy: 26<br />drv: f","displ: 2.8<br />hwy: 26<br />drv: f","displ: 3.1<br />hwy: 27<br />drv: f","displ: 2.4<br />hwy: 27<br />drv: f","displ: 2.4<br />hwy: 30<br />drv: f","displ: 3.1<br />hwy: 26<br />drv: f","displ: 3.5<br />hwy: 29<br />drv: f","displ: 3.6<br />hwy: 26<br />drv: f","displ: 2.4<br />hwy: 24<br />drv: f","displ: 3.0<br />hwy: 24<br />drv: f","displ: 3.3<br />hwy: 22<br />drv: f","displ: 3.3<br />hwy: 22<br />drv: f","displ: 3.3<br />hwy: 24<br />drv: f","displ: 3.3<br />hwy: 24<br />drv: f","displ: 3.3<br />hwy: 17<br />drv: f","displ: 3.8<br />hwy: 22<br />drv: f","displ: 3.8<br />hwy: 21<br />drv: f","displ: 3.8<br />hwy: 23<br />drv: f","displ: 4.0<br />hwy: 23<br />drv: f","displ: 1.6<br />hwy: 33<br />drv: f","displ: 1.6<br />hwy: 32<br />drv: f","displ: 1.6<br />hwy: 32<br />drv: f","displ: 1.6<br />hwy: 29<br />drv: f","displ: 1.6<br />hwy: 32<br />drv: f","displ: 1.8<br />hwy: 34<br />drv: f","displ: 1.8<br />hwy: 36<br />drv: f","displ: 1.8<br />hwy: 36<br />drv: f","displ: 2.0<br />hwy: 29<br />drv: f","displ: 2.4<br />hwy: 26<br />drv: f","displ: 2.4<br />hwy: 27<br />drv: f","displ: 2.4<br />hwy: 30<br />drv: f","displ: 2.4<br />hwy: 31<br />drv: f","displ: 2.5<br />hwy: 26<br />drv: f","displ: 2.5<br />hwy: 26<br />drv: f","displ: 3.3<br />hwy: 28<br />drv: f","displ: 2.0<br />hwy: 26<br />drv: f","displ: 2.0<br />hwy: 29<br />drv: f","displ: 2.0<br />hwy: 28<br />drv: f","displ: 2.0<br />hwy: 27<br />drv: f","displ: 2.7<br />hwy: 24<br />drv: f","displ: 2.7<br />hwy: 24<br />drv: f","displ: 2.7<br />hwy: 24<br />drv: f","displ: 2.4<br />hwy: 29<br />drv: f","displ: 2.4<br />hwy: 27<br />drv: f","displ: 2.5<br />hwy: 31<br />drv: f","displ: 2.5<br />hwy: 32<br />drv: f","displ: 3.5<br />hwy: 27<br />drv: f","displ: 3.5<br />hwy: 26<br />drv: f","displ: 3.0<br />hwy: 26<br />drv: f","displ: 3.0<br />hwy: 25<br />drv: f","displ: 3.5<br />hwy: 25<br />drv: f","displ: 3.1<br />hwy: 26<br />drv: f","displ: 3.8<br />hwy: 26<br />drv: f","displ: 3.8<br />hwy: 27<br />drv: f","displ: 3.8<br />hwy: 28<br />drv: f","displ: 5.3<br />hwy: 25<br />drv: f","displ: 2.2<br />hwy: 29<br />drv: f","displ: 2.2<br />hwy: 27<br />drv: f","displ: 2.4<br />hwy: 31<br />drv: f","displ: 2.4<br />hwy: 31<br />drv: f","displ: 3.0<br />hwy: 26<br />drv: f","displ: 3.0<br />hwy: 26<br />drv: f","displ: 3.5<br />hwy: 28<br />drv: f","displ: 2.2<br />hwy: 27<br />drv: f","displ: 2.2<br />hwy: 29<br />drv: f","displ: 2.4<br />hwy: 31<br />drv: f","displ: 2.4<br />hwy: 31<br />drv: f","displ: 3.0<br />hwy: 26<br />drv: f","displ: 3.0<br />hwy: 26<br />drv: f","displ: 3.3<br />hwy: 27<br />drv: f","displ: 1.8<br />hwy: 30<br />drv: f","displ: 1.8<br />hwy: 33<br />drv: f","displ: 1.8<br />hwy: 35<br />drv: f","displ: 1.8<br />hwy: 37<br />drv: f","displ: 1.8<br />hwy: 35<br />drv: f","displ: 2.0<br />hwy: 29<br />drv: f","displ: 2.0<br />hwy: 26<br />drv: f","displ: 2.0<br />hwy: 29<br />drv: f","displ: 2.0<br />hwy: 29<br />drv: f","displ: 2.8<br />hwy: 24<br />drv: f","displ: 1.9<br />hwy: 44<br />drv: f","displ: 2.0<br />hwy: 29<br />drv: f","displ: 2.0<br />hwy: 26<br />drv: f","displ: 2.0<br />hwy: 29<br />drv: f","displ: 2.0<br />hwy: 29<br />drv: f","displ: 2.5<br />hwy: 29<br />drv: f","displ: 2.5<br />hwy: 29<br />drv: f","displ: 2.8<br />hwy: 23<br />drv: f","displ: 2.8<br />hwy: 24<br />drv: f","displ: 1.9<br />hwy: 44<br />drv: f","displ: 1.9<br />hwy: 41<br />drv: f","displ: 2.0<br />hwy: 29<br />drv: f","displ: 2.0<br />hwy: 26<br />drv: f","displ: 2.5<br />hwy: 28<br />drv: f","displ: 2.5<br />hwy: 29<br />drv: f","displ: 1.8<br />hwy: 29<br />drv: f","displ: 1.8<br />hwy: 29<br />drv: f","displ: 2.0<br />hwy: 28<br />drv: f","displ: 2.0<br />hwy: 29<br />drv: f","displ: 2.8<br />hwy: 26<br />drv: f","displ: 2.8<br />hwy: 26<br />drv: f","displ: 3.6<br />hwy: 26<br />drv: f"],"type":"scatter","mode":"markers","marker":{"autocolorscale":false,"color":"rgba(0,186,56,1)","opacity":1,"size":5.6692913385826778,"symbol":"circle","line":{"width":1.8897637795275593,"color":"rgba(0,186,56,1)"}},"hoveron":"points","name":"(f,1)","legendgroup":"(f,1)","showlegend":true,"xaxis":"x","yaxis":"y","hoverinfo":"text","frame":null},{"x":[5.2999999999999998,5.2999999999999998,5.2999999999999998,5.7000000000000002,6,5.7000000000000002,5.7000000000000002,6.2000000000000002,6.2000000000000002,7,4.5999999999999996,5.4000000000000004,5.4000000000000004,3.7999999999999998,3.7999999999999998,4,4,4.5999999999999996,4.5999999999999996,4.5999999999999996,4.5999999999999996,5.4000000000000004,5.4000000000000004,5.4000000000000004,5.4000000000000004],"y":[20,15,20,17,17,26,23,26,25,24,17,17,18,26,25,26,24,21,22,23,22,20,17,16,18],"text":["displ: 5.3<br />hwy: 20<br />drv: r","displ: 5.3<br />hwy: 15<br />drv: r","displ: 5.3<br />hwy: 20<br />drv: r","displ: 5.7<br />hwy: 17<br />drv: r","displ: 6.0<br />hwy: 17<br />drv: r","displ: 5.7<br />hwy: 26<br />drv: r","displ: 5.7<br />hwy: 23<br />drv: r","displ: 6.2<br />hwy: 26<br />drv: r","displ: 6.2<br />hwy: 25<br />drv: r","displ: 7.0<br />hwy: 24<br />drv: r","displ: 4.6<br />hwy: 17<br />drv: r","displ: 5.4<br />hwy: 17<br />drv: r","displ: 5.4<br />hwy: 18<br />drv: r","displ: 3.8<br />hwy: 26<br />drv: r","displ: 3.8<br />hwy: 25<br />drv: r","displ: 4.0<br />hwy: 26<br />drv: r","displ: 4.0<br />hwy: 24<br />drv: r","displ: 4.6<br />hwy: 21<br />drv: r","displ: 4.6<br />hwy: 22<br />drv: r","displ: 4.6<br />hwy: 23<br />drv: r","displ: 4.6<br />hwy: 22<br />drv: r","displ: 5.4<br />hwy: 20<br />drv: r","displ: 5.4<br />hwy: 17<br />drv: r","displ: 5.4<br />hwy: 16<br />drv: r","displ: 5.4<br />hwy: 18<br />drv: r"],"type":"scatter","mode":"markers","marker":{"autocolorscale":false,"color":"rgba(97,156,255,1)","opacity":1,"size":5.6692913385826778,"symbol":"circle","line":{"width":1.8897637795275593,"color":"rgba(97,156,255,1)"}},"hoveron":"points","name":"(r,1)","legendgroup":"(r,1)","showlegend":true,"xaxis":"x","yaxis":"y","hoverinfo":"text","frame":null},{"x":[1.8,1.8594936708860761,1.9189873417721519,1.978481012658228,2.037974683544304,2.0974683544303798,2.1569620253164556,2.2164556962025319,2.2759493670886077,2.3354430379746836,2.3949367088607598,2.4544303797468356,2.5139240506329115,2.5734177215189873,2.6329113924050636,2.6924050632911394,2.7518987341772152,2.811392405063291,2.8708860759493673,2.9303797468354431,2.9898734177215189,3.0493670886075952,3.108860759493671,3.1683544303797468,3.2278481012658231,3.2873417721518989,3.3468354430379748,3.406329113924051,3.4658227848101268,3.5253164556962027,3.5848101265822789,3.6443037974683543,3.7037974683544306,3.7632911392405068,3.8227848101265822,3.8822784810126585,3.9417721518987348,4.0012658227848101,4.0607594936708864,4.1202531645569627,4.179746835443038,4.2392405063291143,4.2987341772151897,4.358227848101266,4.4177215189873422,4.4772151898734176,4.5367088607594939,4.5962025316455701,4.6556962025316455,4.7151898734177218,4.774683544303798,4.8341772151898734,4.8936708860759497,4.953164556962026,5.0126582278481013,5.0721518987341776,5.1316455696202539,5.1911392405063292,5.2506329113924055,5.3101265822784818,5.3696202531645572,5.4291139240506334,5.4886075949367088,5.5481012658227851,5.6075949367088613,5.6670886075949367,5.726582278481013,5.7860759493670892,5.8455696202531646,5.9050632911392409,5.9645569620253163,6.0240506329113925,6.0835443037974688,6.1430379746835442,6.2025316455696204,6.2620253164556967,6.3215189873417721,6.3810126582278484,6.4405063291139246,6.5],"y":[27.494693813941389,27.246722571255422,27.000853118559494,26.754575990094999,26.505381720103326,26.250760842825862,25.988203892504014,25.715628250904853,25.438931495862466,25.160523350145596,24.880084851872319,24.59729703916075,24.311353285735091,24.011125451266317,23.695641615425398,23.369648431218042,23.037892551649968,22.705120629726878,22.376079318454494,22.055515270838516,21.748175139884662,21.455442984786647,21.172988732195218,20.900399796447914,20.637380734770257,20.383636104387783,20.138870462526018,19.902788366410487,19.675094373266734,19.455493040320277,19.24368892479665,19.039386583921388,18.84229057492001,18.652105455018056,18.468535781441055,18.291286111414529,18.114157730976544,17.937989599154335,17.774070738774501,17.612822210589389,17.455567490668582,17.30363005508168,17.158333379898263,17.021000941187914,16.892956215020231,16.775522677464792,16.670023804591189,16.577783072469011,16.4935104297892,16.416316050584562,16.346235230904469,16.281068359101518,16.221077951506896,16.166526524451804,16.117676594267422,16.074790677284948,16.038131289835572,16.007960948250489,15.98454216886088,15.968137467997943,15.959009361992869,15.957236932513482,15.961836533026746,15.972619054874297,15.989583677408019,16.012729579979805,16.042055941941538,16.077561942645112,16.119246761442405,16.167109577685309,16.221149570725728,16.28136591991553,16.347757804606605,16.42032440415085,16.499064897900148,16.583978465206389,16.67506428542146,16.772321537897245,16.875749401985644,16.985347057038535],"text":["displ: 1.800000<br />hwy: 27.49469<br />drv: 4","displ: 1.859494<br />hwy: 27.24672<br />drv: 4","displ: 1.918987<br />hwy: 27.00085<br />drv: 4","displ: 1.978481<br />hwy: 26.75458<br />drv: 4","displ: 2.037975<br />hwy: 26.50538<br />drv: 4","displ: 2.097468<br />hwy: 26.25076<br />drv: 4","displ: 2.156962<br />hwy: 25.98820<br />drv: 4","displ: 2.216456<br />hwy: 25.71563<br />drv: 4","displ: 2.275949<br />hwy: 25.43893<br />drv: 4","displ: 2.335443<br />hwy: 25.16052<br />drv: 4","displ: 2.394937<br />hwy: 24.88008<br />drv: 4","displ: 2.454430<br />hwy: 24.59730<br />drv: 4","displ: 2.513924<br />hwy: 24.31135<br />drv: 4","displ: 2.573418<br />hwy: 24.01113<br />drv: 4","displ: 2.632911<br />hwy: 23.69564<br />drv: 4","displ: 2.692405<br />hwy: 23.36965<br />drv: 4","displ: 2.751899<br />hwy: 23.03789<br />drv: 4","displ: 2.811392<br />hwy: 22.70512<br />drv: 4","displ: 2.870886<br />hwy: 22.37608<br />drv: 4","displ: 2.930380<br />hwy: 22.05552<br />drv: 4","displ: 2.989873<br />hwy: 21.74818<br />drv: 4","displ: 3.049367<br />hwy: 21.45544<br />drv: 4","displ: 3.108861<br />hwy: 21.17299<br />drv: 4","displ: 3.168354<br />hwy: 20.90040<br />drv: 4","displ: 3.227848<br />hwy: 20.63738<br />drv: 4","displ: 3.287342<br />hwy: 20.38364<br />drv: 4","displ: 3.346835<br />hwy: 20.13887<br />drv: 4","displ: 3.406329<br />hwy: 19.90279<br />drv: 4","displ: 3.465823<br />hwy: 19.67509<br />drv: 4","displ: 3.525316<br />hwy: 19.45549<br />drv: 4","displ: 3.584810<br />hwy: 19.24369<br />drv: 4","displ: 3.644304<br />hwy: 19.03939<br />drv: 4","displ: 3.703797<br />hwy: 18.84229<br />drv: 4","displ: 3.763291<br />hwy: 18.65211<br />drv: 4","displ: 3.822785<br />hwy: 18.46854<br />drv: 4","displ: 3.882278<br />hwy: 18.29129<br />drv: 4","displ: 3.941772<br />hwy: 18.11416<br />drv: 4","displ: 4.001266<br />hwy: 17.93799<br />drv: 4","displ: 4.060759<br />hwy: 17.77407<br />drv: 4","displ: 4.120253<br />hwy: 17.61282<br />drv: 4","displ: 4.179747<br />hwy: 17.45557<br />drv: 4","displ: 4.239241<br />hwy: 17.30363<br />drv: 4","displ: 4.298734<br />hwy: 17.15833<br />drv: 4","displ: 4.358228<br />hwy: 17.02100<br />drv: 4","displ: 4.417722<br />hwy: 16.89296<br />drv: 4","displ: 4.477215<br />hwy: 16.77552<br />drv: 4","displ: 4.536709<br />hwy: 16.67002<br />drv: 4","displ: 4.596203<br />hwy: 16.57778<br />drv: 4","displ: 4.655696<br />hwy: 16.49351<br />drv: 4","displ: 4.715190<br />hwy: 16.41632<br />drv: 4","displ: 4.774684<br />hwy: 16.34624<br />drv: 4","displ: 4.834177<br />hwy: 16.28107<br />drv: 4","displ: 4.893671<br />hwy: 16.22108<br />drv: 4","displ: 4.953165<br />hwy: 16.16653<br />drv: 4","displ: 5.012658<br />hwy: 16.11768<br />drv: 4","displ: 5.072152<br />hwy: 16.07479<br />drv: 4","displ: 5.131646<br />hwy: 16.03813<br />drv: 4","displ: 5.191139<br />hwy: 16.00796<br />drv: 4","displ: 5.250633<br />hwy: 15.98454<br />drv: 4","displ: 5.310127<br />hwy: 15.96814<br />drv: 4","displ: 5.369620<br />hwy: 15.95901<br />drv: 4","displ: 5.429114<br />hwy: 15.95724<br />drv: 4","displ: 5.488608<br />hwy: 15.96184<br />drv: 4","displ: 5.548101<br />hwy: 15.97262<br />drv: 4","displ: 5.607595<br />hwy: 15.98958<br />drv: 4","displ: 5.667089<br />hwy: 16.01273<br />drv: 4","displ: 5.726582<br />hwy: 16.04206<br />drv: 4","displ: 5.786076<br />hwy: 16.07756<br />drv: 4","displ: 5.845570<br />hwy: 16.11925<br />drv: 4","displ: 5.905063<br />hwy: 16.16711<br />drv: 4","displ: 5.964557<br />hwy: 16.22115<br />drv: 4","displ: 6.024051<br />hwy: 16.28137<br />drv: 4","displ: 6.083544<br />hwy: 16.34776<br />drv: 4","displ: 6.143038<br />hwy: 16.42032<br />drv: 4","displ: 6.202532<br />hwy: 16.49906<br />drv: 4","displ: 6.262025<br />hwy: 16.58398<br />drv: 4","displ: 6.321519<br />hwy: 16.67506<br />drv: 4","displ: 6.381013<br />hwy: 16.77232<br />drv: 4","displ: 6.440506<br />hwy: 16.87575<br />drv: 4","displ: 6.500000<br />hwy: 16.98535<br />drv: 4"],"type":"scatter","mode":"lines","name":"(4,1)","line":{"width":3.7795275590551185,"color":"rgba(51,102,255,1)","dash":"solid"},"hoveron":"points","legendgroup":"(4,1)","showlegend":false,"xaxis":"x","yaxis":"y","hoverinfo":"text","frame":null},{"x":[1.6000000000000001,1.6468354430379748,1.6936708860759495,1.7405063291139242,1.7873417721518989,1.8341772151898734,1.8810126582278481,1.9278481012658228,1.9746835443037976,2.0215189873417723,2.0683544303797468,2.1151898734177217,2.1620253164556962,2.2088607594936711,2.2556962025316456,2.3025316455696201,2.349367088607595,2.39620253164557,2.4430379746835444,2.4898734177215189,2.5367088607594939,2.5835443037974684,2.6303797468354428,2.6772151898734178,2.7240506329113927,2.7708860759493672,2.8177215189873417,2.8645569620253166,2.9113924050632911,2.9582278481012656,3.0050632911392405,3.0518987341772155,3.09873417721519,3.1455696202531644,3.1924050632911394,3.2392405063291143,3.2860759493670888,3.3329113924050633,3.3797468354430382,3.4265822784810127,3.4734177215189872,3.5202531645569621,3.5670886075949371,3.6139240506329116,3.660759493670886,3.707594936708861,3.7544303797468355,3.8012658227848104,3.8481012658227849,3.8949367088607594,3.9417721518987343,3.9886075949367088,4.0354430379746837,4.0822784810126578,4.1291139240506336,4.1759493670886076,4.2227848101265817,4.2696202531645575,4.3164556962025316,4.3632911392405065,4.4101265822784814,4.4569620253164555,4.5037974683544304,4.5506329113924053,4.5974683544303794,4.6443037974683543,4.6911392405063292,4.7379746835443033,4.7848101265822791,4.8316455696202532,4.8784810126582281,4.925316455696203,4.9721518987341771,5.018987341772152,5.0658227848101269,5.112658227848101,5.1594936708860759,5.2063291139240508,5.2531645569620249,5.2999999999999998],"y":[33.367399755723071,33.001785641150981,32.643233705901849,32.291839800770049,31.947699776549904,31.610909484035819,31.281564774022129,30.963414336276635,30.660675286013944,30.347437444375483,30.001503767678553,29.643142234264307,29.297941707084181,28.993056046368352,28.789239169925253,28.657811964714501,28.531135602126401,28.341571253551269,28.083301128800624,27.816788409022056,27.546460535094461,27.276342163218349,27.010457949594258,26.752832550422713,26.498139567081587,26.205298786630596,25.890256961810145,25.578187698994668,25.29426460455856,25.063661284876254,24.911134535199924,24.813412358767664,24.742271297683622,24.694031790664734,24.665014276427915,24.651539193690084,24.649926981168175,24.656498077579108,24.667572921639806,24.6794719520672,24.688515607578207,24.69170980622189,24.692157746359381,24.691006934012854,24.688430897814932,24.684603166398226,24.679697268395344,24.673886732438906,24.667345087161518,24.660245861195804,24.652762583174368,24.645068781729826,24.637337985494792,24.629743723101885,24.622459523183711,24.615658914372887,24.609515425302018,24.60420258460373,24.599893920910624,24.596762962855326,24.594983239070437,24.594728278188587,24.596171608842365,24.599486759664412,24.604847259287322,24.612426636343713,24.622398419466201,24.634936137287397,24.650213318439917,24.668403491556369,24.689680185269371,24.714216928211538,24.742187249015483,24.773764676313817,24.809122738739148,24.848434964924095,24.891874883501274,24.939616023103298,24.991831912362777,25.048696079912322],"text":["displ: 1.600000<br />hwy: 33.36740<br />drv: f","displ: 1.646835<br />hwy: 33.00179<br />drv: f","displ: 1.693671<br />hwy: 32.64323<br />drv: f","displ: 1.740506<br />hwy: 32.29184<br />drv: f","displ: 1.787342<br />hwy: 31.94770<br />drv: f","displ: 1.834177<br />hwy: 31.61091<br />drv: f","displ: 1.881013<br />hwy: 31.28156<br />drv: f","displ: 1.927848<br />hwy: 30.96341<br />drv: f","displ: 1.974684<br />hwy: 30.66068<br />drv: f","displ: 2.021519<br />hwy: 30.34744<br />drv: f","displ: 2.068354<br />hwy: 30.00150<br />drv: f","displ: 2.115190<br />hwy: 29.64314<br />drv: f","displ: 2.162025<br />hwy: 29.29794<br />drv: f","displ: 2.208861<br />hwy: 28.99306<br />drv: f","displ: 2.255696<br />hwy: 28.78924<br />drv: f","displ: 2.302532<br />hwy: 28.65781<br />drv: f","displ: 2.349367<br />hwy: 28.53114<br />drv: f","displ: 2.396203<br />hwy: 28.34157<br />drv: f","displ: 2.443038<br />hwy: 28.08330<br />drv: f","displ: 2.489873<br />hwy: 27.81679<br />drv: f","displ: 2.536709<br />hwy: 27.54646<br />drv: f","displ: 2.583544<br />hwy: 27.27634<br />drv: f","displ: 2.630380<br />hwy: 27.01046<br />drv: f","displ: 2.677215<br />hwy: 26.75283<br />drv: f","displ: 2.724051<br />hwy: 26.49814<br />drv: f","displ: 2.770886<br />hwy: 26.20530<br />drv: f","displ: 2.817722<br />hwy: 25.89026<br />drv: f","displ: 2.864557<br />hwy: 25.57819<br />drv: f","displ: 2.911392<br />hwy: 25.29426<br />drv: f","displ: 2.958228<br />hwy: 25.06366<br />drv: f","displ: 3.005063<br />hwy: 24.91113<br />drv: f","displ: 3.051899<br />hwy: 24.81341<br />drv: f","displ: 3.098734<br />hwy: 24.74227<br />drv: f","displ: 3.145570<br />hwy: 24.69403<br />drv: f","displ: 3.192405<br />hwy: 24.66501<br />drv: f","displ: 3.239241<br />hwy: 24.65154<br />drv: f","displ: 3.286076<br />hwy: 24.64993<br />drv: f","displ: 3.332911<br />hwy: 24.65650<br />drv: f","displ: 3.379747<br />hwy: 24.66757<br />drv: f","displ: 3.426582<br />hwy: 24.67947<br />drv: f","displ: 3.473418<br />hwy: 24.68852<br />drv: f","displ: 3.520253<br />hwy: 24.69171<br />drv: f","displ: 3.567089<br />hwy: 24.69216<br />drv: f","displ: 3.613924<br />hwy: 24.69101<br />drv: f","displ: 3.660759<br />hwy: 24.68843<br />drv: f","displ: 3.707595<br />hwy: 24.68460<br />drv: f","displ: 3.754430<br />hwy: 24.67970<br />drv: f","displ: 3.801266<br />hwy: 24.67389<br />drv: f","displ: 3.848101<br />hwy: 24.66735<br />drv: f","displ: 3.894937<br />hwy: 24.66025<br />drv: f","displ: 3.941772<br />hwy: 24.65276<br />drv: f","displ: 3.988608<br />hwy: 24.64507<br />drv: f","displ: 4.035443<br />hwy: 24.63734<br />drv: f","displ: 4.082278<br />hwy: 24.62974<br />drv: f","displ: 4.129114<br />hwy: 24.62246<br />drv: f","displ: 4.175949<br />hwy: 24.61566<br />drv: f","displ: 4.222785<br />hwy: 24.60952<br />drv: f","displ: 4.269620<br />hwy: 24.60420<br />drv: f","displ: 4.316456<br />hwy: 24.59989<br />drv: f","displ: 4.363291<br />hwy: 24.59676<br />drv: f","displ: 4.410127<br />hwy: 24.59498<br />drv: f","displ: 4.456962<br />hwy: 24.59473<br />drv: f","displ: 4.503797<br />hwy: 24.59617<br />drv: f","displ: 4.550633<br />hwy: 24.59949<br />drv: f","displ: 4.597468<br />hwy: 24.60485<br />drv: f","displ: 4.644304<br />hwy: 24.61243<br />drv: f","displ: 4.691139<br />hwy: 24.62240<br />drv: f","displ: 4.737975<br />hwy: 24.63494<br />drv: f","displ: 4.784810<br />hwy: 24.65021<br />drv: f","displ: 4.831646<br />hwy: 24.66840<br />drv: f","displ: 4.878481<br />hwy: 24.68968<br />drv: f","displ: 4.925316<br />hwy: 24.71422<br />drv: f","displ: 4.972152<br />hwy: 24.74219<br />drv: f","displ: 5.018987<br />hwy: 24.77376<br />drv: f","displ: 5.065823<br />hwy: 24.80912<br />drv: f","displ: 5.112658<br />hwy: 24.84843<br />drv: f","displ: 5.159494<br />hwy: 24.89187<br />drv: f","displ: 5.206329<br />hwy: 24.93962<br />drv: f","displ: 5.253165<br />hwy: 24.99183<br />drv: f","displ: 5.300000<br />hwy: 25.04870<br />drv: f"],"type":"scatter","mode":"lines","name":"(f,1)","line":{"width":3.7795275590551185,"color":"rgba(51,102,255,1)","dash":"dash"},"hoveron":"points","legendgroup":"(f,1)","showlegend":false,"xaxis":"x","yaxis":"y","hoverinfo":"text","frame":null},{"x":[3.7999999999999998,3.8405063291139241,3.8810126582278479,3.9215189873417722,3.962025316455696,4.0025316455696203,4.0430379746835445,4.0835443037974679,4.1240506329113922,4.1645569620253164,4.2050632911392407,4.2455696202531641,4.2860759493670884,4.3265822784810126,4.3670886075949369,4.4075949367088603,4.4481012658227845,4.4886075949367088,4.5291139240506331,4.5696202531645564,4.6101265822784807,4.650632911392405,4.6911392405063292,4.7316455696202526,4.7721518987341769,4.8126582278481012,4.8531645569620254,4.8936708860759488,4.9341772151898731,4.9746835443037973,5.0151898734177216,5.0556962025316459,5.0962025316455692,5.1367088607594935,5.1772151898734178,5.2177215189873412,5.2582278481012654,5.2987341772151897,5.339240506329114,5.3797468354430382,5.4202531645569616,5.4607594936708859,5.5012658227848101,5.5417721518987335,5.5822784810126578,5.622784810126582,5.6632911392405063,5.7037974683544306,5.7443037974683548,5.7848101265822782,5.8253164556962025,5.8658227848101259,5.9063291139240501,5.9468354430379744,5.9873417721518987,6.0278481012658229,6.0683544303797472,6.1088607594936706,6.1493670886075948,6.1898734177215182,6.2303797468354425,6.2708860759493668,6.311392405063291,6.3518987341772153,6.3924050632911396,6.4329113924050638,6.4734177215189872,6.5139240506329115,6.5544303797468348,6.5949367088607591,6.6354430379746834,6.6759493670886076,6.7164556962025319,6.7569620253164562,6.7974683544303796,6.8379746835443038,6.8784810126582272,6.9189873417721515,6.9594936708860757,7],"y":[25.65875747025806,25.485542155752263,25.300644382831575,25.105936584507745,24.903291193792526,24.694559370606839,24.475553495008914,24.243468657991944,24.000305120825022,23.748063144777259,23.488742991117785,23.224344921115705,22.956869196040124,22.688316077160149,22.420685825744915,22.155978703063507,21.896194970385054,21.643334888978657,21.399398720113439,21.166386725058508,20.947465183305326,20.767715774961303,20.630685907749971,20.528503271854291,20.453295557457206,20.397190454741683,20.35231565389067,20.31079884508712,20.264767718513994,20.206349964354242,20.127673272790812,20.020865334006668,19.878053838184769,19.691366475508058,19.452930936159493,19.154874910322036,18.789326088178623,18.348412159912225,18.119616648436061,18.329190419276198,18.776194367774231,19.136752866949195,19.396403760256241,19.587947719348083,19.744185415877446,19.897917521497035,20.081944707859559,20.328873653068875,20.635986426080475,20.975982700560397,21.333033233389258,21.691308781447631,22.034980101616128,22.348217950775332,22.615193085805842,22.833785764375815,23.037153610698802,23.227883452698702,23.405987411519206,23.571477608303994,23.724366164196727,23.864665200341101,23.992386837880787,24.107543197959465,24.210146401720809,24.300208570308499,24.377741824866213,24.442758286537629,24.495270076466433,24.535289315796284,24.56282812567088,24.577898627233893,24.580512941628996,24.570683189999869,24.548421493490196,24.513739973243649,24.466650750403904,24.407165946114652,24.335297681519553,24.251058077762298],"text":["displ: 3.800000<br />hwy: 25.65876<br />drv: r","displ: 3.840506<br />hwy: 25.48554<br />drv: r","displ: 3.881013<br />hwy: 25.30064<br />drv: r","displ: 3.921519<br />hwy: 25.10594<br />drv: r","displ: 3.962025<br />hwy: 24.90329<br />drv: r","displ: 4.002532<br />hwy: 24.69456<br />drv: r","displ: 4.043038<br />hwy: 24.47555<br />drv: r","displ: 4.083544<br />hwy: 24.24347<br />drv: r","displ: 4.124051<br />hwy: 24.00031<br />drv: r","displ: 4.164557<br />hwy: 23.74806<br />drv: r","displ: 4.205063<br />hwy: 23.48874<br />drv: r","displ: 4.245570<br />hwy: 23.22434<br />drv: r","displ: 4.286076<br />hwy: 22.95687<br />drv: r","displ: 4.326582<br />hwy: 22.68832<br />drv: r","displ: 4.367089<br />hwy: 22.42069<br />drv: r","displ: 4.407595<br />hwy: 22.15598<br />drv: r","displ: 4.448101<br />hwy: 21.89619<br />drv: r","displ: 4.488608<br />hwy: 21.64333<br />drv: r","displ: 4.529114<br />hwy: 21.39940<br />drv: r","displ: 4.569620<br />hwy: 21.16639<br />drv: r","displ: 4.610127<br />hwy: 20.94747<br />drv: r","displ: 4.650633<br />hwy: 20.76772<br />drv: r","displ: 4.691139<br />hwy: 20.63069<br />drv: r","displ: 4.731646<br />hwy: 20.52850<br />drv: r","displ: 4.772152<br />hwy: 20.45330<br />drv: r","displ: 4.812658<br />hwy: 20.39719<br />drv: r","displ: 4.853165<br />hwy: 20.35232<br />drv: r","displ: 4.893671<br />hwy: 20.31080<br />drv: r","displ: 4.934177<br />hwy: 20.26477<br />drv: r","displ: 4.974684<br />hwy: 20.20635<br />drv: r","displ: 5.015190<br />hwy: 20.12767<br />drv: r","displ: 5.055696<br />hwy: 20.02087<br />drv: r","displ: 5.096203<br />hwy: 19.87805<br />drv: r","displ: 5.136709<br />hwy: 19.69137<br />drv: r","displ: 5.177215<br />hwy: 19.45293<br />drv: r","displ: 5.217722<br />hwy: 19.15487<br />drv: r","displ: 5.258228<br />hwy: 18.78933<br />drv: r","displ: 5.298734<br />hwy: 18.34841<br />drv: r","displ: 5.339241<br />hwy: 18.11962<br />drv: r","displ: 5.379747<br />hwy: 18.32919<br />drv: r","displ: 5.420253<br />hwy: 18.77619<br />drv: r","displ: 5.460759<br />hwy: 19.13675<br />drv: r","displ: 5.501266<br />hwy: 19.39640<br />drv: r","displ: 5.541772<br />hwy: 19.58795<br />drv: r","displ: 5.582278<br />hwy: 19.74419<br />drv: r","displ: 5.622785<br />hwy: 19.89792<br />drv: r","displ: 5.663291<br />hwy: 20.08194<br />drv: r","displ: 5.703797<br />hwy: 20.32887<br />drv: r","displ: 5.744304<br />hwy: 20.63599<br />drv: r","displ: 5.784810<br />hwy: 20.97598<br />drv: r","displ: 5.825316<br />hwy: 21.33303<br />drv: r","displ: 5.865823<br />hwy: 21.69131<br />drv: r","displ: 5.906329<br />hwy: 22.03498<br />drv: r","displ: 5.946835<br />hwy: 22.34822<br />drv: r","displ: 5.987342<br />hwy: 22.61519<br />drv: r","displ: 6.027848<br />hwy: 22.83379<br />drv: r","displ: 6.068354<br />hwy: 23.03715<br />drv: r","displ: 6.108861<br />hwy: 23.22788<br />drv: r","displ: 6.149367<br />hwy: 23.40599<br />drv: r","displ: 6.189873<br />hwy: 23.57148<br />drv: r","displ: 6.230380<br />hwy: 23.72437<br />drv: r","displ: 6.270886<br />hwy: 23.86467<br />drv: r","displ: 6.311392<br />hwy: 23.99239<br />drv: r","displ: 6.351899<br />hwy: 24.10754<br />drv: r","displ: 6.392405<br />hwy: 24.21015<br />drv: r","displ: 6.432911<br />hwy: 24.30021<br />drv: r","displ: 6.473418<br />hwy: 24.37774<br />drv: r","displ: 6.513924<br />hwy: 24.44276<br />drv: r","displ: 6.554430<br />hwy: 24.49527<br />drv: r","displ: 6.594937<br />hwy: 24.53529<br />drv: r","displ: 6.635443<br />hwy: 24.56283<br />drv: r","displ: 6.675949<br />hwy: 24.57790<br />drv: r","displ: 6.716456<br />hwy: 24.58051<br />drv: r","displ: 6.756962<br />hwy: 24.57068<br />drv: r","displ: 6.797468<br />hwy: 24.54842<br />drv: r","displ: 6.837975<br />hwy: 24.51374<br />drv: r","displ: 6.878481<br />hwy: 24.46665<br />drv: r","displ: 6.918987<br />hwy: 24.40717<br />drv: r","displ: 6.959494<br />hwy: 24.33530<br />drv: r","displ: 7.000000<br />hwy: 24.25106<br />drv: r"],"type":"scatter","mode":"lines","name":"(r,1)","line":{"width":3.7795275590551185,"color":"rgba(51,102,255,1)","dash":"dot"},"hoveron":"points","legendgroup":"(r,1)","showlegend":false,"xaxis":"x","yaxis":"y","hoverinfo":"text","frame":null},{"x":[1.8,1.8594936708860761,1.9189873417721519,1.978481012658228,2.037974683544304,2.0974683544303798,2.1569620253164556,2.2164556962025319,2.2759493670886077,2.3354430379746836,2.3949367088607598,2.4544303797468356,2.5139240506329115,2.5734177215189873,2.6329113924050636,2.6924050632911394,2.7518987341772152,2.811392405063291,2.8708860759493673,2.9303797468354431,2.9898734177215189,3.0493670886075952,3.108860759493671,3.1683544303797468,3.2278481012658231,3.2873417721518989,3.3468354430379748,3.406329113924051,3.4658227848101268,3.5253164556962027,3.5848101265822789,3.6443037974683543,3.7037974683544306,3.7632911392405068,3.8227848101265822,3.8822784810126585,3.9417721518987348,4.0012658227848101,4.0607594936708864,4.1202531645569627,4.179746835443038,4.2392405063291143,4.2987341772151897,4.358227848101266,4.4177215189873422,4.4772151898734176,4.5367088607594939,4.5962025316455701,4.6556962025316455,4.7151898734177218,4.774683544303798,4.8341772151898734,4.8936708860759497,4.953164556962026,5.0126582278481013,5.0721518987341776,5.1316455696202539,5.1911392405063292,5.2506329113924055,5.3101265822784818,5.3696202531645572,5.4291139240506334,5.4886075949367088,5.5481012658227851,5.6075949367088613,5.6670886075949367,5.726582278481013,5.7860759493670892,5.8455696202531646,5.9050632911392409,5.9645569620253163,6.0240506329113925,6.0835443037974688,6.1430379746835442,6.2025316455696204,6.2620253164556967,6.3215189873417721,6.3810126582278484,6.4405063291139246,6.5,6.5,6.4405063291139246,6.3810126582278484,6.3215189873417721,6.2620253164556967,6.2025316455696204,6.1430379746835442,6.0835443037974688,6.0240506329113925,5.9645569620253163,5.9050632911392409,5.8455696202531646,5.7860759493670892,5.726582278481013,5.6670886075949367,5.6075949367088613,5.5481012658227851,5.4886075949367088,5.4291139240506334,5.3696202531645572,5.3101265822784818,5.2506329113924055,5.1911392405063292,5.1316455696202539,5.0721518987341776,5.0126582278481013,4.953164556962026,4.8936708860759497,4.8341772151898734,4.774683544303798,4.7151898734177218,4.6556962025316455,4.5962025316455701,4.5367088607594939,4.4772151898734176,4.4177215189873422,4.358227848101266,4.2987341772151897,4.2392405063291143,4.179746835443038,4.1202531645569627,4.0607594936708864,4.0012658227848101,3.9417721518987348,3.8822784810126585,3.8227848101265822,3.7632911392405068,3.7037974683544306,3.6443037974683543,3.5848101265822789,3.5253164556962027,3.4658227848101268,3.406329113924051,3.3468354430379748,3.2873417721518989,3.2278481012658231,3.1683544303797468,3.108860759493671,3.0493670886075952,2.9898734177215189,2.9303797468354431,2.8708860759493673,2.811392405063291,2.7518987341772152,2.6924050632911394,2.6329113924050636,2.5734177215189873,2.5139240506329115,2.4544303797468356,2.3949367088607598,2.3354430379746836,2.2759493670886077,2.2164556962025319,2.1569620253164556,2.0974683544303798,2.037974683544304,1.978481012658228,1.9189873417721519,1.8594936708860761,1.8,1.8],"y":[25.398564531170283,25.350406724824033,25.291381957834023,25.217769417716173,25.125825507555028,25.011848141794516,24.872270349699217,24.704209892372475,24.513021185471526,24.300627465555888,24.066908023891646,23.812781575202905,23.539786293046895,23.240820266022926,22.918251921182048,22.579150416245756,22.230189000569318,21.87786198971202,21.52862822523079,21.188969805507028,20.865374372870004,20.563937118741045,20.285438070931498,20.02673072089036,19.78397471613097,19.552968976348829,19.329487381594927,19.109716981469106,18.890787724448128,18.671266566711331,18.451415721836049,18.233083344582312,18.019279503466034,17.813626819553988,17.619857727131858,17.441415980203853,17.292666104187582,17.153211139446181,17.005919139849262,16.870880039856985,16.743696978660349,16.619847604110394,16.495659458368273,16.36946686241664,16.242506524672443,16.118966841489929,16.005069859190677,15.907651594959102,15.816229525275393,15.731716019678549,15.6607330761185,15.595191133358425,15.534501587657223,15.478211468257365,15.426055962751731,15.377975084585454,15.334089803911947,15.294637204149069,15.259869153756295,15.229922606041105,15.204671720484329,15.183200174409127,15.162118314312034,15.139774617632222,15.115019992976411,15.086896291992943,15.054690373621135,15.017947248689966,14.976447708859622,14.930163679264165,14.879205895376723,14.823774954251903,14.764121600879726,14.700517771341588,14.633237327447661,14.562544375639076,14.488686980673966,14.411894440142936,14.332376753497812,14.250325343402597,19.720368770674472,19.419122050473476,19.132748635651556,18.861441590168951,18.605412554773704,18.364892468352636,18.140131036960113,17.931394008333484,17.738956885579157,17.563093246074736,17.404055476106453,17.262045814025189,17.137176636600259,17.02942151026194,16.938562867966667,16.864147361839628,16.80546349211637,16.761554751741457,16.731273690617837,16.713347003501411,16.706352329954782,16.709215183965465,16.721284692351908,16.742172775759197,16.771606269984442,16.809297225783116,16.854841580646241,16.907654315356567,16.966945584844609,17.031737385690437,17.100916081490574,17.170791334303008,17.247914549978919,17.334977749991701,17.432078513439656,17.543405905368019,17.672535019959188,17.821007301428253,17.987412506052966,18.167438002676814,18.354764381321793,18.542222337699741,18.722768058862489,18.935649357765506,19.141156242625204,19.317213835750252,19.490584090482123,19.665301646373987,19.845689823260464,20.035962127757251,20.239719513929224,20.459401022085341,20.695859751351868,20.94825354345711,21.214303232426737,21.490786753409544,21.774068872005468,22.060539393458939,22.346948850832248,22.630975906899319,22.922060736170003,23.223530411678198,23.532379269741735,23.845596102730617,24.160146446190328,24.473031309668748,24.781430636509707,25.082920278423288,25.381812503118596,25.693261679852991,26.020419234735304,26.364841806253406,26.727046609437231,27.104137435308811,27.489673543857208,27.884937932651624,28.291382562473824,28.710324279284965,29.14303841768681,29.590823096712494,25.398564531170283],"text":["displ: 1.800000<br />hwy: 27.49469<br />drv: 4","displ: 1.859494<br />hwy: 27.24672<br />drv: 4","displ: 1.918987<br />hwy: 27.00085<br />drv: 4","displ: 1.978481<br />hwy: 26.75458<br />drv: 4","displ: 2.037975<br />hwy: 26.50538<br />drv: 4","displ: 2.097468<br />hwy: 26.25076<br />drv: 4","displ: 2.156962<br />hwy: 25.98820<br />drv: 4","displ: 2.216456<br />hwy: 25.71563<br />drv: 4","displ: 2.275949<br />hwy: 25.43893<br />drv: 4","displ: 2.335443<br />hwy: 25.16052<br />drv: 4","displ: 2.394937<br />hwy: 24.88008<br />drv: 4","displ: 2.454430<br />hwy: 24.59730<br />drv: 4","displ: 2.513924<br />hwy: 24.31135<br />drv: 4","displ: 2.573418<br />hwy: 24.01113<br />drv: 4","displ: 2.632911<br />hwy: 23.69564<br />drv: 4","displ: 2.692405<br />hwy: 23.36965<br />drv: 4","displ: 2.751899<br />hwy: 23.03789<br />drv: 4","displ: 2.811392<br />hwy: 22.70512<br />drv: 4","displ: 2.870886<br />hwy: 22.37608<br />drv: 4","displ: 2.930380<br />hwy: 22.05552<br />drv: 4","displ: 2.989873<br />hwy: 21.74818<br />drv: 4","displ: 3.049367<br />hwy: 21.45544<br />drv: 4","displ: 3.108861<br />hwy: 21.17299<br />drv: 4","displ: 3.168354<br />hwy: 20.90040<br />drv: 4","displ: 3.227848<br />hwy: 20.63738<br />drv: 4","displ: 3.287342<br />hwy: 20.38364<br />drv: 4","displ: 3.346835<br />hwy: 20.13887<br />drv: 4","displ: 3.406329<br />hwy: 19.90279<br />drv: 4","displ: 3.465823<br />hwy: 19.67509<br />drv: 4","displ: 3.525316<br />hwy: 19.45549<br />drv: 4","displ: 3.584810<br />hwy: 19.24369<br />drv: 4","displ: 3.644304<br />hwy: 19.03939<br />drv: 4","displ: 3.703797<br />hwy: 18.84229<br />drv: 4","displ: 3.763291<br />hwy: 18.65211<br />drv: 4","displ: 3.822785<br />hwy: 18.46854<br />drv: 4","displ: 3.882278<br />hwy: 18.29129<br />drv: 4","displ: 3.941772<br />hwy: 18.11416<br />drv: 4","displ: 4.001266<br />hwy: 17.93799<br />drv: 4","displ: 4.060759<br />hwy: 17.77407<br />drv: 4","displ: 4.120253<br />hwy: 17.61282<br />drv: 4","displ: 4.179747<br />hwy: 17.45557<br />drv: 4","displ: 4.239241<br />hwy: 17.30363<br />drv: 4","displ: 4.298734<br />hwy: 17.15833<br />drv: 4","displ: 4.358228<br />hwy: 17.02100<br />drv: 4","displ: 4.417722<br />hwy: 16.89296<br />drv: 4","displ: 4.477215<br />hwy: 16.77552<br />drv: 4","displ: 4.536709<br />hwy: 16.67002<br />drv: 4","displ: 4.596203<br />hwy: 16.57778<br />drv: 4","displ: 4.655696<br />hwy: 16.49351<br />drv: 4","displ: 4.715190<br />hwy: 16.41632<br />drv: 4","displ: 4.774684<br />hwy: 16.34624<br />drv: 4","displ: 4.834177<br />hwy: 16.28107<br />drv: 4","displ: 4.893671<br />hwy: 16.22108<br />drv: 4","displ: 4.953165<br />hwy: 16.16653<br />drv: 4","displ: 5.012658<br />hwy: 16.11768<br />drv: 4","displ: 5.072152<br />hwy: 16.07479<br />drv: 4","displ: 5.131646<br />hwy: 16.03813<br />drv: 4","displ: 5.191139<br />hwy: 16.00796<br />drv: 4","displ: 5.250633<br />hwy: 15.98454<br />drv: 4","displ: 5.310127<br />hwy: 15.96814<br />drv: 4","displ: 5.369620<br />hwy: 15.95901<br />drv: 4","displ: 5.429114<br />hwy: 15.95724<br />drv: 4","displ: 5.488608<br />hwy: 15.96184<br />drv: 4","displ: 5.548101<br />hwy: 15.97262<br />drv: 4","displ: 5.607595<br />hwy: 15.98958<br />drv: 4","displ: 5.667089<br />hwy: 16.01273<br />drv: 4","displ: 5.726582<br />hwy: 16.04206<br />drv: 4","displ: 5.786076<br />hwy: 16.07756<br />drv: 4","displ: 5.845570<br />hwy: 16.11925<br />drv: 4","displ: 5.905063<br />hwy: 16.16711<br />drv: 4","displ: 5.964557<br />hwy: 16.22115<br />drv: 4","displ: 6.024051<br />hwy: 16.28137<br />drv: 4","displ: 6.083544<br />hwy: 16.34776<br />drv: 4","displ: 6.143038<br />hwy: 16.42032<br />drv: 4","displ: 6.202532<br />hwy: 16.49906<br />drv: 4","displ: 6.262025<br />hwy: 16.58398<br />drv: 4","displ: 6.321519<br />hwy: 16.67506<br />drv: 4","displ: 6.381013<br />hwy: 16.77232<br />drv: 4","displ: 6.440506<br />hwy: 16.87575<br />drv: 4","displ: 6.500000<br />hwy: 16.98535<br />drv: 4","displ: 6.500000<br />hwy: 16.98535<br />drv: 4","displ: 6.440506<br />hwy: 16.87575<br />drv: 4","displ: 6.381013<br />hwy: 16.77232<br />drv: 4","displ: 6.321519<br />hwy: 16.67506<br />drv: 4","displ: 6.262025<br />hwy: 16.58398<br />drv: 4","displ: 6.202532<br />hwy: 16.49906<br />drv: 4","displ: 6.143038<br />hwy: 16.42032<br />drv: 4","displ: 6.083544<br />hwy: 16.34776<br />drv: 4","displ: 6.024051<br />hwy: 16.28137<br />drv: 4","displ: 5.964557<br />hwy: 16.22115<br />drv: 4","displ: 5.905063<br />hwy: 16.16711<br />drv: 4","displ: 5.845570<br />hwy: 16.11925<br />drv: 4","displ: 5.786076<br />hwy: 16.07756<br />drv: 4","displ: 5.726582<br />hwy: 16.04206<br />drv: 4","displ: 5.667089<br />hwy: 16.01273<br />drv: 4","displ: 5.607595<br />hwy: 15.98958<br />drv: 4","displ: 5.548101<br />hwy: 15.97262<br />drv: 4","displ: 5.488608<br />hwy: 15.96184<br />drv: 4","displ: 5.429114<br />hwy: 15.95724<br />drv: 4","displ: 5.369620<br />hwy: 15.95901<br />drv: 4","displ: 5.310127<br />hwy: 15.96814<br />drv: 4","displ: 5.250633<br />hwy: 15.98454<br />drv: 4","displ: 5.191139<br />hwy: 16.00796<br />drv: 4","displ: 5.131646<br />hwy: 16.03813<br />drv: 4","displ: 5.072152<br />hwy: 16.07479<br />drv: 4","displ: 5.012658<br />hwy: 16.11768<br />drv: 4","displ: 4.953165<br />hwy: 16.16653<br />drv: 4","displ: 4.893671<br />hwy: 16.22108<br />drv: 4","displ: 4.834177<br />hwy: 16.28107<br />drv: 4","displ: 4.774684<br />hwy: 16.34624<br />drv: 4","displ: 4.715190<br />hwy: 16.41632<br />drv: 4","displ: 4.655696<br />hwy: 16.49351<br />drv: 4","displ: 4.596203<br />hwy: 16.57778<br />drv: 4","displ: 4.536709<br />hwy: 16.67002<br />drv: 4","displ: 4.477215<br />hwy: 16.77552<br />drv: 4","displ: 4.417722<br />hwy: 16.89296<br />drv: 4","displ: 4.358228<br />hwy: 17.02100<br />drv: 4","displ: 4.298734<br />hwy: 17.15833<br />drv: 4","displ: 4.239241<br />hwy: 17.30363<br />drv: 4","displ: 4.179747<br />hwy: 17.45557<br />drv: 4","displ: 4.120253<br />hwy: 17.61282<br />drv: 4","displ: 4.060759<br />hwy: 17.77407<br />drv: 4","displ: 4.001266<br />hwy: 17.93799<br />drv: 4","displ: 3.941772<br />hwy: 18.11416<br />drv: 4","displ: 3.882278<br />hwy: 18.29129<br />drv: 4","displ: 3.822785<br />hwy: 18.46854<br />drv: 4","displ: 3.763291<br />hwy: 18.65211<br />drv: 4","displ: 3.703797<br />hwy: 18.84229<br />drv: 4","displ: 3.644304<br />hwy: 19.03939<br />drv: 4","displ: 3.584810<br />hwy: 19.24369<br />drv: 4","displ: 3.525316<br />hwy: 19.45549<br />drv: 4","displ: 3.465823<br />hwy: 19.67509<br />drv: 4","displ: 3.406329<br />hwy: 19.90279<br />drv: 4","displ: 3.346835<br />hwy: 20.13887<br />drv: 4","displ: 3.287342<br />hwy: 20.38364<br />drv: 4","displ: 3.227848<br />hwy: 20.63738<br />drv: 4","displ: 3.168354<br />hwy: 20.90040<br />drv: 4","displ: 3.108861<br />hwy: 21.17299<br />drv: 4","displ: 3.049367<br />hwy: 21.45544<br />drv: 4","displ: 2.989873<br />hwy: 21.74818<br />drv: 4","displ: 2.930380<br />hwy: 22.05552<br />drv: 4","displ: 2.870886<br />hwy: 22.37608<br />drv: 4","displ: 2.811392<br />hwy: 22.70512<br />drv: 4","displ: 2.751899<br />hwy: 23.03789<br />drv: 4","displ: 2.692405<br />hwy: 23.36965<br />drv: 4","displ: 2.632911<br />hwy: 23.69564<br />drv: 4","displ: 2.573418<br />hwy: 24.01113<br />drv: 4","displ: 2.513924<br />hwy: 24.31135<br />drv: 4","displ: 2.454430<br />hwy: 24.59730<br />drv: 4","displ: 2.394937<br />hwy: 24.88008<br />drv: 4","displ: 2.335443<br />hwy: 25.16052<br />drv: 4","displ: 2.275949<br />hwy: 25.43893<br />drv: 4","displ: 2.216456<br />hwy: 25.71563<br />drv: 4","displ: 2.156962<br />hwy: 25.98820<br />drv: 4","displ: 2.097468<br />hwy: 26.25076<br />drv: 4","displ: 2.037975<br />hwy: 26.50538<br />drv: 4","displ: 1.978481<br />hwy: 26.75458<br />drv: 4","displ: 1.918987<br />hwy: 27.00085<br />drv: 4","displ: 1.859494<br />hwy: 27.24672<br />drv: 4","displ: 1.800000<br />hwy: 27.49469<br />drv: 4","displ: 1.800000<br />hwy: 27.49469<br />drv: 4"],"type":"scatter","mode":"lines","line":{"width":3.7795275590551185,"color":"transparent","dash":"solid"},"fill":"toself","fillcolor":"rgba(153,153,153,0.4)","hoveron":"points","hoverinfo":"x+y","name":"(4,1)","legendgroup":"(4,1)","showlegend":false,"xaxis":"x","yaxis":"y","frame":null},{"x":[1.6000000000000001,1.6468354430379748,1.6936708860759495,1.7405063291139242,1.7873417721518989,1.8341772151898734,1.8810126582278481,1.9278481012658228,1.9746835443037976,2.0215189873417723,2.0683544303797468,2.1151898734177217,2.1620253164556962,2.2088607594936711,2.2556962025316456,2.3025316455696201,2.349367088607595,2.39620253164557,2.4430379746835444,2.4898734177215189,2.5367088607594939,2.5835443037974684,2.6303797468354428,2.6772151898734178,2.7240506329113927,2.7708860759493672,2.8177215189873417,2.8645569620253166,2.9113924050632911,2.9582278481012656,3.0050632911392405,3.0518987341772155,3.09873417721519,3.1455696202531644,3.1924050632911394,3.2392405063291143,3.2860759493670888,3.3329113924050633,3.3797468354430382,3.4265822784810127,3.4734177215189872,3.5202531645569621,3.5670886075949371,3.6139240506329116,3.660759493670886,3.707594936708861,3.7544303797468355,3.8012658227848104,3.8481012658227849,3.8949367088607594,3.9417721518987343,3.9886075949367088,4.0354430379746837,4.0822784810126578,4.1291139240506336,4.1759493670886076,4.2227848101265817,4.2696202531645575,4.3164556962025316,4.3632911392405065,4.4101265822784814,4.4569620253164555,4.5037974683544304,4.5506329113924053,4.5974683544303794,4.6443037974683543,4.6911392405063292,4.7379746835443033,4.7848101265822791,4.8316455696202532,4.8784810126582281,4.925316455696203,4.9721518987341771,5.018987341772152,5.0658227848101269,5.112658227848101,5.1594936708860759,5.2063291139240508,5.2531645569620249,5.2999999999999998,5.2999999999999998,5.2531645569620249,5.2063291139240508,5.1594936708860759,5.112658227848101,5.0658227848101269,5.018987341772152,4.9721518987341771,4.925316455696203,4.8784810126582281,4.8316455696202532,4.7848101265822791,4.7379746835443033,4.6911392405063292,4.6443037974683543,4.5974683544303794,4.5506329113924053,4.5037974683544304,4.4569620253164555,4.4101265822784814,4.3632911392405065,4.3164556962025316,4.2696202531645575,4.2227848101265817,4.1759493670886076,4.1291139240506336,4.0822784810126578,4.0354430379746837,3.9886075949367088,3.9417721518987343,3.8949367088607594,3.8481012658227849,3.8012658227848104,3.7544303797468355,3.707594936708861,3.660759493670886,3.6139240506329116,3.5670886075949371,3.5202531645569621,3.4734177215189872,3.4265822784810127,3.3797468354430382,3.3329113924050633,3.2860759493670888,3.2392405063291143,3.1924050632911394,3.1455696202531644,3.09873417721519,3.0518987341772155,3.0050632911392405,2.9582278481012656,2.9113924050632911,2.8645569620253166,2.8177215189873417,2.7708860759493672,2.7240506329113927,2.6772151898734178,2.6303797468354428,2.5835443037974684,2.5367088607594939,2.4898734177215189,2.4430379746835444,2.39620253164557,2.349367088607595,2.3025316455696201,2.2556962025316456,2.2088607594936711,2.1620253164556962,2.1151898734177217,2.0683544303797468,2.0215189873417723,1.9746835443037976,1.9278481012658228,1.8810126582278481,1.8341772151898734,1.7873417721518989,1.7405063291139242,1.6936708860759495,1.6468354430379748,1.6000000000000001,1.6000000000000001],"y":[31.029415872969977,31.046692585904637,31.013696236075184,30.923984535285651,30.771258154799792,30.553381779268282,30.277663380756515,29.966837140323705,29.647920738287816,29.303867343986219,28.934484460689259,28.550956335958467,28.174759818421748,27.847672072586271,27.63893522190104,27.481031636667627,27.298399568208701,27.073274928463292,26.837393867328579,26.612578612578609,26.370432454994713,26.095653076899833,25.796549542351357,25.501979102979888,25.236880006633932,24.958989065475684,24.657038241753554,24.336885662272248,24.022301107138979,23.755024261307593,23.584911654241402,23.488817606343471,23.426955573439361,23.393178281825147,23.381464915326461,23.386014903942339,23.401248538412833,23.42169427307077,23.4417446791118,23.455280746225757,23.455202972874737,23.433462713838146,23.390036362802537,23.331620801451848,23.263761453229161,23.190610642395448,23.115084709878257,23.039105809289165,22.963831027383552,22.889837436991368,22.81726199870409,22.745905279247403,22.675309317675676,22.604818418331384,22.533629490345994,22.460836522411057,22.385472024259435,22.306546768929095,22.223087923533427,22.134174700200752,22.038970064493984,21.936746865385636,21.826906999249069,21.708992806483273,21.582690665816497,21.447827510451532,21.304361580211893,21.152369051112402,20.992028235740904,20.823602876854018,20.647425748122711,20.463883417036172,20.273402683284239,20.07643892212517,19.873466352103758,19.664970108136295,19.451439922775752,19.23336518530326,19.011231145600178,18.785516045504597,31.311876114320047,30.972432679125376,30.645866860903336,30.332309844226796,30.031899821711896,29.744779125374539,29.471090430502464,29.210971814746728,28.964550439386905,28.731934622416031,28.513204106258719,28.30839840113893,28.117503223462393,27.940435258720509,27.777025762235894,27.627003852758147,27.489980712845551,27.365436218435661,27.252709690991537,27.15099641364689,27.0593512255099,26.976699918287821,26.901858400278364,26.8335588263446,26.770481306334716,26.711289556021427,26.654669027872387,26.599366653313908,26.544232284212249,26.488263167644647,26.430654285400241,26.370859146939484,26.308667655588646,26.244309826912431,26.178595690401004,26.113100342400703,26.050393066573861,25.994279129916226,25.949956898605635,25.921828242281677,25.903663157908642,25.893401164167813,25.891301882087447,25.898605423923517,25.917063483437829,25.948563637529368,25.994885299504322,26.057587021927883,26.138007111191857,26.237357416158446,26.372298308444915,26.56622810197814,26.819489735717088,27.123475681866736,27.451608507785508,27.759399127529242,28.003685997865539,28.224366356837159,28.457031249536865,28.722488615194209,29.020998205465503,29.329208390272669,29.609867578639246,29.763871636044101,29.834592292761375,29.939543117949466,30.138440020150433,30.421123595746614,30.735328132570146,31.068523074667848,31.391007544764747,31.673429833740073,31.959991532229566,32.285466167287744,32.66843718880336,33.124141398300011,33.659695066254443,34.272771175728515,34.956878696397325,35.705383638476164,31.029415872969977],"text":["displ: 1.600000<br />hwy: 33.36740<br />drv: f","displ: 1.646835<br />hwy: 33.00179<br />drv: f","displ: 1.693671<br />hwy: 32.64323<br />drv: f","displ: 1.740506<br />hwy: 32.29184<br />drv: f","displ: 1.787342<br />hwy: 31.94770<br />drv: f","displ: 1.834177<br />hwy: 31.61091<br />drv: f","displ: 1.881013<br />hwy: 31.28156<br />drv: f","displ: 1.927848<br />hwy: 30.96341<br />drv: f","displ: 1.974684<br />hwy: 30.66068<br />drv: f","displ: 2.021519<br />hwy: 30.34744<br />drv: f","displ: 2.068354<br />hwy: 30.00150<br />drv: f","displ: 2.115190<br />hwy: 29.64314<br />drv: f","displ: 2.162025<br />hwy: 29.29794<br />drv: f","displ: 2.208861<br />hwy: 28.99306<br />drv: f","displ: 2.255696<br />hwy: 28.78924<br />drv: f","displ: 2.302532<br />hwy: 28.65781<br />drv: f","displ: 2.349367<br />hwy: 28.53114<br />drv: f","displ: 2.396203<br />hwy: 28.34157<br />drv: f","displ: 2.443038<br />hwy: 28.08330<br />drv: f","displ: 2.489873<br />hwy: 27.81679<br />drv: f","displ: 2.536709<br />hwy: 27.54646<br />drv: f","displ: 2.583544<br />hwy: 27.27634<br />drv: f","displ: 2.630380<br />hwy: 27.01046<br />drv: f","displ: 2.677215<br />hwy: 26.75283<br />drv: f","displ: 2.724051<br />hwy: 26.49814<br />drv: f","displ: 2.770886<br />hwy: 26.20530<br />drv: f","displ: 2.817722<br />hwy: 25.89026<br />drv: f","displ: 2.864557<br />hwy: 25.57819<br />drv: f","displ: 2.911392<br />hwy: 25.29426<br />drv: f","displ: 2.958228<br />hwy: 25.06366<br />drv: f","displ: 3.005063<br />hwy: 24.91113<br />drv: f","displ: 3.051899<br />hwy: 24.81341<br />drv: f","displ: 3.098734<br />hwy: 24.74227<br />drv: f","displ: 3.145570<br />hwy: 24.69403<br />drv: f","displ: 3.192405<br />hwy: 24.66501<br />drv: f","displ: 3.239241<br />hwy: 24.65154<br />drv: f","displ: 3.286076<br />hwy: 24.64993<br />drv: f","displ: 3.332911<br />hwy: 24.65650<br />drv: f","displ: 3.379747<br />hwy: 24.66757<br />drv: f","displ: 3.426582<br />hwy: 24.67947<br />drv: f","displ: 3.473418<br />hwy: 24.68852<br />drv: f","displ: 3.520253<br />hwy: 24.69171<br />drv: f","displ: 3.567089<br />hwy: 24.69216<br />drv: f","displ: 3.613924<br />hwy: 24.69101<br />drv: f","displ: 3.660759<br />hwy: 24.68843<br />drv: f","displ: 3.707595<br />hwy: 24.68460<br />drv: f","displ: 3.754430<br />hwy: 24.67970<br />drv: f","displ: 3.801266<br />hwy: 24.67389<br />drv: f","displ: 3.848101<br />hwy: 24.66735<br />drv: f","displ: 3.894937<br />hwy: 24.66025<br />drv: f","displ: 3.941772<br />hwy: 24.65276<br />drv: f","displ: 3.988608<br />hwy: 24.64507<br />drv: f","displ: 4.035443<br />hwy: 24.63734<br />drv: f","displ: 4.082278<br />hwy: 24.62974<br />drv: f","displ: 4.129114<br />hwy: 24.62246<br />drv: f","displ: 4.175949<br />hwy: 24.61566<br />drv: f","displ: 4.222785<br />hwy: 24.60952<br />drv: f","displ: 4.269620<br />hwy: 24.60420<br />drv: f","displ: 4.316456<br />hwy: 24.59989<br />drv: f","displ: 4.363291<br />hwy: 24.59676<br />drv: f","displ: 4.410127<br />hwy: 24.59498<br />drv: f","displ: 4.456962<br />hwy: 24.59473<br />drv: f","displ: 4.503797<br />hwy: 24.59617<br />drv: f","displ: 4.550633<br />hwy: 24.59949<br />drv: f","displ: 4.597468<br />hwy: 24.60485<br />drv: f","displ: 4.644304<br />hwy: 24.61243<br />drv: f","displ: 4.691139<br />hwy: 24.62240<br />drv: f","displ: 4.737975<br />hwy: 24.63494<br />drv: f","displ: 4.784810<br />hwy: 24.65021<br />drv: f","displ: 4.831646<br />hwy: 24.66840<br />drv: f","displ: 4.878481<br />hwy: 24.68968<br />drv: f","displ: 4.925316<br />hwy: 24.71422<br />drv: f","displ: 4.972152<br />hwy: 24.74219<br />drv: f","displ: 5.018987<br />hwy: 24.77376<br />drv: f","displ: 5.065823<br />hwy: 24.80912<br />drv: f","displ: 5.112658<br />hwy: 24.84843<br />drv: f","displ: 5.159494<br />hwy: 24.89187<br />drv: f","displ: 5.206329<br />hwy: 24.93962<br />drv: f","displ: 5.253165<br />hwy: 24.99183<br />drv: f","displ: 5.300000<br />hwy: 25.04870<br />drv: f","displ: 5.300000<br />hwy: 25.04870<br />drv: f","displ: 5.253165<br />hwy: 24.99183<br />drv: f","displ: 5.206329<br />hwy: 24.93962<br />drv: f","displ: 5.159494<br />hwy: 24.89187<br />drv: f","displ: 5.112658<br />hwy: 24.84843<br />drv: f","displ: 5.065823<br />hwy: 24.80912<br />drv: f","displ: 5.018987<br />hwy: 24.77376<br />drv: f","displ: 4.972152<br />hwy: 24.74219<br />drv: f","displ: 4.925316<br />hwy: 24.71422<br />drv: f","displ: 4.878481<br />hwy: 24.68968<br />drv: f","displ: 4.831646<br />hwy: 24.66840<br />drv: f","displ: 4.784810<br />hwy: 24.65021<br />drv: f","displ: 4.737975<br />hwy: 24.63494<br />drv: f","displ: 4.691139<br />hwy: 24.62240<br />drv: f","displ: 4.644304<br />hwy: 24.61243<br />drv: f","displ: 4.597468<br />hwy: 24.60485<br />drv: f","displ: 4.550633<br />hwy: 24.59949<br />drv: f","displ: 4.503797<br />hwy: 24.59617<br />drv: f","displ: 4.456962<br />hwy: 24.59473<br />drv: f","displ: 4.410127<br />hwy: 24.59498<br />drv: f","displ: 4.363291<br />hwy: 24.59676<br />drv: f","displ: 4.316456<br />hwy: 24.59989<br />drv: f","displ: 4.269620<br />hwy: 24.60420<br />drv: f","displ: 4.222785<br />hwy: 24.60952<br />drv: f","displ: 4.175949<br />hwy: 24.61566<br />drv: f","displ: 4.129114<br />hwy: 24.62246<br />drv: f","displ: 4.082278<br />hwy: 24.62974<br />drv: f","displ: 4.035443<br />hwy: 24.63734<br />drv: f","displ: 3.988608<br />hwy: 24.64507<br />drv: f","displ: 3.941772<br />hwy: 24.65276<br />drv: f","displ: 3.894937<br />hwy: 24.66025<br />drv: f","displ: 3.848101<br />hwy: 24.66735<br />drv: f","displ: 3.801266<br />hwy: 24.67389<br />drv: f","displ: 3.754430<br />hwy: 24.67970<br />drv: f","displ: 3.707595<br />hwy: 24.68460<br />drv: f","displ: 3.660759<br />hwy: 24.68843<br />drv: f","displ: 3.613924<br />hwy: 24.69101<br />drv: f","displ: 3.567089<br />hwy: 24.69216<br />drv: f","displ: 3.520253<br />hwy: 24.69171<br />drv: f","displ: 3.473418<br />hwy: 24.68852<br />drv: f","displ: 3.426582<br />hwy: 24.67947<br />drv: f","displ: 3.379747<br />hwy: 24.66757<br />drv: f","displ: 3.332911<br />hwy: 24.65650<br />drv: f","displ: 3.286076<br />hwy: 24.64993<br />drv: f","displ: 3.239241<br />hwy: 24.65154<br />drv: f","displ: 3.192405<br />hwy: 24.66501<br />drv: f","displ: 3.145570<br />hwy: 24.69403<br />drv: f","displ: 3.098734<br />hwy: 24.74227<br />drv: f","displ: 3.051899<br />hwy: 24.81341<br />drv: f","displ: 3.005063<br />hwy: 24.91113<br />drv: f","displ: 2.958228<br />hwy: 25.06366<br />drv: f","displ: 2.911392<br />hwy: 25.29426<br />drv: f","displ: 2.864557<br />hwy: 25.57819<br />drv: f","displ: 2.817722<br />hwy: 25.89026<br />drv: f","displ: 2.770886<br />hwy: 26.20530<br />drv: f","displ: 2.724051<br />hwy: 26.49814<br />drv: f","displ: 2.677215<br />hwy: 26.75283<br />drv: f","displ: 2.630380<br />hwy: 27.01046<br />drv: f","displ: 2.583544<br />hwy: 27.27634<br />drv: f","displ: 2.536709<br />hwy: 27.54646<br />drv: f","displ: 2.489873<br />hwy: 27.81679<br />drv: f","displ: 2.443038<br />hwy: 28.08330<br />drv: f","displ: 2.396203<br />hwy: 28.34157<br />drv: f","displ: 2.349367<br />hwy: 28.53114<br />drv: f","displ: 2.302532<br />hwy: 28.65781<br />drv: f","displ: 2.255696<br />hwy: 28.78924<br />drv: f","displ: 2.208861<br />hwy: 28.99306<br />drv: f","displ: 2.162025<br />hwy: 29.29794<br />drv: f","displ: 2.115190<br />hwy: 29.64314<br />drv: f","displ: 2.068354<br />hwy: 30.00150<br />drv: f","displ: 2.021519<br />hwy: 30.34744<br />drv: f","displ: 1.974684<br />hwy: 30.66068<br />drv: f","displ: 1.927848<br />hwy: 30.96341<br />drv: f","displ: 1.881013<br />hwy: 31.28156<br />drv: f","displ: 1.834177<br />hwy: 31.61091<br />drv: f","displ: 1.787342<br />hwy: 31.94770<br />drv: f","displ: 1.740506<br />hwy: 32.29184<br />drv: f","displ: 1.693671<br />hwy: 32.64323<br />drv: f","displ: 1.646835<br />hwy: 33.00179<br />drv: f","displ: 1.600000<br />hwy: 33.36740<br />drv: f","displ: 1.600000<br />hwy: 33.36740<br />drv: f"],"type":"scatter","mode":"lines","line":{"width":3.7795275590551185,"color":"transparent","dash":"dash"},"fill":"toself","fillcolor":"rgba(153,153,153,0.4)","hoveron":"points","hoverinfo":"x+y","name":"(f,1)","legendgroup":"(f,1)","showlegend":false,"xaxis":"x","yaxis":"y","frame":null},{"x":[3.7999999999999998,3.8405063291139241,3.8810126582278479,3.9215189873417722,3.962025316455696,4.0025316455696203,4.0430379746835445,4.0835443037974679,4.1240506329113922,4.1645569620253164,4.2050632911392407,4.2455696202531641,4.2860759493670884,4.3265822784810126,4.3670886075949369,4.4075949367088603,4.4481012658227845,4.4886075949367088,4.5291139240506331,4.5696202531645564,4.6101265822784807,4.650632911392405,4.6911392405063292,4.7316455696202526,4.7721518987341769,4.8126582278481012,4.8531645569620254,4.8936708860759488,4.9341772151898731,4.9746835443037973,5.0151898734177216,5.0556962025316459,5.0962025316455692,5.1367088607594935,5.1772151898734178,5.2177215189873412,5.2582278481012654,5.2987341772151897,5.339240506329114,5.3797468354430382,5.4202531645569616,5.4607594936708859,5.5012658227848101,5.5417721518987335,5.5822784810126578,5.622784810126582,5.6632911392405063,5.7037974683544306,5.7443037974683548,5.7848101265822782,5.8253164556962025,5.8658227848101259,5.9063291139240501,5.9468354430379744,5.9873417721518987,6.0278481012658229,6.0683544303797472,6.1088607594936706,6.1493670886075948,6.1898734177215182,6.2303797468354425,6.2708860759493668,6.311392405063291,6.3518987341772153,6.3924050632911396,6.4329113924050638,6.4734177215189872,6.5139240506329115,6.5544303797468348,6.5949367088607591,6.6354430379746834,6.6759493670886076,6.7164556962025319,6.7569620253164562,6.7974683544303796,6.8379746835443038,6.8784810126582272,6.9189873417721515,6.9594936708860757,7,7,7,6.9594936708860757,6.9189873417721515,6.8784810126582272,6.8379746835443038,6.7974683544303796,6.7569620253164562,6.7164556962025319,6.6759493670886076,6.6354430379746834,6.5949367088607591,6.5544303797468348,6.5139240506329115,6.4734177215189872,6.4329113924050638,6.3924050632911396,6.3518987341772153,6.311392405063291,6.2708860759493668,6.2303797468354425,6.1898734177215182,6.1493670886075948,6.1088607594936706,6.0683544303797472,6.0278481012658229,5.9873417721518987,5.9468354430379744,5.9063291139240501,5.8658227848101259,5.8253164556962025,5.7848101265822782,5.7443037974683548,5.7037974683544306,5.6632911392405063,5.622784810126582,5.5822784810126578,5.5417721518987335,5.5012658227848101,5.4607594936708859,5.4202531645569616,5.3797468354430382,5.339240506329114,5.2987341772151897,5.2582278481012654,5.2177215189873412,5.1772151898734178,5.1367088607594935,5.0962025316455692,5.0556962025316459,5.0151898734177216,4.9746835443037973,4.9341772151898731,4.8936708860759488,4.8531645569620254,4.8126582278481012,4.7721518987341769,4.7316455696202526,4.6911392405063292,4.650632911392405,4.6101265822784807,4.5696202531645564,4.5291139240506331,4.4886075949367088,4.4481012658227845,4.4075949367088603,4.3670886075949369,4.3265822784810126,4.2860759493670884,4.2455696202531641,4.2050632911392407,4.1645569620253164,4.1240506329113922,4.0835443037974679,4.0430379746835445,4.0025316455696203,3.962025316455696,3.9215189873417722,3.8810126582278479,3.8405063291139241,3.7999999999999998,3.7999999999999998],"y":[21.855944632366711,22.146687289901376,22.257622565233401,22.213902843797065,22.049912430086259,21.8017172020777,21.518182390570033,21.242998113971201,20.992128722917005,20.769103228984363,20.569876359856028,20.385814032287985,20.205762592965517,20.017937705307538,19.812059635851046,19.581708147824241,19.326305191762458,19.051857825173581,18.770028198022164,18.495946584409829,18.247516951827784,18.061010426144136,17.872327619900823,17.570498054264604,17.085055920051122,16.421536508580452,15.635846919592463,14.79608739376622,13.96577196546178,13.201481817248702,12.554459840793164,12.072295054391795,11.799946174538197,11.780037876823455,12.052176555970579,12.649998278390303,13.589974312604493,14.814286886492081,15.835942877051822,16.4144985350644,16.798280803768765,16.986133975052923,17.082477479855694,17.128683044427376,17.139755324849443,17.142148336078861,17.182638370466119,17.318572412532049,17.622804306834531,18.063750471997999,18.55403726441228,19.013442227610735,19.388550729189003,19.666704920155087,19.866815784080579,20.021001639816383,20.169086718236475,20.313091020212287,20.452233361412176,20.585421661802101,20.711244304904604,20.827956985145121,20.933470221024475,21.0253439156151,21.100796681172969,21.156738463207883,21.189834331578894,21.196604069984172,21.17355576647169,21.117342653306714,21.024923484481043,20.893701620820465,20.721619959207324,20.507198205710928,20.249512360759095,19.948128358229347,19.603008462519306,19.214409304578879,18.782786155770033,18.308712053023424,18.308712053023424,30.193404102501173,29.887809207269072,29.599922587650425,29.330293038288502,29.07935158825795,28.847330626221297,28.63416817428881,28.439405924050668,28.26209563364732,28.100732766860716,27.953235978285853,27.816984386461176,27.688912503091085,27.565649318153532,27.443678677409114,27.319496122268649,27.189742480303831,27.051303454737099,26.90137341553708,26.737488023488851,26.557533554805886,26.359741461626236,26.142675885185117,25.905220503161129,25.646569888935247,25.363570387531105,25.029730981395577,24.681409474043253,24.369175335284528,24.112029202366237,23.888214929122796,23.649168545326418,23.339174893605701,22.981251045253,22.653686706915209,22.34861550690545,22.04721239426879,21.710330040656789,21.287371758845467,20.754107931779696,20.243882303487997,20.403290419820301,21.88253743333237,23.988677863752752,25.659751542253769,26.853685316348407,27.60269507419266,27.956161501831339,27.969435613621542,27.700886704788459,27.211218111459782,26.563763471566208,25.825510296408019,25.068784388188877,24.372844400902913,23.821535194863291,23.486508489443978,23.389044195599119,23.47442112377847,23.647413414782868,23.836826865707188,24.028769242204714,24.234811952783733,24.466084749007649,24.730249258302774,25.029312015638784,25.358694449012759,25.707975799114731,26.062875809943424,26.407609622379542,26.727023060570154,27.008481518733038,27.243939202012687,27.432924599447794,27.587401539135978,27.756669957498794,27.997970325218425,28.343666200429748,28.824397021603151,29.461570308149408,21.855944632366711],"text":["displ: 3.800000<br />hwy: 25.65876<br />drv: r","displ: 3.840506<br />hwy: 25.48554<br />drv: r","displ: 3.881013<br />hwy: 25.30064<br />drv: r","displ: 3.921519<br />hwy: 25.10594<br />drv: r","displ: 3.962025<br />hwy: 24.90329<br />drv: r","displ: 4.002532<br />hwy: 24.69456<br />drv: r","displ: 4.043038<br />hwy: 24.47555<br />drv: r","displ: 4.083544<br />hwy: 24.24347<br />drv: r","displ: 4.124051<br />hwy: 24.00031<br />drv: r","displ: 4.164557<br />hwy: 23.74806<br />drv: r","displ: 4.205063<br />hwy: 23.48874<br />drv: r","displ: 4.245570<br />hwy: 23.22434<br />drv: r","displ: 4.286076<br />hwy: 22.95687<br />drv: r","displ: 4.326582<br />hwy: 22.68832<br />drv: r","displ: 4.367089<br />hwy: 22.42069<br />drv: r","displ: 4.407595<br />hwy: 22.15598<br />drv: r","displ: 4.448101<br />hwy: 21.89619<br />drv: r","displ: 4.488608<br />hwy: 21.64333<br />drv: r","displ: 4.529114<br />hwy: 21.39940<br />drv: r","displ: 4.569620<br />hwy: 21.16639<br />drv: r","displ: 4.610127<br />hwy: 20.94747<br />drv: r","displ: 4.650633<br />hwy: 20.76772<br />drv: r","displ: 4.691139<br />hwy: 20.63069<br />drv: r","displ: 4.731646<br />hwy: 20.52850<br />drv: r","displ: 4.772152<br />hwy: 20.45330<br />drv: r","displ: 4.812658<br />hwy: 20.39719<br />drv: r","displ: 4.853165<br />hwy: 20.35232<br />drv: r","displ: 4.893671<br />hwy: 20.31080<br />drv: r","displ: 4.934177<br />hwy: 20.26477<br />drv: r","displ: 4.974684<br />hwy: 20.20635<br />drv: r","displ: 5.015190<br />hwy: 20.12767<br />drv: r","displ: 5.055696<br />hwy: 20.02087<br />drv: r","displ: 5.096203<br />hwy: 19.87805<br />drv: r","displ: 5.136709<br />hwy: 19.69137<br />drv: r","displ: 5.177215<br />hwy: 19.45293<br />drv: r","displ: 5.217722<br />hwy: 19.15487<br />drv: r","displ: 5.258228<br />hwy: 18.78933<br />drv: r","displ: 5.298734<br />hwy: 18.34841<br />drv: r","displ: 5.339241<br />hwy: 18.11962<br />drv: r","displ: 5.379747<br />hwy: 18.32919<br />drv: r","displ: 5.420253<br />hwy: 18.77619<br />drv: r","displ: 5.460759<br />hwy: 19.13675<br />drv: r","displ: 5.501266<br />hwy: 19.39640<br />drv: r","displ: 5.541772<br />hwy: 19.58795<br />drv: r","displ: 5.582278<br />hwy: 19.74419<br />drv: r","displ: 5.622785<br />hwy: 19.89792<br />drv: r","displ: 5.663291<br />hwy: 20.08194<br />drv: r","displ: 5.703797<br />hwy: 20.32887<br />drv: r","displ: 5.744304<br />hwy: 20.63599<br />drv: r","displ: 5.784810<br />hwy: 20.97598<br />drv: r","displ: 5.825316<br />hwy: 21.33303<br />drv: r","displ: 5.865823<br />hwy: 21.69131<br />drv: r","displ: 5.906329<br />hwy: 22.03498<br />drv: r","displ: 5.946835<br />hwy: 22.34822<br />drv: r","displ: 5.987342<br />hwy: 22.61519<br />drv: r","displ: 6.027848<br />hwy: 22.83379<br />drv: r","displ: 6.068354<br />hwy: 23.03715<br />drv: r","displ: 6.108861<br />hwy: 23.22788<br />drv: r","displ: 6.149367<br />hwy: 23.40599<br />drv: r","displ: 6.189873<br />hwy: 23.57148<br />drv: r","displ: 6.230380<br />hwy: 23.72437<br />drv: r","displ: 6.270886<br />hwy: 23.86467<br />drv: r","displ: 6.311392<br />hwy: 23.99239<br />drv: r","displ: 6.351899<br />hwy: 24.10754<br />drv: r","displ: 6.392405<br />hwy: 24.21015<br />drv: r","displ: 6.432911<br />hwy: 24.30021<br />drv: r","displ: 6.473418<br />hwy: 24.37774<br />drv: r","displ: 6.513924<br />hwy: 24.44276<br />drv: r","displ: 6.554430<br />hwy: 24.49527<br />drv: r","displ: 6.594937<br />hwy: 24.53529<br />drv: r","displ: 6.635443<br />hwy: 24.56283<br />drv: r","displ: 6.675949<br />hwy: 24.57790<br />drv: r","displ: 6.716456<br />hwy: 24.58051<br />drv: r","displ: 6.756962<br />hwy: 24.57068<br />drv: r","displ: 6.797468<br />hwy: 24.54842<br />drv: r","displ: 6.837975<br />hwy: 24.51374<br />drv: r","displ: 6.878481<br />hwy: 24.46665<br />drv: r","displ: 6.918987<br />hwy: 24.40717<br />drv: r","displ: 6.959494<br />hwy: 24.33530<br />drv: r","displ: 7.000000<br />hwy: 24.25106<br />drv: r","displ: 7.000000<br />hwy: 24.25106<br />drv: r","displ: 7.000000<br />hwy: 24.25106<br />drv: r","displ: 6.959494<br />hwy: 24.33530<br />drv: r","displ: 6.918987<br />hwy: 24.40717<br />drv: r","displ: 6.878481<br />hwy: 24.46665<br />drv: r","displ: 6.837975<br />hwy: 24.51374<br />drv: r","displ: 6.797468<br />hwy: 24.54842<br />drv: r","displ: 6.756962<br />hwy: 24.57068<br />drv: r","displ: 6.716456<br />hwy: 24.58051<br />drv: r","displ: 6.675949<br />hwy: 24.57790<br />drv: r","displ: 6.635443<br />hwy: 24.56283<br />drv: r","displ: 6.594937<br />hwy: 24.53529<br />drv: r","displ: 6.554430<br />hwy: 24.49527<br />drv: r","displ: 6.513924<br />hwy: 24.44276<br />drv: r","displ: 6.473418<br />hwy: 24.37774<br />drv: r","displ: 6.432911<br />hwy: 24.30021<br />drv: r","displ: 6.392405<br />hwy: 24.21015<br />drv: r","displ: 6.351899<br />hwy: 24.10754<br />drv: r","displ: 6.311392<br />hwy: 23.99239<br />drv: r","displ: 6.270886<br />hwy: 23.86467<br />drv: r","displ: 6.230380<br />hwy: 23.72437<br />drv: r","displ: 6.189873<br />hwy: 23.57148<br />drv: r","displ: 6.149367<br />hwy: 23.40599<br />drv: r","displ: 6.108861<br />hwy: 23.22788<br />drv: r","displ: 6.068354<br />hwy: 23.03715<br />drv: r","displ: 6.027848<br />hwy: 22.83379<br />drv: r","displ: 5.987342<br />hwy: 22.61519<br />drv: r","displ: 5.946835<br />hwy: 22.34822<br />drv: r","displ: 5.906329<br />hwy: 22.03498<br />drv: r","displ: 5.865823<br />hwy: 21.69131<br />drv: r","displ: 5.825316<br />hwy: 21.33303<br />drv: r","displ: 5.784810<br />hwy: 20.97598<br />drv: r","displ: 5.744304<br />hwy: 20.63599<br />drv: r","displ: 5.703797<br />hwy: 20.32887<br />drv: r","displ: 5.663291<br />hwy: 20.08194<br />drv: r","displ: 5.622785<br />hwy: 19.89792<br />drv: r","displ: 5.582278<br />hwy: 19.74419<br />drv: r","displ: 5.541772<br />hwy: 19.58795<br />drv: r","displ: 5.501266<br />hwy: 19.39640<br />drv: r","displ: 5.460759<br />hwy: 19.13675<br />drv: r","displ: 5.420253<br />hwy: 18.77619<br />drv: r","displ: 5.379747<br />hwy: 18.32919<br />drv: r","displ: 5.339241<br />hwy: 18.11962<br />drv: r","displ: 5.298734<br />hwy: 18.34841<br />drv: r","displ: 5.258228<br />hwy: 18.78933<br />drv: r","displ: 5.217722<br />hwy: 19.15487<br />drv: r","displ: 5.177215<br />hwy: 19.45293<br />drv: r","displ: 5.136709<br />hwy: 19.69137<br />drv: r","displ: 5.096203<br />hwy: 19.87805<br />drv: r","displ: 5.055696<br />hwy: 20.02087<br />drv: r","displ: 5.015190<br />hwy: 20.12767<br />drv: r","displ: 4.974684<br />hwy: 20.20635<br />drv: r","displ: 4.934177<br />hwy: 20.26477<br />drv: r","displ: 4.893671<br />hwy: 20.31080<br />drv: r","displ: 4.853165<br />hwy: 20.35232<br />drv: r","displ: 4.812658<br />hwy: 20.39719<br />drv: r","displ: 4.772152<br />hwy: 20.45330<br />drv: r","displ: 4.731646<br />hwy: 20.52850<br />drv: r","displ: 4.691139<br />hwy: 20.63069<br />drv: r","displ: 4.650633<br />hwy: 20.76772<br />drv: r","displ: 4.610127<br />hwy: 20.94747<br />drv: r","displ: 4.569620<br />hwy: 21.16639<br />drv: r","displ: 4.529114<br />hwy: 21.39940<br />drv: r","displ: 4.488608<br />hwy: 21.64333<br />drv: r","displ: 4.448101<br />hwy: 21.89619<br />drv: r","displ: 4.407595<br />hwy: 22.15598<br />drv: r","displ: 4.367089<br />hwy: 22.42069<br />drv: r","displ: 4.326582<br />hwy: 22.68832<br />drv: r","displ: 4.286076<br />hwy: 22.95687<br />drv: r","displ: 4.245570<br />hwy: 23.22434<br />drv: r","displ: 4.205063<br />hwy: 23.48874<br />drv: r","displ: 4.164557<br />hwy: 23.74806<br />drv: r","displ: 4.124051<br />hwy: 24.00031<br />drv: r","displ: 4.083544<br />hwy: 24.24347<br />drv: r","displ: 4.043038<br />hwy: 24.47555<br />drv: r","displ: 4.002532<br />hwy: 24.69456<br />drv: r","displ: 3.962025<br />hwy: 24.90329<br />drv: r","displ: 3.921519<br />hwy: 25.10594<br />drv: r","displ: 3.881013<br />hwy: 25.30064<br />drv: r","displ: 3.840506<br />hwy: 25.48554<br />drv: r","displ: 3.800000<br />hwy: 25.65876<br />drv: r","displ: 3.800000<br />hwy: 25.65876<br />drv: r"],"type":"scatter","mode":"lines","line":{"width":3.7795275590551185,"color":"transparent","dash":"dot"},"fill":"toself","fillcolor":"rgba(153,153,153,0.4)","hoveron":"points","hoverinfo":"x+y","name":"(r,1)","legendgroup":"(r,1)","showlegend":false,"xaxis":"x","yaxis":"y","frame":null}],"layout":{"margin":{"t":23.305936073059364,"r":7.3059360730593621,"b":37.260273972602747,"l":37.260273972602747},"plot_bgcolor":"rgba(235,235,235,1)","paper_bgcolor":"rgba(255,255,255,1)","font":{"color":"rgba(0,0,0,1)","family":"","size":14.611872146118724},"xaxis":{"domain":[0,1],"automargin":true,"type":"linear","autorange":false,"range":[1.3300000000000001,7.2699999999999996],"tickmode":"array","ticktext":["2","3","4","5","6","7"],"tickvals":[2,3,4,5,6,7],"categoryorder":"array","categoryarray":["2","3","4","5","6","7"],"nticks":null,"ticks":"outside","tickcolor":"rgba(51,51,51,1)","ticklen":3.6529680365296811,"tickwidth":0.66417600664176002,"showticklabels":true,"tickfont":{"color":"rgba(77,77,77,1)","family":"","size":11.68949771689498},"tickangle":-0,"showline":false,"linecolor":null,"linewidth":0,"showgrid":true,"gridcolor":"rgba(255,255,255,1)","gridwidth":0.66417600664176002,"zeroline":false,"anchor":"y","title":{"text":"displ","font":{"color":"rgba(0,0,0,1)","family":"","size":14.611872146118724}},"hoverformat":".2f"},"yaxis":{"domain":[0,1],"automargin":true,"type":"linear","autorange":false,"range":[10.169039770664627,45.610998106158824],"tickmode":"array","ticktext":["20","30","40"],"tickvals":[20,30,40],"categoryorder":"array","categoryarray":["20","30","40"],"nticks":null,"ticks":"outside","tickcolor":"rgba(51,51,51,1)","ticklen":3.6529680365296811,"tickwidth":0.66417600664176002,"showticklabels":true,"tickfont":{"color":"rgba(77,77,77,1)","family":"","size":11.68949771689498},"tickangle":-0,"showline":false,"linecolor":null,"linewidth":0,"showgrid":true,"gridcolor":"rgba(255,255,255,1)","gridwidth":0.66417600664176002,"zeroline":false,"anchor":"x","title":{"text":"hwy","font":{"color":"rgba(0,0,0,1)","family":"","size":14.611872146118724}},"hoverformat":".2f"},"shapes":[],"showlegend":true,"legend":{"bgcolor":"rgba(255,255,255,1)","bordercolor":"transparent","borderwidth":1.8897637795275593,"font":{"color":"rgba(0,0,0,1)","family":"","size":11.68949771689498},"title":{"text":"drv","font":{"color":"rgba(0,0,0,1)","family":"","size":14.611872146118724}}},"hovermode":"closest","barmode":"relative"},"config":{"doubleClick":"reset","modeBarButtonsToAdd":["hoverclosest","hovercompare"],"showSendToCloud":false},"source":"A","attrs":{"24298dbddf85":{"x":{},"y":{},"colour":{},"type":"scatter"},"242985736a060":{"x":{},"y":{},"linetype":{}}},"cur_data":"24298dbddf85","visdat":{"24298dbddf85":["function (y) ","x"],"242985736a060":["function (y) ","x"]},"highlight":{"on":"plotly_click","persistent":false,"dynamic":false,"selectize":false,"opacityDim":0.20000000000000001,"selected":{"opacity":1},"debounce":0},"shinyEvents":["plotly_hover","plotly_click","plotly_selected","plotly_relayout","plotly_brushed","plotly_brushing","plotly_clickannotation","plotly_doubleclick","plotly_deselect","plotly_afterplot","plotly_sunburstclick"],"base_url":"https://plot.ly"},"evals":[],"jsHooks":[]}</script>
</div>
</div>
</section><section id="datatable" class="level2"><h2 class="anchored" data-anchor-id="datatable">datatable</h2>
<div class="cell">
<div class="code-copy-outer-scaffold"><div class="sourceCode" id="cb182" style="background: #f1f3f5;"><pre class="downlit sourceCode r code-with-copy"><code class="sourceCode R"><span><span class="kw" style="color: #003B4F;
background-color: null;
font-weight: bold;
font-style: inherit;"><a href="https://rdrr.io/r/base/library.html">library</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;"><a href="https://readxl.tidyverse.org">readxl</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">spi</span> <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">&lt;-</span> <span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://readxl.tidyverse.org/reference/read_excel.html">read_excel</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">here</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://here.r-lib.org/reference/here.html">here</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"blogs"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"2018-03-25_Maldives_R"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"data"</span>, <span class="st" style="color: #20794D;
background-color: null;
font-style: inherit;">"spi.xls"</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span>
<span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">DT</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;">::</span><span class="fu" style="color: #4758AB;
background-color: null;
font-style: inherit;"><a href="https://rdrr.io/pkg/DT/man/datatable.html">datatable</a></span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">(</span><span class="va" style="color: #111111;
background-color: null;
font-style: inherit;">spi</span>,fillContainer <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span>, editable <span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">=</span> <span class="cn" style="color: #8f5902;
background-color: null;
font-style: inherit;">TRUE</span><span class="op" style="color: #5E5E5E;
background-color: null;
font-style: inherit;">)</span></span></code></pre></div></div>
</div>


</section><div id="quarto-appendix" class="default"><section class="quarto-appendix-contents" id="quarto-citation"><h2 class="anchored quarto-appendix-heading">Citation</h2><div><div class="quarto-appendix-secondary-label">BibTeX citation:</div><pre class="sourceCode code-with-copy quarto-appendix-bibtex"><code class="sourceCode bibtex">@online{arfan_dilber2018,
  author = {Arfan Dilber, Muhammad},
  title = {Data {Analysis} with {R:} {Introduction} of {R} {Language}},
  date = {2018-03-25},
  url = {https://myaseen208.com/blogs/2018-03-25_Maldives_R/},
  langid = {en}
}
</code></pre><div class="quarto-appendix-secondary-label">For attribution, please cite this work as:</div><div id="ref-arfan_dilber2018" class="csl-entry quarto-appendix-citeas">
Arfan Dilber, Muhammad. 2018. <span>“Data Analysis with R: Introduction
of R Language.”</span> March 25. <a href="https://myaseen208.com/blogs/2018-03-25_Maldives_R/">https://myaseen208.com/blogs/2018-03-25_Maldives_R/</a>.
</div></div></section></div> ]]></description>
  <category>R</category>
  <category>Statistics</category>
  <category>Research</category>
  <guid>https://myaseen208.com/blogs/2018-03-25_Maldives_R/</guid>
  <pubDate>Sun, 25 Mar 2018 04:00:00 GMT</pubDate>
</item>
</channel>
</rss>
