Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

R PROGRAMMING. HELP TY!! Age Male_prob Male_lives Male_exp Female_prob Female lives Female_exp 1 0 0.006383 100000 76.15 0.005374 100000 80.97 2. 1 0.000453 99362 75.63

R PROGRAMMING. HELP TY!!image text in transcribedimage text in transcribedimage text in transcribed

Age Male_prob Male_lives Male_exp Female_prob Female lives Female_exp 1 0 0.006383 100000 76.15 0.005374 100000 80.97 2. 1 0.000453 99362 75.63 0.000353 99463 80.41 3 3 2 0.000282 99317 74.67 0.000231 99427 79.44 4 3 0.000230 99289 73.69 0.000165 99405 78.45 5 4 0.000169 99266 72.71 0.000129 99388 77.47 6 5 0.000155 99249 71.72 0.000116 99375 76.48 7 6 0.000145 99234 70.73 0.000107 99364 75.48 00 8 7 0.000135 99219 69.74 0.000101 99353 74.49 Showing 1 to 9 of 120 entries, 7 total columns Next, let's look at when death occurs by age and sex. The variables Male_lives and Female_lives show how many people of the same age and gender are still alive at a given age out of a cohort of 100,000. The function diff(x) computes the difference in adjoining values of a vector. For example, -diff(Male_lives)/100000 is the proportion of the starting cohort of males that dies each year. Produce a side-by-side bar plot to display the comparison of male and female death rates by age. Note that diff(x) returns a vector that is one element shorter than x. You can use rbind() to create the required matrix input to show both vectors in the same plot. Check the documentation (?barplot) to see how to get a side-by-side comparison. (Hint: the default is to stack the bars). Include a label that shows age on the x axis. Also include an appropriate title, colors, and a legend to assist with the interpretation. Also include an appropriate title, colors, and a legend to assist with the interpretation. '{r} # Your code goes here ### Question 3: What do you observe about differences in the probability of death by age for males and females? How would you characterize the shape of these distributions? what is going on at age = 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students explore these related Databases questions