Skip to content

need response variable in new data for add_pi #45

@nlichti

Description

@nlichti

Very useful package. I have a minor suggestion: in add_pi (and possibly other functions - I haven't checked), an error is thrown if tb does not include a column for the response variable. The actual values in the column are ignored, but the column has to be present. I'd guess this is due to some internal code similar to:
X <- formula(fit) %>% model.matrix(data = tb)
used to get the design matrix for simulation-based prediction intervals. Using a few more steps should eliminate the need to include the response. Something like:
chr_formula <- formula(fit) %>% deparse() %>% strsplit(' ') %>% getElement(1)
X <- as.formula(chr_formula[-1]) %>% model.matrix(data = tb)
I noticed this specifically with a Poisson GLM. add_ci did not require the response to be in tb.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions