看板 PH-94 關於我們 聯絡資訊
ceiba進不去 = =|| 要怎麼交作業...??? -------------- 助教有po程式檔在ceiba上 可以參考一下: 6.5 SAS /*import data , excel檔較佳*/ data data; set data; interact=xi1*xi2; run; proc corr data=data; /* correlation matrix*/ var Yi Xi1 Xi2; run; proc reg data=data; /* linear model*/ model yi=xi1 xi2; output out=z r=residual p=predict; run; quit; proc reg data=data; model yi=xi1 xi2 interact; output out=z1 r=residual p=predict; run; quit; /* if you want to obtain some graphs, try solutions -> analysis -> interactive data analysis, and choose your file*/ /* then, push "Analyze" button to choose the plot you want*/ R data<- read.table("6.5.txt",header=T) data<-data.frame(data) attach(data) #a pairs(data) cor(data) #b fit<- lm(Yi~Xi1+Xi2,data) summary(fit) #c resid<- resid(fit) resid boxplot(resid) #d interact12<-Xi1*Xi2 fit2<-update(fit,.~.+.+interact12) resid2<- resid(fit2) plot(fitted(fit2),resid2) plot(Xi1,resid2) plot(Xi2,resid2) plot(fitted(fit2),interact12) qqnorm(resid2) 6.15 R data data; set data; interact12=xi1*xi2; interact13=xi1*xi3; interact23=xi2*xi3; run; proc univariate plot; /*stem-and-leaf plot & box plot & ...I forgot orz */ run; proc corr; var Yi xi1 xi2 xi3; run; /* c. */ proc reg; model Yi=xi1 xi2 xi3 ; output out=z p=predict r=residual; run; quit; /* e. */ proc reg; model Yi=xi1 xi2 xi3 interact12 interact13 interact23; output out=z1 p=predict r=residual; run; quit; R data<- read.table("6.15.txt",header=T) data<-data.frame(data) attach(data) #a stem(Xi1) stem(Xi2) stem(Xi3) #b pairs(data) cor(data) #c fit<-lm(Yi~Xi1+Xi2+Xi3,data) summary(fit) #d residual<-resid(fit) residual boxplot(residual) #e interact12<-Xi1*Xi2 interact13<-Xi1*Xi3 interact23<-Xi2*Xi3 fit2<-update(fit,.~.+.+.+interact12+interact13+interact23) residual2<-resid(fit2) plot(fitted(fit2),residual2) plot(Xi1,residual2) plot(Xi2,residual2) plot(Xi3,residual2) plot(interact12,residual2) plot(interact13,residual2) plot(interact23,residual2) qqnorm(residual2) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.137.134.27
coldrat:/*stem-and-leaf plot & box plot & ...I forgot orz/ 04/28 15:46
coldrat:這是什麼意思 @@ 04/28 15:47