Suppose I have the following summation. [summation image]. How do I write a for loop such that I can store the values into a vector for j = 1 all the way through j = m.
I tried the following
theta1 <- 1
theta2 <- 2
z = c()
for(i in 1:j){
z[i] <- sum(exp[(theta1 * j + theta2 * j)
}
However, I get a vector of length j with only the same outputs