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

Marginal plots cause error using different approaches #270

Open
InkaSpy opened this issue Nov 28, 2024 · 0 comments
Open

Marginal plots cause error using different approaches #270

InkaSpy opened this issue Nov 28, 2024 · 0 comments

Comments

@InkaSpy
Copy link

InkaSpy commented Nov 28, 2024

Hello,
thank you in advance for having a look at it. We are currently writing functions for internal use, that can plot the model predicitions considering only a single independent variable to vary. I understand that modelbased is providing these functions already, but I am having some issues when trying them.

According to my understanding the above described intention should be carried out accordingly:

fit <- lm(mpg ~ cyl + disp + gear, data = mtcars)
result <-  estimate_means(fit, by = "disp", fixed = c("cyl", "gear"))
plot(result)

Unfortunately, when I run this I get the following error:
Error in rlang::sym():
! Can't convert a character vector to a symbol.

I tried other plotting options like:

result <- estimate_relation(fit)
plot(result)

where I get the following error:
Error in geom_from_list():
! Problem while computing aesthetics.
ℹ Error occurred in the 2nd layer.
Caused by error:
! object 'interaction(gear, disp)' not found

Of course the plot cannot easily depict the prediction with respect to four variables, but I cannot find out how to select the variables that should be considered for plotting.

Another approach I tried is:

result <- estimate_expectation(fit)
plot(result)

where I get the same error as before:
Error in geom_from_list():
! Problem while computing aesthetics.
ℹ Error occurred in the 2nd layer.
Caused by error:
! object 'interaction(gear, disp)' not found

I find it kind strange that for the last two examples the interaction(gear,disp) object is required even though my model does not contain any interactions and I am also wondering why it is focusing on only this interaction.

I look forward to your response!

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

No branches or pull requests

1 participant