Billy.Requena <billy.requena <at> gmail.com> writes:
>
> Hi everybody,
>
> I'm interested in evaluating the effect of a continuous variable on the
mean
> and/or the variance of my response variable. I have built functions
> expliciting these and used the 'mle2' function to estimate the
coefficients,
> as follows:
>
> func.1 <- function(m=62.9, c0=8.84, c1=-1.6)
> {
> s <- c0+c1*(x)
> -sum(dnorm(y, mean=m, sd=s,log=T))
> }
>
> m1 <- mle2(func.1, method="SANN")
>
> However, the estimation of the effect of x on the variance of y usually has
> dealt some troubles, resulting in no convergencies or sd of estimates
> extremely huge. I tried using different optimizers, but I still faced the
> some problems.
>
> When I had similar troubles in 'GLMM' statistical universe, I used
bayesian
> functions to solve this problem, enjoyning the flexibility of different
> start points to reach the maximum likelihood estimates. However, I have no
> idea which package or which function to use to solve the specific problem
> I'm facing now.
> Does anyone have a clue?
> Thanks in advance
Unless I'm missing something, you can fit this model
(more easily) in gls() from the nlme package, which allows models
for heteroscedasticity. See ?nlme::varConstPower
gls(y~1,weights=varPower(power=1,form=~x),data)
This gives you a standard deviation proportional to (t1+|v|);
that is, if the baseline residual standard deviation is S, then
the standard deviation is S*(t1+|v|), so S would correspond to
your c1 and S*t1 would correspond to your c0.
Ben Bolker