-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbinipolate.sthlp
99 lines (83 loc) · 2.95 KB
/
binipolate.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
{smcl}
{viewerjumpto "Syntax" "examplehelpfile##syntax"}{...}
{viewerjumpto "Description" "examplehelpfile##description"}{...}
{viewerjumpto "Options" "examplehelpfile##options"}{...}
{viewerjumpto "Remarks" "examplehelpfile##remarks"}{...}
{viewerjumpto "Examples" "examplehelpfile##examples"}{...}
{title:Title}
{p2colset 5 19 23 2}{...}
{p2col :{cmd:binipolate} {hline 2}}Bin
data and linearly interpolate percentiles.{p_end}
{p2colreset}{...}
{marker syntax}{...}
{title:Syntax}
{phang}
This command replaces the dataset in memory with a dataset containing linearly interpolated percentiles.
{p 8 17 2}
{cmd:binipolate }
{it:varname}
{ifin}
{weight}
{cmd:,}
{cmdab:b:insize(}{it:sizeofbin}{cmd:)}
[
{cmdab:p:ercentiles(}{it:numlist}{cmd:)}
{cmd:by(}{it:varlist}{cmd:)}
{opt collapsefun(function)}
{opt wide}
{opt classical}
{opt bgen(newvar)}
{opt cgen(newvar)}
{opt pgen(newvar)}
]
{phang}
where {cmdab:b:insize(}{it:sizeofbin}{cmd:)} is the desired size of the bins.
{p_end}
{synoptset 25 tabbed}{...}
{marker table_options}{...}
{synopthdr}
{synoptline}
{syntab :Options}
{synopt :{opth percentiles(numlist)}}list of percentiles as percentages; default is 50 (the median).
{p_end}
{synopt :{opth by(varlist)}}groups over percentiles are to be calculated.
{p_end}
{synopt :{opt wide}}reshape output to wide format; default is long
{p_end}
{synopt :{opt classical}}also calculate classical (non-binned) percentiles.
{p_end}
{synopt :{opth bgen(newvar)}}new variable for values of binned percentiles; default is {it:varname_binned}.
{p_end}
{synopt :{opth cgen(newvar)}}new variable for values of classical percentiles; default is {it:varname_classical}.
{p_end}
{synopt :{opth pgen(newvar)}}new variable for values of binned percentiles; default is {it:varname_binned}.
{p_end}
{syntab:Extras}
{synopt :{opt collapsefun(function)}}Use a Stata collapse function with the same syntax as the default {cmd:collapse} (like {cmd:gcollapse} or {cmd:fcollapse}).
{p_end}
{synoptline}
{p2colreset}{...}
{p 4 6 2}
{marker description}{...}
{title:Description}
{pstd}
{cmd:binipolate} bins {it:varname} into bins of length {it:sizeofbin} and
calculates linearly interpolated percentiles specified by {cmd:percentiles()}.
{pstd}
{cmd:binipolate} replaces the original dataset in memory with a new dataset
containing the percentiles.
{pstd}
If {cmd:percentiles()} is empty, {cmd:binipolate}
returns the median.
{pstd}
{opt classical} will optionally calculate classical percentiles by
{cmd:collapse} or the function specified in {opt collapsefun()}. Computation speed is often much faster when using {cmd:gcollapse} from the gtools package: {opt collapsefun(gcollapse)}.
{title:Examples}
{hline}
{pstd}Calculate binned and classical medians:{p_end}
{phang2}{cmd:. sysuse auto, clear}{p_end}
{phang2}{cmd:. binipolate price, binsize(500) by(foreign) classical}{p_end}
{title:Website}
{pstd}
{cmd:binipolate} is maintained at {browse "https://github.com/Economic/binipolate":github.com/Economic/binipolate}
{p_end}