Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please complete and upload all 4 files for a full rating. Thank you. Homework 7 Basic Introduction to Coding and R Script 10 Points This
Please complete and upload all 4 files for a full rating. Thank you.
Homework 7 Basic Introduction to Coding and R Script 10 Points This homework is due four (4) days after your registered lab section before 11:55pm. Please read and follow the directions. If you have any questions, contact your TA or attend office hours. This week you will be creating code within R Script. Follow all instructions carefully Start by opening Rstudio and then creating a new RScript. For the following assignment, write all your code within the editor/script window This editorscript window is the one you will turn in once finished with your Imagine you're in an economics class here at Davis, and you have been talking about the correlation between country GDP (Gross Domestic Product) and child lliteracy rates. You're interested in the topic so you start doing some of your own research and calculations. 1. You find that world GDP is 80 billion and US GDP is 19 billion. Create and assign the variables "WorldGDP" and "USGDP" to the values above. Now create an equation (using the variables you created) in which you find the proportion of US GDP in relation to the world's GDP- assign the outcome of this equation to the variable "USOutputPercentage 2. After doing this calculation, you realized you mistook trillions for billions and your variables are off. To fix this, reassign the two variables (on two new lines!), WorldGDP and USGDP to the correct values, 80 trillion and 19 trillion respectively. Notice that value of U change since the USGDP and WorldGDP are going up by equal on 3. You find that the five countries with the highest GDP are as follows (all in trillions): US -21 China 14 Japan -5 Germany -4 UK-2.9 a. Create a variable "Largest5" and assign it to the GDPs of the five countries above (using condensed values such as 19 instead of 19,000,000,000,000 is advised) b. You are interested in what the largest five economies would look like if they all grew by 5% next year. Create an equation that uses the "Largest5" variable to answer that question. In the code for this equation, add your name and lab time into a comment. In doing all your research, you find a dataset that has the GDP of multiple countries along with their GDPChildliteracyW19." Download this dataset. ding child illiteracy rates 1. Start by loading the dataset into R. 2. You're interested in the child illiteracy rates for each continent. Subset the data by Continent (North America, South America, Africa, Asia, Australia, and Europe) and then find the mean of the child illiteracy rate for each of the 6 continents 3. You want to leam more about Australia's illiteracy rates. Start by creating a boxplot of the child illiteracy rates in Australia (Hint: use the Australia subset you created in #2) 4. Create a histogram of child illiteracy rates in Australia, specifically the child lliteracy data. Label the x-axis "Child Illiteracy, the y-axis "Frequency", and the main title "Australia Child Illiteracy Rates Histogram" 5. Plot the Australia data with Child Illiteracy on the x-axis and GDP on the y-axis (use the function: plot). After you have your plotted data, run a linear regression on the data (use the function: Im) 6. Add the line of best fit to your plot (use the function: abline) What you need to submit for this assignment 1. The RScript file that contains all the code that you used to complete this assignment. Save as RScript_LASTNAME 2. The boxplot. Save as boxplot (PDF) 3. The histogram with labels and title. Save as histogram (PDF) 4. The Australia Child Illiteracy plot with the line of best fit. Save as Plot (PDF) Upload these 4 items to Canvas. Homework 7 Basic Introduction to Coding and R Script 10 Points This homework is due four (4) days after your registered lab section before 11:55pm. Please read and follow the directions. If you have any questions, contact your TA or attend office hours. This week you will be creating code within R Script. Follow all instructions carefully Start by opening Rstudio and then creating a new RScript. For the following assignment, write all your code within the editor/script window This editorscript window is the one you will turn in once finished with your Imagine you're in an economics class here at Davis, and you have been talking about the correlation between country GDP (Gross Domestic Product) and child lliteracy rates. You're interested in the topic so you start doing some of your own research and calculations. 1. You find that world GDP is 80 billion and US GDP is 19 billion. Create and assign the variables "WorldGDP" and "USGDP" to the values above. Now create an equation (using the variables you created) in which you find the proportion of US GDP in relation to the world's GDP- assign the outcome of this equation to the variable "USOutputPercentage 2. After doing this calculation, you realized you mistook trillions for billions and your variables are off. To fix this, reassign the two variables (on two new lines!), WorldGDP and USGDP to the correct values, 80 trillion and 19 trillion respectively. Notice that value of U change since the USGDP and WorldGDP are going up by equal on 3. You find that the five countries with the highest GDP are as follows (all in trillions): US -21 China 14 Japan -5 Germany -4 UK-2.9 a. Create a variable "Largest5" and assign it to the GDPs of the five countries above (using condensed values such as 19 instead of 19,000,000,000,000 is advised) b. You are interested in what the largest five economies would look like if they all grew by 5% next year. Create an equation that uses the "Largest5" variable to answer that question. In the code for this equation, add your name and lab time into a comment. In doing all your research, you find a dataset that has the GDP of multiple countries along with their GDPChildliteracyW19." Download this dataset. ding child illiteracy rates 1. Start by loading the dataset into R. 2. You're interested in the child illiteracy rates for each continent. Subset the data by Continent (North America, South America, Africa, Asia, Australia, and Europe) and then find the mean of the child illiteracy rate for each of the 6 continents 3. You want to leam more about Australia's illiteracy rates. Start by creating a boxplot of the child illiteracy rates in Australia (Hint: use the Australia subset you created in #2) 4. Create a histogram of child illiteracy rates in Australia, specifically the child lliteracy data. Label the x-axis "Child Illiteracy, the y-axis "Frequency", and the main title "Australia Child Illiteracy Rates Histogram" 5. Plot the Australia data with Child Illiteracy on the x-axis and GDP on the y-axis (use the function: plot). After you have your plotted data, run a linear regression on the data (use the function: Im) 6. Add the line of best fit to your plot (use the function: abline) What you need to submit for this assignment 1. The RScript file that contains all the code that you used to complete this assignment. Save as RScript_LASTNAME 2. The boxplot. Save as boxplot (PDF) 3. The histogram with labels and title. Save as histogram (PDF) 4. The Australia Child Illiteracy plot with the line of best fit. Save as Plot (PDF) Upload these 4 items to CanvasStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started