Skip to content

Commit 8037708

Browse files
Fix a bug.
Fix a bug that displayed an incorrect rho squared metric when a Nested Model was used.
1 parent 52ddbd5 commit 8037708

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

PyKernelLogit/nested_logit.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,8 +541,18 @@ def fit_mle(self,
541541
fixed_params.extend(constrained_pos)
542542
final_constrained_pos = sorted(list(set(fixed_params)))
543543

544+
545+
num_nests = len(self.nest_spec) # Obtain the number of nests
546+
# Set the initial vector of the nest parameters to 40. Note that the 40
547+
# corresponds to scale parameter that is numericalle indistinguishable
548+
# from 1.0
549+
nest_initial_vector = np.ones(num_nests)*40
550+
initial_parm_vector = np.zeros(init_vals.shape[0] - num_nests)
551+
544552
# Create the estimation object
545-
zero_vector = np.zeros(init_vals.shape)
553+
zero_vector = np.concatenate((nest_initial_vector, initial_parm_vector),
554+
axis=0)
555+
546556
estimator_args = [self,
547557
mapping_res,
548558
PMLE,

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
# Versions should comply with PEP440. For a discussion on single-sourcing
2222
# the version across setup.py and the project code, see
2323
# https://packaging.python.org/en/latest/single_source_version.html
24-
version='0.1.3',
24+
version='0.1.4',
2525

2626
description='Maximum likelihood estimation of conditional logit models \
2727
using Kernel Logistic Regression (KLR)',

0 commit comments

Comments
 (0)