Skip to content

Commit

Permalink
Merge pull request #13 from Encephala/fix-index-error-when-no-lags
Browse files Browse the repository at this point in the history
Fix `IndexError` when no lags given in command
  • Loading branch information
dazhwu authored Mar 15, 2024
2 parents dabadb4 + e22d473 commit dde0626
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pydynpd/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def parse_command(self):
if len(parts) <= 1:
print('There should be at least two parts in command string')
exit()

if len(parts) > 3:
print('too many parts')
exit()
Expand Down Expand Up @@ -302,15 +302,15 @@ def check_dep_indep(self):
dep = self._temp_part1_list.names[0]
dep_lags = self._temp_part1_list.lags[0]

if dep_lags[0] != 0:
if len(dep_lags) > 0 and dep_lags[0] != 0:
print('dependent variable should not be lagged on the left hand side of the model')
exit()

if len(dep_lags) == 0:
if len(dep_lags) == 1:
print('lagged dependent variable should be included')
exit()

if len(dep_lags) > 0 and dep_lags[1] != 1:
if dep_lags[1] != 1:
print('lag 1 of the dependent variable is not included')
exit()

Expand Down Expand Up @@ -350,11 +350,11 @@ def check_three_lists(self):
self._temp_iv_list.insert(var_name, var_lags)

# def check_adjustable(self):
#
#
# if len(self.adjustable['indep'])>0:
# dep = self._temp_part1_list.names[0]
# self._temp_part1_list.lags[0]=[1]
#
#
# for var in self.adjustable['indep']:
# if var.name != dep:
# print('in the current version, only the lags of the lagged dependent variable can be adjusted')
Expand Down

0 comments on commit dde0626

Please sign in to comment.