Error in ttest at 99% CI

Hi All,
I am tryiung to do an equality test for these two sample at 0.05 confidence interval and 0.01 confidence interval.
I ran this code and got this
t.test(MTFBI~Religion_new,alternative='two.sided',data=d4)
t.test(MTFBI~Religion_new,alternative='less', data=d4)
t.test(MTFBI~Religion_new,alternative='greater', data=d4)

t.test(MTFBI~Religion_new,alternative='less', data=d4)

Welch Two Sample t-test

data: MTFBI by Religion_new
t = 0.21489, df = 1189.5, p-value = 0.5851
alternative hypothesis: true difference in means is less than 0
95 percent confidence interval:
-Inf 1.699051
sample estimates:
mean in group 1 mean in group 2
28.98566 28.78947

However, when i tried solving for the 0.01 CL with is code,
t.test(MTFBI~Religion_new,alternative = "two.sided", mu = 0,
paired = TRUE, var.equal = FALSE, conf.level = 0.99)

I get this error

t.test(MTFBI~Religion_new,alternative = "two.sided", mu = 0,

  •    paired = TRUE, var.equal = FALSE, conf.level = 0.95)
    

Error in eval(predvars, data, env) : object 'MTFBI' not found

Please what am i doing wrong
Thanks

You need to specify the data argument. The function cannot find MTFBI because it is in a data.frame, not the Global environment.

t.test(MTFBI~Religion_new, data = d4, alternative = "two.sided", mu = 0,
       paired = TRUE, var.equal = FALSE, conf.level = 0.95)

I did that and it worked . Thank you

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