The Coin Return Foundational Fundraiser is here! Please donate!

quick chi-square question

y2jake215y2jake215 certified Flat Birther theoristthe Last Good Boy onlineRegistered User regular
edited March 2009 in Help / Advice Forum
If I'm calculating chi-square for a set of data, and the expected values for one of the categories is 0, do I include that category as a degree of freedom?

For example, I'm calculating the chi-square for a data set of observed phenotypes in a F2 generation of flies. The expected value of 2 of the 8 possible outcomes, which have white-eyed females, are 0. We didn't find any, but what would I do if I HAD found a white-eyed female? I'd have to divide by zero. This is the one part of chi-square I realized I don't know what I would have to do, and I'd like to fully understand it.

C8Ft8GE.jpg
maybe i'm streaming terrible dj right now if i am its here
y2jake215 on

Posts

  • ceresceres When the last moon is cast over the last star of morning And the future has past without even a last desperate warningRegistered User, Moderator Mod Emeritus
    edited March 2009
    I don't have advice because I start with chi squares in my genetics class on Monday. But I feel your pain and I'm interested in the answer.

    At worst, maybe I can help on Monday.

    ceres on
    And it seems like all is dying, and would leave the world to mourn
  • DaenrisDaenris Registered User regular
    edited March 2009
    I'm fairly certain that the assumptions of a chi-square test don't hold if any of the expected outcomes are 0 (or even if many of the outcomes are very low for that matter).

    Are you sure you should be using a chi-square test here? Should you maybe be using Fisher's Exact test or something else?

    Daenris on
  • DJ-99DJ-99 Registered User regular
    edited March 2009
    Are the only possible values 0 or greater? If so, how could you possibly have an EV of 0 but then have a value greater than 0?

    If it's possible to have a value greater than 0, then the EV can't be 0. So you shouldn't ever have to divide by 0.

    Unless it's possible to have negative values here, but I'm not really sure what your data is.

    DJ-99 on
  • y2jake215y2jake215 certified Flat Birther theorist the Last Good Boy onlineRegistered User regular
    edited March 2009
    What we did was take a male fly with a white-eyed mutation and a female with a vestigial wing mutation and bred them, getting a heterozygous wild-type F1 generation, then self crossed to get an F2 generation. The F2 generation had all sorts of combinations of the two mutations and gender in certain ratios, but since white-eyes is a sex-linked trait, it doesn't show up in any females. The problem is, the TA gave us data to show what the exact amount of each fly expected is for a total of 1000 flies. His data has 0s next to the white-eyed female.

    Female Male
    Wild-type 375 187
    White eyes, wild-type wings 0 187
    Vestigial wings, wild-type eyes 125 63
    Vestigial wings and white eyes 0 63
    Total 500 500

    I figure I should just ignore the 2 0s when calculating chi-square, but when getting the p-value I'm still unclear whether to use them as degrees of freedom (it still IS possible to get a white-eyed female, it just would take a lot of unlikely events)

    y2jake215 on
    C8Ft8GE.jpg
    maybe i'm streaming terrible dj right now if i am its here
  • GdiguyGdiguy San Diego, CARegistered User regular
    edited March 2009
    So those are the expected values - do you actually have white eyes in the females?

    If your expected value is zero, and you don't get any events, then the chi-square test is valid - you should just ignore those two as they're not possible outcomes (so the degrees of freedom are 2 less). The chi-square test only tests against possible outcomes; if you know an outcome isn't possible, you don't need to include it. (Which makes sense - if you were doing a chi-square test after a homozygous AA x heterozygous Aa cross, you wouldn't include an outcome for an aa outcome - you know it's not possible, so you wouldn't include it).


    If your expected value is zero and you DO get events, then you shouldn't be using a chi-square test for that data - if the expected value is close to zero, you can do tricks to get some reasonable approximate chi-square value, but if it's exactly zero the test breaks down (or really, balloons to infinity when expected values approach zero, which works the way it should - if you cannot possibly get an outcome with your null hypothesis, but you see that outcome, then your null hypothesis should be rejected)

    Gdiguy on
  • Alistair HuttonAlistair Hutton Dr EdinburghRegistered User regular
    edited March 2009
    Daenris wrote: »
    I'm fairly certain that the assumptions of a chi-square test don't hold if any of the expected outcomes are 0 (or even if many of the outcomes are very low for that matter).

    Are you sure you should be using a chi-square test here? Should you maybe be using Fisher's Exact test or something else?

    If any value is 5 or less (and some people would baulk at 10 or less) then the Chi-square does not hold. You are correct, the Fisher's Exact test should be use. There's used to be a really good one online but I can't seem to find it, the Wikipedia page has links to several ones.

    Alistair Hutton on
    I have a thoughtful and infrequently updated blog about games http://whatithinkaboutwhenithinkaboutgames.wordpress.com/

    I made a game, it has penguins in it. It's pay what you like on Gumroad.

    Currently Ebaying Nothing at all but I might do in the future.
  • apeelewuetuapeelewuetu Registered User new member
    I am presently working on a project in which i want to calculate chi - square , i want u to help me do the calculation, so that i can compare my own with your answer- Items 22 23
    Response YES NO YES NO
    Percentage after counselling 80 20 78 22
    X2 =

  • apeelewuetuapeelewuetu Registered User new member
    Items 22 23
    Response YES NO YES NO
    Percentage after counselling 80 20 78 22
    X2 133.68
    is this value correct ?

This discussion has been closed.