LoslegenKostenlos loslegen

Suspicious timestamps

A confidence interval (CI) for the time of a transaction can indicate a suspicious timestamp. By estimating the parameters mu and kappa of the von Mises distribution on previous timestamps, you can calculate the density (or likelihood) of a new timestamp.

The dataset ts containing all timestamps and the circular package are already loaded. The estimates of the first 24 timestamps are available in your workspace, as well as the probability level alpha set to 95%.

Diese Übung ist Teil des Kurses

Fraud Detection in R

Kurs anzeigen

Anleitung zur Übung

  • Get the periodic mean (mu) and the concentration (kappa) of the first 24 estimates.
  • Use dvonmises() to estimate the densities of all timestamps in ts.
  • Use dvonmises() and qvonmises() to determine the 95% cutoff value for (1 - alpha)/2). Refer to the slides if necessary!
  • Define the variable time_feature: it should be true if densities are greater than or equal to the cutoff and false otherwise. Submit answer to see which timestamps lie outside the 95% confidence interval.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Estimate the periodic mean and concentration on the first 24 timestamps
p_mean <- ___ %% 24
concentration <- ___

# Estimate densities of all 25 timestamps
densities <- ___(___, mu = ___, kappa = ___)

# Check if the densities are larger than the cutoff of 95%-CI
quantile <- ___((1 - ___)/2, mu = p_mean, kappa = concentration)
cutoff <- ___(___, mu = ___, kappa = ___)

# Define the variable time_feature
time_feature <- ___ >= ___
print(cbind.data.frame(ts, time_feature))
Code bearbeiten und ausführen