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 CIs for lpolyci

From   Amy Hsin <>
Subject   st: Plotting CIs for lpolyci
Date   Sat, 6 Oct 2012 11:41:19 -0400

Dear Stata Gurus,

I have trying to plot predictions from a linear regession using kernel
weight local polynomial fit (lpolyci) along with their confidence
intervals. I am having problems graphing the confidence interval.  The
confidence interval are either so small they are not visible or they
are not there at all. I am not sure why this it.  I can manually plot
the CIs from a linear fit model without problems. The linear fit is
near identical to the kernel weighted fit so shouldn't the CIs from
lpolyci be similar to the Cis from lpoly?

For example, I run the following regression:
regress zach asian wave asianxwave data [pw=weight], cluster(newid)
predict zach_asian if asian==1, xb
predict zachsd_asian if asian==1, stdp

The following command generates the kernel weight fitted line but no
confidence intervals are produced.
lpolyci zach_asian wave

The following command generates the confidence intervals for the
linear fit which look good:
generate lacha = zach_asian-zachsd_asian*invttail(15113,.975)
generate hacha = zach_asian+zachsd_asian*invttail(15113,.975)

twoway rarea hachw lachw wave, sort bcolor(gs14)  astyle(background)
	|| lpoly zach_asian wave, clcolor(red) clstyle(foreground)      ///
	|| lfit zach_asian wave, clcolor(red) clstyle(foreground)

The lfit and lpoly give near identical lines so why isn't lpolyci
producing CIs that are in line with the ones that I produce manually.
I understand that estimates for lpoly come from bootstrapping methods
and so SE and CIs are computed using alternative methods but shouldn't
they be approximately the same?

Thank you.


Amy Hsin
Assistant Professor of Sociology
Queens College, City University of New York
*   For searches and help try:

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