Dear list users,
I am estimating a multilevel logistic regression (xtmelogit) with cross-level interactions and I am trying to vizualize the results with predicted values (predicted probabilities). After predicting margins, I do get a plot that makes sense substantively (in terms of shape) and is in line with other visualizations, yet the predicted values apear to be greater than one, which makes no sence if they are probabilties. I use the following code to obtain these values:
xtmelogit polpart_binary2 sex cage ceducation cincome cpolinterest csatisfdem cinternalefficacy c.cexternalefficacy##i.DGOVSPEND CGDP || COUNTRY: cexternalefficacy, intpoints(30)
margins DGOVSPEND, at(cexternalefficacy =(-1.671587 (.5) 2.770934) sex =(0)) atmeans ///
expression(exp(predict(xb)))
matrix b=r(b)'
matrix list b
matrix at=r(at)
matrix list at
matrix at=at[1...,"cexternalefficacy"]#(1\1)
matrix list at
matrix v=r(V)
matrix list v
matrix se=vecdiag(cholesky(diag(vecdiag(v))))'
matrix list se
matrix d=at,b, se
matrix list d
svmat d, names(b)
generate b5 = mod(_n,2) in 1/18
generate ub = b2 + 1.960*b3
generate lb = b2 - 1.960*b3
clist b1-lb in 1/18
graph twoway (line b2 ub lb b1 if b5==0) (line b2 ub lb b1 if b5==1)
I attach the resulting plot.
Could someone explain to me why it is possible that I get predicted values greater than one?
Thanks a lot.
Joost
I am estimating a multilevel logistic regression (xtmelogit) with cross-level interactions and I am trying to vizualize the results with predicted values (predicted probabilities). After predicting margins, I do get a plot that makes sense substantively (in terms of shape) and is in line with other visualizations, yet the predicted values apear to be greater than one, which makes no sence if they are probabilties. I use the following code to obtain these values:
xtmelogit polpart_binary2 sex cage ceducation cincome cpolinterest csatisfdem cinternalefficacy c.cexternalefficacy##i.DGOVSPEND CGDP || COUNTRY: cexternalefficacy, intpoints(30)
margins DGOVSPEND, at(cexternalefficacy =(-1.671587 (.5) 2.770934) sex =(0)) atmeans ///
expression(exp(predict(xb)))
matrix b=r(b)'
matrix list b
matrix at=r(at)
matrix list at
matrix at=at[1...,"cexternalefficacy"]#(1\1)
matrix list at
matrix v=r(V)
matrix list v
matrix se=vecdiag(cholesky(diag(vecdiag(v))))'
matrix list se
matrix d=at,b, se
matrix list d
svmat d, names(b)
generate b5 = mod(_n,2) in 1/18
generate ub = b2 + 1.960*b3
generate lb = b2 - 1.960*b3
clist b1-lb in 1/18
graph twoway (line b2 ub lb b1 if b5==0) (line b2 ub lb b1 if b5==1)
I attach the resulting plot.
Could someone explain to me why it is possible that I get predicted values greater than one?
Thanks a lot.
Joost
Comment