Why don’t my user-written estimation commands work in Stata 11 or Stata 12?
| Title |
|
User-written estimation commands in Stata 11 or Stata 12 |
| Author |
Theresa Boswell, StataCorp
|
| Date |
August 2009; minor revisions July 2011
|
As of Stata 11, variables are no longer dropped because of
collinearity. Instead, these variables are omitted and are labeled with the
“o.” operator in the column names of the resulting parameter
vector. Also, factor variables are now allowed in most official Stata
commands and older, user-written commands do not support the new features.
These two additions will affect user-written commands and may cause the
commands to return an error message. Until the author of the command updates
the command to allow factor variables and handle the new collinearity
behavior, a work-around is required.
Common error messages that may be displayed when a command does not allow
factor variables or understand the new omitted operator include the following:
factor variables not allowed
r(101);
interactions not allowed
r(101);
varname#0b: operator invalid
r(198);
factor variables and time-series operators not allowed
r(101);
i.varname invalid name
r(198);
o.rep78 invalid name
r(198);
_i.varname invalid name
r(198);
_o.varname invalid name
r(198);
If you receive an error message similar to the above, the user-written
command has not been altered to work with the features introduced in Stata 11.
Below are the solutions to working around this issue:
Collinearity
If your model contains collinear terms that are omitted and your
user-written command is complaining about the “o.” notation,
then the solution is to run the estimation command under version control.
For example, instead of typing
regress y x1 x2 x3 x4 x5
type
version 10.1: regress y x1 x2 x3 x4 x5
This will run the estimation command as it ran in Stata 10.1. If you are
able to remove the collinear terms manually from your model, then you can
reduce your independent variables so that none are omitted and run the
estimation command without version control.
Factor Variables
The new factor-variable features are NOT supported under version control.
This is because they are features introduced in Stata 11 and do not work in
previous versions. Thus the above solution for collinearity will not work
for factor variables. You will need to use the
xi prefix if the
user-written command does not allow factor variables. For example, instead
of typing
regress y i.factor
type
xi: regress y i.factor
Factor variables and collinearity
If your estimation model contains both factor variables and collinearity,
you will need to use the xi prefix along with version control for the
user-written command to work. For example, instead of typing
regress y x1 x2 x3 x4 i.factor
type
version 10.1: xi: regress y x1 x2 x3 x4 i.factor
For authors who want help on allowing these new features in their commands,
see the following FAQ:
How do I modify an ado-file created for previous versions of Stata to
support factor variables and the collinearity behavior introduced in Stata
11?
(http://www.stata.com/support/faqs/programming/factor-variable-support/)
|