Bivariate scatter plots for higher-level units (beta version)
mltl2scatter yvar xvar [if] [weight] , l2id(varname) [ keepvars labels lfit qfit ]
mltl2scatter is part of the mlt (multilevel tools) package.
mltl2scatter is an easy way to produce scatter plots for higher-level units. It calculates the mean of the specified variables (yvar and xvar) at the level specified with the l2id(varname) option. The options allow some formatting of the scatter plot. However, if you want to customize the graph, it is useful to specify the keepvars option. mltl2scatter will keep the calculated variables and you can use them to produce any graph.
mltl2scatter can be used together with mlt2stage to produce two-stage plots of the estimated single country regression coefficients of a lower-level variable over a higher-level variable. See Mood (2010) for the comparison of logit models based on different samples.
mltl2scatter allows to specify a weight for the units at the lower level. aweights, fweights and iweights are allowed. See the help for summarize to read how these weights are treated.
keepvars can be specified to keep the variables produced by mltl2scatter. This option is useful in order to customize the graph in your own style.
labels includes the value labels of the variable specified in the l2id(varname) option as marker labels in the scatter plot.
lfit includes a linear regression line in the scatter plot.
qfit includes a non-linear regression line in the scatter plot.
Load data set (ISSP 2006) . net get mlt . use redistribution.dta
Bivariate scatter plot of data aggregated to the country-level . mltl2scatter gr_incdiff gini, l2id(Country) labels lfit
Also see the examples for mlt2stage.
ISSP (2006): International Social Survey Programme - Role of Government IV, GESIS StudyNo: ZA4700, Edition 1.0, doi:10.4232/1.4700.
Carina Mood (2010): “Logistic Regression: Why We Cannot Do What We Think We Can Do, and What We Can Do About It.” European Sociological Review 26 (1): 67-82.
Katja Moehring, GK SOLCIFE, University of Cologne, email@example.com, www.katjamoehring.de.
Alexander Schmidt, GK SOCLIFE and Chair for Empirical Economic and Social Research, University of Cologne, firstname.lastname@example.org, www.alexanderwschmidt.de.