tópicos en análisis de datos y bioestadística. samples and populations: inference and probability...

59
Tópicos en Análisis de Datos y Bioestadística

Upload: margarita-villalobos-carrasco

Post on 24-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Tópicos en Análisis de Datos y Bioestadística

Page 2: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

SAMPLES AND POPULATIONS:INFERENCE AND PROBABILITY

Population

P1

P2

P15

P3

PN

Sample

S1

S2

Sn

InferenceProbability

2

Page 3: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

The probabilistic concept produces a natural classification:

Fixed Numbers (Constants)

Random Variables (unfixed, may change with a certain probability distribution)

Page 4: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

A random variable has a PROBABILITY DISTRIBUTION

The probability distribution can be seen as a ‘frequency plot’ or as an ‘histogram’

Page 5: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Just to remind:

To MEASURE is nothing else than to ‘assign’ a NUMBER to a certain characteristic of a physical observable, and for that we need to use a MEASUREMENT INSTRUMENT

Page 6: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

A Clarification…

A RANDOM VARIABLE has a probability distribution, BUT its realization (the value obtained once it’s measured) is then a CONSTANT (fixed value)

Page 7: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

What causes randomness?

How do we know if an observable is determined by a random variable or a constant?

Remember that to ‘know’ something is equivalent to measure it several times and make predictions and inferences on it

Page 8: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Classical Physics is deterministic

According to Newton’s laws, we can ‘predict’ how a system is going to behave in the future

Page 9: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Remember that in order to solve for the dynamics of any system, we need to ‘know’ the initial conditions

How can we ‘know’ the initial conditions?

Just ‘measuring them’… and after measuring, we inevitably introduce uncertainty

Page 10: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

What about ‘giving’ the initial conditions instead of measuring them?

Can we then use our computational capacity to ‘predict’ how the system is going to evolve?

Page 11: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

So, if a robot arm can always throw an ace, what happened to the randomness of the process?

What can we conclude about it?

Page 12: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

The randomness is due to the variability on the initial conditions

Many systems are very sensible even to extremely small variations on the initial conditions: This is called Dynamical Instability or CHAOS

Page 16: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Summarizing

The ‘randomness’ of a random variable resides on:

- The variability of the initial conditions- The dynamical instability- The perturbation suffered during a

measurement

Page 17: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Clasificación general:

Categórica Cuantitativa o numérica

Nominal Ordinal Discreta Continua

Page 18: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Ejemplos:

Nominales: Sexo, estado civil, presencia de morbilidad, resultado del tratamiento

Ordinales: Severidad de morbilidad, riesgo quirúrgico, resistencia a antibioticos

Discretas: Cociente intelectual, tiempo de tratamiento u hospitalización

Contínuas: concentración de alcohol en la sangre

Page 19: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Las variables continuas

El carácter continuo de una variable lo da la naturaleza intrínseca del observable físico y es independiente de la manera cómo se mida (i.e. del instrumento utilizado) ó de la manera cómo se reporte la medición

Page 20: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Efecto de la manera ‘cómo se mide’ una variable

Imaginemos que medimos la induración del PPD en varios pacientes, y para ello utilizamos una regla milimetrada. Las dimensiones medidas para diferentes personas fueron:5mm, 12mm, 9mm, 32mm, 21mm

Aparentemente estamos frente a una variable discreta, aunque en realidad la induración (longitud) es y debe tratarse de manera continua.

Page 21: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Efecto de la manera ‘cómo se reporta’ una variable

Imaginemos que medimos la duración de la permanencia en UCI de pacientes en un hospital. Los tiempos medidos para diferentes pacientes fueron:15días, 2días, 9días, 12días, 31días

Aparentemente estamos frente a una variable discreta, aunque en realidad el tiempo es y debe tratarse de manera continua.

Page 22: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

En sus trabajos, que tipo de dato es su

variable respuesta, resultado o desenlace

principal?

Page 23: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Categorización/discretización:

Las variables continuas pueden ser convertida en variables discretas y hasta en categóricas

En este proceso se pierde información (precisión)

La información debe obtenerse al mayor nivel de precisión posible y luego agruparse si fuera necesario (discretización)

Page 24: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

DESCRIBIENDO VARIABLES

DICOTOMICAS

Page 25: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Variables dicotómicas:

Page 26: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Pero, nos interesa realmente la muestra o la población? Esta exploración es parte de un proceso de

inferencia estadística

Queremos extrapolar conclusiones a la población

Nuestro primer objetivo es hacer una estimación a nivel de la población:– Cálculo numérico de un cierto parámetro en la

población

– En forma puntual y con intervalo de variabilidad

Page 27: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Perfil de la distribución

Describe cómo los Datos están Distribuídos Caracterización del perfil de la

distribución: Simétrica o sesgada

Page 28: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Dos bases de datos hipotéticas… Es importante tener una imagen visual de la distribución de la variable

La media provee una buena representación de los valores en la base de datos.

Datos de baja variabilidad

Datos con alta variabilidad

La media ya NO provee ahora una buena información de los datos comosucedía anterioremente

Al incrementar datos la distribución cambia..

Page 29: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Recordemos las características de una variable continua con distribución normal…

Figure 10.10

66

Page 30: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Perfil de la distribución

Describe cómo los Datos están Distribuídos Caracterización del perfil de la distribución: Simétrica o sesgada

SimétricaMedia = Mediana = Moda

Page 31: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

How does the standard deviation affect the shape of f(x)?

= 2

=3 =4

= 10 = 11 = 12How does the expected value affect the location of f(x)?

Page 32: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Fenómenos tipo Bernoulli: Se aplican a variables dicotómicas

Representan la ocurrencia o no ocurrencia de UN evento, por ejemplo: el sexo de CADA UNA de las personas encuestadas

Toman solamente dos posibles valores o estados: hombre (1) o mujer (2)

Solo se aplican a nivel unitario: un dato, persona u observación

Page 33: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Distribución Binomial:

Es un conjunto de variables Bernoulli del mismo tipo, por ejemplo, el sexo de las 4,850 personas encuestadas

La variable en estudio (sexo) tiene también dos valores (hombre/mujer), los cuales ocurren con frecuencias relativas (p) y (1-p) simétricas

El valor p es la frecuencia relativa o proporción de hombres entre las personas encuestadas

Page 34: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

0.2

.4.6

Fra

ctio

n

0 .25 .5 .75 1(mean) dichotomous

0.2

.4.6

Fra

ctio

n

0 .25 .5 .75 1(mean) dichotomous

0.2

.4.6

Fra

ctio

n

0 .25 .5 .75 1(mean) dichotomous

0.2

.4.6

Fra

ctio

n

0 .25 .5 .75 1(mean) dichotomous

0.2

.4.6

Fra

ctio

n

0 .25 .5 .75 1(mean) dichotomous

0.2

.4.6

Fra

ctio

n

0 .25 .5 .75 1(mean) dichotomous

n=2

n=5

n=30

n=3

n=15

n=60

Page 35: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

El Teorema del Límite Central da validez a los intervalos de confianza

La media de una muestra “grande” de datos de cualquier tipo sigue una distribución normal

Esto aún se cumple para datos binomiales (sexo, prevalencia, sensibilidad, etc)

Qué es una muestra grande? Eso varía según cada tipo de dato (entre otras cosas)

A medida que el tamaño de muestra crece, la distribución de la media muestral se hace más normal

Page 36: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

AN ILLUSTRATION OF THECENTRAL LIMIT THEOREM

36

Page 37: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

ATENCION !

STATA puede identificar un tipo de variable de manera erronea !

Debemos apoyarnos en la ciencia, en nuestro conocimiento previo de la variable con que estamos trabajando.

Page 38: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2
Page 39: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Continuous Models on the Line

Normal Logistic Cauchy Laplace Student Non-central Student

Page 40: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Normal Distribution

Mean= 0 SD = 0.5, 1, 2

Page 41: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Logistic distribution

Mean=0 SD=0.5, 1

Page 42: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Student distribution

Degrees of freedom= 1,10,100

Page 43: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Laplace distribution

Mean=0

SD=0.5, 1, 5

Page 44: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Continuous Models on the Half Line Exponential Gama Chi-square Non central Chi-square F Non central F Weibull

Page 45: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Exponential distribution

Scale parameter = 0.5, 1, 2

Page 46: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Chi-square distribution

Degrees of freedom = 3, 5, 10,15

Page 47: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

F distribution

Degrees of freedom =

(3,3), (10,10), (30,30)

Page 48: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Continuous Models on a Finite Interval Beta Uniform

Page 49: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Uniform distribution

P = 1/3

Page 50: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Beta distribution

Parameters:

(2,15), (5,15), (15,5)

Page 51: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Discrete Models

Binomial Poisson Negative Binomal Uniform

Page 52: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Binomial distribution

N=10 P= 0.2, 0.5, 0.8

Page 53: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Poisson distribution

Intensity parameter =

1, 3, 7

Page 54: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Bioestadística Aplicada

Negative Binomial

P N

0.5 10

0.4 3

0.4 6

Page 55: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Distribuciones sesgadas

Page 56: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Perfil de la distribución (skewness coefficient)

Describe cómo los Datos están Distribuídos Caracterización del perfil de la

distribución: Simétrica o sesgada

Page 57: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Perfil de la distribución Describe cómo los Datos están Distribuídos Caracterización del perfil de la distribución: Simétrica o sesgada

Sesgada izquierda SimétricaMean = Median = ModeMean Median Mode

Page 58: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Perfil de la distribución

Describe cómo los Datos están Distribuídos Caracterización del perfil de la distribución: Simétrica o sesgada

Sesgada derechaSesgada izquierda SimétricaMedia = Mediana = ModaMedia Mediana Moda Mediana MediaModa

Page 59: Tópicos en Análisis de Datos y Bioestadística. SAMPLES AND POPULATIONS: INFERENCE AND PROBABILITY Population P1P1 P2P2 P 15 P3P3 PNPN Sample S1S1 S2S2

Análisis de OUTLIERS:

Datos sesgados:

Valores que se exceden de 3 rangos intercuartiles por debajo del primer cuartil Q1 o por encima del tercer cuartil (Q3) (percentiles 25 y 75 respectivamente)

Sesgada izquierda Sesgada Positiva

Q1 – 3(Q3 – Q1)Q1 Q3 Q1 Q3 Q3 + 3(Q3 – Q1)

outlier region outlier

region