Re: [R-sig-eco] random effects in a linear mixed model

2011-08-22 Thread Edgar Torres
Dear all,

I tried for the model that Christian suggested, I think it makes sense, 
regarding the vessels, they are not present for all years, I chose vessels that 
had at least 50% fishing between 1981 and 2008, and these vessels at least had 
150 days in the sea by year. The indicators are estimated as the sum by year or 
the month average.
Well, if I well understand, the random effects obteined by ranef() represent 
the variation in the random effects, is it true? Because I take these values 
and apply the Bayesian Change Point Analysis and I have reasonable sudden 
changes. I tried with an indicator that I know when he changes by technology 
improvement.

What you think?

Thanks a lot!

Edgar




De: "Dunbar, Michael J." 
Para: Christian Parker ; "r-sig-ecology@r-project.org" 

Enviado: Lunes, 22 de agosto, 2011 15:43:14
Asunto: Re: [R-sig-eco] random effects in a linear mixed model

Edgar

I agree with what Chris says

(1 + BOAT | fYEAR) makes no sense

It is probably 

(1|BOAT) + (1|fYEAR) that you want

Providing you have enough boats and years to estimate variance components for 
these two factors: please feel free to post any further queries but you will 
need to provide more information on the data if people are to give useful help.

Clearly boat is random, making year a factor and then random is a useful 
simplification to compare variances providing it makes sense to your research 
question.

Regards
Mike


-Original Message-
From: r-sig-ecology-boun...@r-project.org 
[mailto:r-sig-ecology-boun...@r-project.org] On Behalf Of Christian Parker
Sent: 20 August 2011 17:44
To: Elizabeth Green
Cc: r-sig-ecology@r-project.org
Subject: Re: [R-sig-eco] random effects in a linear mixed model

Edgar,

Based on the information provided its difficult to thoroughly answer your
question. But I will assume that you have samples within each year, say
weekly or monthly. Based on this I would say that you can treat the years as
a random effect but I dont think that I would do it the way that you have
specified

LMM2 <- lmer(Op_Obj ~ BOAT
+ (1 + BOAT | fYEAR), data=YM, family=gaussian, na.action=na.omit,
verbose=T)

Which tests for a difference in Op_Obj across boats and allowing that
difference to vary from year to year. Instead I think you are interested in
whether Op_Obj (either average or as a function of other predictors
measured) and you want to allow that relationship to vary by both boat and
year. So I would suggest that if you want to allow the relationship to vary
from year to year that you also include boat as a random variable. I believe
the syntax is like this:


LMM2 <- lmer(Op_Obj ~ 1 +(1|BOAT)+(1| fYEAR), data=YM)

Which is basically an anova design where you allow the intercept to vary by
boat and year. If you are interested in covariates you would include them in
place of the 1 on the "fixed" effects side of the model. And if you wanted
to allow their slopes to vary you would include them in place of the 1's on
the "random" effects side of the model.

There always seems to be a good discussion going in the mixed effects
discussion group as to the definition of fixed and random effects and how to
model them (e.g http://andrewgelman.com/2010/12/so-called_fixed/) but I am
curious as to what advice others on this list have.

Cheers,
Chris Parker

On Fri, Aug 19, 2011 at 11:05 AM, Elizabeth Green wrote:

>
> On Aug 19, 2011, at 2:00 AM, 
> r-sig-ecology-request@r-**project.orgwrote:
>
>
>>  1. Random effects in a linear mix model (Edgar Torres)
>>
>>
> Edgar, the random effects represent the variable that has an effect, but
> not an effect that is likely to be biologically interesting, in this case,
> your fishing vessel. The effects you want to test are the fixed effects, in
> this case time, because you want to see how your variable varies by year,
> accounting for the random effects of the different vessels fishing.
>
> bessie
>
> ~~**~~
> Bessie Green
>  907-388-4496
> http://mercury.bio.uaf.edu/~**elizabeth_green/<http://mercury.bio.uaf.edu/%7Eelizabeth_green/>
>
> __**_
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/**listinfo/r-sig-ecology<https://stat.ethz.ch/mailman/listinfo/r-sig-ecology>
>

    [[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
-- 
This message (and any attachments) is for the recipient ...{{dropped:12}}

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] random effects in a linear mixed model

2011-08-22 Thread Dunbar, Michael J.
Edgar

I agree with what Chris says

(1 + BOAT | fYEAR) makes no sense

It is probably 

(1|BOAT) + (1|fYEAR) that you want

Providing you have enough boats and years to estimate variance components for 
these two factors: please feel free to post any further queries but you will 
need to provide more information on the data if people are to give useful help.

Clearly boat is random, making year a factor and then random is a useful 
simplification to compare variances providing it makes sense to your research 
question.

Regards
Mike


-Original Message-
From: r-sig-ecology-boun...@r-project.org 
[mailto:r-sig-ecology-boun...@r-project.org] On Behalf Of Christian Parker
Sent: 20 August 2011 17:44
To: Elizabeth Green
Cc: r-sig-ecology@r-project.org
Subject: Re: [R-sig-eco] random effects in a linear mixed model

Edgar,

Based on the information provided its difficult to thoroughly answer your
question. But I will assume that you have samples within each year, say
weekly or monthly. Based on this I would say that you can treat the years as
a random effect but I dont think that I would do it the way that you have
specified

LMM2 <- lmer(Op_Obj ~ BOAT
+ (1 + BOAT | fYEAR), data=YM, family=gaussian, na.action=na.omit,
verbose=T)

Which tests for a difference in Op_Obj across boats and allowing that
difference to vary from year to year. Instead I think you are interested in
whether Op_Obj (either average or as a function of other predictors
measured) and you want to allow that relationship to vary by both boat and
year. So I would suggest that if you want to allow the relationship to vary
from year to year that you also include boat as a random variable. I believe
the syntax is like this:


LMM2 <- lmer(Op_Obj ~ 1 +(1|BOAT)+(1| fYEAR), data=YM)

Which is basically an anova design where you allow the intercept to vary by
boat and year. If you are interested in covariates you would include them in
place of the 1 on the "fixed" effects side of the model. And if you wanted
to allow their slopes to vary you would include them in place of the 1's on
the "random" effects side of the model.

There always seems to be a good discussion going in the mixed effects
discussion group as to the definition of fixed and random effects and how to
model them (e.g http://andrewgelman.com/2010/12/so-called_fixed/) but I am
curious as to what advice others on this list have.

Cheers,
Chris Parker

On Fri, Aug 19, 2011 at 11:05 AM, Elizabeth Green wrote:

>
> On Aug 19, 2011, at 2:00 AM, 
> r-sig-ecology-request@r-**project.orgwrote:
>
>
>>  1. Random effects in a linear mix model (Edgar Torres)
>>
>>
> Edgar, the random effects represent the variable that has an effect, but
> not an effect that is likely to be biologically interesting, in this case,
> your fishing vessel. The effects you want to test are the fixed effects, in
> this case time, because you want to see how your variable varies by year,
> accounting for the random effects of the different vessels fishing.
>
> bessie
>
> ~~**~~
> Bessie Green
>  907-388-4496
> http://mercury.bio.uaf.edu/~**elizabeth_green/<http://mercury.bio.uaf.edu/%7Eelizabeth_green/>
>
> __**_
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/**listinfo/r-sig-ecology<https://stat.ethz.ch/mailman/listinfo/r-sig-ecology>
>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
-- 
This message (and any attachments) is for the recipient only. NERC
is subject to the Freedom of Information Act 2000 and the contents
of this email and any reply you make may be disclosed by NERC unless
it is exempt from release under the Act. Any material supplied to
NERC may be stored in an electronic records management system.
___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


Re: [R-sig-eco] random effects in a linear mixed model

2011-08-20 Thread Christian Parker
Edgar,

Based on the information provided its difficult to thoroughly answer your
question. But I will assume that you have samples within each year, say
weekly or monthly. Based on this I would say that you can treat the years as
a random effect but I dont think that I would do it the way that you have
specified

LMM2 <- lmer(Op_Obj ~ BOAT
+ (1 + BOAT | fYEAR), data=YM, family=gaussian, na.action=na.omit,
verbose=T)

Which tests for a difference in Op_Obj across boats and allowing that
difference to vary from year to year. Instead I think you are interested in
whether Op_Obj (either average or as a function of other predictors
measured) and you want to allow that relationship to vary by both boat and
year. So I would suggest that if you want to allow the relationship to vary
from year to year that you also include boat as a random variable. I believe
the syntax is like this:


LMM2 <- lmer(Op_Obj ~ 1 +(1|BOAT)+(1| fYEAR), data=YM)

Which is basically an anova design where you allow the intercept to vary by
boat and year. If you are interested in covariates you would include them in
place of the 1 on the "fixed" effects side of the model. And if you wanted
to allow their slopes to vary you would include them in place of the 1's on
the "random" effects side of the model.

There always seems to be a good discussion going in the mixed effects
discussion group as to the definition of fixed and random effects and how to
model them (e.g http://andrewgelman.com/2010/12/so-called_fixed/) but I am
curious as to what advice others on this list have.

Cheers,
Chris Parker

On Fri, Aug 19, 2011 at 11:05 AM, Elizabeth Green wrote:

>
> On Aug 19, 2011, at 2:00 AM, 
> r-sig-ecology-request@r-**project.orgwrote:
>
>
>>  1. Random effects in a linear mix model (Edgar Torres)
>>
>>
> Edgar, the random effects represent the variable that has an effect, but
> not an effect that is likely to be biologically interesting, in this case,
> your fishing vessel. The effects you want to test are the fixed effects, in
> this case time, because you want to see how your variable varies by year,
> accounting for the random effects of the different vessels fishing.
>
> bessie
>
> ~~**~~
> Bessie Green
>  907-388-4496
> http://mercury.bio.uaf.edu/~**elizabeth_green/
>
> __**_
> R-sig-ecology mailing list
> R-sig-ecology@r-project.org
> https://stat.ethz.ch/mailman/**listinfo/r-sig-ecology
>

[[alternative HTML version deleted]]

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology


[R-sig-eco] random effects in a linear mixed model

2011-08-19 Thread Elizabeth Green


On Aug 19, 2011, at 2:00 AM, r-sig-ecology-requ...@r-project.org wrote:



  1. Random effects in a linear mix model (Edgar Torres)



Edgar, the random effects represent the variable that has an effect,  
but not an effect that is likely to be biologically interesting, in  
this case, your fishing vessel. The effects you want to test are the  
fixed effects, in this case time, because you want to see how your  
variable varies by year, accounting for the random effects of the  
different vessels fishing.


bessie


Bessie Green
 907-388-4496
http://mercury.bio.uaf.edu/~elizabeth_green/

___
R-sig-ecology mailing list
R-sig-ecology@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-ecology