+ > p2<-function(r){
+ gama=0
+ for(i in 1:1000){
+ c=caminho[[4]]
+ for(i in 1:caminho[[3]]+1) {
+ c=c+caminho[[i+3]]*((r[i])^(i-1))
+ d=(abs(c))*exp(-(x^2/2))}
+ gama=gama + ( d/(h(r[i])) )  }
+ return(gama)}
> e3<-p2(r)

OBS: r is a rnorm(1000,0,1)

> caminho
  theta_chapeu f_estrela k a0 a1 a2 a3
1          3.2       1.2        3  2  1  4  5
>


question
i wanted gama to be the sum of all.. but i keep getting gama as a array of
1000 values...
ok r doesn't need u to creat variables and correct themm when needed
but why it corrects gama in this case?
like gama[1] them gama[2]... gama[1000]

tks guys  u are helping me much

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to