r - Having trouble getting coefplot() to plot two regressions on top of each other -
i trying use coefplot(), described in article: http://www.r-bloggers.com/visualization-of-regression-coefficients-in-r/
however, when run exact code, 1 regression plotted, rather 3. here screenshot showing exact code have run, plus output plot. http://i.imgur.com/ytdnd.png
i not sure else do. appreciated.
the code coefplot not accept argument offset anymore. it's not in documentation , not in formals list. can make version modifying code coefplot:
type coefplot2 return . copy-paste function command line , precede with
coefplot2 <- # rest of pasted function should follow
then add voffset=0
formals list , change line:
arrows(ci1, (1:k), ci2, (1:k), lty = lty[1], lwd = lwd[1], col = col,
to this
arrows(ci1, (1:k)+voffset, ci2, (1:k)+voffset, lty = lty[1], lwd = lwd[1], col = col,
and change points line to:
points(cf , (1:k)+voffset, pch = pch, col = col)
then hit enter , should have new coefplot2 function. should work
coefplot2(m2, xlim=c(-2, 6) ) par(new=true) # not add=true argument work either. coefplot2(m3, col="blue", xlim=c(-2, 6), voffset=0.4) par(new=true) coefplot2(m1, col="red", xlim=c(-2, 6) , voffset=0.2)
Comments
Post a Comment