How do I generate distribution of positive numbers only with min, max and mean?Calculating distribution from min, mean, and maxHow to perform goodness of fit test and how to assign probability with uniform distribution?How to generate a non-normal correlated bivariate distributionHow do I test for a symmetric distribution?Truncate lognormal distribution with excelAre there any inverse distribution graph that looks like this?Generate data with skewed distribution and known percentiles, mean and medianSimulating data from an unknown distribution given min and max valuesEstimating gamma distribution parameters using sample mean and stdHow to draw one standard deviation range around the mean of a skewed distributionSample from a distribution if only mean median max etc. are given

Automatic Habit of Meditation

Reduce column width of table while also aligning values at decimal point

Knights fighting a steam locomotive they believe is a dragon

How can I tell if there was a power cut while I was out?

What are the exact meanings of roll, pitch and yaw?

How do we explain the E major chord in this progression?

Iterate over non-const variables in C++

Why can't my huge trees be chopped down?

How to get the two pictures aligned

Why is chess failing to attract big name sponsors?

How do I stop my characters falling in love?

401(k) investment after being fired. Do I own it?

Invert Some Switches on a Switchboard

What is the meaning of "you has the wind of me"?

This message is flooding my syslog, how to find where it comes from?

Do the licences permit GPL- and BSD-licensed applications to be used for government work?

What was the rationale behind 36 bit computer architectures?

Why was Sauron not trying to find the Ring, and instead of preparing for war?

How important is a good quality camera for good photography?

Send a single HTML email from Thunderbird, overriding the default "plain text" setting

Grid/table with lots of buttons

Is it legal for private citizens to "impound" e-scooters?

Strange Cron Job takes up 100% of CPU Ubuntu 18 LTS Server

What causes long-running disputes over sovereignty?



How do I generate distribution of positive numbers only with min, max and mean?


Calculating distribution from min, mean, and maxHow to perform goodness of fit test and how to assign probability with uniform distribution?How to generate a non-normal correlated bivariate distributionHow do I test for a symmetric distribution?Truncate lognormal distribution with excelAre there any inverse distribution graph that looks like this?Generate data with skewed distribution and known percentiles, mean and medianSimulating data from an unknown distribution given min and max valuesEstimating gamma distribution parameters using sample mean and stdHow to draw one standard deviation range around the mean of a skewed distributionSample from a distribution if only mean median max etc. are given






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








1












$begingroup$


I am trying to generate a sample of 2000 rows. I have the following values
min = 80
max = 12000
mean = 500



I want to generate only positive numbers. I tried using triangular distribution and range rule(sd = max-min/4). The values were negative.



Is there anyway I can generate only positive numbers?



Thanks,
Anusha










share|cite|improve this question









$endgroup$







  • 1




    $begingroup$
    What kind of distribution of values do you want?
    $endgroup$
    – Dave
    7 hours ago










  • $begingroup$
    as long as they are positive and has mean = 500, min = 80 and max = 12000
    $endgroup$
    – user3437212
    7 hours ago










  • $begingroup$
    min and max is fine but the mean is way too off in triangular distribution, do you have any other suggestion?
    $endgroup$
    – user3437212
    7 hours ago










  • $begingroup$
    Strongly related: stats.stackexchange.com/q/236449/35989
    $endgroup$
    – Tim
    6 hours ago

















1












$begingroup$


I am trying to generate a sample of 2000 rows. I have the following values
min = 80
max = 12000
mean = 500



I want to generate only positive numbers. I tried using triangular distribution and range rule(sd = max-min/4). The values were negative.



Is there anyway I can generate only positive numbers?



Thanks,
Anusha










share|cite|improve this question









$endgroup$







  • 1




    $begingroup$
    What kind of distribution of values do you want?
    $endgroup$
    – Dave
    7 hours ago










  • $begingroup$
    as long as they are positive and has mean = 500, min = 80 and max = 12000
    $endgroup$
    – user3437212
    7 hours ago










  • $begingroup$
    min and max is fine but the mean is way too off in triangular distribution, do you have any other suggestion?
    $endgroup$
    – user3437212
    7 hours ago










  • $begingroup$
    Strongly related: stats.stackexchange.com/q/236449/35989
    $endgroup$
    – Tim
    6 hours ago













1












1








1


0



$begingroup$


I am trying to generate a sample of 2000 rows. I have the following values
min = 80
max = 12000
mean = 500



I want to generate only positive numbers. I tried using triangular distribution and range rule(sd = max-min/4). The values were negative.



Is there anyway I can generate only positive numbers?



Thanks,
Anusha










share|cite|improve this question









$endgroup$




I am trying to generate a sample of 2000 rows. I have the following values
min = 80
max = 12000
mean = 500



I want to generate only positive numbers. I tried using triangular distribution and range rule(sd = max-min/4). The values were negative.



Is there anyway I can generate only positive numbers?



Thanks,
Anusha







distributions simulation






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked 8 hours ago









user3437212user3437212

324 bronze badges




324 bronze badges







  • 1




    $begingroup$
    What kind of distribution of values do you want?
    $endgroup$
    – Dave
    7 hours ago










  • $begingroup$
    as long as they are positive and has mean = 500, min = 80 and max = 12000
    $endgroup$
    – user3437212
    7 hours ago










  • $begingroup$
    min and max is fine but the mean is way too off in triangular distribution, do you have any other suggestion?
    $endgroup$
    – user3437212
    7 hours ago










  • $begingroup$
    Strongly related: stats.stackexchange.com/q/236449/35989
    $endgroup$
    – Tim
    6 hours ago












  • 1




    $begingroup$
    What kind of distribution of values do you want?
    $endgroup$
    – Dave
    7 hours ago










  • $begingroup$
    as long as they are positive and has mean = 500, min = 80 and max = 12000
    $endgroup$
    – user3437212
    7 hours ago










  • $begingroup$
    min and max is fine but the mean is way too off in triangular distribution, do you have any other suggestion?
    $endgroup$
    – user3437212
    7 hours ago










  • $begingroup$
    Strongly related: stats.stackexchange.com/q/236449/35989
    $endgroup$
    – Tim
    6 hours ago







1




1




$begingroup$
What kind of distribution of values do you want?
$endgroup$
– Dave
7 hours ago




$begingroup$
What kind of distribution of values do you want?
$endgroup$
– Dave
7 hours ago












$begingroup$
as long as they are positive and has mean = 500, min = 80 and max = 12000
$endgroup$
– user3437212
7 hours ago




$begingroup$
as long as they are positive and has mean = 500, min = 80 and max = 12000
$endgroup$
– user3437212
7 hours ago












$begingroup$
min and max is fine but the mean is way too off in triangular distribution, do you have any other suggestion?
$endgroup$
– user3437212
7 hours ago




$begingroup$
min and max is fine but the mean is way too off in triangular distribution, do you have any other suggestion?
$endgroup$
– user3437212
7 hours ago












$begingroup$
Strongly related: stats.stackexchange.com/q/236449/35989
$endgroup$
– Tim
6 hours ago




$begingroup$
Strongly related: stats.stackexchange.com/q/236449/35989
$endgroup$
– Tim
6 hours ago










2 Answers
2






active

oldest

votes


















6












$begingroup$

While the problem is very much ill-posed, since there is an infinite range of distributions satisfying these constraints, a possible solution is to find the maximum entropy distribution under the constraint of a support of $(80,12000)$ [thus using the uniform measure on that interval as the reference measure] and a mean of $mathbb E[X]=500$ is of the form
$$p(x)=expalpha+beta x,mathbb I_(80,1200)(x)$$
with
$$int_80^12000 expalpha+beta x,text dx=1qquadtextandqquad
int_80^12000 xexpalpha+beta x,text dx=500$$

which leads to
$$exp-alpha=beta^-1[exp12000beta-exp80beta]$$
and$$beta^-1expalpha[12000exp12000beta-80exp80beta]-beta^-1=500$$which can be solved numerically in $beta$. Leading to
$$beta^*=-.00238quadtextandquadalpha^*=-5.850$$which can be easily simulated as a truncated exponential distribution, by inversion of the cdf, e.g., using qexp() in R. For instance,



function(n=1)
return(qexp(pexp(80,.00238)+runif(n)*
(pexp(12000,.00238)-pexp(80,.00238)),.00238))


If the question is instead about simulating a sample $X_1:2000$ such that $$min(X_1:2000)=80,quadmax(X_1:2000)=1200,quadbar X_1:2000=500$$
there is again an infinite range of solutions, the simplest being a multinomial distribution constrained by its minimum being 80 and its maximum being 12000 since
$$underbraceX_(1)_80+cdots+underbraceX_(2000)_12000 = 80 + 1998times 987920 + 12000= 2000times 500$$






share|cite|improve this answer











$endgroup$












  • $begingroup$
    Is your comment about $X_1:2000$ about ensuring that the sample (not the population) has a mean of 500? Also, two clarifications would be helpful. 1) Why do something in the form of $expalpha + beta X$? 2) Once we solve for $alpha$ and $beta$, how do to simulate draws from that PDF?
    $endgroup$
    – Dave
    6 hours ago











  • $begingroup$
    As indicated in the answer, the second interpretation of the question is to see all the constraints as constraints on the sample, not on the distribution. And as indicated in the answer, the (truncated) exponential form of the distribution follows from maximum entropy principles.
    $endgroup$
    – Xi'an
    6 hours ago










  • $begingroup$
    @Xi'an Thank you this helps!
    $endgroup$
    – user3437212
    5 hours ago


















4












$begingroup$

If you don't care about the distribution aside from min, max, and mean, then there is a simple answer.



Take 96.476510067114100 percent of draws as 80 and 3.523489932885910 percent of draws as 12000. On average, you get 500, and you have your min and max. I calculated the percentages by solving a system of equations



$$a + b =1$$ $$80a + 12000b = 500$$



The first equation establishes the the values must sum to one, making sure that we are dealing with probabilities. The second equation get us our average of 500.



D <- rep(NA,2000) # define a vector of NAs to hold your sampled values
for (i in 1:2000)
X <- rbinom(1,1,0.96476510067114100) # determine which value you'll take, 80 or 12000
if (X==0)D[i] <- 12000 # declare observation i as 12000
if (X==1)D[i] <- 80 # declare observation i as 80






share|cite|improve this answer











$endgroup$












  • $begingroup$
    Thanks Dave! But I don't want only 80s and 12000s in my distribution. I would like a range of values but all positive
    $endgroup$
    – user3437212
    7 hours ago










  • $begingroup$
    I'm sorry I was not clear earlier
    $endgroup$
    – user3437212
    7 hours ago






  • 2




    $begingroup$
    We can construct a different distribution, but what requirements do you have?
    $endgroup$
    – Dave
    7 hours ago











  • $begingroup$
    normal or a poisson but no negative values
    $endgroup$
    – user3437212
    7 hours ago






  • 5




    $begingroup$
    Normal is out, since it can take all real values. More helpful, though, would be to know what you're considering either of those distributions. So...why normal or Poisson?
    $endgroup$
    – Dave
    7 hours ago













Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "65"
;
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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstats.stackexchange.com%2fquestions%2f419348%2fhow-do-i-generate-distribution-of-positive-numbers-only-with-min-max-and-mean%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









6












$begingroup$

While the problem is very much ill-posed, since there is an infinite range of distributions satisfying these constraints, a possible solution is to find the maximum entropy distribution under the constraint of a support of $(80,12000)$ [thus using the uniform measure on that interval as the reference measure] and a mean of $mathbb E[X]=500$ is of the form
$$p(x)=expalpha+beta x,mathbb I_(80,1200)(x)$$
with
$$int_80^12000 expalpha+beta x,text dx=1qquadtextandqquad
int_80^12000 xexpalpha+beta x,text dx=500$$

which leads to
$$exp-alpha=beta^-1[exp12000beta-exp80beta]$$
and$$beta^-1expalpha[12000exp12000beta-80exp80beta]-beta^-1=500$$which can be solved numerically in $beta$. Leading to
$$beta^*=-.00238quadtextandquadalpha^*=-5.850$$which can be easily simulated as a truncated exponential distribution, by inversion of the cdf, e.g., using qexp() in R. For instance,



function(n=1)
return(qexp(pexp(80,.00238)+runif(n)*
(pexp(12000,.00238)-pexp(80,.00238)),.00238))


If the question is instead about simulating a sample $X_1:2000$ such that $$min(X_1:2000)=80,quadmax(X_1:2000)=1200,quadbar X_1:2000=500$$
there is again an infinite range of solutions, the simplest being a multinomial distribution constrained by its minimum being 80 and its maximum being 12000 since
$$underbraceX_(1)_80+cdots+underbraceX_(2000)_12000 = 80 + 1998times 987920 + 12000= 2000times 500$$






share|cite|improve this answer











$endgroup$












  • $begingroup$
    Is your comment about $X_1:2000$ about ensuring that the sample (not the population) has a mean of 500? Also, two clarifications would be helpful. 1) Why do something in the form of $expalpha + beta X$? 2) Once we solve for $alpha$ and $beta$, how do to simulate draws from that PDF?
    $endgroup$
    – Dave
    6 hours ago











  • $begingroup$
    As indicated in the answer, the second interpretation of the question is to see all the constraints as constraints on the sample, not on the distribution. And as indicated in the answer, the (truncated) exponential form of the distribution follows from maximum entropy principles.
    $endgroup$
    – Xi'an
    6 hours ago










  • $begingroup$
    @Xi'an Thank you this helps!
    $endgroup$
    – user3437212
    5 hours ago















6












$begingroup$

While the problem is very much ill-posed, since there is an infinite range of distributions satisfying these constraints, a possible solution is to find the maximum entropy distribution under the constraint of a support of $(80,12000)$ [thus using the uniform measure on that interval as the reference measure] and a mean of $mathbb E[X]=500$ is of the form
$$p(x)=expalpha+beta x,mathbb I_(80,1200)(x)$$
with
$$int_80^12000 expalpha+beta x,text dx=1qquadtextandqquad
int_80^12000 xexpalpha+beta x,text dx=500$$

which leads to
$$exp-alpha=beta^-1[exp12000beta-exp80beta]$$
and$$beta^-1expalpha[12000exp12000beta-80exp80beta]-beta^-1=500$$which can be solved numerically in $beta$. Leading to
$$beta^*=-.00238quadtextandquadalpha^*=-5.850$$which can be easily simulated as a truncated exponential distribution, by inversion of the cdf, e.g., using qexp() in R. For instance,



function(n=1)
return(qexp(pexp(80,.00238)+runif(n)*
(pexp(12000,.00238)-pexp(80,.00238)),.00238))


If the question is instead about simulating a sample $X_1:2000$ such that $$min(X_1:2000)=80,quadmax(X_1:2000)=1200,quadbar X_1:2000=500$$
there is again an infinite range of solutions, the simplest being a multinomial distribution constrained by its minimum being 80 and its maximum being 12000 since
$$underbraceX_(1)_80+cdots+underbraceX_(2000)_12000 = 80 + 1998times 987920 + 12000= 2000times 500$$






share|cite|improve this answer











$endgroup$












  • $begingroup$
    Is your comment about $X_1:2000$ about ensuring that the sample (not the population) has a mean of 500? Also, two clarifications would be helpful. 1) Why do something in the form of $expalpha + beta X$? 2) Once we solve for $alpha$ and $beta$, how do to simulate draws from that PDF?
    $endgroup$
    – Dave
    6 hours ago











  • $begingroup$
    As indicated in the answer, the second interpretation of the question is to see all the constraints as constraints on the sample, not on the distribution. And as indicated in the answer, the (truncated) exponential form of the distribution follows from maximum entropy principles.
    $endgroup$
    – Xi'an
    6 hours ago










  • $begingroup$
    @Xi'an Thank you this helps!
    $endgroup$
    – user3437212
    5 hours ago













6












6








6





$begingroup$

While the problem is very much ill-posed, since there is an infinite range of distributions satisfying these constraints, a possible solution is to find the maximum entropy distribution under the constraint of a support of $(80,12000)$ [thus using the uniform measure on that interval as the reference measure] and a mean of $mathbb E[X]=500$ is of the form
$$p(x)=expalpha+beta x,mathbb I_(80,1200)(x)$$
with
$$int_80^12000 expalpha+beta x,text dx=1qquadtextandqquad
int_80^12000 xexpalpha+beta x,text dx=500$$

which leads to
$$exp-alpha=beta^-1[exp12000beta-exp80beta]$$
and$$beta^-1expalpha[12000exp12000beta-80exp80beta]-beta^-1=500$$which can be solved numerically in $beta$. Leading to
$$beta^*=-.00238quadtextandquadalpha^*=-5.850$$which can be easily simulated as a truncated exponential distribution, by inversion of the cdf, e.g., using qexp() in R. For instance,



function(n=1)
return(qexp(pexp(80,.00238)+runif(n)*
(pexp(12000,.00238)-pexp(80,.00238)),.00238))


If the question is instead about simulating a sample $X_1:2000$ such that $$min(X_1:2000)=80,quadmax(X_1:2000)=1200,quadbar X_1:2000=500$$
there is again an infinite range of solutions, the simplest being a multinomial distribution constrained by its minimum being 80 and its maximum being 12000 since
$$underbraceX_(1)_80+cdots+underbraceX_(2000)_12000 = 80 + 1998times 987920 + 12000= 2000times 500$$






share|cite|improve this answer











$endgroup$



While the problem is very much ill-posed, since there is an infinite range of distributions satisfying these constraints, a possible solution is to find the maximum entropy distribution under the constraint of a support of $(80,12000)$ [thus using the uniform measure on that interval as the reference measure] and a mean of $mathbb E[X]=500$ is of the form
$$p(x)=expalpha+beta x,mathbb I_(80,1200)(x)$$
with
$$int_80^12000 expalpha+beta x,text dx=1qquadtextandqquad
int_80^12000 xexpalpha+beta x,text dx=500$$

which leads to
$$exp-alpha=beta^-1[exp12000beta-exp80beta]$$
and$$beta^-1expalpha[12000exp12000beta-80exp80beta]-beta^-1=500$$which can be solved numerically in $beta$. Leading to
$$beta^*=-.00238quadtextandquadalpha^*=-5.850$$which can be easily simulated as a truncated exponential distribution, by inversion of the cdf, e.g., using qexp() in R. For instance,



function(n=1)
return(qexp(pexp(80,.00238)+runif(n)*
(pexp(12000,.00238)-pexp(80,.00238)),.00238))


If the question is instead about simulating a sample $X_1:2000$ such that $$min(X_1:2000)=80,quadmax(X_1:2000)=1200,quadbar X_1:2000=500$$
there is again an infinite range of solutions, the simplest being a multinomial distribution constrained by its minimum being 80 and its maximum being 12000 since
$$underbraceX_(1)_80+cdots+underbraceX_(2000)_12000 = 80 + 1998times 987920 + 12000= 2000times 500$$







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited 6 hours ago

























answered 7 hours ago









Xi'anXi'an

61.7k8 gold badges99 silver badges376 bronze badges




61.7k8 gold badges99 silver badges376 bronze badges











  • $begingroup$
    Is your comment about $X_1:2000$ about ensuring that the sample (not the population) has a mean of 500? Also, two clarifications would be helpful. 1) Why do something in the form of $expalpha + beta X$? 2) Once we solve for $alpha$ and $beta$, how do to simulate draws from that PDF?
    $endgroup$
    – Dave
    6 hours ago











  • $begingroup$
    As indicated in the answer, the second interpretation of the question is to see all the constraints as constraints on the sample, not on the distribution. And as indicated in the answer, the (truncated) exponential form of the distribution follows from maximum entropy principles.
    $endgroup$
    – Xi'an
    6 hours ago










  • $begingroup$
    @Xi'an Thank you this helps!
    $endgroup$
    – user3437212
    5 hours ago
















  • $begingroup$
    Is your comment about $X_1:2000$ about ensuring that the sample (not the population) has a mean of 500? Also, two clarifications would be helpful. 1) Why do something in the form of $expalpha + beta X$? 2) Once we solve for $alpha$ and $beta$, how do to simulate draws from that PDF?
    $endgroup$
    – Dave
    6 hours ago











  • $begingroup$
    As indicated in the answer, the second interpretation of the question is to see all the constraints as constraints on the sample, not on the distribution. And as indicated in the answer, the (truncated) exponential form of the distribution follows from maximum entropy principles.
    $endgroup$
    – Xi'an
    6 hours ago










  • $begingroup$
    @Xi'an Thank you this helps!
    $endgroup$
    – user3437212
    5 hours ago















$begingroup$
Is your comment about $X_1:2000$ about ensuring that the sample (not the population) has a mean of 500? Also, two clarifications would be helpful. 1) Why do something in the form of $expalpha + beta X$? 2) Once we solve for $alpha$ and $beta$, how do to simulate draws from that PDF?
$endgroup$
– Dave
6 hours ago





$begingroup$
Is your comment about $X_1:2000$ about ensuring that the sample (not the population) has a mean of 500? Also, two clarifications would be helpful. 1) Why do something in the form of $expalpha + beta X$? 2) Once we solve for $alpha$ and $beta$, how do to simulate draws from that PDF?
$endgroup$
– Dave
6 hours ago













$begingroup$
As indicated in the answer, the second interpretation of the question is to see all the constraints as constraints on the sample, not on the distribution. And as indicated in the answer, the (truncated) exponential form of the distribution follows from maximum entropy principles.
$endgroup$
– Xi'an
6 hours ago




$begingroup$
As indicated in the answer, the second interpretation of the question is to see all the constraints as constraints on the sample, not on the distribution. And as indicated in the answer, the (truncated) exponential form of the distribution follows from maximum entropy principles.
$endgroup$
– Xi'an
6 hours ago












$begingroup$
@Xi'an Thank you this helps!
$endgroup$
– user3437212
5 hours ago




$begingroup$
@Xi'an Thank you this helps!
$endgroup$
– user3437212
5 hours ago













4












$begingroup$

If you don't care about the distribution aside from min, max, and mean, then there is a simple answer.



Take 96.476510067114100 percent of draws as 80 and 3.523489932885910 percent of draws as 12000. On average, you get 500, and you have your min and max. I calculated the percentages by solving a system of equations



$$a + b =1$$ $$80a + 12000b = 500$$



The first equation establishes the the values must sum to one, making sure that we are dealing with probabilities. The second equation get us our average of 500.



D <- rep(NA,2000) # define a vector of NAs to hold your sampled values
for (i in 1:2000)
X <- rbinom(1,1,0.96476510067114100) # determine which value you'll take, 80 or 12000
if (X==0)D[i] <- 12000 # declare observation i as 12000
if (X==1)D[i] <- 80 # declare observation i as 80






share|cite|improve this answer











$endgroup$












  • $begingroup$
    Thanks Dave! But I don't want only 80s and 12000s in my distribution. I would like a range of values but all positive
    $endgroup$
    – user3437212
    7 hours ago










  • $begingroup$
    I'm sorry I was not clear earlier
    $endgroup$
    – user3437212
    7 hours ago






  • 2




    $begingroup$
    We can construct a different distribution, but what requirements do you have?
    $endgroup$
    – Dave
    7 hours ago











  • $begingroup$
    normal or a poisson but no negative values
    $endgroup$
    – user3437212
    7 hours ago






  • 5




    $begingroup$
    Normal is out, since it can take all real values. More helpful, though, would be to know what you're considering either of those distributions. So...why normal or Poisson?
    $endgroup$
    – Dave
    7 hours ago















4












$begingroup$

If you don't care about the distribution aside from min, max, and mean, then there is a simple answer.



Take 96.476510067114100 percent of draws as 80 and 3.523489932885910 percent of draws as 12000. On average, you get 500, and you have your min and max. I calculated the percentages by solving a system of equations



$$a + b =1$$ $$80a + 12000b = 500$$



The first equation establishes the the values must sum to one, making sure that we are dealing with probabilities. The second equation get us our average of 500.



D <- rep(NA,2000) # define a vector of NAs to hold your sampled values
for (i in 1:2000)
X <- rbinom(1,1,0.96476510067114100) # determine which value you'll take, 80 or 12000
if (X==0)D[i] <- 12000 # declare observation i as 12000
if (X==1)D[i] <- 80 # declare observation i as 80






share|cite|improve this answer











$endgroup$












  • $begingroup$
    Thanks Dave! But I don't want only 80s and 12000s in my distribution. I would like a range of values but all positive
    $endgroup$
    – user3437212
    7 hours ago










  • $begingroup$
    I'm sorry I was not clear earlier
    $endgroup$
    – user3437212
    7 hours ago






  • 2




    $begingroup$
    We can construct a different distribution, but what requirements do you have?
    $endgroup$
    – Dave
    7 hours ago











  • $begingroup$
    normal or a poisson but no negative values
    $endgroup$
    – user3437212
    7 hours ago






  • 5




    $begingroup$
    Normal is out, since it can take all real values. More helpful, though, would be to know what you're considering either of those distributions. So...why normal or Poisson?
    $endgroup$
    – Dave
    7 hours ago













4












4








4





$begingroup$

If you don't care about the distribution aside from min, max, and mean, then there is a simple answer.



Take 96.476510067114100 percent of draws as 80 and 3.523489932885910 percent of draws as 12000. On average, you get 500, and you have your min and max. I calculated the percentages by solving a system of equations



$$a + b =1$$ $$80a + 12000b = 500$$



The first equation establishes the the values must sum to one, making sure that we are dealing with probabilities. The second equation get us our average of 500.



D <- rep(NA,2000) # define a vector of NAs to hold your sampled values
for (i in 1:2000)
X <- rbinom(1,1,0.96476510067114100) # determine which value you'll take, 80 or 12000
if (X==0)D[i] <- 12000 # declare observation i as 12000
if (X==1)D[i] <- 80 # declare observation i as 80






share|cite|improve this answer











$endgroup$



If you don't care about the distribution aside from min, max, and mean, then there is a simple answer.



Take 96.476510067114100 percent of draws as 80 and 3.523489932885910 percent of draws as 12000. On average, you get 500, and you have your min and max. I calculated the percentages by solving a system of equations



$$a + b =1$$ $$80a + 12000b = 500$$



The first equation establishes the the values must sum to one, making sure that we are dealing with probabilities. The second equation get us our average of 500.



D <- rep(NA,2000) # define a vector of NAs to hold your sampled values
for (i in 1:2000)
X <- rbinom(1,1,0.96476510067114100) # determine which value you'll take, 80 or 12000
if (X==0)D[i] <- 12000 # declare observation i as 12000
if (X==1)D[i] <- 80 # declare observation i as 80







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited 4 hours ago

























answered 7 hours ago









DaveDave

70210 bronze badges




70210 bronze badges











  • $begingroup$
    Thanks Dave! But I don't want only 80s and 12000s in my distribution. I would like a range of values but all positive
    $endgroup$
    – user3437212
    7 hours ago










  • $begingroup$
    I'm sorry I was not clear earlier
    $endgroup$
    – user3437212
    7 hours ago






  • 2




    $begingroup$
    We can construct a different distribution, but what requirements do you have?
    $endgroup$
    – Dave
    7 hours ago











  • $begingroup$
    normal or a poisson but no negative values
    $endgroup$
    – user3437212
    7 hours ago






  • 5




    $begingroup$
    Normal is out, since it can take all real values. More helpful, though, would be to know what you're considering either of those distributions. So...why normal or Poisson?
    $endgroup$
    – Dave
    7 hours ago
















  • $begingroup$
    Thanks Dave! But I don't want only 80s and 12000s in my distribution. I would like a range of values but all positive
    $endgroup$
    – user3437212
    7 hours ago










  • $begingroup$
    I'm sorry I was not clear earlier
    $endgroup$
    – user3437212
    7 hours ago






  • 2




    $begingroup$
    We can construct a different distribution, but what requirements do you have?
    $endgroup$
    – Dave
    7 hours ago











  • $begingroup$
    normal or a poisson but no negative values
    $endgroup$
    – user3437212
    7 hours ago






  • 5




    $begingroup$
    Normal is out, since it can take all real values. More helpful, though, would be to know what you're considering either of those distributions. So...why normal or Poisson?
    $endgroup$
    – Dave
    7 hours ago















$begingroup$
Thanks Dave! But I don't want only 80s and 12000s in my distribution. I would like a range of values but all positive
$endgroup$
– user3437212
7 hours ago




$begingroup$
Thanks Dave! But I don't want only 80s and 12000s in my distribution. I would like a range of values but all positive
$endgroup$
– user3437212
7 hours ago












$begingroup$
I'm sorry I was not clear earlier
$endgroup$
– user3437212
7 hours ago




$begingroup$
I'm sorry I was not clear earlier
$endgroup$
– user3437212
7 hours ago




2




2




$begingroup$
We can construct a different distribution, but what requirements do you have?
$endgroup$
– Dave
7 hours ago





$begingroup$
We can construct a different distribution, but what requirements do you have?
$endgroup$
– Dave
7 hours ago













$begingroup$
normal or a poisson but no negative values
$endgroup$
– user3437212
7 hours ago




$begingroup$
normal or a poisson but no negative values
$endgroup$
– user3437212
7 hours ago




5




5




$begingroup$
Normal is out, since it can take all real values. More helpful, though, would be to know what you're considering either of those distributions. So...why normal or Poisson?
$endgroup$
– Dave
7 hours ago




$begingroup$
Normal is out, since it can take all real values. More helpful, though, would be to know what you're considering either of those distributions. So...why normal or Poisson?
$endgroup$
– Dave
7 hours ago

















draft saved

draft discarded
















































Thanks for contributing an answer to Cross Validated!


  • 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%2fstats.stackexchange.com%2fquestions%2f419348%2fhow-do-i-generate-distribution-of-positive-numbers-only-with-min-max-and-mean%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

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

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

199年 目錄 大件事 到箇年出世嗰人 到箇年死嗰人 節慶、風俗習慣 導覽選單