I am trying to understand what factors influence temp and humidity but I am not sure what family argument I should be using in my GLM The humidity data is a proportion 0-1 and temp is continuous my model code is as such:

mod4<-glm(average.humid~Age + Mine.size.km2 + canopy.cover.E + canopy.cover.100 + 
                              avarage.sapling.height.in.mine + avarage.canopy.height.at.edge +
                              avarage.canopy.height.100m + number.of.saplings.M + 
                              number.of.saplings.E + number.of.saplings.100m + 
                              Large.trees.Mine + Large.trees.Edge + 
         data = datal, family = gaussian())

I am not sure if Gaussian is the correct code to be used for humidity. It seems to work fine with temp. Is this correct?

  • $\begingroup$ Maybe binomial family. $\endgroup$ Aug 9 at 5:40
  • $\begingroup$ You will puzzle or irritate fewer people by reporting values bounded between 0 and 1 as proportions or fractions, and never as percentages. It's a case where everybody should understand what you mean, but somebody such as myself will dislike the terminology. $\endgroup$
    – Nick Cox
    Aug 22 at 10:57
  • $\begingroup$ A more serious issue is that I understand that relative humidity, which is what you're talking about, is sometimes reported as above 100% or above 1. I've forgotten the physics here, but no statistical routine will understand this except as impossible. $\endgroup$
    – Nick Cox
    Aug 22 at 10:59

1 Answer 1


I believe that a beta regression is what you need.

You have two issues to deal with:

  1. your response variable is bound between 0 (0% humidity) and 1(100% humidity), so the model predictions need to account for that;
  2. the closer the average model predictions are to 0 and 1, the more asymmetrical the distribution of the single observations become around the expected mean. For an average predicted mean humidity of 0%, observed variability can only be 0% or more; for an average predicted mean humidity of 100%, observed variability can only be 100% or less.

Beta regression accounts for these two issues as follows:

  1. it fits a logistic model to the data. A logistic model is sigmoidal i.e. S-shaped and bound between 0 (0%) and 1 (100%);
  2. it assumes that the model residuals follow a beta distribution, which is usually a good approximation when data are rates and proportions (see, for example: https://besjournals.onlinelibrary.wiley.com/doi/epdf/10.1111/1365-2745.13200).

You can fit such a model in R with function betareg() from package betareg: https://www.rdocumentation.org/packages/betareg/versions/3.1-4/topics/betareg

It should also be possible to do so with function glmmTMB() from package glmmTMB:

glmmTMB(humidity~temperature, family=beta_family(link="logit"))

You can (and should) check if your model residuals are "well-behaved" using diagnostic plots. Package DHARMa produces diagnostic plots for generalised linear models and generalised linear mixed-effect models. See: https://cran.r-project.org/web/packages/DHARMa/vignettes/DHARMa.html


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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