<!DOCTYPE html>
<html lang='en'>
<head>
    <link rel="stylesheet" href="individual-project-style.css">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=1024, initial-scale=1.0">
    <title>DATS 6401 - Individual Project - Joseph Valle (Case Study)</title>
    <script src="https://www.gstatic.com/charts/loader.js"></script>
    <script>
        google.charts.load('current', {'packages': ['corechart','geochart']});
        google.charts.setOnLoadCallback(drawAllSheets);

        function drawAllSheets() {
            drawSheetName('case2', 'SELECT A,B,C', caseTest1ResponseHandler); // GDP
            drawSheetName('case4', 'SELECT A,B,C', caseTest2ResponseHandler); // GDP Change (Fixed)
            drawSheetName('case4', 'SELECT A,D,E', caseTest3ResponseHandler); // GDP Growth (Percentage)
            drawSheetName('case2', 'SELECT A,F,G', caseTest4ResponseHandler); // Military
            drawSheetName('case4', 'SELECT A,F,G', caseTest5ResponseHandler); // Military Change Absolute
            drawSheetName('case2', 'SELECT A,T,U', caseTest6ResponseHandler); // Military Share
            drawSheetName('case4', 'SELECT A,H,I', caseTest7ResponseHandler); // Military Change Relative
            drawSheetName('case2', 'SELECT A,H,I', caseTest8ResponseHandler); // Educational
            drawSheetName('case4', 'SELECT A,J,K', caseTest9ResponseHandler); // Educational Change Absolute
            drawSheetName('case2', 'SELECT A,V,W', caseTest10ResponseHandler); // Educational Share
            drawSheetName('case4', 'SELECT A,L,M', caseTest11ResponseHandler); // Educational Change Relative
            drawSheetName('case2', 'SELECT A,J,K', caseTest12ResponseHandler); // Healthcare
            drawSheetName('case4', 'SELECT A,N,O', caseTest13ResponseHandler); // Healthcare Change Absolute
            drawSheetName('case2', 'SELECT A,X,Y', caseTest14ResponseHandler); // Healthcare Share
            drawSheetName('case4', 'SELECT A,P,Q', caseTest15ResponseHandler); // Healthcare Change Relative
        }

        function drawSheetName(sheetName, query, responseHandler){
            var queryString = encodeURIComponent(query);
            var query = new google.visualization.Query(
                'https://docs.google.com/spreadsheets/d/1Ig9G4lXtKgSdBzU0NNRTALwu5cebPNdkeYjgxh98U2M/gviz/tq?sheet='
                + sheetName + '&headers=1&tq=' + queryString);
                query.send(responseHandler);
        } 
        // drawSheetName

        function checkError(response){
            if (response.isError()) {
                alert('Error in query: ' + response.getMessage() + ' ' + response.getDetailedMessage());
                return;
            } 
        }
        // checkError

        function caseTest1ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Total GDP in China and the United States (2013 to 2017)',
                vAxis: {title: 'Amount ($ Billions)'},
                hAxis: {title: 'Year'},
                colors: ['#cd2626','#3a5fcd'],
                legend: {position: 'bottom'}
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, prefix: '$', suffix: 'B'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.ColumnChart(document.getElementById('case_test1_div'));
            chart.draw(data, options);
        } 
        // caseTest1ResponseHandler

        function caseTest2ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Change in GDP in China and the United States (2013 - 2017)',
                vAxis: {title: 'Amount ($ Billions)'},
                hAxis: {title: 'Year Transition'},
                colors: ['#cd2626','#3a5fcd'],
                legend: {position: 'bottom'}
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, prefix: '$', suffix: 'B'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.ColumnChart(document.getElementById('case_test2_div'));
            chart.draw(data, options);
        } 
        // caseTest2ResponseHandler

        function caseTest3ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Rate of GDP Growth in China and the United States (2013 - 2017)',
                vAxis: {title: 'Rate of Growth (%)'},
                hAxis: {title: 'Year Transition'},
                colors: ['#cd2626','#3a5fcd'],
                lineWidth: 3
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, suffix: '%'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.AreaChart(document.getElementById('case_test3_div'));
            chart.draw(data, options);
        } 
        // caseTest3ResponseHandler

        function caseTest4ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Military Spending in China and the United States (2013 - 2017)',
                vAxis: {title: 'Spending ($ Billions)'},
                hAxis: {title: 'Year'},
                colors: ['#cd2626','#3a5fcd'],
                legend: {position: 'bottom'}
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, prefix: '$', suffix: 'B'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.ColumnChart(document.getElementById('case_test4_div'));
            chart.draw(data, options);
        } 
        // caseTest4ResponseHandler

        function caseTest5ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Change in Absolute Military Spending in China and the United States (2013 - 2017)',
                vAxis: {title: 'Spending ($ Billions)'},
                hAxis: {title: 'Year Transition'},
                colors: ['#cd2626','#3a5fcd'],
                legend: {position: 'bottom'}
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, prefix: '$', suffix: 'B'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.ColumnChart(document.getElementById('case_test5_div'));
            chart.draw(data, options);
        } 
        // caseTest5ResponseHandler

        function caseTest6ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Military Share of GDP in China and the United States (2013 - 2017)',
                vAxis: {title: 'Share of GDP (%)'},
                hAxis: {title: 'Year'},
                colors: ['#cd2626','#3a5fcd'],
                lineWidth: 3,
                legend: {position: 'bottom'}
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, suffix: '%'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.LineChart(document.getElementById('case_test6_div'));
            chart.draw(data, options);
        } 
        // caseTest6ResponseHandler

        function caseTest7ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Change in Relative Military Spending in China and the United States (2013 - 2017)',
                vAxis: {title: 'Amount (%)'},
                hAxis: {title: 'Year Transition'},
                colors: ['#cd2626','#3a5fcd'],
                lineWidth: 3,
                legend: {position: 'bottom'}
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, suffix: '%'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.AreaChart(document.getElementById('case_test7_div'));
            chart.draw(data, options);
        } 
        // caseTest7ResponseHandler

        function caseTest8ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Educational Spending in China and the United States (2013 - 2017)',
                vAxis: {title: 'Spending ($ Billions)'},
                hAxis: {title: 'Year'},
                colors: ['#cd2626','#3a5fcd'],
                legend: {position: 'bottom'}
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, prefix: '$', suffix: 'B'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.ColumnChart(document.getElementById('case_test8_div'));
            chart.draw(data, options);
        } 
        // caseTest8ResponseHandler

        function caseTest9ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Change in Absolute Educational Spending in China and the United States (2013 - 2017)',
                vAxis: {title: 'Spending ($ Billions)'},
                hAxis: {title: 'Year Transition'},
                colors: ['#cd2626','#3a5fcd'],
                legend: {position: 'bottom'}
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, prefix: '$', suffix: 'B'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.ColumnChart(document.getElementById('case_test9_div'));
            chart.draw(data, options);
        } 
        // caseTest9ResponseHandler

        function caseTest10ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Educational Share of GDP in China and the United States (2013 - 2017)',
                vAxis: {title: 'Share of GDP (%)'},
                hAxis: {title: 'Year'},
                colors: ['#cd2626','#3a5fcd'],
                lineWidth: 3,
                legend: {position: 'bottom'}
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, suffix: '%'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.LineChart(document.getElementById('case_test10_div'));
            chart.draw(data, options);
        } 
        // caseTest10ResponseHandler

        function caseTest11ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Change in Relative Educational Spending in China and the United States (2013 - 2017)',
                vAxis: {title: 'Amount (%)'},
                hAxis: {title: 'Year Transition'},
                colors: ['#cd2626','#3a5fcd'],
                lineWidth: 3,
                legend: {position: 'bottom'}
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, suffix: '%'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.AreaChart(document.getElementById('case_test11_div'));
            chart.draw(data, options);
        } 
        // caseTest11ResponseHandler

        function caseTest12ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Healthcare Spending in China and the United States (2013 - 2017)',
                vAxis: {title: 'Spending ($ Billions)'},
                hAxis: {title: 'Year'},
                colors: ['#cd2626','#3a5fcd'],
                legend: {position: 'bottom'}
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, prefix: '$', suffix: 'B'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.ColumnChart(document.getElementById('case_test12_div'));
            chart.draw(data, options);
        } 
        // caseTest12ResponseHandler

        function caseTest13ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Change in Absolute Healthcare Spending in China and the United States (2013 - 2017)',
                vAxis: {title: 'Spending ($ Billions)'},
                hAxis: {title: 'Year Transition'},
                colors: ['#cd2626','#3a5fcd'],
                legend: {position: 'bottom'}
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, prefix: '$', suffix: 'B'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.ColumnChart(document.getElementById('case_test13_div'));
            chart.draw(data, options);
        } 
        // caseTest13ResponseHandler

        function caseTest14ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Healthcare Share of GDP in China and the United States (2013 - 2017)',
                vAxis: {title: 'Share of GDP (%)'},
                hAxis: {title: 'Year'},
                colors: ['#cd2626','#3a5fcd'],
                lineWidth: 3,
                legend: {position: 'bottom'}
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, suffix: '%'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.LineChart(document.getElementById('case_test14_div'));
            chart.draw(data, options);
        } 
        // caseTest14ResponseHandler

        function caseTest15ResponseHandler(response){
            checkError(response);
            var data = response.getDataTable();
            var options = {
                title: 'Change in Relative Healthcare Spending in China and the United States (2013 - 2017)',
                vAxis: {title: 'Amount (%)'},
                hAxis: {title: 'Year Transition'},
                colors: ['#cd2626','#3a5fcd'],
                lineWidth: 3,
                legend: {position: 'bottom'}
            };
            var formatter = new google.visualization.NumberFormat({
                fractionDigits: 2, suffix: '%'});
            formatter.format(data,1);
            formatter.format(data,2);
            var chart = new google.visualization.AreaChart(document.getElementById('case_test15_div'));
            chart.draw(data, options);
        } 
        // caseTest15ResponseHandler

        </script>
</head>

<body>
    <div id="main">
        <div id="header">
            <div id="logo">
                <div id="logo_text">
                    <h1><a href="g20_home.html"></a>The G20: A Military, Educational, and Healthcare Perspective</h1>
                    <h3></h3>
                    <h3>DATS 6401 | Joseph Valle</h3>
                </div>
            </div>
        </div>

        <div id="menubar">
            <ul id="menu">
                <li><a href="g20_home.html">Home</a></li>
                <li><a href="g20_military.html">Military</a></li>
                <li><a href="g20_education.html">Education</a></li>
                <li><a href="g20_healthcare.html">Healthcare</a></li>
                <li class="selected"><a href="g20_case_study.html">Case Study</a></li>
                <li><a href="g20_conclusions.html">Conclusions</a></li>
                <li><a href="g20_references.html">References</a></li>
            </ul>
        </div>

        <div id="content">
            <h1>Case Study: Comparing China and the United States</h1>
            <p>
                At this point of our visual presentation, we now turn to a special case study focusing on the two biggest spenders for each of the aforementioned categories - China and the US.
                Considering how these two countries possessed the largest economies in the world over our timespan, it should not come as a surprise that they likewise spent the most.
                However, we can examine them even further by isolating their figures from the other countries included in our data.
                In doing so, we can elucidate any intriguing intra-year trends with respect to their spending habits and economic compositions.
                From there, we will be able to make several instrumental predictions on what their future budgets may entail, while taking into account the latest national developments reported by the news media within both countries.
            </p>
            <h2>A Side-By-Side Examination of the Two Countries</h2>
            <p>
                To start, let us pivot back to GDP.  Recall that China and the US reported greater GDPs than the other countries for each year, as well as higher rates of economic growth over our time span.  But just how much did they grow in between years?
            </p>
            <table class="columns">
                <tr>
                    <td><div id="case_test1_div" style="width: 440px; height:500px;"></div></td>
                    <td><div id="case_test2_div" style="width: 440px; height:500px;"></div></td>
                </tr>
            </table>
            <div id="case_test3_div" style="width: 880px; height:500px;"></div>
            <p>
                Clearly, the US continues to exhibit a larger economy overall than China.
                But we should also note that China's economy between 2013 and 2014, as well from 2016 to 2017, actually expanded more than the US's in absolute figures.
                This observation becomes even notable when we analyze the rates at which both countries' GDPs are growing over time.
                In fact, as we can see from our area chart, China out-paced the US in terms of GDP growth in three of the four year transitions.
                This indicates that the gap between the size of both countries' economies is shrinking as time passes.
                However, does this relationship extend to when we study their trends in military spending? 
            </p>
            <table class="columns">
                <tr>
                    <td><div id="case_test4_div" style="width: 440px; height:500px;"></div></td>
                    <td><div id="case_test5_div" style="width: 440px; height:500px;"></div></td>
                </tr>
            </table>
            <table class="columns">
                <tr>
                    <td><div id="case_test6_div" style="width: 440px; height:500px;"></div></td>
                    <td><div id="case_test7_div" style="width: 440px; height:500px;"></div></td>
                </tr>
            </table>
            <br>
            <p>
                When comparing the two with respect to military spending, the four charts shown above imply an even greater shrinking of the gap with respect to that variable.
                Unlike the other countries we studied earlier, China was the only one to never lower its military spending between years, as can be noted by the charts on the right.
                This explains why its rate of spending substantially exceeded the rest in that category.
                Looking at it from another perspective, while the US spent more on its military in absolute terms than China, its military share of GDP declined from 4.05% to 3.31% over time, while China's stayed consistently at just less than 2% each year.
                However, the former's relative military spending did turn positive between 2015 and 2016, albeit by less than 1%.
                Note that in that same year transition, China's relative spending slowed to almost the same rate as the US's.
            </p>
            <table class="columns">
                <tr>
                    <td><div id="case_test8_div" style="width: 440px; height:500px;"></div></td>
                    <td><div id="case_test9_div" style="width: 440px; height:500px;"></div></td>
                </tr>
            </table>
            <table class="columns">
                <tr>
                    <td><div id="case_test10_div" style="width: 440px; height:500px;"></div></td>
                    <td><div id="case_test11_div" style="width: 440px; height:500px;"></div></td>
                </tr>
            </table>
            <br>
            <p>
                If we turn our case study toward an educational angle, one observation we can pick up right away is that spending in that sector never dropped between years within both countries, in contrast to military spending.
                On that note though they have seen declines in their shares of GDP toward education.
                Yet again, China allocated a proportionately greater amount of funds toward education than the US for most of the year transitions.
                The time encompassing 2015 and 2016 is an intriguing outlier, as the US absolutely grew its educational spending at almost ten times the amount as China then.
                Similarly as with our inquiry on military spending, China's relative spending toward education exceeded the US's for a larger portion of time.
            </p>
            <table class="columns">
                <tr>
                    <td><div id="case_test12_div" style="width: 440px; height:500px;"></div></td>
                    <td><div id="case_test13_div" style="width: 440px; height:500px;"></div></td>
                </tr>
            </table>
            <table class="columns">
                <tr>
                    <td><div id="case_test14_div" style="width: 440px; height:500px;"></div></td>
                    <td><div id="case_test15_div" style="width: 440px; height:500px;"></div></td>
                </tr>
            </table>
            <br>
            <p>
                Compared to the other variables, the US's absolute figures in healthcare spending dwarfed China's at an even greater scale.
                Recall as well that China on average reported the smallest share of GDP toward healthcare of all the countries on our list, further underlining this gap.
                In fact, for each year it spent more than five times as much as China in that sector, especially in 2013.
                While the gap between the two is significantly larger under this category, when we look at the changes in healthcare spending between years, the gap is somewhat smaller from 2016 to 2017.
                Additionally, China's relative spending toward healthcare rose by more than 13% from 2016 to 2017, after declining in the previous years of our time span.
                The US's relative spending likewise dropped somewhat from 2014 to 2017.
                Regarding the latter, given its relatively high shares of GDP toward healthcare compared to China, at more than 16%, this observation further demonstrates how military spending there was prone to greater fluctuations between years.
            </p>
            <h2>Predictions</h2>
            <p>
                Based on the charts we have described here, we can make several forecasts on future spending trends within both countries.
                We should first consider how China over our timespan gradually closed the gap between it and the US with respect to military spending.
                Therefore, it's possible that the latter may augment its spending to a greater level in subsequent years to maintain that gap, owing to the impact of the trade war between both nations and the erosion of their relationship amid the spread of COVID-19.
                However, the size of the US's military budget will also depend on how much its foreign policy approach evolves as a result of the 2020 presidential election.
                Given these observations, it's unlikely that China will slow down its relative military spending any time soon.
                If the rate at which it spends increases to a scale that is large enough, its share of GDP toward defense may ultimately break 2% within the next ten years.
            </p>
            <p>
                On the question of education, there is less likely to be a major closing of the gap, given how the two nations were somewhat closer to each other with respect to their changes in absolute spending between years, and their relatively declining educational shares of GDP.
                Although globalization may play a role behind any spending rises within this sector, we should also account for COVID-19. 
                Much of the economic ramifications from the virus that have drawn attention as of late revolve around education, particularly the transition from in-person to online learning.
                As there continues to be debates, especially in the US, on whether or not to open schools, the administration of online education will probably assume a greater portion of both China and the US's annual budgets.
                School districts with significant outbreaks or historically weaker academic performance may also draw further consideration.
            </p>
            <p>
                Not surprisingly, COVID-19 could also spur both nations to raise their relative healthcare spending, as this will become more critical for individuals who contract the virus.
                Besides the virus itself though, the effects of economic decline at home and abroad will continue to present other kinds of health problems.
                Such issues may include depression, anxiety, and stress, all of which have exacerbated since the virus's emergence.
                Thus, greater healthcare spending in the US and China will likely focus on expanding the resources necessary toward addressing the virus itself, including vaccination procedures, and helping patients with the aforementioned mental problems.
                As a consequence, while the US will likely maintain the top spot among the countries we have studied in terms of its mean share of GDP toward healthcare, China's share for that sector could continue rising somewhat steadily.
            </p>
        </div>
         
        <div id="footer">
            &copy; <script>var d = new Date(); document.write(d.getFullYear());</script> | Joseph Valle
        </div>
    </div>
</body>

</html>