ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 25 Jan 2019 19:39:10 +0100Expected value of random variableshttps://ask.sagemath.org/question/44997/expected-value-of-random-variables/ I'm new to SAGE and just getting my feet wet. Would greatly appreciate if someone could point me to how to calculate the following using SAGE:
Say I have an event drawn from a Poisson distribution that happens on average once a year. I'd like to define a random variable and then calculate the following:
1. Probability the event will occur after 1 month (1/12th of a year)
2. Probability the event will not occur for 2 years but will occur during the third year.
I've searched unsuccessfully for how to do this and would greatly appreciate any help.Thu, 10 Jan 2019 21:33:00 +0100https://ask.sagemath.org/question/44997/expected-value-of-random-variables/Comment by tmonteil for <p>I'm new to SAGE and just getting my feet wet. Would greatly appreciate if someone could point me to how to calculate the following using SAGE:</p>
<p>Say I have an event drawn from a Poisson distribution that happens on average once a year. I'd like to define a random variable and then calculate the following:</p>
<ol>
<li><p>Probability the event will occur after 1 month (1/12th of a year)</p></li>
<li><p>Probability the event will not occur for 2 years but will occur during the third year.</p></li>
</ol>
<p>I've searched unsuccessfully for how to do this and would greatly appreciate any help.</p>
https://ask.sagemath.org/question/44997/expected-value-of-random-variables/?comment=45000#post-id-45000Is it homework ? Before trying to solve such a problem with Sage, how would you have solved it by hand ?Fri, 11 Jan 2019 01:03:21 +0100https://ask.sagemath.org/question/44997/expected-value-of-random-variables/?comment=45000#post-id-45000Comment by kyesledge for <p>I'm new to SAGE and just getting my feet wet. Would greatly appreciate if someone could point me to how to calculate the following using SAGE:</p>
<p>Say I have an event drawn from a Poisson distribution that happens on average once a year. I'd like to define a random variable and then calculate the following:</p>
<ol>
<li><p>Probability the event will occur after 1 month (1/12th of a year)</p></li>
<li><p>Probability the event will not occur for 2 years but will occur during the third year.</p></li>
</ol>
<p>I've searched unsuccessfully for how to do this and would greatly appreciate any help.</p>
https://ask.sagemath.org/question/44997/expected-value-of-random-variables/?comment=45003#post-id-45003It’s not homework. I created the toy problem myself and can easily solve it by hand using the poisson equation (and it’s clear to me how to write code to do that in SAGE). I was just under the impression that there’s some library that will do all this for you in SAGE but maybe I’m wrong? Just want to reiterate this is a toy problem that I made to illustrate my question, which was mostly about SAGE’s built in support for reasoning with random variables.Fri, 11 Jan 2019 02:12:55 +0100https://ask.sagemath.org/question/44997/expected-value-of-random-variables/?comment=45003#post-id-45003Comment by dan_fulea for <p>I'm new to SAGE and just getting my feet wet. Would greatly appreciate if someone could point me to how to calculate the following using SAGE:</p>
<p>Say I have an event drawn from a Poisson distribution that happens on average once a year. I'd like to define a random variable and then calculate the following:</p>
<ol>
<li><p>Probability the event will occur after 1 month (1/12th of a year)</p></li>
<li><p>Probability the event will not occur for 2 years but will occur during the third year.</p></li>
</ol>
<p>I've searched unsuccessfully for how to do this and would greatly appreciate any help.</p>
https://ask.sagemath.org/question/44997/expected-value-of-random-variables/?comment=45181#post-id-45181Please then provide code that declares the distribution. Or just describe the model, the distribution exactly (in mathematical terms). There is a way from *"Say I have an event drawn from a Poisson distribution that happens on average once a year"* to a declared distribution of a random variable.Fri, 25 Jan 2019 19:39:10 +0100https://ask.sagemath.org/question/44997/expected-value-of-random-variables/?comment=45181#post-id-45181