Skip to contents

Hastie, Tibshirani and Friedman (2009), The Elements of Statistical Learning, 2nd ed., Springer, Section 2.6.3, book p. 31 (PDF p. 50): L(theta) = sum_i log Pr_theta(y_i) (2.33) with Pr(Y|X, theta) = N(f_theta(X), sigma^2) (2.34), giving L = -(N/2) log(2 pi) - N log sigma - (1/(2 sigma^2)) sum (y_i - f_i)^2 (2.35).

Usage

Gausslik(y, mu, sigma = NULL)

Arguments

y

N-vector of observations.

mu

fitted values f_theta(x_i); a scalar is recycled.

sigma

optional standard deviation.

Value

list: estimate, loglik, rss, sigma, n, aic, method.

Details

When sigma is not supplied it is profiled at its maximum-likelihood value sqrt(RSS/N), which is what makes least squares and maximum likelihood coincide here.

Examples

Gausslik(c(1, 2, 3), c(1.1, 2.1, 2.9), sigma = 1)$loglik
#> [1] -2.771816