I'm working my way through a Coursera Course and could use an explanation of how to do the code for this question:

To quantify the magnitude of the differences in mean birth weight, we can use a credible interval. Change the type argument to "ci" to construct and record a credible interval for the difference between the weights of babies born to nonsmoking and smoking mothers, and interpret this interval in context of the data. Note that by default you'll get a 95% credible interval. If you want to change the confidence level, change the value for cred_level which takes on a value between 0 and 1. Also note that when doing a credible interval arguments like null and alternative are not useful, so make sure to remove them, but include the prior mean mu_0.

This is what I have:

bayes_inference(y = weight, x = habit, data = nc_fullterm, 
            statistic = "mean", 
            type = "ci", null = 0,
            prior = "JZS", mu_0 = 7.7, rscale = sqrt(2)/2, 
            method = "theoretical", cred_level = 0.95)

And I'm getting this error:

Error in BayesFactor::ttestBF(x = y1, y = y2, mu = mu_0, rscale = rscale, : Use of nonzero null hypothesis not implemented for independent samples test.

I'm not quite sure what this means (assume I'm a complete beginner here).

If I leave the alternative and null arguments in, it seems to work. Any ideas?


closed as off-topic by kjetil b halvorsen, mdewey, user158565, whuber Jan 10 at 17:30

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – kjetil b halvorsen, mdewey, user158565, whuber
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.