-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
Description
The computation in dd() isn't correct. Two issues:
-
In
dd(), you usedf + 2, butconvert.d.to.t()also doesdf + 2, so in essence this is done twice. -
You cannot just convert d to t and then plug t into
dt(). You need to use the change of variables technique:
So, let's say n1=n2=10 and true d is 0.5. At the moment:
> integrate(function(x) dd(x, df=16, populationD=0.5), lower=-Inf, upper=Inf)
0.4264014 with absolute error < 2.3e-07
You can ignore the warnings. Note that I plug in df=16, so that 16+2+2=20 actually corresponds to n1=n2=10. But the density must integrate to 1. Correct would be:
> integrate(function(x) dd(x, df=16, populationD=0.5) * sqrt(10/2), lower=-Inf, upper=Inf)
1 with absolute error < 2.7e-07
So, you need to multiply by sqrt(n1*n2/(n1+n2)).
Reactions are currently unavailable