I don't have any math background, and I'm trying to type this equation into R, and having difficulties understanding the summation notation.
I dont understand the 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
# 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]) ) )
}
sum(v1)
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.