Mercurial > hg > ltpda
view m-toolbox/classes/+utils/@math/Ftest.m @ 7:1e91f84a4be8 database-connection-manager
Make ltpda_up.retrieve work with java.sql.Connection objects
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Mon, 05 Dec 2011 16:20:06 +0100 |
parents | f0afece42f48 |
children |
line wrap: on
line source
% Ftest perfomes an F-Test. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % DESCRIPTION: SFT performes an F-Test providing the measured F statistic, % the two degrees of freedom, the confidence level and the % type of the test (a boolean, one or two tailed). The null % hypothesis H0 is rejected at the confidence level for the % alternative hypothesis H1 if the test statistic falls in the % critical region. % % VERSION: $Id: Ftest.m,v 1.2 2011/03/07 16:50:47 congedo Exp $ % % HISTORY: 18-02-2011 G. Congedo % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [test,critValue,pValue] = Ftest(F,dof1,dof2,alpha,twoTailed) n = numel(F); if twoTailed % Lower bound % critValue(1) = icdf('f',alpha/2,dof1,dof2); critValue(1) = utils.math.Finv(alpha/2/n,dof1,dof2); % Upper bound % critValue(2) = icdf('f',1-alpha/2,dof1,dof2); critValue(2) = utils.math.Finv(1-alpha/2/n,dof1,dof2); else % critValue = icdf('f',1-alpha,dof1,dof2); critValue = utils.math.Finv(1-alpha/n,dof1,dof2); end % pValue = 1-cdf('f',F,dof1,dof2); pValue = 1-utils.math.Fcdf(F,dof1,dof2); if twoTailed test = F<critValue(1) | F>critValue(2); else test = F>critValue; end end