Here are the first two questions im stuck on, sorry for the poor formatting. pm me if you can help! it will definitely be appreciated. I'm mostly confused as to how to code the probability mass function for the distribution. there are 2-3 more problems, should be really easy for some of you.
1.R lets you create new functions using the followingbasicsyntax:name <-function(arg.1, arg.2,..., arg.n){what the functiondoes}Where theargterms are arguments that the function takes. To see a complete example, supposethat R did not already have thefunctionmean()to give themean of the entries in a vector. Wecould code up such a function, which we will callavg()to keep them distinct, as follows:avg<-function(x){sum(x) / length(x)}Thesum()function adds up all the entries in a vector and thelength()function gives the lengthof a vector. Hence,ifxis a vector,sum(x) / length(x)gives the mean of the entries inx. Nowthat you know how to create a new function in R, use thechoose()function to create aprobability mass functionfor themultivariatehypergeometricdistribution.Your function shouldhavethreearguments.Call your functionmult.hyper, and then use the functionmult.hyper()to solve Problem #2 below.
2.There are four suits of 13 cards each in astandard deck of playing cards: hearts, spades,diamonds, and clubs.Each suit has cards numbered one (ace) through ten and three face cards:jack, queen, and king. In the game of hearts, each of four players is dealt a 13-card hand.What isthe probability of drawing six hearts, five spadesincluding the queen, one diamond, and one clubin a single hand?Set up the problem by hand and then give theR output.