
Senhores, estou ajustando uma regressão logistica via glm na hora de validar meu modelo com amostra teste,no comando predict, de acordo com o Help o default para a previsão é o log do odd ratio e o type="response" retornaria as probabilidades, porem me parece que o default está retornando as probabilidades e o response o ajuste linear. segue o trecho do help the type of prediction required. The default is on the scale of the linear predictors; the alternative "response" is on the scale of the response variable. Thus for a default binomial model the default predictions are of log-odds (probabilities on logit scale) and type = "response" gives the predicted probabilities. The "terms" option returns a matrix giving the fitted values of each term in the model formula on the linear predictor scale. Alguem sabe alguma coisa sobre isso? Att. -- Vinicius Brito Rocha. Estatístico e Atuário, Mestre em Pesquisa Operacional www.aplicademic.blogspot.com http://twitter.com/viniciusbritor "Não se preocupe muito com as suas dificuldades em Matemática, posso assegurar-lhe que as minhas são ainda maiores." - Albert Einstein.

se vc nos der um exemplo exato do problema, poderemos tentar.... no meu teste, abaixo, a funcao comporta-se como documentada (padrao: log-odds; type='response' - probabilidade) b set.seed(1) x = runif(1000, -2, 2) link = x*2+3+rnorm(1000) p = 1/(1+exp(-link)) y = sapply(p, function(.x) rbinom(1, 1, .x)) fit = glm(y~x, family=binomial)
coef(fit) (Intercept) x 2.661760 1.821602 predict(fit)[1:10] ## log-odds 1 2 3 4 5 6 7 0.9531603 1.7300025 3.1925992 5.6361285 0.4880927 5.5645897 5.9018454 8 9 10 3.8333982 3.6025375 -0.5312442 predict(fit, type="response")[1:10] ## probabilidade 1 2 3 4 5 6 7 8 0.7217503 0.8494127 0.9605548 0.9964460 0.6196570 0.9961835 0.9972731 0.9788222 9 10 0.9734686 0.3702268 plot(link, predict(fit)) abline(a=0, b=1, col=2)
participantes (2)
-
Benilton Carvalho
-
Vinicius Brito Rocha