about_common_mistakes: Tips to prevent common mistakes

Description Details Credit Author(s) See Also Examples

Description

Tips to prevent common mistakes

Details

Forgetting to use weighted statistics.

Mostly the coordinates don't have an even time interval. This can be because of the missing data, planned data gaps or deviations in the GPS tracker. To prevent this, you can calculate the time difference between coordinates with difftime and used it as weight for weighted descriptive statistics.

Recalculating track data after removing gaps.

After removing gaps, you should be careful to recalculate speed, time difference, etc. since this function can't see that the gaps are removed. To work around this, you can just omit gaps with the descriptive functions that begin with "des_". They can ignore gaps.

Credit

If you use 'psyosphere' for commercial use or research, please support us by include one off the following references:

Author(s)

Benjamin Ziepert. Please send feedback to: feedback-psyosphere@analyse-gps.com.

See Also

about_analysing_tips, about_demos, difftime, wtd.mean

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
## Not run: 
# Example forgetting to use weighted statistics --------------------------------
data(psyo)
tracks <- t_speed(psyo)
tracks <- t_time_difference(tracks, units = "secs")

# Without weighted statistics
mean(tracks[,c("speed")], na.rm = TRUE)
sd(tracks[,c("speed")], na.rm = TRUE)

# With weighted statistics
des_mean(tracks, "speed", "time_difference", t_id = "")

Hmisc::wtd.mean(
  tracks[,c("speed")], as.numeric(tracks[,c("time_difference")])
)

sqrt(Hmisc::wtd.var(
  tracks[,c("speed")], as.numeric(tracks[,c("time_difference")])
))

## End(Not run)

psyosphere documentation built on July 2, 2020, 12:08 a.m.