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

Cauchy test 4 #191

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

staplejw
Copy link
Contributor

Failure in: 6:RoundTrip:7:0:t_cauchy_to_students_t:0

haskell/Tests/TestTools.hs:130
expected:
chiSq_iid = fn n nat:
fn mean real:
fn stdev prob:
q <~ plate _ of n: normal(mean, stdev)
return summate i from 0 to size(q):
((q[i] - mean) * prob2real(1/ stdev)) ^ 2
standardChiSq = fn n nat: chiSq_iid(n, nat2real(0), nat2prob(1))
standardChi = fn n nat:
q <~ standardChiSq(n)
return sqrt(real2prob(q))
nonCentralT = fn n nat:
fn delta prob:
U <~ normal(nat2real(0), nat2prob(1))
X <~ standardChi(n)
return (U + prob2real(delta))
* prob2real(sqrt(nat2prob(n)))
* prob2real(1/ X)
t = fn n nat: nonCentralT(n, nat2prob(0))
t(1)
but got:
U7 <~ normal(+0/1, 1/1)
q305 <~ normal(+0/1, 1/1)
return U7 * prob2real(1/ abs(q305))
Cases: 342 Tried: 293 Errors: 2 Failures: 25

Failure in: 6:RoundTrip:7:0:t_cauchy_to_students_t:1

haskell/Tests/TestTools.hs:130
expected:
chiSq_iid = fn n nat:
fn mean real:
fn stdev prob:
q <~ plate _ of n: normal(mean, stdev)
return summate i from 0 to size(q):
((q[i] - mean) * prob2real(1/ stdev)) ^ 2
standardChiSq = fn n nat: chiSq_iid(n, nat2real(0), nat2prob(1))
standardChi = fn n nat:
q <~ standardChiSq(n)
return sqrt(real2prob(q))
nonCentralT = fn n nat:
fn delta prob:
U <~ normal(nat2real(0), nat2prob(1))
X <~ standardChi(n)
return (U + prob2real(delta))
* prob2real(sqrt(nat2prob(n)))
* prob2real(1/ X)
t = fn n nat: nonCentralT(n, nat2prob(0))
t(1)
but got:
p5 <~ normal(+0/1, 1/1)
p3 <~ normal(+0/1, 1/1)
return p5 / p3
Cases: 342 Tried: 294 Errors: 2 Failures: 26

@mkhattab940
Copy link
Contributor

Done in-lining. Test now fails like this:

### Failure in: 6:RoundTrip:0:2:t_cauchy_to_students_t:1
haskell/Tests/TestTools.hs:130
expected:
U <~ normal(+0/1, 1/1)
X <~ normal(+0/1, 1/1)
return U * prob2real(1/ abs(X))
but got:
p5 <~ normal(+0/1, 1/1)
p3 <~ normal(+0/1, 1/1)
return p5 / p3
Cases: 164  Tried: 89  Errors: 0  Failures: 5
Cases: 164  Tried: 90  Errors: 0  Failures: 5

@JacquesCarette
Copy link
Contributor

Hmmm, why does your expected have an 'abs' but the result doesn't? That is very puzzling.

@JacquesCarette
Copy link
Contributor

I've looked at the question you ask (i.e. what the test is) -- it is your 'expected' which is wrong. What you 'got' is correct.

Copy link
Contributor

@JacquesCarette JacquesCarette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the expected to be correct.

@mkhattab940
Copy link
Contributor

Ok fixed

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

Successfully merging this pull request may close these issues.

3 participants