+ Reply to Thread
Results 1 to 7 of 7

Thread: How do you calculate the p-value by hand? Only learned how to do it electronically

  1. #1
    Points: 13, Level: 1
    Level completed: 25%, Points required for next Level: 37

    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    How do you calculate the p-value by hand? Only learned how to do it electronically




    Hello,

    I am making a Java program that can run a full 1-sample z-test for sample mean and I would like to know how to calculate the p-value by hand once you have the z-statistic. I have learned how to calculate it by looking at the z-table and with a calculator, but for the sake of my program I would need to be able to understand how to calculate it manually or through some kind of formula.

    EDIT:
    I'm explicitly asking how to do what a z-table or calculator does when it gives you the p-value. It would be great if the process could be told as simply as possible, I am not the most advanced statistician.

    Thanks!
    -A possible stat major and freshman in college
    Last edited by solospirit; 10-13-2014 at 03:24 PM.

  2. #2
    TS Contributor
    Points: 14,811, Level: 78
    Level completed: 91%, Points required for next Level: 39
    Miner's Avatar
    Location
    Greater Milwaukee area
    Posts
    1,171
    Thanks
    34
    Thanked 405 Times in 363 Posts

    Re: How do you calculate the p-value by hand? Only learned how to do it electronicall

    You will need the cumulative distribution function and link for the Standard Normal Distribution. Remember to make allowances for 1 and 2 tailed tests.

  3. #3
    Points: 13, Level: 1
    Level completed: 25%, Points required for next Level: 37

    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: How do you calculate the p-value by hand? Only learned how to do it electronicall

    Thanks Miner,

    It looks really complicated, can you dumb it down for me? Steps would be helpful.

  4. #4
    Devorador de queso
    Points: 95,781, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,933
    Thanks
    307
    Thanked 2,629 Times in 2,245 Posts

    Re: How do you calculate the p-value by hand? Only learned how to do it electronicall

    Do you know how to calculate the p-value in theory? Like what it represents? If so then your question basically boils down to "how do I evaluate the CDF of a normal distribution at a specific point" and that isn't an easy thing to do. There are many approximations that you could program yourself (when I did the task that you're essentially doing this is pretty much what I did - it's not too bad but isn't really too enlightening either). Otherwise you could use an external library. I know the Apache commons-math libraries are useful for this. Here is a class that would be useful for your task: http://commons.apache.org/proper/com...tribution.html
    I don't have emotions and sometimes that makes me very sad.

  5. The Following User Says Thank You to Dason For This Useful Post:

    solospirit (10-13-2014)

  6. #5
    Points: 13, Level: 1
    Level completed: 25%, Points required for next Level: 37

    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: How do you calculate the p-value by hand? Only learned how to do it electronicall

    Thanks for the input Dason,

    Yes I know what the p-value presents, and I'm not even close to learning about all the math behind it. I consider myself to be fairly high level at Java so your library may be useful.

    If you still have it, would you mind posting what you did when you did this task?

  7. #6
    Devorador de queso
    Points: 95,781, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,933
    Thanks
    307
    Thanked 2,629 Times in 2,245 Posts

    Re: How do you calculate the p-value by hand? Only learned how to do it electronicall

    I don't have the code readily available at the moment. It was part of senior project I did in undergrad so it's been a while since I've looked at that code. It basically was just a numeric approximation to the CDF though. It looked all messy but got the job done. I didn't learn anything from coding that particular bit in other than "Huh - I guess you can use numeric approximations to get good approximations - cool". Using the library would probably be fine if you're alright with adding that dependency/bloat.
    I don't have emotions and sometimes that makes me very sad.

  8. #7
    Human
    Points: 12,676, Level: 73
    Level completed: 57%, Points required for next Level: 174
    Awards:
    Master Tagger
    GretaGarbo's Avatar
    Posts
    1,362
    Thanks
    455
    Thanked 462 Times in 402 Posts

    Re: How do you calculate the p-value by hand? Only learned how to do it electronicall


    Dragan makes this post (#8).

+ Reply to Thread

           




Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats