I'm not really sure why I'm receiving multiple NA values from this loop despite getting the correct values when I manually multiply the individual list values, and would appreciate any help fixing this code.
q = 5
B_theta = 7.32
B_B = c(1,2,3,4,5,6,7,8,9,10)
Z_t = c(1,2,3,4,5,6,7,8,9,10)
x_t = function (B_theta,B_B,Z_t){ > #function in question
XX_t = c()
for (k in q){
XX_t[k] = B_theta*B_B[k]*Z_t[k]
}
return(XX_t)
}
big_I = x_t(B_theta,B_B,Z_t)
big_I
# returns NA NA NA NA 183