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

Adding set seed to confidence interval analysis #90

Merged
merged 2 commits into from
Nov 18, 2024

Conversation

jvli4n
Copy link
Contributor

@jvli4n jvli4n commented Nov 12, 2024

Adding a set seed option to the confidence interval analysis in the Learn Stats module.
Additionally, adding a dependency for the tree plot table, so it disappears when the check box is no longer selected.

fix: jasp-stats/jasp-issues#2993

Adding a set seed option to the confidence interval analysis in the Learn Stats module.
Additionally, adding a dependency for the tree plot table, so it disappears when the check box is no longer selected.
@jvli4n jvli4n requested a review from FBartos November 12, 2024 16:40
Copy link
Collaborator

@FBartos FBartos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An issue is that the output (tables and figures) do not refreshe once seed is set / changed. (The data are correctly simulated and stored in the container, however, since both seed dependencies are not on the output elements, they do not change-they were already created. -- I can explain a bit more about the states and output logic of JASP in person on Thursday)

I think a question is where the Set seed option would fit the best in the menu. Do you have any preference @EJWagenmakers ? I think it would might be better hidden at the bottom of the menu?

image

Also, should we also add this to the remaining analyses in the "Learn Stats" module since we are already looking into it?

return()
}

.getConfidenceContainer <- function(jaspResults) {
confidenceContainer <- jaspResults[["confidenceContainer"]] %setOrRetrieve% createJaspContainer(dependencies = c("mu", "sigma", "n", "confidenceIntervalInterval", "nReps", "treePlot"))
confidenceContainer <- jaspResults[["confidenceContainer"]] %setOrRetrieve% createJaspContainer(dependencies = c("mu", "sigma", "n", "confidenceIntervalInterval", "nReps", "treePlot", "seed"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
confidenceContainer <- jaspResults[["confidenceContainer"]] %setOrRetrieve% createJaspContainer(dependencies = c("mu", "sigma", "n", "confidenceIntervalInterval", "nReps", "treePlot", "seed"))
confidenceContainer <- jaspResults[["confidenceContainer"]] %setOrRetrieve% createJaspContainer(dependencies = c("mu", "sigma", "n", "confidenceIntervalInterval", "nReps", "treePlot", "setSeed", "seed"))

The SetSeed{} QML function actually has two parts, the checkbox (for enabling/disabling the seed) and the integerfield with the actual seed value. You need to set both into the dependencies, otherwise disabling the checkbox would not re-generate new results with a random seed (the expected behavior when seed is disabled).

You can check the option names used by checking the R code of the .setSeedJASP() function:

> jaspBase::.setSeedJASP
function(options) {

  if (is.list(options) && all(c("setSeed", "seed") %in% names(options))) {
    if (isTRUE(options[["setSeed"]]))
      set.seed(options[["seed"]])
  } else {
    # some analysis (t-test) have common functions for computations, however, only some of the offer seed in the interface - therefore, this error message is disabled for the moment
    # stop(paste(".setSeedJASP was called with an incorrect argument.",
    #            "The argument options should be the options list from QML.",
    #            "Ensure that the SetSeed{} QML component is present in the QML file for this analysis."))
  }
}

@EJWagenmakers
Copy link

Yes, hidden seems better...

1) Adding dependency on checkbox
2) Changing position of Repeatability to be at the end after divider
@jvli4n jvli4n requested a review from FBartos November 16, 2024 17:47
@FBartos FBartos merged commit 4b48e52 into jasp-stats:master Nov 18, 2024
5 checks 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.

[Feature Request]: Set seed option in Learn stats - confidence interval
3 participants