<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Md Ahsanul Islam on Medium]]></title>
        <description><![CDATA[Stories by Md Ahsanul Islam on Medium]]></description>
        <link>https://medium.com/@mdahsanulhimel?source=rss-1cd9d1add8bf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*D4hmSutH832MSvSWqPj9ow.jpeg</url>
            <title>Stories by Md Ahsanul Islam on Medium</title>
            <link>https://medium.com/@mdahsanulhimel?source=rss-1cd9d1add8bf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 13:52:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mdahsanulhimel/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Statistical Civil War of Estimation]]></title>
            <link>https://mdahsanulhimel.medium.com/the-statistical-civil-war-of-estimation-313d448febd5?source=rss-1cd9d1add8bf------2</link>
            <guid isPermaLink="false">https://medium.com/p/313d448febd5</guid>
            <category><![CDATA[estimations]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[bayesian-statistics]]></category>
            <category><![CDATA[confidence-interval]]></category>
            <dc:creator><![CDATA[Md Ahsanul Islam]]></dc:creator>
            <pubDate>Wed, 03 Dec 2025 13:12:19 GMT</pubDate>
            <atom:updated>2025-12-03T13:12:19.038Z</atom:updated>
            <content:encoded><![CDATA[<h4>Frequentists, Bayesians, and the Quest for Truth</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/0*uLO0Kg3-JBcEes1S.jpg" /></figure><p>Today, estimation techniques sit quietly at the center of nearly every data-driven decision, from machine learning models predicting consumer choices to epidemiological simulations projecting disease spread. In the era of high-level programming, however, we rarely look beneath the hood. We treat powerful tools like Maximum Likelihood or Bayesian updates as simple utility functions, often forgetting that they stand on foundations laid by scholars who lived before the invention of the transistor. These early pioneers treated inference as a grand puzzle of logic and truth. While their names may be faded behind the glow of convenient software, the rigorous paths they cut through the wilderness of probability remain the bedrock of our statistical machinery.</p><h3>The Age of Inverse Probability</h3><p>The story begins in the 18th century, an era where probability was largely the domain of theology and gambling. When Thomas Bayes’ work was published after his death in 1763, it addressed a problem of “inverse probability”: given an observed event (data), what can be said about the unobserved cause (parameter)? [1] Pierre-Simon Laplace, the “Newton of France,” later adopted this framework with far greater mathematical rigor. For nearly 150 years, what we now call Bayesian inference was simply “the” method of statistical inference. Scientists operated under the assumption that it was perfectly logical to assign a probability distribution to a parameter, often using a flat or uniform prior (the Principle of Insufficient Reason) when they had no prior knowledge.</p><h3>The Frequentist Reformation</h3><p>In 1805, Adrien-Marie Legendre introduced the Method of Least Squares (LSE) to reconcile inconsistent observations of celestial bodies, though Carl Friedrich Gauss claimed to have used it as early as 1795 and provided its probabilistic justification in 1809 (linking it to the Normal distribution). [2]</p><p>Toward the end of the 19th century, the biometrician Karl Pearson sought computationally feasible ways to fit his system of continuous curves to biological data. In 1894, he formalized the Method of Moments (MoM). [3] Pearson’s logic was grounded in the Law of Large Numbers, which suggests that as sample size increases, sample moments (such as the sample mean or sample variance) converge to their theoretical population counterparts (population mean and variance). The estimation technique is algebraically direct: one establishes a system of equations by setting the sample moments equal to the population moments and solving for the unknown parameters. While MoM estimators are generally consistent, they often lack efficiency, meaning they may have higher variance compared to other methods because they do not utilize the full information contained within the likelihood function.</p><p>By the early 20th century, a fissure formed. A new generation of statisticians, led principally by Sir R.A. Fisher, grew deeply uncomfortable with the Bayesian reliance on priors. Fisher viewed the “Principle of Insufficient Reason”, assigning equal probability to all possibilities when ignorant, as mathematically inconsistent and philosophically flawed. He argued that science demanded objectivity, and that introducing a subjective prior belief into the calculation corrupted the purity of the data.</p><p>In a series of landmark papers starting in 1922, Fisher effectively dismantled the “inverse probability” monopoly. [4] He replaced it with the concept of likelihood function, which represents the joint probability density of the observed data as a function of the parameter. It is a quantity that behaves like probability but is not a probability distribution and thus requires no prior. The philosophical goal was to find the parameter value that makes the observed data “most probable.” Mathematically, this involves taking the derivative of the log-likelihood function with respect to the parameter and setting it to zero (the score function). MLE is admired for its asymptotic properties: as sample size approaches infinity, MLEs become consistent, unbiased, and theoretically achieve the lowest possible variance (reaching the Cramér-Rao lower bound).</p><p>Simultaneously, Jerzy Neyman and Karl Pearson’s son Egon Pearson constructed a rigid decision-making framework based on error rates (Type I and Type II errors) and Confidence Intervals. They redefined probability not as a “degree of belief” (the Bayesian view) but as a “long-run frequency” of repeated sampling. Neyman expanded the scope of inference in 1937 by formalizing Interval Estimation. [5] Neyman argued that because the sample is random, a single point estimate is insufficient. He proposed the Confidence Interval, a frequentist concept where the parameter is fixed but unknown, and the interval itself is the random variable. The construction relies on “pivotal quantities” , functions of the data and parameter whose distributions do not depend on the parameter. If one were to repeat the sampling process infinitely, a 95% confidence interval would contain the true parameter in 95% of those experiments. This contrasted sharply with the Bayesian Credible Interval, which offers a direct probability statement about the parameter itself based on the posterior distribution.</p><h3>The Computational Resurrection</h3><p>With the rise of computing in the mid-20th century, new terrain opened. One path led toward robustness. The availability of computing power also allowed statisticians to address the limitations of classical parametric models. In 1964, Peter Huber introduced M-Estimation to tackle the issue of outliers, a field known as Robust Statistics. [6] Classical methods like LSE are extremely sensitive to data contamination; a single extreme value can skew the squared error term significantly. Huber’s M-estimators generalize MLE by minimizing a function of the residuals that grows less rapidly than the square (such as the Huber loss function), thereby reducing the influence of outliers while maintaining efficiency for normally distributed data.</p><p>Another path returned to the Bayesian tradition. For most of the 20th century, Bayesian inference was constrained by the difficulty of computing posterior distributions. The denominator of Bayes’ theorem involved integrals often too complicated to evaluate analytically. The arrival of Markov Chain Monte Carlo (MCMC) and the Gibbs Sampler (introduced in 1984 by Geman &amp; Geman) changed everything. [7] Instead of solving integrals, one could simulate the posterior directly. Suddenly Bayesian methods became practical, flexible, and suited to hierarchical and high-dimensional models.</p><p>Econometrics added a final chapter to the story. The demands of modern econometrics led Lars Peter Hansen to develop the Generalized Method of Moments (GMM) in 1982. [8] It extends Pearson’s idea of Method of Moments into a framework that works even when no likelihood can be written down. Economists often faced models where the exact likelihood function could not be specified, but certain “moment conditions” (theoretical correlations that should be zero) were known. GMM extends Pearson’s Method of Moments to situations where there are more moment conditions than parameters to estimate (over-identification). The technique minimizes a weighted quadratic form of the moment conditions, allowing for consistent estimation without assuming a specific distributional shape for the data errors. This flexibility has made GMM a dominant tool in the analysis of time-series and panel data where strict distributional assumptions often fail. It handles over-identified systems gracefully and thrives in time-series and panel settings where strict distributional assumptions are questionable.</p><h3>References</h3><p>[1] Bayes, T. (1763). An Essay towards solving a Problem in the Doctrine of Chances. <em>Philosophical Transactions of the Royal Society of London</em>.</p><p>[2] Legendre, A. M. (1805). <em>Nouvelles méthodes pour la détermination des orbites des comètes</em>. F. Didot.</p><p>[3] Pearson, K. (1894). Contributions to the Mathematical Theory of Evolution. <em>Philosophical Transactions of the Royal Society of London. Series A</em>.</p><p>[4] Fisher, R. A. (1922). On the mathematical foundations of theoretical statistics. <em>Philosophical Transactions of the Royal Society of London. Series A</em>.</p><p>[5] Neyman, J. (1937). Outline of a Theory of Statistical Estimation Based on the Classical Theory of Probability. <em>Philosophical Transactions of the Royal Society of London. Series A</em>.</p><p>[6] Huber, P. J. (1964). Robust Estimation of a Location Parameter. <em>The Annals of Mathematical Statistics</em>.</p><p>[7] Geman, S., &amp; Geman, D. (1984). Stochastic Relaxation, Gibbs Distributions, and the Bayesian Restoration of Images. <em>IEEE Transactions on Pattern Analysis and Machine Intelligence</em>.</p><p>[8] Hansen, L. P. (1982). Large Sample Properties of Generalized Method of Moments Estimators. <em>Econometrica</em>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=313d448febd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Interpreting Binary Logistic Regression Coefficients]]></title>
            <link>https://mdahsanulhimel.medium.com/interpreting-binary-logistic-regression-coefficients-df64409d45d7?source=rss-1cd9d1add8bf------2</link>
            <guid isPermaLink="false">https://medium.com/p/df64409d45d7</guid>
            <category><![CDATA[logistic-regression]]></category>
            <category><![CDATA[biostatistics]]></category>
            <category><![CDATA[regression]]></category>
            <dc:creator><![CDATA[Md Ahsanul Islam]]></dc:creator>
            <pubDate>Fri, 03 Nov 2023 07:55:53 GMT</pubDate>
            <atom:updated>2023-11-03T07:55:53.282Z</atom:updated>
            <content:encoded><![CDATA[<p>In binary logistic regression, we often find ourselves dealing with two types of predictors (independent variables): continuous and categorical. In this blog post, I will discuss with example how the coefficients of a binary logistic regression model can be interpreted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*hOruR8WLzzJOvTo0.png" /><figcaption>Source: <a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Ftowardsdatascience.com%2Flogistic-regression-explained-7695f15d1b8b&amp;psig=AOvVaw2vRxGFgtDSJB4eK0sUfFGz&amp;ust=1699084262931000&amp;source=images&amp;cd=vfe&amp;opi=89978449&amp;ved=0CBIQjRxqFwoTCLDlk6Ksp4IDFQAAAAAdAAAAABAa">TowardsDataScience</a></figcaption></figure><p>Suppose we have a model as follows —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*qmP-5lACuLhbAbTkiBeUiQ.png" /></figure><p>Here, ‘SameAgeMarriageOpinion’ a binary outcome variable with two levels: 1 for Yes and 0 for No, ‘EduYears’ is a continuous predictor variable and ‘Gender’ is a categorical predictor variable with two levels: 0 for male and 1 for female.</p><p>After fitting this model to data, we may get the following model —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*mdxwhlKGBPj7ogWenHM_JA.png" /></figure><p>For different values of ‘EduYears’ and ‘Gender’ we obtrain log-odds of ‘SameAgeMarriageOpinion’ which is complicated to understand. For the ease of understanding, scholars often use ‘odds ratios’ rather than using the ‘logits/log odds.’</p><p>The odds ratios are calculated by taking exponents of the coefficients. Odds ratios greater than 1 correspond to ‘positive effects’ because it increases the odds. It cannot be less than 0, and any value between 0 and 1 means ‘negative effects.’</p><p>For the model fitted above, after taking exponents of the coefficients the following odds-ratios are obtained —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/527/1*4RTBL9juqzAe6MOx4RFVhg.png" /></figure><p><strong>Interpretation</strong></p><p>The odds being in support of same year marriage are observed to grow about<strong> 1.16</strong> times larger for each additional year of education. So, if two people differ by 1 year of education, the person with more education has 1.16 times higher odds of being in support of same age marriage than the person with less years of education.</p><p>If two persons differ by 5 years of education, the odds of being in support of same age marriage are 1.16⁵ = 2.1 times higher for the persons with more years of education than those with less. This interpretation is true when controlling for other predictor variable(s), i.e., gender.</p><p>The odds of being in support of same age marriage are 1.89 times higher for females compared to males when controlling for years of education.</p><p>The odds ratios can also be interpreted in terms of percentage. Females have 89% (1.89–1) higher odds of being in support of same age marriage than males, controlling for years of education (i.e., persons with same years of education, females tend to have 89% higher odds of having positive opinion on same age message than males).</p><p>These interpretations in terms of both odds ratios and percentages make the logistic regression results more understandable and relatable. They provide valuable insights into how different factors, such as education and gender, influence the odds of supporting same-year marriage while accounting for other variables.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df64409d45d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Research Paper Reading: A Three-Pass Approach]]></title>
            <link>https://mdahsanulhimel.medium.com/mastering-research-paper-reading-a-three-pass-approach-d8380dc7bb9a?source=rss-1cd9d1add8bf------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8380dc7bb9a</guid>
            <category><![CDATA[research]]></category>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[tools]]></category>
            <dc:creator><![CDATA[Md Ahsanul Islam]]></dc:creator>
            <pubDate>Wed, 06 Sep 2023 15:48:31 GMT</pubDate>
            <atom:updated>2023-09-06T15:48:31.495Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mastering Research Paper Finding and Reading: A Three-Pass Approach</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KTcfMEbG1IGVzwR2" /></figure><p>Reading research papers can be a daunting task, especially when you’re trying to keep up with the latest developments in your field. However, there’s a systematic approach that can help you efficiently find and digest the content and gain a deep understanding of the work. In this blog post, we’ll explore a three-pass approach to reading research papers I found in a paper that can help you make the most out of your academic literature search.</p><h4>FINDING THE PAPERS</h4><p>To find recent research papers on Google Scholar and CiteSeer, follow these steps:</p><ol><li>Go to Google Scholar or CiteSeer: Visit the Google Scholar website (<a href="https://scholar.google.com/">https://scholar.google.com/</a>) or CiteSeer (<a href="https://citeseerx.ist.psu.edu/">https://citeseerx.ist.psu.edu/</a>) to begin your search.</li><li>Enter Keywords: In the search bar, enter relevant keywords related to the topic you’re interested in. Be specific to narrow down your search results. You can also use advanced search options to filter by publication date.</li><li>Browse the Results: Review the search results that match your keywords. The most recent papers typically appear first in the list. You can also use filters to sort by date or relevance.</li><li>Select Papers: Choose three to five papers that seem relevant to your research or interests.</li><li>One-Pass Overview: Apply the one-pass approach to each selected paper as described earlier. This involves reading the title, abstract, introduction, section and subsection headings, conclusion, and glancing over the references. This initial pass will give you a good sense of the paper’s topic, structure, and main findings.</li></ol><p>By following these steps, you can efficiently find and get an initial understanding of recent research papers on Google Scholar and CiteSeer. This process allows you to quickly assess whether a paper is worth a more in-depth read and helps you stay updated on the latest developments in your field.</p><p>In addition, in today’s digital age, there is an abundance of resources and AI tools available to help streamline the process of discovering and understanding research papers. These tools can significantly enhance your ability to find relevant papers, extract key insights, and navigate the vast world of academic literature. Websites like Research Rabbit, Inciteful, Paper Digest, Litmaps, and Elicit offer capabilities ranging from advanced paper search and summarization to citation mapping, making it easier than ever to stay up-to-date with the latest research in your field. Leveraging these AI-powered resources can save researchers valuable time and provide a more comprehensive understanding of the research landscape, ultimately contributing to more informed and insightful academic work.</p><h3>THE THREE PASSES</h3><h4>Pass 1: The Initial Scan</h4><p>In the first pass, your goal is to get a quick overview of the paper’s main points and contributions. Here’s what you should do:</p><ol><li><strong>Title, Abstract, and Introduction:</strong> Start by reading the title, abstract, and introduction. This will give you a high-level understanding of the paper’s topic, objectives, and key findings.</li><li><strong>Section and Subsection Headings:</strong> Focus on the section and subsection headings throughout the paper. This will help you identify the paper’s structure and how the author has organized their content.</li><li><strong>Conclusion:</strong> Jump to the conclusion section. Here, you’ll find a summary of the paper’s main takeaways and findings. This can be particularly helpful in understanding the paper’s contributions.</li><li><strong>References: </strong>Glance over the references to see what sources the author has cited. This can give you an idea of the paper’s background and related works.</li></ol><h4>Pass 2: A Deeper Dive</h4><p>Now that you have a basic understanding of the paper, it’s time to dive deeper. In the second pass, pay closer attention to the paper’s visuals and shared references:</p><ol><li><strong>Figures, Diagrams, and Illustrations:</strong> Carefully examine any figures, diagrams, charts, or illustrations in the paper. Ensure that they are properly labeled and that you understand how they contribute to the paper’s narrative.</li><li><strong>References (Again):</strong> Take another look at the references, but this time, pay attention to shared references. Shared references are papers that both the current paper and the cited papers have in common. This can help you identify the paper’s place in the research landscape.</li></ol><h4>Pass 3: Virtual Recreation</h4><p>The third pass is primarily for reviewers and those who need an in-depth understanding of the paper’s methodology and results:</p><ol><li><strong>Recreate the Work Virtually:</strong> This step involves replicating the experiments or methodologies described in the paper. It’s essential for reviewers who need to assess the validity of the research. This pass can help you gain a deep understanding of the technical aspects of the paper.</li></ol><p>By following this three-pass approach, you can effectively navigate the often-complex world of research papers. Whether you’re a student, researcher, or simply an enthusiast looking to stay informed about the latest developments in your field, this method will help you get the most out of your reading experience.</p><p>Remember, reading research papers is a skill that improves with practice. The more papers you read using this approach, the better you’ll become at quickly grasping the essence of complex research and critically evaluating its contributions to the field. Happy reading!</p><p><strong>Reference<br></strong>Keshav, S. (2007). How to read a paper. <em>ACM SIGCOMM Computer Communication Review</em>, <em>37</em>(3), 83–84. <a href="http://ccr.sigcomm.org/online/files/p83-keshavA.pdf">paper.dvi (sigcomm.org)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8380dc7bb9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tidygeocoder: Making Geocoding Easier in R]]></title>
            <link>https://mdahsanulhimel.medium.com/tidygeocoder-making-geocoding-easier-in-r-b506e7c6d47?source=rss-1cd9d1add8bf------2</link>
            <guid isPermaLink="false">https://medium.com/p/b506e7c6d47</guid>
            <category><![CDATA[maps]]></category>
            <category><![CDATA[geocoding]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[tidygeocoder]]></category>
            <dc:creator><![CDATA[Md Ahsanul Islam]]></dc:creator>
            <pubDate>Sat, 29 Apr 2023 13:49:38 GMT</pubDate>
            <atom:updated>2023-04-29T13:49:38.431Z</atom:updated>
            <content:encoded><![CDATA[<p>Geocoding is the process of converting addresses into geographic coordinates (latitude and longitude) that can be used for various purposes such as mapping and spatial analysis. While there are many geocoding services available on the web, accessing and using them in R can be challenging. Tidygeocoder is an R package that provides a unified high-level interface for a selection of supported geocoding services and results are returned in tibble (dataframe) format.</p><figure><img alt="tidygeocoder logo" src="https://cdn-images-1.medium.com/max/518/1*xaWrY5c5WpLR_NyZQSYn-Q.png" /><figcaption>tidygeocoder</figcaption></figure><h4>Installation and Setup</h4><p>The tidygeocoder package can be installed from CRAN by running the following command:</p><pre>install.packages(&quot;tidygeocoder&quot;)</pre><p>Learn <a href="https://github.com/jessecambon/tidygeocoder">more</a>.</p><p>Some of the key features of this package include:</p><p><strong>Forward geocoding:</strong> This feature allows users to convert addresses to coordinates. For example, given an address “New York, USA”, the package can return the corresponding latitude and longitude. geo() and geocode()functions are used to perform forward geocoding.</p><p>The difference between geo() and geocode() is that geo() takes a vector of addresses as input and geocode() takes a dataframe/tibble as input.</p><p>Here is an example of how to geocode an address using the ArcGIS geocoding service:</p><pre>result &lt;- tidygeocoder::geo(address = &quot;New York, USA&quot;, method = &quot;arcgis&quot;,<br>  custom_query = list(token = &quot;&lt;API_KEY&gt;&quot;))</pre><p>The address parameter is the address you want to geocode. The method parameter specifies which geocoding service you want to use (default is ‘osm’ which is free and does not require any api), and custom_query is a list of parameters specific to the selected geocoding service. In this case, the token parameter is used to specify the ArcGIS API key.</p><p><strong>Reverse geocoding: </strong>This feature allows users to convert coordinates to addresses. For example, given a latitude and longitude, the package can return the corresponding address. reverse_geo() and reverse_geocode()functions are used to perform this.</p><p><strong>Batch geocoding:</strong> This feature allows users to geocode multiple addresses or coordinates in a single query, which can save time and resources. The package automatically uses batch geocoding if it is applicable.</p><pre>library(tidygeocoder)<br>library(dplyr)<br>library(leaflet)<br>addresses &lt;- data.frame(capitals = c(&quot;Dhaka, Bangladesh&quot;,<br>                                     &quot;Kabul, Afganistan&quot;,<br>                                     &quot;Abu Dhabi, UAE&quot;,<br>                                     &quot;London, UK&quot;, <br>                                     &quot;Brasília, Brazil&quot;,<br>                                     &quot;Washington, D.C., USA&quot;))<br># getting addresses<br>lat_longs &lt;- addresses %&gt;% geocode(capitals, method = &#39;osm&#39;)<br><br># visualizing using leaflet<br>leaflet()  %&gt;% <br>  addTiles(group = &quot;OSM&quot;) %&gt;%<br>  addMarkers(<br>    data = lat_longs,<br>    lat =  ~ lat,    <br>    lng =  ~ long,<br>    label = ~ capitals,<br>    labelOptions = labelOptions(noHide = TRUE, direction = &#39;auto&#39;)<br>  )</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*NGp-tLFMpZl8NKMIZjPzvQ.png" /><figcaption>Leaflet Map Output</figcaption></figure><p><strong>Elegant handling of duplicate, NA, and blank input data:</strong> The package handles duplicate, NA, and blank input data elegantly by submitting only unique inputs in queries, while preserving the rows in the original data by default.</p><p><strong>Automatic rate limiting:</strong> The package automatically sets the maximum rate of querying according to the usage policies of the selected geocoding service. This helps to avoid exceeding usage limits and incurring fees.</p><p>You can learn more from this <a href="https://jessecambon.github.io/tidygeocoder/articles/tidygeocoder.html">getting started vignette</a> or <a href="https://jessecambon.github.io/tidygeocoder/index.html">here</a>.</p><p><a href="https://medium.com/@mdahsanulhimel">Follow me</a> for getting useful tips on R.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b506e7c6d47" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tips in R That You Don’t Want to Miss]]></title>
            <link>https://mdahsanulhimel.medium.com/top-3-tips-tricks-in-r-programming-f838b73deec4?source=rss-1cd9d1add8bf------2</link>
            <guid isPermaLink="false">https://medium.com/p/f838b73deec4</guid>
            <category><![CDATA[r-programming]]></category>
            <dc:creator><![CDATA[Md Ahsanul Islam]]></dc:creator>
            <pubDate>Thu, 09 Mar 2023 14:05:48 GMT</pubDate>
            <atom:updated>2023-03-28T10:56:47.745Z</atom:updated>
            <content:encoded><![CDATA[<h4>Increase your productivity by 10 times!</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gvHpSA0RPh9fDMgu" /><figcaption>Photo by <a href="https://unsplash.com/pt-br/@carlheyerdahl?utm_source=medium&amp;utm_medium=referral">Carl Heyerdahl</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Fastest Way to Read &amp; Write Data</h4><p>Use the fread() and fwrite() functions from the data.table package. By running a benchmark test it can be easily seen which one is the fastest:</p><pre>library(microbenchmark)<br>microbenchmark(<br>  &quot;read.csv&quot; = df_base &lt;- read.csv(&quot;train.csv&quot;),<br>  &quot;read_csv&quot; = df_readr &lt;- readr::read_csv(&quot;train.csv&quot;, show_col_types = FALSE),<br>  &quot;fread&quot; = df_dt &lt;- data.table::fread(&quot;train.csv&quot;), <br>  times = 30  # Number of times to evaluate each expression<br>)<br># Unit: milliseconds<br>#      expr     min      lq     mean   median      uq     max neval cld<br>#  read.csv  7.1837 10.2650 11.39292 11.36280 12.6747 16.1982    30  b <br>#  read_csv 40.6657 44.1079 48.41300 47.69160 52.2585 59.7986    30   c<br>#     fread  2.1841  2.6073  3.29697  3.16595  3.8830  5.3864    30 a</pre><p>Looks like the fread() function is almost 3 times faster than the base R’s function and nearly 20X faster than the readr’s function.</p><h4>Disable Scientific Notation</h4><p>Use options to set the value of scipen argument to 999 (default is 0):</p><pre>x &lt;- c(12e12, 8892e3)<br>print(x)<br># 1.200e+13 8.892e+06<br>options(scipen = 999)<br>print(x)<br># 12000000000000        889200</pre><p>Alternatively, you can use format() to disable scientific notation for specific outputs:</p><pre>format(x, scientific = F)<br># &quot;12000000000000&quot; &quot;       8892000&quot;</pre><h4>Converting Data Types of Multiple Columns</h4><p>The easiest way is using the mutate_at() function from dplyr package:</p><pre>library(dplyr)<br>data &lt;- data %&gt;% <br>  mutate_at(vars(Var1, Var2, var3), as.factor)</pre><p>Note that the mutate_at() function is superseded meaning it has a better alternative, but the function is not going away so we can use it anyway.</p><p>The better alternative (is recommended) to do this is using across() combining with mutate(). Example:</p><pre>data &lt;- data %&gt;% <br>  mutate(across(.cols = c(Var1, Var2, Var3), .fns = as.factor))</pre><h4>Converting All Character Columns into Factor Columns</h4><ol><li>Using mutate_if() from dplyr (superseded)</li></ol><p>2. Using across() and where()</p><p>3. Using sapply() and lapply() from base R</p><p>Benchmark score has shown that the base R’s method is the fastest, i.e., using sapply() and lapply() does the job fastest:</p><pre>library(microbenchmark)<br>microbenchmark(<br>  &#39;across&#39; = {<br>    data &lt;- data %&gt;% mutate(across(.cols = where(is.character), .fns = as.factor))<br>  }, <br>  &#39;mutate_if&#39; = {<br>    data &lt;- data %&gt;% mutate_if(is.character, as.factor)<br>  }, <br>  &#39;base R&#39; = {<br>    data[sapply(data, is.character)] &lt;-<br>      lapply(data[sapply(data, is.character)], as.factor)<br>  })<br># Unit: microseconds<br># expr      min       lq      mean  median       uq      max neval cld<br># across    5719.7  5994.30  7051.707  6266.9  7306.05  15862.8   100  b <br># mutate_if 53044.7 55002.05 64289.472 57024.7 68425.85 153458.9   100   c<br># base R    233.4   276.10   343.412   297.6   320.50   1428.6   100 a  </pre><p>Here, sapply(data, is.character) returns TRUE or FALSE when the column is character or not respectively. Then lapply() converts the selected character columns to factor columns.</p><p>But note that if you have read the dataset using fread() then while factorizing using it, you might face an error message like the following:</p><pre>Error in `[.data.table`(data, sapply(data, is.character)) : <br>  i evaluates to a logical vector length 12 but there are 891 rows. <br>Recycling of logical i is no longer allowed as it hides more bugs than is <br>worth the rare convenience. Explicitly use rep(...,length=.N) if you really <br>need to recycle.</pre><p>To overcome this issue, you need to change the class of data to onlydata.frame instead of data.table and data.frame using -</p><pre>attr(data, &quot;class&quot;) &lt;- &quot;data.frame&quot;</pre><p>Now you will be able to convert the character columns to factor without any errors.</p><h4>Splitting into Training &amp; Testing Sets</h4><p>Many of you might have used the sample.split() function from caTools package for splitting datasets into training and test datasets. But did you know that you could easily use the sample() function to split into training and test sets even faster? Can’t believe? Here is the benchmark test:</p><pre>require(microbenchmark)<br>microbenchmark(<br>  caTools = {<br>    set.seed(0)<br>    sample = caTools::sample.split(data$Survived, SplitRatio = .80)<br>    train = subset(data, sample == TRUE)<br>    test  = subset(data, sample == FALSE)<br>  }, <br>  base = {<br>    set.seed(0)<br>    train_ids &lt;- sample(seq_len(nrow(data)),<br>                        +size = floor(.80 * nrow(data)))<br>    train &lt;- data[train_ids,]<br>    test &lt;- data[-train_ids,]<br>  }, <br>  times = 20)<br># Unit:microseconds<br># expr      min       lq     mean   median       uq      max neval cld<br># caTools 1570.000 1865.202 2480.536 2597.502 3038.451 3631.902    20   b<br># base R  714.001  874.251 1266.301 1165.200 1477.551 2706.501    20  a</pre><p>Looks like sample() is nearly two times faster than sample.split() from caTools!</p><h4>The Python Alternative to f-string</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f838b73deec4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Packages in R]]></title>
            <link>https://mdahsanulhimel.medium.com/using-packages-in-r-624b7e542ceb?source=rss-1cd9d1add8bf------2</link>
            <guid isPermaLink="false">https://medium.com/p/624b7e542ceb</guid>
            <category><![CDATA[r-programming]]></category>
            <dc:creator><![CDATA[Md Ahsanul Islam]]></dc:creator>
            <pubDate>Tue, 21 Feb 2023 10:42:48 GMT</pubDate>
            <atom:updated>2023-03-12T14:31:35.317Z</atom:updated>
            <content:encoded><![CDATA[<h4>Things You Need to Know</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*GWvvS9v_njxi2FQyOSNcAw.png" /></figure><p>In R, packages are collection of <em>functions</em>, <em>datasets </em>and <em>documentations</em>. These are typically created and maintained by third-party developers, and they can be downloaded and installed from various sources such as the Comprehensive R Archive Network (CRAN), GitHub, etc.</p><h4>Installing Packages</h4><p>Run the following code -</p><pre>install.packages(&quot;packages_name&quot;)</pre><p>You can pass the names of multiple packages to this function. You can specify the name of the repository using the argument repos . For example:</p><pre>install.packages(&#39;packages&#39;, repos=&#39;http://cran.us.r-project.org&#39;)</pre><p>You can install a package manually for a compressed file:</p><pre>install.packages(&#39;C:/Users/User/Downloads/package_2.1.zip&#39;, <br>                  repos=NULL, type=&#39;source&#39;)</pre><h4>Loading packages</h4><p>Using the function library() :</p><pre>library(&quot;package_name&quot;)</pre><p>Another function to load package is require() :</p><pre>require(&quot;package_name&quot;)</pre><p>You can pass the name of only one package to these functions.</p><p>These two differ from one another in terms of output. If the desired package is not installed, library() throws an error and stops, whereas require() a warning and returns FALSE.</p><h4>Reproducibility</h4><p>If you send your R code to someone, there is a high chance that the user does not have all the packages installed. After running the code, he may need to manually check the error messages and install the packages.</p><p>To overcome this issue, I came up with this solution that will directly load the packages if they are installed, otherwise it will install those and then load into the environment:</p><pre>packages &lt;- c(&quot;tidyverse&quot;,&quot;readxl&quot;)<br><br># checks which are not installed<br>not_installed &lt;- packages[!packages %in% rownames(installed.packages())]<br><br># installs the packages that are not installed<br>install.packages(not_installed) |&gt; suppressMessages()<br><br># load all packages that are in the variable&#39;packages&#39;<br>lapply(X = packages, FUN = library, character.only = TRUE) |&gt; invisible()</pre><p>I have written a function load_packages() that does the task easily. You can use the function by sourcing it into your computer using —</p><pre>source(&quot;https://raw.githubusercontent.com/MdAhsanulHimel/load_packages_R/master/script.R&quot;)<br><br># using the function<br>pkges &lt;- c(&quot;apaTables&quot;, &quot;anytime&quot;, &quot;AER&quot;)<br>load_packages(packages = pkges)</pre><p>Hope it helps. You can find the function in my GitHub repo. Feel free to give feedback.</p><h4>Using install_load()</h4><p>There is a package called install.load in R. This package provides a convenient way to install and load multiple packages in a single command.</p><p>To use the install.load package, you first need to install it by running install.packages(&#39;install.load&#39;) .</p><p>Once the package is installed, you can use the install_load() function to install and load multiple packages in a single command. For example, to install and load the &quot;dplyr&quot; and &quot;ggplot2&quot; packages, you can use the following code:</p><pre># Install and load the dplyr and ggplot2 packages<br>install.load::install_load(c(&quot;dplyr&quot;, &quot;ggplot2&quot;))</pre><p>This will firstly check whether the packages are already installed or not, and if not then install and load the “dplyr” and “ggplot2” packages into your R session.</p><h4>Using p_load()</h4><p>The “pacman” package provides a convenient way to install and load multiple packages in a single command, similar to the install.load package.</p><p>To use the “pacman” package, you first need to install it by running install.packages(&#39;pacman&#39;).</p><p>Once the package is installed, you can use the p_load() function to install and load multiple packages in a single command. For example, to install and load the &quot;dplyr&quot; and &quot;ggplot2&quot; packages, you can use the following code:</p><pre># Install and load the dplyr and ggplot2 packages<br>pacman::p_load(dplyr, ggplot2)</pre><p>The main difference between install_load() and p_load() is that the &quot;pacman&quot; package has additional features such as checking for package updates, searching for packages on multiple CRAN mirrors, managing multiple library locations, etc.</p><p>Follow me for more posts on R Programming and Statistics. Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=624b7e542ceb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The art of combining models: Understanding ensemble learning in depth]]></title>
            <link>https://mdahsanulhimel.medium.com/the-art-of-combining-models-understanding-ensemble-learning-in-depth-7493f8530c3e?source=rss-1cd9d1add8bf------2</link>
            <guid isPermaLink="false">https://medium.com/p/7493f8530c3e</guid>
            <category><![CDATA[bagging]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[ensemble-learning]]></category>
            <category><![CDATA[boosting]]></category>
            <category><![CDATA[stacking]]></category>
            <dc:creator><![CDATA[Md Ahsanul Islam]]></dc:creator>
            <pubDate>Wed, 15 Feb 2023 09:44:43 GMT</pubDate>
            <atom:updated>2023-02-15T09:44:43.737Z</atom:updated>
            <content:encoded><![CDATA[<h4>The ultimate weapon for solving complex problems in machine learning.</h4><p>Ensemble learning is a machine learning technique that combines multiple models (also known as base models or weak learners) to improve the overall performance and predictive accuracy of the system. There are different types of ensemble methods, such as bagging, boosting, and stacking.</p><h4>Bagging</h4><figure><img alt="Bagging, short for bootstrap aggregation, is an ensemble method in machine learning that combines multiple models to improve performance and reduce overfitting. It works by creating multiple bootstrap samples (i.e., random samples with replacement) from the original dataset and training a separate model on each sample. The final prediction is then made by aggregating the predictions of all the models." src="https://cdn-images-1.medium.com/max/1024/1*sGzV00Pb_B7fKxI-1_DNmA.png" /><figcaption>Ensemble learning: Bagging</figcaption></figure><p>Bagging, short for <em>bootstrap aggregation</em>, is an ensemble method in machine learning that combines multiple models to improve performance and reduce overfitting. It works by creating multiple bootstrap samples (i.e., random samples with replacement) from the original dataset and training a separate model on each sample. The final prediction is then made by aggregating the predictions of all the models.</p><p>The most <strong>common method of aggregation</strong> is to take the average (for regression problems) or the majority vote (for classification problems) of the individual model predictions. This approach is known as <strong>“simple averaging”</strong> or <strong>“voting,”</strong> respectively.</p><p>However, other methods of aggregation can also be used, such as weighted averaging or stacking, where a meta-model is trained to combine the outputs of the base models. The choice of aggregation method will depend on the problem at hand and the characteristics of the base models. <br>Bagging can be used with any type of model and is particularly useful for unstable models with high variance.</p><p><strong>OOB instances:</strong> In bagging, each model in the ensemble is trained on a random subset of the training data. Therefore, it’s possible that some data points are not included in any of the subsets used for training. These data points are referred to as out-of-bag (OOB).</p><p>OOB instances can be used to evaluate the performance of the bagged model. Because the model has not seen these instances during training, they can be used as a validation set to estimate the generalization error of the model. This is known as the OOB estimate of error. <br>The OOB estimate can be a useful alternative to cross-validation, as it can save computation time and can be less sensitive to the specific sampling of the data.</p><p><strong>Limitations: </strong>While bagging can improve the overall performance of a model, it can also make it more difficult to interpret and explain, which can be a concern in certain applications, such as those that require transparency or accountability in decision making. One potential disadvantage of bagging is that it may increase computational and storage requirements, as multiple models need to be trained and stored.</p><p>Additionally, if the training set is small, bagging may not be effective, as there may not be enough variance in the data to generate diverse models.</p><p>The random forest can be considered a bagging technique as it combines multiple decision trees by generating a set of bootstrap samples and training a decision tree on each sample. The main difference between random forest and traditional bagging is that random forest adds an additional layer of randomization by selecting a random subset of features for each tree, which helps to reduce correlation between trees and further improve the generalization performance of the model.</p><h4>Boosting (Sequential Ensemble Learning)</h4><figure><img alt="The basic idea behind boosting is to train a sequence of weak learners (In the context of machine learning, learners refer to models or algorithms that are used to predict the output variable based on input data), each focusing on the data points that were misclassified by the previous learners. In other words, the learners are trained sequentially, and each learner is trained to correct the mistakes of its predecessors." src="https://cdn-images-1.medium.com/max/1024/1*-4wJOkhCB7f00ctbT6wJLA.png" /><figcaption>Ensemble learning: Boosting</figcaption></figure><p>The basic idea behind boosting is to train a sequence of weak learners (In the context of machine learning, learners refer to models or algorithms that are used to predict the output variable based on input data), each focusing on the data points that were misclassified by the previous learners. In other words, the learners are trained sequentially, and each learner is trained to correct the mistakes of its predecessors.</p><blockquote>All the samples are used in the first iteration, and then the subsequent iterations focus on the samples that were misclassified by the previous learners.</blockquote><p>At each stage of the boosting process, the misclassified data points are given greater weight, so that subsequent learners focus on the examples that were difficult to classify by the previous learners. The final prediction is obtained by taking a weighted combination of the predictions of all the learners, with the weights depending on the accuracy of each learner.</p><p>The focus of boosting is to reduce both bias and variance in the final model, leading to improved accuracy and generalization performance.</p><p>It can be used for both regression and classification problems. In the case of classification, the weak learners are typically decision trees, while in the case of regression, the weak learners can be decision trees, linear regression models, or other models.</p><p>However, it is important to note that boosting can be prone to overfitting, and it can be computationally expensive and time-consuming. Additionally, the resulting models can be less interpretable than other models, which may be a drawback in certain applications. Therefore, it is essential to consider the specific requirements of the problem at hand when deciding whether to use boosting or other machine learning algorithms.</p><p>One of the most popular boosting algorithms is <strong>AdaBoost</strong>, which is a specific type of boosting that uses decision trees as the base model. Another popular boosting algorithm is <strong>Gradient Boosting</strong>, which is a generalization of AdaBoost that can be used with a wide range of base models.</p><p>There are some reasons why we see decision trees to be used for boosting in most cases —</p><ol><li>Decision trees can handle missing values without the need for imputation or preprocessing.</li><li>They can handle both numerical and categorical features, making them versatile for different types of datasets.</li><li>They can model non-linear relationships between features and the target variable, which is important when the data has complex interactions.</li><li>Decision trees can be trained quickly and are computationally efficient, which is important when training many models in the boosting process.</li><li>Trees can capture feature interactions, which is important when dealing with high-dimensional data.</li></ol><h4>Stacking (Stacked Generalization)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/0*KiUz6VwA-mEEhCkI.png" /><figcaption><a href="https://medium.com/ml-research-lab/stacking-ensemble-meta-algorithms-for-improve-predictions-f4b4cf3b9237">Stacking -Ensemble meta Algorithms for improve predictions | by Ashish Patel | ML Research Lab | Medium</a></figcaption></figure><p>The idea is to train several base models on the original dataset and then use their predictions as inputs to a higher-level model, called a meta-model or blender, which makes the final prediction.</p><p>Unlike bagging and boosting, stacking does not use simple average or majority voting to combine the predictions of the base models, but instead uses a more complex model to learn how to best weight the predictions of each base model. It is a more flexible approach that allows for the use of heterogeneous base models and meta-models.</p><p>Stacking can often achieve better prediction accuracy than using a single model or any of the individual base models alone.</p><p>These ensemble methods are often used in complex problems where a single model may not be sufficient to capture all the variations in the data and can be applied to both classification and regression problems. By combining multiple weaker models, an ensemble model can often achieve better performance and be more robust to overfitting or underfitting compared to any of the individual models on their own. The goal is to leverage the strengths of each individual model while mitigating their weaknesses, resulting in a more accurate and reliable model.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7493f8530c3e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[P-value: Mystery Solved!]]></title>
            <link>https://mdahsanulhimel.medium.com/p-value-mystery-solved-5ad8b590395d?source=rss-1cd9d1add8bf------2</link>
            <guid isPermaLink="false">https://medium.com/p/5ad8b590395d</guid>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[p-value]]></category>
            <category><![CDATA[significance-level]]></category>
            <category><![CDATA[hypothesis-testing]]></category>
            <dc:creator><![CDATA[Md Ahsanul Islam]]></dc:creator>
            <pubDate>Thu, 19 Jan 2023 20:44:49 GMT</pubDate>
            <atom:updated>2023-01-19T20:44:49.606Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*3TmN6dj2luDwu5MEAllbtw.jpeg" /></figure><p>The concept of p-value may be familiar to you if you’ve taken a statistics class or read any research papers. However, many peoples have limited understanding of its origins and relationship to hypothesis testing. Today, we will shed light on this mystery.</p><p>Firstly, let’s know about hypothesis testing. In hypothesis testing, there are two main hypotheses being considered: the null hypothesis (H0) and the alternative hypothesis (H1 or Ha).</p><p>The null hypothesis (H0) represents the default assumption that there is no statistical significance or relationship between the two variables being studied. It is often a statement of &quot;no effect&quot; or &quot;no difference.&quot; It is represented by the symbol H0 and serves as a starting point for an experiment to see if there’s enough evidence to prove that assumption wrong.</p><p>The alternative hypothesis (H1 or Ha) is the opposite of the null hypothesis and represents the idea that there is a statistical significance or relationship between the variables being studied. It is often a statement of &quot;an effect&quot; or &quot;a difference.&quot;</p><blockquote>It’s important to note that in a hypothesis test, we can never prove that the null hypothesis is true. We can only fail to reject it or reject it based on the evidence we have.</blockquote><p>We cannot prove that the null hypothesis is true because there is always a possibility that the results of an experiment or study are due to chance, even if the null hypothesis is true since we always work on samples and not on the whole population.</p><p>Now, we need know about significance level. Significance level is also known as the alpha level. It is the probability of making a type I error, i.e., the probability of rejecting a null hypothesis when it is actually true. The most common significance level used in hypothesis testing is 0.05, which means that there is a 5% chance of rejecting the null hypothesis when it is actually true. Again, all of these are happening because we usually do not have access to the entire population, and so we work on samples.</p><p>Not to mention, English statistician Ronald A. Fisher developed the idea of using the p-value as a measure of the evidence against a null hypothesis in his work on statistical hypothesis testing. His idea was, if the p-value is less than the significance level then reject the null hypothesis. Fisher’s first application of p-value was in the field of genetics and it was used to test Mendelian inheritance of certain characteristics (Fisher, R.A., 1919). After that, p-value started to gain popularity.</p><h4>But what is p-value?</h4><p>In simple words, it represents the probability of obtaining a test statistic as extreme or more extreme than the one observed, assuming the null hypothesis is true. A small p-value (typically less than 0.05) indicates that the observed data is unlikely to have occurred by chance, and therefore provides evidence against the null hypothesis.</p><blockquote>A small p-value (typically less than 0.05) indicates that the observed data is unlikely to have occurred by chance, and therefore provides evidence against the null hypothesis.</blockquote><p>Please note that a small p-value is not definitive proof that the null hypothesis is false, but it does provide evidence against it. The p-value is a measure of the strength of the evidence against the null hypothesis, and the smaller the p-value, the stronger the evidence.</p><p>Here is a simple example to illustrate the concept of a p-value:</p><p>Suppose we are conducting a study to determine whether a new drug is effective in treating a certain medical condition. We randomly assign patients to either the treatment group, which receives the new drug, or the control group, which receives a placebo. After the treatment, we measure the improvement in the condition of each patient.</p><p>We set our null hypothesis to be that there is no difference in the improvement of the condition between the treatment group and the control group. Our alternative hypothesis is that the treatment group will show greater improvement than the control group.</p><p>We use a t-test to compare the mean improvement in the condition between the two groups, and we calculate a p-value of 0.025. This means that there is a 2.5% chance of observing a difference in means as large or larger than the one observed, assuming the null hypothesis is true.</p><p>Since our p-value (0.025) is less than the significance level (0.05), we reject the null hypothesis and conclude that there is evidence that the new drug is effective in treating the condition.</p><p>Keep in mind that this is a simple example, and in real world the process and calculations could be more complex.</p><p>Follow me for posts on statistics, data analytics and R programming. Thank you!</p><p><strong>References</strong></p><ul><li>Fisher, R. A. (1919). XV.—The correlation between relatives on the supposition of Mendelian inheritance. Earth and Environmental Science Transactions of the Royal Society of Edinburgh, 52(2), 399-433.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5ad8b590395d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A PowerPoint Feature I Wish I knew Earlier]]></title>
            <link>https://mdahsanulhimel.medium.com/a-powerpoint-feature-i-wish-i-knew-earlier-5a8c600c569?source=rss-1cd9d1add8bf------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a8c600c569</guid>
            <category><![CDATA[features]]></category>
            <category><![CDATA[printing]]></category>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[powerpoint]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Md Ahsanul Islam]]></dc:creator>
            <pubDate>Sun, 25 Sep 2022 20:21:35 GMT</pubDate>
            <atom:updated>2022-09-25T20:21:35.408Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HxeJ0vTqwfX3RzHW.jpg" /></figure><p>Last week, I had to travel about 20 kilometers from my house to a shop to finish a printing job. I had a PowerPoint design created and saved as a PDF file.</p><p>Before heading to the shop, I uploaded the PDF and pptx files to Google Drive. I uploaded the pptx files because I thought it would be very useful if it needed any editing (and yes, I really needed to edit something). I didn’t bring my laptop because it was too heavy.</p><p>I received a call from my client about a correction just as I was about to begin printing. So, I opened the PowerPoint file to make changes. And tada! Some fonts were not appearing as they should have. I certainly remember using a fancy font, but I couldn’t remember the font’s name. As a result, I had to return home and edit the file on the laptop where it was created.</p><p>This happens when the host computer does not have the font used in the PowerPoint file. It replaces the missing font with the default, which is, as I know, Calibri.</p><p>A solution in the above case was — <br>1. Install the fonts in the host computer<br>2. Go get the computer where you created it and start working on it.</p><p>This hassle could have been avoided if I knew ONE THING which is — <br>“Embed fonts in the file”</p><p>Do the following steps every time you start working on a PowerPoint file with some uncommon or special fonts that you think might not be available to other computer —</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/160/1*SfaWwxHKtXIWFUcbogmdQg.png" /><figcaption>Step 1: Go to PowerPoint’s “Options”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/162/1*UYLCw7ddwDJnvPTS7El1Dw.png" /><figcaption>Step 2: Go to “Save”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*m1u02nGNKYTwD-CZek44yg.png" /><figcaption>Step 3: Enable “<em>Embed fonts in the file”</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/515/1*hS0oWTRWVYakFEvfsD22YQ.png" /><figcaption>Step 4: It is a good idea to select “Embed all characters” which is useful for further editing.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*u7mtqgOnr5mazojGqCVhiA.png" /><figcaption>Step 5: So, select “Embed all characters” and then click on “OK” to confirm the changes.</figcaption></figure><p>Done! I would not have had to travel an additional 20 kilometers up and 20 kilometers down if I had known about it earlier. I hope this helps you all. Thanks!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a8c600c569" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Import Data From Google Sheets To Pandas Dataframe — The Easiest Way]]></title>
            <link>https://mdahsanulhimel.medium.com/import-data-from-google-sheets-to-pandas-dataframe-the-easiest-way-b0a5378525b1?source=rss-1cd9d1add8bf------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0a5378525b1</guid>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[google-sheets]]></category>
            <category><![CDATA[import]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Md Ahsanul Islam]]></dc:creator>
            <pubDate>Fri, 27 May 2022 14:00:32 GMT</pubDate>
            <atom:updated>2022-05-27T14:00:32.038Z</atom:updated>
            <content:encoded><![CDATA[<h3>Import Data From Google Sheets To Pandas Dataframe — The Easiest Way</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lQX7gZatds1ZSz9-" /><figcaption>Photo by <a href="https://unsplash.com/@jcotten?utm_source=medium&amp;utm_medium=referral">Joshua J. Cotten</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Steps:</strong></p><ol><li>Open the google sheets file.</li><li>Click on the ‘Share’ option and change the privacy to “Anyone with the link” so that anyone on the internet with this link can view the file.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*pG08mFbaAcCTbWnSDtQpKA.png" /></figure><p>3. Open your Python IDE. I am using the Google Colab.</p><p>4. Now import the required python library. You’ll only need pandas.</p><p>import pandas as pd</p><p>5. Go to your google sheets tab and copy the google sheet id.</p><p><strong>How to find the google sheet id?</strong></p><p>Let’s say the link to your file is the following:</p><p><a href="https://docs.google.com/spreadsheets/d/1qa6yJkWMJRFG1T56_ZYGi5nm4VVofZNNHxQbveC0PIA/edit#gid=1640708940">https://docs.google.com/spreadsheets/d/1qa6yJkWMJRFG1T56_ZYGi5nm4VVofZNNHxQbveC0PIA/edit#gid=1640708940</a></p><p>The long string between “…/spreadsheets/d/” and “/edit#gid…” is the required google sheet id. In my case it is:</p><p>1qa6yJkWMJRFG1T56_ZYGi5nm4VVofZNNHxQbveC0PIA</p><p>6. Use the following code. Paste your google sheet id as a string in gsheetid and your sheet’s name in sheet_name. In my case, the data is in Sheet1.</p><pre>gsheetid = “1qa6yJkWMJRFG1T56_ZYGi5nm4VVofZNNHxQbveC0PIA”<br>sheet_name = “Sheet1”<br>gsheet_url = f”https://docs.google.com/spreadsheets/d/{gsheetid}/gviz/tq?tqx=out:csv&amp;sheet={sheet_name}&quot;<br>df = pd.read_csv(gsheet_url)<br>df.head()</pre><p>This code gives me the following output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*LyEAE-PWjDwrkCRE8-O-Jg.png" /></figure><p>Done!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0a5378525b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>