Stata 15 help for pwcompare

[R] pwcompare -- Pairwise comparisons

Syntax

pwcompare marginlist [, options]

where marginlist is a list of factor variables or interactions that appear in the current estimation results or _eqns to reference equations. The variables may be typed with or without the i. prefix, and you may use any factor-variable syntax:

. pwcompare i.sex i.group i.sex#i.group

. pwcompare sex group sex#group

. pwcompare sex##group

options Description ------------------------------------------------------------------------- Main mcompare(method) adjust for multiple comparisons; default is mcompare(noadjust) asobserved treat all factor variables as observed

Equations equation(eqspec) perform comparisons within equation eqspec atequations perform comparisons within each equation

Advanced emptycells(empspec) treatment of empty cells for balanced factors noestimcheck suppress estimability checks

Reporting level(#) confidence level; default is level(95) cieffects show effects table with confidence intervals; the default pveffects show effects table with p-values effects show effects table with confidence intervals and p-values cimargins show table of margins and confidence intervals groups show table of margins and group codes sort sort the margins or contrasts within each term post post margins and their VCEs as estimation results display_options control column formats, row spacing, line width, and factor-variable labeling eform_option report exponentiated contrasts

df(#) use t distribution with # degrees of freedom for computing p-values and confidence intervals ------------------------------------------------------------------------- df(#) does not appear in the dialog box.

method Description ------------------------------------------------------------------------- noadjust do not adjust for multiple comparisons; the default bonferroni [adjustall] Bonferroni's method; adjust across all terms sidak [adjustall] Sidak's method; adjust across all terms scheffe Scheffe's method + tukey Tukey's method + snk Student-Newman-Keuls's method + duncan Duncan's method + dunnett Dunnett's method ------------------------------------------------------------------------- + tukey, snk, duncan, and dunnett are only allowed with results from anova, manova, regress, and mvreg. tukey, snk, duncan, and dunnett are not allowed with results from svy.

Time-series operators are allowed if they were used in the estimation.

Menu

Statistics > Postestimation

Description

pwcompare performs pairwise comparisons across the levels of factor variables from the most recently fit model. pwcompare can compare estimated cell means, marginal means, intercepts, marginal intercepts, slopes, or marginal slopes -- collectively called margins. pwcompare reports the comparisons as contrasts (differences) of margins along with significance tests or confidence intervals for the contrasts. The tests and confidence intervals can be adjusted for multiple comparisons.

pwcompare can be used with svy estimation results; see [SVY] svy postestimation.

See [R] margins, pwcompare for performing pairwise comparisons of margins of linear and nonlinear predictions.

Options

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

mcompare(method) specifies the method for computing p-values and confidence intervals that account for multiple comparisons within a factor-variable term.

Most methods adjust the comparisonwise error rate, alpha_c, to achieve a prespecified experimentwise error rate, alpha_e.

mcompare(noadjust) is the default; it specifies no adjustment.

alpha_c = alpha_e

mcompare(bonferroni) adjusts the comparisonwise error rate based on the upper limit of the Bonferroni inequality:

alpha_e <= m * alpha_c

where m is the number of comparisons within the term.

The adjusted comparisonwise error rate is

alpha_c = alpha_e/m

mcompare(sidak) adjusts the comparisonwise error rate based on the upper limit of the probability inequality

alpha_e <= 1 - (1 - alpha_c)^m

where m is the number of comparisons within the term.

The adjusted comparisonwise error rate is

alpha_c = 1 - (1 - alpha_e)^(1/m)

This adjustment is exact when the m comparisons are independent.

mcompare(scheffe) controls the experimentwise error rate using the F (or chi-squared) distribution with degrees of freedom equal to the rank of the term.

For results from anova, regress, manova, and mvreg, pwcompare allows the following additional methods. These methods are not allowed with results that use vce(robust) or vce(cluster clustvar).

mcompare(tukey) uses what is commonly referred to as Tukey's honestly significant difference. This method uses the Studentized range distribution instead of the t distribution.

mcompare(snk) is a variation on mcompare(tukey) that counts only the number of margins in the range for a given comparison instead of the full number of margins.

mcompare(duncan) is a variation on mcompare(snk) with additional adjustment to the significance probabilities.

mcompare(dunnett) uses Dunnett's method for making comparisons with a reference category.

mcompare(method adjustall) specifies that the multiple-comparison adjustments count all comparisons across all terms rather than performing multiple comparisons term by term. This leads to more conservative adjustments when multiple variables or terms are specified in marginlist. This option is compatible only with the bonferroni and sidak methods.

asobserved specifies that factor covariates be evaluated using the cell frequencies observed when the model was fit. The default is to treat all factor covariates as though there were an equal number of observations at each level.

+-----------+ ----+ Equations +--------------------------------------------------------

equation(eqspec) specifies the equation from which margins are to be computed. The default is to compute margins from the first equation.

atequations specifies that the margins be computed within each equation.

+----------+ ----+ Advanced +---------------------------------------------------------

emptycells(empspec) specifies how empty cells are handled in interactions involving factor variables that are being treated as balanced.

emptycells(strict) is the default; it specifies that margins involving empty cells be treated as not estimable.

emptycells(reweight) specifies that the effects of the observed cells be increased to accommodate any missing cells. This makes the margins estimable but changes their interpretation.

noestimcheck specifies that pwcompare not check for estimability. By default, the requested margins are checked and those found not estimable are reported as such. Nonestimability is usually caused by empty cells. If noestimcheck is specified, estimates are computed in the usual way and reported even though the resulting estimates are manipulable, which is to say they can differ across equivalent models having different parameterizations.

+-----------+ ----+ Reporting +--------------------------------------------------------

level(#); specifies the confidence level, as a percentage, for confidence intervals. The default is level(95) or as set by set level. The significance level used by the groups option is 100-#, expressed as a percentage.

cieffects specifies that a table of the pairwise comparisons with their standard errors and confidence intervals be reported. This is the default.

pveffects specifies that a table of the pairwise comparisons with their standard errors, test statistics, and p-values be reported.

effects specifies that a table of the pairwise comparisons with their standard errors, test statistics, p-values, and confidence intervals be reported.

cimargins specifies that a table of the margins with their standard errors and confidence intervals be reported.

groups specifies that a table of the margins with their standard errors and group codes be reported. Margins with the same letter in the group code are not significantly different at the specified significance level.

sort specifies that the reported tables be sorted on the margins or differences in each term.

post causes pwcompare to behave like a Stata estimation (e-class) command. pwcompare posts the vector of estimated margins along with the estimated variance-covariance matrix to e(), so you can treat the estimated margins just as you would results from any other estimation command. For example, you could use test to perform simultaneous tests of hypotheses on the margins, or you could use lincom to create linear combinations.

display_options: vsquish, nofvlabel, fvwrap(#), fvwrapon(style), cformat(%fmt), pformat(%fmt), sformat(%fmt), and nolstretch.

vsquish specifies that the blank space separating factor-variable terms or time-series-operated variables from other variables in the model be suppressed.

nofvlabel displays factor-variable level values rather than attached value labels. This option overrides the fvlabel setting; see [R] set showbaselevels.

fvwrap(#) specifies how many lines to allow when long value labels must be wrapped. Labels requiring more than # lines are truncated. This option overrides the fvwrap setting; see [R] set showbaselevels.

fvwrapon(style) specifies whether value labels that wrap will break at word boundaries or break based on available space.

fvwrapon(word), the default, specifies that value labels break at word boundaries.

fvwrapon(width) specifies that value labels break based on available space.

This option overrides the fvwrapon setting; see [R] set showbaselevels.

cformat(%fmt) specifies how to format contrasts or margins, standard errors, and confidence limits in the table of pairwise comparisons.

pformat(%fmt) specifies how to format p-values in the table of pairwise comparisons.

sformat(%fmt) specifies how to format test statistics in the table of pairwise comparisons.

nolstretch specifies that the width of the table of pairwise comparisons not be automatically widened to accommodate longer variable names. The default, lstretch, is to automatically widen the table of pairwise comparisons up to the width of the Results window. To change the default, use set lstretch off. nolstretch is not shown in the dialog box.

eform_option specifies that the contrasts table be displayed in exponentiated form. exp(contrast) is displayed rather than contrast. Standard errors and confidence intervals are also transformed. See [R] eform_option for the list of available options.

The following option is available with pwcompare but is not shown in the dialog box:

df(#) specifies that the t distribution with # degrees of freedom be used for computing p-values and confidence intervals. The default is to use e(df_r) degrees of freedom or the standard normal distribution if e(df_r) is missing.

Examples

--------------------------------------------------------------------------- Setup for a one-way model . webuse yield . regress yield i.fertilizer

Mean yield for each fertilizer . pwcompare fertilizer, cimargins

Pairwise comparisons of mean yields . pwcompare fertilizer

Pairwise comparisons using Duncan's adjustment for the p-values and confidence intervals . pwcompare fertilizer, effects mcompare(duncan)

Setup for a two-way model . regress yield fertilizer##irrigation

Pairwise comparisons of the cell means with group codes denoting means that are not significantly different based on Tukey's honestly significant difference . pwcompare fertilizer#irrigation, group mcompare(tukey)

Setup for continuous covariate . regress yield fertilizer##c.N03_N

Pairwise comparisons of slopes for each fertilizer with confidence intervals adjusted based on Scheffe's method . pwcompare fertilizer#c.N03_N, mcompare(scheffe)

--------------------------------------------------------------------------- Setup for nonlinear model . webuse hospital . logit satisfied i.hospital

Pairwise comparisons of the log odds using Bonferroni's adjustment . pwcompare hospital, mcompare(bonferroni)

--------------------------------------------------------------------------- Setup for multiple-equation model . webuse jaw . mvreg y1 y2 y3 = i.fracture

Pairwise comparisons of the margins for fracture in the first equation . pwcompare fracture

Pairwise comparisons of the margins for fracture within each equation . pwcompare fracture, atequations

---------------------------------------------------------------------------

Stored results

pwcompare stores the following in r():

Scalars r(df_r) variance degrees of freedom r(k_terms) number of terms in marginlist r(level) confidence level of confidence intervals r(balanced) 1 if fully balanced data, 0 otherwise

Macros r(cmd) pwcompare r(cmdline) command as typed r(est_cmd) e(cmd) from original estimation results r(est_cmdline) e(cmdline) from original estimation results r(title) title in output r(emptycells) empspec from emptycells() r(groups#) group codes for the #th margin in r(b) r(mcmethod_vs) method from mcompare() r(mctitle_vs) title for method from mcompare() r(mcadjustall_vs) adjustall or empty r(margin_method) asbalanced or asobserved r(vce) vcetype specified in vce() in original estimation command

Matrices r(b) margin estimates r(V) variance-covariance matrix of the margin estimates r(error) margin estimability codes; 0 means estimable, 8 means not estimable r(table) matrix containing the margins with their standard errors, test statistics, p-values, and confidence intervals r(M) matrix that produces margins from the model coefficients r(b_vs) margin difference estimates r(V_vs) variance-covariance matrix of the margin difference estimates r(error_vs) margin difference estimability codes; 0 means estimable, 8 means not estimable r(table_vs) matrix containing the margin differences with their standard errors, test statistics, p-values, and confidence intervals r(L) matrix that produces the margin differences from the model coefficients r(k_groups) number of significance groups for each term

pwcompare with the post option also stores the following in e():

Scalars e(df_r) variance degrees of freedom e(k_terms) number of terms in marginlist e(balanced) 1 if fully balanced data, 0 otherwise

Macros e(cmd) pwcompare e(cmdline) command as typed e(est_cmd) e(cmd) from original estimation results e(est_cmdline) e(cmdline) from original estimation results e(title) title in output e(emptycells) empspec from emptycells() e(margin_method) asbalanced or asobserved e(vce) vcetype specified in vce() in original estimation command e(properties) b V

Matrices e(b) margin estimates e(V) variance-covariance matrix of the margin estimates e(error) margin estimability codes; 0 means estimable, 8 means not estimable e(M) matrix that produces margins from the model coefficients e(b_vs) margin difference estimates e(V_vs) variance-covariance matrix of the margin difference estimates e(error_vs) margin difference estimability codes; 0 means estimable, 8 means not estimable e(L) matrix that produces the margin differences from the model coefficients


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