sigfig.Rd
Functions for concisely representing dimensionful quantities and uncertain quantities.
dimfig(data,dimension,thresh=1,...)
sigfig(est,VAR=NULL,SD=NULL,level=0.95,digits=2,...)
A numerical vector of dimensionful quantities represented in SI units.
One of "length"
, "area"
, "time"
, "frequency"
, "speed"
, "diffusion"
, or "mass"
.
Threshold quantity for switching between units. E.g., 100 cm is represented as 1 m only if thresh>=1
.
Can be either confidence-interval estimates with rows (lower-limit,point-estimate,upper-limit) or point estimates (with VAR
or SD
also specified).
Variance in the sampling distribution of x
.
Standard deviation in the sampling distribution of x
.
Confidence level for designating the numerical precision of the significant digits.
Number of significant digits to retain.
Not currently used.
dimfig
chooses the set of units that provides the most concise representation for data
, and sigfig
concisely represents statistical estimates with a fixed number of significant digits.
dimfig
returns a list
with slots for the converted data
and the name of the most concise units. sigfig
returns a character string that is formated with the specified number of significant digits.
# \donttest{
# Load package and data
library(ctmm)
data(buffalo)
DATA <- buffalo$Cilla
GUESS <- ctmm.guess(DATA,interactive=FALSE)
# in general, you want to run ctmm.select instead
FIT <- ctmm.fit(DATA,GUESS)
# raw summary (SI units)
summary(FIT,units=FALSE)
#> $name
#> [1] "OUF anisotropic"
#>
#> $DOF
#> mean area diffusion speed
#> 10.73353 18.13588 902.23372 3445.13307
#>
#> $CI
#> low est high
#> area (square meters) 2.396473e+08 4.034593e+08 6.092424e+08
#> τ[position] (seconds) 3.835257e+05 6.484644e+05 1.096422e+06
#> τ[velocity] (seconds) 2.376427e+03 2.524141e+03 2.681036e+03
#> speed (meters/second) 1.599590e-01 1.626753e-01 1.653910e-01
#> diffusion (square meters/second) 6.116371e+01 6.535948e+01 6.969245e+01
#>
# default summary (concise units)
summary(FIT,units=TRUE)
#> $name
#> [1] "OUF anisotropic"
#>
#> $DOF
#> mean area diffusion speed
#> 10.73353 18.13588 902.23372 3445.13307
#>
#> $CI
#> low est high
#> area (square kilometers) 239.647333 403.459263 609.242407
#> τ[position] (days) 4.438955 7.505375 12.690072
#> τ[velocity] (minutes) 39.607115 42.069009 44.683928
#> speed (kilometers/day) 13.820458 14.055146 14.289780
#> diffusion (square kilometers/day) 5.284545 5.647059 6.021428
#>
# text-formatted summary
sigfig( summary(FIT)$CI )
#> area (square kilometers) τ[position] (days)
#> "400 (240—610)" "7.5 (4.4—12.7)"
#> τ[velocity] (minutes) speed (kilometers/day)
#> "42.1 (39.6—44.7)" "14.06 (13.82—14.29)"
#> diffusion (square kilometers/day)
#> "5.65 (5.28—6.02)"
# }