Displaying 1 result from an estimated 1 matches for "n_indices".
Did you mean:
nr_indices
2010 Nov 03
1
Orthogonalization with different inner products
...cov(X_i,Z__{i-1})Z__{i-1}/var(Z_{i-1}) I have code to do this but I keep getting a "non-conformable array" error in the line with the covariance. Does anyone have any suggestions? Here is my code:
gov=read.table(file.choose(), sep="\t",header=T)
gov1=gov[3:length(gov[1,])]
n_indices=length(names(gov1))
x=data.matrix(gov1)
v=x
R=matrix(rep(0,length(x[,1])*length(x[1,])),length(x[,1]))
for(j in 1:n_indices){
u=matrix(rep(0,length(v[,1])),length(v[,1]))
for(i in 1:j-1){
u = u+cov(v[,j],v[,i])*v[,i]/var(v[,i]) #(error here)
}
v[,j]=v[,j]-u
}
Thank...