Symbolic Multivariate Distribution
$begingroup$
If I try to input a symbolic multivariate distribution, I do not get a useful result.
PDF[MultinormalDistribution[m, S], x]
(* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers. *)
(* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers.*)
(* PDF[MultinormalDistribution[m, S], x] *)
Clearly, Mathematica could return an appropriate symbolic expression. Is there any way of making it do so?
probability-or-statistics symbolic
$endgroup$
add a comment |
$begingroup$
If I try to input a symbolic multivariate distribution, I do not get a useful result.
PDF[MultinormalDistribution[m, S], x]
(* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers. *)
(* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers.*)
(* PDF[MultinormalDistribution[m, S], x] *)
Clearly, Mathematica could return an appropriate symbolic expression. Is there any way of making it do so?
probability-or-statistics symbolic
$endgroup$
add a comment |
$begingroup$
If I try to input a symbolic multivariate distribution, I do not get a useful result.
PDF[MultinormalDistribution[m, S], x]
(* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers. *)
(* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers.*)
(* PDF[MultinormalDistribution[m, S], x] *)
Clearly, Mathematica could return an appropriate symbolic expression. Is there any way of making it do so?
probability-or-statistics symbolic
$endgroup$
If I try to input a symbolic multivariate distribution, I do not get a useful result.
PDF[MultinormalDistribution[m, S], x]
(* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers. *)
(* During evaluation of MultinormalDistribution::vrprm: The value m at position 1 in MultinormalDistribution[m,S] is expected to be a list of real numbers.*)
(* PDF[MultinormalDistribution[m, S], x] *)
Clearly, Mathematica could return an appropriate symbolic expression. Is there any way of making it do so?
probability-or-statistics symbolic
probability-or-statistics symbolic
asked 3 hours ago
mikadomikado
6,9371929
6,9371929
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
You need to supply Mathematica with the structure of your variables:
(* dimension of distribution *)
n = 2;
PDF[
MultinormalDistribution[
Array[Subscript[m, ##] &, n],
Array[Subscript[S, Sequence @@ Sort@{##}] &, {n, n}]
],
Array[Subscript[x, ##] &, n]
]

We use Array to construct variables of the form Subscript[var,i,j,…] (you can of course use any other form that is more convenient). Note that S is explicitly made symmetric by sorting the indices. The code works without this, but this way there are no "fake" parameters.
Note: As pointed out by @BobHanlon in the comments, Subscript can often cause issues if used blindly. For actual use, it is much safer to simply use indexed variables such as Array[x, n].
$endgroup$
$begingroup$
Rather than using subscripted variables, I recommend using indexed variables and then usingFormatto display the indexed variables as subscripted variables. Subscripted variables tend to cause problems in solvers.
$endgroup$
– Bob Hanlon
35 mins ago
$begingroup$
I am aware of that - I just thought that for a quick demonstration, it would be good enough and it's easy to read. But I will add a comment to the answer to point out potential issues.
$endgroup$
– Lukas Lang
31 mins ago
$begingroup$
A very useful answer, but I was hoping for an expression that worked in terms of vector and matrix inputs (of unspecified dimension).
$endgroup$
– mikado
2 mins ago
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f197180%2fsymbolic-multivariate-distribution%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
You need to supply Mathematica with the structure of your variables:
(* dimension of distribution *)
n = 2;
PDF[
MultinormalDistribution[
Array[Subscript[m, ##] &, n],
Array[Subscript[S, Sequence @@ Sort@{##}] &, {n, n}]
],
Array[Subscript[x, ##] &, n]
]

We use Array to construct variables of the form Subscript[var,i,j,…] (you can of course use any other form that is more convenient). Note that S is explicitly made symmetric by sorting the indices. The code works without this, but this way there are no "fake" parameters.
Note: As pointed out by @BobHanlon in the comments, Subscript can often cause issues if used blindly. For actual use, it is much safer to simply use indexed variables such as Array[x, n].
$endgroup$
$begingroup$
Rather than using subscripted variables, I recommend using indexed variables and then usingFormatto display the indexed variables as subscripted variables. Subscripted variables tend to cause problems in solvers.
$endgroup$
– Bob Hanlon
35 mins ago
$begingroup$
I am aware of that - I just thought that for a quick demonstration, it would be good enough and it's easy to read. But I will add a comment to the answer to point out potential issues.
$endgroup$
– Lukas Lang
31 mins ago
$begingroup$
A very useful answer, but I was hoping for an expression that worked in terms of vector and matrix inputs (of unspecified dimension).
$endgroup$
– mikado
2 mins ago
add a comment |
$begingroup$
You need to supply Mathematica with the structure of your variables:
(* dimension of distribution *)
n = 2;
PDF[
MultinormalDistribution[
Array[Subscript[m, ##] &, n],
Array[Subscript[S, Sequence @@ Sort@{##}] &, {n, n}]
],
Array[Subscript[x, ##] &, n]
]

We use Array to construct variables of the form Subscript[var,i,j,…] (you can of course use any other form that is more convenient). Note that S is explicitly made symmetric by sorting the indices. The code works without this, but this way there are no "fake" parameters.
Note: As pointed out by @BobHanlon in the comments, Subscript can often cause issues if used blindly. For actual use, it is much safer to simply use indexed variables such as Array[x, n].
$endgroup$
$begingroup$
Rather than using subscripted variables, I recommend using indexed variables and then usingFormatto display the indexed variables as subscripted variables. Subscripted variables tend to cause problems in solvers.
$endgroup$
– Bob Hanlon
35 mins ago
$begingroup$
I am aware of that - I just thought that for a quick demonstration, it would be good enough and it's easy to read. But I will add a comment to the answer to point out potential issues.
$endgroup$
– Lukas Lang
31 mins ago
$begingroup$
A very useful answer, but I was hoping for an expression that worked in terms of vector and matrix inputs (of unspecified dimension).
$endgroup$
– mikado
2 mins ago
add a comment |
$begingroup$
You need to supply Mathematica with the structure of your variables:
(* dimension of distribution *)
n = 2;
PDF[
MultinormalDistribution[
Array[Subscript[m, ##] &, n],
Array[Subscript[S, Sequence @@ Sort@{##}] &, {n, n}]
],
Array[Subscript[x, ##] &, n]
]

We use Array to construct variables of the form Subscript[var,i,j,…] (you can of course use any other form that is more convenient). Note that S is explicitly made symmetric by sorting the indices. The code works without this, but this way there are no "fake" parameters.
Note: As pointed out by @BobHanlon in the comments, Subscript can often cause issues if used blindly. For actual use, it is much safer to simply use indexed variables such as Array[x, n].
$endgroup$
You need to supply Mathematica with the structure of your variables:
(* dimension of distribution *)
n = 2;
PDF[
MultinormalDistribution[
Array[Subscript[m, ##] &, n],
Array[Subscript[S, Sequence @@ Sort@{##}] &, {n, n}]
],
Array[Subscript[x, ##] &, n]
]

We use Array to construct variables of the form Subscript[var,i,j,…] (you can of course use any other form that is more convenient). Note that S is explicitly made symmetric by sorting the indices. The code works without this, but this way there are no "fake" parameters.
Note: As pointed out by @BobHanlon in the comments, Subscript can often cause issues if used blindly. For actual use, it is much safer to simply use indexed variables such as Array[x, n].
edited 27 mins ago
answered 2 hours ago
Lukas LangLukas Lang
7,45011032
7,45011032
$begingroup$
Rather than using subscripted variables, I recommend using indexed variables and then usingFormatto display the indexed variables as subscripted variables. Subscripted variables tend to cause problems in solvers.
$endgroup$
– Bob Hanlon
35 mins ago
$begingroup$
I am aware of that - I just thought that for a quick demonstration, it would be good enough and it's easy to read. But I will add a comment to the answer to point out potential issues.
$endgroup$
– Lukas Lang
31 mins ago
$begingroup$
A very useful answer, but I was hoping for an expression that worked in terms of vector and matrix inputs (of unspecified dimension).
$endgroup$
– mikado
2 mins ago
add a comment |
$begingroup$
Rather than using subscripted variables, I recommend using indexed variables and then usingFormatto display the indexed variables as subscripted variables. Subscripted variables tend to cause problems in solvers.
$endgroup$
– Bob Hanlon
35 mins ago
$begingroup$
I am aware of that - I just thought that for a quick demonstration, it would be good enough and it's easy to read. But I will add a comment to the answer to point out potential issues.
$endgroup$
– Lukas Lang
31 mins ago
$begingroup$
A very useful answer, but I was hoping for an expression that worked in terms of vector and matrix inputs (of unspecified dimension).
$endgroup$
– mikado
2 mins ago
$begingroup$
Rather than using subscripted variables, I recommend using indexed variables and then using
Format to display the indexed variables as subscripted variables. Subscripted variables tend to cause problems in solvers.$endgroup$
– Bob Hanlon
35 mins ago
$begingroup$
Rather than using subscripted variables, I recommend using indexed variables and then using
Format to display the indexed variables as subscripted variables. Subscripted variables tend to cause problems in solvers.$endgroup$
– Bob Hanlon
35 mins ago
$begingroup$
I am aware of that - I just thought that for a quick demonstration, it would be good enough and it's easy to read. But I will add a comment to the answer to point out potential issues.
$endgroup$
– Lukas Lang
31 mins ago
$begingroup$
I am aware of that - I just thought that for a quick demonstration, it would be good enough and it's easy to read. But I will add a comment to the answer to point out potential issues.
$endgroup$
– Lukas Lang
31 mins ago
$begingroup$
A very useful answer, but I was hoping for an expression that worked in terms of vector and matrix inputs (of unspecified dimension).
$endgroup$
– mikado
2 mins ago
$begingroup$
A very useful answer, but I was hoping for an expression that worked in terms of vector and matrix inputs (of unspecified dimension).
$endgroup$
– mikado
2 mins ago
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f197180%2fsymbolic-multivariate-distribution%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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