-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
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
hardcoded for binary func
#295
Comments
This issue is still relevant, but this PR changes the |
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 |
6 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: