Escolar Documentos
Profissional Documentos
Cultura Documentos
ASSOCIAÇÃO
com diabetes foi tratado com uma droga e o outro grupo recebeu placebo (Áragon e
Enanoria 1 , 2009). O desfecho foi óbito (sim e não). A tabela que representa esses resul-
Mortes Sobreviventes
Medicamento 30 174
Placebo 21 184
Esses dados foram organizados nessa tabela de contigência a partir de uma base de
= “,”)
> ud
Status Treatment Agegrp
...
= sim, Placebo = não). E, a terceira coluna é a faixa etária. Neste exemplo, vamos
trabalhar com tabela de contingência simples, ou seja, sem estratificação por idade.
tratamento com Tobultamide para todas as idades. Para tanto, faz-se necessário saber
brutos:
• > table(ud$Status)
Death Survivor
51 358
Para obter a tabela de contingência, entretanto, deve-se conhecer a distribuição de
• > table(ud$Status[ud$Treatment=="Placebo"])
Death Survivor
21 184
• > table(ud$Status[ud$Treatment=="Tolbutamide"])
Death Survivor
30 174
2
Para montar a tabela de contingência, faz-se necessário conhecer o objeto do R
numéricas com a função matrix(). Por exemplo, uma tabela de contigência 2x2 pode
vetor com os valores das caselas e, posteriormente, monta-se uma matriz 2x2 com esse
vetor, sendo que o preenchimento ocorre pela linha utilizando o argumento byrow =
TRUE.
• Montar as caselas
>tabconti
[,1] [,2]
interesse (Tabela 1). Primeiro, criamos o vetor e a matriz. Segundo, nomeamos as linhas
e colunas.
• Criar a matriz
>tab.ud
[,1] [,2]
[1,] 30 174
[2,] 21 184
3
• Nomear a matriz
>tab.ud
Mortes Sobreviventes
Medicamento 30 174
Placebo 21 184
na Tabela 2.
4
Na Tabela 2, todos os exemplos são razões. Então, o que é uma razão? Uma razão
r1
r1 : r2 =
r2
Um tipo de razão é a proporção, que pode ser utilizada como uma medida de ocorrên-
cia (Tabela 2). Proporção pode ser utilizada para estimar o risco em que o numerador
x
R=
n
onde x é um subconjunto de n.
Como exemplo de medida de associação (Tabela 2), chance (odds) é uma razão de
P R x/n x
Chance = = = =
1−P 1−R 1 − x/n n−x
• >tab.ud
Mortes Sobreviventes
Medicamento 30 174
Placebo 21 184
• Qual é o risco de morte para os dois grupos?
5
• Risco de morte aos que tomaram o medicamento:
> 30/(30+174)
[1] 0.1470588
> 21/(21+184)
[1] 0.1024390
>(30/(30+174)) / (1 - (30/(30+174)))
[1] 0.1724138
[1] 0.1141304
[1] 1.435574
[1] 1.510673
6
Tabela 4: Medidas de associação com morte em ud.
risco (> 1)? Para responder a essa pergunta, podemos calcular o teste exato de Fisher
• > fisher.test(tab.ud)
data: tab.ud
p-value = 0.1813
0.8013768 2.8872863
sample estimates:
odds ratio
1.509142
• > chisq.test(tab.ud)
data: tab.ud
7
No output do teste exato de Fisher é indicado o intervalo de confiança de 95%
(0.8013768 - 2.8872863) o qual mostra que a razão de chances pode ser igual 1. Além
disso, os dois testes apontaram para o mesmo resultado, ou seja, aceita-se a hipótese
programação flexível no qual podemos criar nossas próprias funções. Por exemplo, fun-
ções para calcular as estimativas pontuais das medidas de associação e seus respectivos
intervalos de confiança.
O exemplo a ser trabalhado para entender funções se refere aquele ensaio clínico
aleatório em que um grupo de pacientes com diabetes foi tratado com uma droga e o
outro grupo recebeu placebo (Áragon e Enanoria 1 , 2009). O desfecho foi óbito (sim e
Mortes Sobreviventes
Medicamento 30 174
Placebo 21 184
8
A estimativa do risco relativo (RR) é feita calculando a proporção de pessoas sob
x1
risco que adquiriram a doença N1 dividida pela proporção de pessoas que não estão sob
x0 x1
risco e adquiriram a doença N0 . A proporção N1 é conhecida por risco nos expostos
x0
(R1 ) e a proporção N0 é o risco nos não-expostos (R0 ).
R1 x1 /N1
RR = =
R0 x0 /N0
seguinte fórmula:
O erro padrão EP (RR) é uma medida de desvio padrão das estimativas de risco
s
1 1 1 1
EP [log(RR)] = − + −
x1 N1 x0 N0
na amostra. A raiz quadrada transforma o erro padrão para a escala loge do RR, que é
9
Para um intervalo de confiança de 95%, P (−Z ≤ z ≤ +Z) = 0.95, tem-se que
função qnorm():
[1] 1.644854
[1] 1.959964
Após essa breve revisão teórica, podemos criar uma função no R para calcular o
intervalo de confiança. Vamos criar a função de nome rr que possui dois argumentos,
função poderá ser aplicada para qualquer tabela de contingência 2x2 e, também, para
10
Os argumentos possuem nome, por exemplo, x que é o nome genérico para o objeto
deve ser explicitada a partir desse ponto. Para tanto, devem-se declarar as variáveis,
explicitada na linguagem R.
11
Os resultados, ou seja, o output da função, podem ser mostrados por meio da função
return() que deve retornar uma lista de objetos, utilizando a função list(). Esse objetos
podem ser, por exemplo, a tabela de contingência, os riscos, o risco relativo, o intervalo
• >rr(tab.ud, 0.95)
$x
Mortes Sobreviventes
Medicamento 30 21
0.1470588 0.1024390
$risco.relativo
[1] 1.435574
$int.conf
$nivel.conf
[1] 0.95
mento não está associada ao desfecho, ou seja, ao óbito (RR = 1.44; IC95% = 0.85,
2.42).
12
1.4 Exercícios da Aula 4
13
Figura 1:TheRisco de SARS journal
new england col. 3 , (2003).
em Olsenof emedicine
10
11
12
13
14
15
16
17
18
19
20
21
22
1
2
3
4
5
6
7
8
9
DE F
ABC
No illness (person interviewed) Index patient
No illness (person not interviewed) Crew member
Probable case of SARS Empty seat
Figure 2. Schematic Diagram of the Boeing 737-300 Aircraft on Flight 2 from Hong Kong to Beijing.
Two flight attendants and two Chinese officials also reportedly had illness that met the WHO criteria for a probable case
of SARS. The flight attendants are shown here as members of the crew. The seat locations of the two Chinese officials are
unknown, and they are not included in the diagram.
2 flight;
Emborathreeseja
werepossível
confirmedfazer
to be seropositive,
os cálculosand semthe flight through
precisar our interviews
elaborar with theimagine
uma função, ill passen-
one of the three was also positive on RT-PCR. gers. One ill person, who was part of a tour that trav-
uma situação-problema em que seja necessário aplicar o mesmo procedimento várias
Interviews of passengers were conducted a me- eled together, had an onset of illness eight days after
vezes,
dian por
of 11exemplo,
days (range,calcular o risco
6 to 11) after e o intervalo
the flight. de an
Of the flight, confiança emmight
interval that diversas bases
have been de
attribut-
dados. Nesse caso, é necessário elaborar uma função para otimizar esse procedimento.
the 166 persons interviewed (67 percent), 1 report- able to secondary spread from another member of
Portanto, vamos
ed fever and primeiramente
respiratory symptoms butelaborar uma
never had a função para calcular o risco e o intervalo
the tour group.
de chest
confiança e posteriormente
radiograph obtained and wasaplicá-la comasos dados
not reported de SARS.that
The observation Ostheresultados
passengersdevem
who becameser
having a probable case of SARS (Table 1).
coincidentes com aqueles previamente calculados. He has infected were clustered in the few rows directly in
since fully recovered without hospitalization. Rou- front of or behind the ill passenger, rather than be-
tine surveillance did not result in the detection of any ing randomly distributed throughout the aircraft, is
additional cases among the remaining 33 percent of consistent with the pattern described in other cases
the passengers and crew members. in which a respiratory pathogen was transmitted on
board an aircraft13 and lends further plausibility to
di s cu ssi o n the theory that transmission occurred during the
flight. The risk to passengers was greatest if they
We believe that the most plausible explanation for were seated in the same row as the index patient or
the development of SARS in the passengers and crew within three rows in front of him. The greater con-
members on Flight 2 is that they were infected while centration of persons who became infected in front
on board the aircraft, although other explanations of the index patient than behind him may point to
are possible. As might be expected of a flight carry- the role of coughing in transmission, causing a com-
ing patients with SARS, Flight 2 was traveling from bination of aerosol and small-droplet spread.
a SARS-affected area (Hong Kong) to a destination Large-droplet spread is often believed to occur
that would later be identified as a SARS-affected area within 36 in. of a patient,14 and this cutoff has been
(Beijing). Therefore, it is possible that the passen- used to define exposure to SARS in other investiga-
gers in whom SARS developed were infected before tions.15 However, the distance covered by three
or after the flight. However, the clustering of the economy-class rows on a Boeing 737-300 is 2.3 m
dates of onset of illness around four days after the (90 in.). On this aircraft, 90 percent of the persons
flight is in keeping with the expected incubation pe- who became ill were seated more than 36 in. away
14
riod for SARS11,12 and points to the day of the flight from the index patient, so airborne, small-particle,
as a likely time of transmission. Furthermore, we or other remote transmission may be more straight-
identified no alternative exposures before or after forward explanations for the observed distribution
[1] Aragón TJ, Enanoria WT. Applied Epidemiology Using R [livro na in-
ternet]. Berkeley; 2009 [acesso em outubro 2010]. Disponível em:
http://www.medepi.com/docs/epir.pdf.
[2] Agresti A. Categorical data analysis. New York: Wiley; 1990.
[3] Olsen SJ, Chang HL, Cheung TYY, Tang AF, Fisk TL, e col. Transmission of the
Severe Acute Respiratory Syndrome on Aircraft. New England Journal of Medicine.
2003;349:2416-2422.
15