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

Error in get_prm() when SAEM is the estimation method #196

Open
AndreasCalvagone opened this issue Sep 15, 2021 · 2 comments
Open

Error in get_prm() when SAEM is the estimation method #196

AndreasCalvagone opened this issue Sep 15, 2021 · 2 comments
Labels

Comments

@AndreasCalvagone
Copy link

Hello, I was getting the following error when trying to produce a parameter table from an SAEM model:

get_prm(xp,show_all = T,transform = FALSE)
Returning parameter estimates from $prob no.1, subprob no.0, method saem
Error in if (n_theta != length(theta_names)) { : 
  missing value where TRUE/FALSE needed
In addition: Warning messages:
1: Unknown columns: `OBJ` 
2: Unknown columns: `OBJ` 
3: Unknown columns: `OBJ` 

The issue is that when using SAEM the the last column of the .ext file is called SAEMOBJ. This column is not excluded in the get_iter() function. I could simply patch this bug by correcting get_iter():

grab_iter <-
function (ext, iter) 
{
    out <- ext %>% dplyr::filter(.$ITERATION == iter) %>% dplyr::select(-dplyr::one_of("ITERATION", 
        "OBJ","SAEMOBJ"))  # added SAEMOBJ here
    if (nrow(out) == 0) 
        out[1, ] <- NA_real_
    purrr::flatten(out)
}
@bguiastr
Copy link
Collaborator

bguiastr commented Oct 4, 2021

Thanks for reporting this issue and for the proposed fix, I will implement this in future releases!!

@bguiastr bguiastr added the bug label Oct 4, 2021
@jpryby
Copy link

jpryby commented Oct 7, 2024

Since there is a potential for MCMCOBJ as well, I'd suggest selecting OBJ with dplyr::match(".*OBJ$")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants