Page 1 of 1

Adjusting Parameter Counts

PostPosted: Tue Jan 14, 2014 12:07 pm
by TGrant
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

Re: Adjusting Parameter Counts

PostPosted: Wed Jan 15, 2014 10:21 am
by jlaake
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)

Re: Adjusting Parameter Counts

PostPosted: Wed Jan 15, 2014 1:46 pm
by TGrant
I see. Thanks Jeff!