Comparing Quant results

setwd("C:/Users/ipberg/OneDrive - Iowa State University/Spring26/Sensors/")
load("4-13.RData")

# setwd("/Users/IsaacBerg/Documents/Code/Sensors/")
# load("4-13.RData")
library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
library(tidyr)
library(forcats)
library(ggplot2)
library(purrr)
library(slider)
Warning: package 'slider' was built under R version 4.4.3
library(lubridate)

Attaching package: 'lubridate'
The following objects are masked from 'package:base':

    date, intersect, setdiff, union
library(ggforce)
Warning: package 'ggforce' was built under R version 4.4.3
library(FKF)
Warning: package 'FKF' was built under R version 4.4.3
library(data.table)

Attaching package: 'data.table'
The following objects are masked from 'package:lubridate':

    hour, isoweek, mday, minute, month, quarter, second, wday, week,
    yday, year
The following object is masked from 'package:purrr':

    transpose
The following objects are masked from 'package:dplyr':

    between, first, last
# 1. Transpose each table and convert to a data frame-like structure
# We use t() to flip them and as.data.frame to keep the row names
res_68 <- as.data.frame(t(quant_res_final68))
res_90 <- as.data.frame(t(quant_res_final90))
res_95 <- as.data.frame(t(quant_res_final95))

# 2. Combine them into one table
comparison_table <- cbind(res_68, res_90, res_95)

# 3. Rename the columns for clarity
colnames(comparison_table) <- c("CI_68", "CI_90", "CI_95")

# 4. View the result
print(comparison_table)
                                 CI_68      CI_90     CI_95
n_total_sows                 94.000000  94.000000  94.00000
n_first_alarm                87.000000  87.000000  78.00000
n_no_first_alarm              7.000000   7.000000  16.00000
n_second_alarm               79.000000  79.000000  51.00000
n_no_second_alarm            15.000000  15.000000  43.00000
mean_first_alarm            -29.597701 -29.597701 -21.72756
mean_second_alarm            -7.344937  -7.344937   2.27451
n_first_alarm_gt_48h_before  21.000000  21.000000  11.00000
n_first_alarm_24_to_48h_pre  34.000000  34.000000  27.00000
n_first_alarm_0_to_24h_pre   24.000000  24.000000  27.00000
n_first_alarm_on_FD           3.000000   3.000000   7.00000
n_first_alarm_after_FD        5.000000   5.000000   6.00000
n_second_alarm_before_FD     46.000000  46.000000  22.00000
n_second_alarm_on_FD         26.000000  26.000000  17.00000
n_second_alarm_after_FD       7.000000   7.000000  12.00000