ctmm-initiative / ctmm

Continuous-Time Movement Modeling. Functions for identifying, fitting, and applying continuous-space, continuous-time stochastic movement models to animal tracking data.
http://biology.umd.edu/movement.html
43 stars 10 forks source link

Use units in sigma tau assignment #11

Closed xhdong-umd closed 7 years ago

xhdong-umd commented 7 years ago

@chfleming @jmcalabrese

Currently assign a value in sigma, tau etc require unit conversion manually, especially when you read the value from variogram, then need to convert to SI units.

m0 <- ctmm(sigma=23*1000^2) # 23 km^2 in m^2
m1 <- ctmm(sigma=23*1000^2,tau=6*24*60^2) # and 6 days in seconds

How about we make a utility function that take format like 23 km2, 6 days? With some simple rules these kind of input can be converted to SI unit value. So it will look like

m0 <- ctmm(sigma=SI("23 km^2")) 
m1 <- ctmm(sigma=SI("23 km^2"),tau=SI("6 days")) 

It should also take vector input so this

dt <- 60*60*c(1,5,25)
SVF3 <- variogram(gazelle[[18]],dt=dt)

become

SVF3 <- variogram(gazelle[[18]],dt=SI("1 5 25 hours"))
chfleming commented 7 years ago

I actually have code written to do that. I just need to export it in the NAMESPACE and document it. I will move it up on the TODO list.

xhdong-umd commented 7 years ago

That will be great. I think users will find it more friendly to use.

chfleming commented 7 years ago

Exported, documented, and vignettes updated.

Here is the example.