Skip to content

Instantly share code, notes, and snippets.

View aniversarioperu's full-sized avatar

AniversarioPeru aniversarioperu

View GitHub Profile
@aniversarioperu
aniversarioperu / reanalisis.R
Last active December 26, 2015 03:09
análisis estadistico de Qali Warma
require(stats)
library(ggplot2)
x <- read.csv("tabla31.csv", header=FALSE)
plot(x$V3, x$V2, xlim=c(0,200), ylim=c(0,
70),
ylab="Déficit calórico",
xlab="Presupuesto de Gasto por niño (PIM)",
main="Hay correlación entre gasto y déficit calórico?\nPrimicia: NO hay!")
reg_lineal <- lm(x$V3 ~ x$V2)
abline(lsfit(x$V3, x$V2))
Amazonas,32.86,104
Áncash,32.65,134
Apurímac,50.49,139
Arequipa,38.41,118
Ayacucho,45.88,129
Cajamarca,53.93,120
Cusco,32.08,118
Huancavelica,35.60,125
Huánuco,42.40,125
Ica,20.06,152
@aniversarioperu
aniversarioperu / all_data.csv
Created October 22, 2013 11:57
canciones más toneras, radio inspiración,
maxima lejos de ti
1 El baile del caballo
1 Opam kay kasja
2 donde esta el amor
3 ya no sere tu panuelito
4 ai se eu te pego
5 tu ausencia
6 hoy he vuelto a ver el amor
7 intentalo
8 linda wawita
@aniversarioperu
aniversarioperu / top10.py
Last active December 26, 2015 05:18
plot top 10 más toneras
# -*- coding: utf-8 -*-
import prettyplotlib as ppl
import numpy as np
from prettyplotlib import plt
import csv
from array import array
import collections
""" Top 10 ranking """
@aniversarioperu
aniversarioperu / top20.py
Created October 22, 2013 14:05
top20 mas toneras radio inspiracion
# -*- coding: utf-8 -*-
import prettyplotlib as ppl
import numpy as np
from prettyplotlib import plt
import csv
from array import array
""" Top 20 ranking """
x = []
@aniversarioperu
aniversarioperu / tabla4.csv
Created October 22, 2013 20:55
Tabla 4. Porcentaje de pobres multidimensionales vs. Gasto social por departamento, Perú 2012
Moquegua 24.8 1949
Tumbes 28.4 1839
Ayacucho 56.6 1779
Pasco 55.8 1769
Huancavelica 68.5 1750
Apurímac 60.9 1725
Madre de Dios 27.1 1584
Cusco 38.2 1574
Amazonas 61.7 1404
Tacna 26.5 1399
@aniversarioperu
aniversarioperu / intoxicados_qali_warma.csv
Created October 27, 2013 09:47
número de intoxicados por Qali Warma por fecha y link a la nota de prensa.
Loreto 2013-10-25 80 http://bit.ly/18YdMbA
Junin 2013-09-28 35 http://bit.ly/18qqNpT
Curahuasi 2013-09-18 50 http://bit.ly/18qqEmx
Huanuco 2013-04-18 17 http://bit.ly/18qqzPL
Urubamba 2013-04-15 100 http://bit.ly/18qqlYX
Ucayali 2013-10-05 15 http://bit.ly/18qqfAm
Satipo 2013-09-27 24 http://bit.ly/18YeiGx
@aniversarioperu
aniversarioperu / lm.R
Created November 3, 2013 18:08
Plot del total de delitos por año para Perú. Datos tomados del INEI: http://www.inei.gob.pe/media/MenuRecursivo/Cap08005.xls
library(ggplot2)
y <- read.csv("datos.txt", header=FALSE)
y <- as.vector(y[,1])
x <- 2005:2012
int <- lsfit(x,y)$coefficients[1]
slope <- lsfit(x,y)$coefficients[2]
p <- ggplot(,aes(x,y))
p + geom_point() + geom_abline(intercept=int, slope=slope) +
labs(title = "Perú: Número total de delitos por año")
@aniversarioperu
aniversarioperu / delitos_bayesian.py
Created November 3, 2013 18:11
Análisis estadístico bayesiano del número de delitos por año para Perú. Se obtiene el número esperado de delitos y el año más probable en que se produjo un aumento en la cantidad de delitos. Usando teoría y cógidos de "Bayesian methods for hackers": http://bit.ly/19tyAUX
# -*- coding: utf-8 -*-
import prettyplotlib as ppl
from prettyplotlib import plt
import sys
import pymc as pm
import numpy as np
datos = np.loadtxt("datos.txt")
alpha = 1.0/datos.mean()
print alpha
@aniversarioperu
aniversarioperu / datos.txt
Created November 4, 2013 20:45
número total de delitos Perú, años 2005 al 2012. Fuente INEI
152516
153055
144205
151560
160848
181866
206610
254405