官术网_书友最值得收藏!

Standardization

In statistics, standardization plays a crucial role as we have various attributes for modeling and all of them have different scales. So for comparison purposes, we need to standardize the variables to bring them on the same scale. Centering the values and creating the z scores is done in R by the scale() function. It takes the following arguments:

  • x: A numeric object
  • center: If TRUE, the object's column means are subtracted from the values in those columns (ignoring NAs); if FALSE, centering is not performed
  • scale: If TRUE, the centered column values are pided by the column's standard deviation (when center is also TRUE; otherwise, the root mean square is used); if FALSE, scaling is not performed

If we want to center the data of Volume in our dataset, we just need to execute the following code:

>scale(Sampledata$Volume, center=TRUE, scale=FALSE) 

If we want to standardize the data of volume in our dataset, we just need to execute the following code:

>scale(Sampledata$Volume, center=TRUE, scale=TRUE) 
主站蜘蛛池模板: 金山区| 凯里市| 廊坊市| 博罗县| 铁岭市| 凤翔县| 金乡县| 资兴市| 木兰县| 麻城市| 伊金霍洛旗| 石河子市| 祁阳县| 自治县| 襄汾县| 永顺县| 镇安县| 巴彦淖尔市| 巴楚县| 灵璧县| 西林县| 琼海市| 内江市| 建水县| 凯里市| 嘉鱼县| 桂东县| 洪江市| 连江县| 娄底市| 德化县| 合肥市| 莆田市| 平山县| 河间市| 特克斯县| 临桂县| 花莲县| 永登县| 高邮市| 酒泉市|