[R] Accessing more than two coefficients in a plot
Bert Gunter
gunter.berton at gene.com
Mon Mar 26 00:36:20 CEST 2012
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 <chicagobrownblue at 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 at 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
More information about the R-help
mailing list