Skip to content

Commit

Permalink
Updated c_eff
Browse files Browse the repository at this point in the history
  • Loading branch information
edsandorf committed Aug 14, 2023
1 parent a3c12d3 commit dde82c3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions R/efficiency-criteria.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,12 @@ calculate_c_error <- function(design_vcov, p, dudx, return_all) {
# Undefined if the denominator is not specified
if (is.null(dudx)) {
NA

} else {
# Local overwrite with respect to the actual position for correct subsetting
dudx <- which(names(p) == dudx)

c_eff <- p[-dudx]^-2 *
(diag(design_vcov)[dudx] - 2 *
p[dudx] * p[-dudx]^-1 *
design_vcov[dudx, seq_len(nrow(design_vcov))[-dudx]] +
(p[dudx] / p[-dudx])^2 * diag(design_vcov)[-dudx])
c_eff <- p[-dudx]^-2 * (diag(design_vcov)[dudx] - 2 * p[dudx] * p[-dudx]^-1 * design_vcov[dudx, seq_len(nrow(design_vcov))[-dudx]] + (p[dudx] / p[-dudx])^2 * diag(design_vcov)[-dudx])

# Check if all are to be returned
if (return_all) {
Expand Down

0 comments on commit dde82c3

Please sign in to comment.