spline_interp {animalEKF}  R Documentation 
Calculate a Bezier spline interpolation of irregular observations to regularlength time intervals.
spline_interp(di, area_map=NULL, t_reg=NULL, reg_dt=120, max_dt_wo_obs=60*30, maxStep=NULL, centroids=matrix(c(0,0), ncol=2), nstates=2, spline_deg=3, split_logv=3)
di 
Object of class 
area_map 
Shapefile that all interpolated points should be inside of. 
t_reg 
Desired time steps (must have a constant difference) to interpolate to. If is given, the default value of

reg_dt 
Length in seconds of each regular interval. 
max_dt_wo_obs 
When interpolating, the maximum time length without observations for a given shark that we will interpolate. If this is exceeded, algorithm will wait until next observation and start from there. 
maxStep 
Maximum number of regular steps to interpolate. 
centroids 
Matrix with two columns specifying the centroids of regions. If 
nstates 
Number of behavioral states. For now restricted to a maximum of 2. 
spline_deg 
Degree of spline. The default is 3, or a cubic. Every 
split_logv 
If 
d 
Array of regular step locations. 
di 
Original irregularstep dataset. 
shark_names 
Vector of the names of sharks in the dataset. 
d_ds 
Output regularstep dataset 
Samuel Ackerman
Bezier R package. Aaron Olsen.
#can also be 'di' output of sim_trajectory_joint (set gen_irreg=TRUE) di < data.frame(X=runif(n=9), Y=runif(n=9), time_to_next=c(2,4,15,8,5,18,3,5,NA)) di$date_as_sec < c(0, cumsum(di$time_to_next[9])) region_centroids < cbind(X=runif(2), Y=runif(2)) #one log observation with dt =18 > 16 will be omitted spl < spline_interp(di=di, area_map=NULL, reg_dt=3, max_dt_wo_obs=16, maxStep=NULL, centroids=region_centroids, nstates=2, spline_deg=3, split_logv=3) plot(di[,c("X","Y")], xlim=c(0,1), ylim=c(0,1), type="b", las=1, "Observations interpolated by regular interval spline") lines(spl$d_ds[,c("X","Y")], type="l", col="red") legend("topleft", col=1:2, legend=c("observations","spline"), lty=1)