0
$\begingroup$

I am going through an old research paper and I am stuck in one area of the coding. I'll spare you with most of the details but the function I want to simulate from is a complicated multivariate beta function that looks like:

mvBeta[rating_,x_,R_]:=densityProduct[rating,x]*mvnCopula[copulaInput[rating,x],R]

So clearly, I've already defined other functions. I know that I need to input rating and R. However, I would like perform a monte carlo simulation to obtain vectors of x.

Any help would be greatly appreciated.

$\endgroup$
  • $\begingroup$ Welcome, Jim! Do you perhaps mean mvBeta[rating_,x_,R_]:=densityProduct[rating,x]*mvnCopula[copulaInput[rating,x],R], noting this: mathematica.stackexchange.com/a/18487/8 ? And what sort of input is x? Random real numbers? Some other distirbution? $\endgroup$ – Verbeia Dec 2 '14 at 5:25
  • $\begingroup$ This is just a guess without more information, but something using Map (/@) is probably what you want: mvBeta[rating,#,r]&/@ xvector. $\endgroup$ – Verbeia Dec 2 '14 at 5:31
  • $\begingroup$ input for x is random real numbers in the[0,1] interval. I am not sure how the map is going to work because I do not have a xvector. Rather, I want to simulate this vector just given rating and R $\endgroup$ – Jim Dec 2 '14 at 5:58
  • $\begingroup$ xvector = RandomReal[{0,1},100] ? $\endgroup$ – Verbeia Dec 2 '14 at 6:10
1
$\begingroup$

Based on the comments appended to the question, I believe that what you are looking for is:

mvBeta[myrating, #, myR] & /@ RandomReal[{0,1},100]

where you can change 100 to be any length vector you like, and myrating and myR have already been defined.

$\endgroup$
  • $\begingroup$ Hmm. This might work but now it gives me an error in another place. Would you know how to generate a vector of multivariate standard normals that must have a given correlation matrix? $\endgroup$ – Jim Dec 2 '14 at 6:41
  • $\begingroup$ reference.wolfram.com/language/ref/MultinormalDistribution.html RandomVariate[MultinormalDistribution[parameters],numberofiterates] $\endgroup$ – Verbeia Dec 2 '14 at 6:54
  • $\begingroup$ Thank you. I understand I need to use the MultinormalDistribution function. However, I am not sure how to make it so that my vector of standard normals have a given correlation matrix, say R. $\endgroup$ – Jim Dec 2 '14 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.