<?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 Simone Alessia on Medium]]></title>
        <description><![CDATA[Stories by Simone Alessia on Medium]]></description>
        <link>https://medium.com/@simone.alessia91?source=rss-302dea3ec653------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*eoCEgTv-pOpjWxNP</url>
            <title>Stories by Simone Alessia on Medium</title>
            <link>https://medium.com/@simone.alessia91?source=rss-302dea3ec653------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 20:23:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@simone.alessia91/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[World Happiness Analysis (2015–2022)]]></title>
            <link>https://medium.com/@simone.alessia91/world-happiness-analysis-2015-2022-820fd2377cfe?source=rss-302dea3ec653------2</link>
            <guid isPermaLink="false">https://medium.com/p/820fd2377cfe</guid>
            <dc:creator><![CDATA[Simone Alessia]]></dc:creator>
            <pubDate>Fri, 25 Aug 2023 14:38:29 GMT</pubDate>
            <atom:updated>2023-08-25T14:38:29.857Z</atom:updated>
            <content:encoded><![CDATA[<p>The World Happiness Report is a publication from the Sustainable Development Solution Network, which measures the happiness score by considering responses from a subsample of the worldwide population.</p><p>The happiness score is mainly based on people&#39;s satisfaction with their lives; the main factor that contributes to the satisfaction are six:</p><ul><li>GDP (Gross Domestic Product): how much each country produce, divided by the number of people in the country;</li><li>Social Support: having someone to count on in case of trouble;</li><li>Healthy Life Expectancy: physical and mental health status;</li><li>Freedom to make life choices refers to human rights, including sex, ethnicity, nationality, language, and religion;</li><li>Generosity: measured in how much people donate to charity;</li><li>Perception of corruption: if people trust in the government and the benevolence of others.</li></ul><p>A helpful tool to predict the population&#39;s happiness from those characteristics can be implemented using a Machine Learning model. For this reason, I implemented a <strong>Linear Mixed Effect model </strong>to predict the happiness score of the continent for the year 2022.</p><p>But first, let’s have a look at the available data to have an overall idea of the preprocessing step through exploratory data analysis:</p><p>The original dataset contains 2199 observations of 11 variables: country name, year, life ladder, generosity, GDP, social support, life expectancy, freedom, corruption, and negative and positive effects.</p><p>As a first step, I extracted the continent from the country name to decrease the grouping variable into size 5: Africa, Asia, Europe, North America, Oceania, South America, and Antarctica.</p><p>Then, scaling the dataset allows us to avoid the different scales of measure problem and then the dataset has been split into train (1863 obs.) and test (104 obs.), taking the year 2022 as the test set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wizE5DoaIryywYiRym8Bug.jpeg" /><figcaption>Pairplot of Features</figcaption></figure><p>The plot above shows a general overview of the train set, coloured by different continents: at first view, Oceania seems to be the happiest continent, and the data appears to be clustered. In addition, the happiness score positively correlates to GDP, social support, life expectancy and positive effects.</p><p>I implemented a Linear Mixed Effect Model, which considers the grouping factor from the continent and the timing factor from years.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*wmzikwTiQ0jXTt5VGz1YIA.jpeg" /><figcaption>Residuals</figcaption></figure><p>One of the best ways to check for the model&#39;s goodness of fit is the visualization of the residuals: they should be heteroskedastic and normally distributed. From the figure above we can see that the residuals are not linearly correlated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*IqCpH0_P685SRB6WxGsXpw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*IqCpH0_P685SRB6WxGsXpw.jpeg" /></figure><p>From the two figures above, we can see that the residuals are normally distributed.</p><p>As a fit check, it’s possible to apply the trained model on the data related to 2022:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*wNVCWquHUovza0Bsf8bBbA.jpeg" /><figcaption>Actual vs Predicted on Test set</figcaption></figure><p>In an optimal model the points should follow a straight line, but, to have a clearer idea of a metric, it’s possible to compute the R² which goes from 0 to 1 (the higher the better) to check the accuracy of our model on the test set. In this case, the R² was 0.84, which is a very good result!</p><p>The dataset and related code is available at: <a href="https://github.com/alessiasimone/WorldWireHappinessReport.git">https://github.com/alessiasimone/WorldWireHappinessReport.git</a></p><p><strong>References</strong></p><ul><li><a href="https://en.wikipedia.org/wiki/World_Happiness_Report#:~:text=The%20rankings%20of%20national%20happiness,possible%20life%20being%20a%200.">Wikipedia</a></li><li><a href="https://worldhappiness.report/">World Happiness Report</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=820fd2377cfe" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>