Skip to content

Commit

Permalink
BUG: Trying to avoid for loop but have shape problems.
Browse files Browse the repository at this point in the history
  • Loading branch information
j-grana6 committed Jul 25, 2012
1 parent 7fa9de0 commit c468c18
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions statsmodels/emplike/descriptive.py
Expand Up @@ -73,9 +73,29 @@ def _get_j_y(self, eta1):
See Owen pg. 63
"""
nobs = self.nobs
data = self.est_vect.T
data_star_prime = (1. + np.dot(eta1, data))
data_star_doub_prime = np.copy(1. + np.dot(eta1, data))

# Method 1


# idx = data_star_prime < 1. / nobs
# not_idx = ~idx
# data_star_prime[idx] = 2. * nobs - (nobs) ** 2 * data_star_prime[idx]
# data_star_prime[not_idx] = 1. / data_star_prime[not_idx]
# data_star_doub_prime[idx] = - nobs ** 2
# data_star_doub_prime[not_idx] = - (data_star_doub_prime[not_idx]) ** -2
# data_star_prime = data_star_prime.reshape(nobs, 1)
# data_star_doub_prime = data_star_doub_prime.reshape(nobs, 1)
# root_star = np.sqrt(- 1 * data_star_doub_prime).reshape(nobs,1)
# JJ = root_star * self.est_vect
# yy = data_star_prime / root_star
# return np.mat(JJ), np.mat(yy)

# Method 2

for elem in range(int(self.nobs)):
if data_star_prime[0, elem] <= 1. / self.nobs:
data_star_prime[0, elem] = 2. * self.nobs - \
Expand Down

0 comments on commit c468c18

Please sign in to comment.