The duplicating a variable approach may be fine if you only want the coefficients. But I am guessing it will cause you grief if you also want the marginal effects.
-
Login or Register
- Log in with
webuse nhanes2f, clear logit diabetes i.race weight i.race#c.weight, coefl nolog constraint 1 _b[3.race#c.weight] = 0 logit diabetes i.race weight i.race#c.weight, constraints(1) nolog
. webuse nhanes2f, clear . logit diabetes i.race weight i.race#c.weight, coefl nolog Logistic regression Number of obs = 10,335 LR chi2(5) = 65.47 Prob > chi2 = 0.0000 Log likelihood = -1966.3317 Pseudo R2 = 0.0164 ------------------------------------------------------------------------------- diabetes | Coef. Legend --------------+---------------------------------------------------------------- race | Black | .0257155 _b[2.race] Other | .3318753 _b[3.race] | weight | .0169948 _b[weight] | race#c.weight | Black | .0064931 _b[2.race#c.weight] Other | -.0026229 _b[3.race#c.weight] | _cons | -4.313413 _b[_cons] ------------------------------------------------------------------------------- . constraint 1 _b[3.race#c.weight] = 0 . logit diabetes i.race weight i.race#c.weight, constraints(1) nolog Logistic regression Number of obs = 10,335 Wald chi2(4) = 73.49 Log likelihood = -1966.3384 Prob > chi2 = 0.0000 ( 1) [diabetes]3.race#c.weight = 0 ------------------------------------------------------------------------------- diabetes | Coef. Std. Err. z P>|z| [95% Conf. Interval] --------------+---------------------------------------------------------------- race | Black | .0219021 .5441304 0.04 0.968 -1.044574 1.088378 Other | .157999 .3465437 0.46 0.648 -.5212141 .8372122 | weight | .0169442 .0030932 5.48 0.000 .0108816 .0230068 | race#c.weight | Black | .0065437 .0066256 0.99 0.323 -.0064423 .0195297 Other | 0 (omitted) | _cons | -4.3096 .2389319 -18.04 0.000 -4.777898 -3.841302 ------------------------------------------------------------------------------- .
sysuse auto regress price mpg i.rep78
regress price mpg i(1 3 5).rep78
regress price mpg 1.rep78 3.rep78 5.rep78
regress price mpg i(1 3 5)o(2 4).rep78
regress price mpg 1.rep78 2o.rep78 3.rep78 4o.rep78 5.rep78
regress price c.mpg##1.rep78 i.rep78
c.mpg##1.rep78
mpg 1.rep78 c.mpg#1.rep78
i.rep78
1.rep78
regress price mpg 1.rep78 c.mpg#1.rep78
regress price 2b.rep78 3.rep78 4.rep78 5.rep78 c.mpg##1.rep78
regress price 1.rep78 /// 2b.rep78 /// 3.rep78 /// 4.rep78 /// 5.rep78 /// c.mpg##1.rep78 /// c.mpg##2b.rep78 /// c.mpg##3.rep78 /// c.mpg##4.rep78 /// c.mpg##5.rep78
regress price mpg /// 1.rep78 /// 2b.rep78 /// 3.rep78 /// 4.rep78 /// 5.rep78 /// c.mpg#1.rep78 /// co.mpg#2o.rep78 /// co.mpg#3o.rep78 /// co.mpg#4o.rep78 /// co.mpg#5o.rep78 /// , allbase
regress price co.mpg##b(2)o(2/5).rep78, allbase
local case 1 levelsof rep78, local(levs) local levs : list levs - case gettoken base : levs regress price co.mpg##i(`case')b(`base')o(`levs').rep78, allbase
regress price i.rep78 c.mpg c.mpg#1.rep78
Comment