# Extracting BFs from anovaBF or any Formal class BFBayesFactor object

Hi,

I am using BayesFactor to run an ANOVA:

model<- anovaBF(dif ~ cond * exp, data=df)

The output appears in the console, but if I want to save it as an object, then the object class for this object is a "Formal class BFBayesFactor". What I need is to extract only the BF10 for a given line, so that I could save this as a row in a new dataframe (this is because I want to run the model on 1000 simulated data sets and see how many of them show an effect of a given size...).

I can get one of the slots of the Formal class object by using @ (e.g. model@bayesFactor). However, the values in the bayesFactor slot do not correspond to the values printed in the console.

How do I get access to the values that are printed in the console?

Thanks in advance,

Naomi

## Comments

You can use

`as.vector()`

:This works, thank you for such a swift and helpful response!

___________________________

Now maybe you could also answer a more conceptual question?

My own dataset gives inconclusive results for my effect of interest (BF10 = ~2).

A reviewer asked how many participants I would have to add to cross my desired strength of evidence (BF10>3), and suggested I run simulations. I thought it makes sense to create a larger sample by creating a fake dataset with the same betas as my actual regression (which I obtained from a non-bayesian analysis):

Now, if I increase the number of rows in my fake data set (let's say from 100 to 300), the strength of evidence should logically increase, am I right? Or maybe it doesn't have to? Because when I do that I get more or less the same result (~700 of my fake datasets give a result around BF10~3, and the rest give a BF~2). Maybe it's my NHT logic at work and it doesn't work this way for a Bayesian analysis?

Generally, BFs are suppose to converge to the "truth" as N increases. So I depends what "truth" your betas are closer to, I guess.

For determining N, you might also be interested in https://github.com/nicebread/BFDA

Well, according to the references on the BDFA page (thank you!!) the evidence should become more conclusive as I increase sample size (either towards H1 or H0, but it should still change). So I must be doing something wrong somewhere.

Hi Naomi,

In general, asymptotically, and on average (!), increasing sample size leads to more conclusive BFs. But for a specific data set, a BF might become

lesscompelling as N grows (up to a point). Also, the BFs may increase (again, on average) only slowly, depending on the details of the model specification -- if the data show a whopper of an effect, evidence will initially increase steeply, but if the effect is modest the change is evidence may only be noticeable for a large increase in sample size.Cheers

E.J.

Thanks!