Returns the slope and intercept for x predicting y
Usage
lin.coef(x, y, out = "both", nomiss = 0.8)
Arguments
x
A numeric vector of the same length as y
y
A numeric vector of the same length as x
out
A character vector specifying whether the result should return just the intercept ("int"), just the slope ("slope") or both ("both") which defaults to "both"
nomiss
A numeric between .00 and 1.00 specifying the proportion of x-y pairs required to be complete before NA is returned instead of the regression coefficients. The default of .80 means that if more than 20 percent of the x-y pairs are incomplete an NA will be returned.
Details
This function is largely designed to increase computation efficiency for getting regression coefficients. For instance, this function is called by the Profile.reg function (see Profile.reg).
Value
b0
intercept of the regression line from y predicted from x
b1
slope of the regression line frome y predicted from x
Author(s)
Ryne A. Sherman
See Also
Profile.reg
Examples
data(RSPdata)
# Lets predict self reported extraversion from gender
lin.coef(RSPdata$ssex,RSPdata$sEXT)
# confirm that these numbers match the results from lm()
lm(sEXT ~ ssex, data = RSPdata)