Re: [R-sig-phylo] mixed phylogenetic model in MCMCglmm

2019-10-12 Thread HADFIELD Jarrod
Yes - all random effects (in MCMCglmm and other software) have zero expectation.


On 12 Oct 2019, at 17:07, Oscar Inostroza 
mailto:oskinostr...@gmail.com>> wrote:

I didn't know that! Now all makes sense. I thought the value corresponded to 
the actual estimate of the parameter. So, for the intercerpt it's the same?

El sáb., 12 de oct. de 2019 a la(s) 04:54, HADFIELD Jarrod 
(j.hadfi...@ed.ac.uk) escribió:
Hi,

The random slopes are deviations. You need to add the fixed effect associated 
with x to get the actual slopes. Does this deal with your reservations?

Cheers,

Jarrod

On 12 Oct 2019, at 08:18, Oscar Inostroza 
mailto:oskinostr...@gmail.com>> wrote:

Hi,
thank you for your attention. My data consists of 1820 observations (species) 
grouped in 11 levels (I know that it is a lot!). I mean "crazy" estimates 
because if I run the models separately for each level (i.e. trimmed the 
database at each level), there is a very strong positive relationship between x 
and y. However, when running the full model, the slopes and intercepts are very 
different (e.g. negative or null slopes).

El sáb., 12 de oct. de 2019 a la(s) 03:51, HADFIELD Jarrod 
(j.hadfi...@ed.ac.uk) escribió:
Hi Oscar,

The syntax and prior look fine. How many levels of group are there and what do 
you mean by crazy?

Cheers,

Jarrod


> On 12 Oct 2019, at 04:54, Oscar Inostroza 
> mailto:oskinostr...@gmail.com>> wrote:
>
> I'm trying to run a mixed phylogenetic model using the function in the
> MCMCglmm R package of the same name. In this model, I want to estimate
> slopes and intercepts for each level of a given variable (modeled as a
> random effect). I tried to run the model with the following code. However,
> the estimates of slopes and intercepts for the random effect are crazy!
> (i.e. when running separate models for each level, the results are
> reasonable) There is something wrong with my code? (in the syntax of the
> model, or likely in the prior specification)
>
> prior<- list(G=list(G1=list(V=1, nu=0.002), G2=list(V=diag(2), nu=2,
> alpha.mu= rep(0,2), alpha.V=diag(1000,2,2))), R=list(V=1, 
> nu=0.002))
>
> model<-MCMCglmm(y~x, random=~phylo +
> us(1+x):group,family="gaussian",ginverse=list(phylo=inv.phylo$Ainv),prior=prior,data=data,nitt=nitt,burnin=burn,thin=thin,
> pr=TRUE)
>
> Cheers
>
> p.s the same model, but in the syntax used by brms has the form:
>
> model <- brm(y ~ x +(1|phylo)+(1+x|group), cov_ranef = list(phylo = A)...
>
> (But it's too slow for my amount of data)
>
> --
> Oscar
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-phylo mailing list - 
> R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

The University of Edinburgh is a charitable body, registered in Scotland, with 
registration number SC005336.


--
Oscar Inostroza Michael
Biólogo
Magíster Ciencias (m) Zoología
Programa Doctorado en Sistemática y Biodiversidad
Laboratorio de Ecología Evolutiva y Filoinformática
Facultad de Ciencias Naturales Y Oceanográficas
Universidad de Concepción
Barrio Universitario s/n, Casilla 160-C
Concepción, CHILE

Fono Oficina: (56) 41 - 220 – 7341

e-mail: oskinostr...@gmail.com
   oscarinostr...@udec.cl

Pagina Web: http://phyloevolecol.cl/inostroza-michael/



--
Oscar Inostroza Michael
Biólogo
Magíster Ciencias (m) Zoología
Programa Doctorado en Sistemática y Biodiversidad
Laboratorio de Ecología Evolutiva y Filoinformática
Facultad de Ciencias Naturales Y Oceanográficas
Universidad de Concepción
Barrio Universitario s/n, Casilla 160-C
Concepción, CHILE

Fono Oficina: (56) 41 - 220 – 7341

e-mail: oskinostr...@gmail.com
   oscarinostr...@udec.cl

Pagina Web: http://phyloevolecol.cl/inostroza-michael/


[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


Re: [R-sig-phylo] mixed phylogenetic model in MCMCglmm

2019-10-12 Thread Oscar Inostroza
Hi,
thank you for your attention. My data consists of 1820 observations
(species) grouped in 11 levels (I know that it is a lot!). I mean "crazy"
estimates because if I run the models separately for each level (i.e.
trimmed the database at each level), there is a very strong positive
relationship between x and y. However, when running the full model, the
slopes and intercepts are very different (e.g. negative or null slopes).

El sáb., 12 de oct. de 2019 a la(s) 03:51, HADFIELD Jarrod (
j.hadfi...@ed.ac.uk) escribió:

> Hi Oscar,
>
> The syntax and prior look fine. How many levels of group are there and
> what do you mean by crazy?
>
> Cheers,
>
> Jarrod
>
>
> > On 12 Oct 2019, at 04:54, Oscar Inostroza 
> wrote:
> >
> > I'm trying to run a mixed phylogenetic model using the function in the
> > MCMCglmm R package of the same name. In this model, I want to estimate
> > slopes and intercepts for each level of a given variable (modeled as a
> > random effect). I tried to run the model with the following code.
> However,
> > the estimates of slopes and intercepts for the random effect are crazy!
> > (i.e. when running separate models for each level, the results are
> > reasonable) There is something wrong with my code? (in the syntax of the
> > model, or likely in the prior specification)
> >
> > prior<- list(G=list(G1=list(V=1, nu=0.002), G2=list(V=diag(2), nu=2,
> > alpha.mu= rep(0,2), alpha.V=diag(1000,2,2))), R=list(V=1, nu=0.002))
> >
> > model<-MCMCglmm(y~x, random=~phylo +
> >
> us(1+x):group,family="gaussian",ginverse=list(phylo=inv.phylo$Ainv),prior=prior,data=data,nitt=nitt,burnin=burn,thin=thin,
> > pr=TRUE)
> >
> > Cheers
> >
> > p.s the same model, but in the syntax used by brms has the form:
> >
> > model <- brm(y ~ x +(1|phylo)+(1+x|group), cov_ranef = list(phylo = A)...
> >
> > (But it's too slow for my amount of data)
> >
> > --
> > Oscar
> >
> > [[alternative HTML version deleted]]
> >
> > ___
> > R-sig-phylo mailing list - R-sig-phylo@r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> > Searchable archive at
> http://www.mail-archive.com/r-sig-phylo@r-project.org/
>
> The University of Edinburgh is a charitable body, registered in Scotland,
> with registration number SC005336.
>


-- 
Oscar Inostroza Michael
Biólogo
Magíster Ciencias (m) Zoología
Programa Doctorado en Sistemática y Biodiversidad
Laboratorio de Ecología Evolutiva y Filoinformática
Facultad de Ciencias Naturales Y Oceanográficas
Universidad de Concepción
Barrio Universitario s/n, Casilla 160-C
Concepción, CHILE

Fono Oficina: (56) 41 - 220 – 7341

e-mail: oskinostr...@gmail.com
   oscarinostr...@udec.cl

Pagina Web: http://phyloevolecol.cl/inostroza-michael/

[[alternative HTML version deleted]]

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/


Re: [R-sig-phylo] mixed phylogenetic model in MCMCglmm

2019-10-12 Thread HADFIELD Jarrod
Hi Oscar,

The syntax and prior look fine. How many levels of group are there and what do 
you mean by crazy?

Cheers,

Jarrod


> On 12 Oct 2019, at 04:54, Oscar Inostroza  wrote:
>
> I'm trying to run a mixed phylogenetic model using the function in the
> MCMCglmm R package of the same name. In this model, I want to estimate
> slopes and intercepts for each level of a given variable (modeled as a
> random effect). I tried to run the model with the following code. However,
> the estimates of slopes and intercepts for the random effect are crazy!
> (i.e. when running separate models for each level, the results are
> reasonable) There is something wrong with my code? (in the syntax of the
> model, or likely in the prior specification)
>
> prior<- list(G=list(G1=list(V=1, nu=0.002), G2=list(V=diag(2), nu=2,
> alpha.mu= rep(0,2), alpha.V=diag(1000,2,2))), R=list(V=1, nu=0.002))
>
> model<-MCMCglmm(y~x, random=~phylo +
> us(1+x):group,family="gaussian",ginverse=list(phylo=inv.phylo$Ainv),prior=prior,data=data,nitt=nitt,burnin=burn,thin=thin,
> pr=TRUE)
>
> Cheers
>
> p.s the same model, but in the syntax used by brms has the form:
>
> model <- brm(y ~ x +(1|phylo)+(1+x|group), cov_ranef = list(phylo = A)...
>
> (But it's too slow for my amount of data)
>
> --
> Oscar
>
> [[alternative HTML version deleted]]
>
> ___
> R-sig-phylo mailing list - R-sig-phylo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
> Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/

The University of Edinburgh is a charitable body, registered in Scotland, with 
registration number SC005336.

___
R-sig-phylo mailing list - R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Searchable archive at http://www.mail-archive.com/r-sig-phylo@r-project.org/