0% found this document useful (0 votes)
3 views5 pages

Week7 Assignment

The document outlines a course on R Software, focusing on data frames, statistical functions, and data management techniques. It includes various assignments and questions related to R commands for statistical analysis, such as calculating frequencies, quantiles, histograms, and handling missing data. The document serves as a guide for students to practice and apply their knowledge of R through practical exercises.

Uploaded by

neeru572010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views5 pages

Week7 Assignment

The document outlines a course on R Software, focusing on data frames, statistical functions, and data management techniques. It includes various assignments and questions related to R commands for statistical analysis, such as calculating frequencies, quantiles, histograms, and handling missing data. The document serves as a guide for students to practice and apply their knowledge of R through practical exercises.

Uploaded by

neeru572010
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

29/12/2017 Introduction to R Software - - Unit 8 - Week 7 - Data frames, import of external data in various file formats, statistical fu…

Unit 8 - Week 7 - Data frames, import of external data in


various file formats, statistical functions, compilation of data.

Course
outline Assignment 7
.
How to access the
portal

Week - 1 - Basic 1) Suppose a die is rolled 10 times and following numbers on the upper face are recorded: 1 point
fundamentals, 4,5,5,1,2,1,1,6,3,1. Which one of the following is the correct command to obtain the absolute frequencies of this
installation and data in R?
use of software,
data editing, use of table(c(4,5,5,1,2,1,1,6,3,1))
R as a calculator,
table(4,5,5,1,2,1,1,6,3,1)
functions and
assignments. table(c(4,5,5,1,2,1,1,6,3,1))/length(c(4,5,5,1,2,1,1,6,3,1))
table(4,5,5,1,2,1,1,6,3,1)/length(4,5,5,1,2,1,1,6,3,1)
Week 2 - Use of R
as a calculator,
functions and
matrix operations,
missing data and Accepted Answers:
logical operators. table(c(4,5,5,1,2,1,1,6,3,1))

2) Suppose a die is rolled 21 times and following numbers on the upper face are recorded: 1 point
Week 3 -
5,4,6,5,3,3,5,1,4,4,2,1,5,5,6,3,1,1,2,1,1. Which one of the following is the correct outcome of the following
Conditional
executions and command in R?
loops, data table(c(5,4,6,5,3,3,5,1,4,4,2,1,5,5,6,3,1,1,2,1,1)) ?
management with
sequences.
1 2 3 4 5 6
Week 4 - Data 0.6 0.2 0.3 0.3 0.5 0.2
management with
repeats, sorting,
ordering, and lists 0.6 0.2 0.3 0.3 0.5 0.2
1 2 3 4 5 6
Week 5 - Vector
indexing, factors,
Data management 1 2 3 4 5 6
with strings, 6 2 3 3 5 2
display and
formatting.
6 2 3 3 5 2
Week 6 - Data 1 2 3 4 5 6
management with
display paste,
split, find and
replacement,
manipulations with Accepted Answers:
alphabets, 1 2 3 4 5 6
evaluation of
strings, data 6 2 3 3 5 2
frames.
3) Which one of the following is the correct command to obtain the 3rd, 5th and 7th deciles of a data 1 point
vector x in R?
Week 7 - Data
frames, import of
external data in decile(x, probs=c(30%,70%,90%))
various file decile(x, probs=(0.30,0.70,0.90))
formats, statistical quantile(x, probs=(30%,70%,90%))
functions,

https://onlinecourses.nptel.ac.in/noc17_ma17/unit?unit=29&assessment=57 1/5
29/12/2017 Introduction to R Software - - Unit 8 - Week 7 - Data frames, import of external data in various file formats, statistical fu…
compilation of quantile(x, probs=c(0.30,0.50,0.70))
data.

Lecture 35 :
Statistical
Functions : Accepted Answers:
Frequency and quantile(x, probs=c(0.30,0.50,0.70))
Partition values
4) Which one of the following correctly specify the quantiles of a data vector marks obtained as an 1 point
Lecture 36 :
outcome of the command quantile(marks, probs = seq(0, 1, 0.20)) in R?
Statistical
Functions -
0th, 20th, 100th
Graphics and
Plots 0th, 20th, 40th, 60th, 80th, 100th

Lecture 37 :
0th, 25th, 50th, 75th, 100th
Statistical None of these
Functions -
Central Tendency
and Variation

Lecture 38 : Accepted Answers:


Statistical 0th, 20th, 40th, 60th, 80th, 100th
Functions -
Boxplots, 5) Suppose a die is rolled 10 times and following numbers on the upper face are recorded: 1 point
Skewness and 4,5,5,1,2,1,1,6,3,1. Which of the following command in R is used to obtain the bar plot of this data based on
Kurtosis relative frequencies?
Quiz : Assignment
7 barplot(4,5,5,1,2,1,1,6,3,1)/length(4,5,5,1,2,1,1,6,3,1)
barplot(table(4,5,5,1,2,1,1,6,3,1)/length(4,5,5,1,2,1,1,6,3,1))
New Lesson
barplot(c(4,5,5,1,2,1,1,6,3,1))/length(c(4,5,5,1,2,1,1,6,3,1)))
Assignment-7
barplot(table(c(4,5,5,1,2,1,1,6,3,1))/length(c(4,5,5,1,2,1,1,6,3,1)))
Solution

Week 8 - Graphics
and plots,
statistical Accepted Answers:
functions for barplot(table(c(4,5,5,1,2,1,1,6,3,1))/length(c(4,5,5,1,2,1,1,6,3,1)))
central tendency,
variation, 6) Suppose the ages of 15 children (in completed years) are recorded as follows: 1 point
skewness and 14,15,16,15,15,15,11,12,12,14,11,11,16,13,12. Which one of the following command is used to obtain the
kurtosis, handling histogram of this data in R based on absolute frequencies?
of bivarite data
through graphics,
histo(c(14,15,16,15,15,15,11,12,12,14,11,11,16,13,12))
correlations,
programming and hist(c(14,15,16,15,15,15,11,12,12,14,11,11,16,13,12))
illustration with hist(table(14,15,16,15,15,15,11,12,12,14,11,11,16,13,12))
examples.
histogram(c(14,15,16,15,15,15,11,12,12,14,11,11,16,13,12))

Accepted Answers:
hist(c(14,15,16,15,15,15,11,12,12,14,11,11,16,13,12))

7) Suppose the oil produced every day by 20 different refineries (in thousand liters) is recorded as 1 point
follows: 820, 184, 921, 488, 721, 614, 801, 396, 864, 845, 404, 781, 457, 1029, 1047, 552, 718, 495, 382, 345.
Which one of the following is the correct command to obtain the histogram of this data in R based on relative
frequencies?

hist(c(820,184,921,488,721,614,801,396,864,845,404,781,457,1029,1047,552,718,495,382,345),
freq=FALSE)
hist(c(820,184,921,488,721,614,801,396,864,845,404,781,457,1029,1047,552,718,495,382,345),
freq=TRUE)
hist((820,184,921,488,721,614,801,396,864,845,404,781,457,1029,1047,552,718,495,382,345),
freq=FALSE)

hist(table(820,184,921,488,721,614,801,396,864,845,404,781,457,1029,1047,552,718,495,382,345),freq=FAL

Accepted Answers:
hist(c(820,184,921,488,721,614,801,396,864,845,404,781,457,1029,1047,552,718,495,382,345),
freq=FALSE)

8) Suppose the number of members in 5 households is recorded but one observation gets missing as 1 point
follows: 4,5,8,6,NA. Which one of the following is the correct command to obtain the geometric mean of this data

https://onlinecourses.nptel.ac.in/noc17_ma17/unit?unit=29&assessment=57 2/5
29/12/2017 Introduction to R Software - - Unit 8 - Week 7 - Data frames, import of external data in various file formats, statistical fu…
in R?

prod(c(4,5,8,6,NA),na.rm=TRUE)^(1/length(c(4,5,8,6,NA),na.rm=TRUE))
prod(c(4,5,8,6,NA),na.rm=TRUE)^(1/length(c(4,5,8,6,NA)))
prod(c(4,5,8,6))^(1/length(c(4,5,8,6,NA),na.rm=TRUE))
None of these

Accepted Answers:
None of these

9) Suppose the daily room rents of 10 hotels in rupees are recorded and two observations are missing 1 point
as follows: 380,683,NA,456,559,878,NA,897,893,765. Which one of the following is the correct command to
obtain the product of this data in R?

prod(c(380,683,NA,456,559,878,NA,897,893,765),na.rm=true)
prod((380,683,NA,456,559,878,NA,897,893,765),na.rm=TRUE)
prod(c(380,683,NA,456,559,878,NA,897,893,765), na.rm=TRUE)
product(c(380,683,NA,456,559,878,NA,897,893,765),na.rm=T)

Accepted Answers:
prod(c(380,683,NA,456,559,878,NA,897,893,765), na.rm=TRUE)

10)Suppose the number of students present in 5 class rooms are recorded as follows: 24,15,35,51,42. 1 point
Which one of the following is the correct command to obtain the harmonic mean of this data in R?

length(c(24,15,35,51,42))/mean(1/c(24,15,35,51,42))
length(c(24,15,35,51,42))/(1/mean(c(24,15,35,51,42)))
1/mean(1/(24,15,35,51,42))
1/mean(1/c(24,15,35,51,42))

Accepted Answers:
1/mean(1/c(24,15,35,51,42))

11)Suppose the per hour salary of salesperson in 10 different stores in a city is recorded and two 1 point
observations get missing as follows: 45,75,NA,68,69,57,61,NA,52,81. Which one of the following is the correct
command to obtain the median of this data in R?

median(c(45,75,NA,68,69,57,61,NA,52,81),na.rm=true)
median(c(45,75,NA,68,69,57,61,NA,52,81), na.rm=TRUE)
median((45,75,NA,68,69,57,61,NA,52,81),na.rm=TRUE)
median((45,75,NA,68,69,57,61,NA,52,81),na.rm=T)

Accepted Answers:
median(c(45,75,NA,68,69,57,61,NA,52,81), na.rm=TRUE)

12) Suppose the per day income of 12 persons (in rupees) are recorded and two observations are 1 point
missing as follows: 14514, 185, 415, 711, 212, NA, 771, 151, 616, NA, 913, 312. Which one of the following is
the correct command to obtain the standard deviation of this data in R?

sqrt(variance(c(14514,185,415,711,212,NA,771,151,616,NA,913,312),na.rm=TRUE))
sqrt(var((14514,185,415,711,212,NA,771,151,616,NA,913,312),na.rm=TRUE))
sqrt(var(c(14514,185,415,711,212,NA,771,151,616,NA,913,312), na.rm=TRUE))
sqrt(var(c(14514,185,415,711,212,NA,771,151,616,NA,913,312),na.rm=true))

Accepted Answers:
sqrt(var(c(14514,185,415,711,212,NA,771,151,616,NA,913,312), na.rm=TRUE))

https://onlinecourses.nptel.ac.in/noc17_ma17/unit?unit=29&assessment=57 3/5
29/12/2017 Introduction to R Software - - Unit 8 - Week 7 - Data frames, import of external data in various file formats, statistical fu…
13)Suppose the cost of servicing of 5 brands of cars (in thousand rupees) is recorded but one value gets1 point
missing as follows: 4,3,6,7,NA. Which one of the following is the correct command to obtain the range of this
data in R:

range(c(4,3,6,7,NA), na.rm=TRUE)
maximum(c(4,3,6,7,NA), na.rm=TRUE)-minimum(c(4,3,6,7,NA), na.rm=TRUE)
max(c(4,3,6,7,NA), na.rm=TRUE)-min(c(4,3,6,7,NA), na.rm=TRUE)
max[c(4,3,6,7,NA), na.rm=TRUE]-min[c(4,3,6,7,NA), na.rm=TRUE]

Accepted Answers:
max(c(4,3,6,7,NA), na.rm=TRUE)-min(c(4,3,6,7,NA), na.rm=TRUE)

14)Suppose the number of songs played on 10 channels of a radio in 3 hours time are recorded and two 1 point
observations are missing as follows: 14,15,NA,11,12,11,11,16,13,NA. Which one of the following is the correct
command to obtain the interquartile range of this data in R?

IQRange(c(14,15,NA,11,12,11,11,16,13,NA),na.rm=TRUE)
QR(c(14,15,NA,11,12,11,11,16,13,NA),na.rm=TRUE)
IQR[c(14,15,NA,11,12,11,11,16,13,NA),na.rm=TRUE]
IQR(c(14,15,NA,11,12,11,11,16,13,NA),na.rm=TRUE)

Accepted Answers:
IQR(c(14,15,NA,11,12,11,11,16,13,NA),na.rm=TRUE)

15)Suppose the ages of 5 cars in completed years are recorded as follows: 14,15,15,11,12. Which one 1 point
n
of the following is the correct command to obtain the mean absolute deviation (MD (x)= 1

n

i=1
) of this
∣ xi − x̄

data in R?

sum(abs((14,15,15,11,12)-mean((14,15,15,11,12))))/length((14,15,15,11,12))
sum(abs(c(14,15,15,11,12)-mean(c(14,15,15,11,12))))/length(c(14,15,15,11,12))
sum(absolute(c(14,15,15,11,12)-mean(c(14,15,15,11,12))))/length(c(14,15,15,11,12))
mean(abs(c(14,15,15,11,12)-mean(c(14,15,15,11,12))))/length(c(14,15,15,11,12))

Accepted Answers:
sum(abs(c(14,15,15,11,12)-mean(c(14,15,15,11,12))))/length(c(14,15,15,11,12))

16)Suppose the number of songs played on 10 channels of a radio in 3 hours time are recorded and two 1 point
observations are missing as follows: 14,15,NA,11,12,11,11,16,NA,12. Which one of the following is the correct
command to obtain the boxplot of this data in R?

boxplot[c[14,15,NA,11,12,11,11,16,NA,12], na.rm=TRUE]
boxplot((14,15,NA,11,12,11,11,16,NA,12), na.rm=TRUE)
boxplot(c(14,15,NA,11,12,11,11,16,NA,12), na.rm=TRUE)
None of these

Accepted Answers:
boxplot(c(14,15,NA,11,12,11,11,16,NA,12), na.rm=TRUE)

17) Suppose the number of songs played on 10 channels of a radio in 3 hours time are counted and two 1 point
observations are missing as follows: 14,15,NA,11,12,11,11,16,NA,12. Which one of the following is the correct
command to obtain the coefficient of skewness of this data in R?

skewness[c[14,15,NA,11,12,11,11,16,NA,12], na.rm=TRUE]
skewness(c(14,15,NA,11,12,11,11,16,NA,12), na.rm=TRUE)
skewness((14,15,NA,11,12,11,11,16,NA,12), na.rm=TRUE)
None of these

Accepted Answers:
skewness(c(14,15,NA,11,12,11,11,16,NA,12), na.rm=TRUE)

https://onlinecourses.nptel.ac.in/noc17_ma17/unit?unit=29&assessment=57 4/5
29/12/2017 Introduction to R Software - - Unit 8 - Week 7 - Data frames, import of external data in various file formats, statistical fu…
18)Suppose the share rates (in rupees) of 10 companies on a day in a stock exchange are recorded as 1 point
follows: 514,615,185,191,152,311,116,168,163,512. Which one of the following is the correct command to obtain
the coefficient of kurtosis in R?

kurtosis(c(514,615,185,191,152,311,116,168,163,512))
kurt(c(514,615,185,191,152,311,116,168,163,512))
kurt(514,615,185,191,152,311,116,168,163,512)
kurtosis[c(514,615,185,191,152,311,116,168,163,512)]

Accepted Answers:
kurtosis(c(514,615,185,191,152,311,116,168,163,512))

19)Suppose the share rates (in rupees) of 10 companies on a day in a stock exchange are recorded 1 point
and one observations gets missing as follows: 514,615,185,191,152,311,NA,168,163,512. Which one of the
following correctly specify the command to obtain the coefficient of kurtosis of this data in R and its obtained
value?

kurtosis(c(514,615,185,191,152,311,NA,168,163,512) na.rm=FALSE), 1.668406


kurtosis(c(514,615,185,191,152,311,NA,168,163,512) na.rm=TRUE), NA
kurtosis(c(514,615,185,191,152,311,NA,168,163,512) , na.rm=TRUE), 1.668406
None of these

Accepted Answers:
kurtosis(c(514,615,185,191,152,311,NA,168,163,512) , na.rm=TRUE), 1.668406

https://onlinecourses.nptel.ac.in/noc17_ma17/unit?unit=29&assessment=57 5/5

You might also like