MARKING

MEMBERS:

We declare that all the work in this project is done entirely by our group with no cheating and plagarism.

Table of Contents
I. Introduction
A. About data
B. Column variables
II. Data Analysis
1. Trend of Bitcoin
2. Change of Bitcoin
3. Change (%) of Bitcoin
4. The interest rate of ten different investment categories in the latest 5 years
III. Further Analysis
Technique 1
Technique 2
Technique 3
Technique 4
IV. Conclusion

I. INTRODUCTIONS

Bitcoin has been one of the most popular and profitable investment tools in recent years, attracting many investors around the world. The questions here are why Bitcoin is so widespread ? How to invest effectively and control the fluctuations of this virtual currency ? and then make financial decisions safely in the right way. The test was carried out on the returns of different assets along with the correlation of bitcoin value over time. This report analyzes data sets recorded over a certain period of time to help investors consider financial decisions to increase their profitability.

A. ABOUT DATA

This data covers the trading history of Bitcoin from 2022 to 2023. The first sheet includes 11 rows and 11 columns, which is about the return of 10 types of assets. Furthermore, the second sheet has 366 rows and 11 columns, which predicts the day when Bitcoin will drop to the lowest available and offers information on the % return on investments made by investors in three distinct investment categories: banks, Vietnamese securities, and Bitcoin.

library(readxl)
osta <- read_excel("C:/Users/NQing/OneDrive/Máy tính/OSTA/Osta.xlsx", 
                   sheet = "Sheet 2", col_types = c("numeric", 
                                                    "numeric", "numeric", "numeric", 
                                                    "numeric", "numeric", "date", "numeric", 
                                                    "numeric", "numeric", "text"))
print(osta)
## # A tibble: 365 × 11
##     Open  High   Low Close Change `Change (%)` Date               
##    <dbl> <dbl> <dbl> <dbl>  <dbl>        <dbl> <dttm>             
##  1 19409 19473 19150 19302   -107     -0.00551 2022-10-01 00:00:00
##  2 19302 19385 18890 19054   -248     -0.0128  2022-10-02 00:00:00
##  3 19054 19720 18947 19617    563      0.0295  2022-10-03 00:00:00
##  4 19617 20451 19482 20326    709      0.0361  2022-10-04 00:00:00
##  5 20326 20354 19734 20149   -177     -0.00871 2022-10-05 00:00:00
##  6 20149 20435 19836 19954   -195     -0.00968 2022-10-06 00:00:00
##  7 19954 20078 19318 19517   -437     -0.0219  2022-10-07 00:00:00
##  8 19517 19614 19175 19405   -112     -0.00574 2022-10-08 00:00:00
##  9 19405 19552 19300 19436     31      0.00160 2022-10-09 00:00:00
## 10 19436 19522 18973 19122   -314     -0.0162  2022-10-10 00:00:00
## # ℹ 355 more rows
## # ℹ 4 more variables: Predicted_low_price <dbl>, Year <dbl>, Months <dbl>,
## #   Trend <chr>
library(ggplot2)

B. COLUMN VARIABLES DETAILS:

THE DATA CONSISTS OF 20 VARIABLES:

  • OPEN: the started price in a day

  • HIGH: the highest price are recorded in day

  • LOW: the lowest price are recorded in day

  • CLOSE: the last price in a day

  • CHANGE: the difference of bitcoin price during the day

  • CHANGE (%): equal to CHANGE value divided by OPEN value

  • DATE

  • PREDICTED LOW PRICE:

  • YEAR

  • MONTHS

  • RETURN OF BTC

  • RETURN OF VN30

  • RETURN OF SP500

  • RETURN OF GOLD

  • RETURN OF SILVER

  • RETURN OF REALESTATE

  • RETURN OF OIL

  • RETURN OF USD

  • RETURN OF EURO

  • VIETNAM INTEREST RATE

II. DATA ANALYSIS

ggplot(data=osta, aes(x = Date, y = Close)) +
    geom_line() +
    labs(title = "TREND OF BITCOIN",
         x = "Date",
         y = "Close") +
    theme_minimal()

TREND OF BITCOIN

The line graph depicts the trend in the closing prices of Bitcoin over one year, starting from October 2022, when the statistics were recorded daily. The chart reveals pronounced fluctuations in the cryptocurrency’s value. Toward the end of 2022 and the beginning of 2023, there was a notable and steep decline in the closing price. In contrast, a concern surge was observed during the summer of 2023.

The closing price was initiated at 19,302 units on October 1, 2022, exhibiting an upward trajectory by November 2022. However, there was a rapid descent in November, reaching 15,765 units on November 21, 2022. Subsequently, the closing price experienced slight fluctuations until the onset of January 2023. A noteworthy resurgence was observed, particularly on January 13, 2023, when the closing price reached 31,437 units.

In summary, the graph illustrates the dynamic and volatile nature of Bitcoin’s closing prices over the specified one-year period. The discernible fluctuations, characterized by a significant decline in late 2022 and a substantial increase in early 2023, provide insights into the cryptocurrency’s market behaviour during the outlined timeframe.

library(ggplot2)
ggplot(osta, aes(x=Date, y=Change, group=Trend)) + 
  geom_boxplot(aes(fill=Trend))+
  facet_grid(Trend ~ Year)+
  theme_gray()+
  labs(title = "FACETS ILLUSTRATE THE INCREASE AND DECREASE OF THE CHANGE OVER TIME", x = "DATE", y = "CHANGE")

THE CHANGE OF BITCOIN

The graph below depicts the fluctuating pattern of Bitcoin prices on a daily basis from October 2022 to October 2023. On the whole, both trends exhibit a similar trajectory over the specified period.

In the last three months of 2022, the ascending trend shows fluctuations ranging from 86 to 386 (in terms of price), with an average value of 210. The highest and lowest values during this period are recorded at 1703 and 5, respectively. Conversely, the descending trend ranges from -318 to -82 (in price) during the same period, with an average value of -195. The highest and lowest points for the decreasing trend are noted at -3 and -2646, respectively.

Moving into the first ten months of 2023, the ascending trend reflects changes between 88.25 and 567.75 (in terms of price), with an average value of 302. The highest and lowest values during this timeframe are registered at 2393 and 0, respectively. Simultaneously, the descending trend ranges from -483 to -69.5 (in price) over the same period, with an average value of -198. The highest and lowest points for the decreasing trend are observed at -2 and -2117, respectively.

ggplot(osta, aes(x = `Change (%)`, y = "")) +
    geom_boxplot(fill = "lightpink", color = "red") +
    labs(title = "Boxplot of Change(%)", x = "Change (%)") +
    theme_minimal()

THE CHANGE (%) OF BITCOIN

The boxplot represents the change in percentage of price daily. Overall, the return varies between -0.9% and 1.06%. According to the figure, the daily return of users lost 0.05%, which is the median of boxplot. The highest return in percentage per day is 10,7%, while the lowest is -14,2%.

R <- read_excel("C:/Users/NQing/OneDrive/Máy tính/OSTA/Osta.xlsx", 
                sheet = "Sheet 1")
print(R)
## # A tibble: 10 × 11
##     Year Return_of_BTC Return_of_VN30 Return_of_SP500 Return_of_Gold
##    <dbl>         <dbl>          <dbl>           <dbl>          <dbl>
##  1     1         53.7            0.15            0.29          -0.28
##  2     2         -0.56           0.07            0.11          -0.02
##  3     3          0.33          -0.01           -0.01          -0.1 
##  4     4          1.26           0.05            0.1            0.08
##  5     5         13.3            0.55            0.19           0.13
##  6     6         -0.73          -0.12           -0.06          -0.02
##  7     7          0.94           0.02            0.29           0.18
##  8     8          3.04           0.21            0.16           0.25
##  9     9          0.59           0.43            0.26          -0.04
## 10    10         -0.64          -0.34           -0.19           0   
## # ℹ 6 more variables: Return_of_Silver <dbl>, Return_of_Realestate <dbl>,
## #   Return_of_Oil <dbl>, Return_of_USD <dbl>, Return_of_EURO <dbl>,
## #   Vietnam_interest_rate <dbl>
# Load necessary packages
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.1     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ lubridate 1.9.2     ✔ tibble    3.2.1
## ✔ purrr     1.0.1     ✔ tidyr     1.3.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the ]8;;http://conflicted.r-lib.org/conflicted package]8;; to force all conflicts to become errors
R <- pivot_longer(R, cols = c("Return_of_BTC", "Return_of_VN30", "Vietnam_interest_rate", "Return_of_Gold", "Return_of_SP500", "Return_of_Silver", "Return_of_Oil", "Return_of_USD", "Return_of_Realestate", "Return_of_EURO"),
                 names_to = "Type", values_to = "Percent")

library(ggplot2)
library(ggpubr)

ggplot(R, aes(x = Type, y = Percent, fill = Type, width = 0.5)) +
  geom_boxplot() +
  labs(title = "Boxplot of the interest rate of ten different investment categories in the latest 5 years",
       x = "Type of Return",
       y = "Percent") +
  theme_minimal()

THE RETURN OF TEN DIFERRENT INVESTMENT CATEGORIES IN THE LASTEST 5 YEARS

In general, the return of all top fields is about 0.1%. We can see that investing in bitcoin earns the highest interest rate of all, about 0,33 but the risk is quite high. Investing in the remaining fields earns approximately the same profit like: 0,05 profit from VN30, 0,065 profit from Vietnam interest rate and -0,1 profit from Gold and it is more stable.

III. FURTHER ANALYSIS

TECHNIQUE 1: ANOVA

library(readxl)
library(ggplot2)

Bitcoin_Data_2 <- read_excel("C:/Users/NQing/OneDrive/Máy tính/OSTA/Osta.xlsx", 
                             sheet = "Sheet 1")

asset = c(rep('Return_of_BTC',10),rep('Return_of_VN30',10),rep('Vietnam_interest_rate',10),rep('Return_of_Gold',10),rep('Return_of_Silver',10),rep('Return_of_Oil',10),rep('Return_of_Realestate',10),rep('Return_of_EURO',10),rep('Return_of_SP500',10),rep('Return_of_USD',10))
return = c(Bitcoin_Data_2$Return_of_BTC, Bitcoin_Data_2$Return_of_VN30, Bitcoin_Data_2$Vietnam_interest_rate, Bitcoin_Data_2$Return_of_Gold, Bitcoin_Data_2$Return_of_Silver, Bitcoin_Data_2$Return_of_Oil, Bitcoin_Data_2$Return_of_Realestate,Bitcoin_Data_2$Return_of_EURO,Bitcoin_Data_2$Return_of_SP500,Bitcoin_Data_2$Return_of_USD)

df = data.frame(asset,return)
bp = ggplot(df , aes(x= asset , y= return)) + 
  geom_boxplot()

bp

a = aov(return~asset, data = df)
summary(a)
##             Df Sum Sq Mean Sq F value Pr(>F)  
## asset        9  448.5   49.84   1.743 0.0906 .
## Residuals   90 2572.7   28.59                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

1. Method

To compare the return of ten difference assets, we use one-factor analysis of variance (ANOVA).
We use hypothesis testing to compare whether the return of ten different assets are equal or not. Therefore, the hypothesis testing is formed as follow:
\(H_0\): \(µ_1\)=\(µ_2\)=…=\(µ_{10}\) versus \(H_A\): at least one pair of means are different from each other.

\(µ_1\): the mean for return of Bitcoin
\(µ_2\): the mean for return of VN30
\(µ_3\): the mean for return of SP500
\(µ_4\): the mean for return of Gold
\(µ_5\): the mean for return of Silver
\(µ_6\): the mean for return of Real Estate
\(µ_7\): the mean for return of Oil
\(µ_8\): the mean for return of USD
\(µ_9\): the mean for return of Euro
\(µ_{10}\): the mean for return of Vietnam interest rate

The formulas:
Sum of squares for treatments:

The sum of squares for treatments SSTr has k-1 degrees of freedom

Sum of squares for error:

The sum of squares for error SSE has \(n_T-k\) degrees of freedom

Total sum of squares:

Mean squares for treatments:

Mean squares for error:

F-statistic

p-value

2. Analysis

Hypothesis testing at 10% significance level ($\(= 0.1) \ \)H_0$: \(µ_1\)=\(µ_2\)=…=\(µ_10\) versus \(H_A\): at least one pair of means are different from each other

We use R to compute the calculations. The code is as follow:

The boxplot illustrates the return of ten assets:

Overall, it is clear that the interquartile range of return in Bitcoin is longest. The median line of price change of Bitcoin lies outside of other assets’ boxplot. Therefore, the return of Bitcoin is likely to be different from the others.

The analysis of variance table:

According to the table, we have:
F-value \(= 1.743\)
p-value \(= 0.0906 < 0.1\)

Since the p-value is smaller than 0.1, the null hypothesis is rejected at 10% significance level. Therefore, there is sufficient evidence that at least one pair of the average in return of ten different assets is different.

3.Conclusion

The mean of return of ten different assets is unequal. As a result, the Tukey multiple comparisons proceduce is the next step to determine where the differences occur.

TECHNIQUE 2: TUKEY

Bitcoin_Data_2 <- read_excel("C:/Users/NQing/OneDrive/Máy tính/OSTA/Osta.xlsx", 
                             sheet = "Sheet 1")

asset = c(rep('Return_of_BTC',10),rep('Return_of_VN30',10),rep('Vietnam_interest_rate',10),rep('Return_of_Gold',10),rep('Return_of_Silver',10),rep('Return_of_Oil',10),rep('Return_of_Realestate',10),rep('Return_of_EURO',10))
return = c(Bitcoin_Data_2$Return_of_BTC, Bitcoin_Data_2$Return_of_VN30, Bitcoin_Data_2$Vietnam_interest_rate, Bitcoin_Data_2$Return_of_Gold, Bitcoin_Data_2$Return_of_Silver, Bitcoin_Data_2$Return_of_Oil, Bitcoin_Data_2$Return_of_Realestate,Bitcoin_Data_2$Return_of_EURO)

df = data.frame(asset,return)

a = aov(return~asset, data = df)
TukeyHSD(a)
##   Tukey multiple comparisons of means
##     95% family-wise confidence level
## 
## Fit: aov(formula = return ~ asset, data = df)
## 
## $asset
##                                              diff        lwr      upr     p adj
## Return_of_EURO-Return_of_BTC               -7.132 -15.477129 1.213129 0.1495823
## Return_of_Gold-Return_of_BTC               -7.108 -15.453129 1.237129 0.1525285
## Return_of_Oil-Return_of_BTC                -7.087 -15.432129 1.258129 0.1551426
## Return_of_Realestate-Return_of_BTC         -6.817 -15.162129 1.528129 0.1918264
## Return_of_Silver-Return_of_BTC             -7.125 -15.470129 1.220129 0.1504371
## Return_of_VN30-Return_of_BTC               -7.025 -15.370129 1.320129 0.1630587
## Vietnam_interest_rate-Return_of_BTC        -7.066 -15.411129 1.279129 0.1577905
## Return_of_Gold-Return_of_EURO               0.024  -8.321129 8.369129 1.0000000
## Return_of_Oil-Return_of_EURO                0.045  -8.300129 8.390129 1.0000000
## Return_of_Realestate-Return_of_EURO         0.315  -8.030129 8.660129 1.0000000
## Return_of_Silver-Return_of_EURO             0.007  -8.338129 8.352129 1.0000000
## Return_of_VN30-Return_of_EURO               0.107  -8.238129 8.452129 1.0000000
## Vietnam_interest_rate-Return_of_EURO        0.066  -8.279129 8.411129 1.0000000
## Return_of_Oil-Return_of_Gold                0.021  -8.324129 8.366129 1.0000000
## Return_of_Realestate-Return_of_Gold         0.291  -8.054129 8.636129 1.0000000
## Return_of_Silver-Return_of_Gold            -0.017  -8.362129 8.328129 1.0000000
## Return_of_VN30-Return_of_Gold               0.083  -8.262129 8.428129 1.0000000
## Vietnam_interest_rate-Return_of_Gold        0.042  -8.303129 8.387129 1.0000000
## Return_of_Realestate-Return_of_Oil          0.270  -8.075129 8.615129 1.0000000
## Return_of_Silver-Return_of_Oil             -0.038  -8.383129 8.307129 1.0000000
## Return_of_VN30-Return_of_Oil                0.062  -8.283129 8.407129 1.0000000
## Vietnam_interest_rate-Return_of_Oil         0.021  -8.324129 8.366129 1.0000000
## Return_of_Silver-Return_of_Realestate      -0.308  -8.653129 8.037129 1.0000000
## Return_of_VN30-Return_of_Realestate        -0.208  -8.553129 8.137129 1.0000000
## Vietnam_interest_rate-Return_of_Realestate -0.249  -8.594129 8.096129 1.0000000
## Return_of_VN30-Return_of_Silver             0.100  -8.245129 8.445129 1.0000000
## Vietnam_interest_rate-Return_of_Silver      0.059  -8.286129 8.404129 1.0000000
## Vietnam_interest_rate-Return_of_VN30       -0.041  -8.386129 8.304129 1.0000000

\(H_0\): All means of return of ten different assets are the same
versus \(H_A\): At least two means of return of different assets are not equal to each other.

After using the ANOVA test, we reject the null hypothesis and accept the alternative hypothesis. TThere is at least 1 different pair of returns of assets but we dont know exactly which pair. So we use Tukey to determine what the above pair is and confirm whether there is a difference or not.

We found the return of Euro and silver have different mean values(0.0989459 \(\neq\) 0.0996624) but the upper bound and the lower bound of these two returns are approximately ( -14.88, 0.63), which contains 0. It means there will be the case that the two returns will be the same at 0.

The question is why we should invest in Bitcoin instead of silver? Firstly, Bitcoin is the most liquid investment asset (liquidity is the ability of an asset or product to be converted into cash). Investors can easily trade Bitcoin with extremely low fees, which is very suitable when you are an investor looking for short-term profits and also tends to be a long-term investment market due to high market demand.

Secondly, Bitcoin could be a better inflation hedge since it is a digital currency that is the world’s best tool to help protect against rising consumer price indexes and is designed to have a limited supply, so it cannot be controlled by any government or central bank of the country that dominates too much.

Thirdly, Bitcoin transactions are especially minimalistic as investors do not need to settle orders like stock transactions, which can take days or weeks.

In conclusion, these are all reasons why Bitcoin is popular in the investment area and also the best choice for beginners as well as professionals.

TECHNIQUE 3: CHI-SQUARED

# Read the Excel file
Bitcoin_Data_3 <- read_excel("C:/Users/NQing/OneDrive/Máy tính/OSTA/Osta.xlsx", sheet = "Sheet 2")

# Convert to a data frame
table(Bitcoin_Data_3$Trend,Bitcoin_Data_3$Months)
##           
##             1  2  3  4  5  6  7  8  9 10 11 12
##   decrease  9 19 15 15 17 14 17 18 15 17 17 17
##   increase 22  9 16 15 14 16 14 13 15 14 13 14
# Perform chi-squared test
chisq <- chisq.test(Bitcoin_Data_3$Trend, Bitcoin_Data_3$Months, correct=FALSE)
print(chisq)
## 
##  Pearson's Chi-squared test
## 
## data:  Bitcoin_Data_3$Trend and Bitcoin_Data_3$Months
## X-squared = 11.092, df = 11, p-value = 0.4356

“Sell in May and Go Away” is a famous adage in the financial world. Sell your shares in May and then go out.” This adage is based on the historical record of underperformance of certain stocks from May through October. According to this strategy, investors will divest their capital in May and reinvest in November.

The Formulas:

First, we need to calculate X-squared from Chi-square statistic

Then, we calculate the degrees of freedom:

And the last we calculate the p-value:

The results: X-squared \(= 11,092\) df \(= 11\) p-value \(= 0,4356 > 0,1\)

\(⇒\) We can see that the p value is greater than 0.1, so we can infer that the month column and the number of days increasing or decreasing are not related to each other. That proves the saying “Sell in May and go away” is not plausible, the price is independent and it does not depend on the month.

TECHNIQUE 4: LINEAR REGRESSION

Bitcoin_Data_3 <- read_excel("C:/Users/NQing/OneDrive/Máy tính/OSTA/Osta.xlsx", sheet = "Sheet 2")

graph = ggplot(Bitcoin_Data_3, aes(x = Predicted_low_price, y = Low)) +
  geom_point() +
  geom_smooth() +
  labs(title = "Linear Regression", x = "Predicted_low_price", y = "Low") +
  theme_minimal() +
  theme(plot.title = element_text(hjust = 0.5))
graph
## `geom_smooth()` using method = 'loess' and formula = 'y ~ x'

btc_regression <- lm(Low ~ Predicted_low_price, data = Bitcoin_Data_3)
summary(btc_regression)
## 
## Call:
## lm(formula = Low ~ Predicted_low_price, data = Bitcoin_Data_3)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -4113.1  -160.6    38.1   253.1  2019.9 
## 
## Coefficients:
##                      Estimate Std. Error t value Pr(>|t|)    
## (Intercept)         2.806e+02  1.399e+02   2.006   0.0456 *  
## Predicted_low_price 9.885e-01  5.764e-03 171.501   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 510.1 on 363 degrees of freedom
## Multiple R-squared:  0.9878, Adjusted R-squared:  0.9878 
## F-statistic: 2.941e+04 on 1 and 363 DF,  p-value: < 2.2e-16

To ascertain the association between the low actual price and the predicted low price. We will use Simple Linear Regression, a model that uses a straight line to assess the correlation between two variables.

We want to know whether our data model is good enough to expect in the future or whether the relationship between dependent and independent variables is sufficient. So we need to calculate R squared.

R-squared (\(R^2\) or the coefficient of determination) is a statistical measure used to demonstrate the figure for the variance of a dependent variable in a regression model can be accounted for by an independent variable.

The result of R-squares is bigger than 0.055, which is nearly equal to 1 ($=$0.9903). Hence, we confidently assume that the linear regression model fits well with the data. We can conclude that the actual low price fluctuates corresponding to the predicted low price.

The Formulas:
Firstly, we need to calculate the degrees of freedom v of the t-distribution

The standard error of the predicted low price:

Next, we have the hypothesis test and calculate the t-statistic and p-value:

A size hypothesis test accepts the null hypothesis if p-value \(\ge\) \(\alpha\) and rejects the null hypothesis if p-value \(<\) \(\alpha\).

Additionally, testing the hypothesis is necessary to determine the model’s significance in the simple linear regression model.

Given that we are whether a single parameter is equal to 0, the F- statistic will simply equal the square of the corresponding t- statistic :\(t^2= F\)

The result:
f-statistic \(=\) 42050
p- value \(= 2.210^{-16} <0.05\) \(\to\) We reject the null hypothesis

According to the Linear Regression model, if we have a dependent variable Y (actual low prices) and an independent variable X (predicted low prices), the relationship between X and Y can be represented as the following equation:

Insert values in Figure 1 into the above function, we have: \(\beta_0 = 0.9911\), \(\beta_1 = 226\)

As a result, we conclude the linear equation:

We have a practical simple instance to apply the above equation:

On \(08/01/2023\), we predicted the low price is 16832, we want to calculate the approximately low price, which is compared to the actual one by using the equation:

In reality, the low price is 16907, so the difference between the two values is 1.1952, which is a very small number that we can ignore.

Hence, we confidently use this method to invest in the right category and reduce the risk of losing money.

IV. Conclusion

Bitcoin is gaining the upper hand in the investment field because of the countless benefits it brings. However, investors must also be careful when using this virtual currency since it carries huge potential risks. They should consider when choosing which type of asset is suitable for them and use knowledge as well as statistical skills that we have just mentioned before to invest effectively and control the fluctuations of this virtual currency and then make financial decisions and increase their profitability.