<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Climate change | Reprex</title><link>https://reprex-next.netlify.app/tag/climate-change/</link><atom:link href="https://reprex-next.netlify.app/tag/climate-change/index.xml" rel="self" type="application/rss+xml"/><description>Climate change</description><generator>Wowchemy (https://wowchemy.com)</generator><language>en-us</language><lastBuildDate>Wed, 07 Jul 2021 00:00:00 +0000</lastBuildDate><image><url>https://reprex-next.netlify.app/media/icon_hub9491570ac57158c0eeecc95c95b13e5_20247_512x512_fill_lanczos_center_3.png</url><title>Climate change</title><link>https://reprex-next.netlify.app/tag/climate-change/</link></image><item><title>Green Deal Data Observatory</title><link>https://reprex-next.netlify.app/observatories/greendeal/</link><pubDate>Wed, 07 Jul 2021 00:00:00 +0000</pubDate><guid>https://reprex-next.netlify.app/observatories/greendeal/</guid><description>&lt;p>&lt;strong>Finding reliable historic and new data and information about climate change, as well as the impact of various European Green Deal policies that try to mitigate it is surprisingly hard to find if you are a scientific researcher. And it is even more hopeless if you work as a (data) journalist, a policy researcher in an NGO, or in the sustainability unit of a company that does not provide you with an army of (geo)statisticians, data engineers, and data scientists who can render various data into usable format, i.e.something that you can trust, quote, visualize, import, or copy &amp;amp; paste.&lt;/strong>&lt;/p>
&lt;p>
&lt;i class="fas fa-globe pr-1 fa-fw">&lt;/i> &lt;a href="https://greendeal.dataobservatory.eu/" target="_blank" rel="noopener">Visit the Green Deal Data Observatory&lt;/a>&lt;/p>
&lt;p>
&lt;i class="fas fa-database pr-1 fa-fw">&lt;/i> &lt;a href="https://api.greendeal.dataobservatory.eu/" target="_blank" rel="noopener">Try the Green Deal Data Observatory API&lt;/a>&lt;/p>
&lt;p>
&lt;i class="fab fa-linkedin pr-1 fa-fw">&lt;/i> &lt;a href="https://www.linkedin.com/company/78562153/" target="_blank" rel="noopener">Connect on LinkedIn&lt;/a>&lt;/p>
&lt;h2 id="better-bigger-faster-more">Better, Bigger, Faster, More&lt;/h2>
&lt;table>
&lt;colgroup>
&lt;col style="width: 25%" />
&lt;col style="width: 75%" />
&lt;/colgroup>
&lt;tbody>
&lt;tr class="odd">
&lt;td style="text-align: center;">
&lt;figure id="figure-novel-data-products">
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="**Novel data products**
" srcset="
/media/img/blogposts_2021/global_problem_1_climate_change_5_plots_hue8b7ea28ffb9d0df039569ac96f076be_37305_4a8b0d559d16fda0b316f86641bb328a.webp 400w,
/media/img/blogposts_2021/global_problem_1_climate_change_5_plots_hue8b7ea28ffb9d0df039569ac96f076be_37305_86610edc39505a8c207c1542e1f57369.webp 760w,
/media/img/blogposts_2021/global_problem_1_climate_change_5_plots_hue8b7ea28ffb9d0df039569ac96f076be_37305_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://reprex-next.netlify.app/media/img/blogposts_2021/global_problem_1_climate_change_5_plots_hue8b7ea28ffb9d0df039569ac96f076be_37305_4a8b0d559d16fda0b316f86641bb328a.webp"
width="760"
height="604"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;figcaption>
&lt;strong>Novel data products&lt;/strong>&lt;br>
&lt;/figcaption>&lt;/figure>&lt;/td>
&lt;td style="text-align: left;">Official statistics at the national and European levels follow legal regulations, and in the EU, compromises between member states. New policy indicators often appear 5-10 years after demand appears. We employ the same methodology, software, and often even the same data that Eurostat might use to develop policy indicators, but we do not have to wait for a political and legal consensus to create new datasets. See our &lt;a href="https://greendeal.dataobservatory.eu/post/2021-11-19_global_problem/" target = "_blank">100,000 Opinions on the Most Pressing Global Problem&lt;/a> blogpost.&lt;/td>
&lt;/tr>
&lt;tr class="odd">
&lt;td style="text-align: center;">
&lt;figure id="figure-better-data">
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="**Better data**
" srcset="
/media/img/blogposts_2021/noaa-WWVD4wXRX38-unsplash-edited_huc1de598e48bcf2ca9302064c36ee3048_2297404_13a19cc7308f7f90fb71ae2c524e8fe6.webp 400w,
/media/img/blogposts_2021/noaa-WWVD4wXRX38-unsplash-edited_huc1de598e48bcf2ca9302064c36ee3048_2297404_4c70859ff3bfdb7160714dc07c4d5305.webp 760w,
/media/img/blogposts_2021/noaa-WWVD4wXRX38-unsplash-edited_huc1de598e48bcf2ca9302064c36ee3048_2297404_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://reprex-next.netlify.app/media/img/blogposts_2021/noaa-WWVD4wXRX38-unsplash-edited_huc1de598e48bcf2ca9302064c36ee3048_2297404_13a19cc7308f7f90fb71ae2c524e8fe6.webp"
width="760"
height="504"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;figcaption>
&lt;strong>Better data&lt;/strong>&lt;br>
&lt;/figcaption>&lt;/figure>&lt;/td>
&lt;td style="text-align: left;">Statistical agencies, old fashioned observatories, and data providers often do not have the mandate, know-how or resources to improve data quality. Using peer-reviewed statistical software and hundreds of computational tests, we are able to correct mistakes, impute missing data, generate forecasts, and increase the information content of public data by 20-200% percent. This makes the data usable for NGOs, journalists, and visual artists—among other potential users—who do not have this statistical know-how to make incomplete, mislabelled or low quality data usable for their needs and applications. See our example with the &lt;a href="https://greendeal.dataobservatory.eu/post/2021-11-08-indicator_value_added/" target = "_blank">Government Budget Allocations for R&amp;D in Environment&lt;/a> indicator.&lt;/td>
&lt;/tr>
&lt;tr class="odd">
&lt;td style="text-align: center;">
&lt;figure id="figure-never-seen-data">
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="**Never seen data**
" srcset="
/media/img/blogposts_2021/Gold_panning_at_Bonanza_Creek_4x6_hu1fffe85b839dc3ac2173c909d5b6c103_4409960_f1c3b5c6b5121a140154b90796b17e00.webp 400w,
/media/img/blogposts_2021/Gold_panning_at_Bonanza_Creek_4x6_hu1fffe85b839dc3ac2173c909d5b6c103_4409960_f431f3d05dc891d23af124d457433a12.webp 760w,
/media/img/blogposts_2021/Gold_panning_at_Bonanza_Creek_4x6_hu1fffe85b839dc3ac2173c909d5b6c103_4409960_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://reprex-next.netlify.app/media/img/blogposts_2021/Gold_panning_at_Bonanza_Creek_4x6_hu1fffe85b839dc3ac2173c909d5b6c103_4409960_f1c3b5c6b5121a140154b90796b17e00.webp"
width="760"
height="507"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;figcaption>
&lt;strong>Never seen data&lt;/strong>&lt;br>
&lt;/figcaption>&lt;/figure>&lt;/td>
&lt;td style="text-align: left;">The &lt;a href="https://eur-lex.europa.eu/eli/dir/2019/1024/oj" target = "_blank">2019/1024 directive&lt;/a> on &lt;i>open data and the re-use of public sector information&lt;/i> of the European Union (which is an extension and modernization of the earlier directives on &lt;i>re-use of public sector information&lt;/i> since 2003) makes data gathered in EU institutions, national institutions, and municipalities, as well as state-owned companies legally available. According to the &lt;a href="https://data.europa.eu/sites/default/files/edp_creating_value_through_open_data_0.pdf" target = "_blank">European Data Portal&lt;/a> the estimated historical cost of the data released annually is in the billions of euros. But if this data is a gold mine, its full potential can only be unlocked by an experienced data mining partner like Reprex. Here is why: data is not readily downloadable; it sits in various obsolete file formats in disorganized databases; it is documented in various languages, or not documented at all; it is plagued with various processing errors. We make the powerful promise of &lt;a href="http://dataobservatory.eu/post/2021-06-18-gold-without-rush/" target = "_blank">open data&lt;/a> of the EU legislation a reality in the field of the Green Deal policy context.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h2 id="increase-your-impact-avoid-old-mistakes">Increase Your Impact, Avoid Old Mistakes&lt;/h2>
&lt;p>Reprex helps its policy, business, and scientific partners by providing efficient solutions for necessary data engineering, data processing and statistical tasks that are as complex as they are tedious to perform. We deploy validated, open-source, peer-reviewed scientific software to create up-to-date, reliable, high-quality, and immediately usable data and visualizations. Our partners can leave the burden of this task, share the cost of data processing, and concentrate on what they do best: disseminating and advocating, researching, or setting sustainable business or underwriting indicators and creating early warning systems.&lt;/p>
&lt;table>
&lt;colgroup>
&lt;col style="width: 25%" />
&lt;col style="width: 75%" />
&lt;/colgroup>
&lt;tbody>
&lt;tr class="odd">
&lt;td style="text-align: center;">
&lt;figure id="figure-impact">
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="**Impact**
" srcset="
/media/img/blogposts_2021/zenodo_global_problem_1_climate_change_hue354f3e335afa1ff2ba12be29468b1eb_192906_c4fd9970fb360a4af2d95b796884b5e4.webp 400w,
/media/img/blogposts_2021/zenodo_global_problem_1_climate_change_hue354f3e335afa1ff2ba12be29468b1eb_192906_bf451eca4044a8c426a90607de0d57d0.webp 760w,
/media/img/blogposts_2021/zenodo_global_problem_1_climate_change_hue354f3e335afa1ff2ba12be29468b1eb_192906_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://reprex-next.netlify.app/media/img/blogposts_2021/zenodo_global_problem_1_climate_change_hue354f3e335afa1ff2ba12be29468b1eb_192906_c4fd9970fb360a4af2d95b796884b5e4.webp"
width="760"
height="507"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;figcaption>
&lt;strong>Impact&lt;/strong>&lt;br>
&lt;/figcaption>&lt;/figure>&lt;/td>
&lt;td style="text-align: left;">We publish the data in a way that it is easy to find—as a separate data publication with a DOI, full library metadata, and place it in open science repositories. Our data is more findable than 99% of the open science data, and therefore makes far bigger impact. See our data on the European open science repository &lt;a href="https://zenodo.org/record/5658849#.YbM_K73MLIU/" target = "_blank">Zenodo&lt;/a> managed by CERN (the European Organization for Nuclear Research).&lt;/td>
&lt;/tr>
&lt;tr class="odd">
&lt;td style="text-align: center;">
&lt;figure id="figure-easy-to-use-data">
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="**Easy-to-use data**
" srcset="
/media/img/blogposts_2021/Sisyphus_Bodleian_Library_hu99f0c1d6c82963b9538437670b4d339d_1662894_cd48a6c374c9ff68a08abe79a6abf2f4.webp 400w,
/media/img/blogposts_2021/Sisyphus_Bodleian_Library_hu99f0c1d6c82963b9538437670b4d339d_1662894_a6eb1b13ff33a5c73aba34550964ff52.webp 760w,
/media/img/blogposts_2021/Sisyphus_Bodleian_Library_hu99f0c1d6c82963b9538437670b4d339d_1662894_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://reprex-next.netlify.app/media/img/blogposts_2021/Sisyphus_Bodleian_Library_hu99f0c1d6c82963b9538437670b4d339d_1662894_cd48a6c374c9ff68a08abe79a6abf2f4.webp"
width="760"
height="507"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;figcaption>
&lt;strong>Easy-to-use data&lt;/strong>&lt;br>
&lt;/figcaption>&lt;/figure>&lt;/td>
&lt;td style="text-align: left;">Our data follows the &lt;i>tidy data principle&lt;/i> and comes with all the &lt;a href="https://greendeal.dataobservatory.eu/post/2021-07-08-data-sisyphus/" target = "_blank">recommended Dublin Core and DataCite metadata&lt;/a>. This increases our data compatibility, allowing users to open it in any spreadsheet application or import into their databases. We publish the data in tabular form, and in JSON form through our API enabling automatic retrieval for heavy users, especially if they plan to automatically use our data in daily or weekly updates. Using the best practice of data formatting and documentation with metadata ensures reproducibility and data integrity, rather than repeating data processing and preparation steps (e.g. changing data formats, removing unwanted characters, creating documentation, and other data processing steps that take up thousands of working hours. See our blogpost on the &lt;a href="https://greendeal.dataobservatory.eu/post/2021-07-08-data-sisyphus/" target = "_blank">data Sisyphus&lt;/a>.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h2 id="ethical-big-data-for-all">Ethical Big Data for All&lt;/h2>
&lt;p>Big data creates inequalities, because only the largest corporations, government bureaucracies and best endowed universities can afford large data collection programs, the use of satellites, and the employment of many data scientists. Our open collaboration method of data pooling and cost sharing makes big data available for all.&lt;/p>
&lt;table>
&lt;colgroup>
&lt;col style="width: 25%" />
&lt;col style="width: 75%" />
&lt;/colgroup>
&lt;tbody>
&lt;tr class="odd">
&lt;td style="text-align: center;">
&lt;figure id="figure-big-picture">
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="**Big picture**
" srcset="
/media/img/blogposts_2021/belgium_problem_maps_hu2612e958a057de0213287675ef860060_675999_b50c45a69207375a4b9fd866b7c391ec.webp 400w,
/media/img/blogposts_2021/belgium_problem_maps_hu2612e958a057de0213287675ef860060_675999_240786d02027e6506bb992d486c9f7a8.webp 760w,
/media/img/blogposts_2021/belgium_problem_maps_hu2612e958a057de0213287675ef860060_675999_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://reprex-next.netlify.app/media/img/blogposts_2021/belgium_problem_maps_hu2612e958a057de0213287675ef860060_675999_b50c45a69207375a4b9fd866b7c391ec.webp"
width="760"
height="507"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;figcaption>
&lt;strong>Big picture&lt;/strong>&lt;br>
&lt;/figcaption>&lt;/figure>&lt;/td>
&lt;td style="text-align: left;">Integrating and joining data is hard—it requires engineering, mathematical, and geo-statistical know-how that a large amount of environmental users and stakeholders do not possess. Some examples of the challenges implicit in making data usable include addressing the changing boundaries of French departments (and European administrative-geographic borders, in general), various projections of coordinates on satellite images of land cover, different measurement areas for public opinion and hydrological data, public finance expressed in different orders (e.g. millions versus thousands of euros). We create data that is easy to combine, map, and visualize for end users. See our case study on the severity and awareness of &lt;a href="https://greendeal.dataobservatory.eu/post/2021-04-23-belgium-flood-insurance/" target = "_blank">flood risk in Belgium&lt;/a>, as well as the financial capacity to manage it.&lt;/td>
&lt;/tr>
&lt;tr class="odd">
&lt;td style="text-align: center;">
&lt;figure id="figure-ethical-trustworthy-ai">
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="**Ethical, Trustworthy AI**
" srcset="
/media/img/blogposts_2021/firing_squad_hu1eea09d77eaaec34cb7ac7fa78623292_209835_dd1bf9ba3b725bf3b2092df0274696b3.webp 400w,
/media/img/blogposts_2021/firing_squad_hu1eea09d77eaaec34cb7ac7fa78623292_209835_d060cb7c2700ba27a8efd3b493b38527.webp 760w,
/media/img/blogposts_2021/firing_squad_hu1eea09d77eaaec34cb7ac7fa78623292_209835_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://reprex-next.netlify.app/media/img/blogposts_2021/firing_squad_hu1eea09d77eaaec34cb7ac7fa78623292_209835_dd1bf9ba3b725bf3b2092df0274696b3.webp"
width="400"
height="267"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;figcaption>
&lt;strong>Ethical, Trustworthy AI&lt;/strong>&lt;br>
&lt;/figcaption>&lt;/figure>&lt;/td>
&lt;td style="text-align: left;">AI in 2021 increases data inequalities because large government and corporate entities with an army of data engineers can create proprietary, black box business algorithms that fundamentally alter our lives. We are involved in the R&amp;D and advocacy of the EU’s trustworthy AI agenda which aims at similar protections like GDPR in privacy. We want to demystify AI by making it available for organizations who cannot finance a data engineering team, because 95% of a successful AI is cheap, complete, reliable data tested for negative outcomes – precisely what d&lt;a href="https://dataandlyrics.com/post/2021-05-16-recommendation-outcomes/" target = "_blank">we offer&lt;/a> to our users.&lt;/td>
&lt;/tr>
&lt;/tbody>
&lt;/table>
&lt;h2 id="open-collaboration">Open Collaboration&lt;/h2>
&lt;p>&lt;a href="https://reprex.nl/" target="_blank" rel="noopener">Reprex&lt;/a> grew out of an international data cooperation and works in the open-source world. We use the agile open collaboration method that allows us to work with large corporations, NGOs, developers, university researcher institutes and individuals on an equal footing.&lt;/p>
&lt;p>Find us on &lt;a href="https://www.linkedin.com/company/78562153/" target="_blank" rel="noopener">LinkedIn&lt;/a> or send us an &lt;a href="https://reprex.nl/#contact" target="_blank" rel="noopener">email&lt;/a>.&lt;/p></description></item><item><title>Where Are People More Likely To Treat Climate Change as the Most Serious Global Problem?</title><link>https://reprex-next.netlify.app/post/2021-03-06-individual-join/</link><pubDate>Sat, 06 Mar 2021 00:00:00 +0000</pubDate><guid>https://reprex-next.netlify.app/post/2021-03-06-individual-join/</guid><description>&lt;pre>&lt;code>library(regions)
library(lubridate)
library(dplyr)
if ( dir.exists('data-raw') ) {
data_raw_dir &amp;lt;- &amp;quot;data-raw&amp;quot;
} else {
data_raw_dir &amp;lt;- file.path(&amp;quot;..&amp;quot;, &amp;quot;..&amp;quot;, &amp;quot;data-raw&amp;quot;)
}
&lt;/code>&lt;/pre>
&lt;p>The first results of our longitudinal table &lt;a href="post/2021-03-05-retroharmonize-climate/">were difficult to
map&lt;/a>, because the surveys used
an obsolete regional coding. We will adjust the wrong coding, when
possible, and join the data with the European Environment Agency’s (EEA)
Air Quality e-Reporting (AQ e-Reporting) data on environmental
pollution. We recoded the annual level for every available reporting
stations [&lt;em>not shown here&lt;/em>] and all values are in μg/m3. The period
under observation is 2014-2016. Data file:
&lt;a href="https://www.eea.europa.eu/data-and-maps/data/aqereporting-8" target="_blank" rel="noopener">https://www.eea.europa.eu/data-and-maps/data/aqereporting-8&lt;/a> (European
Environment Agency 2021).&lt;/p>
&lt;h2 id="recoding-the-regions">Recoding the Regions&lt;/h2>
&lt;p>Recoding means that the boundaries are unchanged, but the country
changed the names and codes of regions because there were other boundary
changes which did not affect our observation unit. We explain the
problem and the solution in greater detail in &lt;a href="http://netzero.dataobservatory.eu/post/2021-03-06-regions-climate/" target="_blank" rel="noopener">our
tutorial&lt;/a>
that aggregates the data on regional levels.&lt;/p>
&lt;pre>&lt;code>panel &amp;lt;- readRDS((file.path(data_raw_dir, &amp;quot;climate-panel.rds&amp;quot;)))
climate_data_geocode &amp;lt;- panel %&amp;gt;%
mutate ( year: lubridate::year(date_of_interview)) %&amp;gt;%
recode_nuts()
&lt;/code>&lt;/pre>
&lt;p>Let’s join the air pollution data and join it by corrected geocodes:&lt;/p>
&lt;pre>&lt;code>load(file.path(&amp;quot;data&amp;quot;, &amp;quot;air_pollutants.rda&amp;quot;)) ## good practice to use system-independent file.path
climate_awareness_air &amp;lt;- climate_data_geocode %&amp;gt;%
rename ( region_nuts_codes : .data$code_2016) %&amp;gt;%
left_join ( air_pollutants, by: &amp;quot;region_nuts_codes&amp;quot; ) %&amp;gt;%
select ( -all_of(c(&amp;quot;w1&amp;quot;, &amp;quot;wex&amp;quot;, &amp;quot;date_of_interview&amp;quot;,
&amp;quot;typology&amp;quot;, &amp;quot;typology_change&amp;quot;, &amp;quot;geo&amp;quot;, &amp;quot;region&amp;quot;))) %&amp;gt;%
mutate (
# remove special labels and create NA_numeric_
age_education: retroharmonize::as_numeric(age_education)) %&amp;gt;%
mutate_if ( is.character, as.factor) %&amp;gt;%
mutate (
# we only have responses from 4 years, and this should be treated as a categorical variable
year: as.factor(year)
) %&amp;gt;%
filter ( complete.cases(.) )
&lt;/code>&lt;/pre>
&lt;p>The &lt;code>climate_awareness_air&lt;/code> data frame contains the answers of 75086
individual respondents. 17.07% thought that climate change was the most
serious world problem and 33.6% mentioned climate change as one of the
three most important global problems.&lt;/p>
&lt;pre>&lt;code>summary ( climate_awareness_air )
## rowid serious_world_problems_first
## ZA5877_v2-0-0_1 : 1 Min. :0.0000
## ZA5877_v2-0-0_10 : 1 1st Qu.:0.0000
## ZA5877_v2-0-0_100 : 1 Median :0.0000
## ZA5877_v2-0-0_1000 : 1 Mean :0.1707
## ZA5877_v2-0-0_10000: 1 3rd Qu.:0.0000
## ZA5877_v2-0-0_10001: 1 Max. :1.0000
## (Other) :75080
## serious_world_problems_climate_change isocntry
## Min. :0.000 BE : 3028
## 1st Qu.:0.000 CZ : 3023
## Median :0.000 NL : 3019
## Mean :0.336 SK : 3000
## 3rd Qu.:1.000 SE : 2980
## Max. :1.000 DE-W : 2978
## (Other):57058
## marital_status age_education
## (Re-)Married: without children :13242 18 :15485
## (Re-)Married: children this marriage :12696 19 : 7728
## Single: without children : 7650 16 : 5840
## (Re-)Married: w children of this marriage: 6520 still studying: 5098
## (Re-)Married: living without children : 6225 17 : 5092
## Single: living without children : 4102 15 : 4528
## (Other) :24651 (Other) :31315
## age_exact occupation_of_respondent
## Min. :15.0 Retired, unable to work :22911
## 1st Qu.:36.0 Skilled manual worker : 6774
## Median :51.0 Employed position, at desk : 6716
## Mean :50.1 Employed position, service job: 5624
## 3rd Qu.:65.0 Middle management, etc. : 5252
## Max. :99.0 Student : 5098
## (Other) :22711
## occupation_of_respondent_recoded
## Employed (10-18 in d15a) :32763
## Not working (1-4 in d15a) :37125
## Self-employed (5-9 in d15a): 5198
##
##
##
##
## respondent_occupation_scale_c_14
## Retired (4 in d15a) :22911
## Manual workers (15 to 18 in d15a) :15269
## Other white collars (13 or 14 in d15a): 9203
## Managers (10 to 12 in d15a) : 8291
## Self-employed (5 to 9 in d15a) : 5198
## Students (2 in d15a) : 5098
## (Other) : 9116
## type_of_community is_student no_education
## DK : 34 Min. :0.0000 Min. :0.000000
## Large town :20939 1st Qu.:0.0000 1st Qu.:0.000000
## Rural area or village :24686 Median :0.0000 Median :0.000000
## Small or middle sized town: 9850 Mean :0.0679 Mean :0.008151
## Small/middle town :19577 3rd Qu.:0.0000 3rd Qu.:0.000000
## Max. :1.0000 Max. :1.000000
##
## education year region_nuts_codes country_code
## Min. :14.00 2013:25103 LU : 1432 DE : 4531
## 1st Qu.:17.00 2015: 0 MT : 1398 GB : 3538
## Median :18.00 2017:25053 CY : 1192 BE : 3028
## Mean :19.61 2019:24930 SK02 : 1053 CZ : 3023
## 3rd Qu.:22.00 EL30 : 974 NL : 3019
## Max. :30.00 EE : 973 SK : 3000
## (Other):68064 (Other):54947
## pm2_5 pm10 o3 BaP
## Min. : 2.109 Min. : 5.883 Min. : 66.37 Min. :0.0102
## 1st Qu.: 9.374 1st Qu.: 28.326 1st Qu.: 90.89 1st Qu.:0.1779
## Median :11.866 Median : 33.673 Median :102.81 Median :0.4105
## Mean :12.954 Mean : 38.637 Mean :101.49 Mean :0.8759
## 3rd Qu.:15.890 3rd Qu.: 49.488 3rd Qu.:110.73 3rd Qu.:1.0692
## Max. :41.293 Max. :123.239 Max. :141.04 Max. :7.8050
##
## so2 ap_pc1 ap_pc2 ap_pc3
## Min. : 0.0000 Min. :-4.6669 Min. :-2.21851 Min. :-2.1007
## 1st Qu.: 0.0000 1st Qu.:-0.4624 1st Qu.:-0.49130 1st Qu.:-0.5695
## Median : 0.0000 Median : 0.4263 Median : 0.02902 Median :-0.1113
## Mean : 0.1032 Mean : 0.1031 Mean : 0.04166 Mean :-0.1746
## 3rd Qu.: 0.0000 3rd Qu.: 0.9748 3rd Qu.: 0.57416 3rd Qu.: 0.3309
## Max. :42.5325 Max. : 2.0344 Max. : 3.25841 Max. : 4.1615
##
## ap_pc4 ap_pc5
## Min. :-1.7387 Min. :-2.75079
## 1st Qu.:-0.1669 1st Qu.:-0.18748
## Median : 0.0371 Median : 0.01811
## Mean : 0.1154 Mean : 0.06797
## 3rd Qu.: 0.3050 3rd Qu.: 0.34937
## Max. : 3.2476 Max. : 1.42816
##
&lt;/code>&lt;/pre>
&lt;p>Let’s see a simple CART tree! We remove the regional codes, because
there are very serious differences among regional climate awareness.
These differences, together with education level, and the year we are
talking about, are the most important predictors of thinking about
climate change as the most important global problem in Europe.&lt;/p>
&lt;pre>&lt;code># Classification Tree with rpart
library(rpart)
# grow tree
fit &amp;lt;- rpart(as.factor(serious_world_problems_first) ~ .,
method=&amp;quot;class&amp;quot;, data=climate_awareness_air %&amp;gt;%
select ( - all_of(c(&amp;quot;rowid&amp;quot;, &amp;quot;region_nuts_codes&amp;quot;))),
control: rpart.control(cp: 0.005))
printcp(fit) # display the results
##
## Classification tree:
## rpart(formula: as.factor(serious_world_problems_first) ~ .,
## data: climate_awareness_air %&amp;gt;% select(-all_of(c(&amp;quot;rowid&amp;quot;,
## &amp;quot;region_nuts_codes&amp;quot;))), method: &amp;quot;class&amp;quot;, control: rpart.control(cp: 0.005))
##
## Variables actually used in tree construction:
## [1] age_education isocntry
## [3] serious_world_problems_climate_change year
##
## Root node error: 12817/75086: 0.1707
##
## n= 75086
##
## CP nsplit rel error xerror xstd
## 1 0.0240566 0 1.00000 1.00000 0.0080438
## 2 0.0082703 3 0.92783 0.92783 0.0078055
## 3 0.0050000 5 0.91129 0.91425 0.0077588
plotcp(fit) # visualize cross-validation results
&lt;/code>&lt;/pre>
&lt;p>
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="&amp;amp;ldquo;Visualize cross-validation results&amp;amp;rdquo;" srcset="
/post/2021-03-06-individual-join/rpart-1_hu9f1f775a32eec3a67a573c0d2df50ef4_4271_8ce48ac0f7ba6b1d3752385b96368cc3.webp 400w,
/post/2021-03-06-individual-join/rpart-1_hu9f1f775a32eec3a67a573c0d2df50ef4_4271_b20e6dca7fcadd4576da216956498a35.webp 760w,
/post/2021-03-06-individual-join/rpart-1_hu9f1f775a32eec3a67a573c0d2df50ef4_4271_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://reprex-next.netlify.app/post/2021-03-06-individual-join/rpart-1_hu9f1f775a32eec3a67a573c0d2df50ef4_4271_8ce48ac0f7ba6b1d3752385b96368cc3.webp"
width="672"
height="480"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;pre>&lt;code>summary(fit) # detailed summary of splits
## Call:
## rpart(formula: as.factor(serious_world_problems_first) ~ .,
## data: climate_awareness_air %&amp;gt;% select(-all_of(c(&amp;quot;rowid&amp;quot;,
## &amp;quot;region_nuts_codes&amp;quot;))), method: &amp;quot;class&amp;quot;, control: rpart.control(cp: 0.005))
## n= 75086
##
## CP nsplit rel error xerror xstd
## 1 0.024056592 0 1.0000000 1.0000000 0.008043837
## 2 0.008270266 3 0.9278302 0.9278302 0.007805478
## 3 0.005000000 5 0.9112897 0.9142545 0.007758824
##
## Variable importance
## serious_world_problems_climate_change isocntry
## 31 26
## country_code BaP
## 20 8
## pm2_5 ap_pc1
## 4 3
## age_education pm10
## 2 2
## education ap_pc2
## 2 1
## year
## 1
##
## Node number 1: 75086 observations, complexity param=0.02405659
## predicted class=0 expected loss=0.1706976 P(node): 1
## class counts: 62269 12817
## probabilities: 0.829 0.171
## left son=2 (25229 obs) right son=3 (49857 obs)
## Primary splits:
## serious_world_problems_climate_change &amp;lt; 0.5 to the right, improve=2214.2040, (0 missing)
## isocntry splits as RRLLLRRRLLRLRLLLLLLLLLLRRLLLRLL, improve= 728.0160, (0 missing)
## country_code splits as RRLLLRRLLRLLLLLLLLLLRRLLLRLL, improve= 673.3656, (0 missing)
## BaP &amp;lt; 0.4300347 to the right, improve= 310.6229, (0 missing)
## pm2_5 &amp;lt; 13.38264 to the right, improve= 296.4013, (0 missing)
## Surrogate splits:
## age_education splits as ----RRRRRR-RRRRRRRRRR-RRRRRRRRRR-RRRRRRRRRR-RRRRRRRRRR-RRRRRL-RRR-RRRRRRRRR--RRRLLR--R-R, agree=0.664, adj=0, (0 split)
## pm10 &amp;lt; 7.491315 to the left, agree=0.664, adj=0, (0 split)
##
## Node number 2: 25229 observations
## predicted class=0 expected loss=0 P(node): 0.3360014
## class counts: 25229 0
## probabilities: 1.000 0.000
##
## Node number 3: 49857 observations, complexity param=0.02405659
## predicted class=0 expected loss=0.2570752 P(node): 0.6639986
## class counts: 37040 12817
## probabilities: 0.743 0.257
## left son=6 (34631 obs) right son=7 (15226 obs)
## Primary splits:
## isocntry splits as RRLLLRRRLLRLRLLLLLLLLLLRRLLLRLL, improve=1454.9460, (0 missing)
## country_code splits as RRLLLRRLLRLLLLLLLLLLRRLLLRLL, improve=1359.7210, (0 missing)
## BaP &amp;lt; 0.4300347 to the right, improve= 629.8844, (0 missing)
## pm2_5 &amp;lt; 13.38264 to the right, improve= 555.7484, (0 missing)
## ap_pc1 &amp;lt; -0.005459537 to the left, improve= 533.3579, (0 missing)
## Surrogate splits:
## country_code splits as RRLLLRRLLRLLLLLLLLLLRRLLLRLL, agree=0.987, adj=0.957, (0 split)
## BaP &amp;lt; 0.1749425 to the right, agree=0.775, adj=0.264, (0 split)
## pm2_5 &amp;lt; 5.206993 to the right, agree=0.737, adj=0.140, (0 split)
## ap_pc1 &amp;lt; 1.405527 to the left, agree=0.733, adj=0.126, (0 split)
## pm10 &amp;lt; 25.31211 to the right, agree=0.718, adj=0.076, (0 split)
##
## Node number 6: 34631 observations
## predicted class=0 expected loss=0.1769802 P(node): 0.4612178
## class counts: 28502 6129
## probabilities: 0.823 0.177
##
## Node number 7: 15226 observations, complexity param=0.02405659
## predicted class=0 expected loss=0.4392487 P(node): 0.2027808
## class counts: 8538 6688
## probabilities: 0.561 0.439
## left son=14 (11607 obs) right son=15 (3619 obs)
## Primary splits:
## isocntry splits as LL---LLR--L-L----------LL---R--, improve=337.5462, (0 missing)
## country_code splits as LL---LR--L-L--------LL---R--, improve=337.5462, (0 missing)
## age_education splits as ----LLLLLL-LLLRRRRRRR-RRRRRRRRRL-RRRRRRLLRR-RRRRLLRLRL-RRLRRR-RRR-LLLLRRR-----LR-----L-R, improve=294.0807, (0 missing)
## education &amp;lt; 22.5 to the left, improve=262.3747, (0 missing)
## BaP &amp;lt; 0.053328 to the right, improve=232.7043, (0 missing)
## Surrogate splits:
## BaP &amp;lt; 0.053328 to the right, agree=0.878, adj=0.485, (0 split)
## pm2_5 &amp;lt; 4.810361 to the right, agree=0.827, adj=0.271, (0 split)
## ap_pc2 &amp;lt; 0.8746175 to the left, agree=0.792, adj=0.124, (0 split)
## so2 &amp;lt; 0.3302972 to the left, agree=0.781, adj=0.078, (0 split)
## age_education splits as ----LLLLLL-LLLLLLLRLR-LRRLRRRRRR-RRRRLLLLLR-LRLRLLRRLL-LLRLLR-LLR-RRLLLLL-----RR-----R-L, agree=0.779, adj=0.071, (0 split)
##
## Node number 14: 11607 observations, complexity param=0.008270266
## predicted class=0 expected loss=0.3804601 P(node): 0.1545827
## class counts: 7191 4416
## probabilities: 0.620 0.380
## left son=28 (7462 obs) right son=29 (4145 obs)
## Primary splits:
## age_education splits as ----LLLLLL-LRRRRRRRRR-RRLRRLRRLL-RRRRLRLLRR-RLRLLLRLRL-RR-RR--RRL-L-LLRRR------------L-R, improve=123.71070, (0 missing)
## year splits as R-LR, improve=107.79460, (0 missing)
## education &amp;lt; 20.5 to the left, improve= 90.28724, (0 missing)
## occupation_of_respondent splits as LRRLRRRRRLRLLLRLLL, improve= 84.62865, (0 missing)
## respondent_occupation_scale_c_14 splits as LRLLLRRL, improve= 68.88653, (0 missing)
## Surrogate splits:
## education &amp;lt; 20.5 to the left, agree=0.950, adj=0.861, (0 split)
## occupation_of_respondent splits as LLLLRLLRRLRLLLRLLL, agree=0.738, adj=0.267, (0 split)
## respondent_occupation_scale_c_14 splits as LRLLLLRL, agree=0.733, adj=0.251, (0 split)
## is_student &amp;lt; 0.5 to the left, agree=0.709, adj=0.186, (0 split)
## age_exact &amp;lt; 23.5 to the right, agree=0.676, adj=0.094, (0 split)
##
## Node number 15: 3619 observations
## predicted class=1 expected loss=0.3722023 P(node): 0.04819807
## class counts: 1347 2272
## probabilities: 0.372 0.628
##
## Node number 28: 7462 observations
## predicted class=0 expected loss=0.326052 P(node): 0.09937938
## class counts: 5029 2433
## probabilities: 0.674 0.326
##
## Node number 29: 4145 observations, complexity param=0.008270266
## predicted class=0 expected loss=0.4784077 P(node): 0.05520337
## class counts: 2162 1983
## probabilities: 0.522 0.478
## left son=58 (2573 obs) right son=59 (1572 obs)
## Primary splits:
## year splits as L-LR, improve=40.13885, (0 missing)
## occupation_of_respondent splits as LRLLRRRRRLRLLLRLLL, improve=18.33254, (0 missing)
## marital_status splits as LRRRLRRRLRRLRLLRRRRRRLRLRLLRR, improve=17.86888, (0 missing)
## type_of_community splits as LRLRL, improve=17.55254, (0 missing)
## age_education splits as ------------LLRRRRRRR-RR-RL-RR---LRRR-R--LR-R-R---R-R--RR-RR--RR------RRR--------------R, improve=14.66121, (0 missing)
## Surrogate splits:
## type_of_community splits as LLLRL, agree=0.777, adj=0.412, (0 split)
## marital_status splits as RRLLLLLRLLLLLLLRRRLLLLLLRLRLL, agree=0.680, adj=0.155, (0 split)
## isocntry splits as LL---LL---L-R----------LL------, agree=0.669, adj=0.127, (0 split)
## country_code splits as LL---L---L-R--------LL------, agree=0.669, adj=0.127, (0 split)
## o3 &amp;lt; 83.06345 to the right, agree=0.650, adj=0.076, (0 split)
##
## Node number 58: 2573 observations
## predicted class=0 expected loss=0.4240187 P(node): 0.03426737
## class counts: 1482 1091
## probabilities: 0.576 0.424
##
## Node number 59: 1572 observations
## predicted class=1 expected loss=0.43257 P(node): 0.02093599
## class counts: 680 892
## probabilities: 0.433 0.567
# plot tree
plot(fit, uniform=TRUE,
main=&amp;quot;Classification Tree: Climate Change Is The Most Serious Threat&amp;quot;)
text(fit, use.n=TRUE, all=TRUE, cex=.8)
## Warning in labels.rpart(x, minlength: minlength): more than 52 levels in a
## predicting factor, truncated for printout
&lt;/code>&lt;/pre>
&lt;p>
&lt;figure >
&lt;div class="d-flex justify-content-center">
&lt;div class="w-100" >&lt;img alt="&amp;amp;ldquo;predicting factor, truncated for printout&amp;amp;rdquo;" srcset="
/post/2021-03-06-individual-join/rpart-2_hu8765078af843fd2a25e4b77d7cba4bfb_9882_0bdd94d7f6c1efcc2575c1adeb6917c8.webp 400w,
/post/2021-03-06-individual-join/rpart-2_hu8765078af843fd2a25e4b77d7cba4bfb_9882_daf3b553e16b54a4b23a242bc9ef1e6b.webp 760w,
/post/2021-03-06-individual-join/rpart-2_hu8765078af843fd2a25e4b77d7cba4bfb_9882_1200x1200_fit_q75_h2_lanczos_3.webp 1200w"
src="https://reprex-next.netlify.app/post/2021-03-06-individual-join/rpart-2_hu8765078af843fd2a25e4b77d7cba4bfb_9882_0bdd94d7f6c1efcc2575c1adeb6917c8.webp"
width="672"
height="480"
loading="lazy" data-zoomable />&lt;/div>
&lt;/div>&lt;/figure>
&lt;/p>
&lt;pre>&lt;code>saveRDS ( climate_awareness_air , file.path(tempdir(), &amp;quot;climate_panel_recoded.rds&amp;quot;), version: 2)
# not evaluated
saveRDS( climate_awareness_air, file: file.path(&amp;quot;data-raw&amp;quot;, &amp;quot;climate-panel_recoded.rds&amp;quot;))
&lt;/code>&lt;/pre></description></item></channel></rss>