Displaying 1 result from an estimated 1 matches for "diagp".
Did you mean:
diag
2001 Nov 12
3
'subscript out of bounds' in matrices
Dear list
Having read through all the archives of the mailing lists, I've had no
luck finding the answer to my problem.
I am running a for(i in 1:n) loop and am creating a matrix, p, for each
of the n observations. This matrix p is a 2x1 matrix. I am then doing
the following:
diagp<-diag(c(p[1,1],p[2,1]))
to create a matrix with the elements of P on the diagonal (i.e. a 4x4
matrix).
This works fine when I have n=60, however when I increase the size of
the data set to n=100, I get the error message:
Error in diag(c(p[1, 1], p[2, 1])) : subscript out of bounds
I put this...