[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
Kirsten P Smith <[email protected]> |

To |
[email protected] |

Subject |
Re: st: Changing beta coefficients - w/ logistic regression |

Date |
Fri, 22 Jul 2005 12:49:10 -0400 (EDT) |

Vince, Thank you for the detailed explanation and suggestions, as well as the warning. As Richard and Scott guessed, I was interested in doing a thought experiment to see how changing the values of coefficients would change predicted values. Wouldn't have paid attention to CIs or standard errors for the reasons you list, but it's good to have those reasons enumerated. Cheers, Kirsten On Fri, 22 Jul 2005, Vince Wiggins, StataCorp wrote: Kirsten Smith <[email protected]> wants to modify one of the coefficients after a -logit- estimation and then pretend that the estimates are still from -logit-, retaining access to all of the postestimation facilities after -logit-. She offers the following program to perform the deed, but notes that the statement -ereturn repost- fails. ---------------------------------- BEGIN --- foo.ado --- CUT HERE ------- program foo, eclass tempname bmat matrix `bmat' = e(b) matrix `bmat'[1,1] = 122 ereturn repost b = `bmat' end ---------------------------------- END --- foo.ado --- CUT HERE ------- Let me answer in pieces. An admonishment --------------- Don't do this! The coefficients produced by an estimator are one of the primary things that defines the estimator. All of the postestimation facilities, such as -predict- and -lroc- after -logit-, assume that the coefficients were estimated correctly using a method appropriate for the estimator. Rarely can you change the coefficient of an estimator and retain any meaning from the postestimation results. When modifying the saved results from an estimator while letting the estimates continue to masquerade as though they were from the original estimator, it is easy to create nonsense results and to fool anyone using the estimated results. As a simple example, if you change the coefficients without changing the covariance matrix, how do you interpret the standard errors, tests, and confidence intervals in the estimation results table. This is dangerous territory. We are so sincere in this warning that we require you to write a program when you want to use any of the -ereturn- subcommands that post or modify estimation results. In fact, we require that you declare that you know what you are doing in creating an estimator and assume the risks involved by adding an -eclass- option to the -program- statement. Having said that, I have done this a few times myself and I am sure that Kirsten is only showing us an example of what she wants and has throughly considered the ramifications of changing the coefficients while still pretending to be a -logit- estimation. Technicalities -------------- As discussed by Scott Merryman <[email protected]> and Richard Williams <[email protected]>, -ereturn repost- seems to work after most estimators, but not after others, including -mlogit- and -logit-, to which I would add -stcox- and a few others. These estimators require internal structures to track additional estimation information and do not use -ereturn post- to save their results. As noted in the help for -ereturn repost-, "-ereturn repost- changes the b or V matrix (allowed only after estimation commands that posted their results using -ereturn post-)." If you want to -repost- one of these estimators, you must effectively create a new estimator by picking up and posting all of the saved results that you want, as suggested by Scott Merryman <[email protected]>. You may even need to write an appropriate -predict- command because you will no longer have access to the internal structures created by the command. Some tricks ----------- So, what is Kristen to do with -logit-? She does not, for example, have access to the internal structures that allow rules to work in -predict-. If she does not need predictions, she can proceed as Scott Merryman <[email protected]> has suggested, and simply post those things from -logit- she needs, effectively creating a new estimator. If predictions and most other postestimation facilities are what is important, then she can take advantage of the fact that we already had to address these issues for -logit- and -mlogit- when we created survey estimators for the commands. If Kirsten will survey set her data as a simple random sample, . svyset _n She can use the survey estimator for the logit model, . svy: logit ... Afterward, -foo- will work, because the survey logit estimator does use -ereturn post- to save its estimation results. Note, that -svy: logit- uses the sandwich/linearization estimate of variance. If Kirsten needs both predictions and the same variance estimator as -logit- then she can bounce back and forth between the solutions, or she will need to continue along the lines suggested by Scott and post everything for a complete logit estimator. She will need to pay particular attention to the predictor posted in e(predict) which I believe should be the one from -svy: logit- , "svy_logit_p", though I admit that I have not thoroughly considered that. I would probably bounce back and forth. Note, that it makes me a bit queasy discussing how to make something that is clearly not the estimator for a command pretend that it is the estimator. For these tricks, caveat emptor. -- Vince [email protected] * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/ * * For searches and help try: * http://www.stata.com/support/faqs/res/findit.html * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**Re: st: Changing beta coefficients - w/ logistic regression***From:*[email protected] (Vince Wiggins, StataCorp)

- Prev by Date:
**st: Number format** - Next by Date:
**Re: st: Using Cluster stop with Clustermat** - Previous by thread:
**st: Number format** - Next by thread:
**st: RE: Interaction terms in logistic regression using dummy variables** - Index(es):

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