Hypothesis Testing using R

Hello!

I have been trying to use the inference function;

inference(y = data1$temperature, x= data1$country, data = X3041588,
statistic = c(("mean")),
type=c ("ci"),
null = 0,
alternative= c("twosided"),
method=c ("theoretical"),
conf_level = 0.99,
order= c("A", "B"))

After using this, Im constantly getting the error- Error in ci_two_mean_theo(y = y, x = x, conf_level = conf_level, y_name = y_name, :
could not find function "ci_two_mean_theo"

Please help out.

Hi @tnsh11 ,
Welcome to the Posit/RStudio Community Forum.

Your code is not reproducible because we don't have your data, or know which package the inference() function comes from. See the posting guide about how to make a good reproducible example. However, I suspect your code should look like this:

library(????)
inference(y = temperature, x = country, data = data1,
  statistic = "mean",
  type = "ci",
  null = 0,
  alternative = "twosided",
  method = "theoretical",
  conf_level = 0.99,
  order = c("A", "B"))

Hope this helps.

Hi @DavoWW,

Thank you for your quick response.

I have used the below package for the inference.

library(statsr)

inference(y = data1$temperature, x = data1$country, data = X3041588,
statistic = "mean",
type="ci",
null = 0,
alternative= "twosided",
method="theoretical",
conf_level = 0.99,
order= c ("country A", "country B")
)

Now, the error shows - Categorical variable has more than 2 levels, confidence interval is undefined,
use ANOVA to test for a difference between means

Please see attached image, to view the data.

The error says that country has more than two levels. What is the result of

unique(data1$country)

As @DavoWW pointed out, the beginning of your call to inference() should be

inference(y = temperature, x = country, data = data1,

What is X3041588?

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.