Funciones de densidad
empı́ricas
A.1. Histogramas
Haciendo referencia al Ejemplo 10, en la siguiente serie de gráficos varia-
mos el ancho de clase h, manteniendo fija la frontera izquierda x 0 del primer
intervalo:
> attach(faithful)
> range(waiting)
[1] 43 96
> x0 = 40; M = 100
> h = c(5, 6, 10, 12)
> par(mfcol=c(2,2)) # figura multiple de 2x2 llenada por columnas
> hist(waiting, prob=TRUE, breaks=seq(from=x0, to=M, by=h[1]),
+ main="x0 = 40, h = 5")
> hist(waiting, prob=TRUE, breaks=seq(from=x0, to=M, by=h[2]),
+ main="x0 = 40, h = 6")
> hist(waiting, prob=TRUE, breaks=seq(from=x0, to=M, by=h[3]),
+ main="x0 = 40, h = 10")
> hist(waiting, prob=TRUE, breaks=seq(from=x0, to=M, by=h[4]),
+ main="x0 = 40, h = 12")
97
98 APÉNDICE A. FUNCIONES DE DENSIDAD EMPÍRICAS
> h = 2.5
> hist(waiting, prob=TRUE, breaks=seq(from=x0[1], to=M, by=h),
+ main="x0 = 41, h = 2.5")
> hist(waiting, prob=TRUE, breaks=seq(from=x0[2], to=M, by=h),
+ main="x0 = 41.5, h = 2.5")
> hist(waiting, prob=TRUE, breaks=seq(from=x0[3], to=M, by=h),
+ main="x0 = 42, h = 2.5")
> hist(waiting, prob=TRUE, breaks=seq(from=x0[4], to=M, by=h),
+ main="x0 = 42.5, h = 2.5")
A.1. HISTOGRAMAS 99
con �
1 si u ∈ B
IB (u) =
0 de otra forma
la función indicadora del conjunto B. En la ecuación (A.1) la suma sobre i da
la frecuencia de cada clase, mientras que la suma sobre j crea los “escalones”
que conforman el histograma. El parámetro h controla el ancho de las clase
(valores “grandes” de h producen histogramas planos pero con poca estruc-
tura, mientras que valores “pequeños” producen mayor estructura, pero con
picos que pueden ser intrascendentes.