Skip to content

Commit

Permalink
minor changes, v2.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
anddis committed Nov 26, 2018
1 parent f8cb003 commit 23366d4
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 231 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# med4way
### A Stata command for the 4-way decomposition using parametric regression models

- Current version: `2.2.2`
- Release date: `14jun2018`
- Current version: `2.2.3`
- Release date: `25nov2018`

---

Expand Down
16 changes: 14 additions & 2 deletions med4way.ado
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
*! Hello, I'm med4way.ado
*! v2.2.2 - 14jun2018
*! v2.2.3 - 25nov2018

/*
Previous versions:
v2.2.2 - 14jun2018
v2.2.1 - 19sep2017
v2.2.0 - 31jul2017
v2.1.1 - 28jul2017
Expand Down Expand Up @@ -246,6 +247,13 @@ program define med4way, eclass
}
}

//casecontrol works only with yreg logistic
if ("`casecontrol'"=="true") & !("`yreg'"=="logistic") {
display as error "Error: option casecontrol can only be specified together with a " /*
*/ "logistic regression model for the outcome (yreg)."
error 198
}

//validate rare outcome
if ("`yreg'"=="logistic") {
if "`casecontrol'"=="true" {
Expand Down Expand Up @@ -615,9 +623,13 @@ program define validate_c, rclass
// c_local eretc "`c'" // c used in med4way's ereturn
c_local wrnngtxt `wrnngtxt'

mata: st_local("c_missing", strofreal(hasmissing(strtoreal(tokens(st_local("c")))))) // check that there are no missing values in c. It happens for example if c() contains strings.
if (`c_missing' == 1) {
di as error "Error: please, check the option c(). It must contain only numbers and/or dots (.)"
error 198
}
tempname cmatrix // c needs to be a matrix to pass it on to mata -> dump c into cmatrix
mata: st_matrix("`cmatrix'", strtoreal(tokens(st_local("c"))))

return mat cmatrix = `cmatrix'
end validate_c

Expand Down
4 changes: 2 additions & 2 deletions med4way.pkg
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ d A.Discacciati, A.Bellavia, L.Valeri
d
d After installation, see help med4way
d
d Current version: 2.2.2
d Distribution-Date: 14jun2018
d Current version: 2.2.3
d Distribution-Date: 25nov2018
d
f med4way.ado
f med4way_engine.ado
Expand Down
14 changes: 7 additions & 7 deletions med4way.sthlp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{smcl}
{* *! version 2.2.2 14jun2018}{...}
{* *! version 2.2.3 25nov2018}{...}

{cmd:help med4way}
{hline}
Expand Down Expand Up @@ -91,22 +91,22 @@ Note: the 4-way decomposition holds without any assumptions about confounding. H
{p 7 6 2}{opt logb:inomial}: logbinomial regression (GLM with binomial distribution and log link function){p_end}
{p 7 6 2}{opt poi:sson}: Poisson regression{p_end}
{p 7 6 2}{opt negb:inomial}: negative binomial regression{p_end}
{p 7 6 2}{opt aft, {ul on}e{ul off}xponential}: Accelerated Failure Time (exponential survival distribution) ({helpb stset} required){p_end}
{p 7 6 2}{opt aft, {ul on}w{ul off}eibull}: Accelerated Failure Time (Weibull survival distribution) ({helpb stset} required){p_end}
{p 7 6 2}{opt cox}: Cox proportional hazards model ({helpb stset} required){p_end}
{p 7 6 2}{opt aft, {ul on}e{ul off}xponential}: Accelerated Failure Time regression (exponential distribution) ({helpb stset} required){p_end}
{p 7 6 2}{opt aft, {ul on}w{ul off}eibull}: Accelerated Failure Time regression (Weibull distribution) ({helpb stset} required){p_end}
{p 7 6 2}{opt cox}: Cox proportional hazards regression ({helpb stset} required){p_end}

{phang}
{opt mreg(string)} specifies the form of the regression model for the mediator. The available forms are:

{p 7 6 2}{opt lin:ear}: linear regression{p_end}
{p 7 6 2}{opt logi:stic}: logistic regression regression{p_end}
{p 7 6 2}{opt logi:stic}: logistic regression{p_end}

{phang}
{opt c(string)} fixes the values of the covariates {it:cvars} at which to compute the 4-way decomposition. If {it:cvars} are specified but this option is omitted, {it:cvars} will be automatically fixed at their respective mean values. If this option is specified, the number of values of {opt c(numlist)} must correspond to the number of {it:cvars}. A dot (.) can be used to fix the value of a specific covariate to its mean.
Example: the covariates specified are {it:cvar1 cvar2 cvar3} and the user wants to fix the value for {it:cvar2} to 6, while letting the values for {it:cvar1} and {it:cvar3} to be equal to their respective means. This can be achieved with the option {opt c(. 6 .)}.

{phang}
{opt casec:ontrol} specifies that the data comes from a case-control study (that is, sampling was done on the outcome).
{opt casec:ontrol} specifies that the data comes from a case-control study (that is, sampling was done on the outcome). This option can be specified only together with a logistic regression model for the outcome.

{phang}
{opt full:output} specifies that, in addition to the 4 components of the total effect (controlled direct effect, reference interaction, mediated interaction, pure indirect effect), the following quantities are to be estimated: the proportions of the total effect due to each of the 4 components, the overall proportion mediated, the overall proportion due to interaction, and the overall proportion that would be eliminated if the mediator {it:mvar} were fixed to the value {opt m(#)}.
Expand Down Expand Up @@ -245,7 +245,7 @@ For example, to calculate the overall proportion mediated (op_m){p_end}

{title:References}

{phang}Discacciati, A., Bellavia, A., Lee, J.J., Mazumdar, M., Valeri, L., 2018. Med4way: a Stata command to investigate mediating and interactive mechanisms using the four-way effect decomposition. International Journal of Epidemiology.
{phang}Discacciati, A., Bellavia, A., Lee, J.J., Mazumdar, M., Valeri, L., 2018. Med4way: a Stata command to investigate mediating and interactive mechanisms using the four-way effect decomposition. International Journal of Epidemiology. doi: 10.1093/ije/dyy236

{phang}VanderWeele, T.J., 2014. A unification of mediation and interaction: a 4-way decomposition. Epidemiology (Cambridge, Mass.), 25(5), p.749.

Expand Down
Loading

0 comments on commit 23366d4

Please sign in to comment.