I don't have any math background, and I'm trying to type this equation into R, and having difficulties understanding the summation notation.

enter image description here

I dont understand the enter image description here part, because it seems to refer to values which do not exist.

If the vector R for example has 3 elements: c( element_1 = 1, element_2 = 2, element_3 = 3 ), then it seems to me that the summation from j = 1 to to i-1 (for i=1 ) refers to indices from 1 to (1-1), that is, from 1 to 0. But the index zero does not exist in the vektor R.

So what is the the sigma referring to?

Please help me understand type this into R!

Here is what I typed into R sofar, it's everything but the enter image description here

# Input data:
M <-   c(140L, 12L, 12L, 59L, 94L, 101L, 117L, 213L, 368L, 607L, 1025L, 
1488L, 2255L, 2787L, 3257L, 3715L, 4231L, 6281L) 

R <-  c(42L, 22L, 28L, 54L, 77L, 108L, 169L, 227L, 293L, 531L, 863L, 
1464L, 2591L, 3334L, 3045L, 2605L, 1890L, 1261L) 

D <-  c(2L, 1L, 2L, 6L, 4L, 7L, 15L, 26L, 67L, 120L, 304L, 497L, 883L, 
1158L, 1321L, 1318L, 1177L, 1065L) 

N <- c(167323L, 168088L, 176017L, 180986L, 168189L, 155506L, 174274L, 
195538L, 207287L, 204711L, 183802L, 174342L, 183415L, 151277L, 
104199L, 71782L, 47503L, 33946L) 

# W width of age interval
w <-  c( 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,Inf )  

# function 
v1 <- numeric()           

for(i in 1:length(R))  {

v1[i] <- R[i] /  ( R[i] + M[i] - D[i] )  *  ( 1 - exp( - (w[i]/N[i]) *  (R[i] + M[i] - D[i]) ) )



closed as off-topic by Alex M., Math1000, colormegone, Frits Veerman, egreg Apr 15 '16 at 22:54

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – Alex M., Math1000
If this question can be reworded to fit the rules in the help center, please edit the question.

  • $\begingroup$ I think this is really a question about the R programming language. I think that in R vectors are indexed starting with 0, so the first element is at position 0, not position 1. See if this helps. $\endgroup$ – Ethan Bolker Apr 15 '16 at 13:40
  • $\begingroup$ Thanks. This a programming question, but, I think, also a math question, as G Cab's math-answer below helped me understand the programming question :) $\endgroup$ – Rasmus Larsen Apr 17 '16 at 10:57

Note that the Summation symbol comes under two (most common) different acceptions , depending on the context:
1) $ \quad \sum\limits_{j = 1}^{i - 1} {a_{\,j} } = \sum\limits_{1\, \le \,j\, \le \,i - 1} {a_{\,j} } \quad \Rightarrow \quad 0\quad \left| {\;i \le 1} \right. $
2) (antiderivative)$ \quad a_{\,j} = b_{\,j + 1} - b_{\,j} \quad \Rightarrow \quad \sum\limits_{j = 1}^{i - 1} {a_{\,j} } = \sum\nolimits_{j = 1}^{\,i} {a_{\,j} } = b_{\,i} - b_{\,1} = - \sum\nolimits_{j = i}^{\,1} {a_{\,j} } $

For $i=1$ both acceptions give $0$ as a result.

  • $\begingroup$ Thank you for this. Do you have a source for this? Preferably publicly available. $\endgroup$ – Rasmus Larsen Apr 17 '16 at 10:54
  • $\begingroup$ @RasmusLarsen as far as it concerns basic definition and manipulation of indices, I myself found that the explanation provided in "Concrete Mathematics" is insuperable (as it is for many other topics). On the web I did not encounter a comparably clear exposition. $\endgroup$ – G Cab Apr 17 '16 at 11:33

Not the answer you're looking for? Browse other questions tagged or ask your own question.