search for: truetheta

Displaying 1 result from an estimated 1 matches for "truetheta".

2005 Jun 06
1
A performance anomaly
...NA) n <- nrow(X) e <- y - X%*%beta logl <- ((-n/2)*log(2*pi)) - ((n/2)*log(sigma2)) - ((t(e)%*%e)/(2*sigma2)) return(-logl) # since optim() does minimisation by default. } # A variant: Shift to logs for sigma2 so I can do unconstrained maximisation -- ols.lf1.inlogs <- function(truetheta, y, X) { ols.lf1(c(exp(truetheta[1]), truetheta[-1]), y, X) } # We embark on one numerical experiment set.seed(101) X <- cbind(1, runif(20000)) theta.true <- c(2,4,6) # error variance = 2, intercept = 4, slope = 6. y <- X %*% theta.true[-1] + sqrt(theta.true[1]) * rnorm(20000) measurem...