Checking some hypothesis
Now let’s assume following null hypothesis : The price of a diamond is not correlated with its weight. let’s run a test to check this hypothesis
attach(diamonds.csv)
cor.test(price,carat)
##
## Pearson's product-moment correlation
##
## data: price and carat
## t = 551.41, df = 53938, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.9203098 0.9228530
## sample estimates:
## cor
## 0.9215913
Since the p-value is less than .05 so we reject this null hypothesis.
Now let’s assume following null hypothesis : The price of a diamond is not correlated with its quality of cut. let’s run a test to check this hypothesis
attach(diamonds.csv)
## The following objects are masked from diamonds.csv (pos = 3):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
cor.test(price,cut)
##
## Pearson's product-moment correlation
##
## data: price and cut
## t = 9.2647, df = 53938, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.03143180 0.04828312
## sample estimates:
## cor
## 0.03986029
Since the p-value is less than .05 so we reject this null hypothesis.
let’s assume following null hypothesis : The price of a diamond is not correlated with its color. let’s run a test to check this hypothesis
attach(diamonds.csv)
## The following objects are masked from diamonds.csv (pos = 3):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 4):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
cor.test(price,color)
##
## Pearson's product-moment correlation
##
## data: price and color
## t = 40.675, df = 53938, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.1643111 0.1806869
## sample estimates:
## cor
## 0.1725109
Since the p-value is less than .05 so we reject this null hypothesis.
let’s assume following null hypothesis : The price of a diamond is not correlated with its clarity. let’s run a test to check this hypothesis
attach(diamonds.csv)
## The following objects are masked from diamonds.csv (pos = 3):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 4):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 5):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
cor.test(price,clarity)
##
## Pearson's product-moment correlation
##
## data: price and clarity
## t = -16.656, df = 53938, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.07992579 -0.06313402
## sample estimates:
## cor
## -0.07153497
Since the p-value is less than .05 so we reject this null hypothesis.
let’s assume following null hypothesis : The price of a diamond is not correlated with its depth. let’s run a test to check this hypothesis
attach(diamonds.csv)
## The following objects are masked from diamonds.csv (pos = 3):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 4):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 5):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 6):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
cor.test(price,depth)
##
## Pearson's product-moment correlation
##
## data: price and depth
## t = -2.473, df = 53938, p-value = 0.0134
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.019084756 -0.002208537
## sample estimates:
## cor
## -0.0106474
Since the p-value is less than .05 so we reject this null hypothesis.
let’s assume following null hypothesis : The price of a diamond is not correlated with its table. let’s run a test to check this hypothesis
attach(diamonds.csv)
## The following objects are masked from diamonds.csv (pos = 3):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 4):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 5):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 6):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 7):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
cor.test(price,table)
##
## Pearson's product-moment correlation
##
## data: price and table
## t = 29.768, df = 53938, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.1188223 0.1354277
## sample estimates:
## cor
## 0.1271339
Since the p-value is less than .05 so we reject this null hypothesis.
let’s assume following null hypothesis : The price of a diamond is not correlated with its x-length. let’s run a test to check this hypothesis
attach(diamonds.csv)
## The following objects are masked from diamonds.csv (pos = 3):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 4):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 5):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 6):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 7):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 8):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
cor.test(price,x)
##
## Pearson's product-moment correlation
##
## data: price and x
## t = 440.16, df = 53938, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.8825835 0.8862594
## sample estimates:
## cor
## 0.8844352
Since the p-value is less than .05 so we reject this null hypothesis.
let’s assume following null hypothesis : The price of a diamond is not correlated with its y-length. let’s run a test to check this hypothesis
attach(diamonds.csv)
## The following objects are masked from diamonds.csv (pos = 3):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 4):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 5):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 6):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 7):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 8):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 9):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
cor.test(price,y)
##
## Pearson's product-moment correlation
##
## data: price and y
## t = 401.14, df = 53938, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.8632867 0.8675241
## sample estimates:
## cor
## 0.8654209
Since the p-value is less than .05 so we reject this null hypothesis.
let’s assume following null hypothesis : The price of a diamond is not correlated with its z-length. let’s run a test to check this hypothesis
attach(diamonds.csv)
## The following objects are masked from diamonds.csv (pos = 3):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 4):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 5):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 6):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 7):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 8):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 9):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
## The following objects are masked from diamonds.csv (pos = 10):
##
## carat, clarity, color, cut, depth, price, table, x, X, y, z
cor.test(price,z)
##
## Pearson's product-moment correlation
##
## data: price and z
## t = 393.6, df = 53938, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## 0.8590541 0.8634131
## sample estimates:
## cor
## 0.8612494
Since the p-value is less than .05 so we reject this null hypothesis.
Since every column variable has more than 2 components so it’s not possible to run t-test.