- UID
- 106336
- 热情
- 3030
- 人气
- 3740
- 主题
- 152
- 帖子
- 4863
- 精华
- 4
- 积分
- 5926
- 分享
- 0
- 记录
- 0
- 相册
- 1
- 好友
- 12
- 日志
- 0
- 在线时间
- 2529 小时
- 注册时间
- 2007-2-4
- 阅读权限
- 30
- 最后登录
- 2025-2-8
   
升级   18.52% - UID
- 106336
- 热情
- 3030
- 人气
- 3740
- 主题
- 152
- 帖子
- 4863
- 精华
- 4
- 积分
- 5926
- 阅读权限
- 30
- 注册时间
- 2007-2-4
|
可怜的孩纸
我找到一些以前作业的coding, 你看看有没有差不多能用的
我不知道你们今年题是啥
The R-code for all the questions is attached below:
###------------------Question 1
library(s20x)
AKL.df<-read.csv(file.choose(),header=T)
attach(AKL.df)
### set data set for all the transport methods
AKLtransport.df=AKL.df[,3:11]
###boxplot of each method
boxplot(AKLtransport.df[,1])
bosplot(AKLtransport.df[,2])
boxplot(AKLtransport.df[,3])
boxplot(AKLtransport.df[,4])
bosplot(AKLtransport.df[,5])
boxplot(AKLtransport.df[,6])
boxplot(AKLtransport.df[,7])
bosplot(AKLtransport.df[,8])
boxplot(AKLtransport.df[,9])
### set data set for all the proportion methods
AKLtransport.df=AKL.df[,13:21]
###scatterplot matrix
pairs(AKLtransport.df)
###------------------Question 2
###covariance matrix
cor(AKLtransport.df)
###------------------Question 3
### multivariate qq-plot
mah<-mahalanobis(AKLtransport.df,apply(AKLtransport.df,2,mean),var(AKLtransport.df))
qqplot(mah,qchisq(ppoints(mah),ncol(AKLtransport.df)),main="multivariate qq-plot")
### -----------------Question 4
text(sort(mah),qchisq(ppoints(mah),ncol(AKLtransport.df)),label=sort(mah,index.return=T)$ix)
### -----------------Question 5
###levenes test
res=lm(as.matrix(AKLtransport.df)~as.factor(Region))
resid=abs(res$residuals)
lev=lm(resid~as.factor(Region))
mvlev=manova(lev)
summary(mvlev) |
|