Error when trying to plot conditional effects of brm fit

66 views Asked by At

I recently tried fitting and plotting the conditional effects of a bayesian regression of the below dataset using the following code:

minnow_model <- brms::brm(formula = Num_Chub ~ Depth_bin * veg_cover * set_dur_hr, family = zero_inflated_poisson, data = minnow_glm, init = "random", iter = 10000)
      
plot(minnow_model)
plot(brms::conditional_effects(minnow_model))

In previous applications, this has worked fine and produced the posterior plots and conditional plots. Despite this, when I attempted to reuse code from before fit to this data, I am running into this error:

Error in tcrossprod(b, X) : "tcrossprod" is not a BUILTIN function
Error: Something went wrong (see the error message above). Perhaps you transformed numeric variables to factors or vice versa within the model formula? If yes, please convert your variables beforehand. Or did you set a predictor variable to NA?

I'm at a loss on this error since I cannot see anywhere that I've created a factor variable or set one to NA

1, 2, 1, 1, 1, 0, 0, 0, 0, 0, 3, 0, 1, 0, 0, 0, 2, 0, 1, 1, 1, 
1, 0, 1, 0, 2, 0, 0, 0, 5, 2, 1, 1, 7, 0, 0, 0, 4, 2, 1, 3, 0, 
2, 1, 0, 0, 0, 2, 0, 1, 1, 1, 0, 2, 0, 0, 0, 0, 0, 4, 0, 0, 1, 
1, 3, 5, 1, 1, 0, 0, 0, 0, 2, 0, 0, 3, 0, 1, 0, 1, 0, 1, 1, 0, 
1, 1, 1, 1, 1, 6, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 1, 5, 3, 0, 
1, 0, 0, 2, 1, 0, 1, 7, 0, 0, 2, 3, 8, 4, 0, 3, 0, 0, 1, 0, 0, 
1, 0, 0, 0, 2, 2, 4, 2, 2, 2, 5, 0, 0, 7, 1, 0, 0, 0, 1, 1, 0, 
0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 2, 2, 2, 1, 1, 2, 0, 4, 3, 3, 2, 
2, 1, 0, 0, 1, 2, 0, 3, 1, 4, 3, 1, 1, 3, 6, 0, 2, 1, 2, 1, 2, 
5, 0, 3, 3, 2, 1, 0, 0, 5, 0, 3, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 
1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0.35, 0.35, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.5, 1, 1, 
1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.45, 0.45, 1, 0.5, 1, 1, 1, 
0.35, 0.35, 0.15, 0.15, 0.45, 0.45, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
1, 1, 1, 1, 1, 0.5, 0.45, 0.5, 0.5, 0.5, 0.5, 1, 1, 1, 1, 0.15, 
0.35, 0.35, 0.45, 0.45, 0.35, 0.35, 0.35, 0.35, 0.35, 1, 1, 1, 
1, 0.5, 0.5, 0.5, 0.45, 0.5, 1, 1, 1, 0.5, 0.45, 0.45, 1, 1, 
1, 1, 1, 1, 1, 0.35, 0.35, 0.35, 0.45, 0.35, 0.35, 0.35, 1, 0.5, 
0.5, 0.45, 0.45, 1, 1, 1, 0.35, 0.15, 0.35), set_dur_hr = c(1.11805555555556, 
1.085, 1.11722222222222, 1.12972222222222, 1.02527777777778, 
0.997222222222222, 0.987777777777778, 1.06083333333333, 1.07, 
1.08472222222222, 1.0375, 0.853055555555555, 0.751388888888889, 
0.758055555555556, 0.757777777777778, 0.754444444444444, 0.765833333333333, 
0.930833333333333, 0.943888888888889, 0.943888888888889, 1.01222222222222, 
0.997222222222222, 1.06527777777778, 1.01055555555556, 0.978888888888889, 
0.937222222222222, 0.932222222222222, 1.06666666666667, 1.06638888888889, 
1.05861111111111, 1.08277777777778, 1.07138888888889, 1.01722222222222, 
1.07027777777778, 0.898333333333333, 0.803055555555556, 0.751111111111111, 
1.00388888888889, 0.978333333333333, 1.00888888888889, 1.64694444444444, 
1.62694444444444, 1.61027777777778, 1.59111111111111, 1.56611111111111, 
1.20444444444444, 1.19083333333333, 1.19861111111111, 1.15111111111111, 
1.08138888888889, 1.03916666666667, 1.01027777777778, 0.890277777777778, 
0.862777777777778, 0.8825, 0.855555555555556, 0.861388888888889, 
0.855833333333333, 1.0775, 1.06861111111111, 1.03138888888889, 
1.00777777777778, 0.985555555555556, 0.9675, 0.953333333333333, 
0.933055555555556, 0.938888888888889, 0.918055555555556, 1.38805555555556, 
1.34277777777778, 1.345, 1.40722222222222, 1.24805555555556, 
1.20583333333333, 1.19361111111111, 1.21583333333333, 1.11277777777778, 
1.18777777777778, 1.06166666666667, 1.0075, 0.9925, 0.974444444444444, 
0.964444444444444, 1.14972222222222, 0.971111111111111, 0.966388888888889, 
1.02694444444444, 1.02861111111111, 1.03722222222222, 0.993611111111111, 
1.08305555555556, 1.12055555555556, 1.14027777777778, 1.1275, 
1.2, 1.10638888888889, 1.17305555555556, 1.18611111111111, 1.17666666666667, 
1.18194444444444, 1.05916666666667, 1.20388888888889, 1.12777777777778, 
1.11305555555556, 1.16083333333333, 1.13027777777778, 1.12944444444444, 
1.12555555555556, 1.13972222222222, 1.05472222222222, 1.08583333333333, 
1.07361111111111, 1.31083333333333, 1.35666666666667, 1.36916666666667, 
1.34527777777778, 1.38833333333333, 1.43611111111111, 1.44194444444444, 
1.47805555555556, 1.54083333333333, 1.3775, 1.40611111111111, 
1.41388888888889, 1.75527777777778, 1.65944444444444, 1.61416666666667, 
1.60138888888889, 1.60416666666667, 1.55305555555556, 1.27666666666667, 
1.26361111111111, 1.26833333333333, 1.25388888888889, 1.36138888888889, 
1.31194444444444, 1.26555555555556, 1.36861111111111, 1.17638888888889, 
1.125, 1.09, 1.275, 1.14611111111111, 1.28666666666667, 1.30305555555556, 
1.135, 1.31416666666667, 1.14361111111111, 1.30638888888889, 
1.30333333333333, 1.28111111111111, 1.07194444444444, 1.0425, 
1.06166666666667, 1.04666666666667, 1.06055555555556, 1.07055555555556, 
1.04916666666667, 1.01611111111111, 1.02027777777778, 1.00055555555556, 
1.05611111111111, 1.04805555555556, 1.0375, 1.03, 1.01388888888889, 
1.02916666666667, 1.00361111111111, 1.00111111111111, 0.975555555555556, 
0.8725, 0.923055555555556, 0.92, 16.9977777777778, 16.9888888888889, 
17.1847222222222, 16.9525, 17.2447222222222, 17.1047222222222, 
16.3511111111111, 16.2858333333333, 16.5088888888889, 16.2911111111111, 
16.3136111111111, 16.3413888888889, 16.3663888888889, 16.4336111111111, 
16.7961111111111, 17.6608333333333, 17.6461111111111, 17.6663888888889, 
18.0411111111111, 18.015, 17.9622222222222, 17.9177777777778, 
17.8241666666667, 17.8527777777778, 17.8063888888889, 17.7719444444444, 
17.6705555555556, 17.6702777777778, 17.0244444444444, 16.0636111111111, 
16.0116666666667, 16.8563888888889, 16.8305555555556, 16.8913888888889, 
16.8830555555556, 16.8741666666667, 15.7952777777778, 15.8719444444444, 
1.14694444444444, 1.04888888888889, 1.065, 1.01222222222222, 
1.09944444444444, 0.941111111111111, 0.910833333333333, 0.820833333333333, 
0.777222222222222, 0.735555555555556, 22.3055555555556, 22.3141666666667, 
22.2866666666667, 22.2663888888889, 22.2625, 22.2580555555556, 
22.2391666666667, 22.2069444444444, 22.2091666666667, 22.04, 
22.0244444444444, 21.7861111111111, 21.6363888888889, 21.5886111111111, 
21.4666666666667, 21.435, 21.4127777777778, 21.3761111111111, 
21.3402777777778, 21.4447222222222, 21.13, 21.0936111111111, 
21.12, 21.1280555555556, 21.1180555555556, 21.1008333333333, 
21.1086111111111, 21.0369444444444, 20.9561111111111, 20.9358333333333, 
20.9086111111111, 20.9216666666667, 21.1127777777778, 21.0152777777778, 
21.0411111111111, 20.9283333333333, 20.8433333333333, 20.885, 
20.9241666666667, 20.9480555555556, 21.7147222222222, 21.6247222222222, 
21.6258333333333, 21.6255555555556, 21.4777777777778, 21.41, 
21.3813888888889, 21.2902777777778, 21.2294444444444, 21.1716666666667
)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA, 
-271L))```
0

There are 0 answers