如何使用geom_density()

时间:2017-05-11 05:28:52

标签: r ggplot2 mixture-model

我有以下数据框:

  dat <- structure(list(crt = c(0.049, 0.098, 0.06, 0.06, 0.09951, 0.09939, 
0.09963, 0.09939, 0.09926, 0.0996, 0.09938, 0.09933, 0.09946, 
0.09955, 0.09972, 0.09941, 0.09982, 0.09962, 0.09934, 0.0995, 
0.09985, 0.0996, 0.09976, 0.09951, 0.09986, 0.09979, 0.09931, 
0.09983, 0.09959, 0.09972, 0.09897, 0.09991, 0.09931, 0.09959, 
0.09908, 0.09941, 0.09944, 0.09951, 0.09981, 0.09913, 0.0994, 
0.09934, 0.09969, 0.09967, 0.09968, 0.0991, 0.09937, 0.09968, 
0.09968, 0.09947, 0.09911, 0.0994, 0.09986, 0.0991, 0.09969, 
0.09914, 0.09944, 0.0995, 0.10025, 0.09951, 0.09974, 0.09936, 
0.09914, 0.09901, 0.0996, 0.09975, 0.09865, 0.09916, 0.09936, 
0.0994, 0.09949, 0.0995, 0.09902, 0.09961, 0.09955, 0.09932, 
0.09965, 0.09923, 0.09955, 0.09928, 0.09918, 0.09925, 0.09958, 
0.09944, 0.09953, 0.09942, 0.09918, 0.09977, 0.09931, 0.0998, 
0.0995, 0.09924, 0.0997, 0.09902, 0.09925, 0.09957, 0.09941, 
0.09941, 0.09969, 0.09956, 0.09944, 0.09961, 0.09954, 0.09951, 
0.09974, 0.09925, 0.0995, 0.09999, 0.09944, 0.09894, 0.09986, 
0.09906, 0.09986, 0.09986, 0.09915, 0.09929, 0.09983, 0.09938, 
0.09973, 0.09963, 0.09903, 0.09951, 0.09992, 0.09949, 0.09961, 
0.0993, 0.09967, 0.0997, 0.09946, 0.09995, 0.09931, 0.09963, 
0.09942, 0.09944, 0.09988, 0.09977, 0.09981, 0.09942, 0.0996, 
0.09965, 0.09948, 0.09982, 0.09942, 0.09945, 0.09947, 0.09934, 
0.09974, 0.09944, 0.09931, 0.09979, 0.09915, 0.0996, 0.09938, 
0.09984, 0.09936, 0.09957, 0.09943, 0.09954, 0.09928, 0.09966, 
0.09945, 0.09898, 0.0993, 0.09942, 0.0989, 0.09906, 0.09952, 
0.09925, 0.09913, 0.09935, 0.09992, 0.09966, 0.09914, 0.09957, 
0.09912, 0.09947, 0.09933, 0.09967, 0.09921, 0.09952, 0.09935, 
0.09902, 0.09943, 0.0995, 0.09946, 0.09876, 0.09954, 0.09944, 
0.09932, 0.09981, 0.09993, 0.09924, 0.09917, 0.09911, 0.09947, 
0.09938, 0.09912, 0.0987, 0.09941, 0.09933, 0.09945, 0.09938, 
0.09888, 0.09943, 0.09896, 0.09913, 0.09923, 0.09946, 0.09876, 
0.09951, 0.09831, 0.09951, 0.09955, 0.09929, 0.09981, 0.09964, 
0.09892, 0.09948, 0.09966, 0.09953, 0.09984, 0.09957, 0.09925, 
0.09931, 0.09923, 0.09996, 0.09894, 0.09909, 0.09948, 0.0996, 
0.09988, 0.09973, 0.0999, 0.09961, 0.09966, 0.0989, 0.09994, 
0.09975, 0.09948, 0.09912, 0.09951, 0.09948, 0.09938, 0.09988, 
0.0986, 0.09925, 0.09914, 0.09889, 0.09896, 0.09973, 0.09926, 
0.09936, 0.09962, 0.09962, 0.0997, 0.09932, 0.0996, 0.09935, 
0.09898, 0.09942, 0.09994, 0.09902, 0.09938, 0.09901, 0.09903, 
0.09996, 0.09971, 0.09901, 0.09969, 0.09933, 0.09921, 0.09923, 
0.09956, 0.09897, 0.09949, 0.09934, 0.09923, 0.09976, 0.09913, 
0.09978, 0.09963, 0.09942, 0.09891, 0.09965, 0.09935, 0.09956, 
0.09956, 0.09935, 0.09995, 0.09957, 0.09964, 0.09961, 0.09971, 
0.09962, 0.09959, 0.09934, 0.09916, 0.09945, 0.09935, 0.09931, 
0.09983, 0.09959, 0.09941, 0.09993, 0.09978, 0.09936, 0.09978, 
0.09939, 0.09948, 0.09942, 0.09928, 0.09907, 0.09937, 0.09948, 
0.09972, 0.09925, 0.09942, 0.09908, 0.09963, 0.09968, 0.09937, 
0.09933, 0.09961, 0.09936, 0.09862, 0.09935, 0.09893, 0.09984, 
0.09984, 0.09987, 0.09967, 0.09918, 0.0991, 0.09987, 0.09965, 
0.09949, 0.09965, 0.09942, 0.0997, 0.09931, 0.09984, 0.09954, 
0.09949, 0.09952, 0.09949, 0.0995, 0.09912, 0.09922, 0.09965, 
0.09986, 0.0995, 0.09965, 0.09959, 0.09955, 0.09962, 0.09945, 
0.09943, 0.09988, 0.09974, 0.09996, 0.09883, 0.09932, 0.09917, 
0.09946, 0.09975, 0.09901, 0.0995, 0.09937, 0.09943, 0.09979, 
0.09948, 0.0994, 0.09931, 0.09957, 0.0995, 0.09947, 0.09935, 
0.09939, 0.09954, 0.09978, 0.09889, 0.09911, 0.09904, 0.09936, 
0.09955, 0.09954, 0.09943, 0.0995, 0.09945, 0.09969, 0.09951, 
0.09939, 0.09985, 0.09925, 0.09954, 0.09949, 0.09954, 0.09915, 
0.09968, 0.09928, 0.09943, 0.09914, 0.09945, 0.09945, 0.09996, 
0.09988, 0.09957, 0.09973, 0.09969, 0.09935, 0.09921, 0.09936, 
0.0989, 0.0998, 0.09942, 0.09957, 0.09953, 0.09914, 0.09932, 
0.09904, 0.09982, 0.09929, 0.0997, 0.09954, 0.09939, 0.09966, 
0.09941, 0.09933, 0.09918, 0.09936, 0.09973, 0.09928, 0.0997, 
0.09917, 0.09999, 0.09923, 0.09944, 0.10008, 0.09859, 0.09931, 
0.09942, 0.09937, 0.09916, 0.09991, 0.09931, 0.09946, 0.09923, 
0.09943, 0.0994, 0.09972, 0.09977, 0.0988, 0.09967, 0.09944, 
0.09915, 0.0997, 0.09928, 0.09977, 0.09955, 0.0997, 0.09973, 
0.09891, 0.09978, 0.09987, 0.0986, 0.09926, 0.09934, 0.09952, 
0.09987, 0.09956, 0.09958, 0.09878, 0.0989, 0.09957, 0.0994, 
0.0988, 0.09976, 0.09968, 0.09912, 0.09937, 0.09887, 0.09944, 
0.09912, 0.09973, 0.09969, 0.09944, 0.09945, 0.09941, 0.09864, 
0.09956, 0.0996, 0.09958, 0.09919, 0.09962, 0.09969, 0.09961, 
0.09935, 0.09989, 0.09975, 0.09943, 0.09954, 0.09904, 0.09988, 
0.09929, 0.09945, 0.09978, 0.09899, 0.09957, 0.09905, 0.09967, 
0.09999, 0.09938, 0.09962, 0.0995, 0.09974, 0.09967, 0.0994, 
0.09979, 0.09939, 0.09968, 0.09955, 0.09915, 0.09946, 0.09937, 
0.09988, 0.09988, 0.09928, 0.09968, 0.0998, 0.09972, 0.09895, 
0.09964, 0.09992, 0.09954, 0.09909, 0.0993, 0.0994, 0.09887, 
0.09907, 0.09967, 0.09975, 0.09941, 0.09971, 0.09924, 0.0998, 
0.09931, 0.09897, 0.09932, 0.09973, 0.09948, 0.09955, 0.09933, 
0.09952, 0.09955, 0.09982, 0.09964, 0.09995, 0.09987, 0.09984, 
0.09952, 0.09963, 0.09904, 0.09899, 0.09947, 0.09958, 0.09949, 
0.09971, 0.09973, 0.09956, 0.09864, 0.09944, 0.09964, 0.09942, 
0.09895, 0.09978, 0.09946, 0.09921, 0.09983, 0.09891, 0.09953, 
0.09993, 0.09966, 0.09951, 0.09899, 0.09984, 0.0997, 0.0993, 
0.09851, 0.09932, 0.0994, 0.09948, 0.09984, 0.0999, 0.09988, 
0.09916, 0.09986, 0.09934, 0.09987, 0.09973, 0.0996, 0.09956, 
0.09931, 0.09947, 0.09885, 0.09938, 0.0991, 0.09954, 0.09956, 
0.09959, 0.09904, 0.09933, 0.09938, 0.09939, 0.09933, 0.09901, 
0.09949, 0.09936, 0.09953, 0.09955, 0.09996, 0.09908, 0.0992, 
0.09947, 0.09969, 0.09948, 0.09914, 0.09869, 0.09906, 0.09969, 
0.09964, 0.09896, 0.09924, 0.09954, 0.09969, 0.09967, 0.09946, 
0.09959, 0.0989, 0.09956, 0.09868, 0.09954, 0.09948, 0.09926, 
0.09918, 0.09972, 0.09916, 0.09978, 0.09917, 0.1, 0.09914, 0.09934, 
0.09979, 0.09959, 0.09915, 0.09961, 0.09962, 0.09933, 0.09966, 
0.0992, 0.09918, 0.09933, 0.09975, 0.09986, 0.09951, 0.09937, 
0.09956, 0.09955, 0.09944, 0.09923, 0.09926, 0.09944, 0.09963, 
0.0996, 0.09928, 0.09993, 0.09935, 0.09946, 0.09964, 0.09948, 
0.09985, 0.09912, 0.099, 0.09984, 0.09924, 0.0998, 0.09933, 0.09988, 
0.09947, 0.09931, 0.09906, 0.09889, 0.09905, 0.09969, 0.09946, 
0.09936, 0.09939, 0.0995, 0.09969, 0.09925, 0.09967, 0.09951, 
0.09981, 0.09945, 0.09977, 0.0991, 0.09941, 0.09953, 0.0995, 
0.09977, 0.09929, 0.09952, 0.09944, 0.09926, 0.09907, 0.0996, 
0.09941, 0.09957, 0.099, 0.09944, 0.09857, 0.09958, 0.09961, 
0.10008, 0.09973, 0.09978, 0.09968, 0.09946, 0.09927, 0.09977, 
0.09945, 0.09955, 0.09943, 0.09948, 0.0997, 0.09917, 0.0995, 
0.0999, 0.09942, 0.09915, 0.09895, 0.09878, 0.09946, 0.09934, 
0.09881, 0.09872, 0.09948, 0.09968, 0.09908, 0.0999, 0.09939, 
0.09962, 0.09976, 0.0995, 0.09925, 0.09956, 0.09982, 0.09982, 
0.09886, 0.10021, 0.09891, 0.09956, 0.0994, 0.09867, 0.09837, 
0.09972, 0.09936, 0.09935, 0.09952, 0.09927, 0.09995, 0.09935, 
0.09969, 0.0997, 0.09977, 0.1, 0.09936, 0.0998, 0.09946, 0.09897, 
0.09912, 0.09951, 0.09976, 0.0988, 0.0999, 0.09974, 0.09927, 
0.10006, 0.09945, 0.09969, 0.09872, 0.09916, 0.09885, 0.09989, 
0.09916, 0.09881, 0.09979, 0.09976, 0.09933, 0.09967, 0.09956, 
0.09952, 0.09938, 0.09971, 0.09944, 0.09852, 0.09988, 0.0988, 
0.09958, 0.09967, 0.09973, 0.09955, 0.09998, 0.09921, 0.09923, 
0.09957, 0.09956, 0.09892, 0.09919, 0.0991, 0.09943, 0.09958, 
0.09989, 0.09927, 0.09912, 0.10015, 0.09981, 0.0994, 0.0996, 
0.0996, 0.09953, 0.09827, 0.09919, 0.09969, 0.09956, 0.09988, 
0.09949, 0.09957, 0.09902, 0.09917, 0.09912, 0.09932, 0.09965, 
0.09964, 0.09951, 0.09916, 0.09895, 0.09952, 0.0996, 0.10026, 
0.09945, 0.09862, 0.09987, 0.09991, 0.09897, 0.09913, 0.0998, 
0.09955, 0.09883, 0.09982, 0.09985, 0.09976, 0.09895, 0.09874
), sr = c(0.72319, 0.02491, 0.51903, 0.50319, 0.00844, 0.00723, 
0.00431, 0.01106, 0.00854, 0.00491, 0.00924, 0.00803, 0.00823, 
0.00511, 0.0031, 0.00612, 0.0018, 0.00672, 0.00844, 0.00702, 
0.0026, 0.00401, 0.00642, 0.00582, 0.003, 0.00572, 0.00833, 0.00321, 
0.00461, 0.00612, 0.01177, 0.0016, 0.01025, 0.00471, 0.00985, 
0.00894, 0.00833, 0.00521, 0.0023, 0.0142, 0.00813, 0.00733, 
0.00371, 0.00361, 0.00361, 0.00975, 0.00672, 0.00833, 0.00511, 
0.00582, 0.01066, 0.00884, 0.00371, 0.00965, 0.00351, 0.01045, 
0.00894, 0.00813, -0.0019, 0.01056, 0.00511, 0.00662, 0.00904, 
0.01228, 0.00713, 0.00361, 0.0144, 0.00854, 0.00934, 0.00924, 
0.00723, 0.00501, 0.01035, 0.00501, 0.00501, 0.00813, 0.00481, 
0.00884, 0.00904, 0.00723, 0.00833, 0.00773, 0.00461, 0.00592, 
0.00562, 0.00692, 0.00884, 0.00451, 0.00894, 0.002, 0.00531, 
0.00844, 0.00361, 0.01076, 0.00854, 0.00541, 0.00652, 0.00723, 
0.00622, 0.01035, 0.00642, 0.00582, 0.00481, 0.00552, 0.00451, 
0.00803, 0.00582, 0.00501, 0.00813, 0.01086, 0.00391, 0.00995, 
0.0017, 0.00361, 0.00914, 0.00753, 0.0031, 0.00884, 0.00371, 
0.00421, 0.01187, 0.00632, 0.00411, 0.00702, 0.00632, 0.00702, 
0.00491, 0.00371, 0.00582, 0.0011, 0.00743, 0.00401, 0.00944, 
0.00672, 0.00451, 0.0025, 0.0024, 0.00854, 0.00773, 0.00914, 
0.00592, 0.0027, 0.00662, 0.00833, 0.00642, 0.00692, 0.0031, 
0.00692, 0.00924, 0.00582, 0.00864, 0.00602, 0.00985, 0.0022, 
0.00682, 0.00702, 0.00753, 0.00471, 0.00793, 0.00341, 0.00572, 
0.01106, 0.00783, 0.00914, 0.01309, 0.01116, 0.00491, 0.00783, 
0.01298, 0.01066, 0.001, 0.00481, 0.00975, 0.00511, 0.00965, 
0.00632, 0.01106, 0.00421, 0.00833, 0.00602, 0.00833, 0.01056, 
0.00632, 0.00723, 0.00592, 0.01268, 0.00793, 0.00572, 0.00692, 
0.0027, 0.0018, 0.00763, 0.01015, 0.00944, 0.00702, 0.00874, 
0.01177, 0.01501, 0.00702, 0.00682, 0.00793, 0.00733, 0.01157, 
0.00572, 0.01116, 0.00884, 0.00894, 0.00642, 0.01369, 0.00501, 
0.01867, 0.00642, 0.00682, 0.0142, 0.00481, 0.00501, 0.01167, 
0.01066, 0.00411, 0.00682, 0.0019, 0.00562, 0.00813, 0.00813, 
0.00793, 0.0022, 0.01461, 0.00934, 0.00552, 0.00511, 0.0021, 
0.00592, 0.0014, 0.00491, 0.00401, 0.01126, 0.0011, 0.00331, 
0.00662, 0.00894, 0.00592, 0.00531, 0.00723, 0.00481, 0.01939, 
0.01005, 0.01025, 0.01319, 0.01076, 0.0031, 0.00985, 0.00652, 
0.00441, 0.00421, 0.003, 0.00874, 0.00481, 0.00723, 0.01025, 
0.00753, 0.0013, 0.01005, 0.00642, 0.01147, 0.0139, 9e-04, 0.00341, 
0.01167, 0.00431, 0.00702, 0.00803, 0.00833, 0.00672, 0.01045, 
0.00541, 0.00773, 0.00803, 0.0025, 0.00874, 0.00351, 0.00662, 
0.00702, 0.01207, 0.00411, 0.00823, 0.00531, 0.00461, 0.00914, 
8e-04, 0.00552, 0.00541, 0.00682, 0.00541, 0.00501, 0.00813, 
0.00702, 0.01035, 0.00723, 0.00773, 0.00713, 0.00491, 0.00521, 
0.01106, 0.0031, 0.003, 0.00672, 0.00511, 0.00864, 0.00904, 0.00612, 
0.00803, 0.01066, 0.00944, 0.00803, 0.00431, 0.00874, 0.00592, 
0.01066, 0.00652, 0.00351, 0.00773, 0.00813, 0.00431, 0.00692, 
0.0144, 0.00813, 0.01197, 0.00371, 0.0025, 0.0024, 0.00461, 0.00944, 
0.01217, 0.0021, 0.00491, 0.01228, 0.01207, 0.00733, 0.00471, 
0.00985, 0.0023, 0.00602, 0.00531, 0.00592, 0.00622, 0.00985, 
0.00914, 0.01005, 0.00441, 0.0031, 0.00652, 0.00421, 0.00431, 
0.00541, 0.00451, 0.00582, 0.00854, 0.0022, 0.0027, 8e-04, 0.01187, 
0.00733, 0.00985, 0.00713, 0.0029, 0.01025, 0.00541, 0.00642, 
0.00622, 0.0029, 0.00793, 0.00642, 0.00823, 0.00592, 0.00602, 
0.00662, 0.00662, 0.00844, 0.00662, 0.00501, 0.01177, 0.01076, 
0.01025, 0.00702, 0.00461, 0.00501, 0.00602, 0.00511, 0.00682, 
0.00501, 0.00612, 0.00652, 0.0018, 0.00985, 0.00531, 0.00582, 
0.00894, 0.00874, 0.00341, 0.01187, 0.00702, 0.00955, 0.00854, 
0.00652, 4e-04, 0.0019, 0.00572, 0.003, 0.00511, 0.00692, 0.0142, 
0.00733, 0.01167, 0.0022, 0.00642, 0.00602, 0.00471, 0.01086, 
0.00783, 0.01167, 0.0019, 0.00854, 0.00441, 0.00592, 0.00702, 
0.00461, 0.00743, 0.00723, 0.00854, 0.00844, 0.00351, 0.00823, 
0.00321, 0.00995, 5e-04, 0.00844, 0.00602, -7e-04, 0.01572, 0.00692, 
0.00773, 0.00702, 0.01136, 0.001, 0.00793, 0.00773, 0.00823, 
0.00592, 0.00763, 0.00401, 0.0026, 0.01349, 0.00521, 0.00723, 
0.00955, 0.00491, 0.00854, 0.0031, 0.00481, 0.00341, 0.00773, 
0.01136, 0.0026, 0.00511, 0.0143, 0.00833, 0.00864, 0.00642, 
0.0016, 0.00743, 0.00632, 0.01298, 0.01248, 0.00793, 0.00652, 
0.01501, 0.00371, 0.00421, 0.00934, 0.00723, 0.01228, 0.00743, 
0.00985, 0.0029, 0.00361, 0.00823, 0.00602, 0.00602, 0.01501, 
0.00692, 0.00662, 0.00602, 0.00975, 0.00753, 0.00321, 0.00461, 
0.00672, 0.00441, 0.0025, 0.00652, 0.00572, 0.01126, 0.00471, 
0.00773, 0.00622, 0.00371, 0.01177, 0.00481, 0.01126, 0.00451, 
0.002, 0.01096, 0.00572, 0.00521, 0.00562, 0.00481, 0.00753, 
0.00431, 0.00692, 0.00471, 0.00602, 0.00924, 0.00662, 0.00743, 
0.0013, 0.0017, 0.01116, 0.00461, 0.00441, 0.00351, 0.01228, 
0.00381, 0.0016, 0.00582, 0.01025, 0.00723, 0.00632, 0.01157, 
0.01056, 0.00371, 0.0027, 0.00592, 0.00321, 0.00904, 0.0025, 
0.00763, 0.01217, 0.00955, 0.00361, 0.00733, 0.00552, 0.00823, 
0.00692, 0.00833, 0.003, 0.00562, 0.001, 0.00401, 0.0029, 0.00521, 
0.00702, 0.01015, 0.01157, 0.00672, 0.00451, 0.00713, 0.00381, 
0.00321, 0.00702, 0.0143, 0.00713, 0.00411, 0.00602, 0.01643, 
0.0024, 0.00572, 0.00965, 0.0018, 0.01147, 0.00642, 0.0016, 0.00381, 
0.00753, 0.01136, 0.0017, 0.00451, 0.00904, 0.01603, 0.00763, 
0.00662, 0.00692, 0.00341, 0.00341, 0.0016, 0.01329, 0.0019, 
0.00662, 0.002, 0.00381, 0.00501, 0.00823, 0.00803, 0.00572, 
0.01217, 0.00894, 0.00934, 0.00733, 0.00682, 0.00411, 0.01035, 
0.01136, 0.00692, 0.00672, 0.00793, 0.01056, 0.00511, 0.00753, 
0.00612, 0.00622, 0.0011, 0.01147, 0.00833, 0.00692, 0.00793, 
0.00582, 0.01066, 0.01379, 0.01015, 0.0031, 0.00391, 0.01369, 
0.01056, 0.01015, 0.00381, 0.00411, 0.00632, 0.00652, 0.01177, 
0.00481, 0.014, 0.00511, 0.00572, 0.00763, 0.01025, 0.0029, 0.00864, 
0.0031, 0.00884, 4e-04, 0.00924, 0.00783, 0.0031, 0.00541, 0.00944, 
0.00662, 0.00391, 0.01056, 0.00702, 0.00844, 0.00914, 0.00773, 
0.00421, 0.0029, 0.00823, 0.00864, 0.00995, 0.00531, 0.00763, 
0.00813, 0.00783, 0.00662, 0.00411, 0.00552, 0.01005, 9e-04, 
0.00854, 0.00682, 0.00371, 0.00632, 0.0023, 0.00995, 0.01056, 
0.0027, 0.00813, 0.0024, 0.00692, 0.0029, 0.00552, 0.00914, 0.01076, 
0.01136, 0.00975, 0.00652, 0.01086, 0.01025, 0.00763, 0.01005, 
0.00541, 0.00793, 0.00612, 0.00541, 0.0028, 0.00753, 0.003, 0.01157, 
0.00662, 0.00713, 0.00592, 0.00501, 0.00793, 0.00501, 0.00652, 
0.00924, 0.00975, 0.00531, 0.00773, 0.00461, 0.01066, 0.00682, 
0.01511, 0.00441, 0.00702, 2e-04, 0.0027, 0.0027, 0.00371, 0.00541, 
0.00783, 0.00411, 0.00592, 0.01248, 0.00773, 0.00562, 0.00351, 
0.00874, 0.00562, 0.0015, 0.00864, 0.00975, 0.01217, 0.01258, 
0.00562, 0.00753, 0.01288, 0.01349, 0.00612, 0.00541, 0.00955, 
0.00501, 0.00632, 0.00582, 0.00713, 0.00773, 0.00995, 0.00612, 
0.00431, 0.00451, 0.01298, -0.0016, 0.01217, 0.00521, 0.00672, 
0.01603, 0.01765, 0.00371, 0.00743, 0.00682, 0.00531, 0.00763, 
0.002, 0.00874, 0.00582, 0.00331, 0.00833, 8e-04, 0.00783, 0.00371, 
0.00652, 0.01116, 0.01217, 0.00622, 0.00321, 0.01562, 0.00451, 
0.00702, 0.01096, 3e-04, 0.00662, 0.00411, 0.01288, 0.00955, 
0.01187, 0.00321, 0.01157, 0.0142, 0.0022, 0.0027, 0.00763, 0.00391, 
0.00471, 0.00582, 0.00702, 0.00894, 0.00582, 0.01633, 0.002, 
0.01238, 0.00652, 0.00401, 0.00341, 0.00521, 8e-04, 0.01379, 
0.00854, 0.00451, 0.00582, 0.01116, 0.00823, 0.00985, 0.00743, 
0.00753, 0.0018, 0.00743, 0.01238, -0.0012, 0.0029, 0.00622, 
0.00763, 0.00421, 0.00491, 0.01918, 0.00833, 0.00491, 0.00562, 
0.0024, 0.00753, 0.00682, 0.01096, 0.00894, 0.01076, 0.01309, 
0.01126, 0.00431, 0.00773, 0.01106, 0.01076, 0.00713, 0.00823, 
-0.0016, 0.00934, 0.01481, 0.00341, 0.0012, 0.01096, 0.00975, 
0.0027, 0.00491, 0.01268, 0.0023, 0.0017, 0.0024, 0.01157, 0.01379
), category = c("real", "real", "real", "real", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", "sim", 
"sim", "sim")), row.names = c(NA, -863L), class = c("tbl_df", 
"tbl", "data.frame"), .Names = c("crt", "sr", "category"), vars = character(0))

看起来像这样:

# A tibble: 863 × 3
       crt      sr category
     <dbl>   <dbl>    <chr>
1  0.04900 0.72319     real
2  0.09800 0.02491     real
3  0.06000 0.51903     real
4  0.06000 0.50319     real
5  0.09951 0.00844      sim
6  0.09939 0.00723      sim
7  0.09963 0.00431      sim
8  0.09939 0.01106      sim
9  0.09926 0.00854      sim
10 0.09960 0.00491      sim
# ... with 853 more rows

使用此代码:

library(ggplot2)
  srp <- ggplot() +
         geom_density(data=dat, aes(x=sr, group=category,fill=category), alpha=0.5, size=0.1) +
         scale_fill_brewer(palette="Set1") +
         theme_minimal(base_size=12) +
         xlim(c(0, 1.5)) +
         scale_y_continuous(trans="log1p", name="density") +
         theme(legend.title=element_blank()) +
         xlab("SR") 

  crtp <- ggplot() +
         geom_density(data=dat, aes(x=crt, group=category, fill=category), alpha=0.5,  size=0.1) +
         scale_fill_brewer(palette="Set1") +
         xlim(c(0, 0.2)) +
         scale_y_continuous(trans="log1p", name="density") +
         theme_minimal(base_size=12) +
         theme(legend.title=element_blank()) +
         xlab("CRT") 

  cp <- cowplot::plot_grid(srp, crtp, nrow=2,  scale=0.85, vjust = -3.5, hjust = -0.52)
  cp

我们制作了这个情节:

enter image description here

请注意,红色区域是多模式的。有没有办法估计 那些密度的参数?

假设它遵循正态分布(因此有两个正态分布)。我想估算每次碰撞的meansd

0 个答案:

没有答案