0% found this document useful (0 votes)
20 views3 pages

# A Tibble: 34 × 4 : Warning Message: Package Readxl' Was Built Under R Version 4.3.3

This document analyzes the relationship between health insurance coverage, protein consumption, and life expectancy across Indonesian provinces. It loads data, performs a linear regression, and tests assumptions like normality and heteroscedasticity.

Uploaded by

ayumisra05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

# A Tibble: 34 × 4 : Warning Message: Package Readxl' Was Built Under R Version 4.3.3

This document analyzes the relationship between health insurance coverage, protein consumption, and life expectancy across Indonesian provinces. It loads data, performs a linear regression, and tests assumptions like normality and heteroscedasticity.

Uploaded by

ayumisra05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

> library(readxl)

Warning message:
package ‘readxl’ was built under R version 4.3.3
> data <- read_excel("C:\\Users\\HP\\Documents\\Data Angka Harapan
Hidup.xlsx")
> data
# A tibble: 34 × 4
PROVINSI `Jumlah jaminan kesehatan (X1)` `rata-rata
konsumsi protein(X2)` `angka harapan hidup (Y)`
<chr> <dbl>
<dbl> <dbl>
1 ACEH 98.4
60.9 70.0
2 SUMATERA UTARA 67.4
62.6 69.2
3 SUMATERA BARAT 78.9
57.9 69.5
4 RIAU 78.1
59.4 71.6
5 JAMBI 54.0
57.9 71.2
6 SUMATERA SELATAN 65.5
59.8 69.9
7 BENGKULU 64.8
59.3 69.4
8 LAMPUNG 81.4
56.3 70.7
9 KEP. BANGKA BELITUNG 68.0
65.7 70.7
10 KEP. RIAU 77.2
69.4 70.0
# ℹ 24 more rows
# ℹ Use `print(n = ...)` to see more rows
> anreg <- lm (data$`angka harapan hidup (Y)`~data$`Jumlah jaminan
kesehatan (X1)`+data$`rata-rata konsumsi protein(X2)`)
> anreg

Call:
lm(formula = data$`angka harapan hidup (Y)` ~ data$`Jumlah jaminan
kesehatan (X1)` +
data$`rata-rata konsumsi protein(X2)`)
Coefficients:
(Intercept) data$`Jumlah jaminan kesehatan
(X1)` data$`rata-rata konsumsi protein(X2)`
59.75941 -
0.01918 0.19347

> summary(anreg)

Call:
lm(formula = data$`angka harapan hidup (Y)` ~ data$`Jumlah jaminan
kesehatan (X1)` +
data$`rata-rata konsumsi protein(X2)`)

Residuals:
Min 1Q Median 3Q Max
-6.1220 -1.4084 0.1965 1.3068 4.4670

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 59.75941 4.75231 12.575 1.04e-13
***
data$`Jumlah jaminan kesehatan (X1)` -0.01918 0.03585 -0.535 0.59659
data$`rata-rata konsumsi protein(X2)` 0.19347 0.06568 2.946 0.00606
**
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 2.298 on 31 degrees of freedom
Multiple R-squared: 0.2215, Adjusted R-squared: 0.1712
F-statistic: 4.409 on 2 and 31 DF, p-value: 0.02065

> sisa <- residuals(anreg)


> sisa
1 2 3 4 5 6
7 8 9 10 11 12 13
0.32602992 -1.42251139 0.06696007 1.89432453 1.24157186 -0.15209435 -
0.61815403 1.61031107 -0.48499779 -1.71448656 1.31723865 2.24720877
4.46700804
14 15 16 17 18 19
20 21 22 23 24 25 26
3.53202030 1.27543251 -1.36595358 1.15505313 -6.12200715 -2.04247371
1.62842971 -0.87357418 -2.78766524 3.77785420 2.03365585 0.96728525 -
0.75314151
27 28 29 30 31 32
33 34
0.48264524 1.21706453 -1.46041499 -3.66428920 -2.49537169 0.72253275 -
2.85446866 -1.15102236
> nortest::lillie.test(anreg)
Error in complete.cases(x) : not all arguments have the same length
> nortest::lillie.test(sisa)

Lilliefors (Kolmogorov-Smirnov) normality test

data: sisa
D = 0.080322, p-value = 0.836

> library(car)
Loading required package: carData
Warning messages:
1: package ‘car’ was built under R version 4.3.3
2: package ‘carData’ was built under R version 4.3.3
> vif(anreg)
data$`Jumlah jaminan kesehatan (X1)` data$`rata-rata konsumsi
protein(X2)`
1.00299
1.00299
> library(lmtest)
Loading required package: zoo

Attaching package: ‘zoo’


The following objects are masked from ‘package:base’:

as.Date, as.Date.numeric

Warning messages:
1: package ‘lmtest’ was built under R version 4.3.3
2: package ‘zoo’ was built under R version 4.3.3
> bptest(anreg)

studentized Breusch-Pagan test

data: anreg
BP = 4.2871, df = 2, p-value = 0.1172

> library(lawstat)

Attaching package: ‘lawstat’

The following object is masked from ‘package:car’:

levene.test

Warning message:
package ‘lawstat’ was built under R version 4.3.3
> bgtest(anreg)

Breusch-Godfrey test for serial correlation of order up to 1

data: anreg
LM test = 2.9307, df = 1, p-value = 0.08691

You might also like