Page 1 of 1

Combining share and fixed?

PostPosted: Sat Mar 20, 2010 4:31 pm
by JeffHostetler
I'm trying to apply the robust design to a dataset that includes some radio-collared animals, for which we want to set p and c to 1. I'm interested in including models where p & c are the same for non-collared animals (such as p.session=list(formula=~session,share=T)) or where they always differ by the same amount (such as p.c.session=list(formula=~c+session,share=T)). When I try to combine these models and fixing p & c, it either doesn't fix c or gives me an error message. I first tried fixing p using:
Code: Select all
p_collared.Y=as.numeric(row.names(ShisRDall.ddl$p[ShisRDall.ddl$p$collared=='Y', ]))
p.c.session=list(formula=~session+c, share=T, fixed=list(index=p_collared.Y,value=1))

which does not fix any c values. I then tried deleting rows from the p and/or c design data, which gave me the error "One or more formulae are invalid because the design matrix has all zero rows for the following nonfixed parameters."

It now looks like models where p & c vary independently work best for this dataset, but I'm still curious: is there a way to do this?

Thanks,

Jeff

Re: Combining share and fixed?

PostPosted: Sat Mar 20, 2010 9:11 pm
by jlaake
Jeff-

You don't want to delete design data because that would set p to 0 when you want to set it to 1. Also, as you found I don't think you can delete design data when you are sharing. Sharing simply combines the DM for p and c to use the same columns. It does not mean that p=c unless that is the model you specified. Thus if you want to fix p and c parameters then you need to specify the indices for c as well as p. You have only done it for p and you have left the c parameters to vary. If you add the corresponding indices for c it should work although I've not tried it.

--jeff

Re: Combining share and fixed?

PostPosted: Sun Mar 21, 2010 10:37 am
by JeffHostetler
Jeff,

Thanks! Based on your suggestion, I got it working, but not while using mark.wrapper.

Code: Select all
new.model=mark(ShisRDall.proc,ddl=ShisRDall.ddl,output=F,model.parameters=list(N=list(formula=~1),c=list(fixed=list(index=c_collared.Y,value=1)),
  S=list(formula=~sex+site2+fire), GammaDoublePrime=list(formula=~1,share=T), p=list(formula=~session+c,share=T, fixed=list(index=p_collared.Y,value=1))))
works correctly, but
Code: Select all
p.c.session=list(formula=~session+c,share=T,fixed=list(index=p_collared.Y,value=1)) 
c.fixed=list(fixed=list(index=c_collared.Y,value=1))
...
ShisRDall.CML=create.model.list("Robust")
model.list=mark.wrapper(ShisRDall.CML,data=ShisRDall.proc,ddl=ShisRDall.ddl,output=F)
does not fix c and
Code: Select all
c.fixed=list(fixed=list(index=c_collared.Y,value=1)) #ORDER SWITCHED
p.c.session=list(formula=~session+c,share=T,fixed=list(index=p_collared.Y,value=1)) 
...
ShisRDall.CML=create.model.list("Robust")
model.list=mark.wrapper(ShisRDall.CML,data=ShisRDall.proc,ddl=ShisRDall.ddl,output=F)
gives a "Error in if (x4 > x2) { : argument is of length zero" message. If these particular models have to be run separately, that's no problem for us.

Thanks again,

Jeff

Re: Combining share and fixed?

PostPosted: Sun Mar 21, 2010 11:08 am
by jlaake
Not sure why that is failing wih mark.wrapper but try the following

p.c.session=list(p=list(formula=~session+c,share=T,fixed=list(index=p_collared.Y,value=1)),c=list(fixed=list(index=c_collared.Y,value=1)))

This let's you pair specific model specifications in mark.wrapper rather than using all combinations of p/c models. This should work as long as you do the same with all p/c models.

--jeff

Re: Combining share and fixed?

PostPosted: Sun Mar 21, 2010 11:49 am
by JeffHostetler
That works. Thanks, Jeff!