我目前生成了以下图:
数据:
require(ggplot2)
just_growth_data=structure(list(ID = c(1L, 2L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L,
12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L,
25L, 27L, 28L, 29L, 30L, 31L, 33L, 34L, 35L, 37L, 38L, 39L, 40L,
41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L, 51L, 52L, 53L,
54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L, 64L, 65L, 66L,
67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L, 76L, 77L, 78L, 79L,
80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 89L, 90L, 91L, 92L,
93L, 94L, 95L, 96L, 98L, 99L, 100L, 102L, 103L, 104L, 105L, 106L,
107L, 108L, 109L, 111L, 112L, 113L, 114L, 115L, 116L, 117L, 118L,
119L, 120L, 121L, 122L, 123L, 124L, 125L, 126L, 127L, 128L, 129L,
130L, 131L, 132L, 133L, 134L, 135L, 136L, 137L, 139L, 140L, 141L,
142L, 143L, 144L, 145L, 146L, 147L, 148L, 149L, 150L, 151L, 152L,
153L, 154L, 155L, 156L, 157L, 158L, 159L, 160L, 161L, 162L, 163L,
164L, 165L, 166L, 167L, 168L, 169L, 170L, 171L, 172L, 173L, 174L,
175L, 176L, 177L, 178L, 179L, 180L, 181L, 182L, 184L, 185L, 186L,
187L, 188L, 189L, 191L, 192L, 193L, 194L, 195L, 197L, 198L, 199L,
200L, 201L, 202L, 203L, 204L, 205L, 206L, 207L, 208L, 209L, 210L,
211L, 212L, 213L, 214L, 215L, 216L, 217L, 218L, 219L, 220L, 221L,
222L, 223L, 224L, 225L, 226L, 227L, 228L, 229L, 231L, 232L, 233L,
234L, 235L, 236L, 237L, 238L, 239L, 241L, 242L, 244L, 245L, 246L,
247L, 248L, 249L, 250L, 251L, 253L, 254L, 255L, 257L, 258L, 259L,
260L, 261L, 262L, 263L, 264L, 266L, 267L, 268L, 269L, 270L, 271L,
272L, 273L, 274L, 275L, 276L, 277L, 278L, 279L, 280L, 281L, 282L,
284L, 285L, 286L, 287L, 288L, 289L, 290L, 291L, 292L, 293L, 295L,
296L, 297L, 298L, 299L, 300L, 301L, 302L, 303L, 304L, 305L, 306L,
307L, 309L, 310L, 311L, 312L, 313L, 314L, 315L, 316L, 317L, 318L,
319L, 320L, 321L, 322L, 323L, 324L, 325L, 326L, 327L, 328L, 329L,
330L, 331L, 333L, 334L, 335L, 336L, 337L, 338L, 339L, 340L, 341L,
342L, 343L, 344L, 345L, 346L, 347L, 348L, 349L, 350L, 351L, 352L,
353L, 354L, 355L, 356L, 357L, 358L, 359L, 360L, 361L, 362L, 363L,
364L, 365L, 366L, 367L, 368L, 369L, 371L, 372L, 373L, 374L, 375L,
376L, 377L, 378L, 379L, 380L, 381L, 382L, 383L, 384L, 385L, 386L,
387L, 388L, 389L, 390L, 391L, 392L, 393L, 394L, 395L, 396L, 397L,
399L, 401L, 402L, 403L, 404L, 405L, 406L, 407L, 408L, 409L, 410L,
411L, 412L, 413L, 414L, 415L, 416L, 417L, 418L, 419L, 420L, 421L,
422L, 423L, 424L, 425L, 426L, 427L, 428L, 429L, 430L, 431L, 432L,
433L, 434L, 435L, 437L, 438L, 439L, 440L, 441L, 442L, 443L, 444L,
445L, 446L, 447L, 448L, 449L, 450L, 451L, 452L, 453L, 454L, 455L,
456L, 457L, 458L, 459L, 460L, 461L, 462L, 463L, 464L, 465L, 467L,
468L, 469L, 470L, 471L, 472L, 473L, 474L, 475L, 476L, 477L, 478L,
479L, 480L, 481L, 482L, 483L, 484L, 485L, 486L, 487L, 488L, 489L,
490L, 491L, 492L, 493L, 494L, 495L, 496L, 497L, 498L, 499L, 500L,
501L, 502L, 503L, 504L, 505L, 507L, 508L, 509L, 510L, 511L, 512L,
513L, 514L, 515L, 516L, 517L, 518L, 519L, 520L, 521L, 522L, 523L,
524L, 525L, 526L, 527L, 528L, 529L, 530L, 531L, 532L, 533L, 534L,
535L, 536L, 537L, 538L, 539L, 540L, 541L, 542L, 543L, 544L, 545L,
546L, 547L, 548L, 549L, 550L, 551L, 552L, 553L, 554L, 555L, 556L,
557L, 558L, 559L, 560L, 561L, 562L, 563L, 564L, 565L, 566L, 567L,
568L, 569L, 570L, 571L, 572L, 573L, 574L, 575L, 576L, 577L, 578L,
579L, 580L, 581L, 582L, 583L, 584L, 585L, 586L, 587L, 588L, 589L,
590L, 591L, 592L, 593L, 594L, 595L, 596L, 597L, 598L, 599L, 600L,
601L, 603L, 604L, 605L, 606L, 607L, 608L, 609L, 610L, 611L, 612L,
613L, 614L, 615L, 616L, 617L, 618L, 619L, 620L, 621L, 622L, 623L,
624L, 625L, 626L, 627L, 628L, 630L, 631L, 632L, 633L, 634L, 635L,
636L, 637L, 638L, 639L, 641L, 642L, 643L, 644L, 645L, 646L, 647L,
648L, 649L, 650L, 651L, 652L), ColonyMass_At_Wrkr_Eclosion = c(NA,
117L, NA, 53L, NA, 91L, 85L, 111L, 96L, NA, 112L, 90L, 112L,
120L, 110L, 109L, NA, NA, 99L, 86L, 108L, 109L, 87L, 108L, 116L,
137L, 108L, NA, NA, NA, 93L, NA, 96L, 98L, 87L, NA, 111L, NA,
114L, NA, 11L, 123L, 113L, 130L, 134L, NA, NA, 96L, NA, NA, 15L,
74L, NA, NA, 75L, 96L, 88L, NA, 122L, NA, 101L, 83L, 123L, 89L,
85L, NA, 112L, 98L, 87L, 123L, 115L, 16L, 125L, NA, 91L, NA,
85L, 76L, 122L, 95L, 113L, 116L, 102L, 132L, 11L, 105L, 112L,
102L, 8L, NA, 113L, NA, 93L, 104L, 119L, 116L, 112L, 77L, NA,
NA, 105L, 105L, 41L, 99L, NA, 113L, 120L, 130L, 98L, 122L, 118L,
NA, NA, 97L, NA, NA, NA, 104L, 103L, 110L, 25L, 118L, 98L, 123L,
NA, 97L, NA, 7L, 118L, NA, 82L, NA, 103L, 106L, 113L, NA, 115L,
123L, 124L, 38L, 26L, 102L, 90L, NA, 59L, 102L, 82L, 120L, 113L,
116L, 117L, 116L, 62L, 93L, 91L, 102L, 121L, 120L, NA, 111L,
97L, 63L, 109L, 113L, 102L, 125L, 102L, 111L, 123L, 52L, 72L,
NA, NA, 116L, NA, 81L, 52L, 52L, NA, 105L, 123L, 87L, NA, 136L,
108L, NA, 120L, 122L, NA, NA, 126L, NA, 47L, 111L, 118L, NA,
NA, NA, NA, 109L, NA, 99L, 106L, 53L, 102L, 77L, 99L, NA, NA,
NA, 114L, NA, 111L, NA, 113L, NA, 76L, 114L, NA, 120L, 113L,
97L, 134L, 98L, 118L, 75L, 109L, 124L, 108L, NA, 124L, NA, 65L,
100L, NA, NA, 126L, 11L, 97L, 76L, NA, NA, 106L, 110L, 3L, 116L,
NA, NA, 135L, 96L, 101L, NA, 92L, NA, NA, 118L, NA, 105L, 15L,
129L, 128L, 102L, NA, 92L, 100L, NA, NA, 71L, 103L, NA, 113L,
NA, NA, 63L, NA, 88L, 83L, 106L, 117L, 49L, NA, NA, 61L, 79L,
NA, 91L, 102L, NA, 93L, NA, NA, NA, 87L, 126L, 99L, NA, NA, 100L,
116L, 103L, 87L, 37L, NA, 112L, NA, NA, 18L, NA, 94L, NA, NA,
NA, 117L, 102L, 62L, 96L, NA, 87L, 8L, NA, 86L, 61L, NA, 68L,
117L, 89L, NA, 90L, NA, 104L, 94L, 102L, NA, 105L, 107L, 62L,
130L, 99L, 111L, NA, 106L, 98L, NA, 140L, 88L, 94L, NA, 122L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA), ColonyMass_4wksLater = c(NA, 571L, NA, NA, NA, 736L,
NA, NA, NA, NA, NA, 438L, NA, NA, 711L, NA, NA, NA, 537L, NA,
844L, NA, NA, NA, 560L, 561L, NA, NA, NA, NA, 594L, NA, NA, 457L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 714L, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 417L, NA, NA, NA, 701L, NA,
NA, NA, 25L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 866L, NA, NA,
291L, NA, 659L, 354L, 743L, NA, NA, 696L, NA, NA, NA, NA, NA,
NA, NA, 518L, NA, NA, NA, NA, NA, NA, 907L, 27L, NA, NA, 625L,
NA, NA, 957L, 804L, NA, NA, NA, 650L, NA, NA, NA, NA, NA, NA,
NA, 699L, 632L, NA, NA, 518L, NA, NA, NA, NA, NA, NA, 527L, 541L,
NA, NA, NA, NA, NA, 448L, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, 382L, NA, 431L, NA, 620L, NA, 296L, NA, 532L,
NA, 485L, NA, NA, NA, NA, NA, NA, 153L, NA, NA, NA, NA, 23L,
NA, NA, NA, 606L, NA, NA, NA, 550L, 766L, NA, 426L, 786L, NA,
NA, 289L, NA, 119L, 327L, NA, NA, NA, NA, NA, NA, NA, 602L, NA,
20L, NA, NA, NA, NA, NA, NA, 152L, NA, 592L, NA, NA, NA, 1235L,
197L, NA, 442L, NA, NA, 558L, NA, NA, NA, NA, 818L, NA, NA, NA,
NA, NA, NA, NA, NA, 783L, NA, 519L, NA, NA, NA, 856L, 609L, NA,
397L, NA, NA, 1195L, NA, 473L, NA, NA, NA, NA, 370L, NA, NA,
3L, 561L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 783L, NA, NA,
NA, NA, NA, NA, 537L, NA, NA, NA, NA, NA, 937L, NA, 696L, NA,
NA, 859L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 902L, 430L, NA,
11L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 354L, NA,
NA, NA, NA, NA, NA, NA, NA, NA, 682L, NA, NA, NA, NA, NA, 134L,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 670L, NA, NA, NA, NA, NA,
NA, 537L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA), ColonyMass_2mnthsLater = c(NA, 445L, NA,
NA, NA, 1817L, NA, NA, NA, NA, NA, 2683L, NA, NA, 1775L, NA,
NA, NA, 429L, NA, 77L, NA, NA, NA, 279L, 23L, NA, NA, NA, NA,
NA, NA, NA, 111L, NA, NA, NA, NA, NA, NA, NA, NA, NA, 70L, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 71L, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
249L, NA, NA, NA, NA, 1249L, 636L, 710L, NA, NA, 27L, NA, 50L,
NA, NA, NA, NA, NA, 531L, NA, NA, NA, NA, NA, NA, 63L, NA, NA,
NA, 416L, NA, NA, 400L, 902L, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, 116L, NA, NA, NA, 674L, NA, NA, NA, NA, NA, NA, 1439L,
305L, NA, NA, NA, NA, NA, 93L, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, 2L, NA, 1107L, NA, 13L, NA, 201L, NA, 470L,
NA, 184L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, 72L, NA, NA, NA, 2727L, 33L, NA, 121L, 643L, NA, NA,
168L, NA, 160L, NA, NA, NA, NA, NA, NA, NA, NA, 1732L, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 666L, 60L, NA,
128L, NA, NA, 140L, NA, NA, NA, NA, 15L, NA, NA, NA, NA, 1726L,
NA, NA, NA, NA, NA, 1966L, NA, NA, NA, 77L, 76L, NA, 199L, NA,
NA, 54L, NA, 377L, NA, NA, NA, NA, NA, NA, NA, NA, 738L, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 1422L, NA, NA, NA, NA, NA,
NA, 695L, NA, NA, NA, NA, NA, 15L, NA, 1058L, NA, NA, 680L, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, 534L, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, 850L, NA, NA, NA, NA, NA, 11L, NA, NA, NA, NA, NA,
NA, NA, NA, NA, 51L, NA, NA, NA, NA, NA, NA, 146L, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)), .Names = c("ID",
"ColonyMass_At_Wrkr_Eclosion", "ColonyMass_4wksLater", "ColonyMass_2mnthsLater"
), class = "data.frame", row.names = c(NA, -622L))
代码:
require(reshape)
require(ggplot2)
data.m <- melt(just_growth_data, id.vars="ID")
ggplot(data.m, aes(x=variable, y=value, group=ID)) +
geom_line() +
geom_point() +
ylab("Weight (mg)") +
xlab("Time")
我试图为我的每个殖民地推导出一个增长率(假设指数增长)。我认为这样做的一种方法是:
- 将指数曲线拟合到每个菌落的数据点,然后
- 从曲线方程中提取增长率。
有人建议我尝试使用 nls 来完成此操作,甚至可以非常简单地从三个数据点得出指数曲线的参数。
不幸的是,我仍然没有能力接受这个建议:我不知道该怎么做。
谢谢!