[R] Trouble with first passage time analysis using adehabitatLT
zlong
xanthro_m at hotmail.com
Sun Oct 28 03:05:26 CET 2012
Hey all,
I've run into a few problems running first passage time analysis. I'm hoping
someone might be able to help me sort this out. I'm fine up to the point of
creating the ltraj object from a dataset.
/test<-read.table("~/Desktop/R_Directory/test.txt",header=TRUE)
attach(test)
library(adehabitatLT)
xy<-test[,c("x","y")]
date1<-as.character(date)
date<-as.POSIXct(date1)
fit1<-as.ltraj(xy,date,id=test$name,burst=name,typeII=TRUE)/
from here things start to get fuzzy
1)
Instead of following the basic expression,
/fpt(lt, radii, units = c("seconds", "hours", "days"))/
the sample code on the tutorial expressed fpt as,
/fpt(lt, seq(300,1000, length=30))/
But as far as I can tell this code does not set a specific radius distance
(e.g., 100 m), but rather defines how many radii are to be distributed
across the dataset.
The example code returns values for 30 radii (i.e., "length=30").
/data(puechcirc)
i <- fpt(puechcirc, seq(300,1000, length=30))
plot(i, scale = 500, warn = FALSE)/
Modifying the code, I calculated values for 5 radii using a subsample of my
data (attached below).
/i <- fpt(fit1, seq(1,100, length=5))
plot(i, scale = 5, warn = FALSE)
i/
[[1]]
r1 r2 r3 r4 r5
1 NA NA NA NA
NA
2 80403.66 NA NA NA NA
3 58711.45 NA NA NA NA
4 5325.09 137121.1 NA NA NA
5 25695.41 432542.8 587729.9 742917.0 2061795
6 32629.12 394459.5 553960.4 713461.3 2050644
7 13175.66 489781.9 649159.8 1441978.8 2088730
8 35531.17 1362903.1 1521188.3 1702321.9 2107085
9 60181.97 1348559.8 1515091.3 1698974.1 2124975
10 106913.46 1323955.4 1504503.8 1700214.7 2151971
11 94222.94 1334576.0 1513000.0 1711400.7 2145693
12 66315.86 1329840.1 1488550.8 1647261.5 2089818
13 68114.22 1352723.6 1512442.1 1690046.2 2098154
14 20141.44 1339237.6 1504857.4 1677927.2 2123560
15 5553.17 142994.1 NA NA NA
16 231598.68 NA NA NA NA
17 231598.68 NA NA NA NA
18 NA NA NA NA
NA
Sample_plot.pdf
<http://r.789695.n4.nabble.com/file/n4647675/Sample_plot.pdf>
Fig. 1. fpt(lt, seq(300,1000, length=30))
Is there a way to manually select radius distance (in meters) rather than
specifying how many radii you’d like distributed across the dataset? Or am I
mistaken, and I simply have to estimate radius distances from the spatial
extent of my data (e.g., if an animal traveled 5 km and I had 5 radii, they
are spaced 1000 m apart).
2)
I was able to replicate the same pattern (at least graphically) using the
basic expression by setting radii=1. Unsurprisingly, this only produces data
for 1 radius.
/k<-fpt(fit1,radii=1,units= "days")
plot(k,scale=1)
k/
[[1]]
r1
1 NA
2 0.93059793
3 0.67953065
4 0.06163299
5 0.29740059
6 0.37765181
7 0.15249607
8 0.41124037
9 0.69655056
10 1.23742436
11 1.09054333
12 0.76754471
13 0.78835903
14 0.23311856
15 0.06427280
16 2.68054024
17 2.68054024
18 NA
Basic_plot.pdf <http://r.789695.n4.nabble.com/file/n4647675/Basic_plot.pdf>
Fig. 2. k<-fpt(fit1,radii=1,units= "days")
However, setting “radii=5” I receive a completely different pattern, but
still only values for a single radius. This prevents me from plotting
meanfpt and varlogfpt values, which are what I really need.
/l<-fpt(fit1,radii=5,units= "days")
plot(l,scale=5)
l/
[[1]]
r1
1 NA
2 3.5896499
3 4.2353756
4 0.3081650
5 1.4870029
6 1.8882590
7 0.7624803
8 2.0562018
9 3.4827528
10 4.3457374
11 5.3108066
12 3.8377235
13 3.9417951
14 1.1655928
15 0.3213640
16 NA
17 NA
18 NA
basic_5.pdf <http://r.789695.n4.nabble.com/file/n4647675/basic_5.pdf>
Fig. 3. l<-fpt(fit1,radii=5,units= "days")
So clearly "length=x" in the sample code and "radii=x" in the basic
expression do not reflect the same information. Is there a way to manually
set radius distances in the basic expression and get it to spit out data for
as many radii as are necessary to cover the spatial extent of the data?
3)
I don’t quite understand the units on the Y-axis. My data are in 'days', so
I would assume that the FPT would also be expressed in days (as I believe
Fig. 2 and 3 are). However, the data produced by the sample code appear to
be expressed in some other unit (Fig. 1). Since the sample code seems to be
my most promising avenue (aside from not understanding how radii are
defined), I'd like to be able to have the Y-axis expressed in days. Is there
any way to do that?
I have attached the small dataset I was using to test out the code in case
you'd like to play around with the data.
test.txt <http://r.789695.n4.nabble.com/file/n4647675/test.txt>
As a point of interest, the data represent radio-telemetry points of a
western toad.
Thanks a lot
--
View this message in context: http://r.789695.n4.nabble.com/Trouble-with-first-passage-time-analysis-using-adehabitatLT-tp4647675.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list