rami1
June 29, 2022, 11:42am
1
Hi community,
I am using package BGLR and i am encountering the error as mentioned in the subject-
My scripts and error is as below
Please help me out with the error. Thanks in advance
B=matrix(nrow=ncol(X),ncol=ncol(Y))
dim(X)
[1] 164 10458
dim(Y)
[1] 164 1
ncol(X)
[1] 10458
ncol(Y)
[1] 1
ETA=list(list(X=X,model='BayesB'))
for(i in 1:ncol(X)){
fm=BGLR(y=U[,i],ETA=ETA,verbose=F) #use more iterations!
B[,i]=fm$ETA[[1]]$b
}
Error in U[, i] : subscript out of bounds
FJCC
June 29, 2022, 12:57pm
2
You do not show where U is defined so it is hard to say what the problem is. Does U have at least 10458 columns?
rami1
June 29, 2022, 2:44pm
3
Thanks for your response,
The U is from
Singular value decompositions Y=UDV'
SVD=svd(Y)
U=SVD$u
D=diag(SVD$d)
V=SVD$v
Where the dimensions of U is
dim(U)
[1] 164 1
Even if I change the iterations to 1:150 I am having the same error
ETA=list(list(X=X,model='BayesB'))
for(i in 1:ncol(X)){
fm=BGLR(y=U[,i],ETA=ETA,verbose=F) #use more iterations!
B[,i]=fm$ETA[[1]]$b
}
Error in U[, i] : subscript out of bounds
for(i in 1:150){
fm=BGLR(y=U[,i],ETA=ETA,verbose=F) #use more iterations!
B[,i]=fm$ETA[[1]]$b
}
Error in U[, i] : subscript out of bounds
FJCC
June 29, 2022, 3:10pm
4
This result
dim(U)
[1] 164 1
shows that U has one column. When your use the subscript i in U[, i]
, i can only have the value 1.
rami1
June 29, 2022, 3:29pm
5
the U have 164 values attached. for your reference
FJCC
June 29, 2022, 3:59pm
6
I agree that U has 164 values but they are all in one column, You can iterate over them by changing the value of i in U[i, 1]. Notice that the i is placed before the comma.
system
Closed
July 6, 2022, 4:00pm
7
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed. If you have a query related to it or one of the replies, start a new topic and refer back with a link.