News for hackers. Stuff that matters.
Re:China urges its people to struggle. Some say no by nightcracker on Thursday July 08, 2021 @02:15PM (#27775828)
> This is where the skew (can) come from.

No it can not! It's just mathematically and biologically not true, and attempts to erase a crime against humanity. The human inception process does not give a shit about your decision whether or not to put another child on this earth to decide whether the infant will be a boy or a girl.

Each child put on this earth has a ~50% chance of being either sex. It does not matter whether the parents decide to have another afterwards or not, this future child also has a ~50% chance of being either sex. The *only* variable that matters for the amount of girls that get born (in the absence of selective filtering) is the total number of children born, not whatever strategy their parents were going for.

To try and prove it to you, consider this randomized Python function:

    import numpy as np
    from numba import njit

    @njit
    def bear_children(stop_on_girl_p, stop_on_boy_p, max_children):
        num_girls = num_boys = 0
        while num_girls + num_boys < max_children:
            child_is_girl = np.random.random() < 0.5
            num_girls += child_is_girl
            num_boys += not child_is_girl
            
            r = np.random.random()
            if (    child_is_girl and r < stop_on_girl_p or
                not child_is_girl and r < stop_on_boy_p):
                break

        return [num_girls, num_boys]

Now let's plot the ratio of girls to boys for one million samples to this function for various stop probabilities on girls, boys for a maximum of two, three or four children:

    def sample(n, stop_on_girl_p, stop_on_boy_p, max_children):
        children = [bear_children(stop_on_girl_p, stop_on_boy_p, max_children) for _ in range(n)]
        girls, boys = np.sum(children, axis=0)
        return girls / boys

    for max_children in np.arange(2, 5):
        for stop_on_girl_p in np.linspace(0, 1, 5):
            for stop_on_boy_p in np.linspace(0, 1, 5):
                ratio = sample(10**6, stop_on_girl_p, stop_on_boy_p, max_children)
                print(f"m {max_children}, g {stop_on_girl_p:.2f}, b {stop_on_boy_p:.2f}: {ratio: .6f}")
What are the results? As predicted, a complete indifference to parental strategy:

    m 2, g 0.00, b 0.00:  0.999922
    m 2, g 0.00, b 0.25:  0.995816
    m 2, g 0.00, b 0.50:  1.001230
    m 2, g 0.00, b 0.75:  1.001087
    m 2, g 0.00, b 1.00:  0.999463
    m 2, g 0.25, b 0.00:  0.997941
    m 2, g 0.25, b 0.25:  0.999697
    m 2, g 0.25, b 0.50:  0.999899
    m 2, g 0.25, b 0.75:  0.997890
    m 2, g 0.25, b 1.00:  1.001904
    m 2, g 0.50, b 0.00:  0.999417
    m 2, g 0.50, b 0.25:  1.002257
    m 2, g 0.50, b 0.50:  0.997706
    m 2, g 0.50, b 0.75:  1.003743
    m 2, g 0.50, b 1.00:  1.002836
    m 2, g 0.75, b 0.00:  1.001780
    m 2, g 0.75, b 0.25:  1.001771
    m 2, g 0.75, b 0.50:  0.997113
    m 2, g 0.75, b 0.75:  1.001912
    m 2, g 0.75, b 1.00:  0.998633
    m 2, g 1.00, b 0.00:  1.000313
    m 2, g 1.00, b 0.25:  0.997060
    m 2, g 1.00, b 0.50:  1.001314
    m 2, g 1.00, b 0.75:  0.997819
    m 2, g 1.00, b 1.00:  1.003839
    m 3, g 0.00, b 0.00:  0.999760
    m 3, g 0.00, b 0.25:  1.000058
    m 3, g 0.00, b 0.50:  0.999769
    m 3, g 0.00, b 0.75:  1.003119
    m 3, g 0.00, b 1.00:  0.999096
    m 3, g 0.25, b 0.00:  1.000912
    m 3, g 0.25, b 0.25:  0.999597
    m 3, g 0.25, b 0.50:  1.000687
    m 3, g 0.25, b 0.75:  1.001384
    m 3, g 0.25, b 1.00:  1.001542
    m 3, g 0.50, b 0.00:  0.999007
    m 3, g 0.50, b 0.25:  0.999736
    m 3, g 0.50, b 0.50:  1.001971
    m 3, g 0.50, b 0.75:  0.999555
    m 3, g 0.50, b 1.00:  1.000360
    m 3, g 0.75, b 0.00:  0.999272
    m 3, g 0.75, b 0.25:  1.001740
    m 3, g 0.75, b 0.50:  1.001187
    m 3, g 0.75, b 0.75:  0.998134
    m 3, g 0.75, b 1.00:  1.002759
    m 3, g 1.00, b 0.00:  1.002063
    m 3, g 1.00, b 0.25:  1.002451
    m 3, g 1.00, b 0.50:  0.999767
    m 3, g 1.00, b 0.75:  0.999704
    m 3, g 1.00, b 1.00:  1.003851
    m 4, g 0.00, b 0.00:  0.999863
    m 4, g 0.00, b 0.25:  0.998141
    m 4, g 0.00, b 0.50:  1.000851
    m 4, g 0.00, b 0.75:  0.999944
    m 4, g 0.00, b 1.00:  0.999089
    m 4, g 0.25, b 0.00:  1.001894
    m 4, g 0.25, b 0.25:  0.998684
    m 4, g 0.25, b 0.50:  0.999523
    m 4, g 0.25, b 0.75:  1.000608
    m 4, g 0.25, b 1.00:  1.003503
    m 4, g 0.50, b 0.00:  1.000178
    m 4, g 0.50, b 0.25:  0.998415
    m 4, g 0.50, b 0.50:  1.000846
    m 4, g 0.50, b 0.75:  0.999193
    m 4, g 0.50, b 1.00:  0.998043
    m 4, g 0.75, b 0.00:  0.999524
    m 4, g 0.75, b 0.25:  0.999053
    m 4, g 0.75, b 0.50:  0.996726
    m 4, g 0.75, b 0.75:  1.000306
    m 4, g 0.75, b 1.00:  1.000998
    m 4, g 1.00, b 0.00:  0.999759
    m 4, g 1.00, b 0.25:  1.000097
    m 4, g 1.00, b 0.50:  1.000577
    m 4, g 1.00, b 0.75:  0.999687
    m 4, g 1.00, b 1.00:  0.996829
Re:China urges its people to struggle. Some say no by Izkata on Thursday July 08, 2021 @07:53PM (#27779012)
You're not understanding what I'm saying.

When a couple has G, what's the probability they'll want to go for GX? When the couple has GG, what's the probability they'll want to go for GGX?

It doesn't matter that X is 50% boy 50% girl - in fact, it being 50/50 is why the bias ends up towards more G.

Edit: Ah wait I think I have something backwards in my head, I need to come back to this later. But I do want to mention that the estimated at-birth ratio in humans is more like 51:49, not 50:50

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC102777/

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6511063/