Skip to content
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

remove weights, rename to inv_var_weights -- and add a second type of… #27

Merged
merged 2 commits into from
Dec 7, 2023

Conversation

ericward-noaa
Copy link
Contributor

@ericward-noaa ericward-noaa commented Oct 23, 2023

Proposing changing the weights argument to two arguments:
inv_var_weights for weights similar to how they're being used now. And likelihood_weights for the glmmTMB/sdmTMB/brms style

Example of long format data

s <- sim_dfa(num_trends = 1, num_years = 20, num_ts = 3)
obs <- c(s$y_sim[1, ], s$y_sim[2, ], s$y_sim[3, ])
long <- data.frame("obs" = obs, "ts" = sort(rep(1:3, 20)), "time" = rep(1:20, 3))
long$likelihood_weight <- runif(nrow(long),0.01,1) # these might be CVs for example
long$inv_var_w <- 1/(long$likelihood_weight ^ 2)

# fit model with weights in likelihood
m <- fit_dfa(y = long, data_shape = "long", iter = 50, chains = 1, likelihood_weights = "likelihood_weight")
# fit model with inv var weighting 
m <- fit_dfa(y = long, data_shape = "long", iter = 50, chains = 1, inv_var_weights = "inv_var_w")

@ericward-noaa ericward-noaa merged commit e0bbe7f into main Dec 7, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant