Question: Problem 1 Use the clouds data from package HSAUR 3 to build a multiple regression model of the dependent variable rainfall. a ) Consider all

Problem 1
Use the clouds data from package HSAUR3 to build a multiple regression model of the dependent variable
rainfall.
a) Consider all other variables as potential factors in the model ( this is so called full model).
b) Add potential interaction effects if there is any (use graphical way to help you interpret).
c) Remove some non-significant variables from the model and compare the new model with the full model.
d) Use the residuals against fitted values of the new mode from c) to check the normality assumption.
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")
y - 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
mfrow =c(2,1)
myplot(role.fitted1)
myplot(role.fitted2)
Please do each problem and write the code for each in R
Problem 1 Use the clouds data from package HSAUR

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!