x <- c(0,340,70,140,200,180,210,150,100,130, 140,180,190,160,290,50,220,180,200,210) hist(x) # plot the histogram mean(x) # compute the mean abline(v = mean(x),lwd=2) #add vertical mean #data x <- c(0,340,70,140,200,180,210,150,100,130, 140,180,190,160,290,50,220,180,200,210) #find quartiles quantile(x,prob=c(.25,.50,.75),type=2) # The median of lower half of the observations (excluding the median itself if n is odd) is the first quartile, Q1. sort(x)[1:10] median(sort(x)[1:10]) # scaling properties: x<-c(2,4,6,7,8,9) mean(x) sd(x) a=3 b=2 y1=(x+a)*b y2=(x*b)+a mean(y1);(mean(x)+a)*b mean(y2);(mean(x)*b)+a sd(y1);sd(y2) sd(x)*b z =(x-mean(x))*1/sd(x) # expresses the number of standard deviations that x falls from the mean z mean(z) sd(z) ### fin