Logo

The Data Daily

Invest everyday, biweekly, or monthly? | R-bloggers

Invest everyday, biweekly, or monthly? | R-bloggers

Contact us
Invest everyday, biweekly, or monthly?
Posted on October 5, 2022 by r on Everyday Is A School Day in R bloggers | 0 Comments
[This article was first published on r on Everyday Is A School Day , and kindly contributed to R-bloggers ]. (You can report issue about the content on this page here )
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
Share Tweet
Biweekly did great overall, Better at TIPS, short-term bond, real estate, international; Monthly is second best with 3 out of 8. Good at small, mid, large caps
If you want to automate your investment on index funds with a fixed amount every month, is there a better way to divide the investment? Such as once a month, everyday, or biweekly? I’m very curious about this.
Disclaimer:
I am not a financial adviser. Everything that I shared here were purely out of curiosity and to spark questions for experts to explore the idea further. Also, to utilize our data science skills to explore available data to inform one own’s decision. Please take in any information at your own discretion. If you believe that the methodology is erroneous, please feel free to contact and educate me. I’m more than happy to learn from you!
Thought Process:
Conclusion/Lessons Learnt
Let’s Look at FXAIX
from % ggplot(.,aes(x=date,y=close)) + geom_point(alpha = 0.5) + # geom_line(color = "blue") + theme_bw() + ggtitle("Fidelity S&P 500 closing prices")
The visual does give us an idea that past performance is not indicative of future results. Look at the peaks and troughs, it sure looks like it has a life of its own.
It’s Playtime !
Let’s play with old data
Assuming that we want to automatically invest $200 per month, how would the return of investment look like with dividend reinvestment in daily, biweekly, and monthly strategy, if we had invested from 2018-01-01 to 2022-10-1.
One strategy that most financial advisors would provide is to diverse one’s portfolio. Lets diverse our portfolio to include bonds (short term, TIPS etc), small/mid/large caps, real estate, international indices, all through Fidelity. To make things simple, we are going to simulate contribution of the same amount, which is $200 for each index fund.
Hence, we have selected the following index funds:
FIPDX (Fidelity® Inflation-Protected Bond Index Fund)
FNSOX (Fidelity® Short-Term Bond Index Fund)
FREL (Fidelity® MSCI Real Estate Index ETF)
FSMDX (Fidelity® Mid Cap Index Fund)
FSSNX (Fidelity® Small Cap Index Fund)
FTIHX (Fidelity® Total International Index Fund)
FUAMX (Fidelity® Intermediate Treasury Bond Index Fund)
FXAIX (Fidelity® 500 Index Fund)
Tips/Disclaimers:
You could potentially rewrite/change existing code to simulate DAvid Swenson’s Asset allocation portfolio. To read more about David Swenson Yale Endowment Portfolio. Click here
Also please note that I use Fidelity as an example for simplicity purposes. You could use other brokers such as Vanguard, iShares, etc,
Spend some time assessing all of their expense ratio too
x biweekly_gain & daily_gain > monthly_gain ~ "daily", biweekly_gain > daily_gain & biweekly_gain > monthly_gain ~ "biweekly", monthly_gain > daily_gain & monthly_gain > biweekly_gain ~ "monthly", TRUE ~ "dunno" ))
Basically creating a new column with conditions that tells me which of the 3 investment strategy has the highest yield.
Sneak peek
df %>% ggplot(.,aes(x=strategy,fill=strategy)) + geom_histogram(stat = "count", col = "black", alpha = 0.8) + theme_bw()
Interesting! Biweekly seems to be ahead. Is it the same for all tickers?
Is our winner a true winner?
df %>% mutate(strategy = as.factor(strategy)) %>% group_by(ticker,strategy) %>% summarize(count = n()) %>% ggplot(.,aes(x=strategy,y=count, fill=strategy)) + geom_col(col = "black", alpha = 0.8) + theme_bw() + scale_x_discrete(drop=FALSE) + facet_wrap(.~ticker,scales = "free")
Not bad!
Biweekly does great overall, 4 out of 8.(FIPDX, FNSOX, FREL, FTIHX)
theme: TIPS, short-term bond, real estate, international
Monthly is second best with 3 out of 8. (FSMDX, FSSNX, FXAIX)
theme: small, mid, large caps
Daily is last, 1 out of 8. (FUAMX)
theme: intermediate treasury bond
If we were to explore further, being a winner does not mean you make $$$. For some funds it just means you have less losses, let’s find out more.
Bird’s Eye View
df %>% # mutate(to = lubridate::ymd(to)) %>% select(-daily,-biweekly,-monthly,-strategy) %>% pivot_longer(cols = c("daily_gain","biweekly_gain","monthly_gain"), names_to = "strategy", values_to = "percent_gain") %>% ggplot(.,aes(x=to,y=percent_gain,fill=strategy)) + geom_col(alpha=0.9,position = "dodge") + # geom_line() + theme_bw() + facet_wrap(.~ticker,scales="free") + theme(axis.text.x = element_text(size = 4,angle = 45, hjust = 1))
click here for bigger view
Wow, very busy faceted graphs! What I’ve observed is that biweekly seems to have slightly higher percentage gain and less percentage losses when evaluated during a bear market. This is very helpful because if the plan is to have a fixed income at retirement, preparing for a bear market is probably a better strategy in my opinion.
Zoom in on FXAIX
Limitations/Oppurtunities for improvement
First trade started on 2018-1-1.
Future idea: randomly select starting date as well as end date. But the idea is to assess which of these strategies is best for dollar cost average
Only on index funds, except for ETF (FREL).
Future idea: change codes to assess a variety of stocks/mutual funds/ETF/bonds
Only Fidelity Index funds.
biweekly investing appears to have highest yield when compared the rest
Biweekly 4 out of 8.(FIPDX, FNSOX, FREL, FTIHX)
theme: TIPS, short-term bond, real estate, international
Monthly 3 out of 8. (FSMDX, FSSNX, FXAIX)
theme: small, mid, large caps
Daily 1 out of 8. (FUAMX)
theme: intermediate treasury bond
helpful codes/erros
scale_x_discrete(drop=FALSE) to prevent dropping if the x factor has n = 0, so that it looks nice when visualizing
exited a knit early and because of index.Rmarkdown.lock, I was unable to knit further unless if I deleted the file
When is the best time to start investing? 10 years ago. When is the second best? Today.
If you like this article:

Images Powered by Shutterstock