Skip to content

Question concerning nlme

2 messages · Nelson, Gary (FWE ), Emmanuel Curis

#
I work in the field of fisheries. We sample fish using gears that collect individual in clusters, so any analyses done using such sample have to be corrected for intra-cluster correlation.  This has been shown in many papers in my field.

I am trying to compare growth curves between two sexes using the nlme function. The individuals were collected via cluster sampling.  I have been trying to use the nlme function but am having trouble understanding how to specify the correct formulation.

My growth model is:

vonBert<-deriv(~Linf*(1-exp(-K*(x-t0))),c("Linf","K","t0"),function(x,Linf,K,t0){})

and I created grouped data with cluster as the grouping variable

vbdata<-groupedData(lens~age|cluster,data=catchdata,labels=list(x="age",y="length"))

and the mixed model I have is

vbfull<--nlme(lens~vonBert(age,Linf,K,t0),data=vbdata,fixed=list(Linf~1,K~1,t0~1),random=Linf+K+t0~1,start=c(Linf=c(270),
K=c(0.7),t0=c(0.1)),control=nlmeControl(maxIter=100000,msMaxIter=100000))

My question is how do I incorporate sexes?  I've tried assuming sex is nested within a cluster where
vbdata<-groupedData(lens~age|cluster/sex,data=catchdata,labels=list(x="age",y="length")) but am unsure if this is correct.

Any help would be appreciated.

<>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <><
Gary A. Nelson, Ph. D
Massachusetts Division of Marine Fisheries
Annisquam River Field Station
30 Emerson Avenue
Gloucester, MA 01930
email: gary.nelson @state.ma.us
phone: 978-282-0308 x114
#
According to the nlme documentation, fitting different K parameters
for sexes (for instance) should be something like

md <- nlme( lens ~ vonBert( age, Linf, K, t0 ),
            data = vbdata,
	    fixed = list( Linf ~ 1,
	                  K ~ Sexe, # Different mean value
			  t0 ~ 1),
	    random = list( Linf ~ 1,
	                   K ~ Sexe, # Different variance
			   t0 ~ 1 ),
            start = c( Linf = c( 270 ),
	               K    = c( 0.7, 0.7 ),
		       t0   = c(0.1) ),
	    control = nlmeControl( maxIter=100000, msMaxIter=100000)
	  )

if you assume both different mean value (fixed) and variances of the
random effects (random).

Note that, not knowing the context, nesting sex in the cluster seems
strange to me, because if I interpret nesting correctly it would mean
that sex ? female ? or ? male ? means something different in different
clusters (that is, there would be not 2 sexes, but 2 times the number
of clusters different sexes for your fish)...

Hope this will help,
On Wed, Jul 17, 2019 at 04:54:29PM +0000, Nelson, Gary (FWE ) wrote:
? I work in the field of fisheries. We sample fish using gears that collect individual in clusters, so any analyses done using such sample have to be corrected for intra-cluster correlation.  This has been shown in many papers in my field.
? 
? I am trying to compare growth curves between two sexes using the nlme function. The individuals were collected via cluster sampling.  I have been trying to use the nlme function but am having trouble understanding how to specify the correct formulation.
? 
? My growth model is:
? 
? vonBert<-deriv(~Linf*(1-exp(-K*(x-t0))),c("Linf","K","t0"),function(x,Linf,K,t0){})
? 
? and I created grouped data with cluster as the grouping variable
? 
? vbdata<-groupedData(lens~age|cluster,data=catchdata,labels=list(x="age",y="length"))
? 
? and the mixed model I have is
? 
? vbfull<--nlme(lens~vonBert(age,Linf,K,t0),data=vbdata,fixed=list(Linf~1,K~1,t0~1),random=Linf+K+t0~1,start=c(Linf=c(270),
? K=c(0.7),t0=c(0.1)),control=nlmeControl(maxIter=100000,msMaxIter=100000))
? 
? My question is how do I incorporate sexes?  I've tried assuming sex is nested within a cluster where
? vbdata<-groupedData(lens~age|cluster/sex,data=catchdata,labels=list(x="age",y="length")) but am unsure if this is correct.
? 
? Any help would be appreciated.
? 
? <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <>< <><
? Gary A. Nelson, Ph. D
? Massachusetts Division of Marine Fisheries
? Annisquam River Field Station
? 30 Emerson Avenue
? Gloucester, MA 01930
? email: gary.nelson @state.ma.us
? phone: 978-282-0308 x114
? 
? 
? 	[[alternative HTML version deleted]]
? 
? _______________________________________________
? R-sig-mixed-models at r-project.org mailing list
? https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models