d2jsp
Log InRegister
d2jsp Forums > Off-Topic > General Chat > Homework Help > Need Help With Some Easy Stats/math > Using The Program "r"
Add Reply New Topic New Poll
Member
Posts: 23,337
Joined: Nov 2 2006
Gold: 7,528.30
Dec 10 2013 06:41pm
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.
Member
Posts: 14,433
Joined: Oct 14 2013
Gold: Locked
Trader: Scammer
Dec 10 2013 06:43pm
this seems pretty like it would be pretty esoteric to most people...i think you're better off using your own knowledge and asking your teacher for help.
Member
Posts: 23,337
Joined: Nov 2 2006
Gold: 7,528.30
Dec 10 2013 06:45pm
Quote (JDota72 @ Dec 10 2013 06:43pm)
this seems pretty like it would be pretty esoteric to most people...i think you're better off using your own knowledge and asking your teacher for help.


oh ok. well basically you're just mechanically defining the probability mass function in the program. I know the "syntax", but not the actual math.
Go Back To Homework Help Topic List
Add Reply New Topic New Poll