Colouring different clusters of points in ggplot scatterplot [closed] - r

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I am using ggplot to create a scatterplot
mydata <- read.table('CF1_deNovoAssembly.csv', sep=",",hader=TRUE)
ggplot(mydata, aes(log(Consensus.length), log(Average.coverage))) + geom_point()
Data in CF1_deNovoAssembly.csv:
Name Consensus length Total read count Single reads Reads in pairs Average coverage
CF1_seqReads contig 1 mapping 81148 77393 45653 31740 68.39
CF1_seqReads contig 2 mapping 5175 4154 2526 1628 57.33
CF1_seqReads contig 3 mapping 43676 43232 25550 17682 70.951
CF1_seqReads contig 4 mapping 33156 28321 16619 11702 61.458
CF1_seqReads contig 5 mapping 194560 158576 93416 65160 58.476
CF1_seqReads contig 6 mapping 26990 27221 16183 11038 72.267
CF1_seqReads contig 7 mapping 35155 34449 20227 14222 70.2
CF1_seqReads contig 8 mapping 110217 111889 65611 46278 73.075
CF1_seqReads contig 9 mapping 96757 87785 51431 36354 65.275
CF1_seqReads contig 10 mapping 169489 155776 91690 64086 65.993
CF1_seqReads contig 11 mapping 280769 215666 126964 88702 55.204
CF1_seqReads contig 12 mapping 29819 30563 17993 12570 73.624
CF1_seqReads contig 13 mapping 120801 116090 68428 47662 69.046
CF1_seqReads contig 14 mapping 172189 154880 91940 62940 64.499
CF1_seqReads contig 15 mapping 105798 88828 52338 36490 60.352
CF1_seqReads contig 16 mapping 212719 200557 117997 82560 67.748
CF1_seqReads contig 17 mapping 36352 29426 17354 12072 57.996
CF1_seqReads contig 18 mapping 1468 2594 1622 972 126.813
CF1_seqReads contig 19 mapping 123801 121038 71234 49804 70.139
CF1_seqReads contig 20 mapping 231369 226726 133732 92994 70.348
CF1_seqReads contig 21 mapping 125419 110004 64774 45230 62.915
CF1_seqReads contig 22 mapping 125818 113356 67034 46322 64.733
CF1_seqReads contig 23 mapping 53872 50388 29824 20564 67.235
CF1_seqReads contig 24 mapping 118273 99252 58798 40454 60.263
CF1_seqReads contig 25 mapping 5569 19834 11758 8076 257.753
CF1_seqReads contig 26 mapping 48830 47879 28265 19614 70.306
CF1_seqReads contig 27 mapping 33566 32370 19280 13090 69.097
CF1_seqReads contig 28 mapping 8357 6684 4046 2638 56.178
CF1_seqReads contig 29 mapping 82328 71998 42670 29328 62.916
CF1_seqReads contig 30 mapping 55288 52415 31023 21392 68.03
CF1_seqReads contig 31 mapping 49849 44216 26142 18074 63.699
CF1_seqReads contig 32 mapping 66991 69598 41202 28396 74.615
CF1_seqReads contig 33 mapping 210958 187922 110992 76930 63.938
CF1_seqReads contig 34 mapping 95028 86002 51080 34922 64.925
CF1_seqReads contig 35 mapping 25219 22685 13567 9118 65.146
CF1_seqReads contig 36 mapping 52506 44863 26493 18370 61.281
CF1_seqReads contig 37 mapping 44807 37939 22745 15194 60.863
CF1_seqReads contig 38 mapping 30091 25919 15355 10564 62.312
CF1_seqReads contig 39 mapping 49730 42295 25445 16850 60.872
CF1_seqReads contig 40 mapping 35166 27239 16101 11138 55.456
CF1_seqReads contig 41 mapping 58239 54831 32311 22520 67.764
CF1_seqReads contig 42 mapping 78398 69994 41578 28416 64.135
CF1_seqReads contig 43 mapping 79163 61667 36637 25030 55.958
CF1_seqReads contig 44 mapping 46179 37621 22479 15142 58.463
CF1_seqReads contig 45 mapping 1501 1209 715 494 55.69
CF1_seqReads contig 46 mapping 35505 36158 21296 14862 73.271
CF1_seqReads contig 47 mapping 108945 100876 59394 41482 66.479
CF1_seqReads contig 48 mapping 36042 30283 17961 12322 60.289
CF1_seqReads contig 49 mapping 125139 102821 60441 42380 59.021
CF1_seqReads contig 50 mapping 33093 31998 18976 13022 69.715
CF1_seqReads contig 51 mapping 19399 14764 8826 5938 54.607
CF1_seqReads contig 52 mapping 39627 30320 17856 12464 54.848
CF1_seqReads contig 53 mapping 12163 9861 5887 3974 58.008
CF1_seqReads contig 54 mapping 4378 3872 2442 1430 62.841
CF1_seqReads contig 55 mapping 107763 96191 56993 39198 64.165
CF1_seqReads contig 56 mapping 167629 143032 84032 59000 61.441
CF1_seqReads contig 57 mapping 97622 80176 47622 32554 58.829
CF1_seqReads contig 58 mapping 56912 56028 32850 23178 70.506
CF1_seqReads contig 59 mapping 15390 16360 9792 6568 76.745
CF1_seqReads contig 60 mapping 80202 71909 42337 29572 64.292
CF1_seqReads contig 61 mapping 45435 39732 23290 16442 62.592
CF1_seqReads contig 62 mapping 17972 15752 9208 6544 63.102
CF1_seqReads contig 63 mapping 41256 40603 23859 16744 70.545
CF1_seqReads contig 64 mapping 110461 93608 54796 38812 60.845
CF1_seqReads contig 65 mapping 62066 53798 31662 22136 62.125
CF1_seqReads contig 66 mapping 1981 1788 1112 676 63.459
CF1_seqReads contig 67 mapping 32249 28939 17121 11818 64.486
CF1_seqReads contig 68 mapping 30129 30299 17873 12426 72.002
CF1_seqReads contig 69 mapping 73494 70081 41307 28774 68.502
CF1_seqReads contig 70 mapping 42147 32350 19106 13244 54.965
CF1_seqReads contig 71 mapping 15109 14803 8827 5976 70.037
CF1_seqReads contig 72 mapping 19446 17197 10277 6920 63.506
CF1_seqReads contig 73 mapping 1203 2160 1410 750 127.011
CF1_seqReads contig 74 mapping 35575 31557 18907 12650 63.833
CF1_seqReads contig 75 mapping 61658 52593 31031 21562 61.218
CF1_seqReads contig 76 mapping 2104 2063 1335 728 69.914
CF1_seqReads contig 77 mapping 58182 49734 29348 20386 61.311
CF1_seqReads contig 78 mapping 55182 54095 32319 21776 70.398
CF1_seqReads contig 79 mapping 35523 34002 19964 14038 68.577
CF1_seqReads contig 80 mapping 5174 8766 5222 3544 119.842
CF1_seqReads contig 81 mapping 69777 59263 35069 24194 60.855
CF1_seqReads contig 82 mapping 23575 21660 12872 8788 65.608
CF1_seqReads contig 83 mapping 3065 2609 1597 1012 61.1
CF1_seqReads contig 84 mapping 332 803 619 184 171.226
CF1_seqReads contig 85 mapping 5538 5060 3028 2032 63.651
CF1_seqReads contig 86 mapping 18727 16636 9814 6822 63.747
CF1_seqReads contig 87 mapping 27818 21227 12585 8642 54.79
CF1_seqReads contig 88 mapping 20439 17310 10266 7044 60.577
CF1_seqReads contig 89 mapping 14937 13026 7656 5370 62.693
CF1_seqReads contig 90 mapping 17570 16529 9787 6742 67.656
CF1_seqReads contig 91 mapping 7927 7372 4374 2998 66.942
CF1_seqReads contig 92 mapping 2695 5155 3143 2012 136
CF1_seqReads contig 93 mapping 28431 22662 13382 9280 57.128
CF1_seqReads contig 94 mapping 10910 8378 5032 3346 54.889
CF1_seqReads contig 95 mapping 11426 11337 6863 4474 70.898
CF1_seqReads contig 96 mapping 39433 36586 21812 14774 66.563
CF1_seqReads contig 97 mapping 65815 66239 39289 26950 72.083
CF1_seqReads contig 98 mapping 11296 11627 6991 4636 73.84
CF1_seqReads contig 99 mapping 27785 22040 13130 8910 56.893
CF1_seqReads contig 100 mapping 26131 20073 11793 8280 55.234
CF1_seqReads contig 101 mapping 825 766 560 206 61.246
CF1_seqReads contig 102 mapping 25869 25524 15286 10238 70.695
CF1_seqReads contig 103 mapping 7747 7244 4356 2888 66.154
CF1_seqReads contig 104 mapping 34292 28755 16913 11842 60.05
CF1_seqReads contig 105 mapping 17219 16000 9346 6654 66.858
CF1_seqReads contig 106 mapping 39990 34798 20590 14208 62.384
CF1_seqReads contig 107 mapping 38227 33283 19721 13562 62.381
CF1_seqReads contig 108 mapping 1825 1439 919 520 54.89
CF1_seqReads contig 109 mapping 5333 4212 2494 1718 57.046
CF1_seqReads contig 110 mapping 13827 11248 6582 4666 58.276
CF1_seqReads contig 111 mapping 25486 22477 13277 9200 63.393
CF1_seqReads contig 112 mapping 15592 13751 8295 5456 63.048
CF1_seqReads contig 113 mapping 6230 4864 2986 1878 55.995
CF1_seqReads contig 114 mapping 28229 22164 13150 9014 56.051
CF1_seqReads contig 115 mapping 92951 92630 54674 37956 71.557
CF1_seqReads contig 116 mapping 24347 24204 14532 9672 71.386
CF1_seqReads contig 117 mapping 11556 11295 6657 4638 70.199
CF1_seqReads contig 118 mapping 2750 2553 1683 870 64.722
CF1_seqReads contig 119 mapping 19046 14586 8706 5880 54.681
CF1_seqReads contig 120 mapping 19966 17390 10290 7100 62.622
CF1_seqReads contig 121 mapping 1912 1657 1011 646 62.048
CF1_seqReads contig 122 mapping 1236 5497 3435 2062 318.75
CF1_seqReads contig 123 mapping 1136 852 584 268 53.619
CF1_seqReads contig 124 mapping 414 391 273 118 62.2
CF1_seqReads contig 125 mapping 912 931 619 312 72.031
CF1_seqReads contig 126 mapping 915 588 408 180 43.635
CF1_seqReads contig 127 mapping 2039 1853 1165 688 64.089
CF1_seqReads contig 128 mapping 1471 1253 837 416 58.997
CF1_seqReads contig 129 mapping 1148 2382 1560 822 147.665
CF1_seqReads contig 130 mapping 23233 23367 14443 8924 71.842
CF1_seqReads contig 131 mapping 702 472 324 148 47.107
CF1_seqReads contig 132 mapping 855 1461 967 494 120.706
CF1_seqReads contig 133 mapping 461 1027 725 302 157.434
CF1_seqReads contig 134 mapping 1136 834 580 254 52.482
CF1_seqReads contig 135 mapping 1222 1681 1131 550 98.43
CF1_seqReads contig 136 mapping 1316 997 689 308 53.191
CF1_seqReads contig 137 mapping 1923 1880 1204 676 68.222
CF1_seqReads contig 138 mapping 903 601 401 200 47.503
CF1_seqReads contig 139 mapping 604 495 367 128 56.925
CF1_seqReads contig 140 mapping 1854 1651 1081 570 62.929
CF1_seqReads contig 141 mapping 857 1666 1114 552 137.351
CF1_seqReads contig 142 mapping 273 264 214 50 65.048
CF1_seqReads contig 143 mapping 1848 1254 826 428 47.48
CF1_seqReads contig 144 mapping 9112 8829 5223 3606 69.287
CF1_seqReads contig 145 mapping 4959 8350 5042 3308 120.352
CF1_seqReads contig 146 mapping 1160 2386 1570 816 147.567
CF1_seqReads contig 147 mapping 3398 2919 1807 1112 59.74
CF1_seqReads contig 148 mapping 513 491 381 110 65.774
CF1_seqReads contig 149 mapping 2634 2644 1594 1050 71.279
CF1_seqReads contig 150 mapping 2333 1832 1086 746 54.456
CF1_seqReads contig 151 mapping 9929 8130 4910 3220 58.649
CF1_seqReads contig 152 mapping 4867 4591 2765 1826 66.831
CF1_seqReads contig 153 mapping 2244 1984 1278 706 61.906
CF1_seqReads contig 154 mapping 3008 2557 1581 976 61.333
CF1_seqReads contig 155 mapping 553 1015 733 282 130.448
CF1_seqReads contig 156 mapping 735 974 662 312 91.188
CF1_seqReads contig 157 mapping 1375 2157 1507 650 110.765
CF1_seqReads contig 158 mapping 211 168 160 8 54.796
CF1_seqReads contig 159 mapping 211 174 160 14 56.749
CF1_seqReads contig 160 mapping 3076 3113 1855 1258 73.188
CF1_seqReads contig 161 mapping 1965 1474 998 476 51.869
CF1_seqReads contig 162 mapping 2495 2055 1301 754 57.74
CF1_seqReads contig 163 mapping 230 201 183 18 59.178
CF1_seqReads contig 164 mapping 899 1786 1176 610 140.673
CF1_seqReads contig 165 mapping 3860 2683 1643 1040 49.358
CF1_seqReads contig 166 mapping 1207 1064 642 422 62.839
CF1_seqReads contig 167 mapping 6068 5769 3555 2214 67.996
CF1_seqReads contig 168 mapping 1345 980 628 352 51.059
CF1_seqReads contig 169 mapping 2407 2119 1233 886 62.073
CF1_seqReads contig 170 mapping 236 409 359 50 119.915
CF1_seqReads contig 171 mapping 2288 1959 1229 730 61.018
CF1_seqReads contig 172 mapping 1214 715 497 218 40.74
CF1_seqReads contig 173 mapping 323 531 431 100 113.607
CF1_seqReads contig 174 mapping 1222 789 529 260 44.583
CF1_seqReads contig 175 mapping 207 188 182 6 61.063
CF1_seqReads contig 176 mapping 2236 2204 1392 812 70.699
CF1_seqReads contig 177 mapping 1173 1189 901 288 70.116
CF1_seqReads contig 178 mapping 757 692 476 216 62.54
CF1_seqReads contig 179 mapping 238 485 413 72 137.378
CF1_seqReads contig 180 mapping 1122 984 670 314 62.156
CF1_seqReads contig 181 mapping 1717 1305 819 486 53.286
CF1_seqReads contig 182 mapping 739 1061 825 236 101.298
CF1_seqReads contig 183 mapping 377 293 231 62 54.255
CF1_seqReads contig 184 mapping 878 837 589 248 67.145
CF1_seqReads contig 185 mapping 905 786 540 246 60.841
CF1_seqReads contig 186 mapping 321 223 189 34 44.969
CF1_seqReads contig 187 mapping 215 251 221 30 77.498
CF1_seqReads contig 188 mapping 1153 1074 718 356 64.892
CF1_seqReads contig 189 mapping 568 441 303 138 53.771
CF1_seqReads contig 190 mapping 582 450 282 168 54.89
CF1_seqReads contig 191 mapping 452 767 585 182 119.653
CF1_seqReads contig 192 mapping 263 218 186 32 58.73
CF1_seqReads contig 193 mapping 313 247 193 54 54.22
CF1_seqReads contig 194 mapping 295 214 174 40 48.346
CF1_seqReads contig 195 mapping 297 197 145 52 47.007
CF1_seqReads contig 196 mapping 346 230 180 50 42.566
CF1_seqReads contig 197 mapping 392 226 180 46 37.457
CF1_seqReads contig 198 mapping 208 168 150 18 53.255
CF1_seqReads contig 199 mapping 660 586 398 188 62.903
CF1_seqReads contig 200 mapping 276 300 250 50 72.681
CF1_seqReads contig 201 mapping 388 269 231 38 45.611
CF1_seqReads contig 202 mapping 353 343 245 98 67.042
CF1_seqReads contig 203 mapping 284 175 139 36 42.144
and looking at the y axis I can notice that there are 3 groups of points.
Is there an algorithm to identify each group without using max and/or min y values?

If you want to use some preset values for grouping the y then you could use cut
A reproducible example
set.seed(07122012)
DF <- data.frame(y= runif(100), x = rnorm(100))
# grouping at 0.33 / 0.66
mygroups <- seq(0,1,l=4)
ggplot(DF, aes(x=x,y=y)) + geom_point(aes(colour= cut(y,breaks = mygroups))) +
scale_colour_brewer('My groups', palette = 'Set2')
Or you could do some simple clustering (a combination of scale and kmeans on x and y perhaps)
ggplot(DF, aes(x=x,y=y)) +
geom_point(aes(colour= factor(kmeans(scale(cbind(x,y)), centers=3)$cluster))) +
scale_colour_brewer('My groups', palette = 'Set2')

Related

Issues with stmincuts in iGraph for R

I am trying to have R calculate the minimum cuts of a network. I am having trouble using iGraph's stmicuts command. It produces cuts for certain nodes and the ones it does produce cuts for do not make much sense. For example:
st_min_cuts(net_full, '2', '417', capacity = NULL)
Produces
st_min_cuts(net_full, '2', '346', capacity = NULL)
$value
[1] 2
$cuts
$cuts[[1]]
+ 0/960 edges from 19b17c7 (vertex names):
$partition1s
$partition1s[[1]]
+ 512/525 vertices, named, from 19b17c7:
[1] 346 515 345 145 144 143 142 141 140 139 138 137 136 135 134 133 132 131 130 129 128 127 126 125 124
[26] 123 122 121 120 119 118 117 116 115 114 113 112 111 110 109 108 107 106 105 104 103 102 101 100 99
[51] 98 97 96 95 94 93 92 91 90 89 88 87 86 85 84 83 82 81 80 79 78 77 76 75 74
[76] 73 72 32 31 28 15 8 4 2 524 520 518 517 516 519 513 512 511 510 509 506 504 503 499 497
[101] 491 487 485 480 478 476 474 469 382 380 379 377 370 368 367 366 364 362 361 358 356 354 349 347 338
[126] 336 332 329 319 318 317 316 315 314 313 312 311 310 309 308 307 306 305 304 303 302 301 300 299 298
[151] 297 296 295 30 27 294 293 292 291 290 289 288 287 286 285 284 283 282 281 280 279 278 277 276 275
[176] 274 273 272 24 23 265 264 263 262 261 260 259 258 257 256 255 254 253 252 251 250 249 248 247 246
[201] 245 244 243 242 241 240 239 238 237 21 20 19 18 269 268 267 266 26 17 16 236 235 234 233 232
[226] 231 230 229 228 227 226 225 224 223 222 221 220 219 218 217 216 215 214 213 212 211 210 209 208 207
+ ... omitted several vertices
I am trying to determine the minimum number of nodes that need to be cut for the source and sink to be disconnected. Any recommendations about how I can fix this issue or find the minimum cuts another way?

why is this butterworth filter presenting different results in R and Matlab?

I'm trying to use a 20Hz low pass filter on data in R, but when I use the filtfilt function, the plot is different from the matlab.
I'm using the following code in R:
fc<-20
fs<-100
Wn<-pi*fc/(2*fs)
testar<- butter(5, Wn, type="low")
L2<- signal::filtfilt(testar,Tabela$posicao)
plot(Tabela$tempo, L2, type = "l", col="red")
The matlab code is:
fc=20;
fs=100;
Wn=pi*fc/(2*fs);
[b,a] = butter(5,Wn,'low');
posfilt= filtfilt(b,a,Tabela.posicao);
The plot in matlab is:
The R one:
why the R one is presenting those variation in the begin and in the end of the graph?
Data can be produced as follows:
Tabela <- data.table::fread("
tempo posicao
0 870.22
1 870.27
2 870.33
3 870.39
4 870.46
5 870.52
6 870.57
7 870.61
8 870.63
9 870.65
10 870.66
11 870.68
12 870.7
13 870.73
14 870.76
15 870.79
16 870.81
17 870.82
18 870.83
19 870.83
20 870.83
21 870.84
22 870.85
23 870.85
24 870.85
25 870.83
26 870.79
27 870.74
28 870.69
29 870.63
30 870.59
31 870.57
32 870.56
33 870.55
34 870.53
35 870.51
36 870.46
37 870.42
38 870.37
39 870.33
40 870.31
41 870.3
42 870.3
43 870.31
44 870.31
45 870.31
46 870.33
47 870.36
48 870.42
49 870.52
50 870.64
51 870.77
52 870.87
53 870.92
54 870.91
55 870.82
56 870.68
57 870.51
58 870.37
59 870.27
60 870.25
61 870.29
62 870.38
63 870.5
64 870.61
65 870.69
66 870.74
67 870.76
68 870.76
69 870.75
70 870.74
71 870.74
72 870.76
73 870.78
74 870.81
75 870.86
76 870.93
77 871.02
78 871.12
79 871.23
80 871.33
81 871.42
82 871.47
83 871.5
84 871.52
85 871.52
86 871.54
87 871.57
88 871.62
89 871.67
90 871.71
91 871.73
92 871.72
93 871.68
94 871.64
95 871.59
96 871.58
97 871.59
98 871.62
99 871.66
100 871.7
101 871.7
102 871.69
103 871.65
104 871.6
105 871.56
106 871.54
107 871.52
108 871.52
109 871.5
110 871.48
111 871.43
112 871.38
113 871.31
114 871.24
115 871.17
116 871.12
117 871.07
118 871.02
119 870.99
120 870.97
121 870.97
122 870.98
123 871.00
124 871.02
125 871.04
126 871.04
127 871.02
128 870.97
129 870.91
130 870.84
131 870.78
132 870.74
133 870.72
134 870.72
135 870.72
136 870.72
137 870.71
138 870.69
139 870.68
140 870.69
141 870.72
142 870.77
143 870.84
144 870.92
145 871.01
146 871.1
147 871.19
148 871.28
149 871.36
150 871.43
151 871.49
152 871.55
153 871.6
154 871.67
155 871.74
156 871.84
157 871.95
158 872.07
159 872.2
160 872.31
161 872.42
162 872.51
163 872.59
164 872.66
165 872.75
166 872.86
167 873.02
168 873.22
169 873.48
170 873.8
171 874.16
172 874.55
173 874.99
174 875.49
175 876.06
176 876.72
177 877.48
178 878.36
179 879.33
180 880.41
181 881.59
182 882.87
183 884.24
184 885.71
185 887.29
186 888.96
187 890.73
188 892.61
189 894.57
190 896.63
191 898.77
192 900.99
193 903.28
194 905.63
195 908.02
196 910.44
197 912.88
198 915.33
199 917.79
200 920.25
201 922.71
202 925.15
203 927.57
204 929.96
205 932.3
206 934.59
207 936.82
208 938.99
209 941.09
210 943.14
211 945.12
212 947.05
213 948.89
214 950.62
215 952.2
216 953.62
217 954.86
218 955.94
219 956.86
220 957.65
221 958.33
222 958.9
223 959.4
224 959.83
225 960.2
226 960.53
227 960.82
228 961.09
229 961.35
230 961.58
231 961.81
232 962.02
233 962.23
234 962.45
235 962.7
236 962.98
237 963.32
238 963.7
239 964.13
240 964.6
241 965.09
242 965.59
243 966.09
244 966.59
245 967.1
246 967.62
247 968.15
248 968.69
249 969.25
250 969.81
251 970.36
252 970.89
253 971.4
254 971.89
255 972.33
256 972.73
257 973.08
258 973.38
259 973.63
260 973.85
261 974.05
262 974.25
263 974.44
264 974.63
265 974.8
266 974.96
267 975.1
268 975.24
269 975.37
270 975.5
271 975.64
272 975.8
273 975.96
274 976.13
275 976.32
276 976.52
277 976.74
278 976.97
279 977.21
280 977.44
281 977.66
282 977.84
283 977.97
284 978.05
285 978.06
286 978.01
287 977.9
288 977.74
289 977.53
290 977.28
291 976.99
292 976.67
293 976.34
294 976.01
295 975.68
296 975.35
297 975.02
298 974.68
299 974.31
300 973.91
301 973.48
302 973.04
303 972.58
304 972.14
305 971.71
306 971.32
307 970.97
308 970.67
309 970.41
310 970.2
311 970.02
312 969.89
313 969.78
314 969.72
315 969.68
316 969.67
317 969.67
318 969.67
319 969.67
320 969.67
321 969.68
322 969.69
323 969.73
324 969.79
325 969.88
326 969.98
327 970.08
328 970.17
329 970.24
330 970.28
331 970.29
332 970.27
333 970.22
334 970.15
335 970.07
336 969.98
337 969.89
338 969.81
339 969.74
340 969.68
341 969.63
342 969.6
343 969.57
344 969.56
345 969.55
346 969.57
347 969.6
348 969.65
349 969.73
350 969.81
351 969.89
352 969.96
353 970.01
354 970.05
355 970.06
356 970.07
357 970.08
358 970.09
359 970.09
360 970.09
361 970.08
362 970.06
363 970.04
364 970.00
365 969.96
366 969.94
367 969.93
368 969.95
369 970.00
370 970.08
371 970.17
372 970.27
373 970.35
374 970.42
375 970.48
376 970.53
377 970.58
378 970.64
379 970.73
380 970.85
381 970.98
382 971.14
383 971.3
384 971.45
385 971.58
386 971.69
387 971.76
388 971.79
389 971.8
390 971.78
391 971.75
392 971.71
393 971.66
394 971.61
395 971.55
396 971.48
397 971.39
398 971.3
399 971.2
400 971.1
401 971.00
402 970.9
403 970.82
404 970.76
405 970.73
406 970.72
407 970.73
408 970.77
409 970.83
410 970.9
411 970.98
412 971.06
413 971.16
414 971.27
415 971.4
416 971.53
417 971.67
418 971.81
419 971.94
420 972.06
421 972.17
422 972.25
423 972.33
424 972.38
425 972.42
426 972.45
427 972.45
428 972.44
429 972.42
430 972.38
431 972.34
432 972.29
433 972.24
434 972.2
435 972.16
436 972.12
437 972.1
438 972.08
439 972.07
440 972.07
441 972.07
442 972.07
443 972.08
444 972.09
445 972.12
446 972.18
447 972.26
448 972.37
449 972.49
450 972.61
451 972.7
452 972.78
453 972.82
454 972.83
455 972.82
456 972.79
457 972.76
458 972.71
459 972.65
460 972.57
461 972.49
462 972.39
463 972.29
464 972.19
465 972.11
466 972.07
467 972.05
468 972.07
469 972.1
470 972.14
471 972.17
472 972.19
473 972.2
474 972.21
475 972.22
476 972.25
477 972.29
478 972.36
479 972.44
480 972.52
481 972.61
482 972.68
483 972.74
484 972.78
485 972.81
486 972.83
487 972.85
488 972.86
489 972.88
490 972.9
491 972.92
492 972.95
493 972.97
494 972.99
495 973.00
496 972.99
497 972.97
498 972.93
499 972.88
500 972.83
501 972.78
502 972.73
503 972.69
504 972.66
505 972.64
506 972.64
507 972.66
508 972.7
509 972.76
510 972.83
511 972.92
512 973.02
513 973.13
514 973.25
515 973.39
516 973.56
517 973.74
518 973.94
519 974.14
520 974.34
521 974.52
522 974.68
523 974.82
524 974.94
525 975.06
526 975.18
527 975.3
528 975.43
529 975.58
530 975.73
531 975.88
532 976.02
533 976.15
534 976.27
535 976.4
536 976.53
537 976.67
538 976.82
539 976.99
540 977.17
541 977.35
542 977.53
543 977.71
544 977.88
545 978.03
546 978.18
547 978.31
548 978.44
549 978.55
550 978.63
551 978.69
552 978.72
553 978.73
554 978.73
555 978.72
556 978.71
557 978.69
558 978.67
559 978.62
560 978.54
561 978.41
562 978.22
563 977.96
564 977.62
565 977.19
566 976.67
567 976.05
568 975.32
569 974.47
570 973.48
571 972.34
572 971.03
573 969.52
574 967.79
575 965.83
576 963.64
577 961.2
578 958.52
579 955.62
580 952.5
581 949.16
582 945.6
583 941.83
584 937.85
585 933.68
586 929.33
587 924.8
588 920.12
589 915.3
590 910.35
591 905.29
592 900.13
593 894.88
594 889.56
595 884.18
596 878.76
597 873.31
598 867.84
599 862.37
600 856.93
601 851.52
602 846.16
603 840.86
604 835.64
605 830.48
606 825.41
607 820.4
608 815.46
609 810.57
610 805.74
611 800.96
612 796.25
613 791.59
614 786.99
615 782.46
616 777.99
617 773.57
618 769.2
619 764.89
620 760.64
621 756.45
622 752.32
623 748.25
624 744.24
625 740.31
626 736.46
627 732.69
628 729.03
629 725.5
630 722.1
631 718.83
632 715.7
633 712.68
634 709.77
635 706.96
636 704.25
637 701.63
638 699.13
639 696.75
640 694.49
641 692.36
642 690.34
643 688.42
644 686.6
645 684.85
646 683.17
647 681.56
648 680.01
649 678.52
650 677.1
651 675.75
652 674.49
653 673.3
654 672.19
655 671.15
656 670.16
657 669.22
658 668.33
659 667.5
660 666.74
661 666.05
662 665.42
663 664.85
664 664.32
665 663.82
666 663.35
667 662.93
668 662.57
669 662.27
670 662.05
671 661.89
672 661.77
673 661.69
674 661.62
675 661.56
676 661.5
677 661.44
678 661.38
679 661.34
680 661.29
681 661.25
682 661.2
683 661.13
684 661.05
685 660.95
686 660.83
687 660.7
688 660.57
689 660.43
690 660.28
691 660.13
692 659.96
693 659.78
694 659.6
695 659.43
696 659.29
697 659.2
698 659.16
699 659.19
700 659.28
701 659.43
702 659.65
703 659.96
704 660.37
705 660.9
706 661.54
707 662.31
708 663.19
709 664.2
710 665.33
711 666.58
712 667.94
713 669.43
714 671.02
715 672.73
716 674.55
717 676.46
718 678.46
719 680.55
720 682.73
721 685.00
722 687.36
723 689.81
724 692.34
725 694.92
726 697.54
727 700.15
728 702.73
729 705.28
730 707.79
731 710.27
732 712.76
733 715.26
734 717.8
735 720.38
736 722.98
737 725.6
738 728.21
739 730.81
740 733.39
741 735.96
742 738.5
743 741.02
744 743.52
745 746.00
746 748.45
747 750.87
748 753.25
749 755.58
750 757.87
751 760.12
752 762.34
753 764.53
754 766.71
755 768.86
756 770.99
757 773.09
758 775.16
759 777.2
760 779.23
761 781.24
762 783.25
763 785.26
764 787.28
765 789.3
766 791.31
767 793.33
768 795.34
769 797.35
770 799.35
771 801.34
772 803.33
773 805.31
774 807.29
775 809.26
776 811.21
777 813.16
778 815.09
779 817.03
780 818.96
781 820.91
782 822.88
783 824.85
784 826.82
785 828.78
786 830.73
787 832.67
788 834.59
789 836.5
790 838.41
791 840.33
792 842.27
793 844.23
794 846.2
795 848.18
796 850.15
797 852.1
798 854.02
799 855.93
800 857.84
801 859.76
802 861.71
803 863.69
804 865.69
805 867.72
806 869.75
807 871.79
808 873.83
809 875.88
810 877.94
811 880.02
812 882.12
813 884.25
814 886.41
815 888.59
816 890.78
817 892.97
818 895.18
819 897.39
820 899.61
821 901.85
822 904.11
823 906.38
824 908.67
825 910.97
826 913.29
827 915.61
828 917.94
829 920.28
830 922.63
831 925.00
832 927.38
833 929.79
834 932.22
835 934.68
836 937.17
837 939.67
838 942.17
839 944.67
840 947.15
841 949.62
842 952.08
843 954.51
844 956.94
845 959.36
846 961.75
847 964.12
848 966.45
849 968.73
850 970.94
851 973.07
852 975.12
853 977.08
854 978.94
855 980.7
856 982.34
857 983.86
858 985.26
859 986.52
860 987.65
861 988.64
862 989.49
863 990.2
864 990.76
865 991.16
866 991.42
867 991.52
868 991.48
869 991.3
870 991.01
871 990.63
872 990.18
873 989.67
874 989.13
875 988.56
876 987.98
877 987.39
878 986.79
879 986.2
880 985.61
881 985.04
882 984.52
883 984.05
884 983.65
885 983.32
886 983.07
887 982.88
888 982.74
889 982.64
890 982.55
891 982.47
892 982.38
893 982.28
894 982.15
895 981.98
896 981.78
897 981.54
898 981.26
899 980.94
900 980.61
901 980.28
902 979.94
903 979.61
904 979.29
905 978.98
906 978.68
907 978.39
908 978.11
909 977.85
910 977.6
911 977.37
912 977.16
913 976.94
914 976.72
915 976.5
916 976.27
917 976.06
918 975.85
919 975.67
920 975.5
921 975.36
922 975.22
923 975.08
924 974.93
925 974.76
926 974.57
927 974.35
928 974.1
929 973.85
930 973.6
931 973.36
932 973.13
933 972.93
934 972.74
935 972.55
936 972.37
937 972.19
938 972.00
939 971.8
940 971.6
941 971.39
942 971.18
943 970.97
944 970.76
945 970.56
946 970.37
947 970.19
948 970.02
949 969.86
950 969.72
951 969.6
952 969.5
953 969.42
954 969.36
955 969.33
956 969.29
957 969.27
958 969.23
959 969.19
960 969.14
961 969.09
962 969.04
963 968.99
964 968.94
965 968.88
966 968.82
967 968.74
968 968.64
969 968.54
970 968.42
971 968.3
972 968.19
973 968.08
974 967.98
975 967.86
976 967.74
977 967.59
978 967.42
979 967.24
980 967.04
981 966.85
982 966.67
983 966.5
984 966.35
985 966.2
986 966.06
987 965.92
988 965.77
989 965.61
990 965.44
991 965.25
992 965.05
993 964.82
994 964.58
995 964.32
996 964.05
997 963.78
998 963.52
999 963.28
1000 963.06
1001 962.85
1002 962.65
1003 962.44
1004 962.18
1005 961.87
1006 961.49
1007 961.03
1008 960.49
1009 959.91
1010 959.32
1011 958.75
1012 958.23
1013 957.77
1014 957.33
1015 956.9
1016 956.43
1017 955.87
1018 955.19
1019 954.37
1020 953.43
1021 952.39
1022 951.28
1023 950.13
1024 948.96
1025 947.74
1026 946.48
1027 945.15
1028 943.74
1029 942.26
1030 940.72
1031 939.11
1032 937.45
1033 935.74
1034 933.95
1035 932.07
1036 930.11
1037 928.06
1038 925.97
1039 923.92
1040 921.98
1041 920.24
1042 918.75
1043 917.51
1044 916.51
1045 915.7
1046 915.04
1047 914.51
1048 914.1
1049 913.76
1050 913.44
1051 913.05
1052 912.52
1053 911.79
1054 910.86
1055 909.74
1056 908.49
1057 907.19
1058 905.91
1059 904.73
1060 903.71
1061 902.89
1062 902.28
1063 901.88
1064 901.66
1065 901.59
1066 901.65
1067 901.81
1068 902.03
1069 902.3
1070 902.56
1071 902.79
1072 902.96
1073 903.06
1074 903.09
1075 903.06
1076 902.97
1077 902.85
1078 902.7
1079 902.53
1080 902.36
1081 902.21
1082 902.07
1083 901.95
1084 901.83
1085 901.67
1086 901.46
1087 901.17
1088 900.77
1089 900.26
1090 899.61
1091 898.81
1092 897.85
1093 896.73
1094 895.47
1095 894.12
1096 892.74
1097 891.4
1098 890.16
1099 889.04
1100 888.02
1101 887.1
1102 886.26
1103 885.5
1104 884.81
1105 884.15
1106 883.45
1107 882.61
1108 881.56
1109 880.29
1110 878.88
1111 877.44
1112 876.11
1113 875.01
1114 874.2
1115 873.65
1116 873.28
1117 872.99
1118 872.69
1119 872.36
1120 872.02
1121 871.74
1122 871.56
1123 871.5
1124 871.53
1125 871.6
1126 871.62
1127 871.58
1128 871.45
1129 871.26
1130 871.06
1131 870.9
1132 870.81
1133 870.82
1134 870.92
1135 871.06
1136 871.21
1137 871.32
1138 871.36
1139 871.33
1140 871.24
1141 871.14
1142 871.08
1143 871.08
1144 871.15
1145 871.28
1146 871.43
1147 871.56
1148 871.62
1149 871.6
1150 871.51
1151 871.37
1152 871.2
1153 871.04
1154 870.89
1155 870.77
1156 870.66
1157 870.55
1158 870.44
1159 870.32
1160 870.22
1161 870.13
1162 870.08
1163 870.06
1164 870.07
1165 870.09
1166 870.12
1167 870.14
1168 870.13
1169 870.11
1170 870.08
1171 870.05
1172 870.03
1173 870.03
1174 870.04
1175 870.04
1176 870.03
1177 869.99
1178 869.93
1179 869.87
1180 869.83
1181 869.81
1182 869.83
1183 869.88
1184 869.94
1185 870.00
1186 870.03
1187 870.03
1188 870.02
1189 870.00
1190 870.00
1191 870.00
1192 870.03
1193 870.06
1194 870.1
1195 870.14
1196 870.17
1197 870.2
1198 870.24
1199 870.28
1200 870.33
1201 870.37
1202 870.39
1203 870.39
1204 870.36
1205 870.31
1206 870.24
1207 870.18
1208 870.13
1209 870.09
1210 870.05
1211 870.01
1212 869.95
1213 869.88
1214 869.81
1215 869.75
1216 869.72
1217 869.73
1218 869.77
1219 869.85
1220 869.93
1221 870.01
1222 870.06
1223 870.1
1224 870.11
1225 870.11
1226 870.11
1227 870.11
1228 870.11
1229 870.12
1230 870.14
1231 870.16")
I have hunch that the difference is in how each version handles end-effect transients.
Your signal has a large DC-offset (~875). If you think of the signal as being zero 0 before and after the recording. The jump at the start of the signal gets processed by the filter and is seen as an artifact or end-effect. These end-effects are what you see in the R version of the filtered signal.
From the R documentation from filtfilt this version is old and likely doesn't minimize the end transients (R 'filtfilt' docs). On the other hand the MATLAB version of filtfilt does; Quoting from the MATLAB documentation:
"filtfilt minimizes start-up and ending transients by matching initial conditions. Do not use 'filtfilt' with differentiator and Hilbert FIR filters, because the operation of these filters depends heavily on their phase response." FILTFILT Documentation
As mentioned by Azim, the default implementation of signal::filtfilt() does not include any steps to remove end-effect transients. However, a very simple function that pads the series with a reversed values before/after and then subsets the result to the original range of interest can solve this problem.
EndEffect <- function(filt,x) {
signal::filtfilt(filt,c(rev(x),x,rev(x)))[(length(x) + 1):(2 * length(x))]
}
L2<- EndEffect(testar,Tabela$posicao)
plot(Tabela$tempo, L2, type = "l", col="red")

cleaning the data R

I've got the final data DS such as :
|user_id
40 33
70 50
93 67
106 77
136 91
144 97
160 105
176 113
195 128
207 132
211 134
229 142
280 159
338 187
407 232
425 248
442 259
446 261
469 277
470 278
588 353
590 355
594 358
598 362
609 369
615 375
626 381
633 386
652 399
657 402
735 452
751 464
758 470
760 471
769 478
774 480
806 493
821 501
825 505
856 526
876 536
886 540
890 542
894 543
903 549
919 556
921 558
932 562
The fist column is a what left of line numbers I suppose, after many data manipulations,
and I'd like to drop them, nice, efficient way, and replace it with normal order numbers , 1,2,3,4,5 etc.
I did try to use :
aggr.cid <-aggregate(cbind(DS$user_id), by=list(CustID = DS$user_id),
function(x) x[1])
But instead of getting 1 line I'm getting two, with content of "user_id"
I can remove the second one and all will looks as I need but it is a doggy way....
Those are the row names. You can reset them with
rownames(DS) <- NULL

Gggplot line graph each day

I have this data frame below. I want to plot line graph using GGPLOT for each day of 'ind' column. In the 'ind'column I have the following dates repeated:
datedf<-as.Date(ux<-unique(df$ind))
> datedf
[1] "07/12/2015" "08.12.2015" "09.12.2015" "10.12.2015" "11.12.2015" "12.14.2015" "2015-12- 15 "" 12.16.2015 "[9]" 12/17/2015 "," 12/18/2015 "," 12/21/2015 "
I want to make a line graph that has as Y-axis 'estimatedRate' and 'Future' columns data together and as X-axis the 'm' column for each one of these days.
> mdf<-ux<-unique(df$m)
> mdf
[1] 21 42 63 84 105 126 147 168 189 210 231 252 273 294 315 336 357 378 399 420 441
[22] 462 483 504 525 546 567 588 609 630 651 672 693 714 735 756 777 798 819 840 861 882
[43] 903 924 945 966 987 1008 1029 1050 1071 1092 1113 1134 1155 1176 1197 1218 1239 1260 1281 1302 1323
[64] 1344 1365 1386 1407 1428 1449 1470 1491 1512 1533 1554 1575 1596 1617 1638 1659 1680 1701 1722 1743 1764
[85] 1785 1806 1827 1848 1869 1890 1911 1932 1953 1974 1995 2016 2037 2058 2079 2100 2121 2142 2163 2184 2205
[106] 2226 2247 2268 2289 2310 2331 2352 2373 2394 2415 2436 2457 2478 2499 2520
Notice that every 120 rows I have one day, and data related to this day in the columns 'estimatedRate' and 'Future'.
To make the first graph I use the first 120 lines, to make the second graph the second 120th lines and so on.
ind m estimatedRate Future
1 2015-12-07 21 0.1418127 0.1417730
2 2015-12-07 42 0.1420864 0.1427000
3 2015-12-07 63 0.1464147 0.1445127
4 2015-12-07 84 0.1494089 0.1463107
5 2015-12-07 105 0.1513357 0.1480558
6 2015-12-07 126 0.1526393 0.1499211
7 2015-12-07 147 0.1535730 0.1514676
8 2015-12-07 168 0.1542737 0.1531931
9 2015-12-07 189 0.1548187 0.1544670
10 2015-12-07 210 0.1552547 0.1555310
11 2015-12-07 231 0.1556115 0.1563341
12 2015-12-07 252 0.1559088 0.1569693
13 2015-12-07 273 0.1561603 0.1575226
14 2015-12-07 294 0.1563759 0.1581614
15 2015-12-07 315 0.1565628 0.1587338
16 2015-12-07 336 0.1567263 0.1591577
17 2015-12-07 357 0.1568706 0.1595782
18 2015-12-07 378 0.1569988 0.1599672
19 2015-12-07 399 0.1571136 0.1602606
20 2015-12-07 420 0.1572168 0.1603606
21 2015-12-07 441 0.1573103 0.1605000
22 2015-12-07 462 0.1573952 0.1606000
23 2015-12-07 483 0.1574728 0.1606000
24 2015-12-07 504 0.1575438 0.1606000
25 2015-12-07 525 0.1576092 0.1606000
26 2015-12-07 546 0.1576696 0.1606849
27 2015-12-07 567 0.1577255 0.1607000
28 2015-12-07 588 0.1577774 0.1607000
29 2015-12-07 609 0.1578258 0.1608000
30 2015-12-07 630 0.1578709 0.1608000
31 2015-12-07 651 0.1579131 0.1608000
32 2015-12-07 672 0.1579526 0.1608000
33 2015-12-07 693 0.1579898 0.1608000
34 2015-12-07 714 0.1580247 0.1607000
35 2015-12-07 735 0.1580577 0.1607000
36 2015-12-07 756 0.1580889 0.1607000
37 2015-12-07 777 0.1581183 0.1607000
38 2015-12-07 798 0.1581462 0.1606000
39 2015-12-07 819 0.1581727 0.1605000
40 2015-12-07 840 0.1581979 0.1604000
41 2015-12-07 861 0.1582218 0.1602935
42 2015-12-07 882 0.1582446 0.1602274
43 2015-12-07 903 0.1582663 0.1600911
44 2015-12-07 924 0.1582871 0.1600000
45 2015-12-07 945 0.1583069 0.1598089
46 2015-12-07 966 0.1583258 0.1596099
47 2015-12-07 987 0.1583440 0.1595128
48 2015-12-07 1008 0.1583614 0.1593824
49 2015-12-07 1029 0.1583781 0.1592110
50 2015-12-07 1050 0.1583941 0.1591128
51 2015-12-07 1071 0.1584095 0.1589000
52 2015-12-07 1092 0.1584243 0.1588000
53 2015-12-07 1113 0.1584385 0.1585936
54 2015-12-07 1134 0.1584522 0.1584613
55 2015-12-07 1155 0.1584654 0.1583922
56 2015-12-07 1176 0.1584782 0.1582099
57 2015-12-07 1197 0.1584905 0.1581000
58 2015-12-07 1218 0.1585023 0.1580000
59 2015-12-07 1239 0.1585138 0.1579000
60 2015-12-07 1260 0.1585249 0.1577715
61 2015-12-07 1281 0.1585356 0.1577000
62 2015-12-07 1302 0.1585460 0.1576000
63 2015-12-07 1323 0.1585560 0.1575767
64 2015-12-07 1344 0.1585658 0.1575000
65 2015-12-07 1365 0.1585752 0.1574936
66 2015-12-07 1386 0.1585844 0.1574277
67 2015-12-07 1407 0.1585932 0.1573908
68 2015-12-07 1428 0.1586018 0.1573000
69 2015-12-07 1449 0.1586102 0.1572916
70 2015-12-07 1470 0.1586183 0.1572000
71 2015-12-07 1491 0.1586262 0.1571940
72 2015-12-07 1512 0.1586339 0.1571319
73 2015-12-07 1533 0.1586414 0.1571000
74 2015-12-07 1554 0.1586486 0.1571000
75 2015-12-07 1575 0.1586557 0.1572000
76 2015-12-07 1596 0.1586626 0.1572000
77 2015-12-07 1617 0.1586693 0.1572093
78 2015-12-07 1638 0.1586758 0.1572731
79 2015-12-07 1659 0.1586822 0.1573000
80 2015-12-07 1680 0.1586884 0.1573000
81 2015-12-07 1701 0.1586945 0.1573000
82 2015-12-07 1722 0.1587004 0.1573101
83 2015-12-07 1743 0.1587061 0.1574000
84 2015-12-07 1764 0.1587118 0.1574000
85 2015-12-07 1785 0.1587173 0.1574000
86 2015-12-07 1806 0.1587226 0.1574000
87 2015-12-07 1827 0.1587279 0.1574000
88 2015-12-07 1848 0.1587330 0.1574000
89 2015-12-07 1869 0.1587380 0.1574000
90 2015-12-07 1890 0.1587429 0.1574000
91 2015-12-07 1911 0.1587477 0.1574000
92 2015-12-07 1932 0.1587524 0.1574092
93 2015-12-07 1953 0.1587570 0.1574731
94 2015-12-07 1974 0.1587615 0.1575000
95 2015-12-07 1995 0.1587659 0.1575000
96 2015-12-07 2016 0.1587702 0.1575000
97 2015-12-07 2037 0.1587744 0.1575000
98 2015-12-07 2058 0.1587785 0.1575000
99 2015-12-07 2079 0.1587825 0.1575000
100 2015-12-07 2100 0.1587865 0.1575000
101 2015-12-07 2121 0.1587904 0.1575000
102 2015-12-07 2142 0.1587942 0.1575000
103 2015-12-07 2163 0.1587979 0.1575000
104 2015-12-07 2184 0.1588016 0.1575000
105 2015-12-07 2205 0.1588052 0.1575000
106 2015-12-07 2226 0.1588087 0.1575000
107 2015-12-07 2247 0.1588122 0.1575000
108 2015-12-07 2268 0.1588156 0.1575000
109 2015-12-07 2289 0.1588189 0.1575000
110 2015-12-07 2310 0.1588222 0.1575018
111 2015-12-07 2331 0.1588254 0.1575385
112 2015-12-07 2352 0.1588286 0.1575746
113 2015-12-07 2373 0.1588317 0.1576190
114 2015-12-07 2394 0.1588347 0.1576846
115 2015-12-07 2415 0.1588377 0.1577000
116 2015-12-07 2436 0.1588406 0.1577000
117 2015-12-07 2457 0.1588435 0.1577000
118 2015-12-07 2478 0.1588464 0.1577131
119 2015-12-07 2499 0.1588492 0.1578000
120 2015-12-07 2520 0.1588519 0.1578000
121 2015-12-07 21 0.1418127 0.1417730
122 2015-12-07 42 0.1420864 0.1427000
123 2015-12-07 63 0.1464147 0.1445127
124 2015-12-07 84 0.1494089 0.1463107
125 2015-12-07 105 0.1513357 0.1480558
126 2015-12-07 126 0.1526393 0.1499211
127 2015-12-07 147 0.1535730 0.1514676
128 2015-12-07 168 0.1542737 0.1531931
129 2015-12-07 189 0.1548187 0.1544670
130 2015-12-07 210 0.1552547 0.1555310
131 2015-12-07 231 0.1556115 0.1563341
132 2015-12-07 252 0.1559088 0.1569693
133 2015-12-07 273 0.1561603 0.1575226
134 2015-12-07 294 0.1563759 0.1581614
135 2015-12-07 315 0.1565628 0.1587338
136 2015-12-07 336 0.1567263 0.1591577
137 2015-12-07 357 0.1568706 0.1595782
138 2015-12-07 378 0.1569988 0.1599672
139 2015-12-07 399 0.1571136 0.1602606
140 2015-12-07 420 0.1572168 0.1603606
141 2015-12-07 441 0.1573103 0.1605000
142 2015-12-07 462 0.1573952 0.1606000
143 2015-12-07 483 0.1574728 0.1606000
144 2015-12-07 504 0.1575438 0.1606000
145 2015-12-07 525 0.1576092 0.1606000
146 2015-12-07 546 0.1576696 0.1606849
147 2015-12-07 567 0.1577255 0.1607000
148 2015-12-07 588 0.1577774 0.1607000
149 2015-12-07 609 0.1578258 0.1608000
150 2015-12-07 630 0.1578709 0.1608000
151 2015-12-07 651 0.1579131 0.1608000
152 2015-12-07 672 0.1579526 0.1608000
153 2015-12-07 693 0.1579898 0.1608000
154 2015-12-07 714 0.1580247 0.1607000
155 2015-12-07 735 0.1580577 0.1607000
156 2015-12-07 756 0.1580889 0.1607000
157 2015-12-07 777 0.1581183 0.1607000
158 2015-12-07 798 0.1581462 0.1606000
159 2015-12-07 819 0.1581727 0.1605000
160 2015-12-07 840 0.1581979 0.1604000
161 2015-12-07 861 0.1582218 0.1602935
162 2015-12-07 882 0.1582446 0.1602274
163 2015-12-07 903 0.1582663 0.1600911
164 2015-12-07 924 0.1582871 0.1600000
165 2015-12-07 945 0.1583069 0.1598089
166 2015-12-07 966 0.1583258 0.1596099
167 2015-12-07 987 0.1583440 0.1595128
168 2015-12-07 1008 0.1583614 0.1593824
169 2015-12-07 1029 0.1583781 0.1592110
170 2015-12-07 1050 0.1583941 0.1591128
171 2015-12-07 1071 0.1584095 0.1589000
172 2015-12-07 1092 0.1584243 0.1588000
173 2015-12-07 1113 0.1584385 0.1585936
174 2015-12-07 1134 0.1584522 0.1584613
175 2015-12-07 1155 0.1584654 0.1583922
176 2015-12-07 1176 0.1584782 0.1582099
177 2015-12-07 1197 0.1584905 0.1581000
178 2015-12-07 1218 0.1585023 0.1580000
179 2015-12-07 1239 0.1585138 0.1579000
180 2015-12-07 1260 0.1585249 0.1577715
181 2015-12-07 1281 0.1585356 0.1577000
182 2015-12-07 1302 0.1585460 0.1576000
183 2015-12-07 1323 0.1585560 0.1575767
184 2015-12-07 1344 0.1585658 0.1575000
185 2015-12-07 1365 0.1585752 0.1574936
186 2015-12-07 1386 0.1585844 0.1574277
187 2015-12-07 1407 0.1585932 0.1573908
188 2015-12-07 1428 0.1586018 0.1573000
189 2015-12-07 1449 0.1586102 0.1572916
190 2015-12-07 1470 0.1586183 0.1572000
191 2015-12-07 1491 0.1586262 0.1571940
192 2015-12-07 1512 0.1586339 0.1571319
193 2015-12-07 1533 0.1586414 0.1571000
194 2015-12-07 1554 0.1586486 0.1571000
195 2015-12-07 1575 0.1586557 0.1572000
196 2015-12-07 1596 0.1586626 0.1572000
197 2015-12-07 1617 0.1586693 0.1572093
198 2015-12-07 1638 0.1586758 0.1572731
199 2015-12-07 1659 0.1586822 0.1573000
200 2015-12-07 1680 0.1586884 0.1573000
201 2015-12-07 1701 0.1586945 0.1573000
202 2015-12-07 1722 0.1587004 0.1573101
203 2015-12-07 1743 0.1587061 0.1574000
204 2015-12-07 1764 0.1587118 0.1574000
205 2015-12-07 1785 0.1587173 0.1574000
206 2015-12-07 1806 0.1587226 0.1574000
207 2015-12-07 1827 0.1587279 0.1574000
208 2015-12-07 1848 0.1587330 0.1574000
209 2015-12-07 1869 0.1587380 0.1574000
210 2015-12-07 1890 0.1587429 0.1574000
211 2015-12-07 1911 0.1587477 0.1574000
212 2015-12-07 1932 0.1587524 0.1574092
213 2015-12-07 1953 0.1587570 0.1574731
214 2015-12-07 1974 0.1587615 0.1575000
215 2015-12-07 1995 0.1587659 0.1575000
216 2015-12-07 2016 0.1587702 0.1575000
217 2015-12-07 2037 0.1587744 0.1575000
218 2015-12-07 2058 0.1587785 0.1575000
219 2015-12-07 2079 0.1587825 0.1575000
220 2015-12-07 2100 0.1587865 0.1575000
221 2015-12-07 2121 0.1587904 0.1575000
222 2015-12-07 2142 0.1587942 0.1575000
223 2015-12-07 2163 0.1587979 0.1575000
224 2015-12-07 2184 0.1588016 0.1575000
225 2015-12-07 2205 0.1588052 0.1575000
226 2015-12-07 2226 0.1588087 0.1575000
227 2015-12-07 2247 0.1588122 0.1575000
228 2015-12-07 2268 0.1588156 0.1575000
229 2015-12-07 2289 0.1588189 0.1575000
230 2015-12-07 2310 0.1588222 0.1575018
231 2015-12-07 2331 0.1588254 0.1575385
232 2015-12-07 2352 0.1588286 0.1575746
233 2015-12-07 2373 0.1588317 0.1576190
234 2015-12-07 2394 0.1588347 0.1576846
235 2015-12-07 2415 0.1588377 0.1577000
236 2015-12-07 2436 0.1588406 0.1577000
237 2015-12-07 2457 0.1588435 0.1577000
238 2015-12-07 2478 0.1588464 0.1577131
239 2015-12-07 2499 0.1588492 0.1578000
240 2015-12-07 2520 0.1588519 0.1578000
241 2015-12-07 21 0.1418127 0.1417730
242 2015-12-07 42 0.1420864 0.1427000
243 2015-12-07 63 0.1464147 0.1445127
244 2015-12-07 84 0.1494089 0.1463107
245 2015-12-07 105 0.1513357 0.1480558
246 2015-12-07 126 0.1526393 0.1499211
247 2015-12-07 147 0.1535730 0.1514676
248 2015-12-07 168 0.1542737 0.1531931
249 2015-12-07 189 0.1548187 0.1544670
250 2015-12-07 210 0.1552547 0.1555310
251 2015-12-07 231 0.1556115 0.1563341
252 2015-12-07 252 0.1559088 0.1569693
253 2015-12-07 273 0.1561603 0.1575226
254 2015-12-07 294 0.1563759 0.1581614
255 2015-12-07 315 0.1565628 0.1587338
256 2015-12-07 336 0.1567263 0.1591577
257 2015-12-07 357 0.1568706 0.1595782
258 2015-12-07 378 0.1569988 0.1599672
259 2015-12-07 399 0.1571136 0.1602606
260 2015-12-07 420 0.1572168 0.1603606
261 2015-12-07 441 0.1573103 0.1605000
262 2015-12-07 462 0.1573952 0.1606000
263 2015-12-07 483 0.1574728 0.1606000
264 2015-12-07 504 0.1575438 0.1606000
265 2015-12-07 525 0.1576092 0.1606000
266 2015-12-07 546 0.1576696 0.1606849
267 2015-12-07 567 0.1577255 0.1607000
268 2015-12-07 588 0.1577774 0.1607000
269 2015-12-07 609 0.1578258 0.1608000
270 2015-12-07 630 0.1578709 0.1608000
271 2015-12-07 651 0.1579131 0.1608000
272 2015-12-07 672 0.1579526 0.1608000
273 2015-12-07 693 0.1579898 0.1608000
274 2015-12-07 714 0.1580247 0.1607000
275 2015-12-07 735 0.1580577 0.1607000
276 2015-12-07 756 0.1580889 0.1607000
277 2015-12-07 777 0.1581183 0.1607000
278 2015-12-07 798 0.1581462 0.1606000
279 2015-12-07 819 0.1581727 0.1605000
280 2015-12-07 840 0.1581979 0.1604000
281 2015-12-07 861 0.1582218 0.1602935
282 2015-12-07 882 0.1582446 0.1602274
283 2015-12-07 903 0.1582663 0.1600911
284 2015-12-07 924 0.1582871 0.1600000
285 2015-12-07 945 0.1583069 0.1598089
286 2015-12-07 966 0.1583258 0.1596099
287 2015-12-07 987 0.1583440 0.1595128
288 2015-12-07 1008 0.1583614 0.1593824
289 2015-12-07 1029 0.1583781 0.1592110
290 2015-12-07 1050 0.1583941 0.1591128
291 2015-12-07 1071 0.1584095 0.1589000
292 2015-12-07 1092 0.1584243 0.1588000
293 2015-12-07 1113 0.1584385 0.1585936
294 2015-12-07 1134 0.1584522 0.1584613
295 2015-12-07 1155 0.1584654 0.1583922
296 2015-12-07 1176 0.1584782 0.1582099
297 2015-12-07 1197 0.1584905 0.1581000
298 2015-12-07 1218 0.1585023 0.1580000
299 2015-12-07 1239 0.1585138 0.1579000
300 2015-12-07 1260 0.1585249 0.1577715
301 2015-12-07 1281 0.1585356 0.1577000
302 2015-12-07 1302 0.1585460 0.1576000
303 2015-12-07 1323 0.1585560 0.1575767
304 2015-12-07 1344 0.1585658 0.1575000
305 2015-12-07 1365 0.1585752 0.1574936
306 2015-12-07 1386 0.1585844 0.1574277
307 2015-12-07 1407 0.1585932 0.1573908
308 2015-12-07 1428 0.1586018 0.1573000
309 2015-12-07 1449 0.1586102 0.1572916
310 2015-12-07 1470 0.1586183 0.1572000
311 2015-12-07 1491 0.1586262 0.1571940
312 2015-12-07 1512 0.1586339 0.1571319
313 2015-12-07 1533 0.1586414 0.1571000
314 2015-12-07 1554 0.1586486 0.1571000
315 2015-12-07 1575 0.1586557 0.1572000
316 2015-12-07 1596 0.1586626 0.1572000
317 2015-12-07 1617 0.1586693 0.1572093
318 2015-12-07 1638 0.1586758 0.1572731
319 2015-12-07 1659 0.1586822 0.1573000
320 2015-12-07 1680 0.1586884 0.1573000
321 2015-12-07 1701 0.1586945 0.1573000
322 2015-12-07 1722 0.1587004 0.1573101
323 2015-12-07 1743 0.1587061 0.1574000
324 2015-12-07 1764 0.1587118 0.1574000
325 2015-12-07 1785 0.1587173 0.1574000
326 2015-12-07 1806 0.1587226 0.1574000
327 2015-12-07 1827 0.1587279 0.1574000
328 2015-12-07 1848 0.1587330 0.1574000
329 2015-12-07 1869 0.1587380 0.1574000
330 2015-12-07 1890 0.1587429 0.1574000
331 2015-12-07 1911 0.1587477 0.1574000
332 2015-12-07 1932 0.1587524 0.1574092
333 2015-12-07 1953 0.1587570 0.1574731
334 2015-12-07 1974 0.1587615 0.1575000
335 2015-12-07 1995 0.1587659 0.1575000
336 2015-12-07 2016 0.1587702 0.1575000
337 2015-12-07 2037 0.1587744 0.1575000
338 2015-12-07 2058 0.1587785 0.1575000
339 2015-12-07 2079 0.1587825 0.1575000
340 2015-12-07 2100 0.1587865 0.1575000
341 2015-12-07 2121 0.1587904 0.1575000
342 2015-12-07 2142 0.1587942 0.1575000
343 2015-12-07 2163 0.1587979 0.1575000
344 2015-12-07 2184 0.1588016 0.1575000
345 2015-12-07 2205 0.1588052 0.1575000
346 2015-12-07 2226 0.1588087 0.1575000
347 2015-12-07 2247 0.1588122 0.1575000
348 2015-12-07 2268 0.1588156 0.1575000
349 2015-12-07 2289 0.1588189 0.1575000
350 2015-12-07 2310 0.1588222 0.1575018
351 2015-12-07 2331 0.1588254 0.1575385
352 2015-12-07 2352 0.1588286 0.1575746
353 2015-12-07 2373 0.1588317 0.1576190
354 2015-12-07 2394 0.1588347 0.1576846
355 2015-12-07 2415 0.1588377 0.1577000
356 2015-12-07 2436 0.1588406 0.1577000
357 2015-12-07 2457 0.1588435 0.1577000
358 2015-12-07 2478 0.1588464 0.1577131
359 2015-12-07 2499 0.1588492 0.1578000
360 2015-12-07 2520 0.1588519 0.1578000
361 2015-12-08 21 0.1418127 0.1419048
362 2015-12-08 42 0.1420864 0.1429000
363 2015-12-08 63 0.1464147 0.1446142
364 2015-12-08 84 0.1494089 0.1465071
365 2015-12-08 105 0.1513357 0.1483599
366 2015-12-08 126 0.1526393 0.1501925
367 2015-12-08 147 0.1535730 0.1517595
368 2015-12-08 168 0.1542737 0.1534194
369 2015-12-08 189 0.1548187 0.1547000
370 2015-12-08 210 0.1552547 0.1557739
371 2015-12-08 231 0.1556115 0.1566678
372 2015-12-08 252 0.1559088 0.1573265
373 2015-12-08 273 0.1561603 0.1579527
374 2015-12-08 294 0.1563759 0.1585816
375 2015-12-08 315 0.1565628 0.1590505
376 2015-12-08 336 0.1567263 0.1595437
377 2015-12-08 357 0.1568706 0.1598891
378 2015-12-08 378 0.1569988 0.1602782
379 2015-12-08 399 0.1571136 0.1605000
380 2015-12-08 420 0.1572168 0.1606000
381 2015-12-08 441 0.1573103 0.1607000
382 2015-12-08 462 0.1573952 0.1607000
383 2015-12-08 483 0.1574728 0.1607000
384 2015-12-08 504 0.1575438 0.1607000
385 2015-12-08 525 0.1576092 0.1607000
386 2015-12-08 546 0.1576696 0.1607918
387 2015-12-08 567 0.1577255 0.1608000
388 2015-12-08 588 0.1577774 0.1608000
389 2015-12-08 609 0.1578258 0.1609000
390 2015-12-08 630 0.1578709 0.1609000
391 2015-12-08 651 0.1579131 0.1609000
392 2015-12-08 672 0.1579526 0.1608000
393 2015-12-08 693 0.1579898 0.1608000
394 2015-12-08 714 0.1580247 0.1607000
395 2015-12-08 735 0.1580577 0.1607000
396 2015-12-08 756 0.1580889 0.1606267
397 2015-12-08 777 0.1581183 0.1606000
398 2015-12-08 798 0.1581462 0.1605051
399 2015-12-08 819 0.1581727 0.1604000
400 2015-12-08 840 0.1581979 0.1603816
401 2015-12-08 861 0.1582218 0.1602903
402 2015-12-08 882 0.1582446 0.1602243
403 2015-12-08 903 0.1582663 0.1600733
404 2015-12-08 924 0.1582871 0.1598907
405 2015-12-08 945 0.1583069 0.1597000
406 2015-12-08 966 0.1583258 0.1595000
407 2015-12-08 987 0.1583440 0.1593170
408 2015-12-08 1008 0.1583614 0.1591760
409 2015-12-08 1029 0.1583781 0.1590000
410 2015-12-08 1050 0.1583941 0.1589085
411 2015-12-08 1071 0.1584095 0.1587916
412 2015-12-08 1092 0.1584243 0.1585949
413 2015-12-08 1113 0.1584385 0.1584872
414 2015-12-08 1134 0.1584522 0.1583551
415 2015-12-08 1155 0.1584654 0.1582845
416 2015-12-08 1176 0.1584782 0.1582000
417 2015-12-08 1197 0.1584905 0.1580916
418 2015-12-08 1218 0.1585023 0.1579944
419 2015-12-08 1239 0.1585138 0.1578938
420 2015-12-08 1260 0.1585249 0.1577655
421 2015-12-08 1281 0.1585356 0.1577000
422 2015-12-08 1302 0.1585460 0.1577000
423 2015-12-08 1323 0.1585560 0.1576690
424 2015-12-08 1344 0.1585658 0.1576000
425 2015-12-08 1365 0.1585752 0.1576000
426 2015-12-08 1386 0.1585844 0.1576000
427 2015-12-08 1407 0.1585932 0.1576000
428 2015-12-08 1428 0.1586018 0.1575832
429 2015-12-08 1449 0.1586102 0.1575000
430 2015-12-08 1470 0.1586183 0.1575000
431 2015-12-08 1491 0.1586262 0.1575000
432 2015-12-08 1512 0.1586339 0.1575000
433 2015-12-08 1533 0.1586414 0.1575000
434 2015-12-08 1554 0.1586486 0.1574944
435 2015-12-08 1575 0.1586557 0.1574000
436 2015-12-08 1596 0.1586626 0.1574000
437 2015-12-08 1617 0.1586693 0.1574000
438 2015-12-08 1638 0.1586758 0.1574000
439 2015-12-08 1659 0.1586822 0.1574000
440 2015-12-08 1680 0.1586884 0.1574000
441 2015-12-08 1701 0.1586945 0.1573832
442 2015-12-08 1722 0.1587004 0.1573000
443 2015-12-08 1743 0.1587061 0.1573000
444 2015-12-08 1764 0.1587118 0.1573000
445 2015-12-08 1785 0.1587173 0.1573000
446 2015-12-08 1806 0.1587226 0.1573000
447 2015-12-08 1827 0.1587279 0.1573000
448 2015-12-08 1848 0.1587330 0.1572832
449 2015-12-08 1869 0.1587380 0.1572000
450 2015-12-08 1890 0.1587429 0.1572000
451 2015-12-08 1911 0.1587477 0.1572000
452 2015-12-08 1932 0.1587524 0.1572000
453 2015-12-08 1953 0.1587570 0.1572000
454 2015-12-08 1974 0.1587615 0.1572000
455 2015-12-08 1995 0.1587659 0.1571869
456 2015-12-08 2016 0.1587702 0.1571191
457 2015-12-08 2037 0.1587744 0.1571000
458 2015-12-08 2058 0.1587785 0.1571000
459 2015-12-08 2079 0.1587825 0.1571000
460 2015-12-08 2100 0.1587865 0.1571000
461 2015-12-08 2121 0.1587904 0.1571000
462 2015-12-08 2142 0.1587942 0.1571000
463 2015-12-08 2163 0.1587979 0.1570481
464 2015-12-08 2184 0.1588016 0.1570000
465 2015-12-08 2205 0.1588052 0.1570000
466 2015-12-08 2226 0.1588087 0.1570000
467 2015-12-08 2247 0.1588122 0.1570000
468 2015-12-08 2268 0.1588156 0.1570000
469 2015-12-08 2289 0.1588189 0.1570000
470 2015-12-08 2310 0.1588222 0.1570000
471 2015-12-08 2331 0.1588254 0.1570000
472 2015-12-08 2352 0.1588286 0.1570000
473 2015-12-08 2373 0.1588317 0.1570000
474 2015-12-08 2394 0.1588347 0.1570000
475 2015-12-08 2415 0.1588377 0.1570000
476 2015-12-08 2436 0.1588406 0.1570000
477 2015-12-08 2457 0.1588435 0.1570000
478 2015-12-08 2478 0.1588464 0.1570000
479 2015-12-08 2499 0.1588492 0.1570000
480 2015-12-08 2520 0.1588519 0.1570000
481 2015-12-09 21 0.1418127 0.1419000
482 2015-12-09 42 0.1420864 0.1429698
483 2015-12-09 63 0.1464147 0.1447095
484 2015-12-09 84 0.1494089 0.1464277
485 2015-12-09 105 0.1513357 0.1482057
...
22437 2015-12-21 2457 0.1660790 0.1639335
22438 2015-12-21 2478 0.1660834 0.1639000
22439 2015-12-21 2499 0.1660878 0.1638653
22440 2015-12-21 2520 0.1660921 0.1638000
...
I'm trying to make a 'for' or a function that gives me line graphs for EACH day. But this very complicated as im begginer in R.
What I got so far was plot the graph of the columns 'estimatedRate' and 'Future' together.
ggplot(data=df, aes(x=df$m, y=df$DiFuturo, colour=ind))+
xlab('VĂ©rtices') + ylab('Taxas')+
theme(legend.title=element_blank(), legend.position='top') +
ggtitle('Curvas de DI1')+
geom_point()+ geom_line()+
geom_point(aes(x=df$m,y = df$estimatedRate,colour=ind)) +
geom_point(y = df$estimatedRate, color="black")+
geom_line(y = df$estimatedRate, color="blue")+
theme(axis.text = element_text(size = 12,colour="black"),axis.text.x=element_text(angle = 45))
But I would like separated line graphs. In the end I would end up with 11 charts.
Could you give me a hint?
I am not sure if I understand correctly but I hope it will help.
I took a subset of your dataset
df <- structure(list(ind = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L), .Label = "2015-12-07", class = "factor"), m = c(21L,
42L, 63L, 21L, 42L, 63L, 21L, 42L, 63L), estimatedRate = c(0.1418127,
0.1420864, 0.1464147, 0.1494089, 0.1513357, 0.1526393, 0.153573,
0.1542737, 0.1548187), Future = c(0.141773, 0.1427, 0.1445127,
0.1463107, 0.1480558, 0.1499211, 0.1514676, 0.1531931, 0.154467
), Blocks = structure(c(1L, 2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L), class = "factor", .Label = c("A",
"B", "C"))), .Names = c("ind", "m", "estimatedRate", "Future",
"Blocks"), row.names = c("1", "2", "3", "4", "5", "6", "7", "8",
"9"), class = "data.frame")
a create a new column for block
x <- factor(LETTERS[1:3]); names(x) <- letters[1:3]
df$Blocks <- rep(x, each=3)
df
and then plot
ggplot(data=df, aes(x=m, y=Future, colour=Blocks))+
xlab('VĂ©rtices') + ylab('Taxas')+
theme(legend.title=element_blank(), legend.position='top') +
ggtitle('Curvas de DI1')+
geom_point()+ geom_line()+
geom_point(aes(x=m, y = estimatedRate,colour=ind)) +
geom_point(y = df$estimatedRate, color="black")+
geom_line(y = df$estimatedRate, color="blue")+
theme(axis.text = element_text(size = 12,colour="black"),axis.text.x=element_text(angle = 45)) + facet_grid(Blocks~.)
it gives

Waves argument in geeglm of geepack in R causes failure

I am trying to calculate a GEE-model in the R package "geepack". The response variable is proportional, coded as (Successes, Failures). The explanatory variables are Weight(cont), Rank(cont), ColonySize(cont) and Sex(factor). The data set contains temporal non-independence of observations because over a study period of 413 days repeated behavioral measurements of the same individuals where taken. This non-independence is reflected in a column specifying the AnimalID and the day of observation (Ndate). The data set is not very large and contains 1062 observations on 165 different individuals. The complete study period is 413 days (i.e. Ndate range:1-413).
gee1<-geeglm(wl~WeightScaled+Rank+ColonySize+Sex,
data=allsub, family=binomial, id=AnimalID,
corstr="ar1")
The above model is calculated without difficulties and without noticeable delay. However, the observations are not regularly distributed over the study period (see the complete vector for Ndate below) which means the model output is not meaningful. When I include the waves argument in the model to correctly account for temporal auto-correlation R seems to get stuck or takes very long to calculate this model which should really not take so much time. What happens is that R-Gui displays "(not responding)" for more than 1 hour and the small circle (Win7) indicates that R is busy. The CPU-usage according to the task manager is mostly between 25-30%, sometimes up to 50%. So my question is: Did I make a mistake when specifying the "waves" function which cause R to hang itself or is it normal for this process to be computational very intense? (see an extract of the variable Ndate below)
Model including the waves argument:
gee1<-geeglm(wl~Weight+Rank+ColonySize+Sex,
data=allsub, family=binomial, id=AnimalID,
corstr="ar1", waves=Ndate)
The second question is more fundamental with regards to this GEE and its autocorrelation structure: Is the model able to deal with this kind of temporal autocorrelation where repeated observations of one individual are typically 5-15 but time in between varies largely (sometimes only a few days, but sometimes up to 100 days or more). Textbook examples all look very different but as I see it the principle should be the same.
Thanks very much.
> allsub$Ndate
[1] 169 169 169 43 43 5 5 5 267 267 267 267 162 162 162 162 162 256
[19] 256 256 256 256 256 263 263 263 263 263 263 176 176 176 176 176 176 183
[37] 183 183 183 183 183 190 190 190 190 190 190 190 196 196 196 196 196 196
[55] 196 284 284 284 284 291 291 291 291 175 175 175 175 175 175 175 175 199
[73] 199 199 199 199 199 199 186 186 186 186 186 186 189 189 189 189 189 189
[91] 266 266 266 266 266 266 196 196 196 196 196 196 196 242 242 242 242 242
[109] 242 207 207 207 207 207 210 210 210 210 210 245 245 245 245 245 245 302
[127] 302 302 302 302 302 302 302 217 217 217 217 217 217 217 270 270 270 272
[145] 272 272 291 291 291 220 220 220 220 220 220 220 238 238 238 238 238 238
[757] 291 291 291 291 291 291 220 220 238 238 241 241 294 294 294 294 294 294
[775] 303 303 303 263 263 263 263 263 263 263 263 263 263 316 316 309 304 304
[793] 304 323 323 19 50 99 67 67 67 22 22 22 43 60 110 178 178 178
[811] 33 115 115 115 115 96 116 116 116 116 116 116 116 116 116 116 116 26
[829] 26 122 122 122 122 122 122 122 122 122 64 40 40 40 40 40 40 40
[847] 40 40 58 58 58 58 58 58 58 58 58 58 71 71 75 85 127 78
[865] 78 12 12 12 12 12 12 12 12 12 12 15 152 152 152 152 337 337
[883] 337 337 337 337 344 344 344 344 344 344 344 82 82 82 82 82 82 82
[901] 82 82 348 348 348 348 348 348 348 348 348 351 351 351 359 359 355 355
[919] 355 354 354 345 345 345 358 358 358 358 362 362 362 331 331 349 349 361
[937] 361 378 364 364 364 369 369 369 375 375 375 373 373 373 373 342 365 365
[955] 365 365 365 365 365 365 379 379 379 379 379 379 379 379 379 379 379 379
[973] 379 379 352 352 341 382 382 382 385 373 373 373 373 373 373 368 368 368
[991] 389 389 389 389 285 285 285 308 308 309 309 321 322 326 329 329 329 329
[1009] 330 330 330 330 385 385 385 385 385 385 385 380 380 380 380 380 380 380
[1027] 386 386 386 386 390 390 390 390 365 365 393 393 393 393 393 393 393 393
[1045] 393 393 393 393 393 393 399 397 397 397 392 392 392 392 407 407 400 400
[1063] 413 413
I founds out why R crashes when including the waves argument. GEEglm does not accept two observations on the same individual conducted on the same day. This makes sense when thinking through what the model does. Hope this may help someone else.

Resources