Y<-function(x1,x2) 25+3*x1+4*x2+1.5*x1*x2 x=seq(0,7) EY=Y(x,3) plot(x,EY,type = "l",col=4) abline(49,12,col=2) x1=seq(-10,10,0.5) x2=seq(-10,10,0.5) z=outer(x1,x2,Y) contour(x1,x2,z) data=read.table("D:CH08TA02.txt",header=T) attach(data) fm=lm(Y~x2) xtable(summary(fm)) concentration=read.table("D:concentration.txt",header=T) attach(concentration) concentration.lm<-lm(Y~X) boxcox(concentration.lm) boxcox(concentration.lm,lambda=seq(-0.3,0.3,0.1)) machine=read.table("D:CH11PR07.txt",header=T) attach(machine) fm1=lm(Y~x) xtable(summary(fm1)) par(mfrow=c(2,2)) plot(fm1) res=residuals(fm1) plot(x,res^2) fm2=lm(res^2~x) xtable((summary(fm2))) wi=1/fitted(fm2) print(cbind(x,Y,res,"res^2"=res^2,weights=wi),digits=2) fm3=lm(Y~x,weights=wi) xtable(summary(fm3))