Stata 15 help for cusum

[R] cusum -- Cusum plots and tests for binary variables

Syntax

cusum yvar xvar [if] [in] [, options]

options Description ------------------------------------------------------------------------- Main generate(newvar) save cumulative sum in newvar yfit(fitvar) calculate cumulative sum against fitvar nograph suppress the plot nocalc suppress cusum test statistics

Cusum plot connect_options affect the rendition of the plotted line

Add plots addplot(plot) add plots to the generated graph

Y axis, X axis, Titles, Legend, Overall twoway_options any options other than by() documented in [G-3] twoway_options -------------------------------------------------------------------------

Menu

Statistics > Other > Quality control > Cusum plots and tests for binary variables

Description

cusum graphs the cumulative sum (cusum) of a binary (0/1) variable, yvar, against a (usually) continuous variable, xvar.

Options

+------+ ----+ Main +-------------------------------------------------------------

generate(newvar) saves the cusum in newvar.

yfit(fitvar) calculates a cusum against fitvar, that is, the running sums of the "residuals" fitvar minus yvar. Typically, fitvar is the predicted probability of a positive outcome obtained from a logistic regression analysis.

nograph suppresses the plot.

nocalc suppresses calculation of the cusum test statistics.

+------------+ ----+ Cusum plot +-------------------------------------------------------

connect_options affect the rendition of the plotted line; see [G-3] connect_options.

+-----------+ ----+ Add plots +--------------------------------------------------------

addplot(plot) provides a way to add other plots to the generated graph. See [G-3] addplot_option.

+-----------------------------------------+ ----+ Y axis, X axis, Titles, Legend, Overall +--------------------------

twoway_options are any of the options documented in [G-3] twoway_options, excluding by(). These include options for titling the graph (see [G-3] title_options) and for saving the graph to disk (see [G-3] saving_option).

Examples

Setup . sysuse auto

Graph cumulative sum of foreign against weight . cusum foreign weight

Save as above, but save the cumulative sum in variable cs . cusum foreign weight, generate(cs)

Stored results

cusum stores the following in r():

Scalars r(N) number of observations r(prop1) proportion of positive outcomes r(cusum1) cusum r(zl) test (linear) r(P_zl) p-value for test (linear) r(cusumq) quadratic cusum r(zq) test (quadratic) r(P_zq) p-value for test (quadratic)


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index