src/AlphaEvaluator_MP.py
def sim_YX(ridx,Y,X,resids,RSE_ratio,betas,std_alpha):
    '''Returns randomly simulated Y and X arrays for a given random index
    and monthly standard deviation of alpha
    '''
    X_sim = X[ridx,1:]
    error_sim = resids[ridx,:]

    # better way to do above is below
    A = np.random.randn(Y.shape[1]) # random draws from normal distrib
    B = RSE_ratio # ratio of resid standard errors to mean

    # repeat for n obs, i.e. constant alpha over time
    alpha_sim = std_alpha*np.repeat((A*B)[np.newaxis, :], X_sim.shape[0], axis=0)

    # Make simulated Y's
    Y_sim = alpha_sim + X_sim.dot(betas) + error_sim
    return Y_sim.astype(np.float64),X_sim.astype(np.float64)
Returns randomly simulated Y and X arrays for a given random index
    and monthly standard deviation of alpha
    
Returns randomly simulated Y and X arrays for a given random index
and monthly standard deviation of alpha
Returns randomly simulated Y and X arrays for a given random index and monthly standard deviation of alpha
def sim_YX(ridx,Y,X,resids,RSE_ratio,betas,std_alpha):
    X_sim = X[ridx,1:]
    error_sim = resids[ridx,:]
    A = np.random.randn(Y.shape[1]) 
    B = RSE_ratio 
    alpha_sim = std_alpha*np.repeat((A*B)[np.newaxis, :], X_sim.shape[0], axis=0)
    Y_sim = alpha_sim + X_sim.dot(betas) + error_sim
    return Y_sim.astype(np.float64),X_sim.astype(np.float64)
def sim_YX ( ridx , Y , X , resids , RSE_ratio , betas , std_alpha ) : X_sim = X [ ridx , 1 : ] error_sim = resids [ ridx , : ] A = np . random . randn ( Y . shape [ 1 ] ) B = RSE_ratio alpha_sim = std_alpha * np . repeat ( ( A * B ) [ np . newaxis , : ] , X_sim . shape [ 0 ] , axis = 0 ) Y_sim = alpha_sim + X_sim . dot ( betas ) + error_sim return Y_sim . astype ( np . float64 ) , X_sim . astype ( np . float64 )
Returns randomly simulated Y and X arrays for a given random index
and monthly standard deviation of alpha
Returns randomly simulated Y and X arrays for a given random index and monthly standard deviation of alpha
'''Returns randomly simulated Y and X arrays for a given random index
    and monthly standard deviation of alpha
    ''' # better way to do above is below # random draws from normal distrib # ratio of resid standard errors to mean # repeat for n obs, i.e. constant alpha over time # Make simulated Y's
ridx
Y
X
resids
RSE_ratio
betas
std_alpha