View source: R/RectangleRegression.R
RectangleRegression | R Documentation |
Fit a line using least rectangle method.
RectangleRegression(
x1,
x2,
replicate = 1000,
x1new = seq(from = min(x1), to = max(x1), length.out = 100)
)
x1 |
The first series of data |
x2 |
The second series of data |
replicate |
Number of replicates for bootstrap |
x1new |
Values for x1 to generate x2 |
RectangleRegression performs rectangle regression
A list with parameters of rectangle regression
Marc Girondot marc.girondot@gmail.com
x1 <- runif(100, min=10, max=20)
x2 <- runif(100, min=10, max=20)+x1
rectreg <- RectangleRegression(x1, x2)
plot(x=x1, y=x2, bty="n", las=1, xlim=c(10, 20), ylim=c(20, 40))
abline(a=rectreg$par["Intercept"], b=rectreg$par["Slope"], lwd=2)
par(xpd=FALSE)
lines(rectreg$x2new["x1new", ], rectreg$x2new["50%", ])
lines(rectreg$x2new["x1new", ], rectreg$x2new["2.5%", ], lty=2)
lines(rectreg$x2new["x1new", ], rectreg$x2new["97.5%", ], lty=2)
abline(a=rectreg$Intercept[1], b=rectreg$Slope[3], col="red")
abline(a=rectreg$Intercept[3], b=rectreg$Slope[1], col="red")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.