-
Notifications
You must be signed in to change notification settings - Fork 1
/
ivmw.sthlp
123 lines (95 loc) · 4.9 KB
/
ivmw.sthlp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{smcl}
{* *! version 0.1.0 12sep2021 Tom Palmer}{...}
{vieweralsosee "ivonesamplemr" "help ivonesamplemr"}{...}
{vieweralsosee "rolling" "help rolling"}{...}
{viewerjumpto "Syntax" "ivmw##syntax"}{...}
{viewerjumpto "Description" "ivmw##description"}{...}
{viewerjumpto "Options" "ivmw##options"}{...}
{viewerjumpto "Examples" "ivmw##examples"}{...}
{viewerjumpto "Stored results" "ivmw##results"}{...}
{viewerjumpto "References" "ivmw##references"}{...}
{viewerjumpto "Author" "ivmw##author"}{...}
{title:Title}
{p 5}
{bf:ivmw} {hline 2} Moving window prefix command
{p_end}
{marker syntax}{...}
{title:Syntax}
{p 8 12 2}
{cmd:ivmw} {cmd:,} {opt window(#)} {opt par(string)} [{opt sa:ving(filename [, replace])}
{opt rolling_options}]{cmd::} {it:iv_cmd}
{synoptset 30 tabbed}{...}
{synopthdr}
{synoptline}
{synopt:{opt par:(string)}}Parameter from the {it:iv_cmd} (ivreg2, ivmsmm, ivlsmm, ivtsps, ivtsri) to collect{p_end}
{synopt:{opt window:(#)}}number of consecutive data points in each sample{p_end}
{synopt:{opt sa:ving(filename [, replace])}}Save the moving window output to a dataset.
Specify {cmd:replace} to overwrite the dataset if it already exists.{p_end}
{synopt:{opt rolling_options:}}{help rolling##options}{p_end}
{marker description}{...}
{title:Description}
{pstd}
{cmd:ivmw} implements the moving window (a.k.a. sliding / rolling window) approach to the estimator
specified after the prefix, as per {help ivmw##burgess:Burgess et al., 2014}.
It is implemented as a call to {help rolling}.
{marker options}{...}
{title:Options}
{phang}
Please see {help rolling##options}
{marker examples}{...}
{title:Examples}
{pstd}Simulate data with different outcome-exposure relationships; y# outcome, x exposure, g instrumental variable (genotype).{p_end}
{phang2}{cmd:.} {stata "use https://raw.github.com/remlapmot/ivonesamplemr/main/data/ivmwdata, clear"}{p_end}
{pstd}Plot outcome-exposure relationships{p_end}
{phang2}{cmd:.} {stata "twoway line y1 x, sort(x)"}{p_end}
{phang2}{cmd:.} {stata "twoway line y2 y3 y4 x, sort(x)"}{p_end}
{phang2}{cmd:.} {stata "twoway line y5 x, sort(x)"}{p_end}
{pstd}Example moving window fits.{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(x): ivreg2 y1 (x = g)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(x): ivreg2 y2 (x = g)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(x): ivreg2 y3 (x = g)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(x): ivreg2 y4 (x = g)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(x): ivreg2 y5 (x = g)"}{p_end}
{pstd}Change window size (e.g. for outcome y2).{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3750) par(x): ivreg2 y2 (x = g)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3000) par(x): ivreg2 y2 (x = g)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(2000) par(x): ivreg2 y2 (x = g)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(1000) par(x): ivreg2 y2 (x = g)"}{p_end}
{pstd}Save the moving window dataset.{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(x) saving(ivmw): ivreg2 y2 (x = g)"}{p_end}
{pstd}Use different iv commands.{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(x): ivregress 2sls y (x = z1 z2 z3)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(x): ivregress liml y (x = z1 z2 z3)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(x): ivregress gmm y (x = z1 z2 z3)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(x): ivlsmm y (x = z1 z2 z3)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(x): ivmsmm y (x = z1 z2 z3)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(b1): ivtsps y (x = z1 z2 z3)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(b1): ivtsps y (x = z1 z2 z3), link(logadd)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(b1): ivtsps y (x = z1 z2 z3), link(logmult)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(b1): ivtsps y (x = z1 z2 z3), link(logit)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(b1): ivtsri y (x = z1 z2 z3)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(b1): ivtsri y (x = z1 z2 z3), link(logadd)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(b1): ivtsri y (x = z1 z2 z3), link(logmult)"}{p_end}
{phang2}{cmd:.} {stata "ivmw, window(3950) par(b1): ivtsri y (x = z1 z2 z3), link(logit)"}{p_end}
{marker results}{...}
{title:Stored results}
{pstd}
Please see {help rolling##results}{p_end}
{marker references}{...}
{title:References}
{marker burgess}{...}
{phang}
Burgess S, Davies N, Thompson SG, EPIC-InterAct Consortium.
Instrumental variable analysis with a nonlinear exposure-outcome relationship.
Epidemiology, 2014, 25, 6, 877-885.
{browse "https://doi.org/10.1097/ede.0000000000000161":DOI}
{p_end}
{marker manrolling}{...}
{phang}
StataCorp. Stata Base Reference Manual. Release 16.
rolling - Rolling-window and recursive estimation. 2016.
{browse "https://www.stata.com/manuals/tsrolling.pdf":URL}
{p_end}
{marker author}{...}
{title:Author}
INCLUDE help ivonesamplemr-author