Adjusting Parameter Counts

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

Adjusting Parameter Counts

Postby TGrant » Tue Jan 14, 2014 12:07 pm

Hi, I'm having some trouble adjusting parameter counts.

Because of the unusual structure of my model, the number of parameters has to be adjusted down for each model. Here is the code to determine how many parameters to decrease the count by (it could be a lot simpler but I am trying figure out where it could be wrong). This is looped over all the models but I have just one model here.

Code: Select all
a = 1
x = grep("time",LIBL.models3[[309]]$parameters$Epsilon$formula)
l=length(x)
if (l>0) {b=a+2} else {b=a+1}
y = grep("time",LIBL.models3[[309]]$parameters$Gamma$formula)
m=length(y)
if (m>0) {c=b+2} else {c=b+1}
z = grep("session",LIBL.models3[[309]]$parameters$p$formula)
n=length(z)
if (n>0) {d=c+3} else {d=c+1}
newpar=LIBL.models3[[309]]$results$npar-d


Then I run
Code: Select all
adjust.parameter.count(LIBL.models3[[309]],newpar)


R prints out
Code: Select all
Number of parameters adjusted from  22  to  16
Adjusted AICc =  667.7911
Unadjusted AICc =  654.6893

and opens the MARK full output text file.

Then I run model.table again:
Code: Select all
LIBL.models3$model.table=model.table(LIBL.models3)


but nothing is changed.

Thanks,
Tyler
TGrant
 
Posts: 18
Joined: Tue Dec 19, 2006 9:45 pm

Re: Adjusting Parameter Counts

Postby jlaake » Wed Jan 15, 2014 10:21 am

The help shows for ?adjust.parameter.count that the value of the function is

Value

model: the mark model object with the adjustments made

That is why it sent the model output to notepad because it returned the model and the R default behavior is to print an object when you type it at the console and the for mark models the print function shows the model output. To adjust the parameter count you have to reassign it to the model location

Code: Select all
LIBL.models3[[309]]=adjust.parameter.count(LIBL.models3[[309]],newpar)
jlaake
 
Posts: 1480
Joined: Fri May 12, 2006 12:50 pm
Location: Escondido, CA

Re: Adjusting Parameter Counts

Postby TGrant » Wed Jan 15, 2014 1:46 pm

I see. Thanks Jeff!
TGrant
 
Posts: 18
Joined: Tue Dec 19, 2006 9:45 pm


Return to RMark

Who is online

Users browsing this forum: Bing [Bot] and 2 guests