[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Gillian.Frost@hsl.gov.uk |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: AW: Adjust after regression involving categorical variables |

Date |
Thu, 29 Oct 2009 09:34:48 +0000 |

Thank you all for your helpful comments. I think that -margins- may be a new command in Stata 11 and so I do not have access to it (I'm still using Stata 10). The effects coding may be a way forward for me, I'll have to look into that a bit more. Just to clarify my original question - what is the correct adjust command to get back to the original coefficients in the regression? The first -adjust- leaves the categorical rep78 'as is', but the resulting predictions by foreign do not agree with the coefficients estimated from the regression. However, the second -adjust- holds the categorical rep78 at its values in the dataset, which Martin points out are the proportions that emerge for -proportion rep78-, and the resulting predictions this time correspond to the estimated regression coefficients. So the second -adjust- command seems to be the 'correct' way to treat the categorical rep78. Is this correct? If so, I am struggling to understand what this means for variables that only take values of zero and one. I know that it sets them to their proportions, but how does this make sense when you have a categorical variable such as sex, where you are either male or female? In this instance what would setting sex to a specific value, say 0.25, mean? Also, if you are setting the categorical variable according to their proportions, what happens to the reference category? This does not have a coefficient and so cannot be set to a specified value? I hope that all this is understandable, I am just not fully grasping why the second -adjust- command seems to work, and exactly what it is predicting. Thank you all for your input so far. Gillian "Martin Weiss" <martin.weiss1@gmx.de> Sent by: owner-statalist@hsphsun2.harvard.edu 28/10/2009 12:18 Please respond to statalist@hsphsun2.harvard.edu To <statalist@hsphsun2.harvard.edu> cc Subject st: AW: Adjust after regression involving categorical variables <> Maybe this FAQ will assist you: http://www.stata.com/support/faqs/stat/adjust.html I am not sure what the question really is. You are conducting two different prediction exercises, and they lead to different outcomes, just as you would expect: In the first one, Stata holds -rep78- at its values in the dataset, in the second one it assigns the mean to them. Note that these means are the proportions that emerge for - proportion rep78 -... HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Gillian.Frost@hsl.gov.uk Gesendet: Mittwoch, 28. Oktober 2009 12:44 An: statalist@hsphsun2.harvard.edu Betreff: st: Adjust after regression involving categorical variables Dear all, I am struggling to understand the -adjust- command after regression involving categorical variables. My aim in using -adjust- is to obtain the predicted values adjusted for the categorical variable, but I am not explicitly interested in the categorical variable and so do not want it appearing in the -by()- option of -adjust-. I have been unable to find any examples of this kind of use of -adjust-. I have reproduced my query using the auto dataset below. I am using Stata 10.1 SE. sysuse auto, clear descr ** just for this example, assume that rep78 is categorical xi: regress price weight turn i.rep i.foreign ** output price Coef. Std. Err. t P>t [95% Conf. Interval] weight 4.243125 .6699849 6.33 0.000 2.903407 5.582842 turn -208.6987 125.9326 -1.66 0.103 -460.5164 43.11914 _Irep78_2 822.0914 1691.818 0.49 0.629 -2560.907 4205.09 _Irep78_3 710.281 1560.7 0.46 0.651 -2410.531 3831.093 _Irep78_4 341.2531 1631.858 0.21 0.835 -2921.848 3604.355 _Irep78_5 876.4049 1740.224 0.50 0.616 -2603.387 4356.197 _Iforeign_1 3239.838 859.1453 3.77 0.000 1521.871 4957.805 _cons -32.54137 4097.528 -0.01 0.994 -8226.054 8160.972 ** want the predicted values by foreign - not specifically interested in rep78 but wanted to adjust for it, but I am unsure as to how to treat rep78 ** option 1 - set continuous values to mean but leave rep78 as is adjust weight turn, by(foreign) ** output ---------------------- Car type | xb ----------+----------- Domestic | 5164.18 Foreign | 8390.29 ---------------------- ** However, you see that 8390.29-5164.18=3226.11, and not 3239.838 as predicted by the model above ** option 2 - treat dummies created by -xi- as continuous, and also set them to their mean adjust weight turn _Irep78_2 _Irep78_3 _Irep78_4 _Irep78_5, by(foreign) ** output ---------------------- Car type | xb ----------+----------- Domestic | 5160.01 Foreign | 8399.84 ---------------------- You see that the final -adjust- command gives 8399.84-5160.01=3239.83, as given by the regression model above. So it appears that the second treatment of the categorical gives the 'correct' predictions. However, I am struggling to interpret exactly what this means for rep78, and does it make sense to set variables that are 0/1 to their mean? I would be extremely grateful for any assistance with this. Many thanks, Gillian ------------------------------------------------------------------------ ATTENTION: This message contains privileged and confidential information intended for the addressee(s) only. If this message was sent to you in error, you must not disseminate, copy or take any action in reliance on it and we request that you notify the sender immediately by return email. Opinions expressed in this message and any attachments are not necessarily those held by the Health and Safety Laboratory or any person connected with the organisation, save those by whom the opinions were expressed. Please note that any messages sent or received by the Health and Safety Laboratory email system may be monitored and stored in an information retrieval system. ------------------------------------------------------------------------ Think before you print - do you really need to print this email? ------------------------------------------------------------------------ ------------------------------------------------------------------------ Scanned by MailMarshal - Marshal's comprehensive email content security solution. Download a free evaluation of MailMarshal at www.marshal.com ------------------------------------------------------------------------ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/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/statalist/faq * http://www.ats.ucla.edu/stat/stata/ ------------------------------------------------------------------------ ATTENTION: This message contains privileged and confidential information intended for the addressee(s) only. If this message was sent to you in error, you must not disseminate, copy or take any action in reliance on it and we request that you notify the sender immediately by return email. Opinions expressed in this message and any attachments are not necessarily those held by the Health and Safety Laboratory or any person connected with the organisation, save those by whom the opinions were expressed. Please note that any messages sent or received by the Health and Safety Laboratory email system may be monitored and stored in an information retrieval system. ------------------------------------------------------------------------ Think before you print - do you really need to print this email? ------------------------------------------------------------------------ ------------------------------------------------------------------------ Scanned by MailMarshal - Marshal's comprehensive email content security solution. Download a free evaluation of MailMarshal at www.marshal.com ------------------------------------------------------------------------ * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**st: AW: Adjust after regression involving categorical variables***From:*"Martin Weiss" <martin.weiss1@gmx.de>

- Prev by Date:
**st: Qn about Command prvalue** - Next by Date:
**Re: st: AW: Importing text file into Stata** - Previous by thread:
**st: AW: Adjust after regression involving categorical variables** - Next by thread:
**Re: st: Adjust after regression involving categorical variables** - Index(es):

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