<?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 Harshini N on Medium]]></title>
        <description><![CDATA[Stories by Harshini N on Medium]]></description>
        <link>https://medium.com/@harshini.1623?source=rss-b15430adaf0e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xEdWFAf9HYw9ZMXpBkRxbA.jpeg</url>
            <title>Stories by Harshini N on Medium</title>
            <link>https://medium.com/@harshini.1623?source=rss-b15430adaf0e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 21:02:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@harshini.1623/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[dplyr in R]]></title>
            <link>https://medium.com/@harshini.1623/dplyr-in-r-7ea2c732aa15?source=rss-b15430adaf0e------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ea2c732aa15</guid>
            <category><![CDATA[r]]></category>
            <category><![CDATA[dplyr]]></category>
            <dc:creator><![CDATA[Harshini N]]></dc:creator>
            <pubDate>Tue, 17 May 2022 15:14:57 GMT</pubDate>
            <atom:updated>2022-05-17T15:14:57.632Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7HdSJWPy89IY5HTq" /><figcaption>Photo by <a href="https://unsplash.com/@firmbee?utm_source=medium&amp;utm_medium=referral">Firmbee.com</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>When dealing with an enormous amount of data, we might be interested in viewing a particular field, selecting a subset of the data, updating a particular column, etc. All these operations can easily be performed in R without any hassle. dplyr package in R is the “<em>Grammar of Data Manipulation</em>”. It provides a set of verbs that help in data manipulation and exploration. We can work with dplyr either by installing the “dplyr” package or by installing the “tidyverse” package. The following are the verbs provided by dplyr to solve the data manipulation problems:</p><ol><li>filter( ): It is used to extract fields based on their values.</li><li>select( ): It is used to extract fields based on the column names.</li><li>mutate( ): To transform the existing variable.</li><li>summarize( ): To provide aggregate information.</li><li>arrange( ): It is used to arrange the rows in ascending or descending order.</li></ol><p>Let’s take a look at the examples of each with the help of the iris dataset:-</p><p>Install the dplyr package load the required package:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*MHfrb8DMV2D2SAOe_PWAdg.png" /></figure><ol><li>Filtering the iris dataset based on species “Setosa”. <br>Syntax: filter(data, condition)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*AQH7t3BMUlKAnEX5snBslA.png" /></figure><p>The filter( ) command has extracted only the rows about the species Setosa. The output consists of values of the first ten rows.</p><p>2. We use the parameters “starts_with” and “contains” in the Select command to extract values based on column names. Both “starts_with” and “contains” selects the fields that begin with the particular string or the mentioned condition. <br>Syntax: select(data, starts_with( )) , select(data, contains( ))</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*V9vU4GcKRC3MOrBTLTG3Ag.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*qWM4EuIJ7caEEK6ULHdX2Q.png" /></figure><p>Apart from “starts_with” and “contains” we can also directly mention the column number to extract the desired columns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/910/1*r-h7tgX7VVs3EtLXtR7sxw.png" /><figcaption>Displays only the 3rd and 5th column</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*7kyptpbh0s5XiOKwN1uMcg.png" /><figcaption>Displays columns in the range 3 to 5</figcaption></figure><p>3. The iris dataset contains measurements of the length and width in centimeters. With the help of mutate command, we can convert the length and width from centimeters to inches. <br>Syntax: mutate(data, condition)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*xuU7P3-ooEVKo40dcnJkOg.png" /></figure><p>A new column “Petal_Length_inches” contains the converted value of the Petal length.</p><p>4. The summarize command helps us to find the minimum, maximum, average, sum, etc. of the column values. <br>Syntax: summarize(data, function(column_name))</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*YapEglL6sXbb1-K68Arnlg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*qUH6YO-shl475PlYIMg4kQ.png" /></figure><p>5. We can sort the values in ascending or descending order with the help of the “arrange” command. By default, it will sort the values of the specified column in ascending order. If we want to sort the values in descending order we have to use the command “desc”.<br>Syntax: arrange(data, column_name)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/1*rOFQhL1_zSrregKvVnVOMQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*NqQbHL7h4U31-Ymf0G_lwg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ea2c732aa15" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Pandas Series Object]]></title>
            <link>https://medium.com/@harshini.1623/the-pandas-series-object-43bc1b214beb?source=rss-b15430adaf0e------2</link>
            <guid isPermaLink="false">https://medium.com/p/43bc1b214beb</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[series]]></category>
            <category><![CDATA[pandas-series]]></category>
            <dc:creator><![CDATA[Harshini N]]></dc:creator>
            <pubDate>Wed, 11 May 2022 09:08:41 GMT</pubDate>
            <atom:updated>2022-05-11T09:08:41.976Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yMYsq3r1h5mxiWhG" /><figcaption>Photo by <a href="https://unsplash.com/@rubaitulazad?utm_source=medium&amp;utm_medium=referral">Rubaitul Azad</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The Pandas Series is a one-dimensional array. We can imagine Series as a column in an excel sheet. Series is indexed data. By default, the series indexing starts from 0. We can also define our own index of any data type.</p><ol><li><strong>Importing Pandas and the NumPy module</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*UfuOu8tqbWI1np41AcKLDQ.png" /></figure><p>2. <strong>Creating Series</strong><br>Series can be created from lists or arrays.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*Tekk6jS88XS-4Xs2pa98nQ.png" /><figcaption>Creating Series from Array</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*OdMAMq_JEkSqSyNqZ8kCpA.png" /></figure><p>As we can see, by default the indexing or the labels of the Series starts from 0.</p><p>series_name.values and series_name.index returns the values of the Series object and the index range respectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*jYxlkAJbfI2IGPp0hI4i6A.png" /></figure><p>3.<strong> Accessing elements of a Series</strong><br>The data in Series can be accessed with the associated index. We use the general square bracket notation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*1ITwnBOtuC4I3IBvTjsWww.png" /></figure><p>4.<strong> Explicitly defining the Series Index:</strong><br>The index need not be an integer, it could be any desired data type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uCow5-SK6bCtkyVxrgfJ2A.png" /></figure><p>And the values can be accessed accordingly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*q1v_rE-nDSniLMPPaIFOSQ.png" /></figure><p>Also, the indexes need not be ordered or unique</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*_oyhjwfGzdjwUILt-u6j2w.png" /></figure><p>5. <strong>Series as Dictionary</strong><br>We can also construct a Series object with the help of Python dictionary. Dictionary is a structure that holds values in the form of key-value pairs. The keys provided will act as the index/labels of the Series.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*PxZmC5tzfXXZPVrFl3UCuA.png" /></figure><p>Pandas Series is more flexible than Numpy arrays. Numpy arrays have implicitly defined integer index whereas Pandas Series have an explicitly defined index.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43bc1b214beb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Functions in R]]></title>
            <link>https://medium.com/@harshini.1623/functions-in-r-547a633a054a?source=rss-b15430adaf0e------2</link>
            <guid isPermaLink="false">https://medium.com/p/547a633a054a</guid>
            <category><![CDATA[r]]></category>
            <category><![CDATA[functions-in-r]]></category>
            <dc:creator><![CDATA[Harshini N]]></dc:creator>
            <pubDate>Tue, 10 May 2022 17:53:09 GMT</pubDate>
            <atom:updated>2022-05-10T17:53:09.359Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Z_2qj0IG9sz3186b" /><figcaption>Photo by <a href="https://unsplash.com/@lazycreekimages?utm_source=medium&amp;utm_medium=referral">Michael Dziedzic</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Functions are blocks of code that are used to repetitively perform a specific task. It increases the code reusability and reduces code duplication. Functions can take any number of arguments and evaluate them against the given expression. R has numerous built-in functions such as seq(), min(), max(), rep() etc. We can also create our own functions.</p><p>Syntax: <strong>function_name = <em>function</em>(arguments) {expression}</strong></p><p>Let’s take a look at some of the user defined examples:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*rwQNpEypWQWkewgoXqxbtg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*4auM6Ks-Y1Izheth5HpVaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*GctDoLN8Wn-d6v1PrikA3g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*ihWc1o10xy8QWIRRdEw5mA.png" /></figure><h4>Built-in Functions in R</h4><p>There are several built-in functions in R which can be directly called by users in their programs. seq(), mean(), paste(), rep(), sum(), rm() etc are some of the simple built-in functions provided by R.</p><p>Let’s look at some more of the built-in functions:)</p><p>i. Mathematical Functions<br>max( ), min( ), sum( ), abs( ), sqrt( ), prod( ), round( ), log( ), log10( ), ceiling( ), floor( ), trunc( ), round( ), sin( ), cos( ), tan( ), exp( ) are the built-in mathematical functions in R.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*HFFUMxFPaUxM08t2afS6pw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*2bZRxgIfP-z-MUvjKVaY0w.png" /></figure><p>ii. Statistical Functions<br>mean( ), sd( ), var( ), range( ) and var( ) are some of the statistical built-in functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*PcD39qFkAJWlSWbupsdneQ.png" /></figure><p>iii. String Functions</p><p>nchar( ) — Returns the number of characters in a given string</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*wGBXD1JeVMD7mar96GOsCA.png" /></figure><p>toupper( ) — Is used to convert the given string to upper-case.<br>tolower( ) — Is used to convert the given string to lower-case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*5itu3x07K5mZGawzW7nZ6Q.png" /></figure><p>substring( ) function is used to extract a part of the given string within the specified interval.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*AxK7Pta4Dh6iK2YVz3d6UA.png" /></figure><p>sub( ) function finds the given pattern in the string and replaces it with the new text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*dMWrYBCpXaKgex3e6O5q0g.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=547a633a054a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basics of R]]></title>
            <link>https://medium.com/@harshini.1623/basics-of-r-a5d1a6a50835?source=rss-b15430adaf0e------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5d1a6a50835</guid>
            <category><![CDATA[r]]></category>
            <category><![CDATA[basics]]></category>
            <dc:creator><![CDATA[Harshini N]]></dc:creator>
            <pubDate>Tue, 10 May 2022 14:26:42 GMT</pubDate>
            <atom:updated>2022-05-10T15:03:49.616Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ncDYXmwKOlx-IEFm" /><figcaption>Photo by <a href="https://unsplash.com/@sapegin?utm_source=medium&amp;utm_medium=referral">Artem Sapegin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><ol><li>Assigning values to a variable<br>In any programming language, we use the assignment operator to assign values to a variable. Here again, in addition to the assignment operator, we use left assignment or right assignment operators. <br>i. “=, &lt;-, and &lt;&lt;-” are used to assign value/result on the right-hand side to the variable/object on the left-hand side.<br>ii. “-&gt; and -&gt;&gt;” is used to assign the values on the left-hand side to the variable present on the right-hand side.</li></ol><p>In addition to the assignment operators, we can use the assign() function, to assign values to the variable. <br>Syntax : <strong>assign(variable, value)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*ltAvnCF_1M5LpEX2p_NeqA.png" /><figcaption>Leftward Assignment</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*ii3yFyg-JYNUczmycYhTcA.png" /><figcaption>Rightward Assignment</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*MDJ48HQPJO-xQ6wSWeqtcQ.png" /><figcaption>Using assign() function</figcaption></figure><p>2. The concatenation command in R<br>To combine objects into a vector or list, we use the “c” command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*qe5I4BvcdzFk44sxL3quCg.png" /></figure><p>3. To delete objects from memory.<br>The rm() command is used to remove objects from the specified environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*ZU9oIpMDjDPqIgbidIkPvg.png" /></figure><p>4. Sequences in R<br>Sequences in R are used to create a range of numbers within a specified interval. Syntax : <strong>seq(staring_number, stopping_number)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*M17RkxQq5OpJJrC5ckzvHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*LjmHm8kyqO9Mb5SLtrQVzw.png" /></figure><p>We can also specify the length of the numbers to be generated within the interval. The following commands are the different ways in which we can create a sequence in R.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/742/1*LUbQ_esD9M5H6Omga1f9nQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*OIEecyh4VeO-wXgpoqmzUg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*5-Re_LkkG-BnTGY-X_VOrw.png" /><figcaption>There is no particular order in defining the parameters.</figcaption></figure><p>5. Repeat function in R<br>The rep() function in R is used to repeat a given set of values a specified number of times. <br>Syntax: <strong>rep(value, times)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*csterf6HM5phjzXhV7d0Vw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*upOcS25f3b5tyqsAEO5R7g.png" /></figure><p>If we want each value in the sequence to be repeated a particular number of times, we can use the “each” parameter. <br>Syntax: rep(vector, each, times)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/749/1*_lKNfM7xNkOjHGOOxZHEbQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*AjNQ7MmN6tEeYenDUaEAng.png" /></figure><p>6. Paste Function<br>The paste function is used to concatenate vectors after converting to a character. <br>Syntax: <strong>paste(vector, sep = “ ”, collapse =NULL)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*bm5TxNFoxymgN3oCneYKng.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*Mp1U-mpM7noPSqkvY4cP5w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*-80pkXOJ8R1K_8Kogg3VBA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5d1a6a50835" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Correlograms using R]]></title>
            <link>https://medium.com/@harshini.1623/correlograms-using-r-e6ba447e4760?source=rss-b15430adaf0e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e6ba447e4760</guid>
            <category><![CDATA[correlation]]></category>
            <category><![CDATA[r]]></category>
            <category><![CDATA[correlogram]]></category>
            <dc:creator><![CDATA[Harshini N]]></dc:creator>
            <pubDate>Fri, 06 May 2022 16:47:41 GMT</pubDate>
            <atom:updated>2022-05-06T16:47:41.277Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*fxmGfZShIFq6lzmog1Bf3w.png" /></figure><p>A correlation matrix when represented graphically is known as Correlogram. The correlation matrix is a table that displays the correlation coefficients between the variables. The correlation coefficients are colored according to their values. Let’s now analyze the correlation between the variables of the Iris dataset.</p><ol><li>Install the “<a href="https://cran.r-project.org/web/packages/corrplot/vignettes/corrplot-intro.html">corrplot</a>” package.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*Q4mb10zD8Sh_08FEdTb4oQ.png" /></figure><p>2. Load the package.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*Rw4Vol8vuRMYwArJp-cEyg.png" /></figure><p>3. Let’s summarize the iris dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*GcEta3yqerd2HqD6qoEz8A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/769/1*EuO4eK0E3xvfUA27dN2YlQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*-RirRfQG8qyyv23W6s7nYQ.png" /></figure><p>So, the iris dataset consists of 150 observations of 5 variables-Sepal Length, Sepal Width, Petal Length, Petal Width, and Species. We next consider the first four numeric variables for our correlation analysis.</p><p>4. Computing Correlation Matrix</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*5B1KqPqLxTKAbJk0A6RrUw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/627/1*YeWYZ0282rlyfvsocdb4Rg.png" /></figure><p>5. Visualizing the Correlation Matrix. (Correlogram)<br>Here we use the corrplot() function to plot the Correlogram. The two most important parameters to be passed in the function are the correlation matrix and the visualization method.<br>corrplot(corr, method = c(“circle”, “square”, “ellipse”, “number”, “shade”, “color”, “pie”)</p><p>We can pass the method to be either circle, square, or any of the above-mentioned parameters. Let’s try some of these methods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*TgCXtqYbUQACwJercSkC3g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*q5tkKvy5STC67mlw0MS8Eg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*hIn5WrQC6hdbnfOy8w1dPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*vnT6uYOg2PLrISgPsTOa4Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*NXjXbpwHttffeXZ4EVXj-Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*zcIWMVoo9b2IyoNbvVNMhw.png" /></figure><p>We can also change the layouts of the correlograms. <br>The type() parameter, takes in the following arguments:<br>type = c(“full”, “lower”, “upper”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*L8-D6wd0I2r_Li5iwxF1gg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*Tkbui9E0QpgqXNTf814I0Q.png" /></figure><p>Therefore, corrplot is very easy to use and provides us with various methods in which we can visualize the correlogram.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e6ba447e4760" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Karl Pearson Correlation Coefficient]]></title>
            <link>https://medium.com/@harshini.1623/karl-pearson-correlation-coefficient-739366a39e6c?source=rss-b15430adaf0e------2</link>
            <guid isPermaLink="false">https://medium.com/p/739366a39e6c</guid>
            <category><![CDATA[karl-pearson]]></category>
            <category><![CDATA[coefficient]]></category>
            <category><![CDATA[correlation]]></category>
            <dc:creator><![CDATA[Harshini N]]></dc:creator>
            <pubDate>Fri, 06 May 2022 11:24:35 GMT</pubDate>
            <atom:updated>2022-05-06T11:24:35.990Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3VaziXiTxAuOr9EP" /><figcaption>Photo by <a href="https://unsplash.com/@syinq?utm_source=medium&amp;utm_medium=referral">Susan Q Yin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Correlation refers to the relationship between two or more variables. Correlation can be studied through Scatter Diagrams and Algebraic methods like Karl Person Correlation Coefficient and Spearman Rank Correlation Coefficient.</p><p>Wondering which method best suits your data? Let’s explore one by one:)</p><ol><li>Scatter Diagrams:<br>* Scatter diagrams are used when we have paired numerical data. For example height and weight of a person form one pair, income and expenditure form one pair, etc. <br>* When our dependent variable has multiple values for each value of our independent variable.<br>* When paired observations are plotted, the pattern formed for all units under consideration gives a fair idea of correlation between the two variables. <br>Note: Scatter diagrams can only be plotted for two variables.</li></ol><p><a href="https://medium.com/@harshini.1623/what-is-correlation-2982792b2f6">Learn more about the Determination of Correlation by Scatter Diagram</a></p><p>2. Spearman Rank Correlation Coefficient<br>* Spearman’s Rank Correlation is used when our data exhibits monotonic relationships. <br>* It evaluates the relationship between ordinal data. This means that the correlation coefficient is calculated based on the ranked values for each variable</p><p>Now, let’s move on to our main topic!</p><p>3. Karl Pearson Correlation Coefficient</p><p>The mathematical measure of correlation was given by the statistician Karl Pearson in the form of correlation coefficient. It measures the strength of the linear relationship between paired data. It’s the best-suited method for quantitative data (Interval / Ratio). The Karl Pearson Correlation Coefficient value falls in the range of -1 to +1. <br>The Karl Pearson Correlation Coefficient is denoted by “r” and the formula is as follows:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/228/1*IgIcEfP4sWdi-F0p44TXpQ.png" /></figure><p>where cov(x,y) is the covariance between x and y and its formula is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*qRcxvIdrJrG7NJd5Acax2w.png" /></figure><p>and σ is the notation for standard deviation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/229/1*4vm_V59v6uSykz-RLJea9w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/243/1*nlAcD4KS-R0Y6l17thj9Tg.png" /></figure><p>Now, let’s look at an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*DiZ056R6jSe_aqFJ5zHH1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/166/1*EwrKpBQKV9BuMomjQwcPQQ.png" /></figure><p>The data consists of the Price and Demand of a product for 8 years. The necessary values required for computing the correlation coefficient have been calculated. By calculating the correlation coefficient we obtained:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/394/1*LeFb2Na2URJtPSoxydWjnA.png" /></figure><p>Thus, the value obtained is -0.6194 which indicates that there exists a negative degree of correlation between the Price and Demand. As the price increases, the demand for the product decreases.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=739366a39e6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Correlation?]]></title>
            <link>https://medium.com/@harshini.1623/what-is-correlation-2982792b2f6?source=rss-b15430adaf0e------2</link>
            <guid isPermaLink="false">https://medium.com/p/2982792b2f6</guid>
            <category><![CDATA[correlation]]></category>
            <category><![CDATA[types-of-correlation]]></category>
            <category><![CDATA[scatter-plots]]></category>
            <dc:creator><![CDATA[Harshini N]]></dc:creator>
            <pubDate>Mon, 02 May 2022 13:50:22 GMT</pubDate>
            <atom:updated>2022-05-06T11:27:21.147Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*E96Rub4W1bELdMSbypHJaw.png" /><figcaption>Image Source: <a href="https://www.displayr.com/wp-content/uploads/2018/05/What-is-Correlation.png">https://www.displayr.com/wp-content/uploads/2018/05/What-is-Correlation.png</a></figcaption></figure><h3>Correlation refers to the relationship between two or more variables. If the two variables, say X and Y, are linearly related, they are said to be correlated. It means that the change in one variable is accompanied by the change in the other variable. Correlation often helps us to understand the extent of interdependence between two or more variables. It provides answers to three questions:</h3><ol><li>Is there a relationship between the variables?</li><li>If there is a relationship, how strong is the relationship?</li><li>What is the direction of the relationship?</li></ol><p>The statistician Karl Pearson gave the mathematical measure of correlation in the form of the correlation coefficient. By calculating the correlation coefficient, we can determine the strength and direction of the relationship. The existence of the relationship can be found by calculating the correlation coefficient. The value of the correlation coefficient determines the strength of the relationship and the direction is determined by the sign( positive or negative) of the correlation coefficient.</p><h3>Types of Correlation</h3><ol><li><strong>Positive and Negative Correlation</strong></li></ol><p>Two variables, say X and Y, are said to be positively correlated if they both vary in the same direction. It simply means that the increase/decrease in one variable is accompanied by the increase/decrease in the other variable. For example, if the smoking habits of a person increase the chances of being prone to lung disease also increases. Similarly, the correlation between Discount and Sales, Experience and Income levels are all positively correlated.</p><p>If the variables vary in the opposite direction then the variables are said to be negatively correlated. The increase/decrease in one of the variables is accompanied by the decrease/increase in the other variable. For Example, as the price of particular good increases, the demand for the good decreases.</p><p><strong>2. Simple, Multiple, and Partial Correlation</strong></p><p>Simple Correlation: Here we find the correlation between only two variables. Say, X = Sales and Y = YouTube Advertisements</p><p>Multiple Correlation: In multiple correlation, we find the correlation between more than two variables. Example:- X = Sales, Y= YouTube Advertisements, Z = Newspaper Advertisements.</p><p>Partial Correlation: In partial correlation as well, we find the correlation between more than two variables, but study only two variables at a time. Example: We study the correlation between Sales and YouTube Advertisements by keeping Newspaper advertisements a constant.</p><p><strong>3. Linear and Non-Linear Correlation.</strong></p><p>If the ratio of change in one variable to the other variable is constant, then the variables are said to be linearly correlated. For example, For every 2% increase in income, the expenditure increases by 5%. Correlation is said to be non-linear if the ratio of change is not constant.</p><p>Sometimes, even though the data shows the correlation between the variables, such types of relationships are logically not feasible. For Example, if we consider the number of ice creams eaten and the number of times we fall down the staircase. There exists no relationship between the two! Such types of correlation are called Spurious or Nonsense correlation.</p><h3>Determination of Correlation by Graphical Method</h3><p>Scatter Plot</p><p>The Scatter Plot gives an idea of the relationship between the two variables. It uses dots to represent the values of variables under consideration. It represents the data points on a two-dimensional plane, with one variable on each axis.</p><p>When the paired observations are plotted for all units under consideration, the pattern obtained represents the extent of the relationship between the two variables.</p><ol><li><strong>Perfect Positive Correlation</strong>: When the data points are situated in a graph with an upward or positive slope, correlation is said to be Perfect Positive Correlation. All the data points lie in a straight line. Here the value of the correlation coefficient will be equal to 1.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*Ctm5DP7nVaGTKYiCB2NjOA.png" /><figcaption>Figure 1: Perfect Positive Correlation</figcaption></figure><p><strong>2. Perfect Negative Correlation</strong>: Here, the data points are situated in a graph with a negative slope. All the data points lie on a straight line. The value of correlation coefficient will be equal to -1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*RXN8Ep8wGT4zMeaDkatGDA.png" /><figcaption>Figure 2: Perfect Negative Correlation</figcaption></figure><p><strong>3. Positive Correlation</strong>: If the points are situated around the line with a positive slope, correlation is said to be Positive Correlation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*XwC0bS9SNWrogqXA_HRciA.png" /><figcaption>Figure 3: Positive Correlation</figcaption></figure><p><strong>4. Negative Correlation</strong>: If the points are situated around the line with a negative slope, the correlation is said to be Negative Correlation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*n2AYmCj7PXXCa1k6tvghgA.png" /><figcaption>Figure 4: Negative Correlation</figcaption></figure><p><strong>5. No Correlation: </strong>When the data points are scattered all over the graph, without a proper pattern, the variables are said to be uncorrelated. It is difficult to analyze whether the values are increasing or decreasing. There exists no correlation between the variables. Value of the correlation coefficient is equal to zero.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*PxPJ8Z5nMHYgHJqQvniylA.png" /><figcaption>Figure 5: No Correlation</figcaption></figure><h3>Correlation does not imply Causation</h3><p>Even though there exists a high degree of correlation between the variables, we cannot determine which is the cause and effect. Correlation only determines the extent of the relationship between the variables.</p><p>The Correlation can also be determined by calculating the correlation coefficient through Karl Pearson’s Coefficient of Correlation and Spearman’s Rank Correlation Coefficient. The correlation coefficient computed by any of the methods always lies between -1 and +1.</p><p>Acknowledgments: My teacher <a href="https://medium.com/u/7195c8527cb9">Dr. Sahana Prasad</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2982792b2f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>