• Keine Ergebnisse gefunden

Nonparametric and spatial effects are most intuitively presented by visualization. BayesX provides three options to display estimation results:

• As mentioned in the previous section, BayesX automatically stores most of the results in postscript files.

• Post-estimation commands of remlreg objects allow to display results immediately after having executed a regress command (as long as the corresponding remlreg object is available).

• Graph objects can be used to visualize the content of dataset objects. Hence, creating a dataset object from one of the ASCII files containing the estimation results allows to generate graphics of these results.

In this section we describe the application of the post-estimation commands as well as the usage of graph objects to enable the user to reproduce the automatically generated plots directly in BayesX. Section 7.5 describes how to customize plots.

7.4.1 Post-estimation commands

After having estimated a regression model plots for nonparametric effects of metrical covariates can be generated by the post-estimation command plotnonp.

> r.plotnonp 1 and

> r.plotnonp 2

produce the graphs shown in Figure 7.3 in an Object-Viewer window. Each effect matches a predetermined number obtained from numbering the terms in the regression model which is supplied in the output window (compare the example on the effect ofbmiabove). Note that plotnonp can only be applied as long as the corresponding regression object is available, and hence plotnonp is called a post-estimation command.

12.8 19.4 26 32.7 39.3

-0.3 -0.1 0.1 0.3 0.5

0 14.8 29.5 44.3 59

-0.28 0.07 0.43 0.78 1.13

Figure 7.3: Effect of the body mass index of the child‘s mother and of the age of the child together with pointwise 80% and 95% credible intervals.

The effect of the mother’s body mass is almost linearly increasing indicating a lower risk for undernutrition for better nourished mothers. The effect of the age of the child is obviously nonlinear and strongly decreasing between birth and an age of about 20 months.

This continuous worsening of the nutritional status may be caused by the fact that most of the children obtain liquids other than breast milk already shortly after birth. After 20 months a relatively stable, low level is reached. The slight increase of the effect after 24 months is introduced by a change of the reference standard at that point.

By default the plots produced by plotnonp contain the posterior mode and pointwise credible intervals according to the levels specified in the regress command. Hence, by default Figure 7.3 includes pointwise 80% and 95% credible intervals.

A plot may be stored in postscript format using the outfile option. Executing

> r.plotnonp 1, replace outfile = c:\data\f_bmi.ps

stores the plot for the estimated effect of bmi in the file c:\data\f_bmi.ps. Again, specifyingreplaceallows BayesX to overwrite an existing file (otherwise an error message would be raised, if the file is already existing). Note that BayesX does not display the graph on the screen if option outfile is passed.

Estimation results of spatial effects are best visualized by drawing the respective map and coloring the regions of the map according to some characteristic of the posterior, e. g. the posterior mode. In case of the structured spatial effect, the respective Figure 7.4 can be achieved using the post-estimation command drawmap:

> r.drawmap 3

The map shows pronounced undernutrition in the northern part of Zambia and better nu-trition in the southern part. This is in agreement with findings on the spatial segregation of poverty and deprivation within Zambia (see Kandala et al. (2001) for a more detailed discussion of estimation results).

-0.313644 0 0.243711

Figure 7.4: Posterior mode estimates of the structured spatial effect.

7.4.2 Graph objects

The commands presented in the previous subsection work only as long as the correspond-ing regression object is available in the current BayesX session. However, it may also be desirable to visually inspect results of former analyses which can be achieved using graph objects. Note that graph objects are also used in the batch file of the commands to re-produce the automatically generated graphics. Therefore, the purpose of this subsection is also to get the content of this batch file across.

First, the estimation results have to be stored in a dataset object, e. g. by running the commands

> dataset res

> res.infile using c:\data\r_f_bmi_pspline.res

to obtain the results for the effect of bmi. Now, the estimation results (or any content of a dataset object) may be visualized using a graph object which we create by typing

> graph g

Executing the plotcommand of graph objects

> g.plot bmi pmode ci95lower ci80lower ci80upper ci95upper using res reproduces the graph in the left part of Figure 7.3.

In analogy, spatial effects can be displayed using methoddrawmap of graph objects:

> res.infile using c:\data\r_f_district_spatial.res

> g.drawmap pmode district, map=m using res

Since – in contrast to a remlreg object – no map object is associated with a graph object, we explicitly have to specify the desired map in the option list.

Moreover, graph objects allow to plot other characteristics of the posterior than the posterior mode. For instance, the posterior 95% probabilities may be visualized by

> g.drawmap pcat95 district, map=m using res The result is shown in Figure 7.5.

-1.0 0 1.0

Figure 7.5: Posterior 95% probabilities of the structured spatial effect. Black (white) denotes strictly negative (positive) credible intervals

As a further advantage, visualization of the estimation results of uncorrelated spatial effects is enabled. Since these are modeled as unstructured random effects, BayesX is

unable to recognize them as spatial effects. However, proceeding as follows gives us the possibility to plot the unstructured spatial effect shown in Figure 7.6:

> res.infile using c:\data\r_f_district_random.res

> g.drawmap pmode district, map=m color swapcolors using res

-0.109228 0 0.115689

Figure 7.6: Posterior mode estimates of the unstructured spatial effect.