BiologicalRecordsCentre / BRCindicators

An R package for creating indicators from trends data
4 stars 11 forks source link

Updates to BMA functionality #47

Closed drnickisaac closed 4 years ago

AugustT commented 4 years ago

Fixed a conflict in the description file (we both updated the authors)

AugustT commented 4 years ago

@drnickisaac the example in bma fails

data <- data.frame(species = rep(letters, each = 50),
                    year = rep(1:50, length(letters)),
                    index = runif(n = 50 * length(letters), min = 0, max = 1),
                    se = runif(n = 50 * length(letters), min = 0.01, max = .1))

 # Run the Bayesian meta-analysis
 bma_indicator <- bma(data, model="Smooth")
Error in tolower(model) : object 'model' not found
AugustT commented 4 years ago

@drnickisaac There are more issues. Rather than me trying to tackle this can I ask you to run your examples and address all the errors that you get and then put in a new pull request?

AugustT commented 4 years ago
# Create some example data in the format required
 data <- data.frame(species = rep(letters, each = 50),
                    year = rep(1:50, length(letters)),
                    index = runif(n = 50 * length(letters), min = 0, max = 1),
                    se = runif(n = 50 * length(letters), min = 0.01, max = .1))

 # Run the Bayesian meta-analysis
 bma_indicator <- bma(data, model="Smooth")
Error in jags.model(file = model.file, data = data, inits = inits, n.chains = n.chains,  : 

Error parsing model file:
syntax error on line 48 near "{"
AugustT commented 4 years ago

@drnickisaac nudge

drnickisaac commented 4 years ago

@drnickisaac nudge

Done!

AugustT commented 4 years ago

Hi @drnickisaac are you not getting these errors on your local version?

 data <- data.frame(species = rep(letters, each = 50),
                   year = rep(1:50, length(letters)),
                   index = runif(n = 50 * length(letters), min = 0, max = 1),
                   se = runif(n = 50 * length(letters), min = 0.01, max = .1))

# Run the Bayesian meta-analysis
bma_indicator <- bma(data, model="Smooth")
[1] "Warning: No negative index values detected. Are you sure you transformed the data?"
Processing function input....... 
Done. 

Error in jags.model(file = model.file, data = data, inits = inits, n.chains = n.chains,  : 

Error parsing model file:
syntax error on line 48 near "{"
drnickisaac commented 4 years ago

Doh!

  1. The example data had not been converted to the logit (or log) scale. I've now changed that in the example. We should think about whether there's a better way to explain this, since the other methods take untransformed data. For now though, let's just get it working.
  2. Second problem fixed. This model is perhaps not the best choice for a default, since it's the least tested! But that's a problem for next week when I start working on Steve's manuscript again.
AugustT commented 4 years ago

The problem persists. I suggest looking closely at your syntax once you have parsed your bugs code for smooth, it looks like there is a bug in there. It might be a good idea to write some tests for this function so that you can catch this before the pull request stage.

drnickisaac commented 4 years ago

@AugustT I think the check failure is only on code coverage, not a bug in my code. Correct?

AugustT commented 4 years ago

Correct, all green on Travis

AugustT commented 4 years ago

In she goes. Thanks for getting this over the line