Calculated covariance & corr. coefficient - confirmation
$begingroup$
I have 2 simple discrete random variables.
Marginal distribution of X:
V: 0.002 0.004 0.006 0.008
P: 0.110 0.480 0.300 0.110
Marginal distribution of Y:
V: 0.010 0.020 0.030 0.040
P: 0.100 0.400 0.300 0.200
Here
V means values
P means their respective probabilities
I calculated these below but I am not sure about the last 2:
E[X] = 0.00482000
E[Y] = 0.02600000
var[X] = 0.000002727600
var[Y] = 0.000084000000
covariance (X,Y) = -0.000001120000
correlation coefficient (X,Y) = -0.073992557516
1) Could someone confirm these 6 calculated numbers please?
2) What are the best free tools to calculate such things? Maybe R, Python?
(Please don't downvote for the 2nd question, I will remove it if needed).
I looked at a few online calculators but none of them seems to take probabilities as input, just 2 vectors of values they take.
probability probability-theory
$endgroup$
|
show 4 more comments
$begingroup$
I have 2 simple discrete random variables.
Marginal distribution of X:
V: 0.002 0.004 0.006 0.008
P: 0.110 0.480 0.300 0.110
Marginal distribution of Y:
V: 0.010 0.020 0.030 0.040
P: 0.100 0.400 0.300 0.200
Here
V means values
P means their respective probabilities
I calculated these below but I am not sure about the last 2:
E[X] = 0.00482000
E[Y] = 0.02600000
var[X] = 0.000002727600
var[Y] = 0.000084000000
covariance (X,Y) = -0.000001120000
correlation coefficient (X,Y) = -0.073992557516
1) Could someone confirm these 6 calculated numbers please?
2) What are the best free tools to calculate such things? Maybe R, Python?
(Please don't downvote for the 2nd question, I will remove it if needed).
I looked at a few online calculators but none of them seems to take probabilities as input, just 2 vectors of values they take.
probability probability-theory
$endgroup$
$begingroup$
Someone's going to downvote for the first! Try to write out how you arrived to these values: here is more likely that someone will comment your thought process than your results.
$endgroup$
– N74
Dec 25 '18 at 18:23
$begingroup$
@N74 I just applied the formulas. I wrote a program in Java and those are the values it produced. But some of them do not match with the answers given in my book.
$endgroup$
– peter.petrov
Dec 25 '18 at 20:32
$begingroup$
My suggestion is to copy the formulas, so that we can see if they are the expected ones and if they were correctly applied to your data.
$endgroup$
– N74
Dec 25 '18 at 20:45
$begingroup$
@N74 What is this?! These are basic well-known formulas. If you don't intend to help what is your goal in posting these comments?!
$endgroup$
– peter.petrov
Dec 25 '18 at 21:23
1
$begingroup$
The means and variances look correct. You do not seem to have information about the relationship between $X$ and $Y$, so it is difficult to see how you calculated their covariance and correlation - if they were independent then both would be zero
$endgroup$
– Henry
Dec 26 '18 at 0:20
|
show 4 more comments
$begingroup$
I have 2 simple discrete random variables.
Marginal distribution of X:
V: 0.002 0.004 0.006 0.008
P: 0.110 0.480 0.300 0.110
Marginal distribution of Y:
V: 0.010 0.020 0.030 0.040
P: 0.100 0.400 0.300 0.200
Here
V means values
P means their respective probabilities
I calculated these below but I am not sure about the last 2:
E[X] = 0.00482000
E[Y] = 0.02600000
var[X] = 0.000002727600
var[Y] = 0.000084000000
covariance (X,Y) = -0.000001120000
correlation coefficient (X,Y) = -0.073992557516
1) Could someone confirm these 6 calculated numbers please?
2) What are the best free tools to calculate such things? Maybe R, Python?
(Please don't downvote for the 2nd question, I will remove it if needed).
I looked at a few online calculators but none of them seems to take probabilities as input, just 2 vectors of values they take.
probability probability-theory
$endgroup$
I have 2 simple discrete random variables.
Marginal distribution of X:
V: 0.002 0.004 0.006 0.008
P: 0.110 0.480 0.300 0.110
Marginal distribution of Y:
V: 0.010 0.020 0.030 0.040
P: 0.100 0.400 0.300 0.200
Here
V means values
P means their respective probabilities
I calculated these below but I am not sure about the last 2:
E[X] = 0.00482000
E[Y] = 0.02600000
var[X] = 0.000002727600
var[Y] = 0.000084000000
covariance (X,Y) = -0.000001120000
correlation coefficient (X,Y) = -0.073992557516
1) Could someone confirm these 6 calculated numbers please?
2) What are the best free tools to calculate such things? Maybe R, Python?
(Please don't downvote for the 2nd question, I will remove it if needed).
I looked at a few online calculators but none of them seems to take probabilities as input, just 2 vectors of values they take.
probability probability-theory
probability probability-theory
edited Dec 26 '18 at 0:54
peter.petrov
asked Dec 25 '18 at 17:48
peter.petrovpeter.petrov
5,441821
5,441821
$begingroup$
Someone's going to downvote for the first! Try to write out how you arrived to these values: here is more likely that someone will comment your thought process than your results.
$endgroup$
– N74
Dec 25 '18 at 18:23
$begingroup$
@N74 I just applied the formulas. I wrote a program in Java and those are the values it produced. But some of them do not match with the answers given in my book.
$endgroup$
– peter.petrov
Dec 25 '18 at 20:32
$begingroup$
My suggestion is to copy the formulas, so that we can see if they are the expected ones and if they were correctly applied to your data.
$endgroup$
– N74
Dec 25 '18 at 20:45
$begingroup$
@N74 What is this?! These are basic well-known formulas. If you don't intend to help what is your goal in posting these comments?!
$endgroup$
– peter.petrov
Dec 25 '18 at 21:23
1
$begingroup$
The means and variances look correct. You do not seem to have information about the relationship between $X$ and $Y$, so it is difficult to see how you calculated their covariance and correlation - if they were independent then both would be zero
$endgroup$
– Henry
Dec 26 '18 at 0:20
|
show 4 more comments
$begingroup$
Someone's going to downvote for the first! Try to write out how you arrived to these values: here is more likely that someone will comment your thought process than your results.
$endgroup$
– N74
Dec 25 '18 at 18:23
$begingroup$
@N74 I just applied the formulas. I wrote a program in Java and those are the values it produced. But some of them do not match with the answers given in my book.
$endgroup$
– peter.petrov
Dec 25 '18 at 20:32
$begingroup$
My suggestion is to copy the formulas, so that we can see if they are the expected ones and if they were correctly applied to your data.
$endgroup$
– N74
Dec 25 '18 at 20:45
$begingroup$
@N74 What is this?! These are basic well-known formulas. If you don't intend to help what is your goal in posting these comments?!
$endgroup$
– peter.petrov
Dec 25 '18 at 21:23
1
$begingroup$
The means and variances look correct. You do not seem to have information about the relationship between $X$ and $Y$, so it is difficult to see how you calculated their covariance and correlation - if they were independent then both would be zero
$endgroup$
– Henry
Dec 26 '18 at 0:20
$begingroup$
Someone's going to downvote for the first! Try to write out how you arrived to these values: here is more likely that someone will comment your thought process than your results.
$endgroup$
– N74
Dec 25 '18 at 18:23
$begingroup$
Someone's going to downvote for the first! Try to write out how you arrived to these values: here is more likely that someone will comment your thought process than your results.
$endgroup$
– N74
Dec 25 '18 at 18:23
$begingroup$
@N74 I just applied the formulas. I wrote a program in Java and those are the values it produced. But some of them do not match with the answers given in my book.
$endgroup$
– peter.petrov
Dec 25 '18 at 20:32
$begingroup$
@N74 I just applied the formulas. I wrote a program in Java and those are the values it produced. But some of them do not match with the answers given in my book.
$endgroup$
– peter.petrov
Dec 25 '18 at 20:32
$begingroup$
My suggestion is to copy the formulas, so that we can see if they are the expected ones and if they were correctly applied to your data.
$endgroup$
– N74
Dec 25 '18 at 20:45
$begingroup$
My suggestion is to copy the formulas, so that we can see if they are the expected ones and if they were correctly applied to your data.
$endgroup$
– N74
Dec 25 '18 at 20:45
$begingroup$
@N74 What is this?! These are basic well-known formulas. If you don't intend to help what is your goal in posting these comments?!
$endgroup$
– peter.petrov
Dec 25 '18 at 21:23
$begingroup$
@N74 What is this?! These are basic well-known formulas. If you don't intend to help what is your goal in posting these comments?!
$endgroup$
– peter.petrov
Dec 25 '18 at 21:23
1
1
$begingroup$
The means and variances look correct. You do not seem to have information about the relationship between $X$ and $Y$, so it is difficult to see how you calculated their covariance and correlation - if they were independent then both would be zero
$endgroup$
– Henry
Dec 26 '18 at 0:20
$begingroup$
The means and variances look correct. You do not seem to have information about the relationship between $X$ and $Y$, so it is difficult to see how you calculated their covariance and correlation - if they were independent then both would be zero
$endgroup$
– Henry
Dec 26 '18 at 0:20
|
show 4 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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
},
noCode: 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%2fmath.stackexchange.com%2fquestions%2f3052308%2fcalculated-covariance-corr-coefficient-confirmation%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Mathematics 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%2fmath.stackexchange.com%2fquestions%2f3052308%2fcalculated-covariance-corr-coefficient-confirmation%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
$begingroup$
Someone's going to downvote for the first! Try to write out how you arrived to these values: here is more likely that someone will comment your thought process than your results.
$endgroup$
– N74
Dec 25 '18 at 18:23
$begingroup$
@N74 I just applied the formulas. I wrote a program in Java and those are the values it produced. But some of them do not match with the answers given in my book.
$endgroup$
– peter.petrov
Dec 25 '18 at 20:32
$begingroup$
My suggestion is to copy the formulas, so that we can see if they are the expected ones and if they were correctly applied to your data.
$endgroup$
– N74
Dec 25 '18 at 20:45
$begingroup$
@N74 What is this?! These are basic well-known formulas. If you don't intend to help what is your goal in posting these comments?!
$endgroup$
– peter.petrov
Dec 25 '18 at 21:23
1
$begingroup$
The means and variances look correct. You do not seem to have information about the relationship between $X$ and $Y$, so it is difficult to see how you calculated their covariance and correlation - if they were independent then both would be zero
$endgroup$
– Henry
Dec 26 '18 at 0:20