d2016 = read.table('clipboard', header = T)
head(d2016)
summary(d2016[,3:17]) #描述性统计
#利用改进的极差转换法对数据进行标准化
#正向指标
standard1<-function(x){
(x-min(x))/(max(x)-min(x))*40+60
}
#负向指标
standard2<-function(x){
(max(x)-x)/(max(x)-min(x))*40+60
}
d2016_st_1=apply(d2016[,-c(1,2,14)],2,standard1);d2016_st_1 #正向
d2016_st_2=standard2(d2016[,14]);d2016_st_2 #负向
d2016_st_t=cbind(d2016_st_1,d2016_st_2)
colnames(d2016_st_t)=c("x1","x2","x3","x4","x5","x6","x7","x8","x9","x10","x11","x13","x14","x15","x12")
#对标准后的数据进行归一化处理
#d2016_st_sum=sum(d2016_st_t)
norm <- function(x){
x/colSums(x)
}
d2016_norm_t=norm(d2016_st_t)
|