Inverse Gaussian estimation, Stata program Sample Clauses
Inverse Gaussian estimation, Stata program.ย The methodological framework described above is implemented in a Stata program. The IG model was fitted by maximum likelihood in Stata 14. A gradient method is used in Stata called lf to find the maximum likelihood parameter estimates and their standard errors. The main routine is listed below and calls a subroutine, named ig. The subroutine is listed below the main program. The terms t and f denote the censoring or failure time and failure indicator of the current observation, respectively. The terms theta1 and theta2 denote the two linear predictors representing distance and velocity, respectively. The model can be adjusted for covariates that affect either one or both linear predictors; cov1 cov2 cov3. This covariate set will include the treatment indicator and any additional prognostic or predictive interaction variables. /* Main routine */ ml model lf ig (theta1: t f = cov1 cov2) (theta2: cov3) ml max /* Subroutine */ capture program drop ig program ig version 14.0 args lnf theta1 theta2 tempvar A B E F G fig M N O lnS s local y "$ML_y1" local d "$ML_y2" gen double `A' = ln((2*_pi)^-0.5) gen double `B' = -1.5*ln(`y') gen double `E' = ((exp(`theta1'))^2) / (`y') gen double `F' = 2 * exp(`theta1')*(`theta2') gen double `G' = (`y') * (`theta2')^2 gen double `fig' = (`theta1') + `A' + `B' - 0.5 * (`E' - `F' + `G') gen double `M' = exp(`theta1')- (`y'*`theta2') gen double `N' = -(exp(`theta1'))- (`y'*`theta2') gen double `O' = (`y')^0.5 gen double `lnS' = ln(normprob(`M'/`O') - exp(`F')*normprob(`N'/`O')) gen double `s' = exp(`lnS') quietly replace `lnf' = (`d' * `fig') + ((1 - `d') * (`lnS')) end The survival function is estimated during the maximum likelihood routine and can be easily extracted (๐ ) along with bootstrap confidence intervals. In the following section I describe the implementation of the program in a practical illustration to aid in understanding the flexibility of the approach, and how it can be used, to help understand the therapeutic process.
