After trying to do som e cross validation i got some models that fitted the data fairly good but predicted them horribly (eg. fitted = [10001.543,10034.324,104023.23..], true value = [10001,543,10034,104023] and predicted = [10.22,9.44,11.323...])
For you who is a bit more experienced than i am, How can it be possible that when predicting the same data a model i based on can be so differ so much? what is the difference when the model predics something vs when it fits?
I am using poisson regression on data for you who wonder
Data1 <- data.frame(var1,var2,var3,var4,var5,var6)
data_file <- Data1[50:200,]
data_file2 <- Data1[1:50,]
model1 <- glm(var1~var2+var3+offset(log(var4)),data=data_file,family="poisson"
So what i was about to do was a K-fold cross validation so i split the data up in two variables.
pred <- predict(model1,data_file2)
pred
data_file2[,1]
model1$fitted.values
the last 3 lines gave the following results:
[10.22,9.44,11.323...]
[10001,543,10034,104023]
[10001.543,10034.324,104023.23..],