Question: First, create a $ 1 0 , 0 0 0 times 1 0 0 $ matrix called * * mymat * * using a

First, create a $10,000\times 100$ matrix called **mymat** using a `for()` loop, where the `rbinom(100,1,0.5)` line of code is used 10,000 times to populate each row of the matrix. (You are filling in a whole row of the matrix all at once with the above line of code.) Next, using another `for()` loop (or the same `for()` loop), create a vector `x`, where each component of `x` is the mean of the corresponding row of the matrix. Notice that calculating the mean of each row will give you the proportion of 1s in that row. Then make a histogram of the `x` vector. Do not print the matrix or the vector or else you will get very long output in your output pdf file.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!