Linear combinations

630 views
Skip to first unread message

saver...@hotmail.com

unread,
Mar 24, 2013, 2:39:11 PM3/24/13
to unma...@googlegroups.com

Hi all, sorry this is a bit of a simple question - I'm confused with exactly how linear combinations work when there are covariates included in the model. 

 

For my model fm5 I have created a linear combinations matrix based on the ovenbird example. Basically what I am interested in calculating is the estimated abundance at set distances from a release site. The covariate 'Location' however is a category, so I just wanted to check if  the code I have used below is correct: 

 

> fm5<-pcount(~start~Location+Prox.Release.Site..m.,umf,K=5)

>(lc<-linearComb(fm5, type = "state",

+ + matrix(c(1, 1, 0, 1, 1, 10), 2, 3, byrow = TRUE)))

 Linear combination(s) of Abundance estimate(s)

 

  Estimate    SE (Intercept) LocationRelease.Area Prox.Release.Site..m.

1    1.054 0.594           1                    1                     0

2    0.906 0.526           1                    1                    10


Also I have run a separate model, this one however has more covariates present (most of which are categories), and I am unsure how to get the linear combinations matrix to work as I keep getting an error message: 

fm6<-pcount(~temp+duration+start+wind~Location+Dominant.Veg, umf, K=60)

> (lc<-linearComb(fm6, type = "state",

+ matrix(c(1, 0, 0, 1, 0, 0), 2, 3, byrow = TRUE)))

Error: ncol(coefficients) == length(obj@estimates) is not TRUE


Can anyone explain how linear combinations work and how to create the matrices correctly?


Thanks a lot,


Sarah

erikw...@gmail.com

unread,
Mar 25, 2013, 4:33:41 PM3/25/13
to unma...@googlegroups.com
Hi Sarah,

Linear combinations are discussed in several areas including the FAQ as well as a vignette (page 3). I found these links helpful. Not sure how categorical covariates are handled but I've always been under the impression we should backTransform() linear combination estimates to make sensible interpretations. I believe linear combos are point estimates; if you are interested in estimating abundance at a range of distances from x, then I believe predict() would help and you could visualize the relationship with plot() and include confidence intervals. I'll watch this thread as I'm interested in this question as well.

Erik

Richard Chandler

unread,
Mar 25, 2013, 9:20:57 PM3/25/13
to Unmarked package
Hi Sarah,

I recommend using predict() instead of linearComb() because predict() is just a wrapper around linearComb(), and it should be easier to use. These methods basically just plug the estimates into the (log- or logit-)linear equation. predict() will create the dummy variables and the design matrix for you -- linearComb() will not. 

Richard  


--
You received this message because you are subscribed to the Google Groups "unmarked" group.
To unsubscribe from this group and stop receiving emails from it, send an email to unmarked+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

saver...@hotmail.com

unread,
Mar 27, 2013, 7:08:02 AM3/27/13
to unma...@googlegroups.com
Hi Eric & Richard,

Thanks for your reply, really appreciate it. When using 'predict' is there a way of having the estimated abundance values? 

Sarah  

erikw...@gmail.com

unread,
Mar 29, 2013, 1:28:59 PM3/29/13
to unma...@googlegroups.com
Hi Sarah,

Indeed, predict() can estimate abundance ('state') along a gradient of covariate values that are supplied by a new data.frame. There are a bunch of good examples spattered about the listserve and vignettes.

Not sure what your data looks like but you would start with something similar to this:

newdataframe<- data.frame(Location=factor(c("A","B","C")), Prox.Release.Site..m = seq(0,1), length=100) #assign your covariate values
predict(fm5, newdata = newdataframe, type = "state")

You can sum the predicted values to get total estimated abundance and plot() Predicted ~ Prox.Release.Site..m to visualize predicted relationships.
Reply all
Reply to author
Forward
0 new messages