I have a question about marginal_effects: I thought that the marginal effects plot would give me the same probabilities (from a logistic regression model) as "fitted". However, it doesn't seem to be the case and I'm wondering why. Here's a marginal effect plot:
m2 <- brm_multiple(transition ~ GenderCognition.z,family=binomial(link="logit"),data=data1.short,prior=m2priors)
marginal_effects(m2)
From this plot you'd think that the predicted score for a person with a score of .5 on the x-variable is between .2 and .3. Now for the fitted values:
> fitted(object = m2,newdata =data.frame(GenderCognition.z = seq(-1.5,.5, 0.1)),allow_new_levels = TRUE)
Using the maximum response value as the number of trials.
Only 2 levels detected so that family 'bernoulli' might be a more efficient choice.
Estimate Est.Error 2.5%ile 97.5%ile
[1,] 0.09496612 0.07085960 0.01286031 0.2798268
[2,] 0.10469542 0.07242305 0.01647652 0.2896980
[3,] 0.11554677 0.07382603 0.02101507 0.3004928
[4,] 0.12764293 0.07500860 0.02678388 0.3117016
[5,] 0.14111401 0.07590138 0.03407742 0.3233585
[6,] 0.15609520 0.07642652 0.04311651 0.3353746
[7,] 0.17272316 0.07650019 0.05444389 0.3479582
[8,] 0.19113072 0.07603789 0.06850000 0.3614977
[9,] 0.21143963 0.07496368 0.08562145 0.3756603
[10,] 0.23375088 0.07322548 0.10618030 0.3901145
[11,] 0.25813268 0.07081863 0.13055160 0.4059183
[12,] 0.28460638 0.06782001 0.15924051 0.4232239
[13,] 0.31313126 0.06443301 0.19177586 0.4433088
[14,] 0.34359007 0.06103594 0.22691224 0.4655358
[15,] 0.37577821 0.05820666 0.26375395 0.4919214
[16,] 0.40939983 0.05666195 0.29952325 0.5214995
[17,] 0.44407411 0.05704601 0.33324913 0.5567750
[18,] 0.47935342 0.05962631 0.36312906 0.5963512
[19,] 0.51475211 0.06414149 0.38948707 0.6397166
[20,] 0.54978165 0.06995015 0.41200293 0.6839591
[21,] 0.58398559 0.07631368 0.43157967 0.7283315
Warning message:
In max(out$Y, na.rm = TRUE) :
no non-missing arguments to max; returning -Inf
Here it looks like the expected probability for a person with a score of .5 on the x-variable is .58. Should this be expected? What am I missing here?