0
$\begingroup$

I have a beta regression model in R, have generated predicted (fitted) values based on my data, and plotted lines of those fitted values on a scatter plot of the actual data. I'm most used to GLMMs, and, at least in practice, have been thinking about the beta regression in a similar way.

However, the fitted values for this additive-only fixed-effects model are not creating a straight line, nor are the slopes the same between groups. I was expecting the fitted values to show the same slope, with different intercepts per group. Was that the wrong expectation? Or does this suggest there is an issue with either my data or implementation?

A plot of y and x_coverage, divided by x_type and site

About the data:

y = a 0 to 1 proportion value of [# individuals in an experiment plot on a vegetation type]/[# individuals found across vegetation types within that plot]

x_coverage = a 0 to 1 proportion value of [amount of a vegetation type in a plot]/[total amount of vegetation measured in that plot]

x_type = a categorical factor of the type of vegetation a measurement was taken on

9 plots in the study (study site was once considered as a random variable, but AICc has me leaving it out), a section of the data:

site plot x_type x_coverage y fit
S1 1 B 0.143312327 0.916667 0.77496105
S1 2 B 0.102556653 0.931034 0.75413317
S1 3 B 0.107069321 0.738462 0.756502
S2 4 B 0.001628412 0.215385 0.69722273
S3 5 B 0 0.631579 0.69624543
S3 6 B 0.002018163 0.545455 0.69745638
S4 7 B 0.161420819 0.938776 0.78380402
S4 8 B 0.09705228 0.741176 0.7512228
S4 9 B 0.02603157 0.90625 0.711652
S1 1 P 0 0.016667 0.08769793
S1 2 P 0 0 0.08769793
S1 3 P 0 0.015385 0.08769793
S2 4 P 0.083824442 0.338462 0.10871038
S3 5 P 0 0 0.08769793
S3 6 P 0 0 0.08769793
S4 7 P 0 0.020408 0.08769793
S4 8 P 0.44368743 0.223529 0.2531569
S4 9 P 0 0.03125 0.08769793
S1 1 T 0.343765489 0.066667 0.09710628
S1 2 T 0.570017432 0.034483 0.16978323
S1 3 T 0.848919012 0.246154 0.31109899
S2 4 T 0.412763648 0.415385 0.11569752
S3 5 T 0.595125254 0.236842 0.18007354
S3 6 T 0.534252719 0.090909 0.15594049
S4 7 T 0.83374445 0 0.30193773
S4 8 T 0.364015573 0.035294 0.10226738
S4 9 T 0.52603157 0.0625 0.1528916

About the model:

gamlss(data=newbyplotvegpred, y ~ x_coverage + x_type, family="BEINF0")

Used a zero-inflated hurdle model version of the beta regression (BEINF0), as y contains zero-values (which are fairly believable as real zeros given our methods). Transforming the data and using plain BE changed the fitted values, but not the fact that slopes varied by vegetation type. Double checks with package betareg and glmmtmb give essentially the same results. Predicted values were generated by predict(MODEL, type = "response). Not specifying type, defaults to values scaled to the predictor vars (as I understand it), and indeed produce same-slope lines. But truly wacky intercepts. Fitted values put into ggplot with geom_point and geom_line (< 10 data points, catches an error for geom_smooth).

Any thoughts on what's up with these regression lines I'm plotting. The summary(MODEL) output is sensible, and I feel like that aspect of the our approach has been reasonable. Thank you!

$\endgroup$
0
0
$\begingroup$

geom_line by default produces smoothed lines within plotted points. I'd like to know if you tried the following, which can probably solve this for you:

plot + 
stat_smooth(method = 'lm', se = F)

If you don't specify that your method derives from a linear model (method = 'lm'), stat_smooth function will produce the same connect the dots line as geom_line .

$\endgroup$
1
  • 1
    $\begingroup$ Yeah, so that indeed makes linear lines, thanks. However, another user pointed out to me that beta regression runs a logit link (or probit/cloglog by specification), which aren't necessarily linear. So that doesn't bug me anymore. However, linear or not, the plot still shows different slopes per line (or curve), which I'm still wrapping my head around as I the fit data from an additive model that I thought would shift the intercept by group, but not change the shape/slope of the line. $\endgroup$ – igwill Jan 14 at 1:41
0
$\begingroup$

In gamlss BEINF0(mu, sigma,nu) Y has a point probability at zero p_0 = P(Y=0) = nu/(1+nu) and has a BE(mu, sigma) distribution on (0,1) with probability (1-p0).

Hence E(Y) = mu/(1+nu)

On the predictor scale eta = logit(mu) you will get parallel lines against x. But on the mu scale you will get S shaped curves shifted horizontally, (but only shown for x from 0 to 1, if you limit the range for x).

For full details see:

'Flexible Regression and Smoothing: Using GAMLSS in R’ M. D. Stasinopoulos, R. A. Rigby, G. Z. Heller, V. Voudouris and F. De Bastiani. Chapman and Hall/CRC, Boca Raton, 2017

Hardback (2017) www.routledge.com/9780367658069 Paperback (2020): www.routledge.com/9781138197909

‘Distributions for Modeling Location, Scale, and Shape: Using GAMLSS in R’ R. A. Rigby, M. D. Stasinopoulos, G. Z. Heller and F. De Bastiani. Chapman and Hall/CRC, Boca Raton, 2019

Hardback (2019) www.routledge.com/9780367278847

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.