You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes the user may set the intervention node (g^*) to NA. If this value is actually being applied, then we should produce a warning, since the resulting weights will be also NA.
fit=function(overwrite=FALSE, data, ...) { # Move overwrite to a field? ... self$overwriteself$n<-data$nobsself$define.subset.idx(data)
private$probA1<-data$get.outvar(TRUE, self$gstar.Name)
# private$.isNA.probA1 <- is.na(private$probA1)# self$subset_idx <- rep.int(TRUE, self$n)self$subset_idx<- seq_len(self$n)
private$.outvar<-data$get.outvar(TRUE, self$getoutvarnm) # Always a vector of 0/1# private$.isNA.outvar <- is.na(private$.outvar)self$is.fitted<-TRUE# **********************************************************************# to save RAM space when doing many stacked regressions wipe out all internal data:# self$wipe.alldat# **********************************************************************invisible(self)
},
predictAeqa=function(newdata, ...) { # P(A^s[i]=a^s|W^s=w^s) - calculating the likelihood for indA[i] (n vector of a`s)
assert_that(self$is.fitted)
if (missing(newdata)) {
indA<-self$getoutvarval
} else {
indA<-newdata$get.outvar(self$getsubset, self$getoutvarnm) # Always a vector of 0/1
}
assert_that(is.integerish(indA)) # check that observed exposure is always a vector of integersprobAeqa<- rep.int(1L, self$n) # for missing values, the likelihood is always set to P(A = a) = 1.# probA1 <- private$probA1[self$getsubset]probA1<-private$probA1probAeqa[self$getsubset] <-probA1^(indA) * (1-probA1)^(1L-indA)
self$wipe.alldat# to save RAM space when doing many stacked regressions wipe out all internal data:return(probAeqa)
},
`
The text was updated successfully, but these errors were encountered:
Sometimes the user may set the intervention node (g^*) to
NA
. If this value is actually being applied, then we should produce a warning, since the resulting weights will be alsoNA
.The best place to catch it is probably here:
https://github.com/osofr/stremr/blob/master/R/DeterministicBinaryOutcomeModel.R#L29-L44
Or here (
private$probA1
is the g^*):https://github.com/osofr/stremr/blob/master/R/DeterministicBinaryOutcomeModel.R#L53-L67
The text was updated successfully, but these errors were encountered: