<?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 Shiva Ram on Medium]]></title>
        <description><![CDATA[Stories by Shiva Ram on Medium]]></description>
        <link>https://medium.com/@Analyst_Shiva?source=rss-a6f246f5c2a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*u50pR3dgqS620yTLuyXnag.jpeg</url>
            <title>Stories by Shiva Ram on Medium</title>
            <link>https://medium.com/@Analyst_Shiva?source=rss-a6f246f5c2a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 16:08:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Analyst_Shiva/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[Understanding Scaling and Transformation Techniques in Data Analysis]]></title>
            <link>https://medium.com/@Analyst_Shiva/understanding-scaling-and-transformation-techniques-in-data-analysis-847f7d9b04fc?source=rss-a6f246f5c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/847f7d9b04fc</guid>
            <dc:creator><![CDATA[Shiva Ram]]></dc:creator>
            <pubDate>Mon, 25 Mar 2024 15:17:42 GMT</pubDate>
            <atom:updated>2024-03-26T05:07:26.416Z</atom:updated>
            <content:encoded><![CDATA[<p>In the realm of data analysis and machine learning, preprocessing steps like scaling and transformation are crucial for ensuring the optimal performance of models. These techniques help in making features more interpretable, reducing the influence of outliers, and enhancing the convergence of optimization algorithms. In this blog, we’ll delve into various scaling and transformation techniques, discussing their formulas, examples, optimal use cases, and implementing them from scratch using Python’s Pandas library.</p><h3>Methods of Data Normalization</h3><ol><li>Normalization</li><li>Mean Normalization</li><li>Robust Scalar</li><li>Min-Max Normalization</li><li>Z-score Normalization(Standardization)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aGyCHRnjIOpMyUVYrAIbvw.png" /></figure><ol><li>Normalization</li></ol><p>Normalization rescales the values of numerical features to a range between 0 and 1. It’s particularly useful when the features have varying scales.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VnxiFAmexbMHOXf8f06KAQ.jpeg" /></figure><p>Optimal Use Case:<br>Normalization is suitable when features have different scales and we want to bring them to a uniform scale.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*I5uMhDlV2D1WCfUyXlpnEw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*UHIi4NzpSevI9h_XW5PmJg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jBV3jolMetNErtDbEnng0A.png" /></figure><p>2. Mean Normalization</p><p>The concept of Mean Normalization and Feature Scaling is least addressed, to say the least. So, by the end of this article, you will be clear with these two concepts.</p><p>To understand these two concepts we must first answer few questions.</p><ol><li>What is Feature Scaling?</li><li>What is Mean Normalization?</li><li>When do we use these concepts?</li><li>Why do we need these techniques?</li></ol><p>Let’s go over each of these questions one by one.</p><h3>1. What is Feature Scaling?</h3><p>Feature Scaling is the process of bringing all of the features of a Machine Learning problem to a similar scale or range. The definition is as follows</p><blockquote><strong><em>Feature scaling</em></strong><em> is a method used to normalize the range of independent variables or features of data.</em></blockquote><p><a href="https://www.analyticsvidhya.com/blog/2020/04/feature-scaling-machine-learning-normalization-standardization/">Feature scaling</a> can have a significant effect on a Machine Learning model’s training efficiency and can improve the time taken to train a model. The specifics will be discussed below.</p><h3>2. What is Mean Normalization?</h3><p>Mean Normalization is a way to implement Feature Scaling. What Mean <a href="https://www.analyticsvidhya.com/blog/2022/07/different-types-of-normalization-techniques/">normalization</a> does is that it calculates and subtracts the mean for every feature. A common practice is also to divide this value by the range or the standard deviation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/0*Qpj5Gr2rFhbW3uBH.png" /></figure><p>When the same process is done and the standard deviation is used as the denominator then this process is called <strong>Standardization</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/0*ykse8VPSVmOqqt9G.png" /></figure><h3>3. When do we use these concepts?</h3><p>Generally, Feature Scaling is used when the features do not have the same range of values. To explain this let us take an example of housing prices. In this problem, there might be many features to consider, but let us take two of them for simplicity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/0*lBwFWh4j4VEQMbzc.png" /></figure><p>Now, the range of x1 can be from 2 to 5 and the range of x2 can be from 2500–5000. Now when we look at the ranges, we can see that there is a huge difference. This difference can slow down the learning of a model.</p><h3>4. Why do we need these techniques?</h3><p>Now to the most important question, Why do we need these concepts and techniques? It has been partially answered in the previous section. To discuss in detail we need to understand a data visualization graph called <strong>Contours</strong>.</p><blockquote><strong><em>Contour</em></strong><em> plots are a way to show a three-dimensional surface on a two-dimensional plane.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*-M9g1ZoVf22sUg0P.png" /></figure><p>source: deeplearning.ai | Andrew Ng</p><p>When we take a look at the above images we can see that the unnormalized contour is skewed and takes up an oval shape. The image next to it shows a normalized contour which takes up the shape of a circle and is evenly spaced.</p><p>When we apply Gradient Descent in both situations, it is seen that Gradient Descent converges to the minimum faster if the input is normalized. Whereas, if the input is not normalized, Gradient Descent takes up a lot of steps before it converges to a minimum, which can slow down the learning process of the model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/761/1*frumFivVAYrCMRPjDjF66w.png" /></figure><p>Before Scaling:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*__41dpYuddcwMY1JRskf3g.png" /></figure><p>After Scaling:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*QfAsWjrDZLKaNqviJUhE5w.png" /></figure><p>3. Robust Scaling</p><p>Robust scaling scales features based on percentiles, making it robust to outliers.</p><p>Robust Scalar transforms x to x’ by subtracting each value of features by the <strong>median</strong> and dividing it by the <strong>interquartile range</strong> between the 1st quartile (25th quantile) and the 3rd quartile (75th quantile).</p><p>The formula for Robust Scalar is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/0*jBRyylltRwNyI6Cc.png" /></figure><p>Optimal Use Case:<br>Robust scaling is suitable when the dataset contains outliers.</p><h3>Dataset before Robust Scaling:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/198/0*THDiwKOnJ7YhKhqB.png" /></figure><h3>Dataset after Robust Scaling:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/203/0*tGX7uj8ToUPqiM5e.png" /></figure><p>In this example, robust scaling rescales the values of each feature by removing the median and dividing by the interquartile range (IQR). Robust scaling is less sensitive to outliers compared to other scaling techniques.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*Zw5KdLx67AQaaT76.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*3tURkChXo-Si4vm-WbdWRA.png" /></figure><h3>4. Min-Max Normalization</h3><p>Min-Max Normalization transforms x to x’ by converting each value of features to a range between <strong>0 and 1</strong>, and this is also known as <strong>(0–1) Normalization.</strong> If the data has negative values the range would have been between<strong> -1 and 1</strong>.<br>The formula for Min-Max Normalization is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/0*ZRlT6xeDBAXxozM-.png" /></figure><p>Formula for Min-Max Normalization</p><p>If we want to scale between some bounded <strong>arbitrary set of values [a, b]</strong>. Such as when we are dealing with image processing, the pixels need normalized to be between 0 and 255. Then we could use the following formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/0*0CcczorqcOg8HI4v.png" /></figure><p>Formula for Min-Max Normalization with arbitrary set of values [a, b]</p><p>Min-Max Normalization of Salary Data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/0*8csse0Mx1fToFQOE.png" /></figure><p>First 6 rows of Normalized data (Min-Max Normalization)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*zKNhlPkJgY4DH32z.png" /></figure><p>Descriptive Statistics table of Normalized Years of Experience Variable</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*KRW9S9y7-jEdKa_6.png" /></figure><p>Descriptive Statistics table of Normalized Salary Variable</p><p>As we can see from the descriptive statistics table, the minimum value of the feature gets normalized to 0, the maximum value gets normalized to 1, and the remaining values are between 0 and 1.</p><p><strong>Dataset before Min-Max Scaling:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/196/0*JXMgDqjaFHAA7y54.png" /></figure><p><strong>Dataset after Min-Max Scaling:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/198/0*5luztCXZffSRHNtY.png" /></figure><p>In this example, min-max scaling rescales the values of each feature to a specific range (typically between 0 and 1). The minimum value in the original dataset becomes 0, and the maximum value becomes 1. The other values are scaled proportionally within this range.</p><p>5. Standardization</p><p>Standardization transforms features to have a mean of 0 and a standard deviation of 1. It’s effective when features follow a Gaussian distribution.</p><ul><li>Transforms features to have zero mean and unit variance.</li><li>Formula: X_scaled = (X — X_mean) / X_std, where X is the original feature, X_scaled is the scaled feature, X_mean is the mean of X, and X_std is the standard deviation of X.</li><li>Suitable for features with unknown or non-normal distributions.</li></ul><h3>Dataset before Standardization:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/197/0*mcma-urVI8pPgFLw.png" /></figure><h3>Dataset after Standardization:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/205/0*bLmsOjz8Y9Zj3Fg_.png" /></figure><p>In this example, standardization (Z-score scaling) transforms the values of each feature to have a mean of 0 and a standard deviation of 1. The original values are shifted and rescaled according to the mean and standard deviation of the feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*W_0k6Ppb_2yLGqqx.png" /></figure><p>Optimal Use Case:<br>Standardization is ideal for algorithms that assume features are normally distributed, such as linear regression and logistic regression.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*Lcir7_GXdMXdTTr7aurWLg.png" /></figure><p>6. Log Transformations</p><p>Log transformations are used to stabilize variance, making the data more symmetrical and easier to interpret.</p><ul><li>Applies the logarithm function to the features, which can help normalize skewed distributions.</li><li>Particularly useful for features with highly skewed or long-tailed distributions.</li><li><em>Xlog</em>​=log(<em>X</em>)</li></ul><h3>Dataset before Log Transformation:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/198/0*vB2zTi8GNIEe7Bgf.png" /></figure><h3>Dataset after Log Transformation:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/199/0*GdoQ955rvn3AQ2eV.png" /></figure><p>In this example, the log transformation is applied to each value in the dataset by taking the logarithm with base 10. The resulting values represent the logarithmic scale of the original data.</p><p>Optimal Use Case:<br>Log transformations are beneficial when the data has a skewed distribution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*Zp74-NHYdNUk2c0J3_Vghg.png" /></figure><p>7. Root Transformations</p><p>Root transformations involve taking the square root or cube root of features to stabilize variance and make the data more symmetric.</p><p>Formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/160/1*R14TH5QJf6XOhpRaUxcl3g.png" /></figure><p>Optimal Use Case:<br>Root transformations are useful when the data has a right-skewed distribution and needs to be made more symmetric.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*vpS7oTmr9ESVFrgDAKxVeA.png" /></figure><p>8. Box-Cox Transformation</p><p>The Box-Cox transformation is a family of power transformations that optimally transform data to approximate a normal distribution.</p><p>Formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*JtOh6H813l9VmueiHtp3sg.png" /></figure><p>Optimal Use Case:<br>The Box-Cox transformation is effective when dealing with non-normally distributed data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*uuFPP8R0hELsbc4ZLimlSw.png" /></figure><p>9. Yeo-Johnson Transformation</p><p>The Yeo-Johnson transformation is a modification of the Box-Cox transformation that can handle both positive and negative values.</p><p>Formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*751Yg0iH2lkJavaGLsKVaQ.png" /></figure><p>Optimal Use Case:<br>The Yeo-Johnson transformation is suitable for data with both positive and negative values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/855/1*-jIlhpzsHe6E62Y6DdpUCw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=847f7d9b04fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Probability: A Comprehensive Guide]]></title>
            <link>https://medium.com/@Analyst_Shiva/understanding-probability-a-comprehensive-guide-2c916d5b1cc7?source=rss-a6f246f5c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c916d5b1cc7</guid>
            <dc:creator><![CDATA[Shiva Ram]]></dc:creator>
            <pubDate>Tue, 19 Mar 2024 13:53:03 GMT</pubDate>
            <atom:updated>2024-03-19T13:53:03.806Z</atom:updated>
            <content:encoded><![CDATA[<p>Introduction:<br>In a world full of uncertainty, probability serves as a powerful tool for making informed decisions across various fields. From predicting stock market movements to understanding the likelihood of rain on a given day, probability plays a pivotal role in shaping our understanding of the world around us. In this blog post, we will delve into the fundamental concepts of probability, exploring its applications, theories, and practical implications.</p><p>1. What is probability, and how is it utilized in various fields?</p><p>Probability is the measure of the likelihood that an event will occur. It is expressed as a number between 0 and 1, where 0 indicates impossibility and 1 indicates certainty. Probability theory finds applications in diverse fields such as finance, engineering, healthcare, and sports analytics.</p><p>1.1 Experiment:<br>An experiment is a process that results in one or more outcomes. For example, tossing a coin, rolling a die, or conducting a clinical trial are all examples of experiments.</p><p>1.2 Event:<br>An event is an outcome or a set of outcomes of an experiment. In a coin toss experiment, the event “getting heads” consists of one outcome.</p><p>1.3 Sample space:<br>The sample space of an experiment is the set of all possible outcomes. For a coin toss, the sample space is {heads, tails}.</p><p>2. Compare and contrast empirical probability with theoretical probability. How does the law of large numbers connect these concepts?</p><p>Empirical probability is based on observations or experiments, where the probability of an event is estimated by conducting trials and calculating the proportion of times the event occurs. Theoretical probability, on the other hand, is determined using mathematical principles and assumes equally likely outcomes.</p><p>The law of large numbers states that as the number of trials in an experiment increases, the empirical probability of an event approaches its theoretical probability. This law serves as a bridge between empirical and theoretical probability, highlighting the convergence of observed frequencies to theoretical probabilities with increasing sample size.</p><p>3. Define a random variable and explain its significance with a suitable example.</p><p>A random variable is a variable whose possible values are outcomes of a random phenomenon. It assigns a numerical value to each outcome in the sample space. For example, in rolling a die, the random variable X could represent the number shown on the die face.</p><p>Random variables are significant because they enable us to quantify uncertainty and analyze the probabilities associated with different outcomes. They form the basis for statistical modeling and decision-making in various fields.</p><p>4. What are the axioms of probability?</p><p>The axioms of probability are:</p><p>4.1 Non-negativity: The probability of any event is a non-negative number.<br>4.2 Additivity: The probability of the union of two mutually exclusive events is the sum of their individual probabilities.<br>4.3 Normalization: The probability of the entire sample space is 1.</p><p>These axioms provide a formal framework for defining and manipulating probabilities, ensuring consistency and coherence in probabilistic reasoning.</p><p>5. Provide examples to illustrate the following types of probabilities:</p><p>5.1 Independent events: Flipping a coin and rolling a die are independent events since the outcome of one does not affect the outcome of the other.<br>5.2 Dependent events: Drawing two cards from a deck without replacement is an example of dependent events, as the probability of drawing the second card depends on the outcome of the first draw.<br>5.3 Mutually exclusive events: A single coin toss cannot result in both heads and tails simultaneously, making “getting heads” and “getting tails” mutually exclusive events.<br>5.4 Conditional probability: The probability of rain given that it is cloudy is an example of conditional probability, denoted as P(Rain | Cloudy).<br>5.5 Joint probability: The probability of rolling a 2 on a fair die and tossing a head on a fair coin simultaneously represents the joint probability of these events.</p><p>Conclusion:<br>Probability is a cornerstone of modern statistics and plays a central role in decision-making under uncertainty. By understanding the fundamental concepts and principles of probability, individuals can make informed predictions, assess risks, and draw meaningful insights from data across various domains. Whether you’re a data analyst, a researcher, or simply curious about the world around you, mastering probability opens doors to a deeper understanding of chance and randomness.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c916d5b1cc7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Comprehensive Guide to Sampling Techniques: Probability and Non-Probability Methods]]></title>
            <link>https://medium.com/@Analyst_Shiva/a-comprehensive-guide-to-sampling-techniques-probability-and-non-probability-methods-a1671f498703?source=rss-a6f246f5c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1671f498703</guid>
            <category><![CDATA[sampling-methods]]></category>
            <dc:creator><![CDATA[Shiva Ram]]></dc:creator>
            <pubDate>Tue, 19 Mar 2024 13:21:25 GMT</pubDate>
            <atom:updated>2024-03-19T13:24:32.792Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*A_zSW5jWYTtIbt7oS7D6_g.jpeg" /></figure><p>Introduction:<br>When you conduct research about a group of people, it’s rarely possible to collect data from every person in that group. Instead, you select a <strong>sample</strong>. The sample is the group of individuals who will actually participate in the research.</p><p>To draw valid conclusions from your results, you have to carefully decide how you will select a sample that is representative of the group as a whole. This is called a <strong>sampling method</strong>.</p><p>Understanding the various methods, both probability and non-probability, is essential for any data analyst. In this blog, we’ll delve into the definitions, examples, applications, and advantages and disadvantages of probability and non-probability sampling methods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*VcTx_QE7zkBy8m6cjiQQqw.jpeg" /></figure><p>1. <strong><em>Probability Sampling Methods:</em></strong><br>Probability sampling involves selecting samples based on a known probability distribution, ensuring each member of the population has an equal chance of being selected. Here are some common methods:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*Nm-c0hI-vmBujKbhC68jUw.jpeg" /></figure><p>a. Simple Random Sampling:<br> — Definition: In a simple random sample, every member of the population has an equal chance of being selected. Your sampling frame should include the whole population.</p><p>To conduct this type of sampling, you can use tools like random number generators or other techniques that are based entirely on chance.</p><p>Example:</p><ol><li>Drawing names out of a hat, using random number generators.</li><li>You want to select a simple random sample of 1000 employees of a social media marketing company. You assign a number to every employee in the company database from 1 to 1000, and use a random number generator to select 100 numbers.</li></ol><p>Applications: Population studies, opinion polls.<br> — Advantages: Unbiased representation, easy to understand and implement.<br> — Disadvantages: Requires complete list of population members, not suitable for large populations.</p><p>b. Systematic Sampling:<br> — Definition: Systematic sampling is similar to simple random sampling, but it is usually slightly easier to conduct. Every member of the population is listed with a number, but instead of randomly generating numbers, individuals are chosen at regular intervals.</p><p>Example:</p><ol><li>Selecting every 10th patient entering a clinic for a survey.</li><li>All employees of the company are listed in alphabetical order. From the first 10 numbers, you randomly select a starting point: number 6. From number 6 onwards, every 10th person on the list is selected (6, 16, 26, 36, and so on), and you end up with a sample of 100 people. If you use this technique, it is important to make sure that there is no hidden pattern in the list that might skew the sample. For example, if the HR database groups employees by team, and team members are listed in order of seniority, there is a risk that your interval might skip over people in junior roles, resulting in a sample that is skewed towards senior employees.</li></ol><p>Applications: Quality control, manufacturing processes.<br> — Advantages: Simple to implement, preserves randomness.<br> — Disadvantages: Susceptible to periodic patterns in the population.</p><p>c. Stratified Sampling:<br> — Definition: Stratified sampling involves dividing the population into subpopulations that may differ in important ways. It allows you draw more precise conclusions by ensuring that every subgroup is properly represented in the sample.</p><p>To use this sampling method, you divide the population into subgroups (called strata) based on the relevant characteristic (e.g., gender identity, age range, income bracket, job role).</p><p>Based on the overall proportions of the population, you calculate how many people should be sampled from each subgroup. Then you use random systematic sampling to select a sample from each subgroup.</p><p>Example:</p><ol><li>Dividing students into grade levels and then randomly selecting students from each grade.</li><li>The company has 800 female employees and 200 male employees. You want to ensure that the sample reflects the gender balance of the company, so you sort the population into two strata based on gender. Then you use random sampling on each group, selecting 80 women and 20 men, which gives you a representative sample of 100 people.</li></ol><p>Applications: Educational research, market research.<br> — Advantages: Ensures representation from all subgroups, increased precision.<br> — Disadvantages: Requires knowledge of population characteristics, can be complex to implement.</p><p>d. Cluster Sampling:<br>Definition: Cluster sampling also involves dividing the population into subgroups, but each subgroup should have similar characteristics to the whole sample. Instead of sampling individuals from each subgroup, you randomly select entire subgroups.</p><p>If it is practically possible, you might include every individual from each sampled cluster. If the clusters themselves are large, you can also sample individuals from within each cluster using one of the techniques above. This is called multistage sampling.</p><p>This method is good for dealing with large and dispersed populations, but there is more risk of error in the sample, as there could be substantial differences between clusters. It’s difficult to guarantee that the sampled clusters are really representative of the whole population.</p><p>Example:</p><ol><li>Suppose you’re conducting a survey on public opinion in a large city. You divide the city into neighborhoods (clusters) and randomly select several neighborhoods. Within each selected neighborhood, you survey all households.</li><li>The company has offices in 10 cities across the country (all with roughly the same number of employees in similar roles). You don’t have the capacity to travel to every office to collect your data, so you use random sampling to select 3 offices — these are your clusters.</li></ol><p>Applications: Used when the population is widely dispersed or difficult to access, such as in geographical studies or large-scale health surveys.<br> — Advantages: 1. Cost-effective, as it reduces travel and administrative costs. 2. Suitable for large populations and geographically dispersed areas.<br> — Disadvantages: 1. Increased risk of sampling bias if clusters are not representative of the population. 2. Variability within clusters may affect the accuracy of estimates.</p><p>2. <strong><em>Non-probability Sampling Methods</em></strong>:<br> Non-probability sampling does not rely on random selection and may lead to biased results, but it is often more practical and cost-effective. Here are some examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*zaJj5lasCf6A3RHSG4MVDQ.jpeg" /></figure><p>a. Convenience Sampling:<br> — Definition: A convenience sample simply includes the individuals who happen to be most accessible to the researcher.</p><p>This is an easy and inexpensive way to gather initial data, but there is no way to tell if the sample is representative of the population, so it can’t produce generalizable results. Convenience samples are at risk for both sampling bias and selection bias.</p><p>Example: 1. Surveying shoppers at a mall. 2. You are researching opinions about student support services at your university, so after each of your classes, you ask your fellow students to complete a surveyon the topic. This is a convenient way to gather data, but as you only surveyed students taking the same classes as you at the same level, the sample is not representative of all the students at your university.</p><p>Applications: preliminary research, exploratory studies.<br> — Advantages: convenient, quick, and inexpensive.<br> — Disadvantages: Prone to selection bias, results may not be representative.</p><p>b. Purposive Sampling:<br> — Definition: This type of sampling, also known as judgement sampling, involves the researcher using their expertise to select a sample that is most useful to the purposes of the research.</p><p>It is often used in qualitative research, where the researcher wants to gain detailed knowledge about a specific phenomenon rather than make statistical inferences, or where the population is very small and specific. An effective purposive sample must have clear criteria and a rationale for inclusion. Always make sure to describe your inclusion and exclusion criteria and beware of observer bias affecting your arguments.<br>Example: 1. Interviewing experts in a particular field. 2. You want to know more about the opinions and experiences of disabled students at your university, so you purposefully select a number of students with different support needs in order to gather a varied range of data on their experiences with student services.</p><p>Applications: Qualitative research, case studies.<br> — Advantages: Allows for targeted selection, useful for specialized populations.<br> — Disadvantages: limited generalizability, potential for researcher bias.</p><p>c. Snowball Sampling:<br>Definition: If the population is hard to access, snowball sampling can be used to recruit participants via other participants. The number of people you have access to “snowballs” as you get in contact with more people. The downside here is also representativeness, as you have no way of knowing how representative your sample is due to the reliance on participants recruiting others. This can lead to sampling bias.</p><p>Example: 1. Studying rare populations where individuals are interconnected. 2. You are researching experiences of homelessness in your city. Since there is no list of all homeless people in the city, probability sampling isn’t possible. You meet one person who agrees to participate in the research, and she puts you in contact with other homeless people that she knows in the area.</p><p>Applications: studying marginalized or hard-to-reach populations.<br> — Advantages: useful for accessing hidden populations, cost-effective.<br> — Disadvantages: susceptible to bias, may not be representative of the entire population.</p><p>d. Quota Sampling:</p><p>Quota sampling relies on the non-random selection of a predetermined number or proportion of units. This is called a quota.</p><p>You first divide the population into mutually exclusive subgroups (called strata) and then recruit sample units until you reach your quota. These units share specific characteristics, determined by you prior to forming your strata. The aim of quota sampling is to control what or who makes up your sample.</p><p>Example:</p><ol><li>You want to gauge consumer interest in a new produce delivery service in Boston, focused on dietary preferences. You divide the population into meat eaters, vegetarians, and vegans, drawing a sample of 1000 people. Since the company wants to cater to all consumers, you set a quota of 200 people for each dietary group. In this way, all dietary preferences are equally represented in your research, and you can easily compare these groups.You continue recruiting until you reach the quota of 200 participants for each subgroup.</li></ol><p>2. In a market research study, interviewers are instructed to survey a certain number of respondents from different age groups until each quota is filled.</p><p>Applications: Often used in market research to ensure representation of various demographic groups.</p><p>— Advantages:</p><ul><li>Allows for the representation of specific subgroups within the population.</li><li>It is relatively easy and cost-effective to implement compared to probability sampling methods.</li></ul><p>— Disadvantages:</p><ul><li>There is a risk of selection bias if quotas are not accurately defined or adhered to.</li><li>Results may not be generalizable to the entire population if quotas are poorly chosen or implemented.</li></ul><p>Conclusion:<br>Understanding the diverse range of sampling techniques is fundamental for any data analyst conducting research. Probability sampling methods, such as simple random sampling, systematic sampling, stratified sampling, and cluster sampling, offer robust approaches to ensure representativeness and allow for strong statistical inferences. Each method has its advantages, including unbiased representation and increased precision, but also comes with its set of challenges, such as the need for complete population lists and susceptibility to biases.</p><p>On the other hand, non-probability sampling methods, including convenience sampling, purposive sampling, snowball sampling, and quota sampling, provide practical and cost-effective alternatives, particularly in situations where random selection is not feasible. These methods offer convenience and accessibility but may introduce biases and limitations, compromising the generalizability of results.</p><p>the selection of an appropriate sampling method depends on various factors, including research objectives, population characteristics, and available resources. By carefully considering the strengths and limitations of each technique, researchers can make informed decisions to ensure the validity and reliability of their study findings.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1671f498703" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Probability]]></title>
            <link>https://medium.com/@Analyst_Shiva/probability-4e66b2fc117d?source=rss-a6f246f5c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e66b2fc117d</guid>
            <dc:creator><![CDATA[Shiva Ram]]></dc:creator>
            <pubDate>Tue, 12 Mar 2024 17:04:52 GMT</pubDate>
            <atom:updated>2024-03-12T17:04:52.588Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>What is probability? How it can be used in various fields?</strong></p><p><strong>Probability</strong> is a mathematical term which tells about an uncertainty of an event helps us to make predictions based on the information. It is expressed as a number between 0 and 1, where 0 indicates impossibility (the event will not occur) and 1 indicates certainty (the event will occur).</p><p>In various fields, probability is used extensively:</p><ol><li><strong>Statistics</strong>: Probability forms a foundation os statistical analysis, where it’s used to make inferences about population based on sample data.</li><li><strong>Finance</strong>: Probability models are used in finance to access the risk associated with investments, price derivatives, and predict market movements.</li><li><strong>Engineering and Science</strong>: Probability is used in engineering to analyze the reliability of systems, such as electrical circuits, mechanical components, and software systems. In science, probability is used in fields such as physics, biology, and environmental science to model random phenomena, such as radioactive decay, genetic mutations, and weather patterns.</li><li><strong>Machine Learning and Data Science</strong>: Probability is essential in machine learning and data science for modeling uncertainty in data, making predictions, and estimating parameters of statistical models. Techniques such as Bayesian inference and probabilistic graphical models rely heavily on probability theory.</li><li><strong>Operations Research and Management</strong>: Probability is used in operations research to model and analyze stochastic processes, such as queuing systems, inventory management, and production scheduling. In management, probability is used in decision analysis and risk management to assess the likelihood of different outcomes and make optimal decisions under uncertainty.</li><li><strong>Medicine and Healthcare</strong>: Probability is used in medical research to analyze clinical trial data, assess the effectiveness of treatments, and predict the probability of disease occurrence. In healthcare, probability is used in epidemiology to model the spread of infectious diseases and assess the effectiveness of public health interventions.</li><li><strong>Insurance</strong>: Insurance companies use probability to calculate premiums based on the likelihood of various events such as accidents, illnesses, or natural disasters occurring.</li><li><strong>Weather Forecasting</strong>: Meteorologists use probability to predict the likelihood of different weather outcomes, such as rain, snow, or sunshine.</li><li><strong>Gaming and Gambling</strong>: Probability plays a crucial role in games of chance like poker, blackjack, and roulette, helping players make decisions based on the likelihood of certain outcomes.</li></ol><p>Overall, probability plays a crucial role in a wide range of fields, providing a framework for understanding and dealing with uncertainty, making informed decisions, and solving complex problems.</p><p>After knowing this much about probability we need to understand few more terms:</p><p><strong>Experiment</strong>: Experiment is nothing but a process to generate an outcome or set of outcomes. these outcomes are generally random and uncertain. we experiment and get these outcomes for analysing and calculation the probability.</p><p><strong>Event</strong>: An event is consisting of an outcome or outcomes. For example tossing a coin is an event, rolling a dice is an event, rolling 2 dice is a set of outcomes.</p><p><strong>Sample Space</strong>: The set which consists all the possible outcomes of the event is called Sample Space, it is usually denoted by S. For example if tossing a fair coin is an event then the sample space would be, S = {H,T}.</p><h3>Comparison and contrast between Theoretical and Empirical Probability:</h3><ul><li><strong>Empirical Probability</strong>:</li></ul><p>1. Definition: Empirical probability, also known as experimental probability, is based on observations or experiments. It is calculated by conducting repeated trials of an experiment and recording the outcomes. The empirical probability of an event is the ratio of the number of times the event occurs to the total number of trials.</p><p>2. Calculation: Empirical probability is calculated using observed data from real-world experiments or observations. It is an estimate of the true underlying probability based on observed frequencies.</p><p>3. Use: Empirical probability is often used when it is not possible to determine the theoretical probabilities analytically or when dealing with situations where theoretical probabilities may not accurately represent real-world outcomes.</p><p><strong>Theoretical Probability</strong>:</p><p>1. Definition: Theoretical probability is based on mathematical principles and is calculated using theoretical considerations rather than empirical observations. It is determined by analyzing the sample space and the properties of the experiment.</p><p>2. Calculation: Theoretical probability is calculated using mathematical formulas and principles. It is based on the assumption of equally likely outcomes and does not require conducting actual experiments.</p><p>3. Use: Theoretical probability is used in situations where the sample space and the probabilities of outcomes are known or can be determined analytically. It provides a precise and exact measure of the likelihood of events occurring.</p><p>Comparison:</p><p>- Both empirical and theoretical probabilities are measures of the likelihood of events occurring.<br>- Empirical probability is based on observed frequencies from experiments, while theoretical probability is based on mathematical analysis of the sample space and the properties of the experiment.<br>- Empirical probability provides an estimate of the true underlying probability based on observed data, while theoretical probability provides an exact measure based on mathematical principles.</p><p>Contrast:</p><p>- Empirical probability is based on observed data and is subject to variability due to random fluctuations in the data, while theoretical probability is based on mathematical principles and is not affected by variability in observed data.<br>- Empirical probability may not always accurately represent the true underlying probabilities, especially with a small number of trials, while theoretical probability provides precise measures based on mathematical analysis.</p><p>Law of Large Numbers:</p><p>The Law of Large Numbers states that as the number of trials in an experiment increases, the empirical probability of an event approaches its theoretical probability. In other words, with a large enough sample size, the observed frequencies in empirical probability tend to converge to the true underlying probabilities in theoretical probability. This connection between empirical and theoretical probabilities provided by the Law of Large Numbers highlights the convergence of observed data to expected values as the sample size increases, reinforcing the reliability of probability estimates based on large datasets.</p><h3>What is random variable?</h3><p>A random variable is a mathematical concept used in probability theory and statistics to represent numerical outcomes of random phenomena. It assigns a numerical value to each outcome of an experiment, where each value corresponds to a possible outcome of the experiment.</p><p>Random variables can be classified into two main types: discrete random variables and continuous random variables.</p><p>1. <strong>Discrete Random Variable</strong>: A discrete random variable is one that can take on a finite or countably infinite number of distinct values. These values are typically integers or whole numbers. Examples of discrete random variables include the number of heads obtained when flipping a coin, the number of defects in a batch of products, or the number of students who pass an exam.</p><p>2. <strong>Continuous Random Variable</strong>: A continuous random variable is one that can take on any value within a specified range. These values are typically real numbers and can be infinitely divisible. Examples of continuous random variables include the height of a person, the temperature at a given location, or the time it takes for a process to complete.</p><p>The significance of random variables lies in their ability to represent and quantify uncertainty in various situations. By defining and studying random variables, we can analyze the probabilities associated with different outcomes of random experiments, make predictions, and infer properties of the underlying probability distributions.</p><p>Example:</p><p>Consider a random experiment of rolling a fair six-sided die. Let’s define a discrete random variable X that represents the outcome of this experiment, where X can take values from 1 to 6, each representing the number that appears on the face of the die.</p><p>The probability distribution of the random variable X is given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/0*7nBKOvti-MWRqPNn.png" /></figure><p>This means that each outcome has an equal probability of 1/6 of occurring when the die is rolled.</p><p>With this random variable X, we can calculate various probabilities associated with different outcomes. For example, we can calculate the probability of rolling a number greater than 4 as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*xgENhnaL-hazF7iT.png" /></figure><p>Thus, random variables allow us to analyze the probabilistic behaviour of random experiments and make informed decisions based on their outcomes.</p><p><strong>Axioms of probability</strong>: The axioms of probability are fundamental principles that govern the behaviour of probabilities in a probabilistic framework. These axioms were first formally introduced by mathematician Andrey Kolmogorov and are considered the foundation of probability theory. There are three main axioms:</p><p>1. <strong>Non-Negativity</strong>: The probability of any event A is a non-negative real number. Mathematically, this can be expressed as:<br>P(A) ≥ 0<br>This axiom ensures that probabilities are always non-negative values.</p><p>2. <strong>Normalization</strong>: The probability of the entire sample space S is equal to 1. Mathematically, this can be expressed as:<br>P(S) = 1<br>This axiom ensures that the total probability of all possible outcomes in the sample space is 1, representing certainty.</p><p>3. <strong>Additivity</strong>: For any two mutually exclusive (disjoint) events A and B (i.e., events that cannot occur simultaneously), the probability of the union of these events is equal to the sum of their individual probabilities. Mathematically, this can be expressed as:<br>P(A \cup B) = P(A) + P(B)<br>This axiom ensures that the probability of the union of disjoint events is the sum of their individual probabilities.</p><p>These three axioms provide the mathematical foundation for the definition and calculation of probabilities in probability theory. They ensure that probabilities behave consistently and follow certain rules, allowing for meaningful interpretations and applications in various fields.</p><p>Explanation of following with example:</p><p>1. <strong>Dependent Events</strong>:</p><p>Dependent events are events where the outcome of one event affects the outcome of another event. The probability of the second event is influenced by the outcome of the first event.</p><p>Example: Drawing two cards from a deck without replacement.</p><p>Suppose we have a standard deck of 52 playing cards. If we draw one card from the deck and do not replace it, the probability of the second card being of a certain type will change.</p><p>Let event A be drawing a red card on the first draw, and event B be drawing a red card on the second draw.</p><p>P(A) = 26/52= 1/2</p><p>Now, if the first card drawn is red (event A occurs), there will be 25 red cards left in the deck of 51 cards for the second draw:</p><p>P(B|A) = 25/51</p><p>Since the second draw’s probability depends on the outcome of the first draw, events A and B are dependent.</p><p>2. <strong>Independent Events</strong>:</p><p>Independent events are events where the outcome of one event does not affect the outcome of another event.</p><p>Example: Flipping a coin twice.</p><p>Let event A be getting heads on the first flip, and event B be getting heads on the second flip.</p><p>P(A) = P(B) = 1/2</p><p>Since the outcome of the first flip does not affect the outcome of the second flip, events A and B are independent.</p><p>3. <strong>Mutually Exclusive Events</strong>:</p><p>Mutually exclusive events are events that cannot occur simultaneously.</p><p>Example: Rolling a die and getting an odd number or getting an even number.</p><p>Let event A be getting an odd number, and event B be getting an even number.</p><p>P(A) = 3/6 = 1/2<br>P(B) = 3/6= 1/2</p><p>Since an outcome cannot be both odd and even, events A and B are mutually exclusive.</p><p>4. <strong>Conditional Probability</strong>:</p><p>Conditional probability is the probability of an event occurring given that another event has already occurred.</p><p>Example: Drawing a red card from a standard deck of playing cards, given that the card drawn is a face card (jack, queen, or king).</p><p>Let event A be drawing a red card, and event B be drawing a face card.</p><p>P(B) = 12/52 = 3/13<br>P(A|B) = 6/12 = 1/2</p><p>The probability of drawing a red card given that the card drawn is a face card is 1/2.</p><p>5. <strong>Joint Probability:</strong></p><p>Joint probability is the probability of two or more events occurring simultaneously.</p><p>Example: Tossing two coins and getting heads on both.</p><p>Let event A be getting heads on the first coin toss, and event B be getting heads on the second coin toss.</p><p>P(A \cap B) = P(A) * P(B) = (1/2)*(1/2) = 1/4</p><p>The joint probability of getting heads on both coin tosses is 1/4.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e66b2fc117d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data Visualisation with Python]]></title>
            <link>https://medium.com/@Analyst_Shiva/data-visualisation-with-python-9a4b8c53f182?source=rss-a6f246f5c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a4b8c53f182</guid>
            <dc:creator><![CDATA[Shiva Ram]]></dc:creator>
            <pubDate>Wed, 24 Jan 2024 16:07:28 GMT</pubDate>
            <atom:updated>2024-01-24T16:07:28.916Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kx19SU7gtdOBRwOrtPTLNg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LyJ0cIzQyBUSt_C6XdT6bw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n1xF9cs9kySW8x1iYzG2Wg.png" /></figure><p>Violin Plot (Non-normal Distribution):</p><p>A <strong>violin</strong> plot is created using Seaborn for a non-normal distribution generated with np.random.exponential. Displayed in the first row, spanning all three columns. Histogram (Normal Distribution):</p><p>A <strong>histogram</strong> is created using Seaborn for a normal distribution generated with np.random.normal. Displayed in the second row, first column. Density Plot with Standard Deviation Lines (Normal Distribution):</p><p>A <strong>density plot</strong> is created using Seaborn with vertical lines indicating the mean, median, and standard deviations. Displayed in the second row, second column. Scatter Plot:</p><p>A <strong>scatter plot</strong> is created using Seaborn with random data generated using np.random.randn. Displayed in the second row, third column. Exploded Pie Plot:</p><p>An exploded <strong>pie plot </strong>is created using Matplotlib for illustrating percentages with labels A, B, and C. Displayed in the third row, first column. Countplot:</p><p>A <strong>countplot</strong> is created using Seaborn for the ‘Category’ variable in the data_countplot DataFrame. Displayed in the third row, second column. Butterfly Chart:</p><h4><strong>A Butterfly chart is created using Seaborn for positive and negative values in the butterfly_data DataFrame. Displayed in the third row, third column. The plt.tight_layout() function is used to improve the subplot layout, and plt.show() is used to display the entire figure.</strong></h4><p>Are you curious to know about the pictures how they have been visualized what is the code beyond this pictures then why are you waiting for</p><p><a href="https://github.com/Analyst-Shiva/DA_Batch-264/blob/main/Task%20240124.ipynb">DA_Batch-264/Task 240124.ipynb at main · Analyst-Shiva/DA_Batch-264</a></p><p>If you like my blog follow and comment for more Thank you</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a4b8c53f182" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Median absolute deviation]]></title>
            <link>https://medium.com/@Analyst_Shiva/median-absolute-deviation-72659b4a1b2a?source=rss-a6f246f5c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/72659b4a1b2a</guid>
            <dc:creator><![CDATA[Shiva Ram]]></dc:creator>
            <pubDate>Fri, 12 Jan 2024 03:16:47 GMT</pubDate>
            <atom:updated>2024-01-12T03:16:47.130Z</atom:updated>
            <content:encoded><![CDATA[<p>Median absolute deviation is a robust way to identify outliers. It replaces standard deviation or variance with median deviation and the mean with the median. The result is a method that isn’t as affected by outliers as using the mean and standard deviation.</p><p>To calculate the median absolute deviation you must follow these steps:<br>1) Calculate the median of the population, median(population)<br>2) Calculate the deviation from the median, using the absolute value of the deviations, |x — median(population)|= deviation<br>3) Find the median of the absolute deviations, median(|deviations|), called scaling factor<br>4) Add the scaling factor to the median of the population for the upper bound<br>5) Subtract the scaling factor from the median of the population for the lower bound<br>6) Anything outside of the bounds is an outlier</p><p>Depending on the data it is strongly suggested that you multiply the scaling factor when determining the upper and lower bounds. For example: median(population) + 3*median(|deviations|) = upper bound.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72659b4a1b2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[z- Score for detecting Outliers]]></title>
            <link>https://medium.com/@Analyst_Shiva/z-score-for-detecting-outliers-56fb93f33184?source=rss-a6f246f5c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/56fb93f33184</guid>
            <dc:creator><![CDATA[Shiva Ram]]></dc:creator>
            <pubDate>Fri, 12 Jan 2024 03:12:50 GMT</pubDate>
            <atom:updated>2024-01-12T03:12:50.516Z</atom:updated>
            <content:encoded><![CDATA[<p>Can be Used: The Z-score, also known as the standard score, is a measure of how many standard deviations a data point is from the mean of a dataset. While it is commonly used in normal distributions, Outliers in a dataset are observations that deviate significantly from the majority of the data points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nOeykvgwlSgbGQA0D5Cuuw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0eMxXahDfI_u5yh4monP5A.png" /></figure><p>Can’t be Used: Z-scores are most effective for detecting outliers in approximately normal distributions. However, they may not be suitable for non-normal distributions because using Z-score for non-normal distributions can lead to inaccurate results.. Let’s consider five non-normal distributions — exponential, log-normal, bimodal, skewed, and multimodal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Aye-Z1z_-4YusyXw9FOZOg.png" /></figure><p>Now, let’s discuss why Z-scores might not be ideal for these distributions:</p><ol><li>Exponential Distribution:</li></ol><ul><li>Explanation: Exponential distributions have a rapidly decreasing tail, making extreme values less likely. Z-scores may misidentify tail values as outliers.</li><li>Box plot: The box plot shows a skewed distribution with a long tail.</li></ul><ol><li>Log-normal Distribution:</li></ol><ul><li>Explanation: Log-normal distributions are skewed and may have outliers in the right tail. Z-scores assume symmetry and may not accurately identify outliers in skewed distributions.</li><li>Box plot: The box plot highlights the right-skewed nature of the distribution.</li></ul><ol><li>Bimodal Distribution:</li></ol><ul><li>Explanation: Z-scores may not capture the bimodal nature effectively, as they are designed for unimodal distributions.</li><li>Box plot: The box plot reveals the presence of two distinct modes.</li></ul><ol><li>Skewed Distribution:</li></ol><ul><li>Explanation: Skewed distributions violate the normality assumption, impacting the accuracy of Z-scores for outlier detection.</li><li>Box plot: The skewness is evident in the elongated tail on one side.</li></ul><ol><li>Multimodal Distribution:</li></ol><ul><li>Explanation: Z-scores assume a single mode, and in multimodal distributions, they may not accurately identify outliers.</li><li>Box plot: The multimodal nature is visible in the box plot.</li></ul><p>Summary, Z-scores are most reliable for approximately normal distributions and may not be optimal for various non-normal distributions, as illustrated by the provided examples and box plots.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56fb93f33184" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handling missing values in Python using Pandas]]></title>
            <link>https://medium.com/@Analyst_Shiva/handling-missing-values-in-python-using-pandas-6e88689f1d5b?source=rss-a6f246f5c2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e88689f1d5b</guid>
            <dc:creator><![CDATA[Shiva Ram]]></dc:creator>
            <pubDate>Wed, 10 Jan 2024 10:33:47 GMT</pubDate>
            <atom:updated>2024-01-10T11:00:19.919Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Hi, you are at the right place if you are dealing with missing values, Continue reading till the end if there is no enough time with you try to analyse pictures i have provided you will get complete picture on dealing with missing values. if you have reached till end follow, like and share the blog. missing values play an important role while we deal with data that can lead to mislead analysis. {<strong><em>Missing Data can occur when no information is provided for one or more items or for a whole unit. Missing Data is a very big problem in a real-life scenarios. Missing Data can also refer to as NA(Not Available) values in pandas. In DataFrame or Series sometimes many datasets simply arrive with missing data, either because it exists and was not collected or it never existed. For Example, Suppose different users being surveyed may choose not to share their income, some users may choose not to share the address in this way many datasets went missing</em></strong>.}</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*6y6grOwuNEPGK6C3hOE_2Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*ml65I5kuSdcrFQFYnot8ww.png" /></figure><p>Mainly this missing values can occur due to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/1*ErnhNB8HzH9HCj5j0RerNA.png" /><figcaption>Different types of missing values in data</figcaption></figure><ol><li>Missing Completely at a Random</li><li>Missing at Random</li><li>Missing Not at Random</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OH33vx7ixRYreyvcnfvwlg.png" /></figure><p>In Pandas missing data is represented by two value:</p><ul><li>None: None is a Python singleton object that is often used for missing data in Python code.</li><li>NaN : NaN (an acronym for Not a Number), is a special floating-point value recognized by all systems that use the standard IEEE floating-point representation</li></ul><h3>1. Removing missing values</h3><p>DataFrame.<strong>dropna</strong>(<em>*</em>, <em>axis=0</em>, <em>how=_NoDefault.no_default</em>, <em>thresh=_NoDefault.no_default</em>, <em>subset=None</em>, <em>inplace=False</em>, <em>ignore_index=False</em>)<a href="https://github.com/pandas-dev/pandas/blob/v2.1.4/pandas/core/frame.py#L6286-L6444">[source]</a></p><p>Parameters:</p><p><strong>axis: </strong><em>{0 or ‘index’, 1 or ‘columns’}, default 0</em></p><p>Determine if rows or columns which contain missing values are removed.</p><ul><li>0, or ‘index’ : Drop rows which contain missing values.</li><li>1, or ‘columns’ : Drop columns which contain missing value.</li></ul><p>Only a single axis is allowed.</p><p><strong>how: </strong><em>{‘any’, ‘all’}, default ‘any’</em></p><p>Determine if row or column is removed from DataFrame, when we have at least one NA or all NA.</p><ul><li>‘any’ : If any NA values are present, drop that row or column.</li><li>‘all’ : If all values are NA, drop that row or column.</li></ul><p><strong>thresh: </strong><em>int, optional</em></p><p>Require that many non-NA values. Cannot be combined with how.</p><p><strong>subset: </strong><em>column label or sequence of labels, optional</em></p><p>Labels along other axis to consider, e.g. if you are dropping rows these would be a list of columns to include.</p><p><strong>inplace: </strong><em>bool, default False</em></p><p>Whether to modify the DataFrame rather than creating a new one.</p><p><strong>ignore_index: </strong><em>bool, default </em><em>False</em></p><p>If True, the resulting axis will be labeled 0, 1, …, n - 1.</p><p>Returns: DataFrame or None</p><p>DataFrame with NA entries dropped from it or None if inplace=True.</p><p>See also</p><p><a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.bfill.html#pandas.DataFrame.bfill"><strong>DataFrame.bfill</strong></a>(*[, axis, inplace, limit, ...])</p><p>Fill NA/NaN values by using the next valid observation to fill the gap.</p><p><a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.ffill.html#pandas.DataFrame.ffill"><strong>DataFrame.ffill</strong></a>(*[, axis, inplace, limit, ...])</p><p>Fill NA/NaN values by propagating the last valid observation to next valid.</p><p><a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.fillna.html#pandas.DataFrame.fillna"><strong>DataFrame.fillna</strong></a>([value, method, axis, ...])</p><p>Fill NA/NaN values using the specified method.</p><p><a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.interpolate.html#pandas.DataFrame.interpolate"><strong>DataFrame.interpolate</strong></a>([method, axis, limit, ...])</p><p>Fill NaN values using an interpolation method.</p><p><a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.isna.html#pandas.DataFrame.isna"><strong>DataFrame.isna</strong></a>()</p><p>Detect missing values.</p><p><a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.isnull.html#pandas.DataFrame.isnull"><strong>DataFrame.isnull</strong></a>()</p><p>DataFrame.isnull is an alias for DataFrame.isna.</p><p><a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.notna.html#pandas.DataFrame.notna"><strong>DataFrame.notna</strong></a>()</p><p>Detect existing (non-missing) values.</p><p><a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.notnull.html#pandas.DataFrame.notnull"><strong>DataFrame.notnull</strong></a>()</p><p>DataFrame.notnull is an alias for DataFrame.notna.</p><p><a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.pad.html#pandas.DataFrame.pad"><strong>DataFrame.pad</strong></a>(*[, axis, inplace, limit, ...])</p><p>(DEPRECATED) Fill NA/NaN values by propagating the last valid observation to next valid.</p><p><a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.replace.html#pandas.DataFrame.replace"><strong>DataFrame.replace</strong></a>([to_replace, value, ...])</p><p>Replace values given in to_replace with value.</p><p><strong>Examples</strong></p><pre>&gt;&gt;&gt; df = pd.DataFrame({&quot;name&quot;: [&#39;Alfred&#39;, &#39;Batman&#39;, &#39;Catwoman&#39;],<br>...                    &quot;toy&quot;: [np.nan, &#39;Batmobile&#39;, &#39;Bullwhip&#39;],<br>...                    &quot;born&quot;: [pd.NaT, pd.Timestamp(&quot;1940-04-25&quot;),<br>...                             pd.NaT]})<br>&gt;&gt;&gt; df<br>       name        toy       born<br>0    Alfred        NaN        NaT<br>1    Batman  Batmobile 1940-04-25<br>2  Catwoman   Bullwhip        NaT</pre><p>Drop the rows where at least one element is missing.</p><pre>&gt;&gt;&gt; df.dropna()<br>     name        toy       born<br>1  Batman  Batmobile 1940-04-25</pre><p>Drop the columns where at least one element is missing.</p><pre>&gt;&gt;&gt; df.dropna(axis=&#39;columns&#39;)<br>       name<br>0    Alfred<br>1    Batman<br>2  Catwoman</pre><p>Drop the rows where all elements are missing.</p><pre>&gt;&gt;&gt; df.dropna(how=&#39;all&#39;)<br>       name        toy       born<br>0    Alfred        NaN        NaT<br>1    Batman  Batmobile 1940-04-25<br>2  Catwoman   Bullwhip        NaT</pre><p>Keep only the rows with at least 2 non-NA values.</p><pre>&gt;&gt;&gt; df.dropna(thresh=2)<br>       name        toy       born<br>1    Batman  Batmobile 1940-04-25<br>2  Catwoman   Bullwhip        NaT</pre><p>Define in which columns to look for missing values.</p><pre>&gt;&gt;&gt; df.dropna(subset=[&#39;name&#39;, &#39;toy&#39;])<br>       name        toy       born<br>1    Batman  Batmobile 1940-04-25<br>2  Catwoman   Bullwhip        NaT</pre><ul><li>for better examples you can click the links below i have provided</li></ul><h3><a href="https://pandas.pydata.org/docs/reference/frame.html#missing-data-handling">https://pandas.pydata.org/docs/reference/frame.html#missing-data-handling</a></h3><h3><a href="https://www.geeksforgeeks.org/working-with-missing-data-in-pandas"><strong>https://www.geeksforgeeks.org/working-with-missing-data-in-pandas</strong></a></h3><p>Below link is for visualising missing values using different packages:</p><h3><a href="https://www.geeksforgeeks.org/python-visualize-missing-values-nan-values-using-missingno-library"><strong>https://www.geeksforgeeks.org/python-visualize-missing-values-nan-values-using-missingno-library</strong></a></h3><p>Thank you for reading, following, sharing my blog stay tuned for my next blog :) .</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e88689f1d5b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>