Displaying 2 results from an estimated 2 matches for "estima2".
Did you mean:
estimar
2012 May 10
1
Error t value matrix
Hi all,
I want to make the following:
I want to run a linear regression on each column of a matrix "estima" on
the correspondent column on the matrix "estima2".
You see I want to regress estima[,1] on estima2[,1] this way to all
columns....
At the same time I want to make a regression adding each time a new
observation.
You see, the first regression will regress only one observation with one
observation (I now this has no sense in this only one o...
2012 May 05
2
No error message no display output
...doesn´t appear.
Should I install some special library to run sapply?
pru<-function(){
randz<-matrix(rnorm(200000),100,2000)
H<-matrix(0,100,2000)
for (j in 2:2000){
for (i in 2:100){
H[1,]<-randz[1,]
H[i,j]<-H[i-1,j]+randz[i,j]
}}
hy<-nrow(H)-1
estima<-H[2:nrow(H),]
estima2<-H[1:hy,]
a<-estima
b<-estima2
mycoef <- function(x, y) coefficients( lm(y ~ x-1) )
rest <- sapply(2:2000, function(i){
y <- a[,i]
x <- b[,i]
mycoef(x,y)
}
)
print(summary(rest))
hist(rest,col="...