[R] Iterative loop using "repeat"
mary
mary.dama at libero.it
Sat Jan 5 12:32:39 CET 2013
Thanks for the help:your reply has focused my problem
in particular I'm trying to do a converge process;
the robustm() function is:
function (x,z)
1# {eigen<-eigen(x)
2# d<-madmatrix(z)
##I have created this function to calculate "mad" of a whole matrix
3# eigenc<-eigen$vectors
4# q<-d%*%eigenc
5# invQ<-matrix.inverse(q)
6# sZ<-mdefpos(z,invQ) ##this function
serves me to define positive my new matrix Z, it's X%*%invQ
7# madZ<-madmatrix(sZ)
8# S_X<-q%*%(madsZ)^2%*%t(q)
return(S_X)
}
reviewing this function I realized that it can not be applied in an
iterative manner in the next step because every time a new matrix z should
be fed back into the process and then calculate a new scatter matrix; in the
code above :
(x) is a scatter matrix, Z is a matrix (n*p) of original data that I have
used to obtain a scatter matrix...
in line 6# I need this new matrix sZ because it will be my new (z) if I
reiterate the process on the new scatter matrix S_X, in fact my function
robustm() ask me the scatter matrix and the data matrix so...
how I can do this...and the reiterate the process so that the matrix
converges??
--
View this message in context: http://r.789695.n4.nabble.com/Iterative-loop-using-repeat-tp4654625p4654725.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list