Starting from:

$25

STAT40001_59800 - Hw1 -Solved

Q.N. 1) Calculate the following numerical results to the three decimal places

 a) ln3 + √2sin(π) − e3

b)  

c)   ln5÷− exp(2) + 2× −√       −

d)  (9  2)           4             10 + ln6              exp(1)

e)   log14 + ln14 + (47mod 5)

Q.N. 2) Create the following vectors using rep function:

V1= 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5

V2= 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4 5 5 5 5

V3= MATH, MATH, STAT, STAT, STAT, STAT, STAT, ECE, ECE, ECE, BIO, BIO

Q.N. 3) An article entitled ”What Does It Take to Heat a New Room? Estimating Utility Demand in a Home” by Robert Carver was published in the Journal of Statistics Education v.6, n.1 (1998). It has been observed that in a residential home, energy consumption is closely related to the outdoor temperature and size of the house. The date collected for this study are provided in the link below:

http://jse.amstat.org/datasets/utility.dat.txt

a)Import the data in R

b)How many variables are included in this dataset?

c)The missing values in this dataset are denoted by ∗. Please create a clean dataset by removing the missing vales.

Q.N. 4)The Fibonacci sequence is a famous sequence in mathematics. The first two elements are defined as [1, 1]. Subsequent elements are defined as the sum of the preceding two elements. For example, the third element is 2 (= 1+1), the fourth element is 3 (= 1+2), the fifth element is 5 (= 2+3), and so on.Print first 50 Fibonacci numbers.

Hint: To obtain the first 10 Fibonacci numbers in R, we can use

> Fibonacci <- numeric(10)

> Fibonacci[1] <- Fibonacci[2] <- 1

> for (i in 3:10) Fibonacci[i] <- Fibonacci[i - 2] + Fibonacci[i - 1] > Fibonacci

1

Q.N. 5) Use R to solve the following system of equations:

2x1 + x2 + x3− 3x4 + x5
= 12
x1− x2 + 2x3 + x4− x5
= 1
2x1 + x2− x3 + 2x4 + x5
= −2
x1− 3x2 + x3 + 2x4− x5
= −9
x1 + 2x2− x3 + 3x4− x5
= 0
Q.N. 6) Create the following matrix (M) with the column and row names (Note that the numbers are in sequence from 1 to 20)

>M column-1 column-2 column-3 column-4 column-5

Experiment.1
1
5
9
13
17
Experiment.2
2
6
10
14
18
Experiment.3
3
7
11
15
19
Experiment.4
4
8
12
16
20
a)   Determine the dimension of the matrix M

b)   Select the first two row of the matrix M

c)    Calculate the sum of all columns of the matrix M

d)   Calculate the sum of all rows of the matrix M

e)   Use “sample” to shuffle the elements of each row of the matrix M

Q.N. 7) Test scores of Fifteen students in Test 1 and Test 2 are presented below

S.N.
Test 1
Test2
1
56
86
2
78
67
3
87
78
4
89
89
5
95
87
6
98
67
7
NA
94
8
78
78
9
87
81
10
98
83
11
54
78
12
89
NA
13
78
93
14
98
98
15
97
100
a)   How many students have their test 1 score greater than 80 ?

b)  How many students have their test 2 score greater than 85 ?

2

c)   Did all fifteen students take both tests?

d)  How many students did better in the second test than the first test?

e)   How many students have the same score in the first and second test?


More products