Global Index (short | long) | Local contents | Local Index (short | long)
score = tscore(dof, tail_per);
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.
This function is called by | |
---|---|
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);