Anda di halaman 1dari 3

rm(list = ls())

data <- read.table("C:/Users/Usuario/Documents/suicidio.txt",header = TRUE, sep =


"\t")
View(data)
class(data)
str(data)
summary(data)
frecho <- sort(table(data$Hombre), decreasing = T)
View(frecho)
regresion <- lm(formula = Total ~ Grupo.de.edad+Hombre + Mujer, data=data)
plot(regresion$residuals)
summary(regresion)

> nac <- read.table("C:/Users/Usuario/Documents/nacidos.txt",header = TRUE)


> View(nac)
> plot(nac)
> regresion <- lm(formula = semges ~ tacm+pesogra+numconspre+nuhnv, data=nac)
> plot(regresion$residuals)
> summary(regresion)

Call:
lm(formula = semges ~ tacm + pesogra + numconspre + nuhnv, data = nac)

Residuals:
Min 1Q Median 3Q Max
-7.7700 -0.7348 0.1093 0.8950 5.4220

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 19.3937355 0.8723922 22.231 < 2e-16 ***
tacm 0.2802130 0.0226529 12.370 < 2e-16 ***
pesogra 0.0013913 0.0001313 10.595 < 2e-16 ***
numconspre 0.0771344 0.0201307 3.832 0.000135 ***
nuhnv -0.0420670 0.0515306 -0.816 0.414498
---
Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1

Residual standard error: 1.419 on 984 degrees of freedom


Multiple R-squared: 0.5428, Adjusted R-squared: 0.5409
F-statistic: 292.1 on 4 and 984 DF, p-value: < 2.2e-16

> regresion <- lm(formula = pesogra ~ semges+pesogra+numconspre+nuhnv, data=nac)


Warning messages:
1: In model.matrix.default(mt, mf, contrasts) :
the response appeared on the right-hand side and was dropped
2: In model.matrix.default(mt, mf, contrasts) :
problem with term 2 in model.matrix: no columns are assigned
> regresion <- lm(formula = pesogra ~ semges +pesogra+numconspre+nuhnv, data=nac)
Warning messages:
1: In model.matrix.default(mt, mf, contrasts) :
the response appeared on the right-hand side and was dropped
2: In model.matrix.default(mt, mf, contrasts) :
problem with term 2 in model.matrix: no columns are assigned
> regresion <- lm(formula = pesogra ~ semges+tacm+numconspre+nuhnv, data=nac)
> plot(regresion$residuals)
> summary(regresion)

Call:
lm(formula = pesogra ~ semges + tacm + numconspre + nuhnv, data = nac)

Residuals:
Min 1Q Median 3Q Max
-1019.92 -221.73 -19.89 207.86 1423.60

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -4582.768 197.823 -23.166 < 2e-16 ***
semges 73.598 6.946 10.595 < 2e-16 ***
tacm 95.928 4.692 20.446 < 2e-16 ***
numconspre 7.742 4.658 1.662 0.0968 .
nuhnv 48.106 11.756 4.092 4.63e-05 ***
---
Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1

Residual standard error: 326.4 on 984 degrees of freedom


Multiple R-squared: 0.6255, Adjusted R-squared: 0.624
F-statistic: 410.9 on 4 and 984 DF, p-value: < 2.2e-16

> regresion <- lm(formula = tacm ~ semges+pesogra+numconspre+nuhnv, data=nac)


> plot(regresion$residuals)
> summary(regresion)

Call:
lm(formula = tacm ~ semges + pesogra + numconspre + nuhnv, data = nac)

Residuals:
Min 1Q Median 3Q Max
-16.6777 -1.0196 0.0601 1.2015 6.3440

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 21.955068 1.212289 18.110 <2e-16 ***
semges 0.480258 0.038825 12.370 <2e-16 ***
pesogra 0.003108 0.000152 20.446 <2e-16 ***
numconspre -0.012263 0.026547 -0.462 0.6442
nuhnv -0.166586 0.067276 -2.476 0.0134 *
---
Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1

Residual standard error: 1.858 on 984 degrees of freedom


Multiple R-squared: 0.6349, Adjusted R-squared: 0.6334
F-statistic: 427.7 on 4 and 984 DF, p-value: < 2.2e-16

> regresion <- lm(formula = pesogra ~ semges+tacm+numconspre+nuhnv, data=nac)


> plot(regresion$residuals)
> summary(regresion)

Call:
lm(formula = pesogra ~ semges + tacm + numconspre + nuhnv, data = nac)

Residuals:
Min 1Q Median 3Q Max
-1019.92 -221.73 -19.89 207.86 1423.60

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -4582.768 197.823 -23.166 < 2e-16 ***
semges 73.598 6.946 10.595 < 2e-16 ***
tacm 95.928 4.692 20.446 < 2e-16 ***
numconspre 7.742 4.658 1.662 0.0968 .
nuhnv 48.106 11.756 4.092 4.63e-05 ***
---
Signif. codes: 0 �***� 0.001 �**� 0.01 �*� 0.05 �.� 0.1 � � 1

Residual standard error: 326.4 on 984 degrees of freedom


Multiple R-squared: 0.6255, Adjusted R-squared: 0.624
F-statistic: 410.9 on 4 and 984 DF, p-value: < 2.2e-16

Anda mungkin juga menyukai