Tag Info

New answers tagged

4

I have just had a brief look. The Morgenstern copula is defined as: $$C = F G \big(1+\alpha(1-F)(1-G) \big)$$ In your manual set-up, you set $\alpha = 3 \rho$. In your automated set-up, you tell Mma to set $\alpha = \rho$ ... You type: FGM[μ, σ, ρ, λ] (rather than say: FGM[μ, σ, 3 ρ, λ] ) You then note that the simulated result is out by a factor ...


1

p = Table[, {3}]; (* 3 is the number of 'special' permutations. Note that this number cannot be greater than the number of unique elements of l *) p[[1]] = RandomSample[l]; For[i = 2, i <= Length[p], i++, p[[i]] = p[[1]]; Do[ p[[i, j]] = RandomChoice[Complement[l, Table[p[[k, j]], {k, i - 1}]]], {j, Length[l]}] ] This seems to be a method ...


0

Not sure this is any useful, but this generates the 3 permutations and then check if the condition is met. Otherwise it starts again. NestWhile[ Table[RandomSample[l], {3}] &, Table[RandomSample[l], {3}], !VectorQ[ #, Length[DeleteDuplicates[#]] === 3 & ] & ]


1

EDIT: added capability for including negative numbers as part of a positive sum or positive numbers as part of a negative sum. random[sum_, nbrElements_, init_: 0] := Module[{list = RandomReal[{init, 1}, nbrElements]}, sum*list/Total[list]]; list1 = random[2, 5] {0.0325747, 0.251624, 0.67988, 0.876599, 0.159322} Total[list1] 2. list2 = ...


0

As pointed out by @b.gatessucks, that constraint means that you only need a single random number. If you need a single pair {2 - #, #} & @ RandomReal[{0.5, 1.5}, WorkingPrecision -> 2] of for many {2 - #, #} & /@ RandomReal[{0.5, 1.5}, 10, WorkingPrecision -> 2] {{0.6, 1.4}, {1.45, 0.55}, {0.6, 1.4}, {1.0, 1.0}, {1.05, 0.95}, {1.07, ...



Top 50 recent answers are included