ASSIGNMENT -1 1. Compute the mean , var , sd , length of a variable assuming the values 3,5,5,8,9,1 and 2 INPUT x<-c(3,5,5,8,9,1,2) mean(x) var(x) sd(x) length(x)
OUTPUT > x<-c(3,5,5,8,9,1,2) > mean(x) [1] 4.714286 > var(x) [1] 8.904762 > sd(x) [1] 2.984085 > length(x) [1] 7
2. A random sample of 10 boys had the following I.Q’s :(70,120,110,101,88,83,95,98,107,100). Compute the mean, var , sd and length . INPUT
OUTPUT
x<-c(70,120,110,101,88,83,95,98,107,100) mean(x) var(x) sd(x) length(x)
> x<-c(70,120,110,101,88,83,95,98,107,100) > mean(x) [1] 97.2 > var(x) [1] 203.7333 > sd(x) [1] 14.27352 > length(x) [1] 10
3. Compute the summary of the below data 40,51,61,28,31,50,53,55,46,39,39,39 INPUT
OUTPUT
x<-c(40,51,61,28,31,50,53,55,46,39,39,39) summary(x)
> x<-c(40,51,61,28,31,50,53,55,46,39,39,39) > summary(x) Min. 1st Qu. Median Mean 3rd Qu. Max. 28.00 39.00 43.00 44.33 51.50 61.00