I want to make a grid [0,1] with 100 points but I want points to be concentrated at the edges close to 0 and 1. So I want 60-70% of the points to be in the intervals [0, 0.2] and [0.8, 1]. Any ideas on how I can do this?
2 Answers
One quick way to do this is through inverting a distribution c.d.f.. For example, the distribution Beta(alpha,beta) has density concentrated at small and large values when alpha and beta are less than one. Thus, you can first generate equally spaced grid, and then use the inverse function of Beta c.d.f to map the grid to unequally spaced grid. You can change the percentiles you want (60-70%, e.g.) by setting the appropriate alpha and beta.
-
$\begingroup$ Thanks for your response Justin. I've been messing with this idea this morning but haven't gotten it to work yet. Will keep at it and hopefully get it soon. $\endgroup$– CuedrahFeb 2, 2015 at 21:26
An alternative to the beta distribution mentioned by @Justin is the Kumaraswamy distribution, which has a similar degree of flexibility but a more tractable PDF:$$f(x)=abx^{a-1}(1-x^a)^{b-1}.$$ Setting, for example, $a=b=1/2$ will give you a concentration of points at ends of the unit interval.
Alternatively, you could just uniformly distribute the points in the intervals $[0,0.2)$, $[0.2,0.8]$, and $(0.8,1]$ in the ratio $0.15:0.7:0.15$.
-
$\begingroup$ Thanks for your response. I have never heard of this distribution before, so thank you for teaching me something new :) $\endgroup$– CuedrahFeb 3, 2015 at 21:58
-
$\begingroup$ I was actually able to make my grid using the CDF of the beta distribution relatively easily. I did speak with a professor in the applied math department and she showed me an alternative method utilizing the integral of tanh. The method she showed me is a bit more complicated but is much more flexible in making the grid conform more closely to a number of specifications (i.e. symmetry, degree of concentration etc.) $\endgroup$– CuedrahFeb 3, 2015 at 22:05