Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For the nhanes5 data with NA entries removed, make a scatterplot of weight based on height (that is, vertical axis equals weight and horizontal axis

For the nhanes5 data with NA entries removed, make a scatterplot of weight based on height (that is, vertical axis equals weight and horizontal axis equals height). Then, please format your plot for presentation, as follows:

(a) Put nice labels on the axes that indicate units (height or weight, pounds or inches), then title the plot something like "nhanes5 sample" or "health survey data". Hint: use the xlab, ylab, and main arguments within plot(...).

(b) Make the color of the dot indicate the gender of the person. Use any two different colors you want, one for the men, another for the women. Hint: within the plot(...) command, use col=ifelse(...). Read help documentation by running ?ifelse in the R console. Recall that in these data, 1=Man, 2=Woman.

(c) Fit your first name (as it appears in elearning) neatly into the plot using R. Hint: after making the scatterplot, run a new line of code text(x=70, y=275, "your name") where x and y specify the numerical coordinates in the existing plot. Adjust them as you like to fit your name in the space away from dots.

(d) Use R to find the (multiple linear) regression of Weight based on Height and Gender, then look at the coefficients. Because Gender is either 1 or 2, the regression model can be plotted as two parallel lines, one for if Gender=1, another for if Gender=2. Determine the intercept and slope of each of these lines (the slope is the same for each one), then use abline twice to plot both of them over your scatterplot. Coordinate their colors with your colors in part (b).

(e) Copy the scatterplot. Paste it into Word or PowerPoint with "Paste Options" -> "Picture." Right-click the picture and "Save As Picture." Save it as a JPEG. Finally, upload the JPEG of your histogram to this problem.

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

Step: 3

blur-text-image

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

Introduction to Probability

Authors: Mark Daniel Ward, Ellen Gundlach

1st edition

716771098, 978-1319060893, 1319060897, 978-0716771098

More Books

Students also viewed these Mathematics questions

Question

=+6. For the decision tree of Exercise 4,

Answered: 1 week ago

Question

What is Accounting?

Answered: 1 week ago

Question

Define organisation chart

Answered: 1 week ago

Question

What are the advantages of planning ?

Answered: 1 week ago