# HW8 - -0.5 split.screen(c(1,2,3 screen(1...

This preview shows pages 1–2. Sign up to view the full content.

Sheet1 Page 1 #Question 1 # OT=c(-1,-1,-1,-1,1,1,1,1) PC=c(-1,-1,1,1,-1,-1,1,1) ST=c(-1,1,-1,1,-1,1,-1,1) y=c(67,79,61,75,59,90,52,87) g=lm(y~ OT+PC+ST+OT:PC+OT:ST+PC:ST+OT:PC:ST) eff=2*g\$coef[-1] eff round(cbind(eff),3) eff OT 1.5 PC -5.0 ST 23.0 OT:PC 0.0 OT:ST 10.0 PC:ST 1.5 OT:PC:ST 0.5 split.screen(c(1,2)) [1] 1 2 screen(1) interaction.plot(OT,ST,y) screen(2) interaction.plot(ST,OT,y) # #Half normal plot halfnorm = function(x) ## This function generates the half normal plot { n = length(x) halfn = .5+.5*(1:n-.5)/n plot(qnorm(halfn), sort(abs(x)), type="p", pch=20, xlab="half-normal quantiles", ylab="absolute effects") identify(qnorm(halfn), sort(abs(x)), names(sort(abs(x)))) } halfnorm(eff) # #Question 2 A=c(-1,1,-1,1,-1,1,-1,1) B=c(-1,-1,1,1,-1,-1,1,1) C=c(-1,-1,-1,-1,1,1,1,1) y=c(60,62,82,86,85,85,61,61)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Sheet1 Page 2 g=lm(y~A+B+C+A:B+A:C+B:C+A:B:C) eff=2*g\$coef[-1] eff A B C A:B A:C B:C A:B:C 1.5 -0.5 0.5 0.5 -1.5 -23.5
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: -0.5 split.screen(c(1,2,3)) screen(1) interaction.plot(A,B,y) screen(2) interaction.plot(A,C,y) # #Half normal plot halfnorm = function(x) ## This function generates the half normal plot { n = length(x) halfn = .5+.5*(1:n-.5)/n plot(qnorm(halfn), sort(abs(x)), type="p", pch=20, xlab="half-normal quantiles", ylab="absolute effects") identify(qnorm(halfn), sort(abs(x)), names(sort(abs(x)))) } halfnorm(eff) # #Question 3 # A=c(-1,-1,-1,-1,-1,-1,-1,-1,1,1,1,1,1,1,1,1) B=c(-1,-1,-1,-1,1,1,1,1,-1,-1,-1,-1,1,1,1,1) C=c(-1,-1,1,1,-1,-1,1,1,-1,-1,1,1,-1,-1,1,1) D=c(1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1,1,-1) z=c(-1.309,-1.234,-1.317,-1.625,-1.510,-1.585,-1.505,-1.537,-1.313,-1.302,-1.514,-1.474,-1.483,-1.374,-1.386,-1.650) g=lm(z~ A+B+C+D+A:B+A:C+A:D+B:C+B:D+C:D+A:B:C+A:B:D+A:C:D+B:C:D+A:B:C:D) eff=2*g\$coef[-1] eff round(cbind(eff),3)...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern