Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: st: Bug in margins
From
Joe Canner <[email protected]>
To
"[email protected]" <[email protected]>
Subject
RE: st: Bug in margins
Date
Fri, 30 Aug 2013 17:41:06 +0000
In the PDF documentation, even StataCorp recognizes the ambiguity:
"Concerning 1, when you specify the estimation command, covariates that are logically factor variables must be Stata factor variables."
But unless one heeds the warning in -help margins- to look at the Remarks section of the PDF documentation one may not be aware that the error message is referring to the adding of "i." in the original model.
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Richard Williams
Sent: Friday, August 30, 2013 2:27 PM
To: [email protected]
Subject: Re: st: Bug in margins
At 11:53 AM 8/30/2013, you wrote:
>On Aug 30, 2013, at 10:58 AM, Joe Canner <[email protected]> wrote:
> > The requirement that the original model be specified including
> "i." is also buried deep in the PDF documentation for -margins- (page
> 1063 of r.pdf).
>
>
>Actually, the very first line displayed by -help margins- is
>
> margins [marginlist] ...
>
> where marginlist is a list of factor variables or interactions that
> appear in the current estimation results.
>
>A pedant might argue that this should read "a list of factor variables
>or *their* interactions," but regardless, the information
>*is* accessible.
>
>That said, the fact that so many ask this question does perhaps suggest
>that a more prominent note be added to the documentation and/or that
>the error message in this case be changed to "only factor variables and
>their interactions are allowed," which is the error message you would
>have gotten if you had typed
>
> margins c.lapscopiintent
I like your error messages better. Other possible sources of confusion:
. margins gpa
gpa: factor variables may not contain noninteger values
True, but gpa wasn't a factor variable to begin with, so it would be better to give the "only factor variables" message.
Even ""a list of factor variables or *their* interactions," is potentially confusing because you can't include i.gender#c.income, i.e. the interactions can only be among the factor variables.
And, for good measure, the interactions don't have to be in the estimation command, e.g.
reg y i.x1 i.x2
margins x1#x2
is legitimate. There is no interaction term in the model but if, say,
x1 and x2 both had 2 values, you would get a 4 part classification.
So I am not even sure what "their interactions" means. The margins notation looks like interactions but no interactions are needed in the model.
I am sure it is hard to come up with crystal clear explanations for every error. I think the biggest thing would be to get the "only factor variables" message out there more often. The "covariates"
wording will be very unclear to many people; if you say "factor variables" people have more of a fighting chance of figuring out what the problem is.
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME: (574)289-5227
EMAIL: [email protected]
WWW: http://www.nd.edu/~rwilliam
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/