Skip to content

Instantly share code, notes, and snippets.

@tonussi
Last active October 24, 2019 12:58
Show Gist options
  • Save tonussi/f27c4816e661cce443ea11c5d6430f5b to your computer and use it in GitHub Desktop.
Save tonussi/f27c4816e661cce443ea11c5d6430f5b to your computer and use it in GitHub Desktop.
predicaot2
> m4 <- lm(geo$preco ~ geo$area + geo$coef_ap + geo$acl_decl + geo$frente, data=geo)
>
> summary(m4)
Call:
lm(formula = geo$preco ~ geo$area + geo$coef_ap + geo$acl_decl +
geo$frente, data = geo)
Residuals:
Min 1Q Median 3Q Max
-15525 -5235 -1858 3628 52939
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -41771.930 16298.496 -2.563 0.013501 *
geo$area 17.276 6.424 2.689 0.009761 **
geo$coef_ap 8195.227 2238.198 3.662 0.000614 ***
geo$acl_decl 55767.600 18004.224 3.097 0.003227 **
geo$frente 221.517 94.485 2.344 0.023152 *
---
Signif. codes: 0***0.001**0.01*0.05.0.1 ‘ ’ 1
Residual standard error: 11020 on 49 degrees of freedom
Multiple R-squared: 0.5867, Adjusted R-squared: 0.5529
F-statistic: 17.39 on 4 and 49 DF, p-value: 6.111e-09
> summary(m4)
Call:
lm(formula = geo$preco ~ geo$area + geo$coef_ap + geo$acl_decl +
geo$frente, data = geo)
Residuals:
Min 1Q Median 3Q Max
-15525 -5235 -1858 3628 52939
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -41771.930 16298.496 -2.563 0.013501 *
geo$area 17.276 6.424 2.689 0.009761 **
geo$coef_ap 8195.227 2238.198 3.662 0.000614 ***
geo$acl_decl 55767.600 18004.224 3.097 0.003227 **
geo$frente 221.517 94.485 2.344 0.023152 *
---
Signif. codes: 0***0.001**0.01*0.05.0.1 ‘ ’ 1
Residual standard error: 11020 on 49 degrees of freedom
Multiple R-squared: 0.5867, Adjusted R-squared: 0.5529
F-statistic: 17.39 on 4 and 49 DF, p-value: 6.111e-09
>
> summary(m4)
Call:
lm(formula = geo$preco ~ geo$area + geo$coef_ap + geo$acl_decl +
geo$frente, data = geo)
Residuals:
Min 1Q Median 3Q Max
-15525 -5235 -1858 3628 52939
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -41771.930 16298.496 -2.563 0.013501 *
geo$area 17.276 6.424 2.689 0.009761 **
geo$coef_ap 8195.227 2238.198 3.662 0.000614 ***
geo$acl_decl 55767.600 18004.224 3.097 0.003227 **
geo$frente 221.517 94.485 2.344 0.023152 *
---
Signif. codes: 0***0.001**0.01*0.05.0.1 ‘ ’ 1
Residual standard error: 11020 on 49 degrees of freedom
Multiple R-squared: 0.5867, Adjusted R-squared: 0.5529
F-statistic: 17.39 on 4 and 49 DF, p-value: 6.111e-09
>
> residuos <- rstandard(m4)
>
> preditos <- fitted(m4)
>
> plot(residuos ~ preditos)
>
> qqnorm(residuos)
>
> qqline(residuos)
>
> shapiro.test(residuos)
Shapiro-Wilk normality test
data: residuos
W = 0.82459, p-value = 1.653e-06
>
>
> coefap <- geo$coef_ap^2
> frente <- geo$frente^3
> acldecl <- 1/geo$acl_decl
> m4 <- lm(log(geo$preco) ~ log(geo$area) + coefap + acldecl + frente, data=geo)
>
> summary(m4)
Call:
lm(formula = log(geo$preco) ~ log(geo$area) + coefap + acldecl +
frente, data = geo)
Residuals:
Min 1Q Median 3Q Max
-0.30260 -0.14413 -0.03326 0.09578 0.64391
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 10.546673 0.660423 15.970 < 2e-16 ***
log(geo$area) 0.227991 0.098045 2.325 0.0242 *
coefap 0.041921 0.009218 4.547 3.58e-05 ***
acldecl -1.534453 0.258429 -5.938 2.92e-07 ***
frente 0.003400 0.001822 1.867 0.0679 .
---
Signif. codes: 0***0.001**0.01*0.05.0.1 ‘ ’ 1
Residual standard error: 0.2031 on 49 degrees of freedom
Multiple R-squared: 0.709, Adjusted R-squared: 0.6852
F-statistic: 29.84 on 4 and 49 DF, p-value: 1.35e-12
>
> residuos <- rstandard(m4)
>
> preditos <- fitted(m4)
>
> plot(residuos ~ preditos)
>
> qqnorm(residuos)
>
> qqline(residuos)
>
> shapiro.test(residuos)
Shapiro-Wilk normality test
data: residuos
W = 0.9426, p-value = 0.01198
>
>
@tonussi
Copy link
Author

tonussi commented Oct 23, 2019

MODELO 1 SEM TRANSFORMAR VARIÁVEIS

qqplot_1
residuos_preditos_1

@tonussi
Copy link
Author

tonussi commented Oct 23, 2019

MODELO 2 TRANSFORMANDO AS VARIÁVEIS

qqplot_2
residuos_preditos_2

@tonussi
Copy link
Author

tonussi commented Oct 24, 2019

Residuos vs Preditos (Sem Outliers)

residuos_preditos_sem_outliers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment