I have the following fixed point algorithm (in R)
delta_<-matrix(1,100,1)
f_<-matrix(0,1000,100)
for (iterate in 1:1000){
g0<-1
for (i in 1:1000){
f0<-t(exp(delta_+ g*v_xj[i,1:100])/(1+sum(exp(delta_+g*v_xj[i,1:100]))))
f_[i,1:100]<-f0
}
s_<-t(matrix(1,1,1000)%*%f_/1000)
s_0<-1-sum(s_)
lns_<-log(s_/s_0)
delta_<-delta_+lnsj-lns_
if (abs(lnsj[1]-lns_[1])<=aprox)
break
}
but i want to make them a function in g... i need to obtain many delta for many g ...so i think than the most efficient way is make the algoritm be a function in g.. but when a try
fixed<- function(g){ algoritm.....
result<-list(delta,lns_)
retu(result)
}
the parameters not satifishes the condition
abs(lnsj[1]-lns_[1])<=aprox
in other words, when i a make the function the algorithm doesnt work... someone can help me, or know other way to use the algoritm for many g?
thanks
