0

I'm trying to fit a glm in R My code is the following:

mod1 <- glm(formula = DV ~ IV1*IV2, data = df).

where IV1: between-subjects independent variable; IV2: within-subject independent variable

The DV distribution (not the residual!) is approximately an ex-gaussian.

Which "family" argument should I use? Any tips are welcome, thanks!

  • Are you sure DV is ex-gaussian? What is your justification for this? – Demetri Pananos Dec 28 '21 at 16:47
  • library(gamlss) library(gamlss.dist) library(gamlss.add)

    fit <- fitDist(df$DV, k = 2, type = "realplus", trace = FALSE, try.gamlss = TRUE) This is the output that I get from this: Family: c("exGAUS", "ex-Gaussian") Fitting method: "nlminb"

    – Gianluca Dec 28 '21 at 16:48
  • 1
    That performs maximum likelihood estimation (I presume) on the marginal distribution. Regression concerns the conditional distribution (the distribution of the outcome conditioned on the predictors). This is not a valid justification for an ex-gaussian family. See my answer here for more on this. – Demetri Pananos Dec 28 '21 at 18:27
  • Thank you a lot for this! May I ask you I could I determine (accurately) the *conditional* distribution of the data? with code, possibly? – Gianluca Dec 28 '21 at 18:51
  • Can you tell us more about DV? What is it? How is it measured? – Demetri Pananos Dec 28 '21 at 20:26
  • the DV consists of a continuous variable. Its values could range from 0 to 100. Given a statement, participants had to answer using a VAS scale ranging from 0 = “strongly disagree” to 50 = “neither agree nor disagree” to 100 = “strongly agree”. – Gianluca Dec 29 '21 at 02:41
  • and DV can take on any value from 0 to 100? Could it take 47.7 for example, or is it restricted to whole numbers? – Demetri Pananos Dec 29 '21 at 03:06
  • it can take any value – Gianluca Dec 29 '21 at 03:32
  • More important to understand how the variance is related to the mean, but i strongly suggest you stop looking at your data to choose your models. What sort of quantity does your response variable measure - e.g. is it a time, a length, a proportion, a count, an angle, ...etc? When you say it can take any value, do you mean it can be negative? If not, could some values be exactly 0? – Glen_b Dec 29 '21 at 16:47
  • I should clarify -- I am not suggesting that looking at data is a bad way to come up with a model, just that using the same data you want to use for inference to choose a model has undesirable properties. – Glen_b Jan 01 '22 at 23:33

0 Answers0