Extract summary output and optionally export as a .csv file.

Description

Takes a fitted fit_ssm object and extracts the summary data.frame, which includes the animal ids, POSIXct date/time (at increments specified by tstep in the fit_ssm call), posterior mean longitude and latitude, and the 2.5, 50, and 97.5 longitude and latitude. For the DCRWS and hDCRWS models, the posterior mean and median behavioural states corresponding to each estimated location are also provided.

Usage

1
get_summary(x, file = " ")

Arguments

x

an output object from fit_ssm. If not an error will be returned.

file

a character string naming a file. " " indicates output to the console (default)

Value

a summary data.frame printed either to the console (default) or written as .csv to a specified file.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
data(ellie)
fit <- fit_ssm(ellie, model = "DCRW", tstep = 1, adapt = 2000, samples = 1000, 
                thin = 2, span = 0.1)
                
## print to console                 
get_summary(fit)

## export to .csv file
get_summary(fit, file = "ellie_dcrw.csv")

## plot track of second animal (posterior mean longitude and latitude)
p <- ggplot(data = subset(get_summary(fit), id == unique(id)[2])) + 
       geom_point(aes(lat, lon), col = "firebrick", size = 2)
p

## overlay posterior median longitude and latitude
p + geom_point(aes(lat.5, lon.5), col = "dodgerblue", size = 1)

## End(Not run)