First off, I am an R newbie. I am trying to apply density plots to various groups within my data. Using fitdistrplus, I have created a single distribution density plot for all of my data.
plot(my_data, pch=20)
plotdist(my_data$Capture_Rate, histo = TRUE, demp = TRUE)
fit_w <- fitdist(my_data$Capture_Rate, "weibull")
fit_g <- fitdist(my_data$Capture_Rate, "gamma")
fit_ln <- fitdist(my_data$Capture_Rate, "lnorm")
par(mfrow=c(2,2))
plot.legend <- c("Weibull", "lognormal", "gamma")
denscomp(list(fit_w, fit_ln, fit_g), legendtext = plot.legend)
Using facet_grid in ggplot, I have created a grid of histograms for each grouping of my data.
df_data <- data.frame(my_data)
cdat <- ddply(df_data, c("sYear", "Season"), summarise, Capture_Rate.mean=mean(Capture_Rate))
ggplot(df_data, aes(x=Capture_Rate, fill=sYear))+
geom_histogram(binwidth = .025,
alpha = .5,
position = "identity")+
#geom_density(alpha=.2, fill="#FF6666")+
geom_vline(data=cdat, aes(xintercept=Capture_Rate.mean),
color="red", linetype="dashed", size=1)+
facet_grid(Season ~ sYear)
What I am looking for is to combine the two results where I get a density plot for each histogram in my grouping grid. Thank you for the assistance.
Sample Data:
a <- dput(my_data)
structure(list(Schedule_Name = structure(c(1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 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1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L), .Label = "38K", class = "factor"), sDate = structure(c(17664,
17665, 17666, 17667, 17668, 17669, 17670, 17672, 17674, 17675,
17676, 17677, 17678, 17679, 17680, 17681, 17682, 17683, 17684,
17685, 17686, 17687, 17688, 17689, 17690, 17691, 17692, 17693,
17694, 17696, 17697, 17698, 17699, 17700, 17701, 17702, 17703,
17704, 17705, 17706, 17707, 17708, 17710, 17711, 17712, 17713,
17714, 17715, 17716, 17717, 17718, 17719, 17720, 17721, 17722,
17723, 17724, 17725, 17728, 17729, 17730, 17731, 17732, 17733,
17734, 17735, 17736, 17737, 17738, 17739, 17740, 17741, 17742,
17743, 17744, 17745, 17746, 17747, 17748, 17749, 17750, 17751,
17753, 17754, 17755, 17758, 17759, 17761, 17762, 17763, 17764,
17765, 17766, 17767, 17768, 17769, 17770, 17771, 17772, 17773,
17774, 17775, 17776, 17777, 17778, 17779, 17781, 17782, 17783,
17784, 17785, 17786, 17787, 17788, 17789, 17790, 17791, 17792,
17793, 17794, 17795, 17796, 17797, 17798, 17799, 17800, 17801,
17802, 17803, 17804, 17805, 17806, 17807, 17808, 17809, 17810,
17811, 17812, 17813, 17814, 17815, 17816, 17817, 17818, 17819,
17820, 17821, 17822, 17823, 17824, 17825, 17826, 17827, 17828,
17829, 17830, 17831, 17832, 17833, 17834, 17835, 17836, 17837,
17838, 17839, 17840, 17841, 17842, 17843, 17844, 17845, 17846,
17847, 17848, 17849, 17850, 17851, 17852, 17853, 17854, 17855,
17856, 17857, 17858, 17859, 17860, 17861, 17862, 17863, 17864,
17865, 17866, 17867, 17868, 17869, 17870, 17871, 17872, 17873,
17874, 17875, 17876, 17877, 17878, 17879, 17880, 17881, 17882,
17883, 17884, 17885, 17886, 17887, 17888, 17889, 17890, 17891,
17892, 17893, 17894, 17895, 17896, 17897, 17898, 17899, 17900,
17901, 17902, 17903, 17904, 17905, 17906, 17907, 17908, 17909,
17910, 17911, 17912, 17913, 17914, 17915, 17916, 17917, 17918,
17919, 17920, 17921, 17922, 17923, 17924, 17925, 17926, 17927,
17928, 17929, 17930, 17931, 17932, 17933, 17934, 17935, 17936,
17937, 17938, 17939, 17940, 17941, 17942, 17943, 17944, 17945,
17946, 17947, 17948, 17949, 17950, 17951, 17952, 17953, 17954,
17955, 17956, 17957, 17958, 17959, 17960, 17961, 17962, 17963,
17964, 17965, 17966, 17967, 17968, 17969, 17970, 17971, 17972,
17973, 17974, 17975, 17976, 17977, 17978, 17979, 17980, 17981,
17982, 17983, 17984, 17985, 17986, 17987, 17988, 17989, 17990,
17991, 17992, 17993, 17994, 17995, 17996, 17997, 17998, 17999,
18000, 18001, 18002, 18003, 18004, 18005, 18006, 18007, 18008,
18009, 18010, 18011, 18012, 18013, 18014, 18015, 18016, 18017,
18018, 18019, 18020, 18021, 18022, 18023, 18024, 18025, 18026,
18027, 18028, 18029, 18030, 18031, 18032, 18033, 18034, 18035,
18036, 18037, 18038, 18039, 18040, 18041, 18042, 18043, 18044,
18045, 18046, 18047, 18048, 18049, 18050, 18051, 18052, 18053,
18054, 18055, 18056, 18057, 18058, 18059, 18060, 18061, 18062,
18063, 18064, 18065, 18066, 18067, 18068, 18069, 18070, 18071,
18072, 18073, 18074, 18075, 18076, 18077, 18078, 18079, 18080,
18081, 18082, 18083, 18084, 18085, 18086, 18087, 18088, 18089,
18090, 18091, 18092), class = "Date"), Active_Tails = c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 6L, 6L, 6L, 7L, 8L, 10L,
10L, 10L, 11L, 11L, 11L, 11L, 11L, 12L, 12L, 12L, 12L, 12L,
12L, 13L, 13L, 14L, 14L, 14L, 14L, 15L, 16L, 16L, 16L, 16L,
16L, 16L, 16L, 17L, 18L, 18L, 19L, 19L, 19L, 20L, 21L, 21L,
21L, 22L, 22L, 23L, 24L, 25L, 26L, 26L, 26L, 26L, 25L, 26L,
26L, 27L, 27L, 28L, 28L, 28L, 28L, 28L, 29L, 30L, 30L, 31L,
32L, 33L, 33L, 34L, 34L, 34L, 35L, 35L, 36L, 36L, 36L, 37L,
37L, 37L, 37L, 38L, 40L, 41L, 41L, 41L, 41L, 41L, 41L, 41L,
41L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 43L, 45L, 46L,
46L, 46L, 46L, 46L, 46L, 47L, 48L, 48L, 49L, 49L, 49L, 49L,
50L, 51L, 51L, 52L, 52L, 52L, 52L, 53L, 53L, 54L, 55L, 55L,
55L, 55L, 56L, 56L, 56L, 58L, 58L, 58L, 58L, 60L, 59L, 59L,
60L, 60L, 60L, 60L, 61L, 62L, 63L, 63L, 63L, 63L, 65L, 65L,
65L, 66L, 66L, 66L, 66L, 66L, 66L, 66L, 67L, 67L, 67L, 67L,
67L, 68L, 68L, 68L, 68L, 69L, 69L, 69L, 69L, 69L, 69L, 69L,
69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L, 69L,
69L, 69L, 69L, 69L, 69L, 69L, 69L, 70L, 70L, 70L, 69L, 70L,
70L, 71L, 71L, 70L, 71L, 71L, 71L, 71L, 71L, 71L, 71L, 71L,
71L, 71L, 70L, 70L, 71L, 71L, 71L, 71L, 71L, 71L, 71L, 71L,
71L, 71L, 71L, 71L, 71L, 71L, 71L, 71L, 71L, 71L, 71L, 71L,
71L, 71L, 71L, 71L, 71L, 71L, 71L, 71L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, 16L, 22L, 17L, 17L, 15L, 22L, 21L, 16L,
19L, 19L, 18L, 14L, 23L, 23L, 25L, 17L, 15L, 22L, 21L, 17L,
19L, 17L, 20L, 23L, 22L, 22L, 22L, 19L, 19L, 25L, 22L, 25L,
25L, 21L, 22L, 24L, 24L, 22L, 20L, 26L, 22L, 22L, 26L, 25L,
24L, 27L, 27L, 26L, 24L, 28L, 23L, 27L, 25L, 25L, 27L, 27L,
23L, 28L, 23L, 23L, 29L, 32L, 23L, 19L, 30L, 27L, 30L, 29L,
25L, 29L, 26L, 24L, 30L, 30L, 33L, 24L, 31L, 30L, 28L, 28L,
29L, 35L, 33L, 30L, 33L, 35L, 37L, 32L, 32L, 36L, 30L, 31L,
33L, 33L, 31L, 33L, 33L, 37L, 33L, 33L, 38L, 37L, 37L, 38L,
34L, 36L, 38L, 28L, 35L, 30L, 33L, 38L, 39L, 30L, 34L, 32L,
28L, 37L, 33L, 36L, 39L, 33L, 36L, 34L, 39L, 28L, 39L, 39L,
32L, 30L, 35L, 33L, 37L, 25L, 32L, 30L, 28L, 39L, 36L, 33L,
38L, 40L, 37L, 33L, 35L, 43L, 30L, 32L, 40L, 36L, 30L, 31L,
41L, 29L, 31L, 38L, 41L, 34L, 35L, 42L, 34L, 33L, 40L, 33L,
31L, 38L, 37L, 29L, 33L, 35L, 38L, 34L, 33L, 36L, 39L, 33L,
33L, 31L, 33L, 36L, 33L, 38L, 33L, 30L, 28L, 30L, 28L, 37L,
34L, 33L, 33L, 34L, 35L, 31L, 38L, 30L, 35L, 30L, 45L, 35L,
31L, 30L, 26L, 26L, 35L, 34L, 26L, 34L, 36L, 31L, 31L), Capture_Rate = c(1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.5, 0.5,
1, 1, 0.5, 1, 0.5, 1, 1, 1, 1, 1, 0.5, 0.5, 1, 1, 0.5, 1,
0.33, 1, 1, 0.75, 0.5, 1, 1, 0.25, 0.6, 0.4, 0.8, 0.8, 0.6,
0.6, 0.8, 0.4, 1, 1, 0.67, 0.67, 1, 1, 0.25, 0.4, 0.6, 0.4,
0.64, 0.82, 0.55, 0.36, 0.64, 0.25, 0.75, 0.5, 0.75, 0.58,
0.58, 0.62, 0.54, 0.36, 0.57, 0.71, 0.79, 0.6, 0.38, 0.5,
0.31, 0.44, 0.38, 0.56, 0.63, 0.47, 0.56, 0.39, 0.47, 0.58,
0.47, 0.5, 0.52, 0.38, 0.48, 0.5, 0.5, 0.39, 0.33, 0.36,
0.5, 0.5, 0.62, 0.58, 0.4, 0.5, 0.62, 0.44, 0.37, 0.5, 0.61,
0.43, 0.43, 0.46, 0.52, 0.6, 0.47, 0.77, 0.47, 0.61, 0.52,
0.5, 0.41, 0.65, 0.54, 0.6, 0.64, 0.44, 0.53, 0.62, 0.43,
0.59, 0.46, 0.45, 0.38, 0.54, 0.51, 0.39, 0.46, 0.46, 0.44,
0.34, 0.56, 0.53, 0.58, 0.4, 0.35, 0.51, 0.49, 0.4, 0.44,
0.4, 0.44, 0.5, 0.48, 0.48, 0.48, 0.41, 0.41, 0.53, 0.46,
0.52, 0.51, 0.43, 0.45, 0.49, 0.48, 0.43, 0.39, 0.5, 0.42,
0.42, 0.5, 0.47, 0.45, 0.5, 0.49, 0.47, 0.44, 0.51, 0.41,
0.48, 0.45, 0.43, 0.47, 0.47, 0.4, 0.47, 0.39, 0.39, 0.48,
0.53, 0.38, 0.32, 0.49, 0.44, 0.48, 0.46, 0.4, 0.46, 0.4,
0.37, 0.46, 0.45, 0.5, 0.36, 0.47, 0.45, 0.42, 0.42, 0.43,
0.52, 0.49, 0.45, 0.49, 0.51, 0.54, 0.47, 0.47, 0.52, 0.43,
0.45, 0.48, 0.48, 0.45, 0.48, 0.48, 0.54, 0.48, 0.48, 0.55,
0.54, 0.54, 0.55, 0.49, 0.52, 0.55, 0.41, 0.51, 0.43, 0.48,
0.55, 0.57, 0.43, 0.49, 0.46, 0.4, 0.53, 0.48, 0.51, 0.56,
0.46, 0.51, 0.49, 0.55, 0.39, 0.55, 0.55, 0.45, 0.42, 0.49,
0.46, 0.52, 0.35, 0.46, 0.43, 0.39, 0.55, 0.51, 0.46, 0.54,
0.56, 0.52, 0.46, 0.49, 0.61, 0.42, 0.45, 0.56, 0.51, 0.42,
0.44, 0.58, 0.41, 0.44, 0.54, 0.58, 0.48, 0.49, 0.59, 0.48,
0.46, 0.56, 0.46, 0.44, 0.54, 0.52, 0.41, 0.46, 0.49, 0.54,
0.48, 0.46, 0.51, 0.55, 0.46, 0.46, 0.44, 0.46, 0.51, 0.46,
0.54, 0.46, 0.42, 0.39, 0.42, 0.39, 0.52, 0.48, 0.46, 0.46,
0.48, 0.49, 0.44, 0.54, 0.42, 0.49, 0.42, 0.63, 0.49, 0.44,
0.42, 0.37, 0.37, 0.49, 0.48, 0.37, 0.48, 0.51, 0.44, 0.44
), Total_SPR_IML = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L,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.44, 0.37, 0.5, 0.61, 0.43, 0.43,
0.46, 0.52, 0.6, 0.47, 0.77, 0.47, 0.61, 0.52, 0.5, 0.41,
0.65, 0.54, 0.6, 0.64, 0.44, 0.53, 0.62, 0.43, 0.59, 0.46,
0.45, 0.38, 0.54, 0.51, 0.39, 0.46, 0.46, 0.44, 0.34, 0.56,
0.53, 0.58, 0.4, 0.35, 0.51, 0.49, 0.4, 0.44, 0.4, 0.44,
0.5, 0.48, 0.48, 0.48, 0.41, 0.41, 0.53, 0.46, 0.52, 0.51,
0.43, 0.45, 0.49, 0.48, 0.43, 0.39, 0.5, 0.42, 0.42, 0.5,
0.47, 0.45, 0.5, 0.49, 0.47, 0.44, 0.51, 0.41, 0.48, 0.45,
0.43, 0.47, 0.47, 0.4, 0.47, 0.39, 0.39, 0.48, 0.53, 0.38,
0.32, 0.49, 0.44, 0.48, 0.46, 0.4, 0.46, 0.4, 0.37, 0.46,
0.45, 0.5, 0.36, 0.47, 0.45, 0.42, 0.42, 0.43, 0.52, 0.49,
0.45, 0.49, 0.51, 0.54, 0.47, 0.47, 0.52, 0.43, 0.45, 0.48,
0.48, 0.45, 0.48, 0.48, 0.54, 0.48, 0.48, 0.55, 0.54, 0.54,
0.55, 0.49, 0.52, 0.55, 0.41, 0.51, 0.43, 0.48, 0.55, 0.57,
0.43, 0.49, 0.46, 0.4, 0.53, 0.48, 0.51, 0.56, 0.46, 0.51,
0.49, 0.55, 0.39, 0.55, 0.55, 0.45, 0.42, 0.49, 0.46, 0.52,
0.35, 0.46, 0.43, 0.39, 0.55, 0.51, 0.46, 0.54, 0.56, 0.52,
0.46, 0.49, 0.61, 0.42, 0.45, 0.56, 0.51, 0.42, 0.44, 0.58,
0.41, 0.44, 0.54, 0.58, 0.48, 0.49, 0.59, 0.48, 0.46, 0.56,
0.46, 0.44, 0.54, 0.52, 0.41, 0.46, 0.49, 0.54, 0.48, 0.46,
0.51, 0.55, 0.46, 0.46, 0.44, 0.46, 0.51, 0.46, 0.54, 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,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L, 12L,
12L, 12L, 12L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L, 14L,
14L, 14L, 14L, 14L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 15L, 15L), .Label = c("2018-05",
"2018-06", "2018-07", "2018-08", "2018-09", "2018-10", "2018-11",
"2018-12", "2019-01", "2019-02", "2019-03", "2019-04", "2019-05",
"2019-06", "2019-07"), class = "factor"), Season = structure(c(3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 5L, 5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")
So, the solution for the empirical density is going to slightly easier than do the theoretical distributions. First, let's setup some dummy data, since we don't have any of yours to play around with.
set.seed(123)
# Setup some facets
idx <- expand.grid(c("A", "B"), c("C", "D"))
# For each facet, generate some numbers
df <- apply(idx, 1, function(x){
data.frame(row = x[[1]],
col = x[[2]],
# chose 10 as mean, since Weibull can't be negative
x = rnorm(100, 10))
})
df <- do.call(rbind, df)
Now for the empirical case, we can simply take the density in each facet. We can do this, because ggplot has included kernel density estimates as a stat function.
ggplot(df, aes(x)) +
geom_histogram(binwidth = 0.1) +
# To line up the histogram with KDE, we multiply y-values by binwidth
geom_line(aes(y = ..count..*0.1, colour = "empirical"), stat = "density") +
facet_grid(row ~ col)
Which looks like this:
Because we don't have any ggplot stat functions for the theoretical densities -at least not ones that are panel specific- we would have to pre-compute the xy-coordinates for the theoretical distributions in a separate data.frame:
# Loop over facets
dists <- apply(idx, 1, function(i){
# Grab data belonging to facet
dat <- df$x[df$row == i[[1]] & df$col == i[[2]]]
# Setup x-values
xseq <- seq(min(dat), max(dat), length.out = 100)
# Specify distributions of interest
dists <- c("weibull", "lnorm", "gamma")
# Loop over distributions
fits <- lapply(setNames(dists, dists), function(dist) {
# Estimate parameters
ests <- fitdist(dat, dist)$estimate
# Get y-values
y <- do.call(paste0("d", dist), c(list(x = xseq), as.list(ests)))
# Multiplied by length(dat) to match absolute counts
y * length(dat)
})
# Format everything neatly in a data.frame
out <- lapply(dists, function(j) {
data.frame(row = i[[1]],
col = i[[2]],
x = xseq,
y = fits[[j]],
distr = j)
})
# Combine all distributions
do.call(rbind, out)
})
# Combine all facets
dists <- do.call(rbind, dists)
Now that we've done that tedious work, we can finally plot it:
ggplot(df, aes(x)) +
geom_histogram(binwidth = 0.1) +
geom_line(data = dists, aes(y = y * 0.1, colour = distr)) +
facet_grid(row ~ col)
Adapt as necessary for your own data. Good luck!
EDIT: Now with example data
Assume df
is the data.frame from which you've posted the dput()
output. I've included a condition that checks if the length of the facet data is longer than 2 and wether the variance is non-zero, so as to skip data from which we wouldn't be able to make any estimates anyway. Furthermore, I've converted variable names to be compatible with how you named them in your data.frame.
idx <- expand.grid(levels(df$Season), levels(df$sYear))
# Loop over facets
dists <- apply(idx, 1, function(i){
dat <- df$Capture_Rate[df$Season == i[[1]] & df$sYear == i[[2]]]
print(length(dat))
if (length(dat) < 2 | var(dat) == 0) {
return(NULL)
}
xseq <- seq(min(dat), max(dat), length.out = 100)
dists <- c("weibull", "lnorm", "gamma")
fits <- lapply(setNames(dists, dists), function(dist) {
ests <- fitdist(dat, dist)$estimate
y <- do.call(paste0("d", dist), c(list(x = xseq), as.list(ests)))
y * length(dat)
})
out <- lapply(dists, function(j) {
data.frame(Season = i[[1]],
sYear = i[[2]],
x = xseq,
y = fits[[j]],
distr = j)
})
do.call(rbind, out)
})
dists <- do.call(rbind, dists)
ggplot(df, aes(x=Capture_Rate, fill=sYear))+
geom_histogram(binwidth = .025,
alpha = .5,
position = "identity") +
geom_line(data = dists, aes(x, y * .025, colour = distr), inherit.aes = FALSE) +
facet_grid(Season ~ sYear)