This report estimates the Fama-French 3-factor model for 10 large Taiwan-listed stocks using data exported from TEJ (Taiwan Economic Journal).
The TEJ data is embedded in this document, so no external file is needed to knit it.
tej_csv <- "Date,MKT_RF,SMB,HML,RF,2330 TSMC,2317 Hon Hai,2454 MediaTek,2308 Delta,2382 Quanta,2881 Fubon Fin,2882 Cathay Fin,1301 Formosa Plastics,1303 Nan Ya,2002 China Steel
201801,4.1231,-1.3896,-0.7446,0.08708333,11.1111,-3.1512,7.7509,-3.1287,-0.0367,4.6266,-2.1531,-3.9925,6.831,5.0386
201802,-2.7385,1.1322,0.8735,0.08708333,-3.5294,-4.4467,-6.5824,-4.2828,-1.2297,-5.3255,-0.4533,4.785,0.265,-0.1009
201803,1.1557,2.968,-1.2107,0.08708333,0.6099,0.4539,-7.1752,4.1054,1.493,-1.2885,-1.6213,3.4292,2.3068,4.6324
201804,-2.6046,-1.743,2.6914,0.08708333,-8.2828,-6.3277,5.9058,0.2933,12.2104,5.541,-2.0164,2.8092,3.4606,-5.2805
201805,2.3397,-0.9872,2.6739,0.08708333,-1.3216,3.3775,4.3086,5.3556,-7.8629,-2.1599,3.8834,2.8249,-0.9049,-1.7978
201806,0.4125,2.0266,0.6033,0.08708333,0.1986,-2.9172,3.9785,4.0555,4.394,2.3309,1.8638,0.4547,1.5964,0.3184
201807,3.7022,-4.7552,-0.5587,0.08708333,13.6258,3.157,4.6598,1.1067,-6.641,3.6211,-2.4409,-2.8198,0.7504,0.4644
201808,2.9875,-0.5126,0.4619,0.08708333,4.3081,0.6195,-2.6282,-3.0727,-1.1653,-3.015,4.0884,0.7805,1.0907,-1.2752
201809,0.5746,-1.1636,1.9438,0.08708333,-0.4137,-5.2771,3.849,-6.6802,6.327,0.3679,1.6599,-2.0055,-2.392,2.48
201810,3.5612,3.9898,-1.4021,0.08708333,5.323,6.7427,4.2808,-0.9112,1.4085,-12.0409,3.7327,4.1079,0.798,-3.4367
201811,6.8875,0.0717,-0.727,0.08708333,3.0339,4.7101,-2.8719,6.1246,-4.0732,-3.3951,2.9815,-0.0441,2.692,-0.1983
201812,0.2102,-2.1212,-2.8446,0.08708333,7.8275,4.9134,15.447,2.6561,-2.3335,-0.385,-2.9989,-2.5543,6.5046,0.721
201901,0.2103,1.8273,-3.0513,0.08916667,-1.3613,-3.9288,5.5642,-5.227,4.3621,-4.2664,-1.8967,-0.6891,4.5371,2.1005
201902,7.101,-2.4638,1.5688,0.08916667,0.6979,8.0945,-6.2583,2.4352,-2.4058,6.9664,3.4639,2.0278,9.3127,2.7907
201903,4.0163,0.5386,2.8194,0.08916667,0.3434,-6.4896,6.8615,3.5807,2.139,-4.9776,2.9025,-1.5858,-2.3694,-3.6362
201904,-0.684,-4.0153,-0.4656,0.08916667,-5.5493,3.8517,-4.7202,-3.2728,1.3187,-1.1162,0.3143,-2.5422,4.1893,-5.0694
201905,3.1617,-2.6892,2.0081,0.08916667,4.1287,12.1904,7.7883,2.3301,-2.0277,1.1099,0.881,1.4016,1.4334,4.7719
201906,-0.661,0.5134,0.5318,0.08916667,3.9358,-4.3508,10.426,1.8143,11.3909,6.221,5.6384,1.4064,9.4592,1.4631
201907,-0.6698,1.6508,-1.7838,0.08916667,2.5281,-2.1447,-3.6268,-4.672,4.1428,-4.9999,-2.0254,-1.3757,-2.5332,-2.3197
201908,2.0195,0.4599,0.5312,0.08916667,1.2098,1.3182,9.04,3.4321,-8.6207,5.1363,2.6431,-1.2428,-2.6589,5.729
201909,-6.1705,-0.1429,3.2375,0.08916667,-5.2845,-1.8181,5.1307,4.5282,1.995,0.6399,-0.429,1.3586,-1.6976,0.7049
201910,-5.4547,-0.5323,-0.3824,0.08916667,0.1865,-7.2634,8.0366,7.3485,-2.0766,-3.2279,-0.4925,-4.8579,-7.7956,4.4275
201911,-1.0367,-3.0049,3.2987,0.08916667,0.6151,1.1565,15.6672,7.1905,5.1917,2.4022,4.905,-4.7076,-1.403,0.5363
201912,-2.7488,-1.4117,-6.3254,0.08916667,-1.9125,-4.724,0.4577,-5.9394,-2.7041,1.3763,3.7842,-2.1582,-2.3365,7.5126
202001,2.2941,-0.8673,1.5904,0.06583333,1.6129,3.2627,-3.1515,-3.5643,0.5493,-1.7408,3.7354,-0.2898,1.3016,6.4437
202002,-2.3505,2.32,-0.0998,0.06583333,4.7223,-3.981,-4.1156,4.2812,3.5239,0.8722,5.7525,1.6504,2.067,-0.5714
202003,-4.2668,0.8216,-0.9877,0.06583333,12.874,8.8597,-3.5923,4.2744,5.2556,-0.9027,0.4861,5.9588,8.2047,3.7005
202004,6.6695,-3.6024,-0.089,0.06583333,3.4602,-3.2729,1.6526,4.2813,-4.6614,1.0427,3.196,3.6733,4.5017,2.5588
202005,0.2421,0.7806,-4.8714,0.06583333,3.9165,-0.8747,4.6222,22.3048,-0.5056,3.1823,-0.8721,-0.0918,-1.6076,5.0902
202006,1.3566,-0.7087,-0.8052,0.06583333,2.0905,5.0303,4.1645,4.5828,-1.1797,6.7855,1.7291,0.4296,-2.8937,-3.0772
202007,-4.314,-1.3215,0.5214,0.06583333,-8.0532,-5.6005,8.073,7.6321,-2.036,-4.2275,-0.1336,-3.2094,2.6677,2.7012
202008,-0.9687,1.3845,3.0992,0.06583333,2.3542,1.9828,2.2923,6.6516,9.5742,8.9188,0.7977,0.4315,-4.5809,4.0045
202009,1.5215,2.2651,-1.492,0.06583333,2.8313,7.5971,12.5201,5.0175,3.0439,-7.0131,2.8401,-0.568,8.0258,-5.8556
202010,-3.2738,2.0557,-2.1595,0.06583333,16.0478,-7.5589,0.3209,-0.2025,-4.9522,0.008,-2.9547,1.6941,5.4178,-3.8414
202011,2.5277,-1.6624,-1.454,0.06583333,1.442,1.7601,21.5132,5.5984,5.5057,2.8944,8.9788,-2.5608,-1.1767,-6.8373
202012,-1.1824,-0.5493,1.8054,0.06583333,4.1585,2.1514,6.6422,-2.6733,11.2863,1.6959,-3.7247,2.4216,-6.1525,-0.6429"
window_table <- read.csv(text = tej_csv, check.names = FALSE) %>% as_tibble()
dim(window_table)
## [1] 36 15
The table is in wide format: one row per month, with the factors followed by one column per stock.
The 10 stocks were selected from TEJ by ranking market value at 2020/12.
stock_cols <- setdiff(names(window_table), c("Date", "MKT_RF", "SMB", "HML", "RF"))
stocks <- tibble(label = stock_cols) %>%
separate(label, into = c("CO_ID", "CO_Name"), sep = " ", extra = "merge")
stocks
window_ret <- window_table %>%
select(Date, all_of(stock_cols)) %>%
pivot_longer(-Date, names_to = "label", values_to = "Ret") %>%
separate(label, into = c("CO_ID", "CO_Name"), sep = " ", extra = "merge")
window_table %>% select(Date, all_of(stock_cols))
window_ret %>%
group_by(CO_ID, CO_Name) %>%
summarise(N = sum(!is.na(Ret)),
first_month = min(Date),
last_month = max(Date),
.groups = "drop")
ff_window <- window_table %>% select(Date, MKT_RF, SMB, HML, RF)
ff_window
summary(ff_window %>% select(-Date))
## MKT_RF SMB HML RF
## Min. :-6.1705 Min. :-4.7552 Min. :-6.3254 Min. :0.06583
## 1st Qu.:-1.4744 1st Qu.:-1.4744 1st Qu.:-1.2586 1st Qu.:0.06583
## Median : 0.3273 Median :-0.5224 Median :-0.0944 Median :0.08708
## Mean : 0.4986 Mean :-0.3011 Mean :-0.0332 Mean :0.08069
## 3rd Qu.: 2.6427 3rd Qu.: 1.1953 3rd Qu.: 1.6442 3rd Qu.:0.08917
## Max. : 7.1010 Max. : 3.9898 Max. : 3.2987 Max. :0.08917
36-month stock returns (%) and Fama-French 3-factor returns (%):
window_table
For each stock:
\[R_i - R_f = \alpha_i + b_i \, MKT\_RF + s_i \, SMB + h_i \, HML + \varepsilon_i\]
Stocks with fewer than 24 monthly observations are excluded.
long <- window_ret %>%
left_join(ff_window, by = "Date") %>%
mutate(ExRet = Ret - RF)
ff3_results <- long %>%
filter(!is.na(Ret)) %>%
group_by(CO_ID, CO_Name) %>%
filter(n() >= 24) %>%
group_modify(~ {
m <- lm(ExRet ~ MKT_RF + SMB + HML, data = .x)
cf <- summary(m)$coefficients
data.frame(N = nobs(m),
alpha = cf[1, 1],
b_MKT = cf[2, 1],
s_SMB = cf[3, 1],
h_HML = cf[4, 1],
t_alpha = cf[1, 3],
t_MKT = cf[2, 3],
t_SMB = cf[3, 3],
t_HML = cf[4, 3],
R2 = summary(m)$r.squared,
adj_R2 = summary(m)$adj.r.squared)
}) %>%
ungroup() %>%
mutate(across(c(alpha, b_MKT, s_SMB, h_HML, t_alpha, t_MKT, t_SMB, t_HML, R2, adj_R2),
~ round(.x, 4)))
ff3_results
Stocks included in the regression: 10 of 10. All stocks have the full 36 observations, so none were excluded.
ff3_results %>%
mutate(stock = paste(CO_ID, CO_Name)) %>%
select(stock, b_MKT, s_SMB, h_HML) %>%
pivot_longer(-stock, names_to = "factor", values_to = "loading") %>%
ggplot(aes(x = reorder(stock, loading), y = loading, fill = factor)) +
geom_col(position = "dodge") +
coord_flip() +
labs(title = "Fama-French 3-factor loadings (2018/01 - 2020/12)",
x = NULL, y = "Estimated loading", fill = "Factor") +
theme_minimal()
s_SMB
indicates small-cap-like behavior and negative indicates large-cap-like
behavior. Positive h_HML indicates value-like behavior and
negative indicates growth-like behavior.t_alpha (an
absolute value above about 2 suggests statistical significance).write_csv(ff3_results, "ff3_results.csv")
write_csv(window_table, "window_table.csv")
Outputs saved: ff3_results.csv (regression estimates)
and window_table.csv (36-month returns and factors).