R-Practical questions-Sem-IV
R-Practical questions-Sem-IV
(SEM-IV)
COURSE: COMPUTER ORIENTED STATISTICAL TECHNIQUES PRCATICAL
2. Write a program in R to create two matrices A and B of order 3 X 3 and perform the following
operations:
a) Add matrices A and B
b) Multiply matrices A and B
c) Find the inverse of matrix A
d) Find the inverse of matrix B
e) Find the transpose of matrix B
3. A random sample of 33 individuals who listen to talk radio was selected and the hours per week that
each listens to talk radio was determined. The data are as follows.
9 8 7 4 8 6 8 8 7 10 8 10 6 7 7 8 9 6 5 8 5 6 8 7 8 5 5 8 7 6 6 4 5
Test the null hypothesis using R that μ = 5 hours (h) versus the alternative hypothesis that μ ≠ 5 at
level of significance α = 0.05 in the following three equivalent ways:
(a) Compute the value of the test statistic and compare it with the critical value for α = 0.05
(b) Compute the p-value corresponding to the computed test statistic and compare the p-value with
α = 0.05.
(c) Compute the 1 - α = 0.95 confidence interval for μ and determine whether 5 falls in this
interval.
4. A car travels 25 miles at 25 miles per hour (mi/h), 25 miles at 50 mph, and 25 miles at 75 mph.
Write a program to find the arithmetic mean of the three velocities and the harmonic mean of the three
velocities. Which is correct?
5. Enter the following details of wages of 65 employees at the ABC Ltd. In Excel
26000-26999 10
27000-27999 16
28000-28999 14
29000-29999 10
30000-30999 5
31000-31999 2
Total 65
6. Enter the following table of three distributions f1, f2 and f3 for the variable X in EXCEL.
X f1 f2 f3
0 10 1 1
1 5 2 2
2 2 14 2
3 2 2 5
4 1 1 10
Import the data in R and write and program to find Pearson’s first and second coefficients of skewness.
7. Suppose the number of games in which major league baseball players play during their careers is
normally distributed with mean equal to 1500 games and standard deviation equal to 350 games. Use R
to solve the following problems.
(a) What percentage play in fewer than 750 games?
(b) What percentage play in more than 2000 games?
(c) Find the 90th percentile for the number of games played during a career.
8. The time spent watching TV per week by middle-school students has a normal distribution with mean
20.5 hours and standard deviation 5.5 hours. Use R to find the percent who watch less than 25 hours per
week. Use R to find the percent who watch over 30 hours per week. Sketch a curve representing these
two groups using R or Excel.
10. Enter the following table which shows the heights (H) to the nearest inch (in) and the weights(W) to the
nearest pound (lb) of a sample of 12 male students drawn at random from the first-year students at
College.
H 70 63 72 60 66 70 74 65 62 67 65 68
W 155 150 180 135 156 168 178 160 132 145 139 152
Import the data in R and write a program to fit a least squares line using
a) H as the independent variable
b) H as dependent variable
12. Many casinos use card-dealing machines to deal cards at random. Occasionally, the machine is tested to
ensure an equal likelihood of dealing for each suit. To conduct the test, 1,500 cards are dealt from the
machine, while the number of cards in each suit is counted. Theoretically, 375 cards should be dealt
from each suit. But this is not the case as shown in the following table:
Spade Diamond Club Heart
Observed 402 358 273 467
Enter the data in Excel. Import the date in R and write a program using chi-square test to determine if
the discrepancies are significant. If the discrepancies are significant, then the game would not be fair.
13. Business owner had been working to improve employee relations in his company. He predicted that he
met his goal of increasing employee satisfaction from 65% to 80%. Employees from four departments
were asked if they were satisfied with the working conditions of the company. The results are shown in
the following table:
Finance Sales HR Technology
Satisfied 12 38 5 8
Dissatisfied 7 19 3 1
Total 19 57 8 9
Enter the data in Excel. Import the date from Excel to R and write a program suing chi-square test to
determine whether the results support or reject the business owner's prediction.