We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
jackknife_variance
func
In jackknife.jl line 152,
jackknife.jl
θhj = func(design.data[!, x], rep_weights)
The func will only apply over a single data vector x. This is fine for mean and total, but wont work for ratio, which needs y
x
mean
total
ratio
y
In general case, we need a type system here so that func with different number of args can work here
The text was updated successfully, but these errors were encountered:
This issue is still relevant, but this PR changes the jackknife_variance function and calls it variance: #297
variance
Sorry, something went wrong.
We can do the following:
function variance(x::Vector{Symbol}, func::Function, design::ReplicateDesign{BootstrapReplicates}) θ̂ = func(design.data, x, design.weights) θ̂t = [ func(design.data, x, "replicate_"*string(i)) for i = 1:design.replicates ] variance = sum.((θ̂t .- θ̂) .^ 2) ./ design.replicates return DataFrame(estimator = θ̂, SE = sqrt(variance)) end
function ratio(df::DataFrame, columns, weights) return sum(df[!, columns[1]], StatsBase.weights(df[!, weights])) / sum(df[!, columns[2]], StatsBase.weights(df[!, weights])) end
In the case of GLM,
function glm_tmp(df::DataFrame, columns, weights, link, family) formula_str = string("$(columns[1]) ~ ", join(columns[2:end], " + ")) formula = eval(Meta.parse("@formula($formula_str)")) coef(glm(formula, data, link, family)) end
@nadiaenh can you try this?
Can you also accept args, and kwargs in the variance functions and pass them to func? @nadiaenh
args
kwargs
ayushpatnaikgit
codetalker7
nadiaenh
Successfully merging a pull request may close this issue.
In
jackknife.jl
line 152,The
func
will only apply over a single data vectorx
. This is fine formean
andtotal
, but wont work forratio
, which needsy
In general case, we need a type system here so that
func
with different number of args can work hereThe text was updated successfully, but these errors were encountered: