help plotbeta-------------------------------------------------------------------------------

Title

Plots the estimates from a series of lincom commands

Syntax

plotbetaexp[,options]

optionsDescription ------------------------------------------------------------------------- Mainposition(numlist)specifies the position of the confidence intervals.eformspecifies that the exponentiated form the parameters be plotted.verticalspecifies that the confidence intervals are plotted vertically.level(#)specifies the confidence level.labelsspecifies that variable labels are used in the plot.savedata(filename)specifies that the data in the final plot should be saved.addplot(graph)specifies that an additional twoway graph is added to the plot. twoway_options -------------------------------------------------------------------------where

expis defined

lincom_exp[|]and where

lincom_expmay be any linear combination of coefficients that is valid syntax for test. Note, however, thatexpmay not contain an equal sign.

DescriptionThis command will plot the parameter estimates and confidence intervals from a series of lincom commands.

Updating this command using SSCTo obtain the latest version click the following to install the new version

ssc install plotbeta,replace

Options

position(numlist)specifies the position of the confidence intervals. The default is that the point estimate and confidence intervals are plotted at points 1 2 3 ... It is possible to group confidence intervals in different parts of the plots e.g. 1 2 3 3.1 3.2, here the last three confidence intervals will be much closer to each other.

eformspecifies that the exponentiated form the parameters be plotted.

labelsspecifies that if the lincom expression is a variable then that variable's label is used instead of the variable name. This option is particularly useful if the linear predictor is made up entirely of main effects.

verticalspecifies that the confidence intervals are plotted vertically rather than the default of horizontally.

level(#)specifies the confidence level, in percent, for confidence intervals; see level.

savedata(filename)specifies that the data in the final plot should be saved.

addplot(graph)specifies that an additional twoway graph is added to the plot. This is particularly useful for adding additional datapoints using twoway_scatteri.

ExamplesA linear regression using the auto data, click the highlighted text in order

sysuse auto, clear reg price mpg turn length plotbeta mpg | turn | length plotbeta mpg | turn | length, labels plotbeta mpg | turn | length, addplot((scatteri 2.5 2.5, ms(S) msize(*2))) la > bels

To remove the green text on the right hand side of the plot you need to add in the following two options

plotbeta mpg | turn | length, addplot((scatteri 2.5 2.5, ms(S) msize(*2))) labels ylab(none, axis(2)) ytitle("", axis(2))

This is the most basic graphic and using twoway options the look can be improved. The following command puts the confidence intervals

plotbeta mpg | turn | length | mpg-length , xtitle(Parameters) yscale(range(0.7 4.3) axis(1)) yscale(range(0.7 4.3) axis(2)) title(Coefficients and Confidence Intervals) subtitle(from a Simple Linear Regression) xline(0, lp(dash))

An example using Survival data, click the highlighted text in order

sysuse cancer stset studytime, f(died) xi:stcox i.drug age plotbeta _Idrug_2 | _Idrug_3 plotbeta _Idrug_2 | _Idrug_3, labels eform savedata(temp,replace)

Using the twoway options to solve a problem with labelling

plotbeta age | _Idrug_2 | _Idrug_3, eform labels xline(1, lp(dash))

Notethat by addingageinto the estimates the ylabels are off the graph. This is due to the single quote in the variable label. Either change the label or alter the graphregion sizeplotbeta age | _Idrug_2 | _Idrug_3, eform labels xline(1, lp(dash)) graphregion(margin(l+40 r+15))

AuthorAdrian Mander, MRC Biostatistics Unit, Cambridge, UK.

Email adrian.mander@mrc-bsu.cam.ac.uk

Also seeRelated commands

HELP FILES lincom