I don't know how to read the output when using ranef against the output of gamm in the mgcv package - r

id:268 levels
group:10 levels
Fitted a mixed-effects model using gamm in the mgcv package. Fitted a generalized additive model for age and bmi, but could not read the output of the random effect using ranef
model:
ilrgamm1 <-gamm(y~z1+z2+z3+s(age)+sex+s(bmi)+time,random=list(id=~1+time,group=~1),data=data,method = "REML")
At this time, there are mysterious things like g and g.0 in the output of ranef
names(ranef(ilrgamm1$lme))
[1] "g" "g.0" "id" "group"
ranef(ilrgamm1$lme)[1:2]
$g
Xr1 Xr2 Xr3 Xr4 Xr5 Xr6 Xr7 Xr8
1 0.1130164 0.6108163 -0.1332607 0.4076337 -0.04366085 2.503919 -0.9792176 -0.5911858
$g.0
Xr.01 Xr.02 Xr.03 Xr.04 Xr.05 Xr.06 Xr.07 Xr.08
1/1 0.1983299 0.2758039 -1.100218 -0.4742126 -0.5449821 1.477916 -0.6329114 1.053759
What is Xr1 or Xr2?
Furthermore, there are 268 random effects in group, not 10.
$group
(Intercept)
1/1/102/1 0.0172579674
1/1/103/1 0.0201196786
1/1/104/1 -0.0281116571
1/1/105/1 -0.0217217446
1/1/106/1 0.0124654493
1/1/108/1 -0.0282589006
1/1/109/1 -0.0499878886
1/1/110/1 0.0492600500
1/1/111/1 0.0507119068
1/1/113/1 0.0546332994
1/1/114/1 0.0393550975
1/1/115/1 -0.0148861329
1/1/116/1 0.0375339571
1/1/117/1 0.0148069805
1/1/118/1 -0.0351320894
1/1/119/1 -0.1195068445
1/1/120/1 -0.1160370216
1/1/121/1 0.0473366382
1/1/122/1 -0.0111156856
1/1/123/1 0.0076577605
1/1/124/1 -0.0042122818
1/1/125/1 0.0249031339
1/1/126/1 -0.1207996724
1/1/127/1 0.0275137051
1/1/128/1 -0.0004621387
1/1/130/1 -0.0080189325
1/1/132/1 -0.0147162203
1/1/133/1 0.0019108355
1/1/134/1 0.0048134559
1/1/135/1 -0.0275929191
1/1/136/1 0.0024070977
1/1/138/1 -0.0364971159
1/1/139/1 -0.0250644476
1/1/140/1 -0.0161684667
1/1/143/1 0.0097684438
1/1/144/1 -0.0254024942
1/1/145/1 -0.0308170535
1/1/146/1 -0.0314913020
1/1/147/1 0.0047849092
1/1/148/1 0.0398563674
1/1/149/1 -0.0328543231
1/1/201/2 -0.0386289339
1/1/202/2 -0.0164038050
1/1/203/2 -0.0310222871
1/1/204/2 -0.0465893084
1/1/206/2 -0.0639166021
1/1/207/2 0.0178124681
1/1/208/2 -0.0215777533
1/1/209/2 -0.0008097909
1/1/211/2 -0.0276369553
1/1/218/2 -0.0233586483
1/1/219/2 -0.0381510950
1/1/220/2 -0.0245044572
1/1/221/2 0.0257439303
1/1/222/2 -0.0526194229
1/1/223/2 -0.0598638388
1/1/224/2 -0.0564427102
1/1/226/2 -0.0682312455
1/1/227/2 0.0025178471
1/1/228/2 0.0050413163
1/1/229/2 0.0006566180
1/1/230/2 -0.0394159991
1/1/233/2 -0.0339136266
1/1/234/2 -0.0355879691
1/1/235/2 0.0264388355
1/1/236/2 -0.0190059575
1/1/237/2 -0.0466046545
1/1/238/2 -0.0103843873
1/1/239/2 0.0030630609
1/1/242/2 -0.0385347399
1/1/246/2 -0.0233604289
1/1/247/2 -0.0549077802
1/1/249/2 -0.0309410264
1/1/250/2 -0.0138412118
1/1/251/2 -0.0236995292
1/1/252/2 -0.0263367786
1/1/253/2 -0.0158340565
1/1/254/2 -0.0003306973
1/1/255/2 -0.0106150344
1/1/256/2 -0.0223922258
1/1/258/2 0.0042958519
1/1/301/3 0.1100838962
1/1/302/3 0.0240153141
1/1/303/3 0.0403893185
1/1/306/3 0.0483381436
1/1/307/3 -0.0129870303
1/1/309/3 0.0173975588
1/1/310/3 -0.0189250961
1/1/313/3 0.0357035256
1/1/315/3 0.0012214394
1/1/316/3 0.0325373842
1/1/317/3 -0.0085589305
1/1/319/3 0.0524899049
1/1/321/3 0.0416124283
1/1/322/3 0.0095534385
1/1/325/3 0.0321591953
1/1/326/3 -0.0054073693
1/1/327/3 0.0050364482
1/1/328/3 0.0531385640
1/1/331/3 0.0232251446
1/1/332/3 0.0189221949
1/1/333/3 -0.0181158192
1/1/334/3 -0.0359340965
1/1/335/3 0.0083524511
1/1/336/3 -0.0118781160
1/1/337/3 -0.0085829648
1/1/338/3 0.0095829746
1/1/401/4 -0.0512378233
1/1/402/4 -0.0219261499
1/1/403/4 -0.0160446585
1/1/407/4 0.0017872369
1/1/408/4 -0.0371254332
1/1/409/4 0.0303154843
1/1/411/4 -0.0026150821
1/1/412/4 0.1418719283
1/1/414/4 -0.0556019328
1/1/415/4 0.0073027068
1/1/416/4 -0.0122557311
1/1/417/4 0.0367134933
1/1/418/4 -0.0253763258
1/1/419/4 -0.0203686506
1/1/421/4 -0.0187932155
1/1/422/4 -0.0189659510
1/1/423/4 -0.0306159126
1/1/424/4 0.0273308724
1/1/425/4 0.0040657657
1/1/426/4 0.0312199779
1/1/429/4 0.0036135869
1/1/430/4 -0.0256442792
1/1/433/4 0.0438767257
1/1/434/4 0.0150299855
1/1/435/4 -0.0058240553
1/1/436/4 0.0028309330
1/1/437/4 -0.0023443246
1/1/438/4 0.0115472464
1/1/439/4 -0.0071635162
1/1/441/4 -0.0187692003
1/1/442/4 -0.0301687031
1/1/443/4 -0.0054707553
1/1/501/5 0.0233900218
1/1/502/5 0.0270437356
1/1/503/5 -0.0505494678
1/1/504/5 -0.0555547708
1/1/506/5 -0.0232974224
1/1/508/5 -0.0316901016
1/1/510/5 0.0498275109
1/1/511/5 0.0140125034
1/1/513/5 -0.1284098189
1/1/514/5 0.0336408919
1/1/515/5 -0.0328592365
1/1/516/5 -0.0264024730
1/1/601/6 -0.0064048726
1/1/602/6 0.0136098007
1/1/603/6 0.0437196138
1/1/604/6 0.0685239133
1/1/605/6 -0.0141230573
1/1/606/6 0.0555226687
1/1/607/6 -0.0411745650
1/1/608/6 0.0219745785
1/1/609/6 -0.0045706685
1/1/610/6 -0.0176662070
1/1/611/6 0.0408741543
1/1/612/6 0.0187626096
1/1/613/6 0.0561545743
1/1/614/6 0.0284241671
1/1/615/6 0.0157012751
1/1/616/6 0.0496079608
1/1/701/7 -0.0398327297
1/1/702/7 -0.0140910866
1/1/705/7 0.0286548362
1/1/706/7 0.0369761615
1/1/708/7 0.0116733825
1/1/709/7 0.0001330362
1/1/710/7 0.0274371733
1/1/711/7 0.0090225922
1/1/712/7 0.0765875063
1/1/713/7 0.0148952419
1/1/714/7 -0.0054933850
1/1/716/7 0.0043641233
1/1/717/7 -0.0119174808
1/1/719/7 0.0010953154
1/1/723/7 -0.0371240564
1/1/801/8 0.0636698316
1/1/803/8 0.0246677751
1/1/804/8 -0.0445965919
1/1/806/8 -0.0289816619
1/1/807/8 0.0076561215
1/1/808/8 0.0237686430
1/1/809/8 0.0450896739
1/1/810/8 0.0149585857
1/1/811/8 0.0075693911
1/1/812/8 0.0085475577
1/1/813/8 -0.0136763527
1/1/814/8 0.0117384418
1/1/815/8 0.0067855948
1/1/816/8 0.0140344652
1/1/817/8 0.0103800524
1/1/818/8 -0.0361848876
1/1/819/8 0.0449431626
1/1/820/8 -0.0092320086
1/1/822/8 -0.0404730405
1/1/823/8 -0.0494073578
1/1/824/8 -0.0029941736
1/1/825/8 -0.0145742585
1/1/826/8 -0.0314564014
1/1/828/8 0.0183565957
1/1/829/8 0.0288121410
1/1/830/8 0.0286684412
1/1/831/8 0.0059331890
1/1/832/8 0.0341139486
1/1/833/8 0.0386864016
1/1/834/8 0.0147205534
1/1/835/8 -0.0031409478
1/1/901/9 0.0660687434
1/1/902/9 0.0564001190
1/1/903/9 0.0756466936
1/1/904/9 0.0096398307
1/1/905/9 0.0221015690
1/1/906/9 0.0046220720
1/1/907/9 0.0412366347
1/1/908/9 0.0284303878
1/1/909/9 0.0452359853
1/1/910/9 -0.0195940019
1/1/911/9 -0.0154676475
1/1/912/9 0.0184574647
1/1/913/9 0.0460445032
1/1/914/9 -0.0067133484
1/1/915/9 -0.0087355534
1/1/916/9 -0.0043938763
1/1/917/9 -0.0470434649
1/1/919/9 0.0794927553
1/1/920/9 0.0555903561
1/1/921/9 -0.0036186615
1/1/922/9 0.0078238313
1/1/923/9 0.0143975055
1/1/924/9 0.0731162776
1/1/925/9 -0.0065668921
1/1/926/9 0.0549429919
1/1/927/9 0.0368946293
1/1/928/9 0.0247474240
1/1/929/9 -0.0404517417
1/1/930/9 -0.0076552298
1/1/1001/10 0.0117082112
1/1/1002/10 0.0068444544
1/1/1003/10 0.0327977955
1/1/1004/10 0.0071551344
1/1/1005/10 -0.0052717304
1/1/1006/10 0.0483668189
1/1/1007/10 -0.0167403419
1/1/1008/10 -0.0364566907
1/1/1009/10 -0.0254350538
1/1/1010/10 0.0504571167
1/1/1011/10 -0.0039537094
1/1/1012/10 -0.0054692797
1/1/1013/10 0.0224140597
1/1/1014/10 -0.0310392331
1/1/1015/10 -0.0498130767
1/1/1016/10 -0.0223939677
1/1/1017/10 0.0041103780
1/1/1018/10 0.0880528857
1/1/1019/10 -0.0467056887
1/1/1022/10 -0.0769873686
1/1/1025/10 -0.0229126779
1/1/1028/10 -0.0340772236
1/1/1029/10 -0.0251866535
1/1/1030/10 0.0307034344
1/1/1031/10 -0.0369165146
1/1/1035/10 -0.0056637857
Why not 10 types, which is the number of levels in group?

Is there a reason you're using gamm() instead of gam()? Also, why list time as both a fixed and random effect?
If there aren't reasons for these choices, then one possible solution could be to fit your model as ilrgamm1 <- gam(y~z1+z2+z3+s(age)+sex+s(bmi)+s(time, bs="re"), data=data, method = "REML") - the s(time, bs="re") is indicating that time is a random effect.
Then you can use summary(ilrgamm1) to look at your results, and partial effects plots in plot.gam() or with ggpredict to visualize trends in your smoothed variables.

Related

Fitting distributions with R

Good afternoon. I have a vector 'a' containing 16000 values. I get the descriptive statistics with the help of the following:
library(pastecs)
library(timeDate)
stat.desc(a)
skewness(a)
kurtosis(a)
Especially skewness=-0.5012, kurtosis=420.8073 (1)
Then I build a histogram of my empirical data:
hist(a, col="lightblue", breaks = 140, border="white", main="",
xlab="Value",xlim=c(-0.001,0.001))
After this I try to fit a theoretical distribution to my empirical data. I choose Variance-Gamma distribution and try to get its parameter estimates on my data:
library(VarianceGammma)
a_VG<-vgFit(a)
The parameter estimates are the following:
vgC=-11.7485, sigma=0.4446, theta=11.7193, nu=0.1186 (2)
Further, I create a sample from the Variance-Gamma distribution with the parameters from (2)
and build a histogram of created theoretical values:
VG<-rvg(length(a),vgC=-11.7485,sigma=0.4446,theta=11.7193,nu=0.1186)
hist(VG,breaks=140,col="orange",main="",xlab="Value")
Bu the second histogram differs absolutely from the first (empirical) histogram. Moreover, it is built on the basis of the parameters (2), which I got on the empirical data.
What's wrong with my code? How can I fix it?
P.S. When I type dput(a[abs(a) > 5e-4]) I get:
c(0.000801110480004752, 0.000588162271316861, 0.000555169128569233,
0.000502563410256229, 0.000854633994686438, 0.00593622112246628,
-0.000506168123513007, -0.000502909585836875, 0.000720924373137422,
0.00119141739181039, 0.000548159382141478, -0.000516511318695123,
-0.000744590777740584, 0.000595213912401249, 0.000514055190913965,
-0.000589061375421807, -0.00175392114572581, 0.000745548313668465,
-0.00075910234096277, -0.00059987613053103, 0.000583568488865538,
0.00426484136013094, 0.000610760059768012, 0.000575522836335551,
0.000823785810599276, 0.00181936036509178, -0.00073316272551871,
-0.00184238143420679, -0.000519146793923397, -0.00120324664043103,
-0.000882469414168696, -0.00148118339830283, 0.000929612782487155,
0.000565364610238817, 0.000578158613453894, 0.00060479145432879,
-0.00520576206828594, 0.000708404040882016, 0.00105224485893451,
0.000636486872540587, -0.00359655507585543, 0.000769164650506582,
0.000635701125126786, 0.000570489501935612, -0.000641260260277221,
0.000735092947873994, 0.000757195823062773, 0.000556002742616357,
-0.00207489740356159, -0.000553386431560554, 0.000511326871983186,
0.000504591469525195, -0.000749886905655472, -0.0013939718643865,
-0.000513742626250036, -0.00105021597423516, -0.00156667292147716,
0.000864563166150134, 0.00433724128055069, 0.00053855648931922,
-0.00150732363190365, 0.00052621785349416, 0.000987781100809215,
0.000560725818171903, 0.00176012436713435, -0.000594895431092368,
-0.000686229580335151, 0.00138682284509528, -0.000531964338888358,
-0.00179959148771403, 0.000574543871314503, -0.000686996216439084,
-0.000559043343629995, 0.00055881173674166, -0.000636332688477736,
-0.000623778186703561, -0.00173834148094443, -0.000567224129968125,
-0.00122578683434504, 0.00130960156515414, -0.000548203197176633,
-0.000522749285863711, -0.000820371086264871, 0.000756014225812507,
-0.000714081490558627, -0.000617600335221624, 0.000523639760748651,
-0.000578502663833191, 0.00107478825239227, 0.000612725356974764,
-0.00065509337422931, 0.000505887803587513, -0.000566716376848575,
0.000511727090058756, 0.000572807738912218, -0.000756026937699161,
0.000547948751494332, 0.000628323894238392, -0.000541350489317693,
-0.00133529454372372, -0.000590618859845904, -0.000700581963648972,
0.000735987224462775, 0.000528958898682319, 0.000838250041022448,
-0.000519084424130511, -0.00052258402856431, -0.000538130765869838,
-0.000631819887885854, 0.00054800880764283, 0.00266115500510899,
-0.000839092093771754, 0.000559253571783103, -0.000801028189803432,
-0.000608879021022801, -0.000538018076854385, -0.000689859734395171,
0.00329650346269972, 0.000765494493951024, -0.000689450477848297,
-0.000560199139975737, 0.00159082699266122, -0.00208548663121455,
-0.000598493596793759, 0.000563544422691464, 0.000626996183768824,
-0.000653166846808162, -0.000851350174739807, -0.00140687473245116,
-0.000887003220306326, -0.000765614651347946, -0.00100676206277761,
0.000724714394852555, 0.00108872127644233, -0.000678558537305918,
-0.000705087556212902, 0.000544828152248655, -0.000791700964308362,
0.000606125736727137, -0.00119335967326073, 0.00075413211796338,
0.000526038939010931, 0.00086543737231537, -0.000817788712950573,
-0.000584070926663571, 0.000619657281937691, 0.000680783312420274,
-0.000513831718574664, -0.00050972403875349, -0.00114542220685365,
-0.00070564389723593, -0.01057964950882, -0.000610357922434801,
0.000818264221596365, 0.000940825400308043, -0.000726555639413817,
-0.000591089505560305, 0.000564738888193972, -0.00068515060569041,
0.000668920238348747, -0.00110103375121717, -0.0015480433031172,
0.000663030855223568, 0.000500097431997304, -0.000600730311271391,
-0.000672397772962796, -0.000607852365856587, 0.000536711920570809,
0.000595055206488837, 0.000523123873687581, 0.000977280737528119,
0.000616410821629998, 0.000788593666889881, -0.000671642905915704,
0.000717328711735021, -0.000551853104219902, -0.000565153434708421,
-0.000802585212152707, 0.000536342062561701, 0.000682048510343591,
-0.000541902545439399, 0.000779676683974273, 0.000698841439971787,
0.000559313965908359, -0.00064986819016255, 0.000795421518319017,
0.00364973919549527, 0.000669658692276087, 0.00109045476974678,
0.000514411572742901, 0.000503832507211754, -0.000507376233564116,
0.001232871590787, 0.000561820312542594, -0.000501190337518054,
-0.000769036505996468, -0.000695537959007453, -0.000572065848166048,
-0.00167929926328192, 0.000597078186826749, 0.00710238430870014,
0.000745192112519888, -0.00116091022028009, -0.000791139281769659,
-0.00148898466632552, 0.000565144038962018, -0.000514019821833855,
-0.00148427996685285, -0.000822717245339888, -0.00062922111212238,
-0.000636011367371125, 0.00119640327632808, 0.000548455410294579,
0.000652678152560426, 0.000509244387833618, 0.000961872348987924,
0.000662064072514568, -0.00068116858054168, -0.000569930302445343,
0.00188358126928101, 0.00130560555273895, 0.000593470885775105,
0.00160093110088155, 0.000785262438315115, -0.000912313442922752,
0.000609996052359563, 0.000720137994393966, 0.000568163899000496,
0.00128685533068307, -0.000756787473447318, 0.000765932134255465,
0.00064884753100003, 0.000687571386270847, -0.000582094290400903,
-0.000693177295971736, -0.000601776208094762, 0.000503616387996786,
-0.000615095866544735, -0.000799593899689199, 0.000773750859128342,
-0.000522576090260074, 0.000503578107212022, -0.00104492224837571,
0.000547928732299141, 0.00310304337507183, 0.000893382870797765,
-0.000577792878910799, -0.000647710366578735, -0.00061992948706191,
0.000825702487162516, 0.000606579510524341, 0.000552792484727505,
0.000688600840895504, 0.000505093563534231, -0.000728420573667066,
-0.00157924525963438, -0.000603846616019865, -0.000521941317177976,
0.00150498158245682, -0.000584572670337735, 0.000713757870583365,
0.000524287801789924, 0.00107217649464886, 0.00213147531822244,
0.000566012832157625, -0.00069828890607937, 0.000641567963736378,
-0.000509531713644762, -0.000547564140049417, -0.00115275240244728,
0.000560465768010943, -0.000651807371497171, -0.00096487058986483,
0.000753687665266511, -0.000665599418910645, -0.000691278087025182,
-0.000578010050725553, -0.000685833148198256, 0.000698470819832764,
0.00102943368139208, -0.000725840586788706, 0.00125882415960632,
-0.000630791474954151, -0.000764813558678412, -0.000638539347184164,
0.000654486496518558, 0.000547453642294471, 0.000572020020495501,
-0.000605791001705214, 0.00660211658324172, 0.00114928683282756,
0.000985676480677711, -0.000694668292547718, -0.000528955637964401,
0.000647975568638159, 0.00116454536417443, 0.000506748841724303,
-0.000500925156604382, -0.000567015088082101, 0.00128711230206946,
0.000533633762033858, 0.00505991432758357, 0.000518058378462527,
-0.000592822519784875, 0.00177414999018666, 0.00059845426944527,
-0.000511614433724716, 0.0016614697907098, 0.000852196464322219,
0.00241689725305427, -0.000614317948913978, -0.000729717143318709,
-0.000612900648802039, -0.000727983564232204, -0.000694965869158182,
-0.000527752006066251, -0.000584233784708843, 0.000522097476268968,
0.000543092880677776, 0.000947121210698398, -0.00241810275096377,
0.00181893137435019, 0.000931873879297385, 0.000512116215015013,
0.000724985702444059, -0.000566713495050664, 0.000603953591362227
)
After fitting the data look like the following (empirical histogram-blue, theoretical histogram-orange):
The same when include freq=FALSE in hist
This will all be due to anomalous values in a not represented by the histogram you've shown. This could be the cause of both the very high kurtotsis, and the vgFit() algorithm failing to find a good fit.
Type dput(a[abs(a) > 5e-4]) in the console and copy the output into your question. People then may be able to recreate aomething like the vector a without having to get all 16000 values and debug the vgFit issue.
Thanks for the extra data. There are some extreme values in there, but I don;t think those are what is causing the problem in vgFit. Fitting 4 parameters which can be almost any value is difficult, but you can help it along by rescaling your data to something typical. Try this:
b <- (a-mean(a))/sd(a)
vgf <- vgFit(b)
vgf$param
VG <- rvg(16000, param = vgf$param)
VG_rescaled <- VG*sd(a)+mean(a)
hist(VG_rescaled, breaks=140, col="orange", main="", xlab="Value")
and see if the two histograms are close enough now.

How to solve Warning in log(z) : NaNs produced in R?

I try to run K-S test simulation with different data and with GEV distribution but I get 50 warnings of Warning in log(z): NaNs produced
This is my data t1 = 2.1466558 2.9447386 2.1410642 1.8847492 2.0233282 2.1907725 3.1755095 2.1142972 2.1889601 2.8422979 1.8555857 1.0429501 2.1383811 3.9976282 14.0612719 6.0016379 4.0426939 3.9845386 5.1821300 3.8703266 2.9009807 3.8450287 6.1019829 4.1811626 8.0737452 2.8416879 3.1656657 2.1342049 1.9984793 2.8037649 6.9629563 2.8223349 10.9695854 1.8985456 0.9444765 6.0065642 2.0394709 9.1677515 5.0589429 4.1036932 4.9599679 3.0425898 1.9477278 3.0447457 8.1563085 4.9423730 3.1336760 1.8389239 3.1262185 1.1628846 3.8445247 2.1454052 1.9209593 0.9197765 2.8171347 8.0249643 13.1267940 6.8506226 2.0811591 2.8517716 2.8864796 1.8227987 8.1442224 2.8798242 5.1112049 2.8529055 6.8265215 1.0436781 3.8380311 2.9659720 3.0153516 2.8497134 24.0545609 3.1952943 3.9564030 7.1348925 3.0067497 2.8581224 13.0294469 1.8576194 2.8081190 6.0940443 1.9729950 4.1334539 9.9874363 2.0489537 1.9479052 2.8050009 3.1097060 8.9115900 23.8376271 3.9219177 2.9991323 3.8501608 4.1910852 4.9508869 11.9260378 5.1473547 6.1864583 2.8165587 3.8589393 5.1742220 2.8812650 4.1469513 2.9816058 6.9291070 4.0086371 2.8950365 3.1368533 2.9716707 4.0936148 4.0987735 8.8792285 2.9914305 15.9832293 11.1705646 4.1691180 2.0268396 9.1313510 2.8457873 5.8162405 5.1019303 2.9493099 3.1892744 6.1027555 5.9852653 6.0070368 5.0606722 3.8827039 2.8579010 3.1809342 2.8639117 4.0446142 8.1086074 6.9708477 3.9406243 3.9113551 2.8471808 3.9408469 1.8318536 4.8696027 6.1638158 10.0075047 4.0620721 2.1995222 2.9713600 0.9827086 11.8048057 3.1639570 4.1820899 2.8913417 5.1807095 1.8735194 3.8650210 2.9308563 6.9203276 7.0470336 2.1721080 1.9304191 2.9782089 4.9717892 1.8260324 4.0094237 6.0354774 4.1934337 3.8605304 6.9868062 9.0001938 19.9510362 10.0213967 1.9980948 1.9564188 10.0595901 5.9441410 5.9212171 1.9805753 2.8141160 9.8859371 2.1912938 5.0260191 7.0394183 3.1071499 4.8651357 4.8464983 3.1653826 4.0813080 0.9293124 2.0533324 3.1302422 5.0649879 1.9045972 3.0304574 6.1638933 1.8765108 2.1042605 5.0677281 7.9328270 5.0485400 11.8101217 2.8496955 3.9641349 2.0423748 3.9535697 10.1833001 1.9963743 3.9404075 1.0794579 5.1952880 2.1310139 3.1615550 4.1934939 2.1528778 1.8080386 7.8411243 9.8299614 6.0534968 4.0174467 2.0321006 6.8884815 3.1990381 3.9448174 4.1087308 2.8989261 3.1667614 3.0734750 4.9591400 4.0537864 5.1886589 2.0860818 3.9166460 3.8028030 2.8333645 2.0257119 3.9347423 2.1057551 2.9608942 5.8546608 3.1449161 1.8630542 5.0733393 1.8331204 3.1629142 4.0929211 6.9565034 3.8253997 2.8041233 5.1246350 3.8994802 2.0389505 5.0663955 3.8854816 1.8575128 1.9655496 3.0056002 4.9812668 4.8201262
I fit the GEV to the data:
fit5 = fevd(t1, type="GEV") using the function fevd in extRemes package. I wanna do K-S test simulation but get 50 warnings at this part:
stats <- replicate(n.sims, {
r <- rgevd(n = length(t1),location=fit5$results$par["location"],
shape= fit5$results$par["shape"],
scale = fit5$results$par["scale"])
estfit.gev <- fevd(r, type = "GEV") # added to account for the estimated parameters
as.numeric(ks.test(r, "pgevd",location=estfit.gev$results$par["location"],
shape= estfit.gev$results$par["shape"],
scale = estfit.gev$results$par["scale"])$statistic)
how do I solve this Warning in log(z): NaNs produced? I tried to use absolute r value but I still get the same warnings

Bootstrap p value contradicts p value for likelihood ratio test

I have the same problem as the one posted by #soapsuds here. I did not want to ask a duplicate question but when I tried to edit the original question to provide the reproducible example that was missing in the original post my edits got rejected. Since the reproducible example has a lot of elements, I could not write it as a comment to the original question either, so I provide my code and my reproducible data here, as a separate question.
I am trying to compare two models using the likelihood ratio test. From bootstrapping I get a set of 1000 p-values. Here are the numbers I get:
chi2 <- c(41.83803376, 69.23970174, 42.5479637, 50.90208302, 39.18366824, 78.88589665, 28.88469406, 34.99980796, 85.80860848, 66.01750186, 29.06286, 46.43221576, 46.50523792, 59.87362884, 46.17274808, 77.97429928, 48.04404216, 12.88592623, 43.1883816, 33.24251471, 53.27310465, 56.92595147, 47.99838583, 46.0718587, 49.0760042, 29.70866297, 66.80696553, 66.61091741, 37.82375112, 50.19760846, 30.99961864, 27.17687828, 37.46944206, 66.36226432, 48.30737714, 43.64410333, 23.78480451, 42.52842793, 60.49309556, 46.29154, 26.96744296, 32.21561396, 48.20316788, 38.73153704, 67.80328765, 55.00664931, 36.74645735, 23.3647159, 56.35290442, 38.11055268, 58.3316501, 36.00500638, 41.36949956, 49.09067881, 64.42712507, 23.97787069, 54.5394799, 87.02114296, 26.01402166, 50.47426712, 38.58006084, 48.47626864, 22.28809699, 58.87590487, 17.59264288, 33.32650413, 67.77868338, 60.95427815, 37.19931376, 36.23280256, 53.54379697, 70.06479334, 41.3482703, 34.54099647, 55.99585144, 30.60500406, 32.02745276, 37.92670127, 44.23450124, 40.38607671, 44.02263294, 40.89874789, 62.74174279, 50.95137406, 47.12851204, 26.03848394, 36.6202765, 61.06296311, 50.17094183, 35.93242228, 41.8913277, 35.19089913, 38.88574534, 66.075866, 26.34296242, 49.99887059, 42.97123036, 34.89006324, 66.5460019, 67.61855859, 48.52166614, 41.41324193, 46.76294302, 14.87650733, 24.11661382, 62.28747719, 43.94865019, 44.20328393, 41.17756328, 43.74055584, 49.46236395, 38.59558107, 42.85073398, 49.81046036, 36.60331917, 39.85328124, 59.31376822, 61.36038822, 52.56707689, 29.19196892, 46.473958, 39.12904163, 38.75057931, 36.32493909, 49.61088785, 33.42904297, 34.73661836, 33.97736002, 37.44094284, 57.73605417, 43.14773064, 42.78707831, 26.84112684, 48.47832871, 45.94043053, 71.13563773, 46.28614795, 42.33386157, 59.31216832, 46.72946806, 47.76027545, 52.45174304, 49.99459367, 59.00971014, 24.03299408, 17.09453132, 37.44112252, 46.6352525, 60.42442286, 39.35194465, 46.57121135, 56.28622077, 59.20354176, 57.72511864, 41.97053375, 27.97077407, 29.70497125, 46.63976021, 40.24305901, 24.84335714, 36.08600444, 61.619572, 69.31377401, 86.91496878, 44.47955842, 44.1230351, 46.12514671, 43.97381958, 71.99269072, 47.01277643, 50.08167664, 27.01076954, 31.32586466, 40.96782215, 19.07024825, 53.00009679, 43.15397869, 42.49652848, 53.47325607, 43.45891027, 42.57719313, 39.40459925, 42.15077856, 52.23784844, 33.07947933, 45.02462309, 59.187763, 51.9198527, 48.3179841, 76.10501177, 34.95091433, 40.75545034, 31.27034043, 39.83209227, 47.87278051, 46.25057806, 62.84591205, 41.24656655, 68.14749236, 53.11576938, 39.20515676, 61.96116013, 35.64665684, 72.52689101, 54.64239536, 34.14169048, 34.32282338, 49.60786171, 50.32976034, 43.83560386, 57.49367366, 81.65759842, 61.59398941, 37.77960776, 30.74484476, 34.72859511, 32.46631033, 37.41725027, 34.04569722, 54.11932007, 34.62264522, 28.36753913, 30.95379445, 84.06354755, 29.32445434, 56.7720931, 33.23951864, 48.61860157, 39.3563214, 32.44713462, 61.25078174, 32.49661836, 40.38508488, 26.73565294, 58.16191656, 61.12461262, 23.701462, 22.14004554, 57.80213129, 57.15936762, 31.51238062, 44.60223083, 30.60135802, 46.96637333, 42.79517081, 56.85541543, 48.79421654, 29.72862307, 41.61735121, 43.37983393, 41.16802781, 61.69637392, 37.29991153, 39.0936012, 57.39158494, 57.55033901, 50.72878897, 34.82491685, 42.66486539, 34.54565803, 55.04161695, 44.56687339, 53.46745359, 57.22210412, 34.8578696, 28.81098073, 51.4033337, 51.9568532, 60.98717632, 62.98817996, 44.1335128, 33.38418814, 59.71059054, 45.82016411, 29.47178401, 30.64995791, 28.52106318, 53.98066153, 64.22209517, 58.29438562, 39.18280924, 38.1302144, 41.90062316, 28.68650929, 69.42769639, 33.79539164, 26.08549507, 55.29167497, 97.25975259, 63.07957724, 56.59002373, 51.40088678, 71.33491023, 46.24955174, 33.90101761, 38.0669817, 52.50993176, 51.84637529, 39.93642798, 61.9268346, 30.25561485, 49.57396856, 44.70170977, 57.00286149, 40.39009586, 63.23642634, 59.23643766, 55.80521902, 68.58421775, 24.04456631, 51.64338572, 61.14103174, 59.29371792, 46.51493959, 43.48297587, 39.99164284, 44.62589755, 58.89385062, 60.96824416, 54.02310453, 43.54420281, 44.24628098, 47.0991445, 58.9015349, 60.54157696, 34.86277089, 33.79969585, 34.57183642, 47.21383117, 55.3529805, 36.49813553, 44.94388291, 29.43134497, 43.41469037, 43.033338, 63.37329389, 38.22029171, 43.2894392, 23.42769168, 55.18117532, 19.39227876, 28.29656641, 28.56075122, 39.57260362, 65.48606054, 31.05339648, 24.87488959, 61.6027878, 59.56983406, 37.53918879, 28.67095839, 36.51499868, 44.43350204, 53.35842664, 48.30182354, 31.03494822, 45.68689659, 46.11113306, 53.89204524, 29.75548276, 35.60906482, 53.35195594, 56.28657675, 44.77245145, 60.20671942, 41.62253735, 40.34528594, 38.48551456, 27.39317425, 51.05414332, 38.41986986, 75.05074423, 34.16773046, 52.18497954, 49.63059496, 28.7365636, 10.59466471, 38.1033901, 52.20531405, 47.031987, 47.45955635, 44.64312012, 50.32229588, 62.40798968, 37.7455721, 31.97746406, 51.17250147, 45.91231295, 66.58450378, 32.68956686, 34.35845347, 70.34703042, 41.47493453, 53.67684859, 35.66735299, 19.76630329, 35.69026569, 76.57475236, 62.11269107, 37.06632602, 57.91686258, 33.95869501, 55.18034702, 66.09725866, 46.80608564, 46.75623531, 55.49605214, 45.7813294, 22.37612777, 62.40414132, 50.51745906, 46.86535062, 54.4172637, 35.44713601, 45.40918234, 43.83215257, 57.14754799, 24.20941074, 44.8145542, 50.79673435, 42.14561269, 32.73720673, 28.51047028, 32.14753623, 28.43006627, 39.50188334, 58.51806717, 37.96898151, 73.14656287, 48.23605238, 75.31273481, 29.57608972, 43.62952257, 30.47534709, 43.24927262, 43.61475563, 53.48883918, 53.85263136, 41.91477406, 56.16405384, 46.21202327, 55.52602904, 49.88481191, 46.31478116, 72.29722834, 40.48187205, 35.31368051, 40.57713079, 34.15725967, 65.85738596, 32.16093944, 32.07117679, 46.44579516, 53.3243447, 69.35531671, 21.70205174, 44.30678622, 40.13349937, 51.7431728, 43.03690121, 26.53566586, 18.74773427, 25.97768442, 66.68668827, 42.97352559, 31.61567696, 61.57362103, 55.07104736, 25.05950764, 53.04884067, 30.47176616, 43.33249885, 44.48360752, 40.59006165, 44.29759954, 69.71063388, 47.70186943, 51.12166943, 40.15048072, 44.96459746, 56.31842906, 57.79593771, 49.19795057, 33.58506451, 42.67650993, 47.96512915, 57.98722437, 42.08107371, 66.85903821, 45.30286487, 38.39187118, 48.02442004, 35.97047743, 56.71378254, 40.51082047, 43.78022461, 60.33208664, 35.78159098, 40.98937317, 36.20547787, 45.2382906, 47.81497885, 20.44519563, 16.68817267, 38.31035896, 38.60590267, 70.75756511, 31.73001452, 45.85476281, 47.11473565, 31.40248172, 42.94971714, 39.34376633, 21.09018956, 31.45915941, 53.82696054, 73.59824534, 31.5694168, 39.02189966, 46.91790827, 60.66603832, 59.81148782, 20.46813743, 54.95108785, 66.71844123, 49.48461319, 25.10459028, 60.26169536, 21.90344297, 63.56310687, 38.70295559, 58.19794152, 25.68981924, 61.4804908, 41.97067608, 22.77156359, 48.51789441, 50.31845297, 42.36456456, 43.35814281, 41.32891651, 35.17106573, 48.45296117, 30.55292595, 55.26758567, 71.25929921, 34.62580089, 43.89804598, 46.06384675, 30.74209253, 47.99143497, 34.02715801, 37.95367551, 45.14366438, 40.73655716, 45.32116105, 48.17651965, 63.54774876, 16.32237452, 54.22730144, 46.02331286, 45.44633826, 53.56976595, 53.96781286, 19.79116777, 42.05820938, 45.48852278, 37.34932167, 45.134461, 49.60637239, 29.99017683, 35.2785614, 71.54855053, 61.55744768, 55.7627296, 37.72455372, 62.51288842, 48.17063649, 65.26648616, 48.4831201, 33.49833137, 32.10986243, 15.42586026, 41.95660905, 30.07072484, 42.33604863, 53.20660203, 48.27036556, 32.92677161, 33.59521848, 44.04333058, 59.30038922, 48.84064622, 63.31815488, 36.01169023, 44.42967033, 23.14247159, 53.6314237, 42.43225997, 28.18151375, 44.0733306, 55.93530003, 30.86515779, 34.10702034, 59.38495522, 57.79906004, 64.86160093, 56.70670687, 43.24880707, 40.00049219, 44.08430336, 17.50391283, 72.81320114, 41.55481964, 63.461066, 50.81938548, 58.7427594, 35.27822458, 33.5188344, 46.13196979, 56.94022883, 66.96258461, 39.19601268, 21.95750575, 51.67252792, 46.51047909, 30.42289547, 46.47496475, 41.6440483, 42.36900563, 68.29398345, 30.14059255, 38.90124252, 40.87014585, 51.33635945, 51.72908337, 50.8177621, 31.65411733, 56.75197699, 47.76885318, 34.18305356, 52.52137441, 48.39806899, 18.34609209, 32.5461584, 60.15104883, 36.29250847, 39.02418361, 34.68801402, 48.02453889, 31.36738248, 42.44522981, 71.79176852, 34.25588794, 38.46866138, 45.01393624, 63.38509325, 32.44823195, 64.59346474, 53.80793998, 41.2889141, 28.86534461, 34.85039051, 37.04622686, 31.83207726, 36.65410743, 27.66293315, 23.11203257, 41.61059067, 19.97321534, 59.879676, 39.84187157, 47.324581, 38.24903991, 41.0234849, 62.30809429, 48.47191326, 23.26696808, 29.91547934, 78.39181209, 41.86240014, 33.53717515, 39.63756903, 74.86377649, 56.30173648, 40.29403413, 59.12602764, 47.23561802, 51.32370456, 45.44426051, 55.54666292, 58.85362888, 38.30516953, 46.11300177, 37.96931091, 41.01315149, 63.09345867, 26.74145771, 31.37447907, 39.26896396, 65.35880308, 60.0670218, 45.48057201, 29.76683425, 51.39638136, 46.12180705, 60.72093818, 45.01613513, 37.04611291, 31.32979098, 57.82548455, 29.89919764, 38.77980495, 55.71511912, 66.9872235, 48.74616069, 32.87503301, 56.10335632, 28.72445387, 41.00675821, 55.22238115, 38.56391412, 21.82487917, 51.87394855, 41.62740713, 72.32943223, 49.85456187, 41.76869194, 55.686196, 46.18471338, 52.57455653, 23.03383172, 51.460223, 45.88045256, 47.91709836, 53.09464847, 65.17159616, 48.0076358, 42.50038253, 50.57143193, 22.05776575, 25.5770314, 57.41889173, 37.07408252, 69.83286794, 53.31690771, 36.14562381, 35.3626014, 70.74448842, 30.01870438, 41.95755074, 64.41141845, 48.12704663, 29.33183678, 47.45391445, 35.76760392, 17.57864013, 42.66918162, 27.84884911, 37.83419437, 56.38203205, 32.93395446, 19.45549279, 48.49557175, 63.74692618, 48.36501421, 38.45370018, 63.77499738, 43.40984685, 61.28735474, 47.00513455, 31.82012086, 40.85624032, 32.79590137, 43.79441893, 47.93350586, 26.44410209, 22.71480768, 41.74097624, 29.7828174, 35.24077319, 37.1436077, 63.62150539, 35.27952907, 30.9258966, 35.22384343, 45.0069715, 47.38652625, 60.86474384, 53.19528479, 37.61239521, 64.78497877, 39.50008676, 43.11733875, 34.67761458, 55.21401193, 57.22836509, 30.10411603, 30.03903287, 53.62027996, 40.63516283, 50.229386, 39.59707517, 55.53993024, 62.31160356, 48.65142538, 59.51279601, 51.46268896, 36.70086545, 45.73324953, 39.82026282, 51.51657943, 39.9507342, 26.65847555, 18.11032673, 41.57393548, 37.24804734, 59.78878572, 42.18870686, 57.73556775, 29.83442692, 24.27687775, 44.54663257, 48.40426261, 34.13830576, 64.47843419, 53.82888778, 45.77073351, 41.95910655, 56.25654343, 42.44938602, 18.92651056, 62.89841562, 42.28210051, 60.01632343, 56.38799965, 53.56842386, 71.059581, 59.21196097, 72.29678294, 40.0820475, 74.53163756, 46.35508897, 48.65592196, 36.69711286, 54.84914739, 57.62299813, 63.0750109, 25.53592874, 19.43203054, 63.18532427, 54.79806194, 28.75123602, 47.68037559, 36.06887062, 48.53619627, 42.05208952, 14.47366507, 26.25183654, 57.37741978, 24.92962789, 47.85306044, 35.55674275, 43.62606531, 51.98445971, 57.10441923, 45.20539557, 43.22417529, 48.20941756, 37.12416781, 39.54238987, 45.31000358, 24.59001204, 32.61256929, 31.61553515, 55.76617515, 57.82479513, 34.12465645, 52.1634834, 50.140277, 34.5334757, 70.76112738, 47.22161503, 35.44101995, 54.50312705, 47.74706989, 21.04494842, 42.42698916, 57.8551517, 49.67127478, 67.6702045, 30.64335682, 31.87819093, 45.79096976, 42.72129981, 56.22043416, 22.12571532, 31.93377902, 31.9561172, 60.28281847, 37.49005649, 30.63141229, 22.82707918, 29.55804713, 55.79929136, 39.64043613, 31.79538118, 61.92391469, 19.30462724, 37.00041938, 61.26446455, 47.10048686, 34.70929308, 33.34157984, 49.28331646, 39.9565451, 48.80158593, 29.25279435, 49.96980394, 68.7766356, 49.61949286, 18.80600378, 52.93721773, 24.29791779, 67.69568275, 54.22725318, 35.67531845, 58.05037476, 70.54029077, 55.59508174, 42.07974012, 61.62117032, 44.47174079, 40.13197612, 61.19863058, 35.16748823, 54.79320966, 46.40640448, 41.99222891, 53.33216862, 19.04146695, 29.60278169, 38.43089591, 61.22497978, 32.04678119, 30.77915985, 38.02625789, 74.25140223, 30.44626923, 42.69951906, 28.99988779, 49.76041564, 30.86941271, 58.65788956, 62.64967161, 23.5689175, 42.21941421, 54.88455829, 38.10115824, 24.12341961, 32.84464782, 81.72102673, 42.42771851, 37.75191241, 32.05927543, 43.55812503, 64.79161154, 61.05179286, 53.24693267, 36.29056269, 61.49030629, 53.68500702, 65.93501988, 50.7243041, 51.72139759, 64.80610623, 58.2860023, 33.16444766, 42.7872046, 55.14190562, 39.14341079, 36.05577261, 30.03351742, 24.16526837, 47.94163599, 52.55045103, 56.60625705, 61.6878126, 23.13212844, 50.50369148, 47.79873905, 47.01238239, 35.9159739, 53.18067189, 48.42928497, 67.48879213, 37.37609292, 19.7749038, 47.87115046, 48.90378974)
p.values <- c(9.92E-11, 8.72E-17, 6.90E-11, 9.71E-13, 3.86E-10, 6.58E-19, 7.68E-08, 3.30E-09, 1.98E-20, 4.47E-16, 7.01E-08, 9.48E-12, 9.14E-12, 1.01E-14, 1.08E-11, 1.04E-18, 4.17E-12, 0.000331062, 4.97E-11, 8.14E-09, 2.90E-13, 4.53E-14, 4.27E-12, 1.14E-11, 2.46E-12, 5.02E-08, 2.99E-16, 3.31E-16, 7.74E-10, 1.39E-12, 2.58E-08, 1.86E-07, 9.29E-10, 3.75E-16, 3.64E-12, 3.94E-11, 1.08E-06, 6.97E-11, 7.38E-15, 1.02E-11, 2.07E-07, 1.38E-08, 3.84E-12, 4.86E-10, 1.81E-16, 1.20E-13, 1.35E-09, 1.34E-06, 6.06E-14, 6.68E-10, 2.21E-14, 1.97E-09, 1.26E-10, 2.44E-12, 1.00E-15, 9.74E-07, 1.52E-13, 1.07E-20, 3.39E-07, 1.21E-12, 5.26E-10, 3.34E-12, 2.35E-06, 1.68E-14, 2.74E-05, 7.79E-09, 1.83E-16, 5.84E-15, 1.07E-09, 1.75E-09, 2.53E-13, 5.74E-17, 1.27E-10, 4.17E-09, 7.26E-14, 3.16E-08, 1.52E-08, 7.35E-10, 2.91E-11, 2.08E-10, 3.25E-11, 1.60E-10, 2.36E-15, 9.47E-13, 6.65E-12, 3.35E-07, 1.44E-09, 5.53E-15, 1.41E-12, 2.04E-09, 9.65E-11, 2.99E-09, 4.49E-10, 4.34E-16, 2.86E-07, 1.54E-12, 5.56E-11, 3.49E-09, 3.42E-16, 1.98E-16, 3.27E-12, 1.23E-10, 8.01E-12, 0.000114784, 9.07E-07, 2.97E-15, 3.37E-11, 2.96E-11, 1.39E-10, 3.75E-11, 2.02E-12, 5.21E-10, 5.91E-11, 1.69E-12, 1.45E-09, 2.74E-10, 1.34E-14, 4.75E-15, 4.16E-13, 6.56E-08, 9.28E-12, 3.97E-10, 4.82E-10, 1.67E-09, 1.87E-12, 7.39E-09, 3.77E-09, 5.58E-09, 9.42E-10, 3.00E-14, 5.08E-11, 6.10E-11, 2.21E-07, 3.34E-12, 1.22E-11, 3.33E-17, 1.02E-11, 7.69E-11, 1.35E-14, 8.15E-12, 4.82E-12, 4.41E-13, 1.54E-12, 1.57E-14, 9.47E-07, 3.56E-05, 9.42E-10, 8.55E-12, 7.65E-15, 3.54E-10, 8.83E-12, 6.27E-14, 1.42E-14, 3.01E-14, 9.27E-11, 1.23E-07, 5.03E-08, 8.53E-12, 2.24E-10, 6.22E-07, 1.89E-09, 4.17E-15, 8.40E-17, 1.13E-20, 2.57E-11, 3.08E-11, 1.11E-11, 3.33E-11, 2.16E-17, 7.05E-12, 1.47E-12, 2.02E-07, 2.18E-08, 1.55E-10, 1.26E-05, 3.34E-13, 5.06E-11, 7.08E-11, 2.62E-13, 4.33E-11, 6.79E-11, 3.44E-10, 8.45E-11, 4.92E-13, 8.85E-09, 1.95E-11, 1.43E-14, 5.78E-13, 3.62E-12, 2.69E-18, 3.38E-09, 1.73E-10, 2.24E-08, 2.77E-10, 4.55E-12, 1.04E-11, 2.24E-15, 1.34E-10, 1.52E-16, 3.14E-13, 3.82E-10, 3.50E-15, 2.37E-09, 1.65E-17, 1.45E-13, 5.12E-09, 4.67E-09, 1.88E-12, 1.30E-12, 3.57E-11, 3.39E-14, 1.62E-19, 4.22E-15, 7.92E-10, 2.94E-08, 3.79E-09, 1.21E-08, 9.54E-10, 5.38E-09, 1.89E-13, 4.00E-09, 1.00E-07, 2.64E-08, 4.79E-20, 6.12E-08, 4.89E-14, 8.15E-09, 3.11E-12, 3.53E-10, 1.22E-08, 5.02E-15, 1.19E-08, 2.09E-10, 2.33E-07, 2.41E-14, 5.36E-15, 1.12E-06, 2.53E-06, 2.90E-14, 4.02E-14, 1.98E-08, 2.41E-11, 3.17E-08, 7.22E-12, 6.08E-11, 4.69E-14, 2.84E-12, 4.97E-08, 1.11E-10, 4.51E-11, 1.40E-10, 4.01E-15, 1.01E-09, 4.04E-10, 3.57E-14, 3.29E-14, 1.06E-12, 3.61E-09, 6.50E-11, 4.16E-09, 1.18E-13, 2.46E-11, 2.63E-13, 3.89E-14, 3.55E-09, 7.98E-08, 7.52E-13, 5.67E-13, 5.74E-15, 2.08E-15, 3.07E-11, 7.56E-09, 1.10E-14, 1.30E-11, 5.67E-08, 3.09E-08, 9.27E-08, 2.02E-13, 1.11E-15, 2.26E-14, 3.86E-10, 6.62E-10, 9.60E-11, 8.51E-08, 7.93E-17, 6.12E-09, 3.27E-07, 1.04E-13, 6.08E-23, 1.99E-15, 5.37E-14, 7.53E-13, 3.01E-17, 1.04E-11, 5.80E-09, 6.84E-10, 4.28E-13, 6.00E-13, 2.62E-10, 3.56E-15, 3.79E-08, 1.91E-12, 2.29E-11, 4.35E-14, 2.08E-10, 1.83E-15, 1.40E-14, 8.00E-14, 1.22E-16, 9.41E-07, 6.66E-13, 5.31E-15, 1.36E-14, 9.09E-12, 4.28E-11, 2.55E-10, 2.39E-11, 1.66E-14, 5.80E-15, 1.98E-13, 4.14E-11, 2.90E-11, 6.75E-12, 1.66E-14, 7.20E-15, 3.54E-09, 6.11E-09, 4.11E-09, 6.36E-12, 1.01E-13, 1.53E-09, 2.03E-11, 5.79E-08, 4.43E-11, 5.38E-11, 1.71E-15, 6.32E-10, 4.72E-11, 1.30E-06, 1.10E-13, 1.06E-05, 1.04E-07, 9.08E-08, 3.16E-10, 5.85E-16, 2.51E-08, 6.12E-07, 4.20E-15, 1.18E-14, 8.96E-10, 8.58E-08, 1.51E-09, 2.63E-11, 2.78E-13, 3.65E-12, 2.53E-08, 1.39E-11, 1.12E-11, 2.12E-13, 4.90E-08, 2.41E-09, 2.79E-13, 6.26E-14, 2.21E-11, 8.54E-15, 1.11E-10, 2.13E-10, 5.52E-10, 1.66E-07, 8.99E-13, 5.70E-10, 4.59E-18, 5.06E-09, 5.05E-13, 1.86E-12, 8.29E-08, 0.001134145, 6.71E-10, 5.00E-13, 6.98E-12, 5.62E-12, 2.36E-11, 1.30E-12, 2.79E-15, 8.06E-10, 1.56E-08, 8.46E-13, 1.24E-11, 3.35E-16, 1.08E-08, 4.58E-09, 4.97E-17, 1.19E-10, 2.36E-13, 2.34E-09, 8.75E-06, 2.31E-09, 2.12E-18, 3.24E-15, 1.14E-09, 2.73E-14, 5.63E-09, 1.10E-13, 4.29E-16, 7.84E-12, 8.04E-12, 9.36E-14, 1.32E-11, 2.24E-06, 2.80E-15, 1.18E-12, 7.60E-12, 1.62E-13, 2.62E-09, 1.60E-11, 3.58E-11, 4.04E-14, 8.64E-07, 2.17E-11, 1.02E-12, 8.47E-11, 1.05E-08, 9.32E-08, 1.43E-08, 9.71E-08, 3.28E-10, 2.01E-14, 7.19E-10, 1.20E-17, 3.78E-12, 4.02E-18, 5.38E-08, 3.97E-11, 3.38E-08, 4.82E-11, 4.00E-11, 2.60E-13, 2.16E-13, 9.53E-11, 6.67E-14, 1.06E-11, 9.22E-14, 1.63E-12, 1.01E-11, 1.85E-17, 1.98E-10, 2.81E-09, 1.89E-10, 5.08E-09, 4.85E-16, 1.42E-08, 1.49E-08, 9.42E-12, 2.83E-13, 8.22E-17, 3.18E-06, 2.81E-11, 2.37E-10, 6.33E-13, 5.37E-11, 2.59E-07, 1.49E-05, 3.45E-07, 3.18E-16, 5.55E-11, 1.88E-08, 4.26E-15, 1.16E-13, 5.56E-07, 3.25E-13, 3.39E-08, 4.62E-11, 2.56E-11, 1.88E-10, 2.82E-11, 6.87E-17, 4.96E-12, 8.68E-13, 2.35E-10, 2.01E-11, 6.16E-14, 2.91E-14, 2.31E-12, 6.82E-09, 6.46E-11, 4.34E-12, 2.64E-14, 8.76E-11, 2.92E-16, 1.69E-11, 5.79E-10, 4.21E-12, 2.00E-09, 5.04E-14, 1.96E-10, 3.67E-11, 8.01E-15, 2.21E-09, 1.53E-10, 1.78E-09, 1.74E-11, 4.68E-12, 6.14E-06, 4.41E-05, 6.03E-10, 5.19E-10, 4.04E-17, 1.77E-08, 1.27E-11, 6.70E-12, 2.10E-08, 5.62E-11, 3.55E-10, 4.38E-06, 2.04E-08, 2.19E-13, 9.57E-18, 1.92E-08, 4.19E-10, 7.40E-12, 6.76E-15, 1.04E-14, 6.06E-06, 1.24E-13, 3.13E-16, 2.00E-12, 5.43E-07, 8.30E-15, 2.87E-06, 1.55E-15, 4.93E-10, 2.37E-14, 4.01E-07, 4.47E-15, 9.27E-11, 1.82E-06, 3.27E-12, 1.31E-12, 7.58E-11, 4.56E-11, 1.29E-10, 3.02E-09, 3.38E-12, 3.25E-08, 1.05E-13, 3.13E-17, 4.00E-09, 3.46E-11, 1.14E-11, 2.95E-08, 4.28E-12, 5.43E-09, 7.24E-10, 1.83E-11, 1.74E-10, 1.67E-11, 3.90E-12, 1.57E-15, 5.34E-05, 1.79E-13, 1.17E-11, 1.57E-11, 2.50E-13, 2.04E-13, 8.64E-06, 8.86E-11, 1.54E-11, 9.88E-10, 1.84E-11, 1.88E-12, 4.34E-08, 2.86E-09, 2.71E-17, 4.30E-15, 8.18E-14, 8.15E-10, 2.65E-15, 3.91E-12, 6.54E-16, 3.33E-12, 7.13E-09, 1.46E-08, 8.58E-05, 9.33E-11, 4.17E-08, 7.69E-11, 3.00E-13, 3.71E-12, 9.57E-09, 6.79E-09, 3.21E-11, 1.35E-14, 2.78E-12, 1.76E-15, 1.96E-09, 2.64E-11, 1.50E-06, 2.42E-13, 7.32E-11, 1.10E-07, 3.16E-11, 7.49E-14, 2.77E-08, 5.22E-09, 1.30E-14, 2.90E-14, 8.03E-16, 5.06E-14, 4.82E-11, 2.54E-10, 3.15E-11, 2.87E-05, 1.43E-17, 1.15E-10, 1.64E-15, 1.01E-12, 1.80E-14, 2.86E-09, 7.06E-09, 1.11E-11, 4.49E-14, 2.77E-16, 3.83E-10, 2.79E-06, 6.56E-13, 9.11E-12, 3.47E-08, 9.28E-12, 1.09E-10, 7.56E-11, 1.41E-16, 4.02E-08, 4.46E-10, 1.63E-10, 7.78E-13, 6.37E-13, 1.01E-12, 1.84E-08, 4.94E-14, 4.80E-12, 5.02E-09, 4.26E-13, 3.48E-12, 1.84E-05, 1.16E-08, 8.79E-15, 1.70E-09, 4.19E-10, 3.87E-09, 4.21E-12, 2.14E-08, 7.27E-11, 2.39E-17, 4.83E-09, 5.56E-10, 1.96E-11, 1.70E-15, 1.22E-08, 9.21E-16, 2.21E-13, 1.31E-10, 7.76E-08, 3.56E-09, 1.15E-09, 1.68E-08, 1.41E-09, 1.44E-07, 1.53E-06, 1.11E-10, 7.85E-06, 1.01E-14, 2.75E-10, 6.02E-12, 6.23E-10, 1.50E-10, 2.94E-15, 3.35E-12, 1.41E-06, 4.51E-08, 8.45E-19, 9.79E-11, 6.99E-09, 3.06E-10, 5.04E-18, 6.22E-14, 2.18E-10, 1.48E-14, 6.29E-12, 7.83E-13, 1.57E-11, 9.13E-14, 1.70E-14, 6.05E-10, 1.12E-11, 7.19E-10, 1.51E-10, 1.97E-15, 2.33E-07, 2.13E-08, 3.69E-10, 6.24E-16, 9.17E-15, 1.54E-11, 4.87E-08, 7.55E-13, 1.11E-11, 6.58E-15, 1.95E-11, 1.15E-09, 2.18E-08, 2.86E-14, 4.55E-08, 4.74E-10, 8.38E-14, 2.73E-16, 2.91E-12, 9.83E-09, 6.88E-14, 8.34E-08, 1.52E-10, 1.08E-13, 5.30E-10, 2.99E-06, 5.92E-13, 1.10E-10, 1.82E-17, 1.66E-12, 1.03E-10, 8.50E-14, 1.08E-11, 4.14E-13, 1.59E-06, 7.31E-13, 1.26E-11, 4.45E-12, 3.18E-13, 6.87E-16, 4.25E-12, 7.07E-11, 1.15E-12, 2.65E-06, 4.25E-07, 3.52E-14, 1.14E-09, 6.45E-17, 2.84E-13, 1.83E-09, 2.74E-09, 4.07E-17, 4.28E-08, 9.33E-11, 1.01E-15, 3.99E-12, 6.10E-08, 5.63E-12, 2.22E-09, 2.76E-05, 6.48E-11, 1.31E-07, 7.70E-10, 5.97E-14, 9.53E-09, 1.03E-05, 3.31E-12, 1.41E-15, 3.54E-12, 5.61E-10, 1.39E-15, 4.44E-11, 4.93E-15, 7.08E-12, 1.69E-08, 1.64E-10, 1.02E-08, 3.65E-11, 4.41E-12, 2.71E-07, 1.88E-06, 1.04E-10, 4.83E-08, 2.91E-09, 1.10E-09, 1.51E-15, 2.86E-09, 2.68E-08, 2.94E-09, 1.96E-11, 5.83E-12, 6.11E-15, 3.02E-13, 8.63E-10, 8.35E-16, 3.28E-10, 5.16E-11, 3.89E-09, 1.08E-13, 3.88E-14, 4.09E-08, 4.23E-08, 2.43E-13, 1.83E-10, 1.37E-12, 3.12E-10, 9.16E-14, 2.93E-15, 3.06E-12, 1.22E-14, 7.30E-13, 1.38E-09, 1.36E-11, 2.78E-10, 7.10E-13, 2.60E-10, 2.43E-07, 2.08E-05, 1.13E-10, 1.04E-09, 1.06E-14, 8.29E-11, 3.00E-14, 4.71E-08, 8.34E-07, 2.48E-11, 3.47E-12, 5.13E-09, 9.76E-16, 2.19E-13, 1.33E-11, 9.32E-11, 6.36E-14, 7.25E-11, 1.36E-05, 2.18E-15, 7.90E-11, 9.41E-15, 5.95E-14, 2.50E-13, 3.47E-17, 1.42E-14, 1.85E-17, 2.44E-10, 5.97E-18, 9.87E-12, 3.05E-12, 1.38E-09, 1.30E-13, 3.17E-14, 1.99E-15, 4.34E-07, 1.04E-05, 1.88E-15, 1.34E-13, 8.23E-08, 5.02E-12, 1.90E-09, 3.24E-12, 8.89E-11, 0.000142133, 3.00E-07, 3.60E-14, 5.95E-07, 4.59E-12, 2.48E-09, 3.98E-11, 5.59E-13, 4.13E-14, 1.77E-11, 4.88E-11, 3.83E-12, 1.11E-09, 3.21E-10, 1.68E-11, 7.09E-07, 1.12E-08, 1.88E-08, 8.16E-14, 2.87E-14, 5.17E-09, 5.11E-13, 1.43E-12, 4.19E-09, 4.03E-17, 6.34E-12, 2.63E-09, 1.55E-13, 4.85E-12, 4.49E-06, 7.34E-11, 2.82E-14, 1.82E-12, 1.93E-16, 3.10E-08, 1.64E-08, 1.32E-11, 6.31E-11, 6.48E-14, 2.55E-06, 1.60E-08, 1.58E-08, 8.22E-15, 9.19E-10, 3.12E-08, 1.77E-06, 5.43E-08, 8.03E-14, 3.05E-10, 1.71E-08, 3.57E-15, 1.11E-05, 1.18E-09, 4.99E-15, 6.74E-12, 3.83E-09, 7.73E-09, 2.22E-12, 2.60E-10, 2.83E-12, 6.35E-08, 1.56E-12, 1.10E-16, 1.87E-12, 1.45E-05, 3.44E-13, 8.25E-07, 1.91E-16, 1.79E-13, 2.33E-09, 2.55E-14, 4.51E-17, 8.90E-14, 8.76E-11, 4.16E-15, 2.58E-11, 2.37E-10, 5.16E-15, 3.03E-09, 1.34E-13, 9.61E-12, 9.16E-11, 2.82E-13, 1.28E-05, 5.30E-08, 5.67E-10, 5.09E-15, 1.51E-08, 2.89E-08, 6.98E-10, 6.88E-18, 3.43E-08, 6.38E-11, 7.24E-08, 1.74E-12, 2.76E-08, 1.88E-14, 2.47E-15, 1.21E-06, 8.16E-11, 1.28E-13, 6.72E-10, 9.04E-07, 9.98E-09, 1.57E-19, 7.33E-11, 8.03E-10, 1.50E-08, 4.12E-11, 8.33E-16, 5.56E-15, 2.94E-13, 1.70E-09, 4.45E-15, 2.35E-13, 4.66E-16, 1.06E-12, 6.40E-13, 8.26E-16, 2.27E-14, 8.47E-09, 6.10E-11, 1.12E-13, 3.94E-10, 1.92E-09, 4.25E-08, 8.84E-07, 4.39E-12, 4.19E-13, 5.32E-14, 4.02E-15, 1.51E-06, 1.19E-12, 4.72E-12, 7.05E-12, 2.06E-09, 3.04E-13, 3.42E-12, 2.12E-16, 9.74E-10, 8.71E-06, 4.55E-12, 2.69E-12)
While p-values range from 6.08038E-23 to 0.001134145, the bootstrapped p-value I get is 0.4995005 and I don't understand why. I am using the following function to find the bootstrapped p-value:
(1+sum(logit.boot$t[,2] > logit.boot$t0[2]))/(1+logit.boot$R)
where logit.boot$t[,2] takes on values from the p.values vector, logit.boot$t0[2] equals 2.664684e-11 and logit.boot$R = 1000.
EDIT
Here is the code I used for bootstrapping:
logit.bootstrap <- function(data, indices){
d <- data[indices, ]
Mf1 <- glm(Y ~ A + B + C, data = d, family = "binomial")
data.setM1 <- na.omit(d[, all.vars(formula(Mf1))])
M1.io <- glm(Y ~ A + B, data = data.setM1, family = "binomial")
my.test <- lrtest(Mf1, M1.io)
return(c(my.test$"Chisq"[2], my.test$"Pr(>Chisq)"[2]))
}
logit.boot <- boot(data=my.data, statistic=logit.bootstrap, R=1000) # 10'000 samples
In the result of the boot function, t0 should the p value on the original data, and t is some p values which are generated from random resampling/permutation on the original data.
And in your case, you shouldn't use
(1+sum(logit.boot$t[,2] > logit.boot$t0[2]))/(1+logit.boot$R)
to get information from your bootstrapped p values, you may use
quantile(logit.boot$t[,2], c(0.025,0.975))
or something like this to obtain a bootstrapped 95% confidence interval on your p value. This is not very meaningful, since the meaning of p value is already a probability (confidence level), why do you bother to obtain a confidence interval for p value? And the validness of the bootstrap method relies on the correctness of your parametric model. So if you want to use non-parametric approach toward this problem, I think you need to find some other approaches instead of this one.

How to fit a loess curve over this decomposed time series data in R?

We have time series data with some seasonality from the past 4 years. We want to predict the general rise in trend next year. For this, we decomposed the time series and observed the trend line:
However, this trend line is placed in the middle of the values rather than the values themselves. We are not satisfied with simply extrapolating this trend line since it falls very short of expected traffic.
Since we are interested in only the general rise in trend and not the seasonality, we remove the seasonality from the components:
mydata <- read.csv("values.csv")
mydataseries <- ts(mydata, start=c(2012,1,1),frequency = 365.25
mydataseriescomponents <- decompose(mydataseries)
mydataseriesminusseasons <- mydataseries - mydataseriescomponents$seasonal
We are now trying to fit a loess() curve in R around this time series data minus the seasonal component, that is mydataseriesminusseasons:
855154881.9
1027395443
1132284155
944870172.3
898459083.9
845115286.7
204393180.2
-75788428.32
-184120868.7
-164634776
-190543808.7
-43973009.39
-452418843.2
-1065106918
-1194545584
-1250333168
-379435027.4
-151057609.1
134304962.6
37020062.65
-307740042.8
-309480234.5
-388529539.7
-379333445.3
-193124460
-663765015.3
-100597898.3
-327949890.1
-429500583.5
-1321506072
-1444202356
-369913100.7
-715237274.1
-83507361.25
-328296509.9
-409957935.1
-1351211680
-533631519.6
-882845870.8
-711202595.9
-147504975.3
-361087020.5
-392960561
-456709751.2
-1065209981
-2062128692
-1112973164
-914751976.5
-1377070656
-1903432323
-2110392180
-1984477186
-1434481986
-988902503.8
-944477878.3
-1388889111
-1559730054
-1668752977
-1590459585
-1528272998
-850923022
-542720361.8
-791860111.9
-1057854181
-852120155.6
-810625768.1
-56185632.59
576968488.7
691371629.9
160486150.2
-308533580.1
-261619133.2
-404620378.3
740114544.5
1006206606
622867052.1
-71219884.82
-39173777.42
-533631907.8
-709943766.3
-565909169.9
-968499911.2
-1056539190
-1266350530
-1445031918
-1579156208
-1550356091
-1316401212
-899907725.4
-681646243
-996858524.4
-1261573594
-1620842348
-1529532466
-1107218074
287538766
303061371.4
-382291371.7
-639757694.3
-737369705.5
-732118809.2
-393825621.1
-810602326.3
-1044759123
-1410535140
-1636325717
-1646415420
-1514426422
-1241825553
31448256.14
64762654.11
-513468522.6
-676115681.9
-191498426
-86743267.18
80585792.24
538395944.8
262807408.8
-156283609.7
-72157485.31
-56386961.34
-14257457.85
233362524.8
495465812.9
354441383.3
74975465.29
28985451.46
187381822.2
517857439.4
940857149.4
1397097814
1965769992
1735207534
1568036010
1496104390
1647402384
928936108
1372629124
1417356139
1168474219
1080545493
996524274.5
988026158.1
1060004940
1315522041
1444552768
1438503151
1174067300
1063743311
1086528293
1310565938
1542624917
1504331433
1280216655
1726223821
1670308928
1120574360
1084897870
1285908119
1232985139
1101293494
1081075441
881717495.1
975005126.7
1058436909
1290433280
1288259727
1038856967
1006240656
891910425.2
920601850.4
981585788.8
1536507833
1546018200
1149902811
1230460988
1191817042
1161287112
1273239958
1590385882
1538451838
1242359113
913747727.7
888013837.2
934884821.1
1198395868
1277044767
1235456131
963043028
925500611.4
921906159.7
957528730.9
934517634.5
1183155135
1155142736
893512199.3
829955361
839182104.7
904102148.6
972879836.6
1227504663
1192420215
904137203.4
944756516
1375037708
1328414157
1779424344
1921248556
1899629843
1773839270
1565431502
1592386775
1825650269
1404794363
1393784791
1416771770
1288386476
1289239680
815093905.4
681990799.1
783953618.4
1103067833
1182429773
933897907.8
874114515.6
787403408.5
860338795
1052657878
1297180989
1245476158
1014316130
1004606484
735958898.4
575505161.4
588750452.3
803692654.7
833093724.3
531996754.3
199110366.8
-18901281.1
-6413198.146
-33290860.64
252073940.6
203247618.9
-164091120.7
-501720846.4
-865543851.3
-856086326
-612355346.3
400846624.1
511862726
288735892.8
-127533264.3
-940372573.2
-155917893.1
-699989731.6
-320401187.5
-277824927.9
-705440125.7
-1042182377
-1206106831
-1339738778
-165282703.3
222304361.4
136773204.1
-224139914.3
-271723348.1
-288223577.8
-285482682.4
-1057479814
-1059799528
-960773269.6
-1378106942
-1682462197
-1880270405
-1877392694
-1621410466
-1218560480
387109224.3
85424610.03
-558048286.6
-432347510.8
-107370046
224698124.4
732906395.5
-523071744.4
-1239504492
-1798916179
-2065361083
-1987860160
-1725292219
-1109123667
-971275176.7
-1420498329
-1889158526
-1136864728
-1002777887
647298007.9
1277421457
248465769.8
-377527211.2
-724681515.2
-967478152.4
-947666627.1
-734506065.3
-408053802.2
-241421840.8
-363715586.3
-829237162.5
-929529173.2
-260432788.4
-67756618.13
242997207.2
567370574.9
128921994
-159670249.1
-226982681.8
-240623081
-26502753.8
311495394.1
477285225.3
198408156.8
-195753985.4
-271887709.5
-196538766.7
-72464893.44
180860168.9
360960891.9
147945699.2
-29352193.17
325127464.9
960490365.6
1453481987
1424677454
1207446280
537281902.1
-167977127.5
-505612366.5
-1460096451
-1554214240
-1472813276
-1158137635
-1079634747
-1400116741
-1623247577
-1720625509
-1291068926
-541823228.2
423680238
828606261.2
651175802
588260033.4
511022741
644493024.6
696908085.1
949150687.9
1037411745
754948966.3
790033725.6
1053226989
1170333305
1056602964
1081413405
1135864583
971795777.8
855154881.9
1027395443
1132284155
944870172.3
896319497.9
845115286.7
204393180.2
-75788428.32
-184120868.7
-164634776
-190543808.7
-43973009.39
-452418843.2
-1065106918
-1194545584
-1250333168
-379435027.4
-151057609.1
139705076.6
37020062.65
-307740042.8
-309480234.5
-388529539.7
-379333445.3
-193124460
1308430606
-100597898.3
-327949890.1
-429500583.5
-1321506072
-1444202356
-369913100.7
1419976593
180125360.7
-328296509.9
-409957935.1
-1351211680
-533631519.6
1246061777
1639641696
272442819.7
-361087020.5
-392960561
-456709751.2
1014735303
478499133.8
-748455756.5
-914751976.5
-1377070656
-1903432323
-2110392180
-1984477186
-1434481986
-988902503.8
-944477878.3
-1388889111
-1559730054
-1668752977
-1590459585
-1528272998
-850923022
-542720361.8
-791860111.9
-1057854181
-852120155.6
-810625768.1
-56185632.59
576968488.7
681069818.9
160486150.2
-308533580.1
-261619133.2
-404620378.3
740114544.5
1006206606
622867052.1
-71219884.82
-39173777.42
-533631907.8
-709943766.3
-565909169.9
1641890896
1588111061
880069519.6
1090752417
1278890698
1335767912
1519822543
1812984581
1334545973
426228457.6
456951496.9
1228693380
1312355639
1637418032
691968559
303061371.4
-382291371.7
-639757694.3
-737369705.5
-732118809.2
-408383535.1
1630144553
1548715666
747397223.2
884268460.1
1205537489
1226277745
1637844137
477586396.1
64762654.11
-513468522.6
-676115681.9
-191498426
-86743267.18
80585792.24
538395944.8
262807408.8
-156283609.7
-72157485.31
-56386961.34
-14257457.85
233362524.8
495465812.9
354441383.3
74975465.29
28985451.46
187381822.2
517857439.4
940857149.4
1397097814
1479492584
1206235886
1230335054
1209244303
1772074811
1693077942
1461745247
1417356139
1168474219
1080545493
996524274.5
988026158.1
1059643199
1314652245
1440434637
1438503151
1174067300
1063743311
1086528293
1310565938
1542624917
1504331433
1280216655
1726223821
1670308928
1863627651
1882123871
2055914335
1992301669
1579375771
1533925079
1762629244
1838997943
1897919645
2107505072
1997289608
1464337865
1415561153
1676756233
1700040307
1783398157
1624554189
1546018200
1149902811
1230460988
1191817042
1161373475
1273239958
1590385882
1538451838
1242359113
913747727.7
888013837.2
934884821.1
1198395868
1277044767
1235456131
963043028
925500611.4
921906159.7
957528730.9
934517634.5
1183155135
1151401692
893512199.3
829955361
839182104.7
904102148.6
972879836.6
1227504663
1192420215
904137203.4
944756516
1375037708
1328414157
1193178073
1253502729
1251928059
1185271006
1244858293
1231640212
1171269572
1343448619
1393784791
1416771770
1288386476
1289239680
815093905.4
681990799.1
783953618.4
1103067833
1182429773
933897907.8
874114515.6
787403408.5
860338795
1052657878
1297180989
1245476158
1014316130
1004606484
735958898.4
575505161.4
588750452.3
803692654.7
833093724.3
531996754.3
199110366.8
-18901281.1
-6413198.146
-33290860.64
252073940.6
203247618.9
-164091120.7
-501720846.4
-865543851.3
-856086326
-612355346.3
400846624.1
511862726
288735892.8
-127533264.3
-940372573.2
-155917893.1
-699989731.6
-320401187.5
-277824927.9
-705440125.7
-1042182377
-1206106831
-1339738778
-165282703.3
222304361.4
136773204.1
-224139914.3
-271723348.1
-288223577.8
-285482682.4
410687500.7
1631841798
1553281634
713309450.5
649367763.9
960215164.3
1049107976
1148989485
1678375251
1164709303
183895982
465208739.4
766073381.2
586658157
853178118.4
1317822533
1674419406
693138111.6
610057420.2
928861116.6
1021382975
1317392280
1950890283
1753467250
679132043.8
530667904.1
1923321662
2445945599
2224779498
2205640478
2617939193
1771677175
1773936492
2444894838
2401384689
2491268212
2581667225
2449579792
1593738389
1956098689
2378730864
235226517.6
-67756618.13
242997207.2
567370574.9
128921994
-159670249.1
-226982681.8
-240623081
-26502753.8
311495394.1
477285225.3
198408156.8
-195753985.4
-271887709.5
-196538766.7
-72464893.44
180860168.9
360960891.9
147945699.2
-29352193.17
325127464.9
960490365.6
1453481987
1424677454
1207446280
537281902.1
-167977127.5
-505612366.5
1404374892
1613823539
1849271413
1936762445
1513383047
1256267888
1553901607
1655449233
1979063830
2224098910
2147758870
1612601292
1277373178
1489383946
1406268621
1510782787
1555473157
1721503681
1473734831
1214127421
1427159815
1454163770
1559572239
1693448937
1686056516
1534649610
1402815411
1597472633
1479661974
1572474919
1758527502
1912156129
2007806540
2577055685
3079863351
3189154952
3084552356
3020184398
3019956688
2361199448
1906290720
1878596097
1894542086
54727454.63
-151057609.1
134304962.6
37020062.65
-307740042.8
-309480234.5
-388529539.7
-379333445.3
-193124460
-663765015.3
-100597898.3
-327949890.1
-429500583.5
1538626202
1943756793
142960155.3
-715237274.1
-83507361.25
-328296509.9
-409957935.1
1469349471
-6715352.565
-882845870.8
-711202595.9
-147504975.3
-361087020.5
-392960561
-456709751.2
-1065125015
1006714631
2153142496
1804378762
1673270778
2693842453
3029003743
3091803034
2506604564
2457560591
2027821010
1756470132
2064844611
2119623546
2162263280
2002164168
1694641809
616667238.2
178971439.1
187991217
342780020.4
452558045.9
1221341191
1928282804
1898438088
2350801273
3271266186
3102579205
3404316683
1296736764
1006206606
622867052.1
-71219884.82
-39173777.42
777976197.2
831608580.7
1173972977
574093131.8
145884449.2
125630390.6
140647407.2
-1948845.745
-20569346.72
170376510.8
416953573.6
394780276
210086267.6
240846310.9
-4692367.437
13267344.2
462459409.2
1638331860
1368251762
844946221.3
908678722.7
858991700.5
821130809.8
1087001122
501346560.7
49030467.37
-115293555.8
-42916860.95
-94506694.82
65744337.46
214422930.7
1246493179
948746467.1
450984956.4
906168925.1
55072855.99
-86742286.18
80586773.24
538396925.8
262808389.8
-156282628.7
-72156504.31
-56385980.34
-14256476.85
233363505.8
495466793.9
354442365.3
74976446.29
28986433.46
187382803.2
517858420.4
940858130.4
1397098796
1479493565
1206236868
1230336035
1209245284
1021481495
1358007248
1908140672
1690817796
1450430426
1573572004
1548289864
1518408336
1551340078
1800682764
1691240562
1675755235
1422581675
1551622923
1630779709
1361558060
1542625898
1504332415
1280217636
1726224802
1670309909
1120575341
1084898851
1285909100
1226741796
1101294475
1081076422
881718476.1
975006107.7
1058437890
1290434261
1288260708
1038857948
1006241637
891911406.2
920602831.4
981586769.8
1536508814
1546019181
1149903793
1230461969
1191818023
1161288092
1273240939
1590386863
1538452819
1242360094
913748708.7
888014818.2
934885802.1
1198396849
1277045748
1235457112
963044009
925501591.4
921907140.7
957529712.9
934518615.5
1183156116
1151402673
893513180.3
829956342
839183085.7
904103129.6
972880817.6
1227505644
1192421196
904138184.4
944757497
1375038689
1328415139
1193189782
1253504218
1251929547
1185272494
1244859781
1231641700
1171271060
1343450107
1393786279
1416773258
1288387964
1289241168
1276942382
1223342782
1265179173
1582950274
1549362846
1289741511
1522844687
1575762386
1623981295
1140018366
1297182477
1245477646
1014317618
1004607972
3339996446
2617836416
2598501271
2725463672
2379954942
2430902194
3387783330
4057325882
3941464221
4026010913
3593315188
3218647755
2899429341
3156298547
3453939489
3535652872
3957490786
2127115167
1652343230
1644069350
1408460965
3374914231
1354451507
3451778958
4125068975
3062203905
2860803149
3523217492
3446260128
4086491216
1353224655
1786887688
1329952369
1262946794
1434089723
1426765711
1394483892
3184736742
3585370070
2492338381
2870647454
3422458727
3496074936
3440427221
3488297885
3411694273
1862226333
2347786389
2984492965
2832984919
2706245540
2975365013
2750770215
2329108891
2668972592
3485974677
3498308730
3651172133
4020199587
3953317903
2733969884
2903235323
3953139670
4668898648
4652525612
4073702669
3715845753
3017343417
4181519935
4751974434
4619926728
4594101972
4732221475
4318140179
3780497707
4451918052
5012718317
4833179055
5653878208
5807608123
5396558840
4198373572
4884875793
5677377778
5912605893
5944449107
5747882280
5227572313
4478777171
4801671568
5862958412
6148995450
6002089979
5948770595
5519491673
4863435104
5079255850
5868770156
5542293262
4248733096
2766041977
2732273377
2763007960
3709017196
5826881003
5418281457
4464795375
4353979464
4041806357
3642750843
3991233296
4574288639
4505497973
4507525662
3759850718
2770466566
1884370202
2017997394
2536894291
2394368239
2561217637
2329522814
2238153751
1823017685
1985828850
2534460960
2292248472
2008277139
1792241233
1777656572
1763197595
1863541282
2165268053
2093475484
2045555081
1853852293
1858329332
1755509088
1713779365
1790957115
1574452597
1579659809
1670558649
1766876466
1623856630
2694719637
3768836252
3933201414
3980190714
4955559887
4938681336
4365493305
4568797166
5264823884
5274383182
5433866314
5417386015
5045165577
4013353224
4858457348
5313474135
5517720717
4442688396
4160415512
4888461743
3958104821
4567324340
5323056776
5488909281
4557331369
5223549360
4326783309
3764876526
4571173289
5423886480
5493146693
5626783987
4769215133
3238864341
3322242772
3840761593
4440231932
3952228746
3826102990
3642814617
3683433336
3290239564
3679644227
4401886050
4271007289
4331924299
4217934600
4322830334
3958867188
4735975510
5434096780
5704487461
5359613448
5223744170
3712806728
2381705672
2316848053
2396344551
1960261326
2098710139
1955760687
2933140424
2967171559
3746036475
5150516737
5103739176
4799974487
4940976107
4470787625
2874748403
3370617116
4116000776
3907376783
3879136871
3858305272
3498190930
2968939532
3482738547
4592541370
4548237451
4039300654
3954893868
3196099484
2977703338
3645589701
4866174649
5072864386
5232041565
5275606802
4693688082
3245094491
3790221336
4772983985
4581973930
4331144672
4167962637
3622317542
3760217425
4483667233
5577532419
5303025177
5677698961
5720893489
5385575901
4466914817
5021515141
5865735715
5703914224
5678717816
5600943246
5110447244
4590128626
4877035122
5442054864
5540200590
5229513831
4574668437
3734155348
2825747731
2665659550
3218611753
3177069031
3225833078
2857378098
2605242926
2290489544
2556941031
3052363819
3023655743
3139325913
3183875762
3084641745
2584707861
2573111682
2596449197
3119292036
3103807890
3003440326
3050225234
2639037382
2719271674
3174072606
2288642761
2407051251
2769659370
2792708736
2422258872
2550055714
3094896689
3167462954
3145311598
2982505987
2846929030
2410677820
2528516371
3317404595
3405548963
3264859256
3217887704
3076794348
2682319143
2752574869
3546644862
3387139453
3465822066
3527697761
3304648740
2671176465
2775904656
3369489444
3186975051
3265608930
3125970955
2336383605
2101672532
2227649209
3046717349
3161392531
3174174168
3069526988
3140929673
2396972936
2491933483
3274873818
3471396399
3449881421
3260944652
3059846681
2300326480
2410144424
3280639160
3165080129
1880734112
2026731745
1851573264
1593311358
1623039610
1888090770
1983714225
1990135314
1884610261
1966858510
1881518298
1817889199
2209334095
2213195958
3180360773
3506589476
3266458246
2314386847
2203488644
2979775043
2887785856
3029641480
2854946175
2971200632
2338656676
2508827357
3221768984
3271647981
1494100499
2557318665
2566743784
2024262236
2326858931
2898711691
2629767554
2418419575
2529673112
2517326919
2394071701
2882872031
3958018274
4398615549
4850186215
4769908627
3875047506
3686152334
3944845885
4407300286
5483421647
5150638137
5610203814
4608824221
3183456836
4173041229
5250468129
5281994707
5707036828
5352424541
5755606494
4561838923
5206514812
6017273753
5965257129
6031374315
6079040231
4379684817
2770833772
3855818791
4754914912
4592227424
4426284753
4410453960
4025381538
3174239722
3637497533
4441638488
4174099821
3906145103
3894032411
3032325960
2296152859
3634154800
5013642209
4862468183
4819578542
4516969809
3607317085
2438327317
3732908830
5107431888
4696140901
1856348267
1237864483
406427050.9
166776835.3
1498808575
1828048545
1624152578
1349901570
1420774156
998226407.7
1012022910
1532830520
1859891754
1422784584
1300680502
1969725485
1936125754
1730921235
2284540775
2480696530
2271292433
2177291835
2174315253
1943550394
1789789173
2208387982
2445973421
2180115879
2053590351
2057128187
1868753587
1794479025
2093710971
2310482091
1882157273
1506021669
1535469156
2038211764
2132884419
2539631965
2937476532
2237006540
1897259543
801631140.7
589473184.2
116334380.3
674275361.3
1282712559
1119202007
1004676722
781599593.7
1184057471
1405174402
2414122535
3215047803
3117104932
2843730513
2338714670
1830982498
1282357057
1398445510
1709185553
1343346425
1299455992
1382754660
1451688601
1355952002
1395566041
1646971917
1518132724
1378268909
1383505613
1477733701
1396182586
1340692285
1513095775
952400088.2
654084246.7
626929432.3
700786606
523798987.3
1212948425
1567710490
1072360130
1057312922
876650104.6
1532682661
1439342205
1801524855
2099113224
1992935512
2063753470
1849349346
1589462235
1341435771
1147947080
2071354378
2006092710
2105408195
1234206054
656144711.4
1208902786
1232216105
2213555415
2017146411
1991371378
994748835.5
1523018258
551904050.2
4489317425
7011882149
7509029269
7405531928
6627086822
5118361296
2929515389
4386298474
6193577031
6201888044
5600929516
5249637157
4071570693
3812427933
4814958529
6581889904
6706593436
6538328968
5770674289
5146640592
3869631764
5168489883
7218970135
7319257013
6818980598
6581026441
4463128268
2549197744
2751600290
3586655201
3073231312
2610229695
2664878334
2445857027
3333286739
5342397336
8218514365
7400486992
7351969323
6170498161
6166815740
4938259613
5123232548
6952344511
7484834076
7975757356
6042108897
3954139391
2561409558
3636287452
6659637045
6610145475
6303751643
5790815423
5286756045
532871596.2
2403662106
2933984545
2177296758
1954486433
1713519574
1459802901
4020142932
5383799348
6858179971
7112822894
6327294007
5759923625
5042533123
3796835736
5750880779
7453820307
7335397513
6962686301
7790660114
6724956363
5003169135
6701050938
7992041249
7756326177
7913301179
7741411043
6785177818
6284270117
6963921883
7785974652
7574222100
7588499293
5788919572
4105788142
2859825648
2924210471
4069907537
3895077405
3979654780
2075329893
1979403277
1632081713
1877890303
2412917344
3763581680
3726439732
3673898152
3345262416
2191053212
2548906553
3841133834
3846853011
3492242728
3479185981
3290714847
2514060721
2645599322
2791855040
3791586130
However, we are not familiar with the form of the loess() function and it seems to expect a formula which we do not know. We tried the following:
y <- c(mydata)
x <- 1:1614
lo <- loess(y~x)
We get the error: Error in model.frame.default(formula = y ~ x) :
invalid type (list) for variable 'y'
How do we fit a loess curve around the values to get the general trend line? Also, after removing the seasonal component we have some negative values for some reason. Would this affect the loess() curve?

Analyis of pseudoreplicated data: looking at niche breadth differences using Levins' B

I am interested in testing whether species with trait A have wider niche breadths than species with trait B. I have been using Maxent species distribution modeling. After generating 100 bootstrap replicate Maxent species distribution maps for each species, I used a function in ENMtools to calculate niche breadth using Levins' B, giving me 100 estimates of niche breadth for each species.
What statistical test can I use for 1) a single pair of species with trait A and trait B and 2) a group of species pairs consisting of species with trait A and trait B
Also, am I really dealing with pseudoreplicate data?
Any assistance is appreciated.
Edit, Data is pasted below. I am using the stand alone versions of Maxent and ENMTools, so I do not have code. I have used R to try and analyze the data using t-tests and sign tests, otherwise there is no code to add.
Sample data:
species A species B
0.168581128 0.092476942
0.138468258 0.097536175
0.16412658 0.107661982
0.16371685 0.103260373
0.162732326 0.121757497
0.129050784 0.113096489
0.126583781 0.114981732
0.176855441 0.099364014
0.257605323 0.103776886
0.182453389 0.108293928
0.175081388 0.106879389
0.223292158 0.112947306
0.254094648 0.127991856
0.147219108 0.108193268
0.215448167 0.092778064
0.103140149 0.098756118
0.176492044 0.101350818
0.17121499 0.085262687
0.173945262 0.123863121
0.187958506 0.103502695
0.14655381 0.129826611
0.217358822 0.097517987
0.129096849 0.107359879
0.19682274 0.096810086
0.138933825 0.098270337
0.165596467 0.106029483
0.132607982 0.112006155
0.195556231 0.104323653
0.117660212 0.099375585
0.203652419 0.095314923
0.148629883 0.102969753
0.134932182 0.095842915
0.170387616 0.10520627
0.155080925 0.11811477
0.16431599 0.094490674
0.150336814 0.127094893
0.152238428 0.101582407
0.20186197 0.106561491
0.148248253 0.102802711
0.187076952 0.112530243
0.136677706 0.105465642
0.163433556 0.109735202
0.199990899 0.114393721
0.137892935 0.101238746
0.134763941 0.106226666
0.209942031 0.100820784
0.217706637 0.108691033
0.20036096 0.096355532
0.164807164 0.092417125
0.15371586 0.114739325
0.219866044 0.106098684
0.206539001 0.108628272
0.143972195 0.100132843
0.141272459 0.102480243
0.147306813 0.101444936
0.122265342 0.105942924
0.180917047 0.105722483
0.120716411 0.106555329
0.18800414 0.113761784
0.174485389 0.106940597
0.136967932 0.115609256
0.214880862 0.116237716
0.152007642 0.099203843
0.171732613 0.106697919
0.16261444 0.100392708
0.211592418 0.111231976
0.185334669 0.121699976
0.205723283 0.101651487
0.177553405 0.103634347
0.255510009 0.130654929
0.233807884 0.105441321
0.134768798 0.101113701
0.199416249 0.091038829
0.151712987 0.105402425
0.209823704 0.115964528
0.181800387 0.100236837
0.13240936 0.112243762
0.163134833 0.102686995
0.133972129 0.099741739
0.167130799 0.099626019
0.201614387 0.127056303
0.162793942 0.106440826
0.115234276 0.105374317
0.187650165 0.105206766
0.157882045 0.106361622
0.158200651 0.097265822
0.16939029 0.103107653
0.186945284 0.109809801
0.21049161 0.108904949
0.12530485 0.107502039
0.17948561 0.112303038
0.171934415 0.113321492
0.216209636 0.092409221
0.133687523 0.121289466
0.170516709 0.095395971
0.123796452 0.097354942
0.152966332 0.102279392
0.173328517 0.127320454
0.218387925 0.088878651
0.213022848 0.119487608

Resources