*! version 0.1.4 8 Nov 2022

mpitb stores -- stores estimates into results frame

Syntax

mpitb stores, frame(name) loa(name)
measure(name) spec(name) [options]

* frame(name) name of results frame

* loa(name) underlying level of analysis

* measure(name) underlying measure

* spec underlying specification

ctype(integer) the ctype of the estimate

k(numlist) underlying poverty cutoff

indicator(name) underlying indicator

wgts(name) underlying weighting scheme

tvar(varname) time variable

† t0(value) time variable at begin of period of change

† t1(value) time variable at end of period of change

† yt0(year) year in t0

† yt1(year) year in t1

† ann(value) changes are annualised

subg(numlist) level of subgroup variable

add(string) add string as value for extra variable

ts add data and estimation time stamps

* required options; † required options if ctype=1,2.

Description

mpitb stores may store results of an estimation into the results frame.
Stored information includes the core of an estimate (e.g., point estimate, standard
error, ...) and meta information describing content and context of the estimate
(e.g., measure, indicator, level of analysis, etc). mpitb stores may store
estimates of both levels and changes.

mpitb stores is intended for advanced users and programmers who wish to add
results of a custom estimation to their results frame. Estimates of standard quantities
(e.g., adjusted headcount ratio, intensity, etc.) are automatically stored by
mpitb est.

Options

frame(name) specifies the name of the frame where results are stored.

loa(name) specifies the level of analysis to which the estimate refers.

measure(name) specifies the name of the measure to which the estimate refers.

spec(name) specifies the name of the specification to which the estimate refers.

ctype(integer) specifies the ctype ("change type") of the estimate to store.
The ctype is 0 for "levels", 1 for "absolute changes" and 2 for "relative changes".

tvar(varname) specifies the time variable, which identifies the different
survey rounds in the data. This option is needed if you wish to store level
estimates over several survey rounds (harmonised over time data). In particular,
this option is not needed to store estimates of changes over time.

t0(value) specifies the initial period of a change according to the
integer time variable.

t1(value) specifies the final period of change according to the integer
time variable.

yt0(year) specifies the year in t0 and may contain decimal digits.

yt1(year) specifies the year in t1 and may contain decimal digits.

ann(value) specifies whether change estimate to be stored is annualised (=1)
or not(=0).

add(string) adds string as a value for the extra variable specified by the
add(name) option of mpitb rframe.

ts adds timestamp for the underlying data set and for estimation time.

Remarks

1. The basic usage is to (i) setup a results frame, (ii) perform the estimation and then (iii)
store the estimate. There are two ways how to create a results frame. First,
mpitb est can be instructed to create a result frame, which remains
accessible to the user after program completion. Second, mpitb rframe is
the underlying stand-alone tool.

Examples

1. Storing a simple aggregate level estimate

Set up the results frame

mpitb rframe , frame(mylevs)

Estimate the quantity of interest

mean d_cm

Store estimate into results frame

mpitb stores , fr(mylevs) loa(nat) m(hd) i(d_cm) spec(mympi)

2. Storing a simple level estimate for subgroups

mpitb rframe , frame(mylevs)

svy : mean d_nutr , over(area)

mpitb stores , fr(mylevs) loa(area) meas(hd) i(d_nutr) spec(gmpi)

3. Storing an aggregate estimate for levels over time:

mpitb rframe , fr(levot) t

svy : mean d_cm , over(t)

mpitb stores , fr(levot) loa(nat) meas(hd) i(d_cm) sp(gmpi) tvar(t)

4. Storing an estimate for levels over time for subgroups:

mpitb rframe , fr(levot) t

svy : mean d_cm , over(area t)

mpitb stores , fr(levot) loa(area) meas(hd) i(d_cm) sp(gmpi) w(equal) tvar(t)

5. Storing proportions over time (with timestamps)

mpitb rframe , fr(levot) t ts

svy: prop area

mpitb stores , fr(level) loa(area) meas(popsh) sp(gmpi) ts

6. Storing a change estimate (raw and absolute change)

mpitb rframe , frame(cot) cot

svy: mean d_satt if , over(t)

lincom (d_satt@2.t - d_satt@1.t)

mpitb stores , fr(cot) l(nat) m(hd) ct(1) sp(gmpi_cot) ann(0) yt0(2011) yt1(2014) t0(1) t1(2)

7. Storing a change estimate and levels for a subgroup:

Storing changes of subgroups requires loops. Assume the time variable t
may be 1 or 2 whereas the variable area may either be 0 ("rural") or 1 ("urban")

First we prepare two frames: one for levels, one for changes

mpitb rframe , frame(level) t

mpitb rframe , frame(cot) cot

Next we estimate levels for all subgroups at all points of time

svy : mean d_nutr , over(t area)

Then we can store all levels

mpitb stores , fr(level) l(area) m(hd) ct(0) sp(gmpi_cot) w(equal) tvar(t) ind(d_nutr)

Finally, we can estimate each change and store it immediately into the result frame

forval s = 0/1 {

lincom (d_nutr@`s'.area#2.t - d_nutr@`s'.area#1.t)

mpitb stores , fr(cot) l(area) m(hd) ct(1) sp(gmpi_cot) ann(0) yt0(2011) yt1(2014) t0(1) t1(2)

}