# Documentation of tscore_dan

Global Index (all files) (short | long) | Local Index (files in subdir) (short | long)

## Function Synopsis

`score = tscore(dof, tail_per);`

## Help text

```
score = tscore(dof, tail_per);

Where dof      = degrees of freedom
tail_per = one-tailed confidence limit given in percentage;

score    = the coresponding t-value

Note, this can be modified to give more accuracy.  It's
programmed to return the t-value with an accuracy of 0.001.

This is designed so that dof must be >= 4, and tail_per must
be >= 0.25%;  Also, the convergence isn't very good for dof > 1000.

```

## Listing of function tscore_dan

```function score = tscore(dof, tail_per);

%  Reshape data, if necessary;
szx = size(dof);
dof = dof(:);
niter = length(dof);

tail_per = tail_per / 100;

inc = 0.1;
t = 0:inc:50;
nt = length(t);

tind = repmat(NaN, size(dof));
score = tind;

for i = 1:niter;

%if mod(i, 100) == 0;  disp(i);  end;
ft = 1 ./ ((1 + (t.^2 / dof(i))) .^ ((dof(i) + 1) / 2));
ft(1) = 0.5;
norm = 0.5 / sum(ft);
ft = ft * norm;

int_ft = cumsum(ft);
tind = min(find(int_ft >= (0.5 - tail_per)));
if isempty(tind);
error(['The test did not converge.  ' ...
'See dof and tail_per limit requirements.']);
else
score(i) = t(tind);
end

end

score = reshape(score, szx);

```