# Difference between family = gaussian() and family = cox.ph(link='identity') in GAM and family = binomial(link="logit")

I wonder how do u decide if family = gaussian() or family = cox.ph(link='identity') or family = binomial(link="logit") in GAM ( generalized additive model ) is suitable for the analysis? For my case, my dependent variable is in the form of percentage from 0 - 100%. Stage is a form of time variable. comparison_type is the two different activities performed by the same individual over a specific stage, which means time.

My end goal is to see if there is any significant difference in patterns between the two activities performed by the same individual over time.

library(gam)
library(mgcv)

b <- gam(ssim_exp ~ s(stage, k = 4, fx = TRUE, by = comparison_type) + comparison_type, data = df, family = cox.ph(link='identity'))
summary(b)



The distribution of my dependent variable looks like the below

Any input?

None of these distributions are suitable for the data you describe, which are bounded at some upper and lower value, but are continuous between the two bounds. If the data were recast to the interval 0-1, then you could look at the beta distribution (family = betar()) in {mgcv}, but you can't have true 0s and 1s (100%) in that family ({mgcv} will adjust the data so that the 0s are just slightly greater than 0, and the 1s slightly less than 1). If you have many such values, then zero-one-inflated beta models (which combine separate models for the 0s, 1s, and everything else) would be a starting point. But that distribution is not available in {mgcv}; you could look at {brms} for example as an option in that case.