# Evaluating tensor effect at specific predictor values in brms, ignoring all other effects

• Operating System: Windows 10
• brms Version: 2.13.0

I’ve fit a distributional model of the following form:

``````fit = brm(
bf(response ~ A + t2(X, Y) + (1|G/F),
response ~ A + t2(X, Y) + (1|G/F)),
data = model_data,
family = gaussian())
``````

`A` is a factor with two levels, while `X` and `Y` are Cartesian coordinates that describe location within a circle.

I would like to evaluate the tensor term `t2()` only (i.e., with all other effects set to zero) at the `X` and `Y` values used to fit the model, but have not been successful in using either `conditional_smooths()` or `conditional_effects()`, even when trying to pass the `X` and `Y` data into int_conditions. Using `conditional_smooths()` results in a finely evaluated mesh across the entire marginal domains of the predictors (so I get a rectangular surface rather than circular), whereas the latter seems to only evaluate the predictor `X` and `Y` coordinates conditioning on a specific value of `Y` or `X`, respectively.

Using `fitted()` with the newdata argument set to the X, Y values gives the desired result for the expected predicted response, but in this case I’m interested in purely the effect of the tensor. Is there a way of using `fitted()` such that all other model terms are set to zero / ignored?

Thank you!

Sorry for taking so long respond.

I don’t think you can do this easily in the current version. You can ignore the varying intercept `(1|G/F)` via the `re_formula` argument, but you can’t similarly get rid of the `A` fixed effect and the intercept.

You can however use `posterior_samples` to extract the tensor parameters and then compute the tensor yourself.

Alternatively, what should work would be to use `fitted` or `posterior_linpred` to get the predictor without the varying intercept, then use `posterior_samples` to obtain the samples for the fixed effect and intercept and then subtract `intercept_samples + b_A_samples * A` from the predictor, leaving you with just the `t2` term… This is a bit hacky, but if evaluating the tensor yourself is out of the question, it could help.

Does that make sense?

Best of luck with your model!

Thanks, @martinmodrak, we had the same thought - that’s exactly what I ended up doing :).

At some point i will replace the re_formula argument with a more general one that allows to select terms much more flexibly.