Symbolic integration of logmultinormal distributionhow to simplify symbolic integrationSymbolic Definite IntegrationMultidimensional integral to compute the end-to-end distribution of a FENE ideal chainSymbolic integration conditional bug?Symbolic vs numerical integrationSymbolic Integration of definite integralUnable to integrate function using IntegrateFaster symbolic integrationContour integration with MathematicaHow to study the behavior of this series in Mathematica?

Does 5e follow the Primary Source rule?

Who would use the word "manky"?

I have found a mistake on someone's code published online: what is the protocol?

Why teach C using scanf without talking about command line arguments?

Three Subway Escalators

"This used to be my phone number"

When designing an adventure, how can I ensure a continuous player experience in a setting that's likely to favor TPKs?

BritRail England Passes compared to return ticket for travel in England

Null expletive objects in Latin? "Cariotae cum ficis certandum habent" (Plin. Ep. 1,8)

Which GPUs to get for Mathematical Optimization (if any)?

What could make large expeditions ineffective for exploring territory full of dangers and valuable resources?

What is the name for the average of the largest and the smallest values in a given data set?

Do medium format lenses have a crop factor?

We get more abuse than anyone else

Why aren't there any women super GMs?

Last-minute canceled work-trip mean I'll lose thousands of dollars on planned vacation

Making a Dataset that emulates `ls -tlra`?

How did J. J. Thomson establish the particle nature of the electron?

How long were the Apollo astronauts allowed to breathe 100% oxygen at 1 atmosphere continuously?

Improving an O(N^2) function (all entities iterating over all other entities)

Do pedestrians imitate auto traffic?

Why do jet engines sound louder on the ground than inside the aircraft?

Locked-up DOS computer beeped on keypress. What mechanism caused that?

Is encryption still applied if you ignore the SSL certificate warning for self-signed certs?



Symbolic integration of logmultinormal distribution


how to simplify symbolic integrationSymbolic Definite IntegrationMultidimensional integral to compute the end-to-end distribution of a FENE ideal chainSymbolic integration conditional bug?Symbolic vs numerical integrationSymbolic Integration of definite integralUnable to integrate function using IntegrateFaster symbolic integrationContour integration with MathematicaHow to study the behavior of this series in Mathematica?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2












$begingroup$


I have been trying to integrate and compute moments of LogMultinormalDistributionin Mathematica, but the integrals don't seem to evaluate. Say for the first moment, $langle x rangle $



Integrate[
PDF[LogMultinormalDistribution[
Subscript[μ, 1], Subscript[μ, 2],

Subscript[σ, 1]^2, Subscript[σ, 1] Subscript[σ, 2] ρ,
Subscript[σ, 1] Subscript[σ, 2] ρ, Subscript[σ, 2]^2

]
, x, y
]*x
, x, 0, Infinity
, y, 0, Infinity
]


I also tried typing out the PDF,



Integrate[(2*Pi*σx*σy Sqrt[1 - ρ^2])^-1*
Exp[-1/2*(1/(
1 - ρ^2)) (((Log[x] - μx)/σx)^2 -
2*ρ*((Log[x] - μx)/σx)*((
Log[y] - μy)/σy) + ((
Log[y] - μy)/σy)^2)]*x, x, 0, Infinity, y, 0, Infinity]


But no luck.



The integrals don't seem to evaluate and either I end up aborting them or the program seems to crash.



In general, I would like compute $langle x^n y^m rangle$ for bivariate log normal distribution in mathematica.



Is there a way to speed up the integrals/evaluate them at all.



I am running Mathematica 11.3 on Mac OS Mojave if that helps.










share|improve this question









New contributor



jcp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$











  • $begingroup$
    This may not be the problem, but in general you should avoid using Subscript while defining symbols (variables). Subscript[x, 1] is not a symbol, but a composite expression where Subscript is an operator without built-in meaning. You expect to do $x_1=2$ but you are actually doing Set[Subscript[x, 1], 2] which is to assign a DownValues to the operator Subscript and not an OwnValues to an indexed x as you may intend. Read how to properly define indexed variables here
    $endgroup$
    – rhermans
    9 hours ago










  • $begingroup$
    BTW, Welcome to Mma.SE. Start by taking the tour now and learning about asking and what's on-topic. Always edit if improvable, show due diligence, give brief context, include minimal working example of code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. The site depends on participation, as you receive give back: vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned.
    $endgroup$
    – rhermans
    9 hours ago










  • $begingroup$
    Thanks for the link to defining indexed variables. I will keep that in mind. removing the subscripts however, doesn't help either to be honest.
    $endgroup$
    – jcp
    9 hours ago






  • 1




    $begingroup$
    There is nothing wrong with using subscript notation with integration in Mma, provided you don't mix using $x$ and subscript $x$ (say $x_1$) in the same expression.
    $endgroup$
    – wolfies
    8 hours ago










  • $begingroup$
    @wolfies, I know you think that, you made your point in the Q&A I link, but many people disagree with that, including me. For a new user I think my advice is beneficial, there is nothing to gain and much to loose by using Subscript for anything other than display.
    $endgroup$
    – rhermans
    8 hours ago

















2












$begingroup$


I have been trying to integrate and compute moments of LogMultinormalDistributionin Mathematica, but the integrals don't seem to evaluate. Say for the first moment, $langle x rangle $



Integrate[
PDF[LogMultinormalDistribution[
Subscript[μ, 1], Subscript[μ, 2],

Subscript[σ, 1]^2, Subscript[σ, 1] Subscript[σ, 2] ρ,
Subscript[σ, 1] Subscript[σ, 2] ρ, Subscript[σ, 2]^2

]
, x, y
]*x
, x, 0, Infinity
, y, 0, Infinity
]


I also tried typing out the PDF,



Integrate[(2*Pi*σx*σy Sqrt[1 - ρ^2])^-1*
Exp[-1/2*(1/(
1 - ρ^2)) (((Log[x] - μx)/σx)^2 -
2*ρ*((Log[x] - μx)/σx)*((
Log[y] - μy)/σy) + ((
Log[y] - μy)/σy)^2)]*x, x, 0, Infinity, y, 0, Infinity]


But no luck.



The integrals don't seem to evaluate and either I end up aborting them or the program seems to crash.



In general, I would like compute $langle x^n y^m rangle$ for bivariate log normal distribution in mathematica.



Is there a way to speed up the integrals/evaluate them at all.



I am running Mathematica 11.3 on Mac OS Mojave if that helps.










share|improve this question









New contributor



jcp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$











  • $begingroup$
    This may not be the problem, but in general you should avoid using Subscript while defining symbols (variables). Subscript[x, 1] is not a symbol, but a composite expression where Subscript is an operator without built-in meaning. You expect to do $x_1=2$ but you are actually doing Set[Subscript[x, 1], 2] which is to assign a DownValues to the operator Subscript and not an OwnValues to an indexed x as you may intend. Read how to properly define indexed variables here
    $endgroup$
    – rhermans
    9 hours ago










  • $begingroup$
    BTW, Welcome to Mma.SE. Start by taking the tour now and learning about asking and what's on-topic. Always edit if improvable, show due diligence, give brief context, include minimal working example of code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. The site depends on participation, as you receive give back: vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned.
    $endgroup$
    – rhermans
    9 hours ago










  • $begingroup$
    Thanks for the link to defining indexed variables. I will keep that in mind. removing the subscripts however, doesn't help either to be honest.
    $endgroup$
    – jcp
    9 hours ago






  • 1




    $begingroup$
    There is nothing wrong with using subscript notation with integration in Mma, provided you don't mix using $x$ and subscript $x$ (say $x_1$) in the same expression.
    $endgroup$
    – wolfies
    8 hours ago










  • $begingroup$
    @wolfies, I know you think that, you made your point in the Q&A I link, but many people disagree with that, including me. For a new user I think my advice is beneficial, there is nothing to gain and much to loose by using Subscript for anything other than display.
    $endgroup$
    – rhermans
    8 hours ago













2












2








2





$begingroup$


I have been trying to integrate and compute moments of LogMultinormalDistributionin Mathematica, but the integrals don't seem to evaluate. Say for the first moment, $langle x rangle $



Integrate[
PDF[LogMultinormalDistribution[
Subscript[μ, 1], Subscript[μ, 2],

Subscript[σ, 1]^2, Subscript[σ, 1] Subscript[σ, 2] ρ,
Subscript[σ, 1] Subscript[σ, 2] ρ, Subscript[σ, 2]^2

]
, x, y
]*x
, x, 0, Infinity
, y, 0, Infinity
]


I also tried typing out the PDF,



Integrate[(2*Pi*σx*σy Sqrt[1 - ρ^2])^-1*
Exp[-1/2*(1/(
1 - ρ^2)) (((Log[x] - μx)/σx)^2 -
2*ρ*((Log[x] - μx)/σx)*((
Log[y] - μy)/σy) + ((
Log[y] - μy)/σy)^2)]*x, x, 0, Infinity, y, 0, Infinity]


But no luck.



The integrals don't seem to evaluate and either I end up aborting them or the program seems to crash.



In general, I would like compute $langle x^n y^m rangle$ for bivariate log normal distribution in mathematica.



Is there a way to speed up the integrals/evaluate them at all.



I am running Mathematica 11.3 on Mac OS Mojave if that helps.










share|improve this question









New contributor



jcp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$




I have been trying to integrate and compute moments of LogMultinormalDistributionin Mathematica, but the integrals don't seem to evaluate. Say for the first moment, $langle x rangle $



Integrate[
PDF[LogMultinormalDistribution[
Subscript[μ, 1], Subscript[μ, 2],

Subscript[σ, 1]^2, Subscript[σ, 1] Subscript[σ, 2] ρ,
Subscript[σ, 1] Subscript[σ, 2] ρ, Subscript[σ, 2]^2

]
, x, y
]*x
, x, 0, Infinity
, y, 0, Infinity
]


I also tried typing out the PDF,



Integrate[(2*Pi*σx*σy Sqrt[1 - ρ^2])^-1*
Exp[-1/2*(1/(
1 - ρ^2)) (((Log[x] - μx)/σx)^2 -
2*ρ*((Log[x] - μx)/σx)*((
Log[y] - μy)/σy) + ((
Log[y] - μy)/σy)^2)]*x, x, 0, Infinity, y, 0, Infinity]


But no luck.



The integrals don't seem to evaluate and either I end up aborting them or the program seems to crash.



In general, I would like compute $langle x^n y^m rangle$ for bivariate log normal distribution in mathematica.



Is there a way to speed up the integrals/evaluate them at all.



I am running Mathematica 11.3 on Mac OS Mojave if that helps.







calculus-and-analysis






share|improve this question









New contributor



jcp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.










share|improve this question









New contributor



jcp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








share|improve this question




share|improve this question








edited 8 hours ago









rhermans

23.3k4 gold badges42 silver badges107 bronze badges




23.3k4 gold badges42 silver badges107 bronze badges






New contributor



jcp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








asked 9 hours ago









jcpjcp

111 bronze badge




111 bronze badge




New contributor



jcp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




New contributor




jcp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.













  • $begingroup$
    This may not be the problem, but in general you should avoid using Subscript while defining symbols (variables). Subscript[x, 1] is not a symbol, but a composite expression where Subscript is an operator without built-in meaning. You expect to do $x_1=2$ but you are actually doing Set[Subscript[x, 1], 2] which is to assign a DownValues to the operator Subscript and not an OwnValues to an indexed x as you may intend. Read how to properly define indexed variables here
    $endgroup$
    – rhermans
    9 hours ago










  • $begingroup$
    BTW, Welcome to Mma.SE. Start by taking the tour now and learning about asking and what's on-topic. Always edit if improvable, show due diligence, give brief context, include minimal working example of code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. The site depends on participation, as you receive give back: vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned.
    $endgroup$
    – rhermans
    9 hours ago










  • $begingroup$
    Thanks for the link to defining indexed variables. I will keep that in mind. removing the subscripts however, doesn't help either to be honest.
    $endgroup$
    – jcp
    9 hours ago






  • 1




    $begingroup$
    There is nothing wrong with using subscript notation with integration in Mma, provided you don't mix using $x$ and subscript $x$ (say $x_1$) in the same expression.
    $endgroup$
    – wolfies
    8 hours ago










  • $begingroup$
    @wolfies, I know you think that, you made your point in the Q&A I link, but many people disagree with that, including me. For a new user I think my advice is beneficial, there is nothing to gain and much to loose by using Subscript for anything other than display.
    $endgroup$
    – rhermans
    8 hours ago
















  • $begingroup$
    This may not be the problem, but in general you should avoid using Subscript while defining symbols (variables). Subscript[x, 1] is not a symbol, but a composite expression where Subscript is an operator without built-in meaning. You expect to do $x_1=2$ but you are actually doing Set[Subscript[x, 1], 2] which is to assign a DownValues to the operator Subscript and not an OwnValues to an indexed x as you may intend. Read how to properly define indexed variables here
    $endgroup$
    – rhermans
    9 hours ago










  • $begingroup$
    BTW, Welcome to Mma.SE. Start by taking the tour now and learning about asking and what's on-topic. Always edit if improvable, show due diligence, give brief context, include minimal working example of code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. The site depends on participation, as you receive give back: vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned.
    $endgroup$
    – rhermans
    9 hours ago










  • $begingroup$
    Thanks for the link to defining indexed variables. I will keep that in mind. removing the subscripts however, doesn't help either to be honest.
    $endgroup$
    – jcp
    9 hours ago






  • 1




    $begingroup$
    There is nothing wrong with using subscript notation with integration in Mma, provided you don't mix using $x$ and subscript $x$ (say $x_1$) in the same expression.
    $endgroup$
    – wolfies
    8 hours ago










  • $begingroup$
    @wolfies, I know you think that, you made your point in the Q&A I link, but many people disagree with that, including me. For a new user I think my advice is beneficial, there is nothing to gain and much to loose by using Subscript for anything other than display.
    $endgroup$
    – rhermans
    8 hours ago















$begingroup$
This may not be the problem, but in general you should avoid using Subscript while defining symbols (variables). Subscript[x, 1] is not a symbol, but a composite expression where Subscript is an operator without built-in meaning. You expect to do $x_1=2$ but you are actually doing Set[Subscript[x, 1], 2] which is to assign a DownValues to the operator Subscript and not an OwnValues to an indexed x as you may intend. Read how to properly define indexed variables here
$endgroup$
– rhermans
9 hours ago




$begingroup$
This may not be the problem, but in general you should avoid using Subscript while defining symbols (variables). Subscript[x, 1] is not a symbol, but a composite expression where Subscript is an operator without built-in meaning. You expect to do $x_1=2$ but you are actually doing Set[Subscript[x, 1], 2] which is to assign a DownValues to the operator Subscript and not an OwnValues to an indexed x as you may intend. Read how to properly define indexed variables here
$endgroup$
– rhermans
9 hours ago












$begingroup$
BTW, Welcome to Mma.SE. Start by taking the tour now and learning about asking and what's on-topic. Always edit if improvable, show due diligence, give brief context, include minimal working example of code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. The site depends on participation, as you receive give back: vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned.
$endgroup$
– rhermans
9 hours ago




$begingroup$
BTW, Welcome to Mma.SE. Start by taking the tour now and learning about asking and what's on-topic. Always edit if improvable, show due diligence, give brief context, include minimal working example of code and data in formatted form. By doing all this you help us to help you and likely you will inspire great answers. The site depends on participation, as you receive give back: vote and answer questions, keep the site useful, be kind, correct mistakes and share what you have learned.
$endgroup$
– rhermans
9 hours ago












$begingroup$
Thanks for the link to defining indexed variables. I will keep that in mind. removing the subscripts however, doesn't help either to be honest.
$endgroup$
– jcp
9 hours ago




$begingroup$
Thanks for the link to defining indexed variables. I will keep that in mind. removing the subscripts however, doesn't help either to be honest.
$endgroup$
– jcp
9 hours ago




1




1




$begingroup$
There is nothing wrong with using subscript notation with integration in Mma, provided you don't mix using $x$ and subscript $x$ (say $x_1$) in the same expression.
$endgroup$
– wolfies
8 hours ago




$begingroup$
There is nothing wrong with using subscript notation with integration in Mma, provided you don't mix using $x$ and subscript $x$ (say $x_1$) in the same expression.
$endgroup$
– wolfies
8 hours ago












$begingroup$
@wolfies, I know you think that, you made your point in the Q&A I link, but many people disagree with that, including me. For a new user I think my advice is beneficial, there is nothing to gain and much to loose by using Subscript for anything other than display.
$endgroup$
– rhermans
8 hours ago




$begingroup$
@wolfies, I know you think that, you made your point in the Q&A I link, but many people disagree with that, including me. For a new user I think my advice is beneficial, there is nothing to gain and much to loose by using Subscript for anything other than display.
$endgroup$
– rhermans
8 hours ago










3 Answers
3






active

oldest

votes


















4












$begingroup$

Life is easier when one can go straight to the answer without going through the integration.



Given a mean vector and covariance matrix



μ = μ1, μ2;
Σ = σ1^2, σ1 σ2 ρ, σ1 σ2 ρ, σ2^2;


the moment generating function for a bivariate normal is



mgf[t1_, t2_] := Exp[t1, t2.μ + t1, t2.Σ.t1, t2/2]


Because the definition of the moment generating function is $E[e^t_1 X_1+t_2 X_2]=E[Y_1^t_1 Y_2^t_2]$, then mgf[t1_, t2_] is the function that gives the expectation of $Y_1^t_1 Y_2^t_2$.



mgf[m, n]
(* E^(m μ1 + n μ2 + 1/2 (m (m σ1^2 + n ρ σ1 σ2) + n (m ρ σ1 σ2 + n σ2^2))) *)


You can see that this easily generalizes to more than two dimensions. Here is a reference with the steps of integration: The Lognormal Random Multivariate






share|improve this answer









$endgroup$












  • $begingroup$
    There can be no better answer than this.
    $endgroup$
    – wolfies
    7 hours ago










  • $begingroup$
    @wolfies. I agree. But I wish I would have immediately thought of it. Good thing Google is around.
    $endgroup$
    – JimB
    6 hours ago










  • $begingroup$
    Ah this makes a lot of sense. Can't believe I did not think of doing this earlier.
    $endgroup$
    – jcp
    5 hours ago


















1












$begingroup$

For Mathematica the integral can be very complicated if all general cases are considered for each parameter. One option to speed and simplify things is to analyze more specific cases using Assuming.



You would need to decide if these assumptions are valid, and define your own if not, but these seem quite reasonable to me.



pdf = Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Simplify@PDF[
LogMultinormalDistribution[
μ1, μ2,

σ1^2, ρ σ1 σ2,
ρ σ1 σ2, σ2^2

]
, x, y]
]


enter image description here



Notice I have avoided the use of Subscript and used Simplify and indentation to make the code more readable.



Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Integrate[
pdf
, x, 0, Infinity
, y, 0, Infinity
]
]

(* 1 *)


So the integral is $1$, as expected for a PDF.



Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Integrate[
pdf x
, x, 0, Infinity
, y, 0, Infinity
]
]


enter image description here



E^(μ1 + σ1^2/2)


Using AbsoluteTiming the solution took 123 seconds in my computer (Mathematica 12 i7-4770 3.4GHz)






share|improve this answer











$endgroup$












  • $begingroup$
    Hi. thanks this definitely helps. Running absolute timing on my computer however yields 165.78 and 203.667 s for the first and second computation respectively. Is there anyway to speed this up further? I need to repeat this computation several times.
    $endgroup$
    – jcp
    8 hours ago










  • $begingroup$
    @jcp see the answer by JimB
    $endgroup$
    – rhermans
    8 hours ago


















1












$begingroup$

Format[μ[n_]] := Subscript[μ, n];
Format[σ[n_]] := Subscript[σ, n]

dist = LogMultinormalDistribution[μ[1], μ[2],
σ[1]^2, ρ σ[1] σ[2], ρ σ[1] σ[2], σ[2]^2];


The Moments are built-in for this distribution



Moment[dist, m, n]


enter image description here






share|improve this answer









$endgroup$












  • $begingroup$
    I guess there is a better answer.
    $endgroup$
    – JimB
    31 mins ago













Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "387"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);






jcp is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f202395%2fsymbolic-integration-of-logmultinormal-distribution%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























3 Answers
3






active

oldest

votes








3 Answers
3






active

oldest

votes









active

oldest

votes






active

oldest

votes









4












$begingroup$

Life is easier when one can go straight to the answer without going through the integration.



Given a mean vector and covariance matrix



μ = μ1, μ2;
Σ = σ1^2, σ1 σ2 ρ, σ1 σ2 ρ, σ2^2;


the moment generating function for a bivariate normal is



mgf[t1_, t2_] := Exp[t1, t2.μ + t1, t2.Σ.t1, t2/2]


Because the definition of the moment generating function is $E[e^t_1 X_1+t_2 X_2]=E[Y_1^t_1 Y_2^t_2]$, then mgf[t1_, t2_] is the function that gives the expectation of $Y_1^t_1 Y_2^t_2$.



mgf[m, n]
(* E^(m μ1 + n μ2 + 1/2 (m (m σ1^2 + n ρ σ1 σ2) + n (m ρ σ1 σ2 + n σ2^2))) *)


You can see that this easily generalizes to more than two dimensions. Here is a reference with the steps of integration: The Lognormal Random Multivariate






share|improve this answer









$endgroup$












  • $begingroup$
    There can be no better answer than this.
    $endgroup$
    – wolfies
    7 hours ago










  • $begingroup$
    @wolfies. I agree. But I wish I would have immediately thought of it. Good thing Google is around.
    $endgroup$
    – JimB
    6 hours ago










  • $begingroup$
    Ah this makes a lot of sense. Can't believe I did not think of doing this earlier.
    $endgroup$
    – jcp
    5 hours ago















4












$begingroup$

Life is easier when one can go straight to the answer without going through the integration.



Given a mean vector and covariance matrix



μ = μ1, μ2;
Σ = σ1^2, σ1 σ2 ρ, σ1 σ2 ρ, σ2^2;


the moment generating function for a bivariate normal is



mgf[t1_, t2_] := Exp[t1, t2.μ + t1, t2.Σ.t1, t2/2]


Because the definition of the moment generating function is $E[e^t_1 X_1+t_2 X_2]=E[Y_1^t_1 Y_2^t_2]$, then mgf[t1_, t2_] is the function that gives the expectation of $Y_1^t_1 Y_2^t_2$.



mgf[m, n]
(* E^(m μ1 + n μ2 + 1/2 (m (m σ1^2 + n ρ σ1 σ2) + n (m ρ σ1 σ2 + n σ2^2))) *)


You can see that this easily generalizes to more than two dimensions. Here is a reference with the steps of integration: The Lognormal Random Multivariate






share|improve this answer









$endgroup$












  • $begingroup$
    There can be no better answer than this.
    $endgroup$
    – wolfies
    7 hours ago










  • $begingroup$
    @wolfies. I agree. But I wish I would have immediately thought of it. Good thing Google is around.
    $endgroup$
    – JimB
    6 hours ago










  • $begingroup$
    Ah this makes a lot of sense. Can't believe I did not think of doing this earlier.
    $endgroup$
    – jcp
    5 hours ago













4












4








4





$begingroup$

Life is easier when one can go straight to the answer without going through the integration.



Given a mean vector and covariance matrix



μ = μ1, μ2;
Σ = σ1^2, σ1 σ2 ρ, σ1 σ2 ρ, σ2^2;


the moment generating function for a bivariate normal is



mgf[t1_, t2_] := Exp[t1, t2.μ + t1, t2.Σ.t1, t2/2]


Because the definition of the moment generating function is $E[e^t_1 X_1+t_2 X_2]=E[Y_1^t_1 Y_2^t_2]$, then mgf[t1_, t2_] is the function that gives the expectation of $Y_1^t_1 Y_2^t_2$.



mgf[m, n]
(* E^(m μ1 + n μ2 + 1/2 (m (m σ1^2 + n ρ σ1 σ2) + n (m ρ σ1 σ2 + n σ2^2))) *)


You can see that this easily generalizes to more than two dimensions. Here is a reference with the steps of integration: The Lognormal Random Multivariate






share|improve this answer









$endgroup$



Life is easier when one can go straight to the answer without going through the integration.



Given a mean vector and covariance matrix



μ = μ1, μ2;
Σ = σ1^2, σ1 σ2 ρ, σ1 σ2 ρ, σ2^2;


the moment generating function for a bivariate normal is



mgf[t1_, t2_] := Exp[t1, t2.μ + t1, t2.Σ.t1, t2/2]


Because the definition of the moment generating function is $E[e^t_1 X_1+t_2 X_2]=E[Y_1^t_1 Y_2^t_2]$, then mgf[t1_, t2_] is the function that gives the expectation of $Y_1^t_1 Y_2^t_2$.



mgf[m, n]
(* E^(m μ1 + n μ2 + 1/2 (m (m σ1^2 + n ρ σ1 σ2) + n (m ρ σ1 σ2 + n σ2^2))) *)


You can see that this easily generalizes to more than two dimensions. Here is a reference with the steps of integration: The Lognormal Random Multivariate







share|improve this answer












share|improve this answer



share|improve this answer










answered 8 hours ago









JimBJimB

19.9k1 gold badge28 silver badges65 bronze badges




19.9k1 gold badge28 silver badges65 bronze badges











  • $begingroup$
    There can be no better answer than this.
    $endgroup$
    – wolfies
    7 hours ago










  • $begingroup$
    @wolfies. I agree. But I wish I would have immediately thought of it. Good thing Google is around.
    $endgroup$
    – JimB
    6 hours ago










  • $begingroup$
    Ah this makes a lot of sense. Can't believe I did not think of doing this earlier.
    $endgroup$
    – jcp
    5 hours ago
















  • $begingroup$
    There can be no better answer than this.
    $endgroup$
    – wolfies
    7 hours ago










  • $begingroup$
    @wolfies. I agree. But I wish I would have immediately thought of it. Good thing Google is around.
    $endgroup$
    – JimB
    6 hours ago










  • $begingroup$
    Ah this makes a lot of sense. Can't believe I did not think of doing this earlier.
    $endgroup$
    – jcp
    5 hours ago















$begingroup$
There can be no better answer than this.
$endgroup$
– wolfies
7 hours ago




$begingroup$
There can be no better answer than this.
$endgroup$
– wolfies
7 hours ago












$begingroup$
@wolfies. I agree. But I wish I would have immediately thought of it. Good thing Google is around.
$endgroup$
– JimB
6 hours ago




$begingroup$
@wolfies. I agree. But I wish I would have immediately thought of it. Good thing Google is around.
$endgroup$
– JimB
6 hours ago












$begingroup$
Ah this makes a lot of sense. Can't believe I did not think of doing this earlier.
$endgroup$
– jcp
5 hours ago




$begingroup$
Ah this makes a lot of sense. Can't believe I did not think of doing this earlier.
$endgroup$
– jcp
5 hours ago













1












$begingroup$

For Mathematica the integral can be very complicated if all general cases are considered for each parameter. One option to speed and simplify things is to analyze more specific cases using Assuming.



You would need to decide if these assumptions are valid, and define your own if not, but these seem quite reasonable to me.



pdf = Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Simplify@PDF[
LogMultinormalDistribution[
μ1, μ2,

σ1^2, ρ σ1 σ2,
ρ σ1 σ2, σ2^2

]
, x, y]
]


enter image description here



Notice I have avoided the use of Subscript and used Simplify and indentation to make the code more readable.



Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Integrate[
pdf
, x, 0, Infinity
, y, 0, Infinity
]
]

(* 1 *)


So the integral is $1$, as expected for a PDF.



Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Integrate[
pdf x
, x, 0, Infinity
, y, 0, Infinity
]
]


enter image description here



E^(μ1 + σ1^2/2)


Using AbsoluteTiming the solution took 123 seconds in my computer (Mathematica 12 i7-4770 3.4GHz)






share|improve this answer











$endgroup$












  • $begingroup$
    Hi. thanks this definitely helps. Running absolute timing on my computer however yields 165.78 and 203.667 s for the first and second computation respectively. Is there anyway to speed this up further? I need to repeat this computation several times.
    $endgroup$
    – jcp
    8 hours ago










  • $begingroup$
    @jcp see the answer by JimB
    $endgroup$
    – rhermans
    8 hours ago















1












$begingroup$

For Mathematica the integral can be very complicated if all general cases are considered for each parameter. One option to speed and simplify things is to analyze more specific cases using Assuming.



You would need to decide if these assumptions are valid, and define your own if not, but these seem quite reasonable to me.



pdf = Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Simplify@PDF[
LogMultinormalDistribution[
μ1, μ2,

σ1^2, ρ σ1 σ2,
ρ σ1 σ2, σ2^2

]
, x, y]
]


enter image description here



Notice I have avoided the use of Subscript and used Simplify and indentation to make the code more readable.



Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Integrate[
pdf
, x, 0, Infinity
, y, 0, Infinity
]
]

(* 1 *)


So the integral is $1$, as expected for a PDF.



Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Integrate[
pdf x
, x, 0, Infinity
, y, 0, Infinity
]
]


enter image description here



E^(μ1 + σ1^2/2)


Using AbsoluteTiming the solution took 123 seconds in my computer (Mathematica 12 i7-4770 3.4GHz)






share|improve this answer











$endgroup$












  • $begingroup$
    Hi. thanks this definitely helps. Running absolute timing on my computer however yields 165.78 and 203.667 s for the first and second computation respectively. Is there anyway to speed this up further? I need to repeat this computation several times.
    $endgroup$
    – jcp
    8 hours ago










  • $begingroup$
    @jcp see the answer by JimB
    $endgroup$
    – rhermans
    8 hours ago













1












1








1





$begingroup$

For Mathematica the integral can be very complicated if all general cases are considered for each parameter. One option to speed and simplify things is to analyze more specific cases using Assuming.



You would need to decide if these assumptions are valid, and define your own if not, but these seem quite reasonable to me.



pdf = Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Simplify@PDF[
LogMultinormalDistribution[
μ1, μ2,

σ1^2, ρ σ1 σ2,
ρ σ1 σ2, σ2^2

]
, x, y]
]


enter image description here



Notice I have avoided the use of Subscript and used Simplify and indentation to make the code more readable.



Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Integrate[
pdf
, x, 0, Infinity
, y, 0, Infinity
]
]

(* 1 *)


So the integral is $1$, as expected for a PDF.



Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Integrate[
pdf x
, x, 0, Infinity
, y, 0, Infinity
]
]


enter image description here



E^(μ1 + σ1^2/2)


Using AbsoluteTiming the solution took 123 seconds in my computer (Mathematica 12 i7-4770 3.4GHz)






share|improve this answer











$endgroup$



For Mathematica the integral can be very complicated if all general cases are considered for each parameter. One option to speed and simplify things is to analyze more specific cases using Assuming.



You would need to decide if these assumptions are valid, and define your own if not, but these seem quite reasonable to me.



pdf = Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Simplify@PDF[
LogMultinormalDistribution[
μ1, μ2,

σ1^2, ρ σ1 σ2,
ρ σ1 σ2, σ2^2

]
, x, y]
]


enter image description here



Notice I have avoided the use of Subscript and used Simplify and indentation to make the code more readable.



Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Integrate[
pdf
, x, 0, Infinity
, y, 0, Infinity
]
]

(* 1 *)


So the integral is $1$, as expected for a PDF.



Assuming[
And[x > 0, y > 0, ρ^2 < 1, σ1, σ2, μ1, μ2 ∈ Reals, σ2 > 0],
Integrate[
pdf x
, x, 0, Infinity
, y, 0, Infinity
]
]


enter image description here



E^(μ1 + σ1^2/2)


Using AbsoluteTiming the solution took 123 seconds in my computer (Mathematica 12 i7-4770 3.4GHz)







share|improve this answer














share|improve this answer



share|improve this answer








edited 8 hours ago

























answered 8 hours ago









rhermansrhermans

23.3k4 gold badges42 silver badges107 bronze badges




23.3k4 gold badges42 silver badges107 bronze badges











  • $begingroup$
    Hi. thanks this definitely helps. Running absolute timing on my computer however yields 165.78 and 203.667 s for the first and second computation respectively. Is there anyway to speed this up further? I need to repeat this computation several times.
    $endgroup$
    – jcp
    8 hours ago










  • $begingroup$
    @jcp see the answer by JimB
    $endgroup$
    – rhermans
    8 hours ago
















  • $begingroup$
    Hi. thanks this definitely helps. Running absolute timing on my computer however yields 165.78 and 203.667 s for the first and second computation respectively. Is there anyway to speed this up further? I need to repeat this computation several times.
    $endgroup$
    – jcp
    8 hours ago










  • $begingroup$
    @jcp see the answer by JimB
    $endgroup$
    – rhermans
    8 hours ago















$begingroup$
Hi. thanks this definitely helps. Running absolute timing on my computer however yields 165.78 and 203.667 s for the first and second computation respectively. Is there anyway to speed this up further? I need to repeat this computation several times.
$endgroup$
– jcp
8 hours ago




$begingroup$
Hi. thanks this definitely helps. Running absolute timing on my computer however yields 165.78 and 203.667 s for the first and second computation respectively. Is there anyway to speed this up further? I need to repeat this computation several times.
$endgroup$
– jcp
8 hours ago












$begingroup$
@jcp see the answer by JimB
$endgroup$
– rhermans
8 hours ago




$begingroup$
@jcp see the answer by JimB
$endgroup$
– rhermans
8 hours ago











1












$begingroup$

Format[μ[n_]] := Subscript[μ, n];
Format[σ[n_]] := Subscript[σ, n]

dist = LogMultinormalDistribution[μ[1], μ[2],
σ[1]^2, ρ σ[1] σ[2], ρ σ[1] σ[2], σ[2]^2];


The Moments are built-in for this distribution



Moment[dist, m, n]


enter image description here






share|improve this answer









$endgroup$












  • $begingroup$
    I guess there is a better answer.
    $endgroup$
    – JimB
    31 mins ago















1












$begingroup$

Format[μ[n_]] := Subscript[μ, n];
Format[σ[n_]] := Subscript[σ, n]

dist = LogMultinormalDistribution[μ[1], μ[2],
σ[1]^2, ρ σ[1] σ[2], ρ σ[1] σ[2], σ[2]^2];


The Moments are built-in for this distribution



Moment[dist, m, n]


enter image description here






share|improve this answer









$endgroup$












  • $begingroup$
    I guess there is a better answer.
    $endgroup$
    – JimB
    31 mins ago













1












1








1





$begingroup$

Format[μ[n_]] := Subscript[μ, n];
Format[σ[n_]] := Subscript[σ, n]

dist = LogMultinormalDistribution[μ[1], μ[2],
σ[1]^2, ρ σ[1] σ[2], ρ σ[1] σ[2], σ[2]^2];


The Moments are built-in for this distribution



Moment[dist, m, n]


enter image description here






share|improve this answer









$endgroup$



Format[μ[n_]] := Subscript[μ, n];
Format[σ[n_]] := Subscript[σ, n]

dist = LogMultinormalDistribution[μ[1], μ[2],
σ[1]^2, ρ σ[1] σ[2], ρ σ[1] σ[2], σ[2]^2];


The Moments are built-in for this distribution



Moment[dist, m, n]


enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered 1 hour ago









Bob HanlonBob Hanlon

63.7k3 gold badges36 silver badges99 bronze badges




63.7k3 gold badges36 silver badges99 bronze badges











  • $begingroup$
    I guess there is a better answer.
    $endgroup$
    – JimB
    31 mins ago
















  • $begingroup$
    I guess there is a better answer.
    $endgroup$
    – JimB
    31 mins ago















$begingroup$
I guess there is a better answer.
$endgroup$
– JimB
31 mins ago




$begingroup$
I guess there is a better answer.
$endgroup$
– JimB
31 mins ago










jcp is a new contributor. Be nice, and check out our Code of Conduct.









draft saved

draft discarded


















jcp is a new contributor. Be nice, and check out our Code of Conduct.












jcp is a new contributor. Be nice, and check out our Code of Conduct.











jcp is a new contributor. Be nice, and check out our Code of Conduct.














Thanks for contributing an answer to Mathematica Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f202395%2fsymbolic-integration-of-logmultinormal-distribution%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

Tom Holland Mục lục Đầu đời và giáo dục | Sự nghiệp | Cuộc sống cá nhân | Phim tham gia | Giải thưởng và đề cử | Chú thích | Liên kết ngoài | Trình đơn chuyển hướngProfile“Person Details for Thomas Stanley Holland, "England and Wales Birth Registration Index, 1837-2008" — FamilySearch.org”"Meet Tom Holland... the 16-year-old star of The Impossible""Schoolboy actor Tom Holland finds himself in Oscar contention for role in tsunami drama"“Naomi Watts on the Prince William and Harry's reaction to her film about the late Princess Diana”lưu trữ"Holland and Pflueger Are West End's Two New 'Billy Elliots'""I'm so envious of my son, the movie star! British writer Dominic Holland's spent 20 years trying to crack Hollywood - but he's been beaten to it by a very unlikely rival"“Richard and Margaret Povey of Jersey, Channel Islands, UK: Information about Thomas Stanley Holland”"Tom Holland to play Billy Elliot""New Billy Elliot leaving the garage"Billy Elliot the Musical - Tom Holland - Billy"A Tale of four Billys: Tom Holland""The Feel Good Factor""Thames Christian College schoolboys join Myleene Klass for The Feelgood Factor""Government launches £600,000 arts bursaries pilot""BILLY's Chapman, Holland, Gardner & Jackson-Keen Visit Prime Minister""Elton John 'blown away' by Billy Elliot fifth birthday" (video with John's interview and fragments of Holland's performance)"First News interviews Arrietty's Tom Holland"“33rd Critics' Circle Film Awards winners”“National Board of Review Current Awards”Bản gốc"Ron Howard Whaling Tale 'In The Heart Of The Sea' Casts Tom Holland"“'Spider-Man' Finds Tom Holland to Star as New Web-Slinger”lưu trữ“Captain America: Civil War (2016)”“Film Review: ‘Captain America: Civil War’”lưu trữ“‘Captain America: Civil War’ review: Choose your own avenger”lưu trữ“The Lost City of Z reviews”“Sony Pictures and Marvel Studios Find Their 'Spider-Man' Star and Director”“‘Mary Magdalene’, ‘Current War’ & ‘Wind River’ Get 2017 Release Dates From Weinstein”“Lionsgate Unleashing Daisy Ridley & Tom Holland Starrer ‘Chaos Walking’ In Cannes”“PTA's 'Master' Leads Chicago Film Critics Nominations, UPDATED: Houston and Indiana Critics Nominations”“Nominaciones Goya 2013 Telecinco Cinema – ENG”“Jameson Empire Film Awards: Martin Freeman wins best actor for performance in The Hobbit”“34th Annual Young Artist Awards”Bản gốc“Teen Choice Awards 2016—Captain America: Civil War Leads Second Wave of Nominations”“BAFTA Film Award Nominations: ‘La La Land’ Leads Race”“Saturn Awards Nominations 2017: 'Rogue One,' 'Walking Dead' Lead”Tom HollandTom HollandTom HollandTom Hollandmedia.gettyimages.comWorldCat Identities300279794no20130442900000 0004 0355 42791085670554170004732cb16706349t(data)XX5557367