question archive Initialize a data frame named my_binom_stats with 18 rows and 2 columns

Initialize a data frame named my_binom_stats with 18 rows and 2 columns

Subject:StatisticsPrice: Bought3

Initialize a data frame named my_binom_stats with 18 rows and 2 columns.

Name the first column y and the second column pdf_y. Set the first column, y, to the possible outcomes from a Binom(size=17,prob=0.83)
Binom(size=17,prob=0.83) (BE CAREFUL WITH THIS STEP!), and fill pdf_y using the appropriate stats package function.


Initialize a second, empty data frame named my_binom_loops with 18 rows and 2 columns. Name the first column y and the second column pdf_y. Then, using nested loops:
1)Iterate over the 18 rows.
2)Iterate over the 2 columns
 3)IF the inner loop is on the first column, add the appropriate number to the y column.
• OTHERWISE, fill pdf_y using the appropriate stats package function.




Finally, use the all_equal() function (from the dplyr package) to confirm that the my_binom_stats and the my_binom_loops data frames are equivalent.


This question uses R

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE