Tem o dataset deste exemplo?
Emerson, segue um exemplo sem erro:
> a1=glm(ce~fx+pp+di+sx+tb+hf,family="poisson"(link="log"))
> summary(a1,cor=F)
Call:
glm(formula = ce ~ fx + pp + di + sx + tb + hf, family = poisson(link = "log"))
Deviance Residuals:
Min 1Q Median 3Q Max
-1,406 -0,864 -0,703 0,593 1,576
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1,399 0,196 -7,14 0,00000000000094 ***
fx 0,455 0,211 2,16 0,031 *
pp 0,518 0,263 1,97 0,049 *
di 0,414 0,207 2,00 0,046 *
sx 0,287 0,202 1,42 0,156
tb -1,177 1,009 -1,17 0,243
hf -0,338 0,421 -0,80 0,423
---
Signif. codes: 0 ‘***’ 0,001 ‘**’ 0,01 ‘*’ 0,05 ‘.’ 0,1 ‘ ’ 1
(Dispersion parameter for poisson family taken to be 1)
Null deviance: 183,26 on 250 degrees of freedom
Residual deviance: 160,98 on 244 degrees of freedom #### Aqui Residual deviance não é maior do que os graus de liberdade (sugere não haver overdispersion)
(16 observations deleted due to missingness)
AIC: 383
Number of Fisher Scoring iterations: 5
#Razões de prevalências
> exp(a1$coefficients)
(Intercept) fx pp di sx tb hf
0,24673 1,57594 1,67850 1,51360 1,33183 0,30818 0,71343
> exp(confint(a1)) # 95% CI for exponentiated coefficients
Waiting for profiling to be done...
2,5 % 97,5 %
(Intercept) 0,165063 0,35644
fx 1,035317 2,36868
pp 0,975754 2,74838
di 1,015014 2,29550
sx 0,890559 1,97234
tb 0,017425 1,39886
hf 0,278106 1,49427
# Verificando fator de inflação das variancia
> vif(a1)
fx pp di sx tb hf
1,0911 1,0722 1,0131 1,0238 1,0084 1,0040
> sqrt(vif(a1))
fx pp di sx tb hf
1,0446 1,0355 1,0065 1,0118 1,0042 1,0020
> sqrt(vif(a1)) > 2
fx pp di sx tb hf
FALSE FALSE FALSE FALSE FALSE FALSE
# Análise de residuos studentizados
> #residuos
> library(MASS)
> sresid
> mean(sresid)
[1] 0,00022105
> var(sresid)
[1] 1,0093
>
#variável dependente
> tab(ce)
freq.abs freq.rel
0 149 58,9
1 104 41,1
Total: 253
Mauricio Cardeal
UFBA
Em 19/04/2016 22:00, Emerson Cotta Bodevan escreveu:
Prezados...
Executei o comando sugerido pelo Mauricio
mod1<-glm(PoliFar~ClassEco+Educ,family="poisson"(link="log"),data=dmha2) e estou encontrando a seguinte mensagem de erro
Error in if (any(y < 0)) stop("negative values not allowed for the 'Poisson' family") : valor ausente onde TRUE/FALSE necessário
Além disso: Warning message:
In Ops.factor(y, 0) : ‘<’ not meaningful for factors
Meus dados estão no seguinte formato: (
data frame dmha2):
ClassEco Educ PoliFar
A 0-2 S
D-E 3-5 N
B 12+ S
A 6-8 S
C 9-11 N
D-E 0-2 S
... ... ...
Vocês sabem o que está errado?
Att.,
_______________________________________________
R-br mailing list
R-br@listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forne�a c�digo m�nimo reproduz�vel.