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

        # better way to do above is below
        A = np.random.randn(self.Y.shape[1]) # random draws from normal distrib
        B = self._SE_resid_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(self,ridx,betas,std_alpha):
        X_sim = self.X.values[ridx,1:]
        error_sim = self._resids[ridx,:]
        A = np.random.randn(self.Y.shape[1]) 
        B = self._SE_resid_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 ( self , ridx , betas , std_alpha ) : X_sim = self . X . values [ ridx , 1 : ] error_sim = self . _resids [ ridx , : ] A = np . random . randn ( self . Y . shape [ 1 ] ) B = self . _SE_resid_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
self
ridx
betas
std_alpha