Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Stats Functions #1732

Open
6 tasks done
ds26gte opened this issue Apr 12, 2024 · 5 comments
Open
6 tasks done

More Stats Functions #1732

ds26gte opened this issue Apr 12, 2024 · 5 comments
Assignees

Comments

@ds26gte
Copy link
Contributor

ds26gte commented Apr 12, 2024

Issue brownplt/code.pyret.org#520 filed by @schanzer

We've had a few teachers ask if Pyret supports various stats functions:

  • population variance
  • sample variance
  • t-test (multiple kinds)
  • z-test
  • chi-squared test
  • multiple regression

Getting these implemented as a Pyret program would be great, but implementing them as part of Pyret's stats library would be much better.

(In keeping with the other stats functions, these should all operate on lists. I'll wrap them to work with tables in the DS teachpack.)

@ds26gte ds26gte self-assigned this Apr 12, 2024
ds26gte added a commit to ds26gte/pyret-lang that referenced this issue Apr 12, 2024
@shriram
Copy link
Member

shriram commented Apr 13, 2024

Thanks, @ds26gte! Can you add some tests, please?

ds26gte added a commit to ds26gte/pyret-lang that referenced this issue Apr 13, 2024
…lt#1732

- statistics.arr: added exceptions for t-test-{pooled, independent}
@schanzer
Copy link
Contributor

@ds26gte awesome to see this progress! I'm still hoping we can add a z-test function as well (see checklist in the issue).

@ds26gte
Copy link
Contributor Author

ds26gte commented Apr 13, 2024

@team, the z-test seems to require, in addition to the two samples, also the population (rather than the sample) variances. Please add what you think are the right arguments for the z-test and the other functions that I've already added.

ds26gte added a commit to ds26gte/pyret-lang that referenced this issue Apr 15, 2024
@schanzer
Copy link
Contributor

@ds26gte waiting to hear back about the desired contract from one of the teachers who requested these functions, which should give me a sense for whether these are close enough to what they need that I couldn't bridge the gap in a teachpack. Will wait to hear back.

@schanzer
Copy link
Contributor

@ds26gte I spoke with Nancy Pfenning today, who gave the following descriptions of what the inputs to various functions should be:

z-test: list of numbers, stddev, hypothesized mean
t-test: list of numbers, mean
2-sample t-test: 2 list of numbers (can be different size), "tail-ness" (boolean operator? >,<, ≠?)
paired t-test: 2 list of numbers (error if different size, order matters), "tail-ness" (boolean operator? >,<, ≠?)
pooled t-test: 2 lists of numbers, "tail-ness" (boolean operator? >,<, ≠?)
chi-squared: 2 lists of numbers (assumes pre-summarized data)

I think this is all inline with what you have, with the exception of the z-test. Can you double-check your implementation, and let me know why it has two lists of numbers?

ds26gte added a commit to ds26gte/pyret-lang that referenced this issue May 16, 2024
  list of known x-inputs, and a list of the corresponding known
  y-outputs, and returns a predictor function that takes a list of
  x-inputs and returns its estimated y-output brownplt#1732
- js/trove/multiple-regression.js contains the JS implementation of
  multiple-regression and all its matrix subroutines
- tests/test-statistics.arr: added a basic test (can add more from
  curriculum examples, when these are added)
ds26gte added a commit to ds26gte/pyret-lang that referenced this issue May 17, 2024
representing one input (setting of indep vars to values). The returned
predictor fn also takes an N-tuple brownplt#1732
ds26gte added a commit to ds26gte/pyret-lang that referenced this issue May 17, 2024
multiple-regression.js: clean-up w/ better row/col indexing names
ds26gte added a commit to ds26gte/pyret-lang that referenced this issue May 17, 2024
- check mulreg test on 1 var matches our linreg on same var
- add mulreg test for 2 vars
statistics.arr: add pointers to docs for formulas used
ds26gte added a commit to ds26gte/pyret-lang that referenced this issue May 17, 2024
ds26gte added a commit to ds26gte/pyret-lang that referenced this issue May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants