Skip to content

FPT and Adehabitat

6 messages · Clément Calenge, Samantha Patrick

#
Hard to say without any reproducible example... could you post an 
example (minimum dataset + R code)?
Best regards,

Cl?ment Calenge
Samantha Patrick wrote:

  
    
#
The data set is pasted at the bottom of the email and this is the code I am using (excluding data read):

ddate <-as.POSIXct(datetime)
burst<-as.factor(FPT[,6])
id<-as.factor(FPT[,6])
xy<-data.frame (FPT[,7], FPT[,8])
yaya<-as.ltraj(xy,ddate,id, burst, typeII = TRUE, slsp = c("remove", "missing"))
summary.ltraj(yaya)
ayayGPS <- redisltraj(yaya, 500) 

fptshort=fpt(ayayGPS, seq(5000,30000, length=6))

I am wondering if the outputs are for the redistributed locations? If this is the case, is there any way to get FPT for raw locations (I want to compare the results with other measures of sinuosity etc.)?  The timing of bursts is not constant though...

Many thanks for your help

Best Wishes

Sam 


dddate	tttime	Lat	Lon	ID	Burst	xx	yy
2006-06-21	15:09:48	-5.48138	51.73081	6.2	6.2	742965.87000	5736959.30000
2006-06-21	15:12:01	-5.48146	51.73082	6.2	6.2	742960.28000	5736960.50000
2006-06-21	15:14:58	-5.48583	51.72864	6.2	6.2	742670.66000	5736703.30000
2006-06-21	15:17:24	-5.48699	51.72929	6.2	6.2	742586.76000	5736771.50000
2006-06-21	15:20:30	-5.49569	51.73421	6.2	6.2	741960.22000	5737289.50000
2006-06-21	15:22:43	-5.51323	51.73561	6.2	6.2	740742.05000	5737387.10000
2006-06-21	15:24:56	-5.52846	51.74312	6.2	6.2	739650.90000	5738172.20000
2006-06-21	15:27:18	-5.54604	51.74984	6.2	6.2	738402.38000	5738861.10000
2006-06-21	15:29:36	-5.56479	51.75534	6.2	6.2	737079.38000	5739411.70000
2006-06-21	15:31:55	-5.58231	51.76059	6.2	6.2	735843.10000	5739938.30000
2006-06-21	15:34:31	-5.60271	51.76500	6.2	6.2	734413.21000	5740363.20000
2006-06-21	15:37:07	-5.62265	51.76815	6.2	6.2	733021.53000	5740648.70000
2006-06-21	15:39:26	-5.64052	51.77049	6.2	6.2	731776.44000	5740852.10000
2006-06-21	15:42:20	-5.66318	51.77429	6.2	6.2	730194.48000	5741203.40000
2006-06-21	15:44:42	-5.68139	51.78069	6.2	6.2	728906.38000	5741857.50000
2006-06-21	15:46:55	-5.69897	51.78288	6.2	6.2	727682.52000	5742045.20000
2006-06-21	15:49:13	-5.71702	51.78535	6.2	6.2	726426.04000	5742264.20000
2006-06-21	15:52:13	-5.74030	51.79218	6.2	6.2	724786.32000	5742950.60000
2006-06-21	15:54:37	-5.75805	51.79961	6.2	6.2	723526.28000	5743722.30000
2006-06-21	15:57:25	-5.78056	51.80464	6.2	6.2	721949.58000	5744212.70000
2006-06-21	15:59:37	-5.78381	51.80597	6.2	6.2	721719.39000	5744350.60000
2006-06-21	16:01:48	-5.78273	51.80650	6.2	6.2	721790.85000	5744413.50000
2006-06-21	16:04:06	-5.78262	51.80813	6.2	6.2	721790.77000	5744595.10000
2006-06-21	16:06:19	-5.78165	51.80903	6.2	6.2	721852.86000	5744698.10000
2006-06-21	16:08:31	-5.78108	51.81042	6.2	6.2	721885.22000	5744853.70000
2006-06-21	16:11:07	-5.78012	51.81167	6.2	6.2	721945.56000	5744996.10000
2006-06-21	16:13:31	-5.78455	51.81492	6.2	6.2	721624.44000	5745343.80000
2006-06-21	16:15:42	-5.80296	51.82131	6.2	6.2	720324.79000	5745997.80000
2006-06-21	16:18:00	-5.82177	51.82815	6.2	6.2	718995.58000	5746702.40000
2006-06-21	16:20:25	-5.84190	51.83592	6.2	6.2	717570.85000	5747505.00000
2006-06-21	16:22:42	-5.86282	51.83992	6.2	6.2	716111.21000	5747888.20000
2006-06-21	16:25:02	-5.88449	51.84056	6.2	6.2	714615.50000	5747895.30000
2006-06-21	16:27:25	-5.90739	51.84269	6.2	6.2	713028.46000	5748064.10000
2006-06-21	16:29:37	-5.92828	51.84313	6.2	6.2	711587.50000	5748052.60000
2006-06-21	16:32:01	-5.95060	51.84389	6.2	6.2	710047.08000	5748072.50000
2006-06-21	16:56:55	-6.17119	51.87331	6.2	6.2	694728.69000	5750729.80000
2006-06-21	16:59:07	-6.18950	51.87581	6.2	6.2	693457.32000	5750959.20000
2006-06-21	17:01:18	-6.20822	51.87589	6.2	6.2	692168.53000	5750918.60000
2006-06-21	17:03:31	-6.22717	51.87621	6.2	6.2	690863.23000	5750904.90000
2006-06-21	17:05:57	-6.24819	51.87824	6.2	6.2	689408.33000	5751075.00000
2006-06-21	17:08:06	-6.26652	51.88070	6.2	6.2	688136.15000	5751301.30000
2006-06-21	17:10:24	-6.28705	51.88118	6.2	6.2	686721.86000	5751302.10000
2006-06-21	17:30:53	-6.45187	51.88101	6.2	6.2	675380.21000	5750873.30000
2006-06-21	17:33:01	-6.45097	51.88106	6.2	6.2	675441.74000	5750880.30000
2006-06-21	17:35:12	-6.45016	51.88134	6.2	6.2	675496.73000	5750913.60000
2006-06-21	17:37:36	-6.44931	51.88168	6.2	6.2	675554.00000	5750953.90000
2006-06-21	17:40:01	-6.45036	51.88182	6.2	6.2	675481.09000	5750966.70000
2006-06-21	17:42:25	-6.46744	51.87689	6.2	6.2	674324.60000	5750376.90000
2006-06-21	17:47:04	-6.47118	51.86575	6.2	6.2	674110.57000	5749129.60000
2006-06-21	17:49:42	-6.47089	51.85771	6.2	6.2	674161.22000	5748236.80000
2006-06-21	17:52:00	-6.47270	51.86890	6.2	6.2	673993.44000	5749475.90000
2006-06-21	17:54:15	-6.48392	51.87681	6.2	6.2	673191.15000	5750328.90000
2006-06-21	17:57:24	-6.48532	51.88458	6.2	6.2	673064.58000	5751190.20000
2006-06-21	17:59:38	-6.48502	51.88476	6.2	6.2	673084.53000	5751210.90000
2006-06-21	18:01:48	-6.48431	51.88493	6.2	6.2	673132.65000	5751230.60000
2006-06-21	18:04:00	-6.48373	51.88517	6.2	6.2	673172.08000	5751259.30000
2006-06-21	18:06:37	-6.48307	51.88531	6.2	6.2	673216.72000	5751276.60000
2006-06-21	18:08:48	-6.48249	51.88548	6.2	6.2	673255.87000	5751296.70000
2006-06-21	18:11:37	-6.48168	51.88556	6.2	6.2	673311.19000	5751307.30000
2006-06-21	18:13:48	-6.48085	51.88569	6.2	6.2	673368.13000	5751324.30000
2006-06-21	18:16:36	-6.48000	51.88609	6.2	6.2	673425.07000	5751370.80000
2006-06-21	18:18:48	-6.47963	51.88632	6.2	6.2	673449.43000	5751396.90000
2006-06-21	18:21:37	-6.47898	51.88742	6.2	6.2	673489.80000	5751521.00000
2006-06-21	18:24:42	-6.47843	51.88777	6.2	6.2	673526.54000	5751560.80000
2006-06-21	18:27:44	-6.47785	51.88806	6.2	6.2	673565.54000	5751595.00000
2006-06-21	18:31:54	-6.47595	51.88390	6.2	6.2	673711.97000	5751136.90000
2006-06-21	18:34:13	-6.47883	51.88695	6.2	6.2	673501.81000	5751469.10000
2006-06-21	18:36:43	-6.48925	51.89100	6.2	6.2	672769.77000	5751894.20000
2006-06-21	18:39:07	-6.48853	51.89066	6.2	6.2	672820.50000	5751858.10000
2006-06-21	18:41:24	-6.48806	51.89093	6.2	6.2	672851.47000	5751888.90000
2006-06-21	18:43:43	-6.48760	51.89111	6.2	6.2	672882.66000	5751910.00000
2006-06-21	18:46:14	-6.50280	51.89640	6.2	6.2	671816.44000	5752462.80000
2006-06-21	18:48:24	-6.51535	51.90130	6.2	6.2	670934.59000	5752978.30000
2006-06-21	18:50:43	-6.53180	51.90659	6.2	6.2	669783.44000	5753528.10000
2006-06-21	18:52:54	-6.54770	51.91159	6.2	6.2	668670.70000	5754046.20000
2006-06-21	18:55:07	-6.56365	51.91854	6.2	6.2	667548.36000	5754782.80000
2006-06-21	18:57:43	-6.58125	51.92617	6.2	6.2	666310.08000	5755590.80000
2006-06-21	19:00:19	-6.59594	51.92229	6.2	6.2	665313.97000	5755125.60000
2006-06-21	19:03:32	-6.61737	51.92219	6.2	6.2	663841.38000	5755066.00000
2006-06-21	19:06:07	-6.63860	51.92683	6.2	6.2	662364.38000	5755534.10000
2006-06-21	19:08:50	-6.65449	51.93002	6.2	6.2	661260.75000	5755853.80000
2006-06-21	19:11:00	-6.66988	51.92770	6.2	6.2	660211.40000	5755561.50000
2006-06-21	19:19:55	-6.73595	51.92041	6.2	6.2	655694.34000	5754607.40000
2006-06-21	19:22:07	-6.75289	51.92037	6.2	6.2	654529.67000	5754567.40000
2006-06-21	19:24:18	-6.76489	51.91180	6.2	6.2	653733.38000	5753589.00000
2006-06-21	19:26:49	-6.77896	51.91149	6.2	6.2	652767.36000	5753525.10000
2006-06-21	19:29:00	-6.79281	51.91160	6.2	6.2	651814.25000	5753508.20000
2006-06-21	19:31:49	-6.80859	51.90841	6.2	6.2	650739.36000	5753120.10000
2006-06-21	19:34:13	-6.81951	51.90515	6.2	6.2	649999.50000	5752735.00000
2006-06-21	19:37:31	-6.83476	51.90308	6.2	6.2	648957.17000	5752473.50000
2006-06-21	19:39:55	-6.84750	51.90275	6.2	6.2	648081.77000	5752411.50000
2006-06-21	19:42:22	-6.86246	51.90572	6.2	6.2	647043.59000	5752711.30000
2006-06-21	19:44:32	-6.87491	51.90647	6.2	6.2	646184.81000	5752769.00000
2006-06-21	19:47:01	-6.88648	51.89641	6.2	6.2	645421.25000	5751627.70000
2006-06-21	19:51:26	-6.89770	51.89913	6.2	6.2	644640.49000	5751907.60000
2006-06-21	19:53:36	-6.90755	51.90497	6.2	6.2	643943.96000	5752537.70000
2006-06-21	19:55:50	-6.92119	51.90624	6.2	6.2	643001.95000	5752651.50000
2006-06-21	19:58:00	-6.93272	51.90531	6.2	6.2	642212.04000	5752525.70000
2006-06-21	20:00:14	-6.94620	51.91235	6.2	6.2	641262.59000	5753283.00000
2006-06-21	20:02:31	-6.95391	51.92287	6.2	6.2	640699.10000	5754437.90000
2006-06-21	20:04:55	-6.96821	51.92892	6.2	6.2	639697.30000	5755083.10000
2006-06-21	20:07:07	-6.98130	51.93282	6.2	6.2	638785.69000	5755491.50000
2006-06-21	20:09:19	-6.99558	51.93392	6.2	6.2	637800.23000	5755586.10000
2006-06-21	20:11:30	-7.00972	51.93806	6.2	6.2	636815.72000	5756020.60000
2006-06-21	20:13:43	-7.02412	51.94170	6.2	6.2	635814.93000	5756398.40000
2006-06-21	20:15:56	-7.03805	51.94504	6.2	6.2	634847.64000	5756743.40000
2006-06-21	20:18:19	-7.05357	51.94017	6.2	6.2	633795.50000	5756173.70000
2006-06-21	20:20:49	-7.07035	51.93468	6.2	6.2	632658.47000	5755532.50000
2006-06-21	20:23:19	-7.08226	51.93128	6.2	6.2	631849.87000	5755132.10000
2006-06-21	20:25:31	-7.09397	51.93145	6.2	6.2	631044.01000	5755129.70000
2006-06-21	20:27:49	-7.10594	51.93418	6.2	6.2	630213.31000	5755412.60000
2006-06-21	20:30:07	-7.11838	51.93647	6.2	6.2	629351.69000	5755644.60000
2006-06-21	20:32:20	-7.13231	51.93359	6.2	6.2	628402.16000	5755299.60000
2006-06-21	20:34:43	-7.14559	51.92439	6.2	6.2	627515.21000	5754252.80000
2006-06-21	20:37:01	-7.15992	51.91804	6.2	6.2	626547.66000	5753521.60000
2006-06-21	20:39:20	-7.17634	51.91853	6.2	6.2	625417.35000	5753548.20000
2006-06-21	20:41:30	-7.19056	51.91872	6.2	6.2	624438.97000	5753544.40000
2006-06-21	20:43:49	-7.20412	51.91658	6.2	6.2	623512.48000	5753283.70000
2006-06-21	20:46:07	-7.21879	51.91735	6.2	6.2	622501.41000	5753344.50000
2006-06-21	20:48:19	-7.23236	51.91628	6.2	6.2	621571.44000	5753203.20000
2006-06-21	20:50:37	-7.24680	51.91654	6.2	6.2	620577.46000	5753208.20000
2006-06-21	20:52:48	-7.26108	51.91442	6.2	6.2	619601.28000	5752948.50000
2006-06-21	20:55:01	-7.27334	51.91375	6.2	6.2	618759.89000	5752853.70000
2006-06-21	20:57:14	-7.28510	51.91937	6.2	6.2	617936.13000	5753459.80000
2006-06-21	20:59:25	-7.29653	51.92360	6.2	6.2	617138.78000	5753911.50000
2006-06-21	21:01:36	-7.30587	51.92531	6.2	6.2	616492.58000	5754087.30000
2006-06-21	21:03:56	-7.32102	51.92161	6.2	6.2	615459.95000	5753651.10000
2006-06-21	21:06:06	-7.33423	51.92266	6.2	6.2	614549.49000	5753746.70000
2006-06-21	21:08:18	-7.34527	51.92961	6.2	6.2	613772.55000	5754502.50000
2006-06-21	21:10:37	-7.36041	51.93295	6.2	6.2	612723.16000	5754850.90000
2006-06-21	21:16:36	-7.40056	51.94133	6.2	6.2	609942.27000	5755721.40000
2006-06-21	21:18:49	-7.40028	51.94125	6.2	6.2	609962.29000	5755712.40000
2006-06-21	21:21:01	-7.40044	51.94117	6.2	6.2	609951.37000	5755703.60000
2006-06-21	21:23:25	-7.40046	51.94107	6.2	6.2	609949.79000	5755692.10000
2006-06-21	21:25:37	-7.40008	51.94118	6.2	6.2	609976.09000	5755705.00000
2006-06-21	21:27:55	-7.40016	51.94100	6.2	6.2	609971.02000	5755685.30000
2006-06-21	21:31:25	-7.40075	51.94086	6.2	6.2	609930.70000	5755669.00000
2006-06-21	21:34:33	-7.40036	51.94086	6.2	6.2	609957.63000	5755668.90000
2006-06-21	21:37:55	-7.40036	51.94075	6.2	6.2	609957.56000	5755656.40000
		
Dr Samantha Patrick
EU INTERREG Post Doc
Marine Biology & Ecology Research Centre
University of Plymouth 
Plymouth
PL4 8AA

T: 01752 584699
M: 07740472719

-----Original Message-----
From: Cl?ment Calenge [mailto:clement.calenge at oncfs.gouv.fr] 
Sent: 21 April 2010 11:18
To: Samantha Patrick
Cc: r-sig-ecology at r-project.org
Subject: Re: [R-sig-eco] FPT and Adehabitat

Hard to say without any reproducible example... could you post an 
example (minimum dataset + R code)?
Best regards,

Cl?ment Calenge
Samantha Patrick wrote:

  
    
#
Samantha Patrick wrote:
Actually, when you use redisltraj, you redicretize your trajectory so 
that the step length is constant (you fix it to 500 metres). Your 
original dataset has 139 relocations, but when you rediscretize the 
trajectory, you increase the number of relocations. Indeed, have a look 
at the contents of ayayGPS:

 > ayayGPS

*********** List of class ltraj ***********

Type of the traject: Type II (time recorded)
Irregular traject. Variable time lag between two locs

Characteristics of the bursts:
   id    burst nb.reloc NAs          date.begin            date.end
1 6.2 6.2.R500      295   0 2006-06-21 15:09:48 2006-06-21 21:16:01

There are 295 relocations in your new trajectory. This explains why the 
fpt returns a data frame with 295 data points. Now the question is: why 
do you rediscretize the trajectory? You note that "The timing of bursts 
is not constant". This is expected: the function redisltraj does not 
transform an irregular trajectory into a regular one (the help page of 
this function indicates that it is used for "Rediscretization of a 
Trajectory With Regular Step Length").

Looking at the time lag between successive relocations:

plotltr(yaya,"dt/60")

it appears that a relocation was collected approximately every 2 min... 
and that there are missing values. Two points are important here:

* there should be missing values in the trajectory at several places. 
Therefore the function setNA may be useful here to fill in these NAs 
(have a look at the help page of the function setNA):

yaya2 <- setNA(yaya, as.POSIXct("2010-01-01"), 2, units="min")

have a look at yaya2:

 > yaya2

*********** List of class ltraj ***********

Type of the traject: Type II (time recorded)
Irregular traject. Variable time lag between two locs

Characteristics of the bursts:
   id burst nb.reloc NAs          date.begin            date.end
1 6.2   6.2      195  56 2006-06-21 15:09:48 2006-06-21 21:37:55

The number of relocations have increased (there are now 195 relocations, 
because 56 are missing)

* the timings are only approximate. We can "round" the timing to make 
the trajectory exactly regular (see the help page of sett0):

yaya3 <- sett0(yaya2, as.POSIXct("2010-01-01"), 2, units="min")

yaya3 is now exactly regular:

 > yaya3

*********** List of class ltraj ***********

Type of the traject: Type II (time recorded)
Regular traject. Time lag between two locs: 120 seconds

Characteristics of the bursts:
   id burst nb.reloc NAs          date.begin            date.end
1 6.2   6.2      195  56 2006-06-21 15:10:00 2006-06-21 21:38:00

the time lag between relocations is now constant. This dataset yaya3 
contains only the original relocations (with rounded timings) + missing 
values.
 **But note that the step length is no longer constant** (but why do you 
need constant step length in FPT analysis?). Finally use the function fpt:

fptshort <- fpt(yaya3, seq(5000,30000, length=6))

Hope this helps

Cl?ment Calenge.

  
    
#
Thank you so much - you have been a huge help.  I have followed you recommendation and now I have my trajectories sampled at an equal time period and the missing values entered as NAs.  To continue with my analysis I have been trying to find a way to output the object of class ltraj (in this case yaya3) so I can see where R has placed the NAs and the corresponding co-ordinates of points with FP values (to allow spatial analysis).  However I can only find a function to plot the positions of NAs  - the final hurdle!

Many Thanks again

Sam


Dr Samantha Patrick
EU INTERREG Post Doc
Marine Biology & Ecology Research Centre
University of Plymouth
Plymouth
PL4 8AA

T: 01752 584699
M: 07740472719


-----Original Message-----
From: Cl?ment Calenge [mailto:clement.calenge at oncfs.gouv.fr]
Sent: 21 April 2010 12:12
To: Samantha Patrick
Cc: r-sig-ecology at r-project.org
Subject: Re: [R-sig-eco] FPT and Adehabitat
Samantha Patrick wrote:
Actually, when you use redisltraj, you redicretize your trajectory so
that the step length is constant (you fix it to 500 metres). Your
original dataset has 139 relocations, but when you rediscretize the
trajectory, you increase the number of relocations. Indeed, have a look
at the contents of ayayGPS:

 > ayayGPS

*********** List of class ltraj ***********

Type of the traject: Type II (time recorded)
Irregular traject. Variable time lag between two locs

Characteristics of the bursts:
   id    burst nb.reloc NAs          date.begin            date.end
1 6.2 6.2.R500      295   0 2006-06-21 15:09:48 2006-06-21 21:16:01

There are 295 relocations in your new trajectory. This explains why the
fpt returns a data frame with 295 data points. Now the question is: why
do you rediscretize the trajectory? You note that "The timing of bursts
is not constant". This is expected: the function redisltraj does not
transform an irregular trajectory into a regular one (the help page of
this function indicates that it is used for "Rediscretization of a
Trajectory With Regular Step Length").

Looking at the time lag between successive relocations:

plotltr(yaya,"dt/60")

it appears that a relocation was collected approximately every 2 min...
and that there are missing values. Two points are important here:

* there should be missing values in the trajectory at several places.
Therefore the function setNA may be useful here to fill in these NAs
(have a look at the help page of the function setNA):

yaya2 <- setNA(yaya, as.POSIXct("2010-01-01"), 2, units="min")

have a look at yaya2:

 > yaya2

*********** List of class ltraj ***********

Type of the traject: Type II (time recorded)
Irregular traject. Variable time lag between two locs

Characteristics of the bursts:
   id burst nb.reloc NAs          date.begin            date.end
1 6.2   6.2      195  56 2006-06-21 15:09:48 2006-06-21 21:37:55

The number of relocations have increased (there are now 195 relocations,
because 56 are missing)

* the timings are only approximate. We can "round" the timing to make
the trajectory exactly regular (see the help page of sett0):

yaya3 <- sett0(yaya2, as.POSIXct("2010-01-01"), 2, units="min")

yaya3 is now exactly regular:

 > yaya3

*********** List of class ltraj ***********

Type of the traject: Type II (time recorded)
Regular traject. Time lag between two locs: 120 seconds

Characteristics of the bursts:
   id burst nb.reloc NAs          date.begin            date.end
1 6.2   6.2      195  56 2006-06-21 15:10:00 2006-06-21 21:38:00

the time lag between relocations is now constant. This dataset yaya3
contains only the original relocations (with rounded timings) + missing
values.
 **But note that the step length is no longer constant** (but why do you
need constant step length in FPT analysis?). Finally use the function fpt:

fptshort <- fpt(yaya3, seq(5000,30000, length=6))

Hope this helps

Cl?ment Calenge.
--
Cl?ment CALENGE
Cellule d'appui ? l'analyse de donn?es
Office national de la chasse et de la faune sauvage
Saint Benoist - 78610 Auffargis
tel. (33) 01.30.46.54.14
#
Samantha Patrick wrote:
see the help page of plotNAltraj.
Best regards,

Cl?ment Calenge