This is probably very simple, but I am having trouble getting R to loop through negative numbers. I have tried using seq(-10,10,1), I have tried using seq(from=-10, to=10, by=1) What I get is either b values of 1-10 or 1-21. I need it to be from -10 to 10. What am I missing in here? Any help is very appreciated.
Here is my current attempt at the code:
pr1 <- NULL
i <- 1
t = seq(from = -10, to = 10, by = 1)
for (b in seq(t)) {
LLF <- sum(1*log((1/(1+exp(-(b)))))+(1-1)*log(1-(1/(1+exp(-(b))))))
like[b] <- LLF
pr[b] <- b
}
pr
df <-data.frame(like, pr)```