The question asked: There are two number generators. Given a sample, which of these generators is it from?
1) generates a random number uniformly between 0 and 1 with $P(x<a) = a$
2) generates a random number uniformly between 0 and 1 with $P(x<a) = a^2$
The samples are {0.1,0.2,0.3} (belongs to G1) and {0.9,0.8,0.7} (belongs to G2)
My question is:
1) If it is a uniform distribution between 0 and 1 how can it have $F_x = a \ $
2) Assuming they meant $0<x<1 \ and \ f_x=a \ $ for G1 and $0<x<1 \ and \ f_x=a^2 \ $ for G2; do I have to use the likelihood estimator and if so how?
I tried finding the PDF of G1 by differentiating "a" but I get 0 and I dont know what that means. Im still learning so I'm not sure if I'm making mistakes or if the question is sketchy.
The first generator samples randomly from $\mathsf{Unif}(0,1) \equiv \mathsf{Beta}(1,1),$ which has density function $f_1(x) = 1,$ for $0 \le x \le 1.$
The second generator samples randomly from $\mathsf{Beta}(2,1),$ which has density function $f_2(x) = 2x,$ for $0 \le x \le 1.$ [Perhaps see Wikipedia on beta distributions.]
The likelihood function of a sample given a distribution is the product of the density evaluated at each sample value. For the first generator, the likelihood function is $L_1(\mathbf{x_1}) = L_1(\mathbf{x_2}) = 1$ for both samples.
For the second generator, you should get $L_2(\mathbf{x_1}) = 0.048$ for the first sample and $L_2(\mathbf{x_2}) = 4.032.$
Computations in R, but easy to do by hand: [In R,
dbeta
is a beta density function; the 2nd and 3rd parameters of this R function are the shape parameters of the particular beta distribution.]With that information you should be able to use the likelihood functions to say which sample comes from which distribution.
Intuitive approach: Here are the density functions for the two distributions:
It makes sense that the sample with more relatively large observations should have come from the second generator.