ProjectMOSAIC / mosaic

Project MOSAIC R package
http://mosaic-web.org/
93 stars 26 forks source link

mosaic::confint() options #726

Closed nicholasjhorton closed 5 years ago

nicholasjhorton commented 5 years ago

library(mosaic) mod <- lm(pcs ~ mcs, data = HELPrct) confint(mod, conf.level = 0.90) # gives 95% interval, since correct option is "level" confint(mod, level = 0.90)

Does it make sense to add an additional option for mosaic::confint() that accepts "conf.level" as an alias for "level"?

rpruim commented 5 years ago

The generic for confint() is defined in the stats package where the signature is set as

confint
#> function (object, parm, level = 0.95, ...) 
#> UseMethod("confint")
#> <bytecode: 0x7ff9c897d770>
#> <environment: namespace:stats>

Created on 2019-01-10 by the reprex package (v0.2.1)

We could add an alias to each of the methods we define, but it would not work globally, only where we have created new methods. That could lead to errors in other situations, so I'm not sure it is worth it.

nicholasjhorton commented 5 years ago

I concur with @rpruim. I suggest instead that we include examples of changing the confidence level in some of our examples to make this more obvious.

rpruim commented 5 years ago

example(confint) already includes one such example.

rpruim commented 5 years ago

I had another idea:

 library(mosaic)
confint(rnorm(100), conf.level = 0.90)

#> Error in confint.numeric(rnorm(100), conf.level = 0.9):  Use `level` to set the confidence level, not `conf.level`.

Created on 2019-01-10 by the reprex package (v0.2.1)

nicholasjhorton commented 5 years ago

I like it!

All the best,

Nick

On Jan 10, 2019, at 4:18 PM, Randall Pruim notifications@github.com wrote:

I had another idea:

library(mosaic) confint(rnorm(100), conf.level = 0.90)

> Error in confint.numeric(rnorm(100), conf.level = 0.9): Use level to set the confidence level, not conf.level.

Created on 2019-01-10 by the reprex package (v0.2.1)

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or mute the thread.