# How to scale a binomial distribution by X with error?

Posted 1 month ago
245 Views
|
4 Replies
|
0 Total Likes
|
 I'm trying to simulate a binomial distribution [ n=8, p=0.22]. I want to scale the result by a known weight [e.g., 0.51]. This weight, however, has uncertainty [variance = 0.31] that should be factored in.Is it possible in Mathematica to randomly scale an outcome by x plus or minus a given variance?Thanks :)
4 Replies
Sort By:
Posted 1 month ago
 Your terminology is not standard ("scale by a known weight") so it's not clear how an outcome might be modified in a probabilistic manner. One specific that needs clarification is "Do the modified outcomes still only consist of the integer values from 0 to 8?"If so, then one possibility is that one might consider $p$ to be a random variable rather than the constant 0.22. One way to do this is the following: (* Modify the logit of the probability by adding some noise *) s = 0.05; SeedRandom[12345]; logitp = Log[0.22/(1 - 0.22)] + RandomVariate[NormalDistribution[0, s], 1][[1]] (* -1.3151 *) (* Transform back to a probability *) p = 1 - 1/(1 + Exp[logitp]) (* 0.211634 *) (* Generate a random observation *) x = RandomVariate[BinomialDistribution[8, p], 1][[1]] (* 1 *) There are lots of other ways, too. Hence, the need for more specifics.
Posted 1 month ago
 Thank you, Jim.Apologies for the ambiguous language. I have a measured probability (0.22) of success. The success of each trail corresponds to a particular weight (e.g., measured voltage 0.51 mV). This measurement has error (coefficient of variation + channel noise = 0.31). I am trying to calculate how 8 such units with similar successes and weights would behave (i.e, what is the expected mV and variance).Here's what I did....I have treated weight as a random normal variable such that: weight_SD = RandomVariate[NormalDistribution[0.51,0.31], 100]; pTrials = RandomVariate[BinomialDistribution[8, 0.22], 100]; data = pTrials * weight_SD Does this seem sound? Thanks again for the help :)
 We speak different terminologies so please take the following comments as my misunderstanding as opposed to a judgement.Are you wanting to perform a logistic regression where the logit of the probability of success is dependent on a measured voltage plus some additional error?One possibility is that the logit of the probability of success for a single unit is a linear function of the measured voltage plus some error: $$\log(p/(1 - p)) = a + b \times voltage + error$$I'm not following your construction of weights because the example you give will result in about 5% of the weights being negative. (And Mathematica doesn't allow an underscore in a variable name.)