Fixing paramters in MS model

posts related to the RMark library, which may not be of general interest to users of 'classic' MARK

Fixing paramters in MS model

Postby Eldar » Wed Feb 02, 2011 6:39 pm

Hallo,
In my experiment I know a lot of the parameters for p matrix. I know that they depend on stratum and year, so I created a dataframe "a" where I have (a$stratum, a$year, a$p.value)...
How can I send them to RMark?

I tried following:
a$stratum.year<-paste(a$stratum, a$year, sep=".")
ddl$p$stratum.year<-paste(ddl$p$stratum, ddl$p$year, sep=".")

model1<-make.mark.model(data=data, ddl=ddl, parameters=list(S=list(formula=~1), p=list(formula=~stratum*year, fixed=list(stratum.year=a$stratum.year, value=a$stratum.year$value)), Psi=list(formula=~1)))
BUT, it does not work...
Any suggestions how to do it?
Best,
Eldar
Eldar
 
Posts: 56
Joined: Fri Nov 19, 2010 4:03 pm
Location: Amsterdam

Re: Fixing paramters in MS model

Postby jlaake » Wed Feb 02, 2011 6:52 pm

As you have found, what you are doing will not work. Many try the exact same thing but it is not setup in that fashion nor do I think it could be. See section C.11 in Appendix C and section X in the workshop notes. You need to use the fixed=list(indices=...,value=...) form. Those sections contain some useful examples and the best one is in the workshop notes. Essentially you have to extract the indices of the design data that match the values you want to specify. If those "known" fixed values are 0 for say p or 1 for Phi, then you can also delete the design data for those parameters as another way to fix the parameter values.

--jeff
jlaake
 
Posts: 1480
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Fixing paramters in MS model

Postby Eldar » Thu Feb 03, 2011 11:30 am

Dear Jeff,
Thanks a lot for your help, workshop notes are great!
As far as I had a lot of recapture probabilities to be fixed to specific values I used a bit different logic:
so, I have a dataframe "recap.rates" with columns ($stratum, $time, $value).
then I
#1) extract indices from ddl:
indices.all<-data.frame(stratum=ddl$p$stratum, time=ddl$p$time, indices=as.numeric(row.names(ddl$p)))
#2) merge them with my dataframe:
indices.match<-merge(indices.all, recap.rates, by.x=c("stratum", "time"), by.y=c("stratum", "time"))
#3) create formula:
p.fixed=list(formula = ~stratum*time , fixed=list(index=indices.match$indices, value=indices.match$value))
And it works!
Best,
Eldar
Eldar
 
Posts: 56
Joined: Fri Nov 19, 2010 4:03 pm
Location: Amsterdam


Return to RMark

Who is online

Users browsing this forum: No registered users and 5 guests