I have fitted a model in R programming language. My dependent variable is disease severity and my predictors are weather variables. How can I write this model in mathematical form for a manuscript? Is there a package which can help me write this in mathematical form? I will be making my GitHub repository available, but the idea is to write just model formula in a manuscript. Thank you!

mod1 <- gam(severity ~  s(mean_rh, k = 8) + s(mean_temp, k = 10) + s(mean_ws, k =7) + s(rain, k = 7), family = betar(),  data = data)
  • 2
    $\begingroup$ $\mathbb{E}[g(y_i)] = \sum_{p=1}^P h_p(x_{i,p})$ where $g$ is your link function, $h_p$ is the learned univariate transformation of the $p$th input ($p$ might be mean rh or mean temperature), and $x_{i,p}$ is the actual value of, say, mean temperature for the $i$th observation, and $y_i$ is the severity of the $i$th observation. You would note separately in the narrative the values of $k$ you chose (I don't use R much, these are like spline degrees of freedom or something like that right?). $\endgroup$ Commented Jan 28, 2023 at 15:51
  • $\begingroup$ hmm I'm not sure that this question is an exact duplicate since the linked answer seems to concern a univariate additive model. $\endgroup$ Commented Jan 28, 2023 at 16:15
  • $\begingroup$ As the indicated duplicate question and answer show, there is no simple, useful mathematical formula for the default thin-plate spline smoothers implemented via an s() term in a gam() model. @JohnMadden this question is about a simple sum of additive s() terms, so the difficulty in the linked answer holds here. If regression splines has been specified via bs="cr" within the s() terms, then a formula would be possible (albeit messy). $\endgroup$
    – EdM
    Commented Jan 28, 2023 at 16:16
  • $\begingroup$ @EdM Perhaps not notation that tells us exactly what's going on, but I would argue it's useful to abstract away exactly what the splines are doing and write the formula in terms of abstract univariate transformation as my initial comment suggests. Though I'm not a GAM expert and look forward to hearing others' thoughts on the matter. $\endgroup$ Commented Jan 28, 2023 at 16:20
  • $\begingroup$ @JohnMadden the entry on smooth.terms in the mgcv manual explains that with the default thin-plate spline "a truncated eigen-decomposition is used to achieve the rank reduction," which leads to basis functions that are hard to interpret and would unnecessarily complicate the presentation in a manuscript. For presentation in a manuscript, as this question proposes, a simple statement of the model formula via the s() terms would be most intelligible. In this additive model, plots of outcome versus predictors would illustrate. $\endgroup$
    – EdM
    Commented Jan 28, 2023 at 16:30