On 5/30/05, Ajay Shah [EMAIL PROTECTED] wrote:
I wrote this:
# Setup problem
x - runif(100)
y - 2 + 3*x + rnorm(100)
X - cbind(1, x)
# True OLS --
lm(y ~ x)
# OLS likelihood function --
ols.lf - function(theta, K, y, X) {
beta - theta[1:K]
sigma - exp(theta[K+1])
e - (y -
I wrote this:
# Setup problem
x - runif(100)
y - 2 + 3*x + rnorm(100)
X - cbind(1, x)
# True OLS --
lm(y ~ x)
# OLS likelihood function --
ols.lf - function(theta, K, y, X) {
beta - theta[1:K]
sigma - exp(theta[K+1])
e - (y - X%*%beta)/sigma
logl - sum(log(dnorm(e)))
return(logl)
}