Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Greetings, Could someone, please, help with this exercise in R programming? The data for this exercise is below. Thank you # Fit a linear model
Greetings, Could someone, please, help with this exercise in R programming? The data for this exercise is below. Thank you
# Fit a linear model
earn_lm <- lm(___ ~ ___ + ___ + ___ + ___ + ___, data=___)
# View the summary of your model
summary(earn_lm)
## Creating predictions using `predict()`using the `earn` variable as the predictor and the others variables as the outcome
predicted_df <- data.frame(
earn = predict(___, ___),
ed=___, race=___, height=___,
age=___, sex=___
)
this is the dataset.
earn | height | sex | ed | age | race |
50000 | 74.42444 | male | 16 | 45 | white |
60000 | 65.53754 | female | 16 | 58 | white |
30000 | 63.6292 | female | 16 | 29 | white |
50000 | 63.10856 | female | 16 | 91 | other |
51000 | 63.40248 | female | 17 | 39 | white |
9000 | 64.39951 | female | 15 | 26 | white |
29000 | 61.65633 | female | 12 | 49 | white |
32000 | 72.69854 | male | 17 | 46 | white |
2000 | 72.03947 | male | 15 | 21 | hispanic |
27000 | 72.23493 | male | 12 | 26 | white |
6530 | 69.51215 | male | 16 | 65 | white |
30000 | 68.03161 | male | 11 | 34 | white |
12000 | 67.55693 | male | 12 | 27 | white |
12000 | 65.43059 | female | 12 | 51 | white |
22000 | 65.66285 | female | 16 | 35 | white |
17000 | 67.75877 | male | 12 | 58 | white |
40000 | 68.35184 | female | 14 | 29 | white |
44000 | 69.60957 | male | 13 | 44 | white |
7000 | 64.18457 | female | 12 | 55 | black |
53000 | 73.07461 | male | 13 | 35 | black |
5000 | 62.37553 | female | 13 | 51 | white |
14000 | 63.02393 | female | 14 | 21 | white |
5500 | 67.2299 | male | 14 | 22 | white |
40000 | 65.55111 | female | 12 | 41 | white |
34000 | 72.07965 | male | 12 | 45 | white |
10000 | 63.09113 | female | 12 | 35 | black |
27000 | 64.32355 | female | 16 | 60 | white |
50000 | 71.64285 | male | 16 | 38 | white |
41000 | 76.79309 | male | 16 | 33 | white |
15000 | 63.89391 | female | 14 | 25 | white |
25000 | 63.80262 | female | 12 | 33 | white |
75000 | 71.59223 | male | 17 | 39 | white |
27000 | 67.52196 | male | 17 | 31 | white |
12000 | 64.39435 | female | 12 | 26 | white |
7500 | 61.17822 | female | 14 | 78 | white |
30000 | 66.98388 | female | 14 | 31 | black |
21000 | 65.31646 | female | 12 | 57 | white |
27000 | 63.57419 | female | 14 | 26 | white |
3000 | 66.611 | female | 15 | 65 | white |
25000 | 64.91176 | female | 12 | 30 | white |
24000 | 64.78968 | female | 12 | 41 | white |
32000 | 66.93769 | female | 18 | 29 | white |
10000 | 68.17281 | female | 17 | 30 | white |
11000 | 60.45066 | female | 12 | 21 | hispanic |
18700 | 64.79325 | female | 13 | 32 | white |
20000 | 61.81492 | female | 12 | 29 | white |
3500 | 71.57215 | male | 10 | 18 | white |
13000 | 67.31441 | male | 8 | 56 | black |
25000 | 69.89987 | male | 12 | 65 | white |
21000 | 69.7617 | male | 17 | 41 | white |
34000 | 67.74647 | female | 17 | 49 | white |
6000 | 60.19022 | female | 12 | 65 | white |
17000 | 71.0065 | male | 12 | 28 | white |
35000 | 71.1668 | male | 12 | 32 | white |
4000 | 72.73563 | male | 13 | 18 | white |
14000 | 68.13822 | female | 14 | 55 | white |
10000 | 66.37981 | female | 12 | 57 | white |
25000 | 69.23278 | male | 16 | 29 | white |
16000 | 63.27394 | female | 14 | 27 | white |
16000 | 61.82776 | male | 14 | 28 | hispanic |
16500 | 64.22121 | female | 14 | 43 | white |
4000 | 63.84127 | female | 9 | 68 | white |
3840 | 66.97477 | female | 9 | 52 | white |
Step 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