<jupyter_start><jupyter_text>Regression of BDCS to its holdings- We get an almost perfect fit for BDCS, allowing us to get much more hostory for the ETF- Testing regression on less/more history, and thus more/less companies, we get very similar fits, increasing our confidence that even a fit with 3-4 companies (from 2005) it good enough<jupyter_code># TICC, FSC
# TCAP - changed symbol name
bdc_comps = [ 'ABDC','ACSF','AINV','ARCC','BKCC','CPTA','CODI','EQS','FDUS','GARS','GLAD','GAIN','GBDC','GECC','HCAP','HTGC','HRZN','KCAP','MAIN','MCC','MRCC','MVC','NMFC','OFS','OHAI','OXLC','PFLT','PNNT','PSEC','SLRC','SUNS','SCM','CGBD','TCPC','TCRD','TSLX','TPVG','WHF']
mode = "TR"
def regress(year, show=True):
    target = get("BDCS", mode=mode)
    source = get(bdc_comps, trim=True, start=year, mode=mode, source="Y")
    return lrret(target, source, return_pred=True, show_res=show)
bdcs_fit = regress(2005)
bdcs_fit = get(bdcs_fit, rebal="day")
show(bdcs_fit, BDCS, trim=False)
lst = [regress(y, show=False) for y in range(2005, 2018)]
_lst = get(lst, rebal="day") # the regression is done on daily rebal, so we build the actual series in the same way
show(_lst, trim=False)
show([x/_lst[0] for x in _lst], 0, 1, trim=False)
# regressing from 2005, there are only 4 companies making the fit
# this is what they look like
top = ['ARCC', 'PSEC', 'AINV', 'OHAI']
all = get(top + [SPY, BDCS], source="Y")
show(all, source="Y", trim=False, align="rel")<jupyter_output><empty_output><jupyter_text>BDCL<jupyter_code># BDCL is ~1.7 BDCS
lrret(BDCL, [BDCS], freq="M", pos_weights=False, sum1=False, fit_values=True)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1774390243902439, 'fraction_numerical': 0.01768292682926829, 'mean_word_length': 7.044117647058823, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '267139', 'license': 'MIT', 'n_tokens_mistral': 651, 'n_tokens_neox': 611, 'n_words': 167, 'path': 'Research/BizDev.ipynb', 'repo_name': 'shew91/Retropy', 'size': '1640'}