Skip to content

Commit

Permalink
Small change
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobSeedorff21 committed Aug 31, 2023
1 parent ff0e146 commit 21d0fa3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/StepwiseMethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ List ForwardCpp(NumericMatrix x, NumericVector y, NumericVector offset,
const arma::imat Interactions(interactions.begin(), interactions.rows(),
interactions.cols(), false, true);
arma::ivec BestModel(keep.begin(), keep.size(), false, true);
BestModel.replace(1, 0);
arma::ivec Indices(indices.begin(), indices.size(), false, true);
arma::ivec CurModel = BestModel;
arma::mat xTemp = GetMatrix(&X, &CurModel, &Indices);
Expand Down Expand Up @@ -183,13 +184,13 @@ List BackwardCpp(NumericMatrix x, NumericVector y, NumericVector offset,
const arma::imat Interactions(interactions.begin(), interactions.rows(),
interactions.cols(), false, true);
arma::ivec BestModel(keep.begin(), keep.size(), false, true);
BestModel.replace(0, 1);
arma::ivec Indices(indices.begin(), indices.size(), false, true);
arma::ivec CurModel = BestModel;
arma::mat xTemp = GetMatrix(&X, &CurModel, &Indices);
IntegerVector order(CurModel.n_elem, - 1);
arma::ivec Order(order.begin(), order.size(), false, true);


// Getting X'WX
arma::mat XTWX = X.t() * X;

Expand All @@ -202,7 +203,6 @@ List BackwardCpp(NumericMatrix x, NumericVector y, NumericVector offset,

// Performing Backward elimination
for(unsigned int i = 0; i < steps; i++){

bool flag = true;
CurModel = BestModel;
drop1(&X, &XTWX, &Y, &Offset, &Interactions, method, m, Link, Dist, &CurModel, &BestModel,
Expand Down

0 comments on commit 21d0fa3

Please sign in to comment.