Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Help in R programming The data for this assignment represent a sample from a com

ID: 3066775 • Letter: H

Question

Help in R programming

The data for this assignment represent a sample from a company that began an exercise program for their employees. Use this data to answer the following question. The variables in this dataset are: age – Age (in years) of employee; male – Whether the employee is male (1) or female (0); coffee – Number of cups of coffee the employee drinks on a weekday;  activity – General daily activity level (0–10 scale, higher numbers are more activity); preStress – Stress level before the exercise program began (0–100 scale);heart – Whether the employee has developed heart disease (e.g., high blood pressure); stress – Stress level one year after the exercise program began (0–100 scale)

Download the file “employeeExercise.dat” and import it into R using the following syntax: dat <- read.table("employeeExercise.dat", header = TRUE) Or, if you have trouble with the working directory, use this syntax: dat <- read.table(file.choose(), header = TRUE)

1.  Load the rockchalk package, and use the plotSlopes() function to visualize the interaction effect by plotting stress by activity, with different slopes for different levels of coffee. Choose 0, 2, and 5 cups of coffee for the slopes, and describe/contrast the effect of activity on stress among heavy (5), moderate (2), and non-drinkers of coffee (0). Be sure to paste your plot into the document, along with the syntax.

age male coffee activity preStress heart stress
25 0 3 9 69 0 53
32 1 3 5 66 1 61
35 1 3 3 71 0 55
27 0 1 6 61 0 50
21 1 3 4 61 0 41
53 0 2 4 54 1 85
53 0 4 8 76 1 94
49 0 4 3 68 1 80
35 1 2 5 58 0 56
34 1 5 8 77 1 82
48 1 1 8 64 0 67
31 1 1 10 66 1 47
29 1 1 8 66 0 43
28 1 6 4 74 1 54
49 1 4 6 65 0 76
35 1 4 2 74 1 55
42 1 2 0 66 1 72
21 1 2 2 72 1 47
28 1 5 10 80 0 73
44 1 2 9 73 0 71
41 1 2 10 65 0 70
46 1 1 8 69 0 64
23 1 3 6 70 1 54
47 0 3 6 61 0 76
48 1 3 10 72 0 79
32 1 4 1 71 1 49
34 1 7 7 78 1 80
37 1 5 0 70 1 42
49 0 1 4 64 0 71
27 1 3 2 72 1 49
49 0 2 4 70 1 78
33 1 1 9 71 0 44
41 1 1 4 71 0 61
50 1 2 7 71 1 79
47 1 5 0 75 1 58
50 1 4 6 73 1 86
41 1 2 7 63 0 64
37 0 0 0 63 0 74
33 0 0 9 53 0 43
55 1 4 3 71 1 81
45 0 1 4 64 0 69
51 0 1 9 61 0 67
33 1 7 5 76 0 60
46 1 4 3 73 1 67
54 1 3 4 67 1 83
40 1 3 9 74 0 70
33 0 0 3 58 0 59
52 0 0 3 70 0 79
25 1 2 4 73 1 45
46 1 6 8 79 0 94
46 1 2 6 64 0 75
49 1 2 10 62 0 74
24 1 3 9 69 0 50
27 1 3 4 69 1 53
37 1 4 4 75 1 62
21 0 1 0 65 1 54
35 0 0 1 52 0 73
53 1 4 3 71 1 85
47 0 4 3 66 0 72
32 1 2 4 65 0 57
35 1 5 4 69 1 67
50 1 4 5 67 1 83
23 1 4 6 75 0 46
28 1 4 7 62 0 60
27 1 3 9 67 0 60
38 1 3 6 73 0 67
22 1 4 3 56 1 46
30 1 6 1 81 1 40
25 0 1 10 58 0 41
43 1 3 0 63 1 66
23 1 5 10 73 0 68
49 0 1 3 61 0 77
32 1 3 3 65 0 55
30 0 4 6 59 0 57
48 1 3 5 75 0 71
30 1 3 10 71 0 59
40 0 0 0 67 0 73
27 0 0 3 60 0 51
45 0 2 6 66 0 71
22 1 6 6 73 1 59
40 1 3 0 67 1 65
52 1 2 5 65 1 78
36 1 4 10 73 0 76
24 1 4 5 73 0 44
29 1 1 3 70 0 50
41 1 2 1 70 1 68
25 1 6 4 81 1 51
23 1 1 2 67 0 44
48 1 3 6 78 0 72
53 1 3 1 70 1 79
28 0 0 10 52 0 35
33 1 7 1 75 1 41
23 1 1 4 71 0 46
35 0 1 7 56 0 56
55 1 3 5 70 1 91
54 1 4 2 70 1 77
52 1 2 6 69 0 79
52 1 4 3 78 1 83
29 1 1 7 77 0 44
45 0 0 3 65 1 78
41 1 3 6 64 0 63
35 0 1 9 66 0 53
26 0 1 5 61 0 45
41 1 2 10 74 0 61
46 0 3 3 74 1 71
42 1 5 4 81 0 63
49 0 1 8 63 0 70
37 0 1 5 50 0 61
39 1 3 4 68 0 66
35 1 8 4 75 0 53
21 0 4 2 60 1 42
31 1 2 5 69 0 55
51 0 2 0 70 1 86
42 1 5 8 77 1 90
29 0 1 0 63 1 62
39 1 3 1 71 1 60
39 1 0 0 58 1 78
45 0 1 8 60 0 67
36 1 3 2 65 1 62
55 0 1 0 63 0 87
53 1 2 7 71 1 84
28 1 6 0 70 1 33
53 1 7 6 79 1 99
51 1 2 3 67 1 83
44 0 0 1 54 1 87
29 0 4 2 79 0 44
45 1 3 1 71 1 72
28 0 3 6 77 0 47
50 1 3 0 73 1 75
52 1 3 7 66 0 84
52 1 3 6 65 0 79
23 0 3 10 67 0 51
51 1 2 7 66 0 75
51 1 5 10 82 0 100
38 1 2 7 62 0 63
27 0 1 5 62 0 44
47 0 4 2 62 1 72
40 1 1 0 68 1 73
50 1 1 10 75 1 73
22 1 6 7 76 0 52
35 1 4 6 74 1 67
24 0 0 6 61 0 37
48 0 0 1 62 0 83
40 1 2 8 70 0 67
48 0 1 3 64 0 76
28 1 2 1 65 1 58
50 0 0 8 62 0 65
54 1 1 10 62 0 70
47 1 3 4 62 1 81
52 1 2 0 68 0 74
45 1 3 2 78 1 73
29 1 4 2 78 0 41
37 1 7 2 79 1 51
49 1 5 4 69 1 82
37 0 1 6 56 0 58
46 1 3 4 64 0 72
27 1 8 7 77 1 75
34 1 1 1 64 0 60
39 1 1 2 74 1 68
35 0 1 9 64 0 50
28 1 5 6 74 0 60
41 1 4 7 79 1 85
23 1 2 5 62 0 42
35 1 5 3 76 1 48
36 0 2 6 59 0 59
38 1 4 8 67 0 72
24 1 1 10 69 0 39
54 1 2 6 67 0 82
40 1 7 1 74 1 43
37 0 1 7 62 0 56
29 1 3 0 71 1 46
24 1 3 2 68 1 49
21 0 1 10 59 0 35
31 1 2 9 63 0 52
40 0 3 5 58 0 69
52 1 6 8 79 0 100
39 1 2 0 68 1 62
25 1 2 1 77 0 45

Explanation / Answer

r<-read.table("balbichi.txt",header=TRUE)
r

confint(l,"activity",0.95)


Output

   2.5 %    97.5 %
activity -0.5593442 0.8859033

This means that,based on the data,95% of the time COnfidence Interval lies between -0.5593442 and 0.8859033 which indicates that you cant be 95% confident whether the slope will be either be positive or negative,because it contains 0.