• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

imbroglio-dc / concrete / #17

08 Sep 2023 04:21AM UTC coverage: 23.74% (-55.2%) from 78.898%
#17

push

travis-pro

imbroglio-dc
CRAN compatibilty + R Journal paper

832 of 832 new or added lines in 7 files covered. (100.0%)

325 of 1369 relevant lines covered (23.74%)

0.68 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/rcpp_getCleverCovariate.cpp
1
// -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; indent-tabs-mode: nil; -*-
2
//
3
// we only include RcppArmadillo.h which pulls Rcpp.h in for us
4
#include "RcppArmadillo.h"
5
// via the depends attribute we tell Rcpp to create hooks for
6
// RcppArmadillo so that the build process will know what to do
7
//
8
// [[Rcpp::depends(RcppArmadillo)]]
9
//
10
// via the exports attribute we tell Rcpp to make this function
11
// available from R
12
//
13
// [[Rcpp::export]]
14
arma::dmat getCleverCovariate(arma::dvec GStar, 
×
15
                              arma::dmat NuisanceWeight, 
16
                              arma::dmat hFS, 
17
                              int LeqJ) {
18
    for (arma::uword i = 0; i < NuisanceWeight.n_cols; ++i) {
×
19
        NuisanceWeight.col(i) = GStar(i) * NuisanceWeight.col(i);
×
20
    }
21
    return NuisanceWeight % (LeqJ - hFS);
×
22
}
23

24
// [[Rcpp::export]]
25
arma::dmat getHazLS(arma::dvec T_Tilde,
×
26
                    arma::dvec EvalTimes,
27
                    arma::dmat HazL) {
28
    for (arma::uword i = 0; i < HazL.n_cols; ++i) {
×
29
        HazL.col(i) = (EvalTimes <= T_Tilde(i)) % HazL.col(i);
×
30
    }
31
    return HazL;
×
32
}
33

34
// Needs Debugging
35
// // [[Rcpp::export]]
36
// arma::cube updateHazardsCpp(arma::dvec J,
37
//                             arma::dvec TargetTimes,
38
//                             arma::dvec L, 
39
//                             arma::cube Hazards, 
40
//                             arma::dmat TotalSurv,
41
//                             arma::dvec EvalTimes,
42
//                             arma::dvec GStar, 
43
//                             arma::dmat NuisanceWeight,  
44
//                             arma::dvec PnEIC, 
45
//                             double StepSize) {
46
//     arma::cube UpdatedHaz(size(Hazards), arma::fill::zeros);
47
//     for (arma::uword l = 0; l < Hazards.n_slices; l++) {
48
//         for (arma::uword j = 0; j < J.size(); j++) {
49
//             int LeqJ = L(l) == J(j);
50
//             arma::dmat Fjt = Hazards.slice( arma::as_scalar(arma::find(L == J(j))) ) % TotalSurv;
51
//             Fjt = arma::cumsum(Fjt, 0);
52
//             for (arma::uword k = 0; k < TargetTimes.size(); k++) {
53
//                 arma::dmat hFS(Fjt.n_rows, Fjt.n_cols, arma::fill::zeros);
54
//                 arma::uword RowK = arma::as_scalar(arma::find(EvalTimes == TargetTimes(k)));
55
//                 hFS.rows(0, RowK) = arma::repmat(arma::dmat(Fjt.row(RowK)), RowK+1, 1);
56
//                 hFS.rows(0, RowK) = (hFS.rows(0, RowK) - Fjt.rows(0, RowK)) % TotalSurv.rows(0, RowK);
57
//                 arma::dmat hG(hFS.n_rows, hFS.n_cols, arma::fill::zeros);
58
//                 arma::vec TLeqTk(hG.n_rows, arma::fill::zeros);
59
//                 TLeqTk.head(RowK+1).ones();
60
//                 for (arma::uword i = 0; i < NuisanceWeight.n_cols; i++) {
61
//                     hG.col(i) = GStar(i) * TLeqTk % NuisanceWeight.col(i);
62
//                 }
63
//                 UpdatedHaz.slice(l) = UpdatedHaz.slice(l) + hG % (LeqJ - hFS) * PnEIC(j*TargetTimes.size() + k);
64
//             }
65
//         }
66
//     }
67
//     for (arma::uword m=0; m < UpdatedHaz.n_slices; m++) {
68
//         UpdatedHaz.slice(m) = Hazards.slice(m) % arma::exp(UpdatedHaz.slice(m) * StepSize);
69
//     }
70
//     return UpdatedHaz;
71
// }
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc