*! version 2.00 14/06/99 (STB-53: sg128) program define gullplot version 6.0 *First written 16/09/98 *Author: Salgado-Ugarte I.H. *This program estimates the Linfinite and K parameters of the von *Bertalanffy growth function by means of the Gulland-Holt method *Gulland and Holt (1959) adjusted by Gulland (1969) using mean *length at age values. *This new version is updated for Stata 6.0 #delimit ; syntax varlist(min=1 max=1) [if] [in] , [noGraph T1title(string) Symbol(string) Connect(string) *]; #delimit cr tokenize `varlist' quietly { preserve tempvar msize gen `msize' = `1' `if' `in' *drop if `msize'==. *if `msize'[1]==. { * di in red "no observations" * exit} *keep `msize' local nurows=_N+2 set obs `nurows' tempvar lagmsi lmsize llagm delsi delest b gen lagmsi=`msize'[_n+1] gen lmsize= `msize'[_n-1] gen llagm= lagmsi[_n-1] gen delsi= llagm-lmsize replace lmsize=0 if _n==1 regress delsi lmsize predict `delest' local b=_b[lmsize] if `b'>=0 { noi di in red "The slope of the line of the observed points is >=0" exit} else local kval=log(_b[lmsize]+1)*-1 local linf=_b[_cons]/(1-exp(`kval'*-1)) replace `delest'=0 if _n==_N replace lmsize=`linf' if _n==_N noi di _newline "Estimation of L_inf and K values by the Gulland Method" noi di _dup(60) "-" noi di "Intercept = " %8.4f _b[_cons] _skip(10) "Slope = " %8.4f _b[lmsize] noi di _newline "R-squared = " %8.4f _result(7) _skip(10) "Adj R-squared = " %8.4f _result(8) noi di _newline "L_inf. = " %8.4f `linf' _skip(10) "K = " %8.4f `kval' noi di _dup(60) "-" if "`graph'" ~= "nograph" { local lilab=string(round(`linf',.0001),"%9.4f") local kvlab=string(round(`kval',.0001),"%9.4f") if "`t1title'" ==""{ local t1title "Gulland graph" local t1title "`t1title', L_inf = `lilab', K = `kvlab'" } if "`symbol'"=="" { local symbol "O." } if "`connect'"=="" { local connect ".l" } if "`l1lab'"=="" {local l1lab "Delta Size" } label var lmsize "Size at age t" graph delsi `delest' lmsize, `options' /* */ t1("`t1title'") /* */ s(`symbol') c(`connect') /* */ l1(`l1lab') } } end