UAS_Regresi

Author

Anonim (14221016/EA-B)

A. Akses data/Memuat Data

Load paket readxl

library(readxl)
Financial_Data_Ratio_Q3_2022 <- read_excel("C:/Users/WINDOWS 10/Downloads/Financial Data & Ratio - Q3 2022.xlsx")
View(Financial_Data_Ratio_Q3_2022)
library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
fdr <- Financial_Data_Ratio_Q3_2022%>%select(Assets, Liabilities, Equity, Sales, EBT, Profit, POA, EPS, BE, ROA, ROE, DER, NPM, PER, PBV)
glimpse(fdr)
Rows: 812
Columns: 15
$ Assets      <chr> "16960.16", "130793.60000000001", "34.619999999999997", "2…
$ Liabilities <chr> "10885.54", "48844.18", "16.73", "15843.1", "3295.42", "44…
$ Equity      <chr> "6074.62", "81949.41", "17.88", "11991.55", "1983.69", "85…
$ Sales       <chr> "6483.46", "52702.34", "20.46", "22109.45", "695.5", "1371…
$ EBT         <chr> "3926.35", "30378.02", "2.4900000000000002", "1175.72", "4…
$ Profit      <chr> "3037.55", "20022.27", "2.4900000000000002", "927.41", "31…
$ POA         <chr> "3006.19", "18046.78", "2.4900000000000002", "955.46", "31…
$ EPS         <chr> "115.51", "563.32000000000005", "20.9", "75.56", "20.53", …
$ BE          <chr> "148.59", "2562.04", "81.28", "597.38", "709.27", "272.27"…
$ ROA         <chr> "28", "22", "13", "5", "1", "4", "-17", "1", "10", "1", "-…
$ ROE         <chr> "78", "35", "26", "13", "3", "28", "-", "1", "16", "2", "-…
$ DER         <chr> "1.79", "0.6", "0.94", "1.32", "1.66", "5.17", "-7.1", "0.…
$ NPM         <chr> "73", "55", "22", "7", "8", "17", "-7227", "8", "35", "65"…
$ PER         <chr> "15.8", "6.28", "11.87", "17.8", "17.920000000000002", "14…
$ PBV         <chr> "12.11", "1.38", "2.98", "2.2599999999999998", "0.49", "0.…

B. Penyiapan data/Data Preparation Telah dilakukan di excel

Mengubah jenis data char menjadi double

fdr$Assets <- as.double(fdr$Assets)
Warning: NAs introduced by coercion
fdr$Liabilities <- as.double(fdr$Liabilities)
Warning: NAs introduced by coercion
fdr$Equity <- as.double(fdr$Equity)
Warning: NAs introduced by coercion
fdr$Sales <- as.double(fdr$Sales)
Warning: NAs introduced by coercion
fdr$EBT <- as.double(fdr$EBT)
Warning: NAs introduced by coercion
fdr$Profit <- as.double(fdr$Profit)
Warning: NAs introduced by coercion
fdr$EPS <- as.double(fdr$EPS)
Warning: NAs introduced by coercion
fdr$BE <- as.double(fdr$BE)
Warning: NAs introduced by coercion
fdr$PBV <- as.double(fdr$PBV)
Warning: NAs introduced by coercion
fdr$PER <- as.double(fdr$PER)
Warning: NAs introduced by coercion
fdr$DER <- as.double(fdr$DER)
Warning: NAs introduced by coercion
fdr$ROA <- as.double(fdr$ROA)
Warning: NAs introduced by coercion
fdr$ROE <- as.double(fdr$ROE)
Warning: NAs introduced by coercion
fdr$NPM <- as.double(fdr$NPM)
Warning: NAs introduced by coercion
fdr$POA <- as.double(fdr$POA)
Warning: NAs introduced by coercion
library(dplyr)
fdr <- fdr%>%mutate(Price=PER*EPS)

D. Visualisasi ringkas & Pengujian Korelasi

1 Visualisasi Ringkas

library(ggplot2)

ggplot(fdr,aes(PER, Price)) + geom_point(aes(color = "red" )) + geom_smooth(method = "lm") + labs(title="Visualisasi Korelasi PER Terhadap Pergerakan Harga Saham")
`geom_smooth()` using formula = 'y ~ x'
Warning: Removed 35 rows containing non-finite values (`stat_smooth()`).
Warning: Removed 35 rows containing missing values (`geom_point()`).

2 Uji Korelasi

3.1 Uji Multiple Korelasi

variable <- fdr[,c(8,9,16)]
library(corrplot)
corrplot 0.92 loaded
cor.mtest(variable)
$p
                EPS            BE        Price
EPS    0.000000e+00 1.245517e-125 1.292010e-45
BE    1.245517e-125  0.000000e+00 5.473267e-19
Price  1.292010e-45  5.473267e-19 0.000000e+00

$lowCI
            EPS        BE     Price
EPS   1.0000000 0.6772274 0.4219038
BE    0.6772274 1.0000000 0.2469528
Price 0.4219038 0.2469528 1.0000000

$uppCI
            EPS        BE     Price
EPS   1.0000000 0.7454189 0.5305460
BE    0.7454189 1.0000000 0.3739986
Price 0.5305460 0.3739986 1.0000000

D. Pemodelan menggunakan Regresi

1. Membuat Model regresi dan Mengidentifikasi mana pengaruh paling signifikan

library(moderndive)
regresi <- lm(Price ~ PBV+EPS+BE+PER, data = fdr)

E. Hasil Regresi (Model persamaan regresi)

summary(regresi)

Call:
lm(formula = Price ~ PBV + EPS + BE + PER, data = fdr)

Residuals:
   Min     1Q Median     3Q    Max 
-18456  -1259  -1022   -197  35015 

Coefficients:
              Estimate Std. Error t value Pr(>|t|)    
(Intercept) 1427.09988  133.58012  10.683   <2e-16 ***
PBV           -0.03374    0.12264  -0.275    0.783    
EPS            4.27088    0.30100  14.189   <2e-16 ***
BE            -0.44474    0.04377 -10.160   <2e-16 ***
PER            0.29490    0.31100   0.948    0.343    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 3673 on 771 degrees of freedom
  (36 observations deleted due to missingness)
Multiple R-squared:  0.3233,    Adjusted R-squared:  0.3198 
F-statistic: 92.09 on 4 and 771 DF,  p-value: < 2.2e-16
plot(regresi)

Warning in sqrt(crit * p * (1 - hh)/hh): NaNs produced

Warning in sqrt(crit * p * (1 - hh)/hh): NaNs produced

get_regression_table(regresi)
# A tibble: 5 × 7
  term      estimate std_error statistic p_value lower_ci upper_ci
  <chr>        <dbl>     <dbl>     <dbl>   <dbl>    <dbl>    <dbl>
1 intercept 1427.      134.       10.7     0     1165.    1689.   
2 PBV         -0.034     0.123    -0.275   0.783   -0.274    0.207
3 EPS          4.27      0.301    14.2     0        3.68     4.86 
4 BE          -0.445     0.044   -10.2     0       -0.531   -0.359
5 PER          0.295     0.311     0.948   0.343   -0.316    0.905

1. Dari model persamaan yang saya buat, saya mendapatkan kemampuan tingkat prediksi model regresi saya telah saya buat adalah sebesar 31,98%

2. variable independent yang memiliki nilai prediksi yang paling besar terhadap harga saham adalah variabel EPS dengan koefisien sebesar 4.270 selanjutnya BE, PER, PBV