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

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) 
主站蜘蛛池模板: 乌鲁木齐市| 清水河县| 兴安县| 民和| 和田县| 吉木乃县| 武城县| 县级市| 竹溪县| 南丹县| 阳泉市| 绵竹市| 建阳市| 布拖县| 且末县| 河曲县| 怀远县| 平昌县| 宁陵县| 巴彦淖尔市| 五台县| 上林县| 玉林市| 丽水市| 林甸县| 和田县| 东光县| 天水市| 武鸣县| 石嘴山市| 保德县| 金川县| 青神县| 德化县| 新绛县| 张家口市| 义乌市| 鄂伦春自治旗| 昭觉县| 垦利县| 大名县|