Displaying 2 results from an estimated 2 matches for "estimating_the_regression_line".
2009 Jul 08
0
typo in ts detrending implementation in spec.pgram?
...sumt2 <- N * (N^2 - 1)/12
for (i in 1L:ncol(x))
x[, i] <- x[, i] - mean(x[, i]) - sum((x[, i]-mean(x[,i]) * t) * t/sumt2
}
Note x[, i]-mean(x[,i]) instead of x[,i] only as in repository. Here is a quick reference http://en.wikipedia.org/wiki/Simple_linear_regression#Estimating_the_regression_line . Note $\hat b$ there. It has not x in summation, but x-mean(x).
Perhaps, the even better solution would be resid(lm(x[,i] ~ seq(along = x[,i]))) . See http://tolstoy.newcastle.edu.au/R/help/05/01/10115.html
Mikhail
2009 Jul 09
2
How to Populate List
... sumt2 <- N * (N^2 - 1)/12
for (i in 1L:ncol(x))
x[, i] <- x[, i] - mean(x[, i]) - sum((x[, i]-mean(x[,i]) * t) * t/sumt2
}
Note x[, i]-mean(x[,i]) instead of x[,i] only as in repository. Here is a quick reference http://en.wikipedia.org/wiki/Simple_linear_regression#Estimating_the_regression_line . Note $\hat b$ there. It has not x in summation, but x-mean(x).
Perhaps, the even better solution would be resid(lm(x[,i] ~ seq(along = x[,i]))) . See http://tolstoy.newcastle.edu.au/R/help/05/01/10115.html
Mikhail
------------------------------
Message: 77
Date: Wed, 8 Jul 2009 14:06:28 -04...