When I run the code below (given by the professor), I got the error
eval(substitute(x), data, parent.frame()) : argument "data" is missing, with no default
Also, I see some use the est=""
and some use the statistics=""
: which one is the right one to use?
I try to include library (dplyr)
and library(statsr)
but that did not solve the problem.
back = as.factor(c(rep("correct", 11), rep("wrong", 1)))
inference(back, est = "proportion", type = "ht", method = "simulation",
success = "correct", null = 0.1, alternative = "greater", seed = 654, nsim = 100)
With a few adjustments (discussed in comments) this seems to work:
back
) as a variable in a data frame, and specify that data frame via the data
argumentest
argument should be called statistic
insteadback <- as.factor(c(rep("correct", 11), rep("wrong", 1)))
dd <- data.frame(back) ## embed the variable in a data frame
inference(back,
data = dd, ## include data argument
statistic = "proportion", ## est -> statistic
type = "ht", method = "simulation",
success = "correct", null = 0.1,
alternative = "greater", seed = 654, nsim = 100)
If you read the help page for ?inference
carefully, you'll see that these answers (especially "should I use est
or statistic
?") are embedded there ...