id educ date state
Min. :10002 Min. : 8.00 Length:660 Length:660
1st Qu.:10800 1st Qu.:12.00 Class :character Class :character
Median :11692 Median :14.00 Mode :character Mode :character
Mean :11729 Mean :14.38
3rd Qu.:12600 3rd Qu.:16.00
Max. :13921 Max. :20.00
regprc ecoprc inseason hhsize
Min. :0.5900 Min. :0.590 Min. :0.0000 Min. :1.000
1st Qu.:0.5900 1st Qu.:0.890 1st Qu.:0.0000 1st Qu.:2.000
Median :0.8900 Median :1.090 Median :0.0000 Median :3.000
Mean :0.8827 Mean :1.082 Mean :0.3364 Mean :2.941
3rd Qu.:1.1900 3rd Qu.:1.290 3rd Qu.:1.0000 3rd Qu.:4.000
Max. :1.1900 Max. :1.590 Max. :1.0000 Max. :9.000
male faminc age reglbs
Min. :0.0000 Min. : 5.00 Min. :19.00 Min. : 0.000
1st Qu.:0.0000 1st Qu.: 25.00 1st Qu.:33.00 1st Qu.: 0.000
Median :0.0000 Median : 45.00 Median :43.00 Median : 0.000
Mean :0.2621 Mean : 53.41 Mean :44.52 Mean : 1.282
3rd Qu.:1.0000 3rd Qu.: 65.00 3rd Qu.:53.00 3rd Qu.: 2.000
Max. :1.0000 Max. :250.00 Max. :88.00 Max. :42.000
ecolbs numlt5 num5_17 num18_64
Min. : 0.000 Min. :0.0000 Min. :0.0000 Min. :0.000
1st Qu.: 0.000 1st Qu.:0.0000 1st Qu.:0.0000 1st Qu.:1.000
Median : 1.000 Median :0.0000 Median :0.0000 Median :2.000
Mean : 1.474 Mean :0.2864 Mean :0.6212 Mean :1.805
3rd Qu.: 2.000 3rd Qu.:0.0000 3rd Qu.:1.0000 3rd Qu.:2.000
Max. :42.000 Max. :4.0000 Max. :6.0000 Max. :7.000
numgt64
Min. :0.0000
1st Qu.:0.0000
Median :0.0000
Mean :0.2288
3rd Qu.:0.0000
Max. :3.0000
sebaran data untuk dua variabel age dan id
ggplot(apple, aes(x = age, y = id)) +geom_point() +labs(x ="Age", y ="Id",title ="Scatter Plot of Age and Id") +theme_minimal()
korelasi antara age dan ecoprc
cor(apple$age, apple$ecoprc, use ="complete.obs")
[1] 0.07202745
menghitung jumlah nilai yang hilang
sum(is.na(apple))
[1] 0
histogram dari age
ggplot(apple, aes(x = age)) +geom_histogram(binwidth =1, fill ="purple", color ="black") +labs(x ="Age", y ="Frequency",title ="Histogram of Age") +theme_minimal()
Call:
lm(formula = ecoprc ~ hhsize + faminc + age, data = apple)
Residuals:
Min 1Q Median 3Q Max
-0.53393 -0.22334 0.00495 0.22194 0.60577
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.0392065 0.0525410 19.779 <2e-16 ***
hhsize 0.0012237 0.0079859 0.153 0.878
faminc -0.0004093 0.0003240 -1.263 0.207
age 0.0013604 0.0007988 1.703 0.089 .
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.2951 on 656 degrees of freedom
Multiple R-squared: 0.007603, Adjusted R-squared: 0.003065
F-statistic: 1.675 on 3 and 656 DF, p-value: 0.171
perubahan dalam hhsize mempengaruhi ecoprc
ggplot(apple, aes(x = hhsize, y = ecoprc)) +geom_point() +geom_smooth(method ="lm", col ="pink") +labs(x ="hhsize", y ="Ecoprc",title ="Scatter Plot of hhsize and Ecoprc with Regression Line") +theme_minimal()
`geom_smooth()` using formula = 'y ~ x'
histogram dari ecoprc
ggplot(apple, aes(x = ecoprc)) +geom_histogram(aes(y = ..density..), binwidth =0.1, fill ="blue", color ="black") +geom_density(color ="red", size =1) +labs(x ="Ecoprc", y ="Density", title ="Histogram dan Density Plot dari Ecoprc") +theme_minimal()
Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
ℹ Please use `linewidth` instead.
Warning: The dot-dot notation (`..density..`) was deprecated in ggplot2 3.4.0.
ℹ Please use `after_stat(density)` instead.
q-q plot dari ecoprc
ggplot(apple, aes(sample = ecoprc)) +stat_qq() +stat_qq_line() +labs(x ="Theoretical Quantiles", y ="Sample Quantiles", title ="Q-Q Plot dari Ecoprc") +theme_minimal()