Question

In: Statistics and Probability

A = (1 −7 5 0 0 10 8 2 2 4 10 3 −4 8...

A =
(1 −7 5 0

0 10 8 2

2 4 10 3

−4 8 −9 6)

(1) Count the number of rows that contain negative components.
(2) Obtain the inverse of A and count the number of columns that contain even number of positive components.
(3) Assign column names (a,b,c,d) to the columns of A.
(4) Transform the matrix A into a vector object a by stacking rows.
(5) Replace the diagonal components of A with (0,0,2,3). Hint: use a “diag” function

Solutions

Expert Solution

> A = matrix(c(1,0,2,-4,-7,10,4,8,5,8,10,-9,0,2,3,6),ncol=4,nrow=4);A
[,1] [,2] [,3] [,4]
[1,] 1 -7 5 0
[2,] 0 10 8 2
[3,] 2 4 10 3
[4,] -4 8 -9 6
1) number of rows that contain negative components --

> B = A[-2:-3, ]
> B
[,1] [,2] [,3] [,4]
[1,] 1 -7 5 0
[2,] -4 8 -9 6
> nrow(B)
2
2) number of columns that contain even number of positive components --

inverse = solve(A);inverse
[,1] [,2] [,3] [,4]
[1,] -0.49921753 -0.4765258 0.53364632 -0.107981221
[2,] -0.11580595 0.0258216 0.02034429 -0.018779343
[3,] 0.13771518 0.1314554 -0.07824726 -0.004694836
[4,] 0.02816901 -0.1549296 0.21126761 0.112676056
> count = inverse[ ,1:3]
> ncol(count)
3
3) Assign column names (a,b,c,d) to the columns of A --

> colnames(A)=c('a','b','c','d')
> A
a b c d
[1,] 1 -7 5 0
[2,] 0 10 8 2
[3,] 2 4 10 3
[4,] -4 8 -9 6
4) matrix A into a vector object a by stacking rows --

> as.vector(A)
[1] 1 0 2 -4 -7 10 4 8 5 8 10 -9 0 2 3 6
5) Replace the diagonal components of A with (0,0,2,3) --

> diag(A)<-c(0,0,2,4)
> A
a b c d
[1,] 0 -7 5 0
[2,] 0 0 8 2
[3,] 2 4 2 3
[4,] -4 8 -9 4


Related Solutions

Given: x y -5 1 -4 5 -3 4 -2 7 -1 10 0 8 1...
Given: x y -5 1 -4 5 -3 4 -2 7 -1 10 0 8 1 9 2 13 3 14 4 13 5 18 What are the confidence limits (alpha = 0.05) for the true mean value of Y when X = 3?
DATA 3 8 2 15 2 2 0 0 4 5 2 7 0 1 5...
DATA 3 8 2 15 2 2 0 0 4 5 2 7 0 1 5 3 0 2 5 4 1 6 9 5 3 1 2 10 6 1 1 2 1 19 6 6 6 7 0 4 1 1 1 0 1 9 2 2 2 1 16 10 10 5 2 3 1 4 4 4 3 6 2 8 5 2 7 1 6 4 0 3 1 1 1 Background: A group of...
Period   0 1 2 3 4 5 6 7 8 9 10 11 PBP NPV IRR...
Period   0 1 2 3 4 5 6 7 8 9 10 11 PBP NPV IRR Project A $                       (1,000,000) $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 400,000 Project B $                       (1,000,000) $ 500,000 $ 500,000 $ 500,000 Project C $                             (80,000) $      1,040 $      9,456 $    11,405 $    18,567 $    47,453 $      6,394 $    45,727 $    51,933 $    85,625 Project D $                           (400,000) $      4,161...
Input Data Month 0 1 2 3 4 5 6 7 8 9 10 11 12...
Input Data Month 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Revenue $             -   $            -   $            -   $        -   $        -   $         -   $    2,500 $    2,875 $    3,306 $    3,802 $    4,373 $    5,028 $    5,783 $    6,650 $    7,648 $      8,795 $   10,114 $   11,631 $   13,376 $   15,382 $   17,689 $   20,343 $   23,394 $   26,903 Monthly Revenue Growth...
Input Data Month 0 1 2 3 4 5 6 7 8 9 10 11 12...
Input Data Month 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 Revenue $             -   $            -   $            -   $        -   $        -   $         -   $    2,500 $    2,875 $    3,306 $    3,802 $    4,373 $    5,028 $    5,783 $    6,650 $    7,648 $      8,795 $   10,114 $   11,631 $   13,376 $   15,382 $   17,689 $   20,343 $   23,394 $   26,903 Monthly Revenue Growth...
Period   0 1 2 3 4 5 6 7 8 9 10 11 PBP NPV IRR...
Period   0 1 2 3 4 5 6 7 8 9 10 11 PBP NPV IRR Project A $                       (1,000,000) $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 200,000 $ 400,000 Project B $                       (1,000,000) $ 500,000 $ 500,000 $ 500,000 Project C $                             (80,000) $      1,040 $      9,456 $    11,405 $    18,567 $    47,453 $      6,394 $    45,727 $    51,933 $    85,625 Project D $                           (400,000) $      4,161...
Q 0 1 2 3 4 5 6 7 8 TC 10 18 24 30 38...
Q 0 1 2 3 4 5 6 7 8 TC 10 18 24 30 38 50 66 91 120 AC 18 12 10 9.5 10 11 13 15 MC 8 6 6 8 12 16 25 29 TR 16 32 48 64 80 96 112 128 MR 16 16 16 16 16 16 16 16 A perfectly competitive TV production firm in Lost Angeles faces the above short-run cost schedule. The price per unit of output is £16. a)...
x (Bins) frequency 0 0 1 0 2 0 3 2 4 5 5 8 6...
x (Bins) frequency 0 0 1 0 2 0 3 2 4 5 5 8 6 13 7 33 8 42 9 66 10 77 11 105 12 103 13 110 14 105 15 84 16 70 17 51 18 40 19 27 20 27 21 15 22 5 23 7 24 2 25 2 26 1 27 0 28 0 29 0 30 0 (7) On the Histogram worksheet, calculate all frequencies of the distribution using the table shown....
MATLAB: Matrix M = [ 0 2 3 5; 7 3 8 4 ] Write one...
MATLAB: Matrix M = [ 0 2 3 5; 7 3 8 4 ] Write one command that stores all of the rows of columns 1, 2, and 3 of M into a matrix named M2.
Find regression line for the data X 0   1   2   3    4   5   6   7  8          &nbsp
Find regression line for the data X 0   1   2   3    4   5   6   7  8               [3 MARKS] Y 11 21 31 41 51 61 71 81 91 b. X  0   2   4   6   8  10                            [3 MARKS]       Y  12 15 17 18 20 22
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT