I'm trying to do a Huggins model. Here's a sample of my data:
> head(ch)
ch station year plot
1011 1 2002 1.N2
1101 1 2002 1.N2
1000 1 2002 1.N2
1101 1 2002 1.N2
1010 1 2002 1.N2
1001 1 2002 1.N2
All 3 grouping variables (station, year, plot) are being imported as factors.
Here's my code:
ch=import.chdata("tt_jc_inp.txt",header=TRUE)
woodrat.proc=process.data(ch,model="Huggins",groups="plot", time.intervals=c(1,1,1),nocc=4)
woodrat.ddl=make.design.data(woodrat.proc)
initial.analysis=function(){
p.dot=list(formula=~1)
p.plot=list(formula=~plot)
p.time=list(formula=~time)
c.time=list(formula=~time)
c.plot=list(formula=~plot)
c.dot=list(formula=~1)#
woodrat.cml=create.model.list("Huggins")
#use mark.wrapper with model list gvol.CML and the processed data and design data to fit each of the models in MARK
model.list=mark.wrapper(woodrat.cml,data=woodrat.proc,ddl=woodrat.ddl,output=F)
results=mark.wrapper(woodrat.cml,data=woodrat.proc,ddl=woodrat.ddl,adjust=T,invisible=F)
#return the list of model results as the value of the fnction
return(model.list)
}
#run the analysis. assign results to object gvol.results
woodrat.results=initial.analysis()
woodrat.results
When I run the model with a single variable as the group it runs perfectly, but when I try to designate more than 1 group it gives me this error:
Error in cohort + cumsum(time.intervals[i:(num - 1)]) :
non-numeric argument to binary operator
Any idea where I'm going wrong? Thanks for your help and quick replies. They are much appreciated! -Katie