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

Add option to print the true model used during the method #16

Open
mihaiconstantin opened this issue Apr 30, 2022 · 0 comments
Open

Add option to print the true model used during the method #16

mihaiconstantin opened this issue Apr 30, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@mihaiconstantin
Copy link
Owner

Would be nice to be able to see what the true model looked like. Currently, we can only extract the true model from StepOne via the $true_model_parameters field.

Some thoughts on this:

  • since powerly will support more types of models, the responsibility for deciding how to plot the true model should lie with the specific model classes (i.e., with the users that propose new models)

  • then, in the plot method of the Method class add an argument model = FALSE that when TRUE will call the plot method of the corresponding model used

powerly/R/Method.R

Lines 233 to 260 in 0dbadcf

if (last) {
# Plot the right step from the last iteration.
if (step == 1) {
plot.StepOne(object$step_1, save = save, path = path, width = width, height = height, ...)
} else if (step == 2) {
plot.StepTwo(object$step_2, save = save, path = path, width = width, height = height, ...)
} else if (step == 3) {
plot.StepThree(object$step_3, save = save, path = path, width = width, height = height, ...)
} else {
stop("Incorrect step specification.")
}
} else {
# Prevent plotting of previous results if it converged on first iteration.
if (object$iteration > 1) {
# Plot the right step from the previous iteration.
if (step == 1) {
plot.StepOne(object$previous$step_2$step_1, save = save, path = path, width = width, height = height, ...)
} else if (step == 2) {
plot.StepTwo(object$previous$step_2, save = save, path = path, width = width, height = height, ...)
} else if (step == 3) {
plot.StepThree(object$previous, save = save, path = path, width = width, height = height, ...)
} else {
stop("Incorrect step specification.")
}
} else {
warning("No previous results. Method converged on first iteration.")
}
}

  • otherwise, the plot will just be one of the method steps
@mihaiconstantin mihaiconstantin added the enhancement New feature or request label Apr 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

1 participant