Thanks for all of the help you’ve been giving folks on this group. All of you gurus are an awesome resource for those of us with fewer skills and/or less knowledge.
Here’s a simple example using the Alder Flycatcher data that is on the web somewhere (should also be attached):
> alfl.data <- read.csv("alfl0506.csv", row.names=1)
> str(alfl.data)
'data.frame':
49 obs. of 20 variables:
$ alfl1_05: int 1 2 0 1 0 3 0 0 0 0 ...
$ alfl2_05: int 0 3 1 0 0 1 0 0 1 0 ...
$ alfl3_05: int 1 0 1 1 0 1 0 0 2 0 ...
$ alfl1_06: int 0 0 1 1 0 0 0 0 1 1 ...
$ alfl2_06: int 1 0 0 0 0 0 0 0 0 0 ...
$ alfl3_06: int 1 0 0 1 0 0 0 0 0 0 ...
$ struct : num 5.45 4.75 14.7 5.05 4.15 9.75 9.6 15.7 9.2 7.75 ...
$ woody : int 6 1 7 6 2 8 4 0 4 3 ...
$ time1_05: num 8.68 9.43 8.25 7.77 9.57 9.1 8.6 8.12 7.63 9.92 ...
$ time2_05: num 8.73 7.4 6.7 6.23 9.55 9.12 8.62 7.92 7.43 5.67 ...
$ time3_05: num 5.72 7.58 7.62 7.17 5.73 9.12 6.72 8.07 7.6 9.72 ...
$ date1_05: int 6 20 20 20 8 8 8 1 1 1 ...
$ date2_05: int 25 32 32 32 27 27 27 27 27 27 ...
$ date3_05: int 34 54 47 47 36 36 36 36 36 36 ...
$ time1_06: num 8.75 6.38 7.07 5.75 10 9.55 9.02 6.13 5.63 7.93 ...
$ time2_06: num 5.25 8.12 7.07 7.53 7.37 6.87 6.38 9.27 8.83 7.53 ...
$ time3_06: num 5.12 6.87 6.2 5.75 5.75 ...
$ date1_06: int 8 13 13 13 12 12 12 12 12 12 ...
$ date2_06: int 26 37 37 37 28 28 28 28 28 28 ...
$ date3_06: int 44 48 48 48 46 46 46 46 46 46 ...
>
> ### Load Package ###
> library(unmarked)
Loading required package: reshape
Loading required package: lattice
Loading required package: Rcpp
>
> ### Make Unmarked PCO dataframe ###
> alfl.umf <- unmarkedFramePCO(y=alfl.data[,1:6],
+ siteCovs=alfl.data[,c("woody", "struct")],
+ # we could have yearlySiteCovs here.
+ obsCovs=list(time=alfl.data[,c("time1_05", "time2_05", "time3_05",
+ "time2_06", "time3_06", "time3_06")],
+ date=alfl.data[,c("date1_05", "date2_05", "date3_05",
+ "date2_06", "date3_06", "date3_06")]),
+ numPrimary=2)
>
> # Standardize covariates after making the UMF
> siteCovs(alfl.umf) <- scale(siteCovs(alfl.umf))
> obsCovs(alfl.umf) <- scale(obsCovs(alfl.umf))
> summary(alfl.umf)
unmarkedFrame Object
49 sites
Maximum number of observations per site: 6
Mean number of observations per site: 6
Number of primary survey periods: 2
Number of secondary survey periods: 3
Sites with at least one detection: 42
Tabulation of y observations:
0 1 2 3 <NA>
183 76 25 10 0
Site-level covariates:
woody struct
Min. :-1.5749 Min. :-1.793802
1st Qu.:-0.5887 1st Qu.:-0.797115
Median :-0.0956 Median :-0.002653
Mean : 0.0000 Mean : 0.000000
3rd Qu.: 0.6441 3rd Qu.: 0.618471
Max. : 2.3699 Max. : 3.247416
Observation-level covariates:
time date
Min. :-1.96447 Min. :-2.3602
1st Qu.:-0.80321 1st Qu.:-0.5701
Median :-0.04802 Median : 0.1012
Mean : 0.00000 Mean : 0.0000
3rd Qu.: 0.81723 3rd Qu.: 0.9217
Max. : 2.38455 Max. : 1.5930
> library(MuMIn)