get_predict()
VahidTehrani opened this issue · comments
VahidTehrani commented
It looks something is not right in the get_predict()
function.
data(mid)
z.out1 <- zelig(conflict ~ major + contig + power + maxdem + mindem + years,
data = mid, model = "relogit", tau = 1042/303772)
prob <- z.out1$get_predict()
max(sapply(prob, max))
min(sapply(prob, min))
and return 0.9610796 as max and -10.59513 as min. Does it make sense? It supposed to be probability!! The link fucntion is 'logit'.
Christopher Gandrud commented
Thanks for reporting @VahidTehrani. I'll take a look.
Christopher Gandrud commented
I think it's because currently the type
argument to predict
is not set as response
. Not great use-ability for this case, so I'll work on a better solution.
In the mean time:
library(zeligverse)
data(mid)
z.out1 <- zelig(conflict ~ major + contig + power + maxdem + mindem + years,
data = mid, model = "relogit", tau = 1042/303772)
# Extract fitted model object and predict response probabilities
fitted_model <- from_zelig_model(z.out1)
prob <- predict(fitted_model, type = "response")
max(sapply(prob, max))
min(sapply(prob, min))
Christopher Gandrud commented
From 971809e predict
accepts arguments (like type = "response"
)
VahidTehrani commented
Thanks! @christophergandrud