# How to create a distribution and sample?

Suppose we are given some small set of data on bundles of electrical wires and increasing voltages run through them, and we note how many of the individual wires fail.

So for example, a large data set we have n observations, for each n,

there is $$w_{i}$$ number of wires, voltage $$v_{i}$$ and $$f_{i}$$ of the wires fail.

And suppose we are given some of the information for example for the first few, ( note that each sample has increased voltage and we see increased proportion of failed wires). However we are not given the voltages, all we know is that it increases.

$$w_{1}=14$$ and $$f_{1}=4$$

$$w_{2}=13$$ and $$f_{2}=4$$

$$w_{3}=7$$ and $$f_{3}=3$$

$$w_{4}=10$$ and $$f_{4}=5$$

$$w_{5}=12$$ and $$f_{5}=7$$

$$w_{6}=20$$ and $$f_{6}=13$$

etc..

ie we have a parameter space such that ( $$t$$ is the proportion that fail) $$\{t_{i}: t_{1} \lt t_{2} \lt t_{3} \lt .. \lt t_{n} \le 1\}$$

My goal is to model this as a conditional distribution and sample so that I can make some statements about each $$t_{i}$$, such as the mean and deviations of each.(assuming flat prior)

Firstly I know about sampling, but I am wondering how from just the simple data, how I can accurately form the conditional distribution? Using rejection or transformations for example, and then Gibbs to make some conclusions on the individual failure proportions.

My thoughts:

Well it seems that the number of wires that fail is a function of the voltage. As voltage increases, so to does the proportion of failed wires.

Possibly I could use rejection method to sample from the distribution that is creating this?

So I would want to find some function $$g(x)$$ such that $$g(x) \ge f(x)$$ for all $$x$$ , then simulate uniform random variables and check the conditions.

However, as of now I don't have a distribution. I guess I could form a hand drawn using the points and x axis as 1,2,3,4,5,6... and y being the corresponding proportion rate of failure.

I know for a distribution, we need the probabilities to sum/integrate to 1.

The probabilities here I assume would be the probability that a certain proportion fail. So for n wires, we would have the probability that $$p_{1}=\frac{1}{n}$$ proportional fail, a probability for $$p_{2}=\frac{2}{n}$$proportion fail, all the way to the probability that all wires fail.

So it looks more like the form of a CDF, as voltage increases, ie if we write in the form of a function, $$F(v_{1})=\frac{4}{14}$$ , $$F(v_{2})=\frac{4}{13}$$, and so forth, so if we had an unlimited sample, as $$n \to \infty$$ , $$F(v_{n}) \to 1$$

and I suppose then $$F^{-1}=f$$ would be our density, but I am still not sure how to do this in finite case.

Issues: We are not told anything about underlying distribution, parameters or form. Only the data given. So do we take the data that is given to be the initialising values?

I was thinking I could possibly just assume that the failures follow a binomial distribution, with the binomial parameter following some other distribution such as a beta. How does that sound? Would we then need to also put some distribution on the $$w_{i}$$ ?

You seemed to have written a long post that mixes many issues together, in my opinion. My suggestion is to first think about the generative model, i.e. what exactly are the processes that generate your data.

In principle, you could come up with the generative model (i.e. probability distribution) for your whole data $$(f,v,w)$$. I'm guessing that you don't know what process generates $$w$$ and $$v$$. So, therefore, you need to generate a conditional distribution $$P(f|v,w)$$ and specify its parameters.

The meaningful distribution for f|v,w is a binomial distribution.

$$f|v,w \sim B(w,F(v))$$ where F is some kind of function that maps the voltage into [0,1] range. One example of such a function would be some kind of logistic function, i.e. $$F(v|a,b) = \frac{1}{1+\exp{(a+b v)}}$$

If you chose that function you will have the probability distribution $$P(f|v,w, a,b)$$ Assuming that individual $$f_i$$ are independent, you can write down the whole likelihood function that will depend on two parameters. You can then either sample this likelihood using a variety of methods (and after choosing a prior) or just optimize it to find best a,b.

• No knowledge on the generation of v and w. Maybe logistic will work better then beta.. But we are not given any of the values for $v$ only that it is increasing? – Learning Nov 29 '18 at 4:59
• I didn't realize that you don't know voltages. It wasn't clear from the post. In that case, you can just use the index 'i' as 'voltage'. Also may want to change the logistic function to something else that better fits the data... – sega_sai Nov 29 '18 at 5:55
• Sorry I should clarify. Everything given appears in the question above. – Learning Nov 29 '18 at 6:03
• Yes I could use the index as voltage as that fits the criterion. Can you possibly expand at all on your comments? I will take note of them and work through to the best I can and update. Such as if I were to choose a beta or something diffirent then logistic – Learning Nov 29 '18 at 6:27
• I am not sure how much I can expand more.First I didn't talke about beta at all. My B(n,p) distribution is the binomial distribution.Regarding using a different function then logistic,what I meant is that you somehow need to have a model for the failure fraction as a function of i.If your had voltages, that's easy and what I wrote in the text.If you don't,you need a model for the failure as a function of i.If you can assume that voltages linearly increase with i,then you can still use logistic function.If not you need either a different functional form or assume what process generates voltages – sega_sai Nov 29 '18 at 16:07