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

Hard coded variable name x should be avoided #46

Open
mronkko opened this issue May 28, 2020 · 1 comment
Open

Hard coded variable name x should be avoided #46

mronkko opened this issue May 28, 2020 · 1 comment
Labels
bug

Comments

@mronkko
Copy link

@mronkko mronkko commented May 28, 2020

Please specify whether your issue is about:

  • [x ] a possible bug
  • a question about package functionality
  • a suggested code or documentation change, improvement to the code, or feature request

The summary method has a hard coded variable name x. This is problematic: x is quite commonly used as the name for a predictor variable when teaching regression. If we have x as a predictor, the summary method incorrectly selects the predictors as the predicted value and vice versa.

Put your code here:

## load package
library("prediction")

## code goes here

set.seed(12345)
N <- 200

x <- rnorm(N)
y <- x+rnorm(N)

m1 <- lm(y ~ x)

p1 <- prediction(m1, at=list(x=-3:3))
summary(p1)

## session info for your system
sessionInfo()
@leeper leeper added the bug label Jun 20, 2020
@leeper
Copy link
Owner

@leeper leeper commented Jun 20, 2020

If you're able, can you send a pull request that fixes this? Thanks!

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

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.