logFit: Log fit

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/turb.R

Description

Calculates the log fit of a set of points using lm.

Usage

1
logFit(x, y)

Arguments

x

Vector containing x coordinates of the points.

y

Vector containing y coordinates of the points.

Details

This function returns the coefficients that best approximate the set of points according to the equation

y = a1 + a2*log(x)

The function returns the vector c(a1, a2).

Value

Vector with fit coefficients.

Author(s)

Paulo José Saiz Jabardo.

See Also

lm predict.lm

Examples

1
2
3
4
5
6
7
x <- 1:10
y <- 3*log(x) + 1 + rnorm(10, sd=0.2)

fit <- logFit(x, y)
plot(x, y, xlab='x', ylab='y')
lines(x, fit[1] + fit[2]*log(x))
print(fit)#' x <- 1:10

tunelipt/wutils documentation built on Nov. 5, 2019, 11:01 a.m.