resid_calc

Author

Isaac Berg

load("Z:/Isaac/Visual Features/data/all_objects_12_12.RData")
aug_res_60
# A tibble: 19,890 × 19
   feature sow   time_group_60 datetime            hour     ttf mean_value
   <fct>   <fct> <fct>         <dttm>              <fct>  <dbl>      <dbl>
 1 Area    1     1             2025-04-01 09:13:30 9     -17.9      58046.
 2 Area    1     2             2025-04-01 10:00:01 10    -17.0      56895.
 3 Area    1     3             2025-04-01 11:00:00 11    -16.0      58349.
 4 Area    1     4             2025-04-01 12:00:00 12    -15.0      50050.
 5 Area    1     5             2025-04-01 13:00:02 13    -14.0      47858.
 6 Area    1     6             2025-04-01 14:00:02 14    -13.0      50943.
 7 Area    1     7             2025-04-01 15:00:01 15    -12.0      50301.
 8 Area    1     8             2025-04-01 16:00:01 16    -11.0      53684.
 9 Area    1     9             2025-04-01 17:00:01 17    -10.0      47713.
10 Area    1     10            2025-04-01 18:00:00 18     -9.03     54449.
# ℹ 19,880 more rows
# ℹ 12 more variables: sd_value <dbl>, var_value <dbl>, n_obs <int>,
#   .fitted <dbl>, .fixed <dbl>, .mu <dbl>, .offset <dbl>, .sqrtXwt <dbl>,
#   .sqrtrwt <dbl>, .weights <dbl>, .wtres <dbl>, .resid <dbl>
aug_resid <- aug_res_60$.resid[16]
aug_resid
[1] 2096.505
y <- aug_res_60$mean_value[16]
est <- aug_res_60$.fitted[16]
obs_resid <- y-est
obs_resid
[1] 2096.505
aug_resid
[1] 2096.505
df_60_min_vars
$fixed
Loading required package: lmerTest
Warning: package 'lmerTest' was built under R version 4.4.3
Loading required package: lme4
Warning: package 'lme4' was built under R version 4.4.3
Loading required package: Matrix

Attaching package: 'lmerTest'
The following object is masked from 'package:lme4':

    lmer
The following object is masked from 'package:stats':

    step
# A tibble: 408 × 11
   feature data     model_fit  effect group term  estimate std.error statistic
   <fct>   <list>   <list>     <chr>  <chr> <chr>    <dbl>     <dbl>     <dbl>
 1 Area    <tibble> <lmrMdLmT> fixed  <NA>  hour0   65463.     2567.      25.5
 2 Area    <tibble> <lmrMdLmT> fixed  <NA>  hour1   66084.     2565.      25.8
 3 Area    <tibble> <lmrMdLmT> fixed  <NA>  hour2   65903.     2565.      25.7
 4 Area    <tibble> <lmrMdLmT> fixed  <NA>  hour3   66152.     2565.      25.8
 5 Area    <tibble> <lmrMdLmT> fixed  <NA>  hour4   65806.     2568.      25.6
 6 Area    <tibble> <lmrMdLmT> fixed  <NA>  hour5   64931.     2566.      25.3
 7 Area    <tibble> <lmrMdLmT> fixed  <NA>  hour6   65227.     2564.      25.4
 8 Area    <tibble> <lmrMdLmT> fixed  <NA>  hour7   65901.     2564.      25.7
 9 Area    <tibble> <lmrMdLmT> fixed  <NA>  hour8   65195.     2559.      25.5
10 Area    <tibble> <lmrMdLmT> fixed  <NA>  hour9   65254.     2556.      25.5
# ℹ 398 more rows
# ℹ 2 more variables: df <dbl>, p.value <dbl>

$random
# A tibble: 34 × 11
   feature   data     model_fit  effect group term  estimate std.error statistic
   <fct>     <list>   <list>     <chr>  <chr> <chr>    <dbl>     <dbl>     <dbl>
 1 Area      <tibble> <lmrMdLmT> ran_p… sow   sd__…  1.05e+4        NA        NA
 2 Area      <tibble> <lmrMdLmT> ran_p… Resi… sd__…  4.67e+3        NA        NA
 3 Centroid… <tibble> <lmrMdLmT> ran_p… sow   sd__…  2.32e+1        NA        NA
 4 Centroid… <tibble> <lmrMdLmT> ran_p… Resi… sd__…  1.78e+1        NA        NA
 5 Centroid… <tibble> <lmrMdLmT> ran_p… sow   sd__…  1.65e+1        NA        NA
 6 Centroid… <tibble> <lmrMdLmT> ran_p… Resi… sd__…  8.48e+0        NA        NA
 7 Concavity <tibble> <lmrMdLmT> ran_p… sow   sd__…  2.92e-2        NA        NA
 8 Concavity <tibble> <lmrMdLmT> ran_p… Resi… sd__…  3.84e-2        NA        NA
 9 Convex.A… <tibble> <lmrMdLmT> ran_p… sow   sd__…  1.20e+4        NA        NA
10 Convex.A… <tibble> <lmrMdLmT> ran_p… Resi… sd__…  7.00e+3        NA        NA
# ℹ 24 more rows
# ℹ 2 more variables: df <dbl>, p.value <dbl>

$model_summaries
# A tibble: 17 × 10
   feature      data     model_fit   nobs   sigma  logLik    AIC    BIC REMLcrit
   <fct>        <list>   <list>     <int>   <dbl>   <dbl>  <dbl>  <dbl>    <dbl>
 1 Area         <tibble> <lmrMdLmT>  1170 4.67e+3 -11400. 22853. 22984.   22801.
 2 Centroid.X   <tibble> <lmrMdLmT>  1170 1.78e+1  -5006. 10064. 10196.   10012.
 3 Centroid.Y   <tibble> <lmrMdLmT>  1170 8.48e+0  -4166.  8384.  8516.    8332.
 4 Concavity    <tibble> <lmrMdLmT>  1170 3.84e-2   2035. -4017. -3886.   -4069.
 5 Convex.Area  <tibble> <lmrMdLmT>  1170 7.00e+3 -11860. 23772. 23904.   23720.
 6 Convex.Peri… <tibble> <lmrMdLmT>  1170 4.29e+1  -6023. 12098. 12230.   12046.
 7 Eccentricity <tibble> <lmrMdLmT>  1170 4.25e-2   1923. -3795. -3663.   -3847.
 8 Elasticity   <tibble> <lmrMdLmT>  1170 1.19e-1    733. -1414. -1283.   -1466.
 9 Elongation   <tibble> <lmrMdLmT>  1170 1.95e-1    172.  -292.  -160.    -344.
10 Height       <tibble> <lmrMdLmT>  1170 2.17e+1  -5228. 10508. 10640.   10456.
11 Major.Axis.… <tibble> <lmrMdLmT>  1170 1.84e+1  -5055. 10162. 10294.   10110.
12 Minor.Axis.… <tibble> <lmrMdLmT>  1170 2.17e+1  -5228. 10508. 10640.   10456.
13 Perimeter    <tibble> <lmrMdLmT>  1170 1.61e+2  -7528. 15107. 15239.   15055.
14 Rightmost.X  <tibble> <lmrMdLmT>  1170 1.17e+1  -4539.  9130.  9261.    9078.
15 Rightmost.Y  <tibble> <lmrMdLmT>  1170 3.41e+1  -5744. 11540. 11672.   11488.
16 Roundness    <tibble> <lmrMdLmT>  1170 7.01e-2   1336. -2620. -2488.   -2672.
17 Width        <tibble> <lmrMdLmT>  1170 1.84e+1  -5055. 10162. 10294.   10110.
# ℹ 1 more variable: df.residual <int>

$augment
# A tibble: 17 × 2
   feature           aug                  
   <fct>             <list>               
 1 Area              <tibble [1,170 × 17]>
 2 Centroid.X        <tibble [1,170 × 17]>
 3 Centroid.Y        <tibble [1,170 × 17]>
 4 Concavity         <tibble [1,170 × 17]>
 5 Convex.Area       <tibble [1,170 × 17]>
 6 Convex.Perimeter  <tibble [1,170 × 17]>
 7 Eccentricity      <tibble [1,170 × 17]>
 8 Elasticity        <tibble [1,170 × 17]>
 9 Elongation        <tibble [1,170 × 17]>
10 Height            <tibble [1,170 × 17]>
11 Major.Axis.Length <tibble [1,170 × 17]>
12 Minor.Axis.Length <tibble [1,170 × 17]>
13 Perimeter         <tibble [1,170 × 17]>
14 Rightmost.X       <tibble [1,170 × 17]>
15 Rightmost.Y       <tibble [1,170 × 17]>
16 Roundness         <tibble [1,170 × 17]>
17 Width             <tibble [1,170 × 17]>
df_60_min_vars$fixed$estimate[1]
[1] 65462.66
aug_res_60$.fixed[16]
      16 
65462.66