タグ

ブックマーク / ykchat.hatenadiary.org (1)

  • R - 分散 - まさるな日記

    「入門はじめての多変量解析」の内容をもとに多変量解析をRでお勉強していこかと Section 1.8 次のデータを使って、平均、分散、標準偏差を求めてみる No. 身長 体重 1 151 48 2 164 53 3 146 45 4 158 61 Rで記述してみると... 身長 <- c(151, 164, 146, 158) 体重 <- c(48, 53, 45, 61) data <- data.frame(身長, 体重) result <- matrix(0, 2, 3) rownames(result) <- c("身長", "体重") colnames(result) <- c("平均", "分散", "標準偏差") result[,1] <- mean(data) # 平均 result[,2] <- diag(var(data)) # 分散 result[,3] <- sd(

    R - 分散 - まさるな日記
    InoHiro
    InoHiro 2015/07/22
  • 1