Learn R Programming

rioplot (version 1.1.1)

project.point: Project point 1 onto the line (at 90 degress) running through point 2 and the origin (0,0).

Description

Given two points, p1 and p2, this function identifies the point at which p1 is projected onto the line connecting p2 and the origin (0,0). The projection occurs at a right angle.

Usage

project.point(p1,p2)

Value

Two values which correspond to the x and y co-ordinates in the graph.

Arguments

p1

First point, the one that is to be projected onto point 2.

p2

Second point, the one that is projected to the origin. This is the outcome or dependent variable in our book. See reference below.

Author

David Melamed, Ronald L. Breiger, and Eric Schoon

Details

The output is just a single point. This is implemented as the point to which lines are drawn in many graphs.

References

Schoon, Eric, David Melamed, and Ronald L. Breiger. 2024. Regression Inside Out. NY: Cambridge University Press.

Examples

Run this code
data(Kenworthy99)
m1 <- lm(scale(dv) ~ scale(gdp) + scale(pov) + scale(tran) -1,data=Kenworthy99)
rp1 <- rio.plot(m1,include.int="no",r1=1:15)
project.point(as.numeric(rp1$col.dimensions[1,]),as.numeric(rp1$row.dimensions[1,]))

Run the code above in your browser using DataLab