r:lecture
Table of Contents
Data
R과 함께 인스톨된 public data들은 http://127.0.0.1:13732/library/datasets/html/00Index.html 에서 참조가 가능하다.
Descriptive Statistics
R 명령어 | |
---|---|
표본수 | length(v) |
평균 | mean(v) |
분산 | var(v) 1) |
표준편차 | sd(v) |
표준오차 | sd(v)/sqrt(length(v)) |
변동계수 | … |
표준오차 값은 데이터의 상황에 따라 다르게 구하므로 함수를 만들어서 사용하거나, 해당상황에 맞는 공식을 이용하여 구하는 것이 좋다 2).
boxplot(Volume)
boxplot(Volume, col=“green”)
hist(Volume, probability=T)
lines(density(Volume), col=“blue”)
rnorm(n=31, mean=0, sd=1)
rnorm(31)
qqnorm(x)
qqline(x)
함수만들기
se = function(x) sd(x)/sqrt(length(x))
시뮬레이션
set.seed(1234)
height = rnorm(n=100000, mean=175, sd=5)
mean(height)
M=NULL
V=NULL
for (i in 1:10000) {
x=sample(height, size=100)
M[i]=mean(x)
V[i]=var(x)
}
t-test
x = c{15.5, 11.21, 12.67, 8.877, 12.15, 9.88, 2.06, 14.5, 0, 4.97}
r/lecture.txt · Last modified: 2015/11/05 14:19 by hkimscil