I needed to create my own forecast from the square root, linear and quadratic 
coefficients and then the abline() plot worked fine. 
 
# Forecast l using non-linear regression coeffs - unweighted
lm2.bforecast<- numeric(n)
for (i in 1:n)
{
lm2.bforecast[i] <- 
lm2.b$coeff["(Intercept)"]+lm2.b$coeff["VV1_2"]*VV1_2[i]+lm2.b$coeff["VV1_22"]*VV1_22[i]+lm2.b$coeff["VV1_212"]*VV1_212[i]
}
lm2.bforecastline<-lm(lm2.bforecast ~ VV1_2, method = "qr", model = TRUE, x = 
FALSE, y = FALSE, qr = TRUE) # unweighted, non-linear regression forecast

plot(VV1_2, Lambda1_2,  ylim=yrange, tck=1, main="Verizon V(1) Parameters (V, 
V^2 & V^0.5) Unweighted", xlab="VV1_2", ylab="Lambda1_2 & 
Beta1_2",pch=19,col="red") 
{points(VV1_2, lm2.lforecast, pch=19, col="brown")
abline(lm2.lforecastline, col="brown", lty="longdash", lwd=2)
 ...
 

> Date: Sun, 25 Mar 2012 15:36:20 -0700
> Subject: Re: [R] Accessing more than two coefficients in a plot
> From: gunter.ber...@gene.com
> To: chicagobrownb...@hotmail.com
> CC: r-help@r-project.org
> 
> Well, as a line in the plane is determined by 2 coefficients only, I'd
> guess that trying to find an R function that plots a line defined by 4
> coefficients has about the same chance of success as finding a unicorn
> with 3 horns.
> 
> You do understand that your linear model defines a hyperplane in your
> three covariates, do you not? Or do I misunderstand what you have
> requested?
> 
> Cheers,
> Bert
> 
> On Sun, Mar 25, 2012 at 2:32 PM, FJ M <chicagobrownb...@hotmail.com> wrote:
> >
> > I've successfully plotted (in the plot and abline code below) a simple 
> > regression of Lambda1_2 on VV1_2. I then successfully regressed Lambda1_2 
> > on VV1_2, VV1_22 and VV1_212 producing lm2.l. When I go to plot lm2.l using 
> > abline I get the warning:
> >
> > "1: In abline(lm2.l, col = "brown", lty = "dotted", lwd = 2) : only using 
> > the first two of 4 regression coefficients"
> >
> > Is there another function like abline that will produce a line using the 
> > constant and three coefficients from the lm2.l regression?
> >
> >
> > lm.l <- lm(Lambda1_2 ~ VV1_2, method = "qr", model = TRUE, x = FALSE, y = 
> > FALSE, qr = TRUE) # unweighted regression
> >
> > lm2.l <- lm(Lambda1_2 ~ VV1_2 + VV1_22 + VV1_212, method = "qr", model = 
> > TRUE, x = FALSE, y = FALSE, qr = TRUE) # unweighted regression
> >
> > plot(VV1_2, Lambda1_2, ylim=yrange, tck=1, main="V(1) Parameters (V, V^2 & 
> > V^0.5)", xlab="VV1_2", ylab="Lambda & Beta1_2",pch=19,col="red")
> > {abline(lm2.l, col="brown", lty="dotted", lwd=2)
> > abline(wlm2.l, col="gold",lty="longdash", lwd=2)
> > points(VV1_2, Beta1_2, pch=19, col="blue")
> > abline(lm2.b, col="black",lty="dotted", lwd=2)
> > abline(wlm2.b, col="blue", lty="longdash", lwd=2)
> > legend("topright", inset=.05, title="Parameters",
> > labels, lwd=2, lty=c(1, 1, 1, 1, 2), col=colors)
> > }
> > ______________________________________________
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> 
> 
> 
> -- 
> 
> Bert Gunter
> Genentech Nonclinical Biostatistics
> 
> Internal Contact Info:
> Phone: 467-7374
> Website:
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm
                                          
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to