<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Considerando a funcao que calcula a estatistica, e' mais apropriado
usar stype='w' na funcao boot()<br>
<br>
O CI fica menos amplo que o obtido por GLM:<br>
<br>
<br>
plot(boo <- boot(a,SMR2,999,stype='w'))<br>
boot.ci(boo)<br>
<br>
m <- glm(Hosp_Death ~ offset(log(SAPS3Pro2)), poisson, data=a)<br>
(coef.stats <- coef(summary(m)))<br>
<br>
hist(boo$t)<br>
abline(v=exp(coef.stats[1,1] +
qnorm(c(0.025,0.5,0.975))*coef.stats[1,2]), col=2)<br>
abline(v=quantile(boo$t, c(0.025,0.975)), col=4)<br>
<br>
Elias<br>
<br>
<div class="moz-cite-prefix">On 23/09/15 15:40, Pedro Emmanuel
Alvarenga Americano do Brasil wrote:<br>
</div>
<blockquote
cite="mid:CAFfGvyKYHXsR1Y6=+SXSO2nnMAppf+t-tpF+xh7Lz0pbAx5tzg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_default"
style="color:rgb(0,0,102);font-family:courier new,monospace">
Amigos de R,</div>
<div class="gmail_default"
style="color:rgb(0,0,102);font-family:courier new,monospace"><br>
</div>
<div class="gmail_default"
style="color:rgb(0,0,102);font-family:courier new,monospace">Desculpa
pela demora, so consegui voltar nessa análise hoje. Bom tentei
fazer o script recomendado pelo Elias. O pedaço do plot do
bootstrap funciona, mas o pedaço para gerar o intervalo de
confiança retorna um erro. </div>
<div class="gmail_default"
style="color:rgb(0,0,102);font-family:courier new,monospace"><br>
</div>
<div class="gmail_default"
style="color:rgb(0,0,102);font-family:courier new,monospace">
<pre tabindex="0" id="rstudio_console_output" style="margin:0px;border:currentColor;color:rgb(0,0,0);text-transform:none;line-height:9.72px;text-indent:0px;letter-spacing:normal;font-family:"Courier New";font-size:9pt!important;font-style:normal;font-variant:normal;font-weight:normal;word-spacing:0px;white-space:pre-wrap!important;background-color:rgb(255,255,255)"><span style="color:blue;white-space:pre">> </span><span style="color:blue">library(boot)
</span><span style="color:blue;white-space:pre">> </span><span style="color:blue">SMR2 <- function(a,w=1){length(a$Hosp_Death[which(a$Hosp_Death==1)])*w/(length(a$SAPS3Pro2) * mean(a$SAPS3Pro2))*w}
</span><span style="color:blue;white-space:pre">> </span><span style="color:blue">SMR2(a)
</span>[1] 1.000319
<span style="color:blue;white-space:pre">> </span><span style="color:blue">plot(boo <- boot(a,SMR2,999,stype='i'))
</span><span style="color:blue;white-space:pre">> </span><span style="color:blue"><a moz-do-not-send="true" href="http://boot.ci">boot.ci</a>(boo)
</span><span style="color:rgb(197,6,11)">Error in <a moz-do-not-send="true" href="http://bca.ci">bca.ci</a>(boot.out, conf, index[1L], L = L, t = t.o, t0 = t0.o, :
estimated adjustment 'w' is infinite</span></pre>
</div>
<div class="gmail_default"
style="color:rgb(0,0,102);font-family:courier new,monospace"><br>
</div>
<div class="gmail_default"
style="color:rgb(0,0,102);font-family:courier new,monospace">Achei
muito estranho a função plot do bot funcionar e o <a
moz-do-not-send="true" href="http://boot.ci">boot.ci</a> não
funcionar. Possivelmente ha necessidade de resolver alguma
configuração para esse pedação do script. <br>
</div>
</div>
<div class="gmail_extra"><br clear="all">
<div>
<div class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div dir="ltr"><font
style="background-color:rgb(255,255,255)"
color="#000066" face="'courier new', monospace">Pedro
Brasil</font></div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">2015-09-23 0:19 GMT-03:00 ASANTOS <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:alexandresantosbr@yahoo.com.br"
target="_blank">alexandresantosbr@yahoo.com.br</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Mauro,
segue o script,
<div>
<div class="h5"><br>
<br>
dput(a[sample(1:nrow(a),100),c("Hosp_Death","SAPS3Pro2")])<br>
structure(list(Hosp_Death = c(0L, 1L, 0L, 1L, 0L, 0L,
0L, 1L,<br>
0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L,<br>
1L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 1L,<br>
0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L,
0L, 0L,<br>
1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L,
0L, 0L,<br>
1L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, 0L, 0L,
0L, 0L,<br>
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L),
SAPS3Pro2 = c(0.1205,<br>
0.3768, 0.315, 0.3768, 0.0311, 0.0719, 0.1735, 0.75,
0.01, 0.1454,<br>
0.1093, 0.0511, 0.0891, 0.3353, 0.0073, 0.0401, 0.0044,
0.0239,<br>
0.5246, 0.1591, 0.0453, 0.0511, 0.8715, 0.1735, 0.6037,
0.4405,<br>
0.2047, 0.0208, 0.1591, 0.2047, 0.1205, 0.2759, 0.0273,
0.0044,<br>
0.2759, 0.0157, 0.0643, 0.2215, 0.2047, 0.1735, 0.1591,
0.0273,<br>
0.0062, 0.0311, 0.0157, 0.4192, 0.0643, 0.1735, 0.239,
0.4618,<br>
0.0401, 0.0802, 0.0273, 0.0239, 0.0025, 0.0157, 0.0311,
0.0157,<br>
0.0719, 0.239, 0.0574, 0.0157, 0.0085, 0.0085, 0.1093,
0.2215,<br>
0.1591, 0.0719, 0.0044, 0.8563, 0.0453, 0.2047, 0.1454,
0.0273,<br>
0.0891, 0.0802, 0.0239, 0.0135, 0.0802, 0.2571, 0.1735,
0.0157,<br>
0.3768, 0.2759, 0.0891, 0.2047, 0.1735, 0.1454, 0.0643,
0.0311,<br>
0.0453, 0.2759, 0.0239, 0.0181, 0.4405, 0.0085, 0.0311,
0.1205,<br>
0.6579, 0.1093)), .Names = c("Hosp_Death", "SAPS3Pro2"),
row.names = c(21875L,<br>
6572L, 48643L, 11869L, 35683L, 48246L, 23919L, 29666L,
3676L,<br>
45549L, 36453L, 14510L, 5082L, 1898L, 41549L, 25481L,
28590L,<br>
38198L, 12822L, 12834L, 33267L, 34088L, 47720L, 30063L,
18326L,<br>
11582L, 11454L, 34960L, 18785L, 11385L, 20605L, 28105L,
25496L,<br>
1607L, 48766L, 36534L, 41868L, 45312L, 37206L, 26927L,
38944L,<br>
21087L, 22343L, 1332L, 11496L, 29485L, 38316L, 4486L,
19757L,<br>
45768L, 33028L, 12205L, 13150L, 41270L, 2780L, 44400L,
19696L,<br>
26015L, 14651L, 39093L, 24905L, 17870L, 35016L, 42851L,
20464L,<br>
33155L, 24924L, 33220L, 15379L, 28989L, 33286L, 34782L,
48534L,<br>
9045L, 20403L, 40222L, 8821L, 31240L, 12465L, 11024L,
24407L,<br>
45729L, 7412L, 22344L, 17737L, 3514L, 2335L, 22491L,
22493L,<br>
14077L, 20346L, 12114L, 36868L, 16431L, 25112L, 31272L,
10877L,<br>
14391L, 8422L, 45130L), class = "data.frame")<br>
<br>
<br>
SMR <- function(obs.var,pred.var){<br>
</div>
</div>
if(length(obs.var) != length(pred.var)){<span><br>
stop("Length of pred.var and obs.var differ.")<br>
}<br>
</span>
if(any(min(pred.var) <0 | max(pred.var) > 1)){<span><br>
stop("The individual predicted death must range from
0 to 1.")<br>
}<br>
</span>
if(any(levels(as.factor(obs.var)) != c(0,1))){<span><br>
stop("Observed death variable must be coded as 0 and
1.")<br>
}<br>
</span><span>
O <- length(obs.var[which(obs.var==1)])<br>
</span><span>
E <- length(pred.var) * mean(pred.var)<br>
</span><span>
SMR <- O / E<br>
</span><span>
lowerCL <- O / E * (1 - 1 / (9 * O) - 1.96 / (3 *
sqrt(O)))^3 * 100<br>
</span><span>
upperCL <- (O + 1) / E * (1 - (1 / (9 * (O + 1))) +
1.96 / (3 * sqrt(O + 1)))^3 * 100<br>
</span>
output <- c(SMR=SMR,lower.Cl=lowerCL,upper.Cl=upperCL)<br>
output<span class="im HOEnZb"><br>
}<br>
<br>
<br>
SMR2 <-
function(a,w=1){length(a$Hosp_Death[which(a$Hosp_Death==1)])*w/(length(a$SAPS3Pro2)
* mean(a$SAPS3Pro2))*w}<br>
<br>
<br>
</span><span class="im HOEnZb"><a moz-do-not-send="true"
href="http://boot.ci" target="_blank" rel="noreferrer">boot.ci</a>(boot(a,
SMR2, R = 10, stype = "w",parallel = "multicore"))<br>
<br>
x <- <a moz-do-not-send="true" href="http://boot.ci"
target="_blank" rel="noreferrer">boot.ci</a>(boot(a,
SMR2, R = 10, stype = "w",parallel = "snow"))<br>
</span><span class="im HOEnZb">
SMR2 <- function(a,w=1)<br>
sum(w*a$Hosp_Death)/sum(w*a$SAPS3Pro2)<br>
<br>
SMR2(a) ### SMR observada nos dados<br>
<br>
require(boot)<br>
<br>
plot(boo <- boot(a,SMR2,999,stype='i'))<br>
<a moz-do-not-send="true" href="http://boot.ci"
target="_blank" rel="noreferrer">boot.ci</a>(boo)<br>
<br>
</span>
<div class="HOEnZb">
<div class="h5">
Em 22/09/2015 23:14, Mauro Sznelwar escreveu:<br>
<blockquote class="gmail_quote" style="margin:0px 0px
0px
0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid">Alguém
poderia passar o código anterior, pois eu apaguei o
que chegou antes.<br>
<br>
<br>
<br>
vc pode fazer assim:<br>
<br>
SMR2 <- function(a,w=1)<br>
sum(w*a$Hosp_Death)/sum(w*a$SAPS3Pro2)<br>
<br>
SMR2(a) ### SMR observada nos dados<br>
<br>
require(boot)<br>
<br>
plot(boo <- boot(a,SMR2,999,stype='i'))<br>
<a moz-do-not-send="true" href="http://boot.ci"
target="_blank" rel="noreferrer">boot.ci</a>(boo)<br>
<br>
.<br>
<br>
<br>
---<br>
Este email foi escaneado pelo Avast antivírus.<br>
<a moz-do-not-send="true"
href="https://www.avast.com/antivirus"
target="_blank" rel="noreferrer">https://www.avast.com/antivirus</a><br>
<br>
_______________________________________________<br>
R-br mailing list<br>
<a moz-do-not-send="true"
href="mailto:R-br@listas.c3sl.ufpr.br"
target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
<a moz-do-not-send="true"
href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br"
target="_blank" rel="noreferrer">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a moz-do-not-send="true"
href="http://www.leg.ufpr.br/r-br-guia"
target="_blank" rel="noreferrer">http://www.leg.ufpr.br/r-br-guia</a>)
e fornea cdigo mnimo reproduzvel.<br>
</blockquote>
<br>
</div>
</div>
<span class="im HOEnZb">
-- <br>
======================================================================<br>
Alexandre dos Santos<br>
Proteção Florestal<br>
IFMT - Instituto Federal de Educação, Ciência e Tecnologia
de Mato Grosso<br>
Campus Cáceres<br>
Caixa Postal 244<br>
Avenida dos Ramires, s/n<br>
Bairro: Distrito Industrial<br>
Cáceres - MT CEP: 78.200-000<br>
Fone: <a moz-do-not-send="true"
href="tel:%28%2B55%29%2065%208132-8112" target="_blank"
value="+556581328112">(+55) 65 8132-8112</a> (TIM) <a
moz-do-not-send="true"
href="tel:%28%2B55%29%2065%209686-6970" target="_blank"
value="+556596866970">(+55) 65 9686-6970</a> (VIVO)<br>
<a moz-do-not-send="true"
href="mailto:e-mails%3Aalexandresantosbr@yahoo.com.br"
target="_blank">e-mails:alexandresantosbr@yahoo.com.br</a><br>
<a moz-do-not-send="true"
href="mailto:alexandre.santos@cas.ifmt.edu.br"
target="_blank">alexandre.santos@cas.ifmt.edu.br</a><br>
Lattes: <a moz-do-not-send="true"
href="http://lattes.cnpq.br/1360403201088680"
target="_blank" rel="noreferrer">http://lattes.cnpq.br/1360403201088680</a><br>
======================================================================<br>
<br>
</span>
<div class="HOEnZb">
<div class="h5">
_______________________________________________<br>
R-br mailing list<br>
<a moz-do-not-send="true"
href="mailto:R-br@listas.c3sl.ufpr.br" target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
<a moz-do-not-send="true"
href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br"
target="_blank" rel="noreferrer">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a moz-do-not-send="true"
href="http://www.leg.ufpr.br/r-br-guia"
target="_blank" rel="noreferrer">http://www.leg.ufpr.br/r-br-guia</a>)
e fornea cdigo mnimo reproduzvel.</div>
</div>
</blockquote>
</div>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
R-br mailing list
<a class="moz-txt-link-abbreviated" href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a>
<a class="moz-txt-link-freetext" href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a>
Leia o guia de postagem (<a class="moz-txt-link-freetext" href="http://www.leg.ufpr.br/r-br-guia">http://www.leg.ufpr.br/r-br-guia</a>) e forne�a c�digo m�nimo reproduz�vel.</pre>
</blockquote>
<br>
</body>
</html>