Assignment 3 (Q)
Assignment 3 (Q)
----------------------------------------------------------------------------------------------------------------------------- -------------
Roll No: --------------
----------------------------------------------------------------------------------------------------------------------------- -------------
Roll No: --------------
------------------------------------------------------------------------------------------------------------------------------------------
Roll No: --------------
3,9,13,10,8,10,12,8,18,14,13,11,15,12,17,19,13,17,15,16,17,18,20,
22,25,23,22,25,26,29,30,31,32,33,27,26,28,29,26,24,23,22,21,20,18
Write R commands to compute: length, sum, mean, median, 90th percentile, variance, standard deviation and
product of the vector containing these observations (20)
Question # 3 (a): Let you have vector of values in R environment, write R commands to: (10)
(i) compute natural log (ii) compute square root (iii) Round to 2 decimals
(iv) Retain the integer part (v) compute product of vector
X=34.46,34.6,35.38,35.85,35.68,35.35,35.04,34.07,32.2,34.32,31.08
Write R commands to test the hypothesis that population mean is 35 against alternative that it is not 35.
Use 5% level of significance. (10)
Question # 4 (a): For a binomial random variable X with parameters n 12 and P 0.7 , write R command(s) to
compute: (10)
Question # 4 (b): Write an R function/programme that takes a vector as input and returns Range and Coefficient of
Range as output (the function must work for vector of any length). (10)
Question # 5 (a): Write an R function/programme that takes a vector as input and returns its Geometric mean as output
(the function must work for vector of any length). (10)
Question # 5 (b): Let you have a vector of " n " observations. If it is decided that any value that falls outside the limits
X 3 S.DX will be considered as an outlier. Write a function/program in R that takes vector as
input and returns (i) Observations which are outlier (ii) Percentage of outliers in the original vector
as output. (10)
Roll No: --------------
Question # 1: Write R commands to compute: mean, median, variance, standard deviation, lower quartile and upper
quartile of the vector containing the following sample values. (20)
3,9,13,10,8,10,12,8,18,14,13,11,15,12,17,19,13,17,15,16,17,18,20,
22,25,23,22,25,26,29,30,31,32,33,27,26,28,29,26,24,23,22,21,20,18
X = 34.46,34.6,35.38,35.85,35.68,35.35,35.04,34.07,32.2,34.32,31.08
Y = 34.14,34.85,35.89,33.53,33.79,34.72,35.22,36.5,37.6,37.89,37.71
(i) population variances are equal against the alternative that they are not equal. (10)
(ii) population means are equal against the alternative that they are not equal. (10)
Question # 4 (a): A random variable X is normally distributed with mean 50 and standard deviation 10. Write R
command(s) to find the probability that random variable X takes a value: (10)
(i) between 55 and 100 (ii) greater than 54 (iii) smaller than 57
Question # 4 (b): Write an R function/programme that takes a vector as input and returns its Harmonic mean as output
(the function must work for vector of any length). (10)
n
Question # 5 (a): Write a function/program in R that takes two numbers n and r as input and Pr (n permutation r)
as output. (10)
Question # 5 (b): Write a function/program in R that takes a vector as input and returns its mean deviation from mean
as output. (10)
Roll No: --------------
Question # 1 (a): Samples from each of four populations (G1, G2, G3, and G4) have been taken and the data is given,
Write R commands to test the hypothesis that means of the four populations are equal (using a
significance level of 5%)? (10)
3,9,13,10,8,10,12,8,18,14,13,11,15,12,17,19,13,17,15,16,17,18,20,
22,25,23,22,25,26,29,30,31,32,33,27,26,28,29,26,24,23,22,21,20,18
Write R commands to compute: length, sum, mean, median, 90th percentile, variance, standard deviation and
product of the vector containing these observations (20)
X = 34.46,34.6,35.38,35.85,35.68,35.35,35.04,34.07,32.2,34.32,31.08
Y = 34.14,34.85,35.89,33.53,33.79,34.72,35.22,36.5,37.6,37.89,37.71
(i) population variances are equal against the alternative that they are not equal. (10)
(ii) population means are equal against the alternative that they are not equal. (10)
Question # 4 (b): For a binomial random variable X with parameters n 12 and P 0.7 , write R command(s) to
compute to give results: (10)
Question # 4 (b): Write an R function/programme that takes a vector as input and returns Range and Coefficient of
Range as output (the function must work for vector of any length). (10)
Question # 5 (a): Write an R function/programme that takes a vector as input and returns its Geometric mean as output
(the function must work for vector of any length). (10)
Question # 5 (b): Write an R function/programme that takes a vector as input and returns Coefficient of variation as
output (the function must work for vector of any length). (10)