*! v 3.1.2 PR 26-Oct-94. STB-22: sg26.1 program define fp version 3.1 if "`*'"=="" | substr("`1'",1,1)=="," { if "$S_E_fp"=="fp" & "$S_E_fp2"=="" { /* in state 2 */ local model $FP_curr est hold temp est unhold fpres _jprfprp `*' est hold fpres est unhold temp } else { _jprfprp `*' } exit } loc varlist "req ex min(2) max(3)" loc if "opt" loc in "opt" loc weight "aweight fweight" #delimit ; loc options "ESTimates COMparison POwers(str) ADDpowers(str) FIXpowers(str) BAse(str) CMd(str) CONTinuous(str) EXPx(str) NAme(str) FAST noREPeat DF(int -1) LOg Zero ORIgin(str) GPlot(int -1) SAVing(str) DEVthr(str) *"; #delimit cr parse "`*'" if "`devthr'"!="" { conf num `devthr' } gl S_P1 gl S_P2 if "`powers'"=="1" { local df 1 } _jprfpin `df' "`cmd'" `gplot' "`saving'" loc df $S_1 loc df3 $S_2 loc df4 $S_3 loc meq2 $S_4 loc cmd "$S_5" loc anova $S_6 loc normal $S_7 loc qreg $S_8 loc glm $S_9 loc blogit $S_10 loc dist $S_11 loc graph $S_12 loc saving "$S_13" if `df'>4 { di in red "invalid df" exit 198 } if `df'==1 { if "`fixpowe'"!="" { di in red "fixpowers not allowed with df(1)" exit 198 } loc powers 1 } parse "`varlist'", parse(" ") gl S_E_cmd gl S_E_p1 gl S_E_p2 loc y `1' if `blogit' { loc cmd=substr("`cmd'", 2, .) loc mhs `2' loc rhs `3' } else { if "`3'"!="" { error 103 } loc rhs `2' } loc name=substr("`name'",1,6) if "`name'"=="`rhs'" { di in red "`name' already defined" exit 110 } /* Parse the list of powers */ if "`powers'"=="" { loc powers "-2,-1,-.5,0,.5,1,2,3" } if "`powers'"=="none" { if "`addpowe'"!=""|`df'!=-1 { di in red "addpowers and df invalid with powers(none)" exit 198 } loc pwrs "`fixpowe'" loc search 0 } else { loc pwrs "`powers' `addpowe'" loc search 1 } tempvar p qui gen `p'=. _jprfppp `p' "`pwrs'" 1 0 loc np $S_1 if `np'<1 { di in red "no powers given" exit 2002 } loc pwrs "$S_3" tempvar touse x lnx qui { mark `touse' [`weight' `exp'] `if' `in' markout `touse' `y' `mhs' `base' gen `x'=`rhs' if `touse'==1 drop `touse' } /* Deal with weights. */ loc mnlnwt 0 /* mean log normalized weights */ qui if "`exp'" != "" { tempvar s gen `s' `exp' replace `x'=. if `s'<=0|`s'==. replace `s'=. if `x'==. if "`weight'"=="fweight" { capture assert `s'==int(`s') if `x'!=. if _rc { noi error 401 } } sum `s' noi di "(sum of wgt is " _result(1)*_result(3) ")" replace `s'=log(`s'/_result(3)) sum `s' loc mnlnwt=_result(3) drop `s' loc exp "[`weight'`exp']" } quietly { gen `lnx'=. loc lin=(`np'==1 & `p'[1]==1) if `lin' { loc zero } _jprfpxo `x' `lnx' `lin' "`expx'" "`origin'" "`zero'" loc nobs $S_1 loc zeta $S_2 loc shift $S_3 loc kx "$S_4" } /* If `cmd' is blogit or bprobit, expand dataset to enable use of logit or probit command. */ qui if `blogit' { preserve keep `y' `x' `mhs' `lnx' `p' `base' drop if `x'==. _jprfplx `y' `mhs' drop `y' rename _outcome `y' loc exp "[freq=_pop]" } gl S_E_base "`base'" #delimit ; _jprfpfp `anova' `blogit' `cmd' "`compari'" "`continu'" "`devthr'" `df' `df3' `df4' `dist' "`estimat'" "`exp'" "`fast'" "`fixpowe'" `glm' `gplot' `graph' "`if'" "`in'" "`kx'" `lin' "`log'" `lnx' `meq2' `mnlnwt' "`name'" `nobs' `normal' `np' "`options'" "`origin'" `p' "`pwrs'" `qreg' "`repeat'" "`rhs'" "`saving'" `search' "`shift'" `x' `y' "`zero'" "`zeta'" ; #delimit cr end