Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

lmBF with polynomial terms

Hi All,

I was wondering whether the BayesFactor package for R support polynomial terms in lmBF. For example, I can run:

lm(formula = DV ~ IV1 + poly(IV2, 2, raw = TRUE), data = data)

I can produce a model, but:

lmBF(formula = DV ~ IV1 + poly(IV2, 2, raw = TRUE), data = data)

fails with error "Error in [.data.frame(data, , vars) : undefined columns selected".

I have tried 'manually specifying the the polynomials in the formula (e.g., I(IV2^2)) to no avail.

I have also tried computing the the variables first (e.g., IV22 = IV2^2), which seems to work. I was wondering if I am doing something wrong here with my model specification, or does BayesFactor not yet support polynomials specified using formula.

Many thanks for a fantastic package!

Charles

Comments

  • edited 9:27PM

    This is not currently supported in the formula itself, but you can create the relevant contrasts as columns in your data frame and then include those in the formula.

  • edited 9:27PM

    Thanks Richard!

Sign In or Register to comment.