Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

st: plotting marginal effect for xtreg interaction terms

From   lreine ycenna <>
Subject   st: plotting marginal effect for xtreg interaction terms
Date   Wed, 19 Oct 2011 12:54:49 +0100

I seem to have made an error somewhere in my command, but I don't know where.
(1) stata returns an error message after the first line of my command
is entered (xtreg Y A B AxB, fe)- independent variables are collinear
with the panel variable cn r(198);

(2) I'm not sure whether I can plot the marginal effect for xtreg.
Correct me if im wrong.

My equation is -xtreg Y A B AXB, fe -.
I'm interested to know how B will change with respect to an increase in A.

Here's my command:

xtreg Y A B AxB, fe

generate income=((_n-1)/10)

matrix b=e(b)
matrix V=e(V)
scalar b1=b[1,1]
scalar b2=b[1,2]
scalar b3=b[1,3]
scalar varb1=V[1,1]
scalar varb2=V[2,2]
scalar varb3=V[3,3]
scalar covb1b3=V[1,3]
scalar covb2b3=V[2,3]

scalar list b1 b2 b3 varb1 varb2 varb3 covb1b3 covb2b3

gen lab=b1+b3*income
gen conse=sqrt(varb1+varb3*(income^2)+2*covb1b3*income)
gen a=1.96*conse
gen upper=conb+a
gen lower=conb-a
graph twoway  (line lab income, clwidth(medium) clcolor(blue) clcolor(black))

*   For searches and help try:

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