Is is possible to calculate the expected value for a continuous variable using the sum of discrete distribution?
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I would like to know if it is possible to calculate the expected value for a continuous random variable as:
$ mathopmathbbE(x)=int xf(x)d(x)=frac1Nsum_i=1^NX_i $
If that is true, how can we convert the integral to the sum? Also, is the sum part $frac1Nsum_i=1^NX_i$ used to calculate the discrete uniform distribution?
probability expectation
add a comment |Â
up vote
0
down vote
favorite
I would like to know if it is possible to calculate the expected value for a continuous random variable as:
$ mathopmathbbE(x)=int xf(x)d(x)=frac1Nsum_i=1^NX_i $
If that is true, how can we convert the integral to the sum? Also, is the sum part $frac1Nsum_i=1^NX_i$ used to calculate the discrete uniform distribution?
probability expectation
Can you explain what is the random variable (or random variables)? What is $x$? What is $X_i$? What is $N$? If $X$ is a random variable with PDF $f_X(x)$ then indeed $E[X] = int_-infty^infty xf_X(x)dx$.
– Michael
Jul 19 at 17:49
@Michael I have a series of different values that I want to calculate the expected value for each of them. An example of the series is 5.6, 3.2, 1.9, 6.1, 7.2. $N$ in this case is 5, $X_i$ is each value in the series.
– Adam Amin
Jul 19 at 17:56
@AdamAmin And where is the continuous distribution?
– callculus
Jul 19 at 18:03
@callculus I am not sure. It is confusing me how to calculate the expected value for each value in the series. I need this because I am calculating the autocorrelation for the series I have and part of the equation is to get the expected value.
– Adam Amin
Jul 19 at 18:09
1
This is called monte carlo integration
– RHowe
Jul 19 at 18:13
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I would like to know if it is possible to calculate the expected value for a continuous random variable as:
$ mathopmathbbE(x)=int xf(x)d(x)=frac1Nsum_i=1^NX_i $
If that is true, how can we convert the integral to the sum? Also, is the sum part $frac1Nsum_i=1^NX_i$ used to calculate the discrete uniform distribution?
probability expectation
I would like to know if it is possible to calculate the expected value for a continuous random variable as:
$ mathopmathbbE(x)=int xf(x)d(x)=frac1Nsum_i=1^NX_i $
If that is true, how can we convert the integral to the sum? Also, is the sum part $frac1Nsum_i=1^NX_i$ used to calculate the discrete uniform distribution?
probability expectation
asked Jul 19 at 17:38
Adam Amin
11
11
Can you explain what is the random variable (or random variables)? What is $x$? What is $X_i$? What is $N$? If $X$ is a random variable with PDF $f_X(x)$ then indeed $E[X] = int_-infty^infty xf_X(x)dx$.
– Michael
Jul 19 at 17:49
@Michael I have a series of different values that I want to calculate the expected value for each of them. An example of the series is 5.6, 3.2, 1.9, 6.1, 7.2. $N$ in this case is 5, $X_i$ is each value in the series.
– Adam Amin
Jul 19 at 17:56
@AdamAmin And where is the continuous distribution?
– callculus
Jul 19 at 18:03
@callculus I am not sure. It is confusing me how to calculate the expected value for each value in the series. I need this because I am calculating the autocorrelation for the series I have and part of the equation is to get the expected value.
– Adam Amin
Jul 19 at 18:09
1
This is called monte carlo integration
– RHowe
Jul 19 at 18:13
add a comment |Â
Can you explain what is the random variable (or random variables)? What is $x$? What is $X_i$? What is $N$? If $X$ is a random variable with PDF $f_X(x)$ then indeed $E[X] = int_-infty^infty xf_X(x)dx$.
– Michael
Jul 19 at 17:49
@Michael I have a series of different values that I want to calculate the expected value for each of them. An example of the series is 5.6, 3.2, 1.9, 6.1, 7.2. $N$ in this case is 5, $X_i$ is each value in the series.
– Adam Amin
Jul 19 at 17:56
@AdamAmin And where is the continuous distribution?
– callculus
Jul 19 at 18:03
@callculus I am not sure. It is confusing me how to calculate the expected value for each value in the series. I need this because I am calculating the autocorrelation for the series I have and part of the equation is to get the expected value.
– Adam Amin
Jul 19 at 18:09
1
This is called monte carlo integration
– RHowe
Jul 19 at 18:13
Can you explain what is the random variable (or random variables)? What is $x$? What is $X_i$? What is $N$? If $X$ is a random variable with PDF $f_X(x)$ then indeed $E[X] = int_-infty^infty xf_X(x)dx$.
– Michael
Jul 19 at 17:49
Can you explain what is the random variable (or random variables)? What is $x$? What is $X_i$? What is $N$? If $X$ is a random variable with PDF $f_X(x)$ then indeed $E[X] = int_-infty^infty xf_X(x)dx$.
– Michael
Jul 19 at 17:49
@Michael I have a series of different values that I want to calculate the expected value for each of them. An example of the series is 5.6, 3.2, 1.9, 6.1, 7.2. $N$ in this case is 5, $X_i$ is each value in the series.
– Adam Amin
Jul 19 at 17:56
@Michael I have a series of different values that I want to calculate the expected value for each of them. An example of the series is 5.6, 3.2, 1.9, 6.1, 7.2. $N$ in this case is 5, $X_i$ is each value in the series.
– Adam Amin
Jul 19 at 17:56
@AdamAmin And where is the continuous distribution?
– callculus
Jul 19 at 18:03
@AdamAmin And where is the continuous distribution?
– callculus
Jul 19 at 18:03
@callculus I am not sure. It is confusing me how to calculate the expected value for each value in the series. I need this because I am calculating the autocorrelation for the series I have and part of the equation is to get the expected value.
– Adam Amin
Jul 19 at 18:09
@callculus I am not sure. It is confusing me how to calculate the expected value for each value in the series. I need this because I am calculating the autocorrelation for the series I have and part of the equation is to get the expected value.
– Adam Amin
Jul 19 at 18:09
1
1
This is called monte carlo integration
– RHowe
Jul 19 at 18:13
This is called monte carlo integration
– RHowe
Jul 19 at 18:13
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
I think you are asking if it is possible to estimate the mean of a continuous distribution by taking the sample mean of a large sample (of size $N$) from that distribution. If so, the answer is Yes, but be aware that the result is an estimate and that the error of the estimate depends on the sample size $N$ (typically, smaller error for larger $N$). Here are some examples in which
we sample at random from a few known distributions. (Sampling done using
R statistical software.)
1) $N=50$ observations from the distributon $mathsfNorm(mu = 75,, sigma=3).$ The R statement rnorm
samples at random from a specified normal population. You will get a somewhat different estimate each time you take
a sample and find its mean. In 95% of runs the answer will be within
x = rnorm(50, 75, 3); mean(x); 2*sd(x)/sqrt(50)
## 74.84001 # aprx E(X) = 75
## 0.7656806 # 95% margin of simulation error
2) $N = 5000$ observations from $mathsfNorm(mu = 75,, sigma=3).$
x = rnorm(5000, 75, 3); mean(x); 2*sd(x)/sqrt(5000)
## 75.00454
## 0.08390667
3) $N = 1000$ observations from $mathsfUnif(a = 50, b = 100).$ The mean of this population distribution is $mu = 75.$
y = runif(1000, 50, 100); mean(y); 2*sd(y)/sqrt(1000)
## 75.54673
## 0.900703
4) $N = 10^6$ observations from an exponential distribution with rate 1/5.
This distribution has mean $mu = 5.$
w = rexp(10^6, 1/5); mean(w); 2*sd(w)/sqrt(10^6)
[1] 4.997817
[1] 0.00998948
5) $n = 10,000$ observations from the beta distribution with shape parameters $alpha = 1.2$ and $beta = 2.8.$ You can look in your text or read about the beta distribution on Wikipedia, if you have not encountered it yet. Its mean is $$mu = int_0^1 x,fracGamma(alpha + beta)Gamma(alpha)+Gamma(beta),x^alpha-1(1-x)^beta-1,dx = fracalphaalpha+beta = 0.3.$$
v = rbeta(10000, 1.2, 2.8); mean(v); 2*sd(v)/sqrt(10000)
[1] 0.3017991
[1] 0.004096549
Notes: (a) The Law of Large Numbers (LLN) guarantees that the mean of a sample
converges 'in probability' to its population mean as $N rightarrow infty.$
By definition, that is $lim_N rightarrow inftyP(|bar X - mu| < epsilon) = 0,$ for any $epsilon > 0.$
(b) The margins of simulation error depend on the dispersion of the population and the sample size. For most non-normal distributions the same
formula I have used in the examples above works because of the Central Limit Theorem (CLT).
(c) As in @Geronimo's Comment (+1), this is one form of 'Monte Carlo Integration.' It is a method often used in applications, but you don't literally "convert the integral into a sum." As remarked above you use the LLN and the CLT to get an approximate answer and to have some confidence how accurate that answer is. (Of course, it's only a 95% confidence interval, so there are some occasions on which the estimate is farther from the target than hoped for.)
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
I think you are asking if it is possible to estimate the mean of a continuous distribution by taking the sample mean of a large sample (of size $N$) from that distribution. If so, the answer is Yes, but be aware that the result is an estimate and that the error of the estimate depends on the sample size $N$ (typically, smaller error for larger $N$). Here are some examples in which
we sample at random from a few known distributions. (Sampling done using
R statistical software.)
1) $N=50$ observations from the distributon $mathsfNorm(mu = 75,, sigma=3).$ The R statement rnorm
samples at random from a specified normal population. You will get a somewhat different estimate each time you take
a sample and find its mean. In 95% of runs the answer will be within
x = rnorm(50, 75, 3); mean(x); 2*sd(x)/sqrt(50)
## 74.84001 # aprx E(X) = 75
## 0.7656806 # 95% margin of simulation error
2) $N = 5000$ observations from $mathsfNorm(mu = 75,, sigma=3).$
x = rnorm(5000, 75, 3); mean(x); 2*sd(x)/sqrt(5000)
## 75.00454
## 0.08390667
3) $N = 1000$ observations from $mathsfUnif(a = 50, b = 100).$ The mean of this population distribution is $mu = 75.$
y = runif(1000, 50, 100); mean(y); 2*sd(y)/sqrt(1000)
## 75.54673
## 0.900703
4) $N = 10^6$ observations from an exponential distribution with rate 1/5.
This distribution has mean $mu = 5.$
w = rexp(10^6, 1/5); mean(w); 2*sd(w)/sqrt(10^6)
[1] 4.997817
[1] 0.00998948
5) $n = 10,000$ observations from the beta distribution with shape parameters $alpha = 1.2$ and $beta = 2.8.$ You can look in your text or read about the beta distribution on Wikipedia, if you have not encountered it yet. Its mean is $$mu = int_0^1 x,fracGamma(alpha + beta)Gamma(alpha)+Gamma(beta),x^alpha-1(1-x)^beta-1,dx = fracalphaalpha+beta = 0.3.$$
v = rbeta(10000, 1.2, 2.8); mean(v); 2*sd(v)/sqrt(10000)
[1] 0.3017991
[1] 0.004096549
Notes: (a) The Law of Large Numbers (LLN) guarantees that the mean of a sample
converges 'in probability' to its population mean as $N rightarrow infty.$
By definition, that is $lim_N rightarrow inftyP(|bar X - mu| < epsilon) = 0,$ for any $epsilon > 0.$
(b) The margins of simulation error depend on the dispersion of the population and the sample size. For most non-normal distributions the same
formula I have used in the examples above works because of the Central Limit Theorem (CLT).
(c) As in @Geronimo's Comment (+1), this is one form of 'Monte Carlo Integration.' It is a method often used in applications, but you don't literally "convert the integral into a sum." As remarked above you use the LLN and the CLT to get an approximate answer and to have some confidence how accurate that answer is. (Of course, it's only a 95% confidence interval, so there are some occasions on which the estimate is farther from the target than hoped for.)
add a comment |Â
up vote
0
down vote
I think you are asking if it is possible to estimate the mean of a continuous distribution by taking the sample mean of a large sample (of size $N$) from that distribution. If so, the answer is Yes, but be aware that the result is an estimate and that the error of the estimate depends on the sample size $N$ (typically, smaller error for larger $N$). Here are some examples in which
we sample at random from a few known distributions. (Sampling done using
R statistical software.)
1) $N=50$ observations from the distributon $mathsfNorm(mu = 75,, sigma=3).$ The R statement rnorm
samples at random from a specified normal population. You will get a somewhat different estimate each time you take
a sample and find its mean. In 95% of runs the answer will be within
x = rnorm(50, 75, 3); mean(x); 2*sd(x)/sqrt(50)
## 74.84001 # aprx E(X) = 75
## 0.7656806 # 95% margin of simulation error
2) $N = 5000$ observations from $mathsfNorm(mu = 75,, sigma=3).$
x = rnorm(5000, 75, 3); mean(x); 2*sd(x)/sqrt(5000)
## 75.00454
## 0.08390667
3) $N = 1000$ observations from $mathsfUnif(a = 50, b = 100).$ The mean of this population distribution is $mu = 75.$
y = runif(1000, 50, 100); mean(y); 2*sd(y)/sqrt(1000)
## 75.54673
## 0.900703
4) $N = 10^6$ observations from an exponential distribution with rate 1/5.
This distribution has mean $mu = 5.$
w = rexp(10^6, 1/5); mean(w); 2*sd(w)/sqrt(10^6)
[1] 4.997817
[1] 0.00998948
5) $n = 10,000$ observations from the beta distribution with shape parameters $alpha = 1.2$ and $beta = 2.8.$ You can look in your text or read about the beta distribution on Wikipedia, if you have not encountered it yet. Its mean is $$mu = int_0^1 x,fracGamma(alpha + beta)Gamma(alpha)+Gamma(beta),x^alpha-1(1-x)^beta-1,dx = fracalphaalpha+beta = 0.3.$$
v = rbeta(10000, 1.2, 2.8); mean(v); 2*sd(v)/sqrt(10000)
[1] 0.3017991
[1] 0.004096549
Notes: (a) The Law of Large Numbers (LLN) guarantees that the mean of a sample
converges 'in probability' to its population mean as $N rightarrow infty.$
By definition, that is $lim_N rightarrow inftyP(|bar X - mu| < epsilon) = 0,$ for any $epsilon > 0.$
(b) The margins of simulation error depend on the dispersion of the population and the sample size. For most non-normal distributions the same
formula I have used in the examples above works because of the Central Limit Theorem (CLT).
(c) As in @Geronimo's Comment (+1), this is one form of 'Monte Carlo Integration.' It is a method often used in applications, but you don't literally "convert the integral into a sum." As remarked above you use the LLN and the CLT to get an approximate answer and to have some confidence how accurate that answer is. (Of course, it's only a 95% confidence interval, so there are some occasions on which the estimate is farther from the target than hoped for.)
add a comment |Â
up vote
0
down vote
up vote
0
down vote
I think you are asking if it is possible to estimate the mean of a continuous distribution by taking the sample mean of a large sample (of size $N$) from that distribution. If so, the answer is Yes, but be aware that the result is an estimate and that the error of the estimate depends on the sample size $N$ (typically, smaller error for larger $N$). Here are some examples in which
we sample at random from a few known distributions. (Sampling done using
R statistical software.)
1) $N=50$ observations from the distributon $mathsfNorm(mu = 75,, sigma=3).$ The R statement rnorm
samples at random from a specified normal population. You will get a somewhat different estimate each time you take
a sample and find its mean. In 95% of runs the answer will be within
x = rnorm(50, 75, 3); mean(x); 2*sd(x)/sqrt(50)
## 74.84001 # aprx E(X) = 75
## 0.7656806 # 95% margin of simulation error
2) $N = 5000$ observations from $mathsfNorm(mu = 75,, sigma=3).$
x = rnorm(5000, 75, 3); mean(x); 2*sd(x)/sqrt(5000)
## 75.00454
## 0.08390667
3) $N = 1000$ observations from $mathsfUnif(a = 50, b = 100).$ The mean of this population distribution is $mu = 75.$
y = runif(1000, 50, 100); mean(y); 2*sd(y)/sqrt(1000)
## 75.54673
## 0.900703
4) $N = 10^6$ observations from an exponential distribution with rate 1/5.
This distribution has mean $mu = 5.$
w = rexp(10^6, 1/5); mean(w); 2*sd(w)/sqrt(10^6)
[1] 4.997817
[1] 0.00998948
5) $n = 10,000$ observations from the beta distribution with shape parameters $alpha = 1.2$ and $beta = 2.8.$ You can look in your text or read about the beta distribution on Wikipedia, if you have not encountered it yet. Its mean is $$mu = int_0^1 x,fracGamma(alpha + beta)Gamma(alpha)+Gamma(beta),x^alpha-1(1-x)^beta-1,dx = fracalphaalpha+beta = 0.3.$$
v = rbeta(10000, 1.2, 2.8); mean(v); 2*sd(v)/sqrt(10000)
[1] 0.3017991
[1] 0.004096549
Notes: (a) The Law of Large Numbers (LLN) guarantees that the mean of a sample
converges 'in probability' to its population mean as $N rightarrow infty.$
By definition, that is $lim_N rightarrow inftyP(|bar X - mu| < epsilon) = 0,$ for any $epsilon > 0.$
(b) The margins of simulation error depend on the dispersion of the population and the sample size. For most non-normal distributions the same
formula I have used in the examples above works because of the Central Limit Theorem (CLT).
(c) As in @Geronimo's Comment (+1), this is one form of 'Monte Carlo Integration.' It is a method often used in applications, but you don't literally "convert the integral into a sum." As remarked above you use the LLN and the CLT to get an approximate answer and to have some confidence how accurate that answer is. (Of course, it's only a 95% confidence interval, so there are some occasions on which the estimate is farther from the target than hoped for.)
I think you are asking if it is possible to estimate the mean of a continuous distribution by taking the sample mean of a large sample (of size $N$) from that distribution. If so, the answer is Yes, but be aware that the result is an estimate and that the error of the estimate depends on the sample size $N$ (typically, smaller error for larger $N$). Here are some examples in which
we sample at random from a few known distributions. (Sampling done using
R statistical software.)
1) $N=50$ observations from the distributon $mathsfNorm(mu = 75,, sigma=3).$ The R statement rnorm
samples at random from a specified normal population. You will get a somewhat different estimate each time you take
a sample and find its mean. In 95% of runs the answer will be within
x = rnorm(50, 75, 3); mean(x); 2*sd(x)/sqrt(50)
## 74.84001 # aprx E(X) = 75
## 0.7656806 # 95% margin of simulation error
2) $N = 5000$ observations from $mathsfNorm(mu = 75,, sigma=3).$
x = rnorm(5000, 75, 3); mean(x); 2*sd(x)/sqrt(5000)
## 75.00454
## 0.08390667
3) $N = 1000$ observations from $mathsfUnif(a = 50, b = 100).$ The mean of this population distribution is $mu = 75.$
y = runif(1000, 50, 100); mean(y); 2*sd(y)/sqrt(1000)
## 75.54673
## 0.900703
4) $N = 10^6$ observations from an exponential distribution with rate 1/5.
This distribution has mean $mu = 5.$
w = rexp(10^6, 1/5); mean(w); 2*sd(w)/sqrt(10^6)
[1] 4.997817
[1] 0.00998948
5) $n = 10,000$ observations from the beta distribution with shape parameters $alpha = 1.2$ and $beta = 2.8.$ You can look in your text or read about the beta distribution on Wikipedia, if you have not encountered it yet. Its mean is $$mu = int_0^1 x,fracGamma(alpha + beta)Gamma(alpha)+Gamma(beta),x^alpha-1(1-x)^beta-1,dx = fracalphaalpha+beta = 0.3.$$
v = rbeta(10000, 1.2, 2.8); mean(v); 2*sd(v)/sqrt(10000)
[1] 0.3017991
[1] 0.004096549
Notes: (a) The Law of Large Numbers (LLN) guarantees that the mean of a sample
converges 'in probability' to its population mean as $N rightarrow infty.$
By definition, that is $lim_N rightarrow inftyP(|bar X - mu| < epsilon) = 0,$ for any $epsilon > 0.$
(b) The margins of simulation error depend on the dispersion of the population and the sample size. For most non-normal distributions the same
formula I have used in the examples above works because of the Central Limit Theorem (CLT).
(c) As in @Geronimo's Comment (+1), this is one form of 'Monte Carlo Integration.' It is a method often used in applications, but you don't literally "convert the integral into a sum." As remarked above you use the LLN and the CLT to get an approximate answer and to have some confidence how accurate that answer is. (Of course, it's only a 95% confidence interval, so there are some occasions on which the estimate is farther from the target than hoped for.)
edited Jul 20 at 20:58
answered Jul 20 at 20:30
BruceET
33.2k61440
33.2k61440
add a comment |Â
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2856893%2fis-is-possible-to-calculate-the-expected-value-for-a-continuous-variable-using-t%23new-answer', 'question_page');
);
Post as a guest
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
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
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
Can you explain what is the random variable (or random variables)? What is $x$? What is $X_i$? What is $N$? If $X$ is a random variable with PDF $f_X(x)$ then indeed $E[X] = int_-infty^infty xf_X(x)dx$.
– Michael
Jul 19 at 17:49
@Michael I have a series of different values that I want to calculate the expected value for each of them. An example of the series is 5.6, 3.2, 1.9, 6.1, 7.2. $N$ in this case is 5, $X_i$ is each value in the series.
– Adam Amin
Jul 19 at 17:56
@AdamAmin And where is the continuous distribution?
– callculus
Jul 19 at 18:03
@callculus I am not sure. It is confusing me how to calculate the expected value for each value in the series. I need this because I am calculating the autocorrelation for the series I have and part of the equation is to get the expected value.
– Adam Amin
Jul 19 at 18:09
1
This is called monte carlo integration
– RHowe
Jul 19 at 18:13