Bookmark and Share

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]

st: Re: regression using generalized linear model


From   "Joseph Coveney" <[email protected]>
To   <[email protected]>
Subject   st: Re: regression using generalized linear model
Date   Wed, 12 Mar 2014 10:17:46 +0900

Aidan Trung Nguyen wrote:

I'm trying to write the STATA equivalent of the followingSAS statement:

proc glm data=datasetclass a b model x = v*y*y    u*u    t    a*b
weight w
output out = outputdataset 


a is a string character
b, x, v, y, u, t are numeric
u contains non integer and negative values

I tried the below command but without success:anova x  v*y*y   u*u  t   a*b 

error message : factor variables may not contain non integervalues Any guidance
is much appreciated. Thanks.

--------------------------------------------------------------------------------

Try:

encode a, generate(A) // You knew this already
anova x c.(v#y#y u#u t) A#b aweight[w]

1. In Stata's estimation commands other than-anova-, the default for a predictor
is a continuous variable, and so if you do not use the i. prefix, then it is
assumed not to represent a classification variable.  In Stata's -anova-, it is
the opposite for reasons of convention in ANOVA:  unless you use the c. prefix,
it is assumed to be a classification (SAS's CLASS) variable.  Stata's
classification (factor) variables cannot have noninteger values, just like the
error message said.

2. The OUTPUT statement in the SAS example doesn't specify any diagnostics or
predictions to save.  Check your SAS log file for error messages.  (I assume
that you omitted all of the semicolons for clarity.)  For corresponding
diagnostics, predictions, residuals etc. after Stata's -anova-, see
http://www.stata.com/help.cgi?anova+postestimation

3. You might want to consider your model a little more.  As written, it has
polynomial terms without any corresponding regressor terms, and an interaction
term without either of the main effects terms.

4. In SAS, GLM is General Linear Model, not Generalized Linear Model.

Joseph Coveney

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index