Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Anova with string variables

From   Roger Newson <>
Subject   Re: st: Anova with string variables
Date   Sun, 24 Nov 2002 16:15:26 +0000

At 07:17 23/11/02 -0800, Ricardo Ovaldia wrote:
Dear all,

It is unfoutunate (and strange) that -anova- does not
accept string variables as factors. String variables
first need to be -encoded-. This is okay, except that
-anova,regress- does not display the value lables from
-encode- so unless you keep track of how the variable
was encoded one can not interpret the output. Is there
a way to display the output displaying the value
One possible solution might be to use the -parmest- package, together with the -descsave- and -factext- packages (all of which are downloadable from SSC). The -parmest- package creates an output data set with one observation per fitted parameter of a model, or one observation per parameter per by-group, and data on estimates, confidence limits, P-values and other parameter attributes, including optionally the variable label of the X-variate corresponding to the parameter. The -descsave- package is an extended version of -describe-, which creates an output do-file capable of reconstructing the variables described. The -factext- package reconstructs factors (numeric or string) in the -parmest- output data set, with their variable and/or value labels, so the user can produce plots, listings and/or tables of estimates, confidence intervals and/or P-values with the values of the factors displayed. A bonus is that the estimates and confidence limits can then be displayed to a sensible number of decimal places, and the P-values can be displayed to a sensible number of significant figures using a format such as %8.1e.

I presented a tutorial on the use of -parmest-, -factext- and -descsave- at the 2002 UK Stata User Meeting, and the presentation can be downloaded from the website of that meeting at

However, users are warned that some of the examples presented there will not work with the latest version of -parmest-, which requires the user to specify one of the three options -saving-, -norestore- and -fast-, which specify whether the output data set is to be saved to disk, written to memory (overwriting any existing data), or both. These particular examples will work if the user specifies the -norestore- option.

I hope this helps.


Roger Newson
Lecturer in Medical Statistics
Department of Public Health Sciences
King's College London
5th Floor, Capital House
42 Weston Street
London SE1 3QD
United Kingdom

Tel: 020 7848 6648 International +44 20 7848 6648
Fax: 020 7848 6620 International +44 20 7848 6620
or 020 7848 6605 International +44 20 7848 6605

Opinions expressed are those of the author, not the institution.

* For searches and help try:

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