Hot answers tagged

10

To simulate data with a varying error variance, you need to specify the data generating process for the error variance. As has been pointed out in the comments, you did that when you generated your original data. If you have real data and want to try this, you just need to identify the function that specifies how the residual variance depends on your ...


7

You should try lots of models. The 'no free lunch' theorem states that there is no one best model - every situation is different. Logistic regression for example is desirable when it works because parameters are very interpretable. Random forests are great because they can deal with very difficult patterns, but forget about interpreting them. The point ...


6

Instead of overdispersed (or quasi-)poisson regression you can use the NB1 distribution, which has the same linear variance function as ODP and a full-fledged likelihood function instead of the quasilikelihood of ODP. NB1 is implemented in the gamlss package as family=NBII, whereas regular Negative Binomial can be called through family=NBI. All credit for ...


5

You need to model the heteroskedasticity. One approach is via the R package (CRAN) dglm, dispersion generalized linear model. This is an extension of glm's which, in addition to the usual glm, fits a second glm for dispersion from the residuals from the first glm. I have no experience with such models, but they seem promising ... Here is some code: n <...


5

Sorry i'm quite late with this.... but might help someone i believe : gamlss package is what you should be looking for. It supports almost all the distributions( not just exponential family ones). It gives amazing flexibility on almost all the parameters of a distribution.


5

I have added preliminary support for gamlss to the emmeans package... > emmeans(m1, "site", type = "response") site response SE df asymp.LCL asymp.UCL A 0.02484787 0.01033381 NA 0.01092510 0.05551769 B 0.03821898 0.01775760 NA 0.01518276 0.09290972 C 0.07260824 0.03116918 NA 0.03063369 0.16245783 D 0.18820172 0.04509320 NA 0....


4

The answer below references the inflated beta GAMLSS documentation (Rigby & Stasinopoulos, 2010, section 10.8.2, page 215). It would seem that your data could be fitted with the inflated beta model. The response variable for the $\nu$ component of the model is a ratio of probabilities (an odds) given by $\nu = p_0 / (1-p_0-p_1)$ where $p_0$ is the ...


4

These concepts fall under the subject of Generalized Linear Models. Generalized linear models contain two components A random component. The observed data is distributed according to some distribution. The distribution that generates a single data point comes from a family of distributions. The systematic component. The specific distribution from the ...


4

Regression models aim to estimate a parameter (typically a mean) for a response variable conditional on a (set of) regressor variable(s). To do that, we generally need to specify the nature of the response variable, i.e., its distribution. Standard linear regression assumes the response is conditionally normal and coefficients for the covariates can be ...


4

What Rigby and Stasinoplous' GAMLSS models allow is the modelling of all parameters of a distribution with separate linear predictors. Thomas Yee's Vector Generalised Additive Model (VGAM) class of models also allows for this kind of model to be fitted. More recently, there is a trend to calling such models Distributional Models because of the ability to ...


4

The overall and predictor-specific worm plots share the feature that "different shapes indicate different inadequacies in the model", as explained in the article Analysis of longitudinal multilevel experiments using GAMLSSs by Gustavo Thomas et al: https://arxiv.org/pdf/1810.03085.pdf. Section 12.4 of the book Flexible Regression and Smoothing: ...


4

There seems to be a smooth dependence of variance on observation index, so you could try a joint modeling approach, see for instance Articles that work with covariates for mean, variance, and correlation simultaneously. Maybe also look into if there is autocorrelation (show us a plot!), and tell us what your data represents, and how it was obtained. There ...


3

One point to consider is are you interested in making predictions or understanding associations and carrying out inference (confidence intervals around effects). Although random forests provide a variable-importance summary, this technique is primarily aimed at prediction; there is no inference. Many researchers think they are interested in making ...


3

The glm() function does not support the Weibull distribution in R unfortunately. You can try ?family to see which distributions are available. I would try using survreg() from the survival package instead.


3

In general, you can't select "the best" model using stepwise regression. All statistics produced through stepwise model building have a nested chain of invisible/unstated "conditional on excluding X" or "conditional on including X" statements built into them with the result that: p-values are biased variances are biased parameter estimates are biased F ...


3

the pb() function fits P-splines as described by Eilers and Marx (1996): B-splines on equally spaced knots and finite difference penalties. In the same paper there are some code chunks that show how to fit the model (in the appendix if I remember well). I do not know about the details of the fitted.gamlss method but the code below should be helpful (look at ...


3

A couple of comments: Generalized Linear Mixed Models (GLMMs) have the following general representation: $$\left\{ \begin{array}{l} Y_i \mid b_i \sim \mathcal F_\psi,\\\\ b_i \sim \mathcal N(0, D), \end{array} \right.$$ where $Y_i$ is the response for the $i$-th sample unit and $b_i$ is the vector of random effects for this unit. The response $Y_i$ ...


3

A worm plot is basically a qq plot, so what you are doing is trying to find the best functional form of the covariates that yields a normal quantile Residual. This indicates a better fit. You checked the information criterion, and you could also do a likelihood ratio test. But if the model has a better fit, there isn't anything wrong with cubic splines. I ...


2

It may be that it has changed since this question was written, but it looks as though the random effect is not coded correctly for gamlss. You have it written as "random=~1|Trial," but when I try to run that through gamlss it states that the "|" is not valid for factors. More details on how to code random effects for gamlss is in the manual: http://www....


2

In R, load the package gamlss.tr (for fitting truncated distributions), then: y<-rSICHELtr(1000,2,0.5,-1) hist(y) gen.trun(par=0,family="SICHEL", type="left",delta=0.0001) m1<-gamlss(y~1,family=SICHELtr) summary(m1) The above code generates a sample of 1000 from the truncated SICHEL distribution, then fits it. Note in the simulation mu=2, sigma=0.5 ...


2

The possibility of values being exactly 0 and 1 would seem to rule out the just using the beta for all cases (otherwise I'd have suggested it earlier). One possibility is to use a zero-one inflated beta - which can also be seen as a mixture of a beta and a Bernoulli - a distribution of the mixed type. Conceived either way it will have four parameters; as ...


2

The difference in sample size is not an issue. However, it sounds like your situation may present several possible problems for the Mann-Whitney (some of which might be overcome - I'll come back to this). It also sounds like you a GLM may have problems and you may need a zero-inflated model - since it's the conditional distribution of the response that ...


2

First, you need to formally define the model you want to estimate. Based on your example, you'll want to set a model like this: $$Y_i = \beta_0 +\beta_1 X_i + \epsilon_i$$ where $\epsilon_i \sim N(0, X_i^2 \sigma^2)$ and each error is iid. Similar to a Simple Linear Regression model, there are three parameters to estimate, $\beta_0, \beta_1$ and $\sigma^2$. ...


2

Let's have some simple examples to show the differences. Our example have a single independent variable x and a single dependent variable - either real y or categorical z: x y z ... 0 0.01 A 1 1.98 A 2.01 4.02 B 2.99 6.01 B ... One can see that y grows as x grows and that z=B for values of x grater than something around 1.5. That is an example ...


2

The same website where you link the document has another publication, where they state that the "Global Deviance is -2*max(log likelihood) under hypotheses H0 and H1 respectively." I ran a quick test on my own data, and it seems to match that claim: I ran a simple negative binomial model using gamlss, and it produced a Global Deviance of 6697.049. I then ...


2

Infinitely many answers are possible, some links in comments. One family is the skew-normal, but it only admits limited degrees of skewness. The same ideas used to construct the skew-normal family from the normal family can be used for other families! For empirical modeling with skewness have a look at the gamlss system, which admits many families.


2

Simon Wood, the author of the mgcv package for R and a statistician who has made significant contributions to GAM theory and methods, has developed well-performing Wald-like tests for smooths. As such, you could fit a model with a linear term and a smooth with no null space and then use the test on the smooth term as a test for non-linearity (on the link ...


2

You can simulate some data to see what happens in a simple case: n <- 10 x <- 1:n set.seed(1234) y <- 0.1 + 0.2 * x + rnorm(n, mean = 0, sd = 0.2) library(gamlss) model <- gamlss(y ~ x, family = NO) summary(x) The global deviance reported by R is negative, the reason for this being the fact that the variability of the y observations about ...


2

For your example, for some parameter values $c,d$ the variance will be negative ... for that reason, in such models often is used a log link function for the variance. But such models (and many others) can be fitted with extensions of generalized linear models (glm's), also introducing link functions and linear predictors for the variance (and maybe even for ...


1

There is a paper covering the package, but I'm not sure how much help to you it might be. Based on my understanding the purpose of GAMLSS is to be able to run different models of distribution parameters in the same global model. This is similar to mixed-effects regression where the model is hierarchical, i.e., that equations for parameters at different ...


Only top voted, non community-wiki answers of a minimum length are eligible