* +-======-+ * Copyright (c) 2003-2007 United States Government as represented by * the Admistrator of the National Aeronautics and Space Administration. * All Rights Reserved. * * THIS OPEN SOURCE AGREEMENT ("AGREEMENT") DEFINES THE RIGHTS OF USE, * REPRODUCTION, DISTRIBUTION, MODIFICATION AND REDISTRIBUTION OF CERTAIN * COMPUTER SOFTWARE ORIGINALLY RELEASED BY THE UNITED STATES GOVERNMENT AS * REPRESENTED BY THE GOVERNMENT AGENCY LISTED BELOW ("GOVERNMENT AGENCY"). * THE UNITED STATES GOVERNMENT, AS REPRESENTED BY GOVERNMENT AGENCY, IS AN * INTENDED THIRD-PARTY BENEFICIARY OF ALL SUBSEQUENT DISTRIBUTIONS OR * REDISTRIBUTIONS OF THE SUBJECT SOFTWARE. ANYONE WHO USES, REPRODUCES, * DISTRIBUTES, MODIFIES OR REDISTRIBUTES THE SUBJECT SOFTWARE, AS DEFINED * HEREIN, OR ANY PART THEREOF, IS, BY THAT ACTION, ACCEPTING IN FULL THE * RESPONSIBILITIES AND OBLIGATIONS CONTAINED IN THIS AGREEMENT. * * Government Agency: National Aeronautics and Space Administration * Government Agency Original Software Designation: GSC-15354-1 * Government Agency Original Software Title: GEOS-5 GCM Modeling Software * User Registration Requested. Please Visit http://opensource.gsfc.nasa.gov * Government Agency Point of Contact for Original Software: * Dale Hithon, SRA Assistant, (301) 286-2691 * * +-======-+ *************************************************************************************** * $Id$ * Copyright (C) 2004 Bin Guan. * Distributed under GNU/GPL. *************************************************************************************** function astudt(arg) * * Calculate t for given dof and p in a two-tailed Student t-test. * rc = gsfallow("on") dof=subwrd(arg,1) p=subwrd(arg,2) tname=subwrd(arg,3) if(p='') usage() return endif if(tname='') tname='astudtout' endif v=0.5 dv=0.5 t=0 while(dv>1e-6) t=1/v-1 dv=dv/2 'studt 'dof' 't 'q defval studtout 1 1' *'q defval studtp 1 1' studtp=subwrd(result,3) if(studtp>p) v=v-dv else v=v+dv endif endwhile tname'='t return *************************************************************************************** function usage() * * Print usage information. * say ' Two-tailed Student t-test.' say '' say ' Usage: astudt

[]' say ' : degree of freedom.' say '

: probability.' say ' : t-statistic. Defaults to astudtout.' say '' say ' Dependencies: studt.gs' say '' say ' Copyright (C) 2004 Bin Guan.' say ' Distributed under GNU/GPL.' return