#Input Data buku

Book <- c("Intro to History", "Basic Algebra", "Intro to Psyc", "Intro to Sosiology", "Bun Mngi", "Intro to Biology", "Fund of Jazz", "Princ of Nursing")

#Input Data Halaman dan Harga Jual Buku

Page <- c(500,700,800,600,400,500,600,800)
Price = c(84,75,99,72,69,81,63,93)
data_buku <- data.frame(Page, Price)

#Koefsien Korelasi

cor(Price, Page)
## [1] 0.6138789
(korelasi <- cor(data_buku))
##            Page     Price
## Page  1.0000000 0.6138789
## Price 0.6138789 1.0000000
library(corrplot)
## Warning: package 'corrplot' was built under R version 4.4.2
## corrplot 0.95 loaded
corrplot(corr = korelasi, method = "number", type = "upper")

#Membuat Scatterplot

plot (x = Page, y = Price,
      main = "Scatterplot Page vs Price",
      xlab = "Page",
      ylab = "Price ($)")

#Uji Signifikansi Koefisien Korelasi

cor.test(x=Page, y=Price, alternative = "two.sided", 
         method = "pearson",
         exact = NULL, conf.level = 0.95)
## 
##  Pearson's product-moment correlation
## 
## data:  Page and Price
## t = 1.9049, df = 6, p-value = 0.1055
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.1600131  0.9204012
## sample estimates:
##       cor 
## 0.6138789

#Uji Signifikansi Koefisien Korelasi

Hipotesis H0: rho = 0 vs H1: rho ≠ 0 Nilai p (p-value = 0.1055): Karena nilai p > 0.05, belum cukup bukti untuk menolak H0 dan disimpulkan bahwa tidak ada korelasi yang signifikan antara Page (halaman buku) dan Price (harga jual buku).