I am trying to run a multiple season, single species occupancy model with covariates using colext in unmarked. I have worked on this for days now and I need to make some progress, so I hope someone here can help. Everything seems to work fine except for the format of yearlySiteCovs. I’ve looked at the help material, the “Dynamic Occupancy” article by Kery and Chandler, and have tried multiple logical workarounds. I also found THIS post which I thought answered it, but I still don’t seem to be able to get it right.
Using standard notation of Kery and Chandler, M = 330, J = 3, and T = 9. I have two siteCovs, dummy vars to indicate membership in one of 3 populations; the siteCov matrix is 330 rows. I have 3 obsCovs applied to detection probability. When formatted, this generates amatrix with MTJ (8910) rows and 3 columns.
According to the unmarked documentation, the yearlySiteCovs is a matrix of MT rows in a site-major, year-minor order. Thus I started with a 330 * 9 matrix (sample below) with columns representing each year’s value (months since an event) measured at the beginning of the season for each site (represented by their index# here):
yr2003 yr2004 yr2005 yr2006 yr2007 yr2008 yr2009 yr2010 yr2011
7 25 2 14 2 1 13 25 12 3
27 15 2 14 2 1 13 3 15 3
44 34 2 14 0 12 24 36 12 5
56 34 46 1 1 13 3 15 27 12
59 13 2 15 26 38 50 11 23 35
68 2 14 1 12 24 36 11 23 35
185 NA NA NA 60 10 22 11 23 35
212 10 0 11 23 35 10 22 34 11
238 10 22 10 22 34 9 9 21 1
327 1 14 25 1 12 25 36 0 12
I tried various formats to get this to read in and get various reasons why it doesn’t. I used ‘melt’ in reshape2 to convert the data to a 2970 row matrix ordered by site then year and then removed the extraneous information leaving a vector of the above time since event values. If I use
umf <- unmarkedMultFrame(y=y,
siteCovs = siteCovs,
obsCovs = obsCovs,
yearlySiteCovs = yearlySiteCovs,
numPrimary=T)
I get the error: “Error in checkAtAssignment("unmarkedMultFrame", "yearlySiteCovs", "integer") :
assignment of an object of class “integer” is not valid for @‘yearlySiteCovs’ in an object of class “unmarkedMultFrame”; is(value, "optionalDataFrame") is not TRUE”
If I change the data type to anything else, I get the same message with whatever other class I use inserted.
If I change the input to: yearlySiteCovs = list(yearlySiteCovs) I get the error: “Error in unmarkedMultFrame(y = y, siteCovs = siteCovs, obsCovs = obsCovs, :
At least one element of yearlySiteCovs is not a matrix or data frame.”
I am seriously out of time and overdue on this. Can anyone please help me to understand how to format this so I can run the model? The real frustration is that I’ve done the analysis in Program PRESENCE, but I can’t easily generate predictive graphics I need from that output. I need to duplicate my selected best model in R so I can use the power of R to generate predictives for the report. Thanks in advance, and if you need more info I can provide it.
Cheers,
Shane
--
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/d/optout.
I have one last question regarding how colext() uses the yearlySiteCovs. In my data there are 9 primary periods (2003-2011), thus 8 transitional periods for colonization and extinction. However, the yearlySiteCovs list must contain a variable for each of the nine years, so I end up with the following call to unmarkedMultFrame. As noted above, mrf03 applies to fires prior to the initial year of the study, and thus is included in the siteCovs data. mrf03 really has no place in the yearlySiteCovs data, but appears to be required to give the correct dimensions to the data.
fgsp.umf <- unmarkedMultFrame(y=datin[,2:28],
siteCovs=datin[,c("kpsp","tlwma", "mrf03")],
yearlySiteCovs = list(mrFire=datin[,c("mrf03", "mrf04", "mrf05", "mrf06", "mrf07", "mrf08", "mrf09", "mrf10", "mrf11")]),
obsCovs = list( doy=datin[,41:67],
tod=datin[,68:94],
tod2=datin[,95:121]),
numPrimary=9)
When I set up a model such that gammaformula = ~kpsp + tlwma + mrFire, which mrFire columns are being supplied to which colonization probability? For gamma1 between year03 and year04, I want to apply mrf04 which contains the data relevant to settling patterns in 2004. If unmarked is applying the mrf03 data, the associations are nonsensical, but if I try to exclude the mrf03 column from the list, I get an error about incorrect dimensions in my list. My concern arises because when I compare results from PRESENCE to my unmarked results, they are essentially identical for all other models I’ve run, but in this case I can’t get them to match, suggesting I’m not getting the proper parameterization. Can anyone enlighten me on this? I did some digging around and I just can't find a good explanation of this.
Thanks,
Shane
Sorry if my persistence is offputting, but I’m going to ping this thread one more time in hopes someone can help me to understand the situation in my last post above. I’ll constrain the example a bit more than above for brevity, but assume 3 years of data 2003-2005, thus initial Psi in 03, colonization/extinction events 03-04 and 04-05, and detection probabilities for each point count during that time, 3/season.
As Dan described above, I broke out mrf03 (most recent fire prior to the 03 season) for use as a predictor of initial colonization because we believe there is a short window of time where the habitat is suitable after fire. That leaves me with mrf04 and mrf05, which are the times since the most recent fire preceding the 04 and 05 seasons as predictors of colonization and extinction for each of those seasons.
when I set up my unmarkedMultFrame I intuitively wanted to use: yearlySiteCovs = list(mrFire=data[,c("mrf04", "mrf05")])
which doesn’t work because there must be a frame for each year, thus unmarked requires: yearlySiteCovs = list(mrFire=data[,c("mrf03", "mrf04", "mrf05")])
So my question is, what is being applied as a predictor of col/ext? Is it one of those columns, or is it the difference between mrf03 and mrf04 for the 04 season? Dan noted, "Then the mrf03, 04, 05, etc., should represent the change in fire history between closed occurrence periods so that it indicates how fire would affect..." This also seemed to be implied by another post on this forum, though I can't relocate it at the moment. It isn't the change in fire history from one year to the next that is biologically relevant, but the absolute time since the last burn, which is what I've tried to supply in the mrfXX variables for each year.
Thanks again for your time and consideration.
Shane
--
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+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "unmarked" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/unmarked/Tk5QRBFTgyY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to unmarked+unsubscribe@googlegroups.com.