-
-
Save tbrugz/3821678 to your computer and use it in GitHub Desktop.
Eleições municipais: correlacionando valor da receita com valor dos bens
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tse <- read.csv("Candidatos RS municipais - 2008 e 2012.csv", header=T, sep=",") | |
# cargo 11 = prefeito; cargo 13 = vereador | |
f.tse2012p <- tse[tse$ANO_ELEICAO==2012 & tse$CD_CARGO==11,] | |
f.tse2012v <- tse[tse$ANO_ELEICAO==2012 & tse$CD_CARGO==13,] | |
f.tse2008p <- tse[tse$ANO_ELEICAO==2008 & tse$CD_CARGO==11,] | |
f.tse2008v <- tse[tse$ANO_ELEICAO==2008 & tse$CD_CARGO==13,] | |
# regressões logaritmicas - 2012 | |
lml.tse2012p <- lm(log(f.tse2012p$VL_RECEITA) ~ log(f.tse2012p$VL_BEM)) | |
lml.tse2012v <- lm(log(f.tse2012v$VL_RECEITA) ~ log(f.tse2012v$VL_BEM)) | |
# regressões logaritmicas - 2008 | |
lml.tse2008p <- lm(log(f.tse2008p$VL_RECEITA) ~ log(f.tse2008p$VL_BEM)) | |
lml.tse2008v <- lm(log(f.tse2008v$VL_RECEITA) ~ log(f.tse2008v$VL_BEM)) | |
# gera o gráfico | |
plot(tse$VL_BEM, tse$VL_RECEITA, log="xy", xlab="Valor dos Bens", ylab="Valor das Receitas", main="Eleições municipais: Receitas em função dos Bens"); | |
# desenha as linhas que representam as regressões | |
abline(lml.tse2012p, col="red") | |
abline(lml.tse2012v, col="green") | |
abline(lml.tse2008p, col="blue") | |
abline(lml.tse2008v, col="orange") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# regressões lineares - 2012 e 2008 | |
lm.tse2012p <- lm(f.tse2012p$VL_RECEITA ~ f.tse2012p$VL_BEM) | |
lm.tse2012v <- lm(f.tse2012v$VL_RECEITA ~ f.tse2012v$VL_BEM) | |
lm.tse2008p <- lm(f.tse2008p$VL_RECEITA ~ f.tse2008p$VL_BEM) | |
lm.tse2008v <- lm(f.tse2008v$VL_RECEITA ~ f.tse2008v$VL_BEM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> summary(lm.tse2012p) | |
Call: | |
lm(formula = f.tse2012p$VL_RECEITA ~ f.tse2012p$VL_BEM) | |
Residuals: | |
Min 1Q Median 3Q Max | |
-27426951 -86736 -57031 -11998 52921991 | |
Coefficients: | |
Estimate Std. Error t value Pr(>|t|) | |
(Intercept) 5.974e+04 7.468e+04 0.80 0.424 | |
f.tse2012p$VL_BEM 4.276e-02 7.318e-04 58.42 <2e-16 *** | |
--- | |
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | |
Residual standard error: 2343000 on 994 degrees of freedom | |
(127 observations deleted due to missingness) | |
Multiple R-squared: 0.7745, Adjusted R-squared: 0.7742 | |
F-statistic: 3413 on 1 and 994 DF, p-value: < 2.2e-16 | |
#--------------------------------------------------------------- | |
> summary(lm.tse2012v) | |
Call: | |
lm(formula = f.tse2012v$VL_RECEITA ~ f.tse2012v$VL_BEM) | |
Residuals: | |
Min 1Q Median 3Q Max | |
-5247321 -11455 -10180 -5653 16905486 | |
Coefficients: | |
Estimate Std. Error t value Pr(>|t|) | |
(Intercept) 1.101e+04 1.305e+03 8.436 <2e-16 *** | |
f.tse2012v$VL_BEM 8.046e-03 1.208e-04 66.597 <2e-16 *** | |
--- | |
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | |
Residual standard error: 164400 on 16075 degrees of freedom | |
(3104 observations deleted due to missingness) | |
Multiple R-squared: 0.2162, Adjusted R-squared: 0.2162 | |
F-statistic: 4435 on 1 and 16075 DF, p-value: < 2.2e-16 | |
#--------------------------------------------------------------- | |
> summary(lm.tse2008p) | |
Call: | |
lm(formula = f.tse2008p$VL_RECEITA ~ f.tse2008p$VL_BEM) | |
Residuals: | |
Min 1Q Median 3Q Max | |
-22252540 -101901 -83255 -36562 31751289 | |
Coefficients: | |
Estimate Std. Error t value Pr(>|t|) | |
(Intercept) 8.626e+04 5.447e+04 1.584 0.114 | |
f.tse2008p$VL_BEM 3.058e-02 8.200e-04 37.296 <2e-16 *** | |
--- | |
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | |
Residual standard error: 1720000 on 1013 degrees of freedom | |
(57 observations deleted due to missingness) | |
Multiple R-squared: 0.5786, Adjusted R-squared: 0.5782 | |
F-statistic: 1391 on 1 and 1013 DF, p-value: < 2.2e-16 | |
#--------------------------------------------------------------- | |
> summary(lm.tse2008v) | |
Call: | |
lm(formula = f.tse2008v$VL_RECEITA ~ f.tse2008v$VL_BEM) | |
Residuals: | |
Min 1Q Median 3Q Max | |
-880916 -9474 -8093 -4090 2767518 | |
Coefficients: | |
Estimate Std. Error t value Pr(>|t|) | |
(Intercept) 1.023e+04 4.596e+02 22.25 <2e-16 *** | |
f.tse2008v$VL_BEM 9.688e-04 5.910e-05 16.39 <2e-16 *** | |
--- | |
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | |
Residual standard error: 55390 on 14661 degrees of freedom | |
(873 observations deleted due to missingness) | |
Multiple R-squared: 0.018, Adjusted R-squared: 0.01793 | |
F-statistic: 268.7 on 1 and 14661 DF, p-value: < 2.2e-16 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment