This is a markdown file
```jlcon other stuff on this line
julia> 1+3 4
julia> error("oops") ERROR: oops in error at error.jl:21
tmle_dynamic_ate <- function(logitQnA1, logitQnA0, gn1, A, Y, d1=1, d0=0, Q_is_logit=TRUE, gbound=0.01){ | |
n <- length(Y) | |
if (length(d1) == 1) d1 <- rep(d1, n) | |
if (length(d0) == 1) d0 <- rep(d0, n) | |
if (length(logitQnA1) != n || | |
length(logitQnA0) != n || | |
length(gn1) != n || | |
length(d1) != n || | |
length(d0) != n || | |
length(A) != n) stop("inputs should all have the same length") |
immutable NullableVector{T} | |
isnull::Vector{Uint8} | |
values::Vector{T} | |
end | |
Base.length(nv::NullableVector) = length(nv.isnull) | |
function Base.getindex(nv::NullableVector{Float64}, i::Integer) | |
return bool(nv.isnull[i]) ? Nullable{Float64}() : Nullable{Float64}(nv.values[i]) | |
end |
julia> function testgetindex(v) | |
@inbounds x = v[1] | |
x | |
end | |
testgetindex (generic function with 1 method) | |
julia> @code_llvm testgetindex(v) | |
define double @"julia_testgetindex;42178"(%jl_value_t*) { | |
top: |
module firmod | |
type FIR{in_t,coef_t} | |
in::Vector{in_t} | |
coef::Vector{coef_t} | |
function FIR (coef::Vector{coef_t}) | |
new (zeros (in_t, size (coef)), copy (coef)) | |
end | |
end |
import Base.convert | |
bitstype 64 IBMFloat64 | |
# ibm float format is hex based: | |
# * bit 1 = sign | |
# * bits 2-8 = exponent to the power of 16, with bias of 64 | |
# * bits 9-64 = mantissa: no implied leading 1 (unlike ieee), | |
# typically normalised (hex of bits 9-12 is non-zero), though this need | |
# not be the case |
make_caret_wrappers <- function(alg_names) { | |
#creates an environment that stors SL wrappers. For a given <name> in alg_names, the wrapper will be | |
# named SL.caret.<name> | |
# alg_names should be a list of names of models provided by the caret pacakge. | |
# see http://caret.r-forge.r-project.org/modelList.html | |
# only set up for binomial family | |
# also, set up to use single split CV internally within caret. This can be changed by fiddling with fitControl, below | |
This is a markdown file
```jlcon other stuff on this line
julia> 1+3 4
julia> error("oops") ERROR: oops in error at error.jl:21
library(Rcpp) | |
cppFunction('NumericVector colVars(NumericMatrix x) { | |
int nrow = x.nrow(), ncol = x.ncol(); | |
NumericVector out(ncol); | |
for (int j = 0; j < ncol; j++) { | |
double mean = 0; | |
double M2 = 0; | |
int n; | |
double delta, xx; |
hdps_screen <- function(outcome, treatment, covars, keep=0, indexes=TRUE) { | |
#outcome and treatment are binary vectors of length n | |
#covars is a matrix of binary variabesl of size n x p, | |
# where p is the number of covariates for in a paritular data dimension | |
#keep: number of covariates to keep | |
# indexes: return indexes or subest of covars | |
# | |
#returns indexes of kept covariates or matrix of kept covars | |
#indexes are sorted by abs(log(multiplicitive bias)) | |
#if keep is 0 or greatner than the number of covars for which multiplicitive bias |