Assingment

profileTJ9
ch-7.2logistic-regression-assignment_1700177513437.zip

Logistic Regression Assignment/Harass.txt

Age MarStat FemIdeol FreqBeh OffensBeh Report
13 1 102 2 4 0
45 2 101 3 6 0
19 2 102 2 7 1
42 2 102 1 2 1
27 1 77 1 1 0
19 1 98 0 6 1
37 1 96 1 6 0
22 1 92 1 2 0
23 1 104 2 3 1
36 2 82 3 4 1
32 1 87 2 5 1
38 2 91 2 4 1
32 1 101 2 3 0
35 2 94 3 4 0
39 2 92 2 3 1
30 1 85 2 5 1
27 1 99 2 6 1
44 2 80 2 3 0
33 1 101 2 2 0
23 1 85 3 3 0
24 1 90 3 3 0
26 1 90 2 3 1
31 2 99 2 3 1
30 1 108 1 4 1
42 1 88 2 5 0
55 2 80 3 4 1
46 2 81 3 4 0
22 1 102 2 5 1
48 1 86 2 1 0
28 1 90 1 4 0
44 1 94 3 3 1
49 1 77 2 3 0
28 2 98 3 3 1
29 2 84 2 2 0
36 2 105 3 5 0
40 1 91 2 3 1
36 2 78 2 3 0
25 2 85 1 3 1
35 2 87 3 4 1
31 2 95 2 4 0
48 2 91 2 5 1
36 1 103 2 3 0
36 2 99 1 5 0
43 1 86 2 3 1
22 1 83 2 6 0
38 2 97 2 6 1
27 1 90 2 4 1
32 2 99 3 3 0
26 1 98 3 6 1
28 2 107 2 6 1
32 2 82 3 3 0
26 1 95 3 5 0
38 1 88 3 3 1
48 2 73 1 3 0
43 1 88 2 5 1
51 1 87 2 4 0
41 2 83 2 4 0
32 2 104 2 2 1
27 1 92 2 7 1
46 2 75 3 5 1
33 2 96 2 3 1
21 2 107 3 5 0
49 2 83 3 5 0
51 2 82 1 3 1
34 1 90 2 6 1
36 2 105 3 5 0
41 2 100 1 4 0
41 2 86 2 4 0
28 1 84 0 3 1
45 1 81 1 3 0
38 1 88 2 3 1
45 2 85 2 3 0
36 1 91 2 0 0
43 1 90 2 4 1
33 2 102 2 5 0
40 1 94 2 3 0
39 1 83 2 2 1
40 1 90 2 5 0
33 2 91 2 4 1
52 1 91 3 3 0
32 2 87 1 2 1
30 1 94 2 4 0
34 2 101 1 6 1
41 1 75 3 1 0
37 1 92 3 5 1
31 1 97 3 2 0
21 2 97 1 5 0
32 1 92 2 5 0
40 2 89 2 3 0
47 2 91 2 4 1
48 2 85 3 5 0
60 2 96 2 5 0
33 1 94 2 6 1
21 1 88 2 4 0
37 2 92 3 3 1
49 2 82 2 5 1
53 2 68 3 4 0
33 1 87 2 1 0
16 1 93 1 3 1
50 2 91 2 5 0
30 2 98 3 3 1
40 2 74 1 1 0
23 2 89 2 3 1
43 2 81 2 4 0
28 2 94 1 5 0
38 2 89 2 4 1
43 2 87 1 4 1
26 1 89 2 3 1
38 1 94 2 2 0
42 2 99 3 4 1
33 1 92 0 3 1
26 1 93 1 4 0
41 1 95 2 2 0
52 2 101 4 6 1
46 2 97 2 4 0
33 2 96 1 2 1
29 1 97 2 4 0
38 1 98 2 5 1
22 2 96 1 2 0
33 1 92 2 3 1
48 1 100 2 3 0
52 2 74 2 4 0
32 2 99 4 2 0
33 1 82 2 3 0
32 1 101 3 4 0
40 2 94 2 2 0
55 1 103 2 2 0
27 2 92 1 3 1
43 1 95 2 2 0
69 1 85 3 5 0
23 1 80 2 2 0
31 2 98 3 4 0
43 2 86 3 4 0
24 1 90 3 4 1
57 2 88 2 4 0
34 1 88 2 3 1
19 1 96 1 5 1
47 1 100 2 5 1
47 1 77 1 4 1
32 1 90 2 3 0
22 1 99 2 5 1
29 1 102 0 5 0
34 2 93 2 3 1
29 2 90 2 6 1
43 1 91 2 2 0
42 1 81 2 1 0
49 2 91 3 6 0
33 1 82 3 2 0
26 2 82 1 4 0
31 2 89 2 4 1
26 1 88 1 2 1
47 2 94 3 4 0
44 2 93 2 2 0
49 2 95 1 5 1
40 2 108 2 5 1
28 2 91 2 3 1
46 2 83 2 6 1
49 2 95 2 4 1
24 2 98 1 2 0
31 2 94 1 4 1
41 1 92 3 3 1
29 1 87 2 3 0
40 1 99 3 3 0
26 1 88 1 5 1
46 1 98 1 3 1
36 2 90 2 4 0
49 1 68 3 4 1
42 2 90 2 3 1
33 2 97 2 5 1
42 1 91 2 3 1
26 2 91 1 4 0
38 2 98 4 9 1
31 2 106 2 3 1
41 2 86 2 4 0
37 2 101 2 5 0
46 1 82 2 2 0
27 1 95 3 4 0
31 2 96 2 2 0
33 2 95 1 3 1
29 1 97 3 4 1
22 2 87 1 1 0
30 2 97 2 3 0
24 1 103 2 3 0
45 2 101 2 5 0
28 1 80 2 2 0
29 2 98 2 4 1
56 2 102 3 3 0
46 2 91 3 6 1
44 2 91 2 3 1
49 2 96 2 3 0
41 2 83 3 4 1
29 1 92 2 6 1
42 2 92 1 2 0
29 1 75 3 2 0
39 1 101 2 4 1
44 2 77 1 4 0
40 1 89 3 3 0
49 2 87 3 6 1
43 2 99 3 3 0
39 2 101 3 4 0
28 2 96 1 3 0
55 2 89 3 4 1
25 2 92 2 4 0
29 2 101 2 4 1
31 2 91 2 3 0
37 2 95 3 4 0
38 2 88 1 4 0
29 2 103 3 5 1
42 2 94 3 5 1
48 2 79 2 1 0
47 1 100 2 4 1
42 2 89 1 2 0
37 2 84 2 2 0
30 1 88 3 6 1
46 1 96 4 4 0
34 1 101 3 4 1
37 1 102 3 4 0
36 1 100 3 3 0
37 2 78 1 3 0
39 1 91 3 5 0
35 1 83 2 3 1
44 2 88 2 4 1
18 2 95 4 4 1
35 1 89 2 4 1
39 2 82 2 3 1
20 1 108 1 5 1
42 2 98 3 4 0
43 2 93 2 4 1
39 2 100 2 2 1
22 1 73 1 2 0
52 2 101 2 2 0
24 1 76 2 3 0
34 1 92 3 5 0
34 1 88 1 1 0
44 2 116 1 5 1
44 1 99 3 5 0
31 2 98 2 3 0
44 2 94 3 2 1
52 1 87 1 3 0
51 2 85 2 4 0
31 1 88 2 3 1
37 2 84 2 3 0
37 2 78 1 2 0
25 2 91 2 1 1
46 1 92 2 3 0
46 1 97 1 3 0
44 2 103 2 3 0
36 1 95 2 5 1
29 1 83 2 4 0
25 1 79 2 3 0
29 2 99 2 3 1
28 1 102 2 5 0
39 1 95 0 2 0
38 1 74 2 4 0
30 1 75 2 1 0
50 1 83 4 6 1
51 1 77 2 3 0
24 1 71 2 3 0
25 1 91 2 2 1
36 1 89 2 3 0
42 2 85 2 5 1
47 1 84 3 5 1
41 2 80 2 2 1
52 1 90 2 4 1
25 1 75 2 5 1
38 1 77 1 3 0
47 2 85 2 1 1
45 1 79 1 2 1
25 2 93 2 6 1
30 2 84 2 0 0
48 1 71 1 4 1
40 1 90 2 4 0
35 1 94 1 4 1
27 2 86 2 3 0
57 2 91 1 3 0
27 1 86 3 3 1
47 1 77 3 2 1
43 2 99 2 4 0
41 2 95 2 5 1
47 1 92 3 2 0
30 2 86 2 3 1
24 1 88 1 4 1
48 2 89 3 4 0
33 2 93 3 6 1
46 2 94 4 4 1
26 2 93 2 4 1
34 2 90 2 2 1
42 1 91 2 3 1
42 2 85 2 2 1
33 2 89 3 4 1
35 1 97 3 2 0
39 1 77 2 4 0
35 1 95 2 3 1
28 1 84 1 1 0
51 2 95 2 5 1
28 1 90 2 2 1
31 1 111 2 7 1
44 1 105 2 3 1
44 1 88 3 5 1
53 1 96 3 5 1
47 1 91 1 3 1
40 1 98 3 5 1
41 2 90 3 3 1
29 1 76 2 3 1
41 2 97 1 3 0
50 2 93 4 6 1
50 1 88 3 5 1
33 1 94 2 3 1
36 1 84 1 5 1
29 1 99 1 5 1
19 1 86 2 6 1
38 2 88 2 1 0
46 2 86 1 1 0
44 2 88 2 5 0
28 2 94 2 1 0
21 1 78 1 2 0
34 2 88 1 3 1
42 2 92 3 5 1
33 1 84 2 3 1
48 2 94 2 4 1
39 2 84 2 1 0
49 2 88 2 3 0
41 1 105 2 2 0
32 1 90 2 1 0
44 2 102 3 7 1
19 1 92 1 4 0
39 2 87 2 3 0
53 2 103 2 4 1
25 1 109 2 6 1
29 2 91 2 2 0
23 2 90 2 3 0
50 2 94 2 4 0
33 1 98 1 4 0
32 1 87 2 4 1
45 1 85 3 4 0
44 2 96 1 4 1
34 2 103 1 4 0
18 1 110 1 5 1
37 2 98 0 5 0
34 2 100 3 4 1
25 1 79 2 5 1
38 1 87 0 3 1
47 1 83 1 5 1

Logistic Regression Assignment/Logistic Regression Assignment.docx

Dr. Alam, CS 445

Logistic Regression Assignment

Build a logistic regression model to predict the likelihood that a subject will report sexual harassment on the basis of the following independent variables:

· Age

· Marital status (1 = married, 2 : single)

· Feminist ideology

· Frequency of the behavior

· Offensiveness of the behavior

· Whether or not it was reported (0 : no, 1 : yes)

For each variable, higher numbers represent more of the property.

Instruction:

Use the Harass.dat dataset, which contains slightly modified data on 343 cases created to replicate the results of a study of sexual harassment.

Steps:

1. Load the Harass.dat dataset into R.

2. Prepare the data for analysis. This may involve cleaning the data, removing any outliers, and converting categorical variables to dummy variables. This dataset is clean, so you do not need to do anything.

3. Split the data into training and test sets (Optional).

4. Build a logistic regression model on the training set. If you decided not to split the data in step 3, then use the whole data set to test your model

5. Evaluate the model on the test set (Optional).

6. Interpret the results of the model.

7. Interpreting the results of the coefficients, std. error, z-value, and p-value of the independent variables. When you are interpreting the coefficients produced by R for a logistic regression model, you need to think of them as representing a one-unit increase or decrease in the log odds of y=1 for a one-unit increase or decrease in the corresponding predictor variable.

8. Use the two rows of data given below and calculate the probability that a subject will report sexual harassment on the basis of the independent variables:

Age MarStat FemIdeol FreqBeh OffensBeh PrReport

45 1 98 3 3 ?

25 0 75 1 3 ?

2