[R] help on using sum in writng a function again

2006-04-09 Thread skim033
Hi, thanks for your reply. Here I would like to ask you again more directly. The following is what I had for now. The function to begin with is dnorm(theta+2*pi*j,0,1)*(pnorm(((2*pi*(k+1)-rho* (theta+2*pi*j)). Now, I wanted to sum it over k from -1 to 1. So, I wrote the following.

Re: [R] help on using sum in writng a function again

2006-04-09 Thread Gabor Grothendieck
Sorry, I replied to the wrong email. Here it is again: Try this where g is f summed over j and k for given scalars theta and rho and gv is g vectorized over theta. I have not checked this carefully so be sure you do: f - function(theta = 0, rho = 0, j = 0, k = 0)