Topic: Utilities

Topic Description:

Basic R utilities used in many packages and functions, such as date and string manipulations, statistical distributions, geometry of lines and distances. The R package date is required for the two data functions.



File: utilities/statistics.r

View File Source Download File No help file available

Function: majoraxisreg.no.int

Function Description: majoraxisreg.no.int

Major axis regression with no intercept. Only a slope is returned. Below is the same for standard regression.

Function Arguments:

ArgumentDefault Value
x
y

Function Source:

majoraxisreg.no.int=function(x,y)
{
inc=(!is.na(x)&!is.na(y))
x=x[inc]
y=y[inc]

a=sum(x*y)
b=sum(x^2)-sum(y^2)
c=(-a)

answer=numeric()
answer[1]=(-b+sqrt(b^2-4*a*c))/(2*a)
answer[2]=(-b-sqrt(b^2-4*a*c))/(2*a)
return(max(answer,na.rm=T))
}