Skip to content
This repository has been archived by the owner on Jun 24, 2020. It is now read-only.

z-scores #42

Open
palewire opened this issue Jan 25, 2014 · 6 comments
Open

z-scores #42

palewire opened this issue Jan 25, 2014 · 6 comments

Comments

@palewire
Copy link
Contributor

@ryanvmenezes, think that's something that could be boiled down to simple python in here for reuse in our other projects?

@ryanvmenezes
Copy link

@palewire definitely. I'll try to dummy up some code using existing functions. I think the two most useful would go something like this:

  1. t-value for simple linear regression line of best fit
    tvalue_SLR(indepVarList, depVarList, nullSlope=0)
    null hypothesis: slope of best-fit line is 0 (no relationship between variables)
  2. z-value for a single proportion
    zvalue_proportion(successList, failureList, mean=sum(successList)/sum(failureList))
    (this is what I'm ranking on for the overcrowding analysis)

@palewire
Copy link
Contributor Author

Are there existing Python functions that do this already in numpy or scipy?

@ryanvmenezes
Copy link

@palewire Ah, scipy.stats.linregress is an existing version of my no. 1, though it doesn't return a t-value, which I think is most important. The p-value it returns can be reverse-engineered to be a t-value using scipy.stats.t in a custom function, I think.

Don't see a version of my no. 2 yet...

@palewire
Copy link
Contributor Author

Hmm. It might be a fun exercise to unpack the scipy function and see how we could rewrite it in a simplified, more literate and documented way.

@ryanvmenezes
Copy link

@palewire I just recalled this request because I've been writing a lot of python scripts that don't quite generate the z-/t-scores I want. Would it be against the spirit of this repo to import a package like scipy or numpy? My guess is yes but I'll let you decide. In any case, function no. 2 (the proportion z-value) is doable with simple arithmetic.

@palewire
Copy link
Contributor Author

What do you need from numpy to make your function work?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants