Question: Problem 2 Read the following R codes and the corresponding output then answer the questions. Model 1 without interaction library ( HSAUR 3 ) data

Problem 2
Read the following R codes and the corresponding output then answer the questions.
Model 1 without interaction
library(HSAUR3)
data("womensrole")
fm - cbind(agree,disagree)- gender + education
womensrole_glm_1- glm(fm, data = womensrole, family = binomial())
role.fitted1- fitted(womensrole_glm_1)
#role.fitted1- predict(womensrole_glm_1, type = "response")
Plot function
myplot - function(role.fitted){
f - womensrole$gender == "Female"
plot(womensrole$education, role.fitted, type ="n",
ylab = "Probability of agreeing",
xlab = "Education", ylim = c(0,1))
lines(womensrole$education[!f], role.fitted[!f], lty =1)
lines(womensrole$education[f], role.fitted[f], lty =2)
lgtxt - c("Fitted (Males)", "Fitted (Females)")
legend("topright", lgtxt, lty =1:2, bty ="n")
v - womensroleagree +
womensrole$disagree)
size - womensroleagree+womensroledisagree
size - size - min(size)
size -(size / max(size))*3+1
text (womensrole$education[f], y[f],"\VE",
family = "HersheySerif", cex = size, col="red")
text (womensrole$education[!f], y[!f],"\MA",
family = "HersheySerif", cex = size, col="blue")
}
Model 2 with interaction
fm2- cbind(agree,disagree)- gender * education
womensrole_glm_2- glm(fm2, data = womensrole, family = binomial())
role.fitted2- fitted(womensrole_glm_2)
Call myplot fuction
Problem 2 Read the following R codes and the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!