// version 1.0.0 14Feb2018 // Functions used in mycalcs.cpp // #include #include "stplugin.h" #include "mymatrix.h" #include "mycalcsv.h" ST_retcode MyAve(MyMatrix &bmat, ST_int first, ST_int last, ST_int nvars, ST_int *nobs) { ST_int i, j ; ST_double value ; ST_retcode rc ; char msg[80] ; *nobs = (ST_int) 0 ; for(i=first-1; i0) { sprintf(msg, "Problem accessing Stata data\n") ; SF_error(msg) ; return(rc) ; } if (SF_is_missing(value)) { sprintf(msg, "missing values encountered\n") ; SF_error(msg) ; return(static_cast(416)) ; } bmat.IncrementByValue(0, j, value) ; } } bmat.DivideByScalar( static_cast(*nobs) ) ; return(rc) ; } ST_retcode MyV(MyMatrix &bmat, MyMatrix &vmat, ST_int first, ST_int last, ST_int nvars, ST_int nobs) { ST_int i, j, j2 ; ST_double value ; char msg[80] ; ST_retcode rc ; rc = (ST_retcode) 0 ; MyMatrix emat2(1, nvars) ; for(i=first-1; i0) { sprintf(msg, "Problem accessing Stata data\n") ; SF_error(msg) ; return(rc) ; } if (SF_is_missing(value)) { sprintf(msg, "missing values encountered\n") ; SF_error(msg) ; return(static_cast(416)) ; } emat2.StoreValue(0, j, (bmat.GetValue(0,j)-value) ) ; } for(j=0; j (nobs*(nobs-1))) ) ; return(rc) ; }