0

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.

Jim
  • 93
  • 7
  • Welcome, Jim! Do you perhaps mean mvBeta[rating_,x_,R_]:=densityProduct[rating,x]*mvnCopula[copulaInput[rating,x],R], noting this: http://mathematica.stackexchange.com/a/18487/8 ? And what sort of input is x? Random real numbers? Some other distirbution? – Verbeia Dec 02 '14 at 05:25
  • This is just a guess without more information, but something using Map (/@) is probably what you want: mvBeta[rating,#,r]&/@ xvector. – Verbeia Dec 02 '14 at 05:31
  • 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 – Jim Dec 02 '14 at 05:58
  • xvector = RandomReal[{0,1},100] ? – Verbeia Dec 02 '14 at 06:10

1 Answers1

1

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.

Verbeia
  • 34,233
  • 9
  • 109
  • 224
  • 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? – Jim Dec 02 '14 at 06:41
  • http://reference.wolfram.com/language/ref/MultinormalDistribution.html RandomVariate[MultinormalDistribution[parameters],numberofiterates] – Verbeia Dec 02 '14 at 06:54
  • 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. – Jim Dec 02 '14 at 06:57