I am using the lme4 package and running a linear mixed model but I am confused but the output and expect that I am encountering an error even though I do not get an error message.
The basic issue is when I fit a model like lmer(Values ~ stimuli + timeperiod + scale(poly(distance.code,3,raw=FALSE))*habitat + wind.speed + (1|location.code), data=df, REML=FALSE)
and then look at the results using something like summary I see all the model fixed (and random) effects as I would expect however the habitat effect is always displayed as habitatForest. Like this:
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 996.63179 8.16633 31.22730 122.042 < 2e-16 ***
stimuliBHCO -3.57541 1.28877 8750.89273 -2.774 0.005544 **
stimuliCOHA -10.17037 1.29546 8754.17156 -7.851 4.62e-15 ***
timeperiod 0.19900 0.05516 8744.95307 3.608 0.000310 ***
scale(poly(distance.code, 3, raw = FALSE))1 -3.87613 0.71431 8745.70773 -5.426 5.90e-08 ***
scale(poly(distance.code, 3, raw = FALSE))2 2.65854 0.71463 8745.19353 3.720 0.000200 ***
scale(poly(distance.code, 3, raw = FALSE))3 4.66340 0.72262 8745.67948 6.453 1.15e-10 ***
habitatForest -68.82430 11.83009 29.95226 -5.818 2.34e-06 ***
wind.speed -0.35853 0.07631 8403.15191 -4.698 2.66e-06 ***
scale(poly(distance.code, 3, raw = FALSE))1:habitatForest 2.89860 1.03891 8745.46534 2.790 0.005282 **
scale(poly(distance.code, 3, raw = FALSE))2:habitatForest -3.49758 1.03829 8745.11371 -3.369 0.000759 ***
scale(poly(distance.code, 3, raw = FALSE))3:habitatForest -4.67300 1.03913 8745.30579 -4.497 6.98e-06 ***
---
This is happening even though there are two levels of habitat (Forest and Grassland)
at first, I thought this might be because my model had an interaction term but it happens when I try a simpler model like lmer(Values ~ stimuli + timeperiod + distance.code + habitat + wind.speed + (1|location.code), data=ex.df, REML=FALSE)
Why would it say "habitatForest" and not just "habitat" or if it were going to include a factor by name why not say "habitatForest" and "habitatGrassland"?
A quick look at the expected output from this function here: https://rpubs.com/palday/mixed-interactions or here: https://ase.tufts.edu/bugs/guide/assets/mixed_model_guide.html (among others)
shows that the out put that I am getting is not what is expected or normal.
Other output I have seen simply have factors with two levels, like mine, as a single line (eg habitat).
Here is a portion of the data I am using. I used dput and subseting to produce this. I couldn't figure out how to make the data set smaller and still reproduce the error so I apologize if this is too large. The data set that it comes from is MUCH bigger! (also please let me know if I have used dput incorrectly.(Still new to R and stackoverflow)
structure(list(location.code = structure(c(1L, 1L, 1L, 2L, 2L,
2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L,
2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L,
1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L,
2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L,
2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L,
1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 4L, 4L, 4L, 3L, 3L, 3L, 3L,
3L, 3L, 4L, 4L, 4L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L,
1L, 1L, 1L, 2L, 2L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L,
4L, 3L, 3L, 3L, 4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L,
2L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 3L, 3L, 3L,
4L, 4L, 4L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 4L, 4L, 4L,
3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 3L, 3L, 3L, 4L, 4L, 4L, 1L,
1L, 1L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 4L, 4L, 4L, 3L, 3L, 3L,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1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L), .Label = c("Grassland",
"Forest"), class = "factor"), distance.code = c(0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L,
30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L), stimuli = structure(c(3L, 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0, 0.9, 0.9, 0.9, 65,
65, 65, 65, 65, 55, 55, 55, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0.9, 0.9, 0.9, 65, 65, 65, 65, 65, 55, 55,
55, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.9,
0.9, 0.9, 65, 65, 65, 65, 65, 55, 55, 55, 50, 50, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.9, 0.9, 0.9, 65, 65, 65, 65,
65, 55, 55, 55, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0.9, 0.9, 0.9, 65, 65, 65, 65, 65, 55, 55, 55, 50, 50,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.9, 0.9, 0.9, 65,
65, 65, 65, 65, 55, 55, 55, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0.9, 0.9, 0.9), timeperiod = c(6L, 6L, 6L,
6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 9L,
9L, 9L, 9L, 9L, 9L, 11L, 11L, 11L, 11L, 11L, 11L, 13L, 13L, 13L,
13L, 13L, 13L, 15L, 15L, 15L, 15L, 15L, 15L, 17L, 17L, 17L, 17L,
17L, 17L, 19L, 19L, 19L, 19L, 19L, 19L, 20L, 20L, 20L, 20L, 20L,
20L, 21L, 21L, 21L, 21L, 21L, 21L, 22L, 22L, 22L, 22L, 22L, 22L,
23L, 23L, 23L, 23L, 23L, 23L, 24L, 24L, 24L, 24L, 24L, 24L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L,
6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 8L,
8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 11L,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L,
17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L,
17L, 17L, 17L, 17L, 17L, 17L, 17L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 20L, 20L, 20L, 20L,
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L,
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 21L, 21L,
21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L,
21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L,
22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L,
22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L,
22L, 22L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L,
23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L,
23L, 23L, 23L, 23L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L,
24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L,
24L, 24L, 24L, 24L, 24L, 24L), Values = c(910.721895276374, 922.652711611841,
926.219785713456, 1030.28919690464, 1121.98321368732, 992.741416151102,
910.878353926705, 920.201901019659, 922.134996121665, 992.059286431433,
1042.05240231832, 1018.99804250179, 911.976009884021, 918.215389274037,
931.037495260958, 981.032280455129, 983.700699744073, 989.716307418049,
911.476759038955, 918.554393750162, 920.391856289719, 994.583211567691,
1006.58290843226, 1005.52479816571, 908.665064025178, 917.940176257067,
922.746174825048, 986.419049170517, 1042.41789735969, 1082.89658057517,
916.02310296116, 918.254868924698, 931.01648294424, 982.154409713674,
1008.54477137219, 996.577798511801, 912.914857937818, 916.937508116615,
920.933077377339, 997.669828575817, 1007.44452218386, 1151.25894192961,
909.463528658898, 915.293665875472, 921.917039784441, 983.866984633392,
1002.04551764872, 986.791628665069, 907.695668282537, 917.845214744473,
932.330755620455, 972.609449456089, 1155.55960936774, 1083.40557091613,
909.903267624225, 914.846316952797, 921.279328283221, 1000.3672969178,
1021.78461788922, 1011.40975353271, 915.037273600535, 914.099859036178,
924.116937361394, 994.428182266452, 1123.09745015276, 1004.1485272116,
914.431649376896, 915.27037594587, 929.411251949862, 974.273124973661,
1145.99211507205, 1013.58184367388, 913.467056616881, 920.213007520924,
919.794369158301, 983.816025282468, 1103.11322201674, 974.792027063404,
910.532609655114, 917.616832229923, 923.462599912213, 1015.24811721269,
1070.61183211249, 1016.57332551186, 910.196695694198, 923.403802532832,
905.400995326023, 1036.98011238981, 963.147077473505, 916.899569521736,
931.240844862156, 919.11781354823, 995.408916523572, 960.825305234446,
1026.22960551445, 1000.13773127026, 962.347584090332, 904.090295814044,
908.836747102913, 928.867625382891, 918.100799763641, 906.282906701285,
913.146312873635, 977.094140033575, 972.599778534534, 964.658406857446,
921.91272768213, 910.507770576621, 942.269786765654, 1014.34022271036,
1128.29327664605, 1043.1365958913, 919.185972424773, 925.486310755197,
908.769520270226, 1030.20866627018, 956.104935565803, 922.01947330213,
934.451182538208, 928.626906337293, 986.326936258622, 1003.40797963907,
1021.91264348048, 995.68658929192, 993.102343807935, 901.633626404701,
908.255562868123, 922.840049924103, 917.012733437446, 907.541530752433,
915.050696506642, 983.542956895186, 972.236377246083, 965.082329354352,
918.337944633569, 910.137012141557, 952.89462134025, 977.420371016686,
1154.17994731565, 1022.82998099991, 927.061613377597, 926.745527716988,
908.284054932259, 966.157586219165, 974.986841619676, 916.559494755925,
935.817296050643, 918.835719171662, 1023.62078549133, 1009.23121097376,
1005.81651905991, 981.715747809821, 953.127134375762, 902.809201411559,
907.462229880533, 921.595454423298, 919.198277947855, 904.969515265664,
913.438353334218, 974.889830301362, 970.58615968713, 963.029605541189,
915.889893279581, 908.147726780027, 942.742415528349, 979.939535179807,
1153.51966568673, 1020.93502990084, 916.246150801212, 936.016759720656,
914.4488779132, 962.397352323664, 986.957848140285, 985.364195731404,
932.548910038465, 917.363220594089, 1085.89850605988, 1031.66330597084,
1005.64983154588, 991.988118229379, 975.384741587994, 902.60240793926,
907.989086075871, 923.287310593779, 912.878571722023, 904.107623756648,
905.563259817979, 991.530368160932, 975.190212414434, 965.951810135591,
915.334621878897, 910.857441830446, 936.093336975328, 972.074491630181,
1106.77459226532, 993.45400883741, 951.911391767329, 927.688604859773,
915.194279622847, 971.414103170297, 956.138106650696, 965.458656222347,
944.097918792458, 947.157460200658, 1029.14870726558, 992.151638322899,
954.129642526236, 981.48182339388, 968.10870393618, 906.941701681267,
917.956716926981, 923.05649603805, 934.459432014683, 922.801034508827,
920.724850575215, 981.478432929603, 1012.67364507927, 966.471299899978,
912.640460101352, 906.34455384334, 923.738349342148, 970.987788560016,
1210.42940542072, 975.753397539076, 911.747488522664, 928.34872697947,
910.852487444859, 982.304620375747, 1028.52794775628, 913.408967803895,
934.334726415048, 916.354017093653, 1036.08727658415, 974.408618327141,
1004.71633485176, 995.142763465394, 987.00017276687, 906.86826042139,
915.355833226192, 930.395950341189, 911.742114273539, 905.725754800821,
912.194776217353, 979.488696998854, 998.766511802223, 968.436523426865,
916.299279627464, 907.645161223541, 925.30056793674, 978.067851389738,
1142.91274685359, 1001.53234105611, 916.842758017232, 924.907983103717,
922.470305986631, 992.855613565408, 955.757560902304, 929.20232030375,
943.535934437766, 923.58180450271, 1035.68330820385, 962.09501965608,
1035.71434011945, 999.021624049638, 1037.74929152155, 904.65540329816,
907.898446182233, 915.586965865012, 912.540978342886, 904.648950841522,
910.146698786639, 970.655222414677, 969.045225438776, 961.588678057607,
922.252864714149, 904.866433981365, 921.496292021655, 971.871605044557,
1075.02261709497, 1018.63215987506, 925.837889075039, 937.313874872585,
919.393974179406, 984.865480173384, 998.38173566307, 923.591922218561,
935.764591123357, 914.144404904734, 1064.07484543951, 1009.55385037395,
1003.07982307794, 1019.96770677478, 1023.43370663799, 1075.23648079772,
918.40638740207, 930.381596850856, 911.431923384541, 908.158538518039,
913.917742396318, 972.975539521988, 969.261073622988, 966.900828461146,
912.922987528198, 906.204515258546, 917.349668426986, 965.167090686302,
1033.80724280751, 1019.96323854891, 923.466492256566, 923.247012056591,
911.896005256495, 983.55323734271, 987.195939413696, 948.013535459932,
946.283282150572, 946.996017019961, 1018.55920835599, 983.790383328001,
1044.1241515621, 1025.44806232873, 1013.07125415424, 936.438305947314,
914.845558304809, 919.627558974215, 912.08306092659, 905.506361055768,
925.863591354922, 980.84672626416, 1034.50509678374, 999.432501149952,
914.013428128551, 903.385280147577, 914.982720974316, 987.521728519027,
1026.27371444455, 1003.6659923071, 936.860089156893, 922.376363123921,
909.301601087255, 949.125313633903, 983.891808931205, 928.514242776379,
931.528375870523, 934.663002673557, 983.163630767407, 958.520107194186,
1028.60002280789, 1027.26325499148, 1026.49504978946, 904.375575893285,
912.523756638651, 919.179127414697, 913.641605762865, 905.043751380124,
918.017612913947, 966.955539088111, 1083.03489991906, 982.779995986195,
913.039005945342, 901.569366267589, 924.344189118069, 986.456388413752,
1053.70140237407, 1012.4655295529, 918.216939699045, 924.376017342816,
912.32335834515, 962.020663167786, 968.751653626515, 923.781426521514,
934.702280304594, 945.072040784087, 972.171048113648, 980.160384144599,
1029.12422797868, 1045.60159108586, 1069.71097019503, 904.989955563463,
911.137606736246, 913.282276988181, 911.62618760385, 904.022814213797,
917.471586361699, 969.239603596626, 1092.64417075988, 995.598256664543,
911.352468377778, 903.930535551161, 934.598647851096, 968.529282541217,
1014.22774561852, 992.123001836286, 955.008951781314, 928.638327604534,
930.057703919378, 979.117036821698, 961.435436233545, 927.430280788518,
933.188144311621, 938.849731346915, 975.793676023678, 984.576641002029,
953.148108722352, 1025.14511979605, 987.536969976085, 904.469118373204,
919.724696002539, 921.494112907094, 933.99081130992, 910.883621211755,
919.830805764804, 973.217375644616, 1097.82345512272, 955.321702833728,
914.950887550846, 907.869650845588, 930.21996042144, 988.365255219924,
1072.82537699421, 941.505101156388, 912.978755227237, 924.00211814663,
926.073413421038, 975.963524978988, 966.347030574186, 927.813889117707,
938.87057229942, 937.20592642584, 1049.77079831674, 993.369595475566,
941.988672609005, 1036.52896057029, 1025.79874961742, 909.778142305324,
926.05520033663, 930.593948095488, 927.731349235947, 909.012240248148,
918.177023640935, 965.119279536339, 1100.04708794994, 950.187396378294,
913.95540287581, 908.285198789598, 928.585928045517, 1009.11449170465,
1048.43494462072, 1070.81842375631, 919.615682872958, 927.180388372158,
911.229890874478, 979.675336133848, 975.987038362197, 936.015685237366,
944.935422587313, 934.084922337254, 1065.1158215132, 960.558846324124,
954.324007605299, 1036.19891812821, 1000.52619841385, 904.622130948163,
911.66456482634, 952.40730926852, 925.617846758624, 907.103270618455,
921.775155162068, 962.660086144894, 1089.5423829539, 976.343009650736,
917.002530477079, 905.207509685187, 920.30422426818, 985.37894037379,
1032.27384329955, 974.803996932782)), class = "data.frame", row.names = c(85L,
86L, 87L, 89L, 90L, 91L, 99L, 100L, 101L, 103L, 104L, 105L, 113L,
114L, 115L, 117L, 118L, 119L, 127L, 128L, 129L, 131L, 132L, 133L,
141L, 142L, 143L, 145L, 146L, 147L, 155L, 156L, 157L, 159L, 160L,
161L, 169L, 170L, 171L, 173L, 174L, 175L, 183L, 184L, 185L, 187L,
188L, 189L, 197L, 198L, 199L, 201L, 202L, 203L, 211L, 212L, 213L,
215L, 216L, 217L, 225L, 226L, 227L, 229L, 230L, 231L, 239L, 240L,
241L, 243L, 244L, 245L, 253L, 254L, 255L, 257L, 258L, 259L, 267L,
268L, 269L, 271L, 272L, 273L, 615L, 616L, 617L, 619L, 620L, 622L,
623L, 624L, 626L, 627L, 629L, 630L, 631L, 640L, 641L, 642L, 643L,
644L, 645L, 647L, 648L, 649L, 651L, 652L, 653L, 655L, 656L, 657L,
659L, 660L, 661L, 663L, 664L, 666L, 667L, 668L, 670L, 671L, 673L,
674L, 675L, 684L, 685L, 686L, 687L, 688L, 689L, 691L, 692L, 693L,
695L, 696L, 697L, 699L, 700L, 701L, 703L, 704L, 705L, 707L, 708L,
710L, 711L, 712L, 714L, 715L, 717L, 718L, 719L, 728L, 729L, 730L,
731L, 732L, 733L, 735L, 736L, 737L, 739L, 740L, 741L, 743L, 744L,
745L, 747L, 748L, 749L, 751L, 752L, 754L, 755L, 756L, 758L, 759L,
761L, 762L, 763L, 772L, 773L, 774L, 775L, 776L, 777L, 779L, 780L,
781L, 783L, 784L, 785L, 787L, 788L, 789L, 791L, 792L, 793L, 795L,
796L, 798L, 799L, 800L, 802L, 803L, 805L, 806L, 807L, 816L, 817L,
818L, 819L, 820L, 821L, 823L, 824L, 825L, 827L, 828L, 829L, 831L,
832L, 833L, 835L, 836L, 837L, 839L, 840L, 842L, 843L, 844L, 846L,
847L, 849L, 850L, 851L, 860L, 861L, 862L, 863L, 864L, 865L, 867L,
868L, 869L, 871L, 872L, 873L, 875L, 876L, 877L, 879L, 880L, 881L,
883L, 884L, 886L, 887L, 888L, 890L, 891L, 893L, 894L, 895L, 904L,
905L, 906L, 907L, 908L, 909L, 911L, 912L, 913L, 915L, 916L, 917L,
919L, 920L, 921L, 923L, 924L, 925L, 927L, 928L, 930L, 931L, 932L,
934L, 935L, 937L, 938L, 939L, 948L, 949L, 950L, 951L, 952L, 953L,
955L, 956L, 957L, 959L, 960L, 961L, 963L, 964L, 965L, 967L, 968L,
969L, 971L, 972L, 974L, 975L, 976L, 978L, 979L, 981L, 982L, 983L,
992L, 993L, 994L, 995L, 996L, 997L, 999L, 1000L, 1001L, 1003L,
1004L, 1005L, 1007L, 1008L, 1009L, 1011L, 1012L, 1013L, 1015L,
1016L, 1018L, 1019L, 1020L, 1022L, 1023L, 1025L, 1026L, 1027L,
1036L, 1037L, 1038L, 1039L, 1040L, 1041L, 1043L, 1044L, 1045L,
1047L, 1048L, 1049L, 1051L, 1052L, 1053L, 1055L, 1056L, 1057L,
1059L, 1060L, 1062L, 1063L, 1064L, 1066L, 1067L, 1069L, 1070L,
1071L, 1080L, 1081L, 1082L, 1083L, 1084L, 1085L, 1087L, 1088L,
1089L, 1091L, 1092L, 1093L, 1095L, 1096L, 1097L, 1099L, 1100L,
1101L, 1103L, 1104L, 1106L, 1107L, 1108L, 1110L, 1111L, 1113L,
1114L, 1115L, 1124L, 1125L, 1126L, 1127L, 1128L, 1129L, 1131L,
1132L, 1133L, 1135L, 1136L, 1137L, 1139L, 1140L, 1141L, 1143L,
1144L, 1145L, 1147L, 1148L, 1150L, 1151L, 1152L, 1154L, 1155L,
1157L, 1158L, 1159L, 1168L, 1169L, 1170L, 1171L, 1172L, 1173L,
1175L, 1176L, 1177L, 1179L, 1180L, 1181L, 1183L, 1184L, 1185L,
1187L, 1188L, 1189L, 1191L, 1192L, 1194L, 1195L, 1196L, 1198L,
1199L, 1201L, 1202L, 1203L, 1212L, 1213L, 1214L, 1215L, 1216L,
1217L, 1219L, 1220L, 1221L, 1223L, 1224L, 1225L, 1227L, 1228L,
1229L))
Here is the code (I think) that would be needed to fit the model and see the summary after the above data is loaded:
library(lme4)
library(lmerTest)
fit1 <- lmer(Values ~ stimuli + timeperiod + scale(poly(distance.code,3,raw=FALSE))*habitat + wind.speed + (1|location.code), data=df, REML=FALSE)
fit2 <- lmer(Values ~ stimuli + timeperiod + distance.code + habitat + wind.speed + (1|location.code), data=ex.df, REML=FALSE)
summary(fit1)
#or
summary(fit2)
I think this has to do with my data structure and the programming but if it is actually something to do with the stats I am happy to take this post down and re-post over at the stats stackexchange.
Thanks for any help!
note: although your question is about the lmer() function, this answer also applies to lm() and other R functions that fit linear models.
The way that coefficient estimates from linear models in R are presented can be confusing. To understand what's going on, you need to understand how R fits linear models when the predictor is a factor variable.
Coefficients on factor variables in R linear models
Before we look at factor variables, let's look at the more straightforward situation where the predictor is continuous. In your example dataset, one of the predictors is wind speed (continuous variable). The estimated coefficient is about -0.35. It's easy to interpret this: averaged across the other predictors, for every increase of 1 km/h in wind speed, your response value is predicted to decrease by 0.35.
But what about if the predictor is a factor? A categorical variable cannot increase or decrease by 1. Instead it can take several discrete values. So what the lmer() or lm() function does by default is automatically code your factor variable as a set of so-called "dummy variables." Dummy variables are binary (they can take values of 0 or 1). If the factor variable has n levels, you need n-1 dummy variables to encode it. The reference level or control group acts like an intercept.
In the case of your habitat variable, there are only 2 levels so you have only 1 dummy variable which will be 0 if habitat is not Forest and 1 if it is Forest. Now we can interpret the coefficient estimate of -68.8: the average value of your response is expected to be 68.8 less in forest habitat relative to the reference level of grassland habitat. You don't need a second dummy variable for grassland because you only need to estimate the one coefficient to compare the two habitats.
If you had a third habitat, let's say wetland, there would be a second dummy variable that would be 0 if not wetland and 1 if wetland. The coefficient estimate there would be the expected difference between the value of the response variable in wetland habitat compared to grassland habitat. Grassland will be the reference level for all the coefficients.
Default setting of reference level
Now to directly address your question of why habitatForest is the coefficient name.
Because by default no reference level or control group is specified, the first one in the factor level ordering becomes the reference level to which all other levels are compared. Then the coefficients are named by appending the variable's name to the name of the level being compared to the reference level. Your factor is ordered with grassland first and forest second. So the coefficient is the effect of the habitat being forest habitat, compared to the reference level, which is grassland in this case. If you switched the habitat factor level ordering, Forest would be the reference level and you would get habitatGrassland as the coefficient instead. (Note that default factor level ordering is alphabetical, so without specifically ordering the factor levels as you seem to have done, Forest would be the reference level by default).
Incidentally, the two links you give in your question (guides to mixed models from Phillip Alday and Tufts) do in fact have the same kind of output as you are getting. For example in Alday's tutorial, the factor recipe has 3 levels: A, B, and C. There are two coefficients in the fixed effects summary, recipeB and recipeC, just as you would expect from dummy coding using A as reference level. You may be confusing the fixed effects summary with the ANOVA table presented elsewhere in his post. The ANOVA table does only have a single line for recipe which gives you the ratio of variance due to recipe (across all its levels) and the total variance. So that would only be one ratio regardless of how many levels recipe has.
Further reading
This is not the place for a full discussion of contrast coding in linear models in R. The dummy coding (which you may also see called one-hot encoding) I described here is just one way to do it. These resources may be helpful:
Documentation for the base R function contrasts()
description of different types of categorical variable coding in R from UCLA IDRE Stats
Marissa Barlaz' tutorial on R contrast coding
Related
I am using the lme4 package and running a linear mixed model but I am confused but the output and expect that I am encountering an error even though I do not get an error message.
The basic issue is when I fit a model like lmer(Values ~ stimuli + timeperiod + scale(poly(distance.code,3,raw=FALSE))*habitat + wind.speed + (1|location.code), data=df, REML=FALSE)
and then look at the results using something like summary I see all the model fixed (and random) effects as I would expect however the habitat effect is always displayed as habitatForest. Like this:
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) 996.63179 8.16633 31.22730 122.042 < 2e-16 ***
stimuliBHCO -3.57541 1.28877 8750.89273 -2.774 0.005544 **
stimuliCOHA -10.17037 1.29546 8754.17156 -7.851 4.62e-15 ***
timeperiod 0.19900 0.05516 8744.95307 3.608 0.000310 ***
scale(poly(distance.code, 3, raw = FALSE))1 -3.87613 0.71431 8745.70773 -5.426 5.90e-08 ***
scale(poly(distance.code, 3, raw = FALSE))2 2.65854 0.71463 8745.19353 3.720 0.000200 ***
scale(poly(distance.code, 3, raw = FALSE))3 4.66340 0.72262 8745.67948 6.453 1.15e-10 ***
habitatForest -68.82430 11.83009 29.95226 -5.818 2.34e-06 ***
wind.speed -0.35853 0.07631 8403.15191 -4.698 2.66e-06 ***
scale(poly(distance.code, 3, raw = FALSE))1:habitatForest 2.89860 1.03891 8745.46534 2.790 0.005282 **
scale(poly(distance.code, 3, raw = FALSE))2:habitatForest -3.49758 1.03829 8745.11371 -3.369 0.000759 ***
scale(poly(distance.code, 3, raw = FALSE))3:habitatForest -4.67300 1.03913 8745.30579 -4.497 6.98e-06 ***
---
This is happening even though there are two levels of habitat (Forest and Grassland)
at first, I thought this might be because my model had an interaction term but it happens when I try a simpler model like lmer(Values ~ stimuli + timeperiod + distance.code + habitat + wind.speed + (1|location.code), data=ex.df, REML=FALSE)
Why would it say "habitatForest" and not just "habitat" or if it were going to include a factor by name why not say "habitatForest" and "habitatGrassland"?
A quick look at the expected output from this function here: https://rpubs.com/palday/mixed-interactions or here: https://ase.tufts.edu/bugs/guide/assets/mixed_model_guide.html (among others)
shows that the out put that I am getting is not what is expected or normal.
Other output I have seen simply have factors with two levels, like mine, as a single line (eg habitat).
Here is a portion of the data I am using. I used dput and subseting to produce this. I couldn't figure out how to make the data set smaller and still reproduce the error so I apologize if this is too large. The data set that it comes from is MUCH bigger! (also please let me know if I have used dput incorrectly.(Still new to R and stackoverflow)
structure(list(location.code = structure(c(1L, 1L, 1L, 2L, 2L,
2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2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 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L,
30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L, 0L, 60L, 0L, 30L, 60L,
0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L, 60L, 0L, 30L,
60L), stimuli = structure(c(3L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L,
2L, 2L, 2L, 3L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L, 2L, 2L, 2L, 3L,
3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L, 2L, 2L,
2L, 3L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L,
2L, 2L, 2L, 3L, 3L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0.8, 0.2,
0.2, 0.2, 0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 0.8, 0.8, 0.8, 0.2, 0.2,
0.2, 65, 65, 65, 65, 65, 55, 55, 55, 50, 50, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0.9, 0.9, 0.9, 65, 65, 65, 65, 65,
55, 55, 55, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0.9, 0.9, 0.9, 65, 65, 65, 65, 65, 55, 55, 55, 50, 50, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.9, 0.9, 0.9, 65,
65, 65, 65, 65, 55, 55, 55, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0.9, 0.9, 0.9, 65, 65, 65, 65, 65, 55, 55,
55, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.9,
0.9, 0.9, 65, 65, 65, 65, 65, 55, 55, 55, 50, 50, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.9, 0.9, 0.9, 65, 65, 65, 65,
65, 55, 55, 55, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0.9, 0.9, 0.9, 65, 65, 65, 65, 65, 55, 55, 55, 50, 50,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.9, 0.9, 0.9, 65,
65, 65, 65, 65, 55, 55, 55, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0.9, 0.9, 0.9, 65, 65, 65, 65, 65, 55, 55,
55, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.9,
0.9, 0.9, 65, 65, 65, 65, 65, 55, 55, 55, 50, 50, 0, 0, 0, 0,
0,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L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 11L,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 15L,
15L, 15L, 15L, 15L, 15L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L,
17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L, 17L,
17L, 17L, 17L, 17L, 17L, 17L, 17L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 19L, 20L, 20L, 20L, 20L,
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L,
20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 21L, 21L,
21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L,
21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L, 21L,
22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L,
22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 22L,
22L, 22L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L,
23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L, 23L,
23L, 23L, 23L, 23L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L,
24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L, 24L,
24L, 24L, 24L, 24L, 24L, 24L), Values = c(910.721895276374, 922.652711611841,
926.219785713456, 1030.28919690464, 1121.98321368732, 992.741416151102,
910.878353926705, 920.201901019659, 922.134996121665, 992.059286431433,
1042.05240231832, 1018.99804250179, 911.976009884021, 918.215389274037,
931.037495260958, 981.032280455129, 983.700699744073, 989.716307418049,
911.476759038955, 918.554393750162, 920.391856289719, 994.583211567691,
1006.58290843226, 1005.52479816571, 908.665064025178, 917.940176257067,
922.746174825048, 986.419049170517, 1042.41789735969, 1082.89658057517,
916.02310296116, 918.254868924698, 931.01648294424, 982.154409713674,
1008.54477137219, 996.577798511801, 912.914857937818, 916.937508116615,
920.933077377339, 997.669828575817, 1007.44452218386, 1151.25894192961,
909.463528658898, 915.293665875472, 921.917039784441, 983.866984633392,
1002.04551764872, 986.791628665069, 907.695668282537, 917.845214744473,
932.330755620455, 972.609449456089, 1155.55960936774, 1083.40557091613,
909.903267624225, 914.846316952797, 921.279328283221, 1000.3672969178,
1021.78461788922, 1011.40975353271, 915.037273600535, 914.099859036178,
924.116937361394, 994.428182266452, 1123.09745015276, 1004.1485272116,
914.431649376896, 915.27037594587, 929.411251949862, 974.273124973661,
1145.99211507205, 1013.58184367388, 913.467056616881, 920.213007520924,
919.794369158301, 983.816025282468, 1103.11322201674, 974.792027063404,
910.532609655114, 917.616832229923, 923.462599912213, 1015.24811721269,
1070.61183211249, 1016.57332551186, 910.196695694198, 923.403802532832,
905.400995326023, 1036.98011238981, 963.147077473505, 916.899569521736,
931.240844862156, 919.11781354823, 995.408916523572, 960.825305234446,
1026.22960551445, 1000.13773127026, 962.347584090332, 904.090295814044,
908.836747102913, 928.867625382891, 918.100799763641, 906.282906701285,
913.146312873635, 977.094140033575, 972.599778534534, 964.658406857446,
921.91272768213, 910.507770576621, 942.269786765654, 1014.34022271036,
1128.29327664605, 1043.1365958913, 919.185972424773, 925.486310755197,
908.769520270226, 1030.20866627018, 956.104935565803, 922.01947330213,
934.451182538208, 928.626906337293, 986.326936258622, 1003.40797963907,
1021.91264348048, 995.68658929192, 993.102343807935, 901.633626404701,
908.255562868123, 922.840049924103, 917.012733437446, 907.541530752433,
915.050696506642, 983.542956895186, 972.236377246083, 965.082329354352,
918.337944633569, 910.137012141557, 952.89462134025, 977.420371016686,
1154.17994731565, 1022.82998099991, 927.061613377597, 926.745527716988,
908.284054932259, 966.157586219165, 974.986841619676, 916.559494755925,
935.817296050643, 918.835719171662, 1023.62078549133, 1009.23121097376,
1005.81651905991, 981.715747809821, 953.127134375762, 902.809201411559,
907.462229880533, 921.595454423298, 919.198277947855, 904.969515265664,
913.438353334218, 974.889830301362, 970.58615968713, 963.029605541189,
915.889893279581, 908.147726780027, 942.742415528349, 979.939535179807,
1153.51966568673, 1020.93502990084, 916.246150801212, 936.016759720656,
914.4488779132, 962.397352323664, 986.957848140285, 985.364195731404,
932.548910038465, 917.363220594089, 1085.89850605988, 1031.66330597084,
1005.64983154588, 991.988118229379, 975.384741587994, 902.60240793926,
907.989086075871, 923.287310593779, 912.878571722023, 904.107623756648,
905.563259817979, 991.530368160932, 975.190212414434, 965.951810135591,
915.334621878897, 910.857441830446, 936.093336975328, 972.074491630181,
1106.77459226532, 993.45400883741, 951.911391767329, 927.688604859773,
915.194279622847, 971.414103170297, 956.138106650696, 965.458656222347,
944.097918792458, 947.157460200658, 1029.14870726558, 992.151638322899,
954.129642526236, 981.48182339388, 968.10870393618, 906.941701681267,
917.956716926981, 923.05649603805, 934.459432014683, 922.801034508827,
920.724850575215, 981.478432929603, 1012.67364507927, 966.471299899978,
912.640460101352, 906.34455384334, 923.738349342148, 970.987788560016,
1210.42940542072, 975.753397539076, 911.747488522664, 928.34872697947,
910.852487444859, 982.304620375747, 1028.52794775628, 913.408967803895,
934.334726415048, 916.354017093653, 1036.08727658415, 974.408618327141,
1004.71633485176, 995.142763465394, 987.00017276687, 906.86826042139,
915.355833226192, 930.395950341189, 911.742114273539, 905.725754800821,
912.194776217353, 979.488696998854, 998.766511802223, 968.436523426865,
916.299279627464, 907.645161223541, 925.30056793674, 978.067851389738,
1142.91274685359, 1001.53234105611, 916.842758017232, 924.907983103717,
922.470305986631, 992.855613565408, 955.757560902304, 929.20232030375,
943.535934437766, 923.58180450271, 1035.68330820385, 962.09501965608,
1035.71434011945, 999.021624049638, 1037.74929152155, 904.65540329816,
907.898446182233, 915.586965865012, 912.540978342886, 904.648950841522,
910.146698786639, 970.655222414677, 969.045225438776, 961.588678057607,
922.252864714149, 904.866433981365, 921.496292021655, 971.871605044557,
1075.02261709497, 1018.63215987506, 925.837889075039, 937.313874872585,
919.393974179406, 984.865480173384, 998.38173566307, 923.591922218561,
935.764591123357, 914.144404904734, 1064.07484543951, 1009.55385037395,
1003.07982307794, 1019.96770677478, 1023.43370663799, 1075.23648079772,
918.40638740207, 930.381596850856, 911.431923384541, 908.158538518039,
913.917742396318, 972.975539521988, 969.261073622988, 966.900828461146,
912.922987528198, 906.204515258546, 917.349668426986, 965.167090686302,
1033.80724280751, 1019.96323854891, 923.466492256566, 923.247012056591,
911.896005256495, 983.55323734271, 987.195939413696, 948.013535459932,
946.283282150572, 946.996017019961, 1018.55920835599, 983.790383328001,
1044.1241515621, 1025.44806232873, 1013.07125415424, 936.438305947314,
914.845558304809, 919.627558974215, 912.08306092659, 905.506361055768,
925.863591354922, 980.84672626416, 1034.50509678374, 999.432501149952,
914.013428128551, 903.385280147577, 914.982720974316, 987.521728519027,
1026.27371444455, 1003.6659923071, 936.860089156893, 922.376363123921,
909.301601087255, 949.125313633903, 983.891808931205, 928.514242776379,
931.528375870523, 934.663002673557, 983.163630767407, 958.520107194186,
1028.60002280789, 1027.26325499148, 1026.49504978946, 904.375575893285,
912.523756638651, 919.179127414697, 913.641605762865, 905.043751380124,
918.017612913947, 966.955539088111, 1083.03489991906, 982.779995986195,
913.039005945342, 901.569366267589, 924.344189118069, 986.456388413752,
1053.70140237407, 1012.4655295529, 918.216939699045, 924.376017342816,
912.32335834515, 962.020663167786, 968.751653626515, 923.781426521514,
934.702280304594, 945.072040784087, 972.171048113648, 980.160384144599,
1029.12422797868, 1045.60159108586, 1069.71097019503, 904.989955563463,
911.137606736246, 913.282276988181, 911.62618760385, 904.022814213797,
917.471586361699, 969.239603596626, 1092.64417075988, 995.598256664543,
911.352468377778, 903.930535551161, 934.598647851096, 968.529282541217,
1014.22774561852, 992.123001836286, 955.008951781314, 928.638327604534,
930.057703919378, 979.117036821698, 961.435436233545, 927.430280788518,
933.188144311621, 938.849731346915, 975.793676023678, 984.576641002029,
953.148108722352, 1025.14511979605, 987.536969976085, 904.469118373204,
919.724696002539, 921.494112907094, 933.99081130992, 910.883621211755,
919.830805764804, 973.217375644616, 1097.82345512272, 955.321702833728,
914.950887550846, 907.869650845588, 930.21996042144, 988.365255219924,
1072.82537699421, 941.505101156388, 912.978755227237, 924.00211814663,
926.073413421038, 975.963524978988, 966.347030574186, 927.813889117707,
938.87057229942, 937.20592642584, 1049.77079831674, 993.369595475566,
941.988672609005, 1036.52896057029, 1025.79874961742, 909.778142305324,
926.05520033663, 930.593948095488, 927.731349235947, 909.012240248148,
918.177023640935, 965.119279536339, 1100.04708794994, 950.187396378294,
913.95540287581, 908.285198789598, 928.585928045517, 1009.11449170465,
1048.43494462072, 1070.81842375631, 919.615682872958, 927.180388372158,
911.229890874478, 979.675336133848, 975.987038362197, 936.015685237366,
944.935422587313, 934.084922337254, 1065.1158215132, 960.558846324124,
954.324007605299, 1036.19891812821, 1000.52619841385, 904.622130948163,
911.66456482634, 952.40730926852, 925.617846758624, 907.103270618455,
921.775155162068, 962.660086144894, 1089.5423829539, 976.343009650736,
917.002530477079, 905.207509685187, 920.30422426818, 985.37894037379,
1032.27384329955, 974.803996932782)), class = "data.frame", row.names = c(85L,
86L, 87L, 89L, 90L, 91L, 99L, 100L, 101L, 103L, 104L, 105L, 113L,
114L, 115L, 117L, 118L, 119L, 127L, 128L, 129L, 131L, 132L, 133L,
141L, 142L, 143L, 145L, 146L, 147L, 155L, 156L, 157L, 159L, 160L,
161L, 169L, 170L, 171L, 173L, 174L, 175L, 183L, 184L, 185L, 187L,
188L, 189L, 197L, 198L, 199L, 201L, 202L, 203L, 211L, 212L, 213L,
215L, 216L, 217L, 225L, 226L, 227L, 229L, 230L, 231L, 239L, 240L,
241L, 243L, 244L, 245L, 253L, 254L, 255L, 257L, 258L, 259L, 267L,
268L, 269L, 271L, 272L, 273L, 615L, 616L, 617L, 619L, 620L, 622L,
623L, 624L, 626L, 627L, 629L, 630L, 631L, 640L, 641L, 642L, 643L,
644L, 645L, 647L, 648L, 649L, 651L, 652L, 653L, 655L, 656L, 657L,
659L, 660L, 661L, 663L, 664L, 666L, 667L, 668L, 670L, 671L, 673L,
674L, 675L, 684L, 685L, 686L, 687L, 688L, 689L, 691L, 692L, 693L,
695L, 696L, 697L, 699L, 700L, 701L, 703L, 704L, 705L, 707L, 708L,
710L, 711L, 712L, 714L, 715L, 717L, 718L, 719L, 728L, 729L, 730L,
731L, 732L, 733L, 735L, 736L, 737L, 739L, 740L, 741L, 743L, 744L,
745L, 747L, 748L, 749L, 751L, 752L, 754L, 755L, 756L, 758L, 759L,
761L, 762L, 763L, 772L, 773L, 774L, 775L, 776L, 777L, 779L, 780L,
781L, 783L, 784L, 785L, 787L, 788L, 789L, 791L, 792L, 793L, 795L,
796L, 798L, 799L, 800L, 802L, 803L, 805L, 806L, 807L, 816L, 817L,
818L, 819L, 820L, 821L, 823L, 824L, 825L, 827L, 828L, 829L, 831L,
832L, 833L, 835L, 836L, 837L, 839L, 840L, 842L, 843L, 844L, 846L,
847L, 849L, 850L, 851L, 860L, 861L, 862L, 863L, 864L, 865L, 867L,
868L, 869L, 871L, 872L, 873L, 875L, 876L, 877L, 879L, 880L, 881L,
883L, 884L, 886L, 887L, 888L, 890L, 891L, 893L, 894L, 895L, 904L,
905L, 906L, 907L, 908L, 909L, 911L, 912L, 913L, 915L, 916L, 917L,
919L, 920L, 921L, 923L, 924L, 925L, 927L, 928L, 930L, 931L, 932L,
934L, 935L, 937L, 938L, 939L, 948L, 949L, 950L, 951L, 952L, 953L,
955L, 956L, 957L, 959L, 960L, 961L, 963L, 964L, 965L, 967L, 968L,
969L, 971L, 972L, 974L, 975L, 976L, 978L, 979L, 981L, 982L, 983L,
992L, 993L, 994L, 995L, 996L, 997L, 999L, 1000L, 1001L, 1003L,
1004L, 1005L, 1007L, 1008L, 1009L, 1011L, 1012L, 1013L, 1015L,
1016L, 1018L, 1019L, 1020L, 1022L, 1023L, 1025L, 1026L, 1027L,
1036L, 1037L, 1038L, 1039L, 1040L, 1041L, 1043L, 1044L, 1045L,
1047L, 1048L, 1049L, 1051L, 1052L, 1053L, 1055L, 1056L, 1057L,
1059L, 1060L, 1062L, 1063L, 1064L, 1066L, 1067L, 1069L, 1070L,
1071L, 1080L, 1081L, 1082L, 1083L, 1084L, 1085L, 1087L, 1088L,
1089L, 1091L, 1092L, 1093L, 1095L, 1096L, 1097L, 1099L, 1100L,
1101L, 1103L, 1104L, 1106L, 1107L, 1108L, 1110L, 1111L, 1113L,
1114L, 1115L, 1124L, 1125L, 1126L, 1127L, 1128L, 1129L, 1131L,
1132L, 1133L, 1135L, 1136L, 1137L, 1139L, 1140L, 1141L, 1143L,
1144L, 1145L, 1147L, 1148L, 1150L, 1151L, 1152L, 1154L, 1155L,
1157L, 1158L, 1159L, 1168L, 1169L, 1170L, 1171L, 1172L, 1173L,
1175L, 1176L, 1177L, 1179L, 1180L, 1181L, 1183L, 1184L, 1185L,
1187L, 1188L, 1189L, 1191L, 1192L, 1194L, 1195L, 1196L, 1198L,
1199L, 1201L, 1202L, 1203L, 1212L, 1213L, 1214L, 1215L, 1216L,
1217L, 1219L, 1220L, 1221L, 1223L, 1224L, 1225L, 1227L, 1228L,
1229L))
Here is the code (I think) that would be needed to fit the model and see the summary after the above data is loaded:
library(lme4)
library(lmerTest)
fit1 <- lmer(Values ~ stimuli + timeperiod + scale(poly(distance.code,3,raw=FALSE))*habitat + wind.speed + (1|location.code), data=df, REML=FALSE)
fit2 <- lmer(Values ~ stimuli + timeperiod + distance.code + habitat + wind.speed + (1|location.code), data=ex.df, REML=FALSE)
summary(fit1)
#or
summary(fit2)
I think this has to do with my data structure and the programming but if it is actually something to do with the stats I am happy to take this post down and re-post over at the stats stackexchange.
Thanks for any help!
note: although your question is about the lmer() function, this answer also applies to lm() and other R functions that fit linear models.
The way that coefficient estimates from linear models in R are presented can be confusing. To understand what's going on, you need to understand how R fits linear models when the predictor is a factor variable.
Coefficients on factor variables in R linear models
Before we look at factor variables, let's look at the more straightforward situation where the predictor is continuous. In your example dataset, one of the predictors is wind speed (continuous variable). The estimated coefficient is about -0.35. It's easy to interpret this: averaged across the other predictors, for every increase of 1 km/h in wind speed, your response value is predicted to decrease by 0.35.
But what about if the predictor is a factor? A categorical variable cannot increase or decrease by 1. Instead it can take several discrete values. So what the lmer() or lm() function does by default is automatically code your factor variable as a set of so-called "dummy variables." Dummy variables are binary (they can take values of 0 or 1). If the factor variable has n levels, you need n-1 dummy variables to encode it. The reference level or control group acts like an intercept.
In the case of your habitat variable, there are only 2 levels so you have only 1 dummy variable which will be 0 if habitat is not Forest and 1 if it is Forest. Now we can interpret the coefficient estimate of -68.8: the average value of your response is expected to be 68.8 less in forest habitat relative to the reference level of grassland habitat. You don't need a second dummy variable for grassland because you only need to estimate the one coefficient to compare the two habitats.
If you had a third habitat, let's say wetland, there would be a second dummy variable that would be 0 if not wetland and 1 if wetland. The coefficient estimate there would be the expected difference between the value of the response variable in wetland habitat compared to grassland habitat. Grassland will be the reference level for all the coefficients.
Default setting of reference level
Now to directly address your question of why habitatForest is the coefficient name.
Because by default no reference level or control group is specified, the first one in the factor level ordering becomes the reference level to which all other levels are compared. Then the coefficients are named by appending the variable's name to the name of the level being compared to the reference level. Your factor is ordered with grassland first and forest second. So the coefficient is the effect of the habitat being forest habitat, compared to the reference level, which is grassland in this case. If you switched the habitat factor level ordering, Forest would be the reference level and you would get habitatGrassland as the coefficient instead. (Note that default factor level ordering is alphabetical, so without specifically ordering the factor levels as you seem to have done, Forest would be the reference level by default).
Incidentally, the two links you give in your question (guides to mixed models from Phillip Alday and Tufts) do in fact have the same kind of output as you are getting. For example in Alday's tutorial, the factor recipe has 3 levels: A, B, and C. There are two coefficients in the fixed effects summary, recipeB and recipeC, just as you would expect from dummy coding using A as reference level. You may be confusing the fixed effects summary with the ANOVA table presented elsewhere in his post. The ANOVA table does only have a single line for recipe which gives you the ratio of variance due to recipe (across all its levels) and the total variance. So that would only be one ratio regardless of how many levels recipe has.
Further reading
This is not the place for a full discussion of contrast coding in linear models in R. The dummy coding (which you may also see called one-hot encoding) I described here is just one way to do it. These resources may be helpful:
Documentation for the base R function contrasts()
description of different types of categorical variable coding in R from UCLA IDRE Stats
Marissa Barlaz' tutorial on R contrast coding
I am trying to use the effects package to create plots of effects in a linear mixed model. I specify the model
fit1 <- lmer(Values ~ stimuli + timeperiod + scale(poly(distance.code,3,raw=FALSE))*habitat + wind.speed + (1|location.code), data=ex.df, REML=FALSE)
For this model I can generate results for analysis as I expect using summary or anova but when I try to look at specific effects:
allEffects(fit1)
#or
plot(allEffects(fit1))
#or
emmeans(fit1, pairwise ~ stimuli)
An error is returned:
Error in poly(distance.code, 3, raw = FALSE) :
'degree' must be less than number of unique points
(with the plot function the error is different but is probably arising from the error with allEffects)
I understand, based on the responses to this question and this question, that "numerical overflow" can be an issue with poly terms. However, I am not clear on what this means or how to overcome the issue.
I also saw in this post and in another post about lme4 that I can no longer find, that I might need to update packages so I have updated 'effects' and 'lme4' in an attempt to remedy this but to no avail.
So if this error is happening because of "numerical overflow" how can I remedy the problem? or if it is not numerical overflow what is happening and how can I work around this?
a subset of my data using dput is:
structure(list(location.code = structure(c(1L, 1L, 1L, 1L, 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L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 11L,
11L, 11L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 13L, 13L), distance.code = c(0L, 30L, 60L,
120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L,
60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L,
30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L, 30L, 60L,
0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L, 30L,
60L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L,
30L, 60L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L,
0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L,
120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L, 60L, 120L, 0L, 30L,
60L, 120L, 0L, 60L, 120L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L,
30L, 60L, 120L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 120L, 0L, 30L,
60L, 120L, 0L, 30L, 60L, 120L, 0L, 60L, 120L, 0L, 30L, 60L, 120L,
0L, 60L, 120L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L,
120L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 120L,
0L, 30L, 60L, 120L, 0L, 60L, 120L, 0L, 30L, 60L, 120L, 0L, 60L,
120L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L,
30L, 60L, 120L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 120L, 0L, 30L,
60L, 120L, 0L, 60L, 120L, 0L, 30L, 60L, 120L, 0L, 60L, 120L,
0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L, 30L,
60L, 120L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 120L, 0L, 30L, 60L,
120L, 0L, 60L, 120L, 0L, 30L, 60L, 120L, 0L, 60L, 120L, 0L, 30L,
60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 120L,
0L, 30L, 60L, 120L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 120L, 0L,
60L, 120L, 0L, 30L, 60L, 120L, 0L, 60L, 120L, 0L, 30L, 60L),
Values = c(910.721895276374, 922.652711611841, 926.219785713456,
918.776924477918, 1030.28919690464, 1121.98321368732, 992.741416151102,
910.878353926705, 920.201901019659, 922.134996121665, 917.610324052986,
992.059286431433, 1042.05240231832, 1018.99804250179, 911.976009884021,
918.215389274037, 931.037495260958, 913.49701806948, 981.032280455129,
983.700699744073, 989.716307418049, 911.476759038955, 918.554393750162,
920.391856289719, 911.795802370903, 994.583211567691, 1006.58290843226,
1005.52479816571, 908.665064025178, 917.940176257067, 922.746174825048,
921.752449434568, 986.419049170517, 1042.41789735969, 1082.89658057517,
916.02310296116, 918.254868924698, 931.01648294424, 924.221021573334,
982.154409713674, 1008.54477137219, 996.577798511801, 912.914857937818,
916.937508116615, 920.933077377339, 917.443294381608, 997.669828575817,
1007.44452218386, 1151.25894192961, 909.463528658898, 915.293665875472,
921.917039784441, 912.073280663674, 983.866984633392, 1002.04551764872,
986.791628665069, 907.695668282537, 917.845214744473, 932.330755620455,
917.500330773026, 972.609449456089, 1155.55960936774, 1083.40557091613,
909.903267624225, 914.846316952797, 921.279328283221, 914.498616645498,
1000.3672969178, 1021.78461788922, 1011.40975353271, 915.037273600535,
914.099859036178, 924.116937361394, 913.523739017819, 994.428182266452,
1123.09745015276, 1004.1485272116, 914.431649376896, 915.27037594587,
929.411251949862, 910.549315840806, 974.273124973661, 1145.99211507205,
1013.58184367388, 913.467056616881, 920.213007520924, 919.794369158301,
912.333012054637, 983.816025282468, 1103.11322201674, 974.792027063404,
910.532609655114, 917.616832229923, 923.462599912213, 913.432298686233,
1015.24811721269, 1070.61183211249, 1016.57332551186, 910.196695694198,
923.403802532832, 905.400995326023, 934.612035397761, 1036.98011238981,
963.147077473505, 953.792949959199, 916.899569521736, 931.240844862156,
919.11781354823, 938.028220926723, 995.408916523572, 960.825305234446,
993.019295484939, 1026.22960551445, 1000.13773127026, 962.347584090332,
1074.31979099791, 904.090295814044, 908.836747102913, 928.867625382891,
918.100799763641, 906.282906701285, 913.146312873635, 921.224088728859,
977.094140033575, 972.599778534534, 964.658406857446, 1197.35130424458,
921.91272768213, 910.507770576621, 942.269786765654, 922.718235872787,
1014.34022271036, 1128.29327664605, 1043.1365958913, 1238.18704569961,
919.185972424773, 925.486310755197, 908.769520270226, 919.644447501213,
1030.20866627018, 956.104935565803, 955.159231718685, 922.01947330213,
934.451182538208, 928.626906337293, 941.089746683706, 986.326936258622,
1003.40797963907, 1007.57786522109, 1021.91264348048, 995.68658929192,
993.102343807935, 1114.80420865448, 901.633626404701, 908.255562868123,
922.840049924103, 917.012733437446, 907.541530752433, 915.050696506642,
925.95358291661, 983.542956895186, 972.236377246083, 965.082329354352,
1205.36753472358, 918.337944633569, 910.137012141557, 952.89462134025,
923.334999242316, 977.420371016686, 1154.17994731565, 1022.82998099991,
1186.66254220951, 927.061613377597, 926.745527716988, 908.284054932259,
921.213190559531, 966.157586219165, 974.986841619676, 959.421220417498,
916.559494755925, 935.817296050643, 918.835719171662, 912.457217113586,
1023.62078549133, 1009.23121097376, 978.938675917385, 1005.81651905991,
981.715747809821, 953.127134375762, 1088.16577366048, 902.809201411559,
907.462229880533, 921.595454423298, 919.198277947855, 904.969515265664,
913.438353334218, 918.91715550342, 974.889830301362, 970.58615968713,
963.029605541189, 1182.94093491074, 915.889893279581, 908.147726780027,
942.742415528349, 928.20319656241, 979.939535179807, 1153.51966568673,
1020.93502990084, 1154.799618481, 916.246150801212, 936.016759720656,
914.4488779132, 918.823772018551, 962.397352323664, 986.957848140285,
972.131488585193, 985.364195731404, 932.548910038465, 917.363220594089,
919.124801182577, 1085.89850605988, 1031.66330597084, 974.763804119707,
1005.64983154588, 991.988118229379, 975.384741587994, 1064.14809010237,
902.60240793926, 907.989086075871, 923.287310593779, 912.878571722023,
904.107623756648, 905.563259817979, 917.423553921906, 991.530368160932,
975.190212414434, 965.951810135591, 1192.3330908297, 915.334621878897,
910.857441830446, 936.093336975328, 932.960789822422, 972.074491630181,
1106.77459226532, 993.45400883741, 1138.94109332484, 951.911391767329,
927.688604859773, 915.194279622847, 920.98264624041, 971.414103170297,
956.138106650696, 969.385400747507, 965.458656222347, 944.097918792458,
947.157460200658, 915.929397317864, 1029.14870726558, 992.151638322899,
964.680220137879, 954.129642526236, 981.48182339388, 968.10870393618,
1097.48462256339, 906.941701681267, 917.956716926981, 923.05649603805,
934.459432014683, 922.801034508827, 920.724850575215, 935.811146196027,
981.478432929603, 1012.67364507927, 966.471299899978, 1192.4066704659,
912.640460101352, 906.34455384334, 923.738349342148, 916.883929696437,
970.987788560016, 1210.42940542072, 975.753397539076, 1138.97675920151,
911.747488522664, 928.34872697947, 910.852487444859, 916.227875349016,
982.304620375747, 1028.52794775628, 999.236663664046, 913.408967803895,
934.334726415048, 916.354017093653, 918.660674732388, 1036.08727658415,
974.408618327141, 1006.21629092128, 1004.71633485176, 995.142763465394,
987.00017276687), wind.speed = c(0.8, 0.8, 0.8, 0.8, 0.2,
0.2, 0.2, 0.8, 0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 0.8, 0.8, 0.8,
0.8, 0.2, 0.2, 0.2, 0.8, 0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 0.8,
0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 0.8, 0.8, 0.8, 0.8, 0.2, 0.2,
0.2, 0.8, 0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 0.8, 0.8, 0.8, 0.8,
0.2, 0.2, 0.2, 0.8, 0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 0.8, 0.8,
0.8, 0.8, 0.2, 0.2, 0.2, 0.8, 0.8, 0.8, 0.8, 0.2, 0.2, 0.2,
0.8, 0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 0.8, 0.8, 0.8, 0.8, 0.2,
0.2, 0.2, 0.8, 0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 65, 65, 65,
65, 65, 65, 65, 55, 55, 55, 55, 50, 50, 50, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.9, 0.9, 0.9,
0.9, 65, 65, 65, 65, 65, 65, 65, 55, 55, 55, 55, 50, 50,
50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0.9, 0.9, 0.9, 0.9, 65, 65, 65, 65, 65, 65, 65, 55, 55,
55, 55, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0.9, 0.9, 0.9, 0.9, 65, 65, 65, 65, 65,
65, 65, 55, 55, 55, 55, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.9, 0.9, 0.9, 0.9, 65,
65, 65, 65, 65, 65, 65, 55, 55, 55, 55, 50, 50, 50, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.9, 0.9,
0.9, 0.9, 65, 65, 65, 65, 65, 65, 65, 55, 55, 55, 55, 50,
50, 50, 0, 0, 0)), row.names = c(85L, 86L, 87L, 88L, 89L,
90L, 91L, 99L, 100L, 101L, 102L, 103L, 104L, 105L, 113L, 114L,
115L, 116L, 117L, 118L, 119L, 127L, 128L, 129L, 130L, 131L, 132L,
133L, 141L, 142L, 143L, 144L, 145L, 146L, 147L, 155L, 156L, 157L,
158L, 159L, 160L, 161L, 169L, 170L, 171L, 172L, 173L, 174L, 175L,
183L, 184L, 185L, 186L, 187L, 188L, 189L, 197L, 198L, 199L, 200L,
201L, 202L, 203L, 211L, 212L, 213L, 214L, 215L, 216L, 217L, 225L,
226L, 227L, 228L, 229L, 230L, 231L, 239L, 240L, 241L, 242L, 243L,
244L, 245L, 253L, 254L, 255L, 256L, 257L, 258L, 259L, 267L, 268L,
269L, 270L, 271L, 272L, 273L, 615L, 616L, 617L, 618L, 619L, 620L,
621L, 622L, 623L, 624L, 625L, 626L, 627L, 628L, 629L, 630L, 631L,
632L, 640L, 641L, 642L, 643L, 644L, 645L, 646L, 647L, 648L, 649L,
650L, 651L, 652L, 653L, 654L, 655L, 656L, 657L, 658L, 659L, 660L,
661L, 662L, 663L, 664L, 665L, 666L, 667L, 668L, 669L, 670L, 671L,
672L, 673L, 674L, 675L, 676L, 684L, 685L, 686L, 687L, 688L, 689L,
690L, 691L, 692L, 693L, 694L, 695L, 696L, 697L, 698L, 699L, 700L,
701L, 702L, 703L, 704L, 705L, 706L, 707L, 708L, 709L, 710L, 711L,
712L, 713L, 714L, 715L, 716L, 717L, 718L, 719L, 720L, 728L, 729L,
730L, 731L, 732L, 733L, 734L, 735L, 736L, 737L, 738L, 739L, 740L,
741L, 742L, 743L, 744L, 745L, 746L, 747L, 748L, 749L, 750L, 751L,
752L, 753L, 754L, 755L, 756L, 757L, 758L, 759L, 760L, 761L, 762L,
763L, 764L, 772L, 773L, 774L, 775L, 776L, 777L, 778L, 779L, 780L,
781L, 782L, 783L, 784L, 785L, 786L, 787L, 788L, 789L, 790L, 791L,
792L, 793L, 794L, 795L, 796L, 797L, 798L, 799L, 800L, 801L, 802L,
803L, 804L, 805L, 806L, 807L, 808L, 816L, 817L, 818L, 819L, 820L,
821L, 822L, 823L, 824L, 825L, 826L, 827L, 828L, 829L, 830L, 831L,
832L, 833L, 834L, 835L, 836L, 837L, 838L, 839L, 840L, 841L, 842L,
843L, 844L, 845L, 846L, 847L, 848L, 849L, 850L, 851L), class = "data.frame")
> ex.df <- head(ex.df, 100)
> dput(ex.df)
structure(list(location.code = structure(c(1L, 1L, 1L, 1L, 2L,
2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L,
1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L,
1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L,
1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 1L), .Label = c("BSF1",
"BSG1", "RLF3", "RLG3", "CCBSF1", "CCBSG1", "CPF1", "CPF2", "CPG1",
"CPG2", "OSG1", "OSG2", "RLF4", "RLF5", "RLF1", "RLF2", "RLG1",
"RLG2", "BNPF1", "BNPG1", "OSG3", "OSF1", "CMG3", "CMF1", "BSG2",
"BSG3", "WSF1", "WSF2", "HPG1", "HPG2"), class = "factor"), stimuli = structure(c(3L,
3L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L,
3L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 2L,
2L, 2L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 2L, 2L, 2L,
3L, 3L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 3L, 3L,
3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L, 3L,
2L, 2L, 2L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 2L, 2L,
2L, 1L, 1L), .Label = c("FOSP", "BHCO", "COHA", "YEWA", "TUTI"
), class = "factor"), habitat = structure(c(2L, 2L, 2L, 2L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L,
1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L,
2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 2L, 2L), .Label = c("Grassland",
"Forest"), class = "factor"), exp.period = structure(c(1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
1L, 1L), .Label = c("before", "during", "after"), class = "factor"),
timeperiod = c(6L, 6L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L,
7L, 7L, 7L, 8L, 8L, 8L, 8L, 8L, 8L, 8L, 9L, 9L, 9L, 9L, 9L,
9L, 9L, 11L, 11L, 11L, 11L, 11L, 11L, 11L, 13L, 13L, 13L,
13L, 13L, 13L, 13L, 15L, 15L, 15L, 15L, 15L, 15L, 15L, 17L,
17L, 17L, 17L, 17L, 17L, 17L, 19L, 19L, 19L, 19L, 19L, 19L,
19L, 20L, 20L, 20L, 20L, 20L, 20L, 20L, 21L, 21L, 21L, 21L,
21L, 21L, 21L, 22L, 22L, 22L, 22L, 22L, 22L, 22L, 23L, 23L,
23L, 23L, 23L, 23L, 23L, 24L, 24L, 24L, 24L, 24L, 24L, 24L,
6L, 6L), distance.code = c(0L, 30L, 60L, 120L, 0L, 30L, 60L,
0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L,
30L, 60L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L,
120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L,
30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L, 30L,
60L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L,
0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L,
60L, 120L, 0L, 30L, 60L, 0L, 30L, 60L, 120L, 0L, 30L, 60L,
0L, 30L, 60L, 120L, 0L, 30L, 60L, 0L, 30L), Values = c(910.721895276374,
922.652711611841, 926.219785713456, 918.776924477918, 1030.28919690464,
1121.98321368732, 992.741416151102, 910.878353926705, 920.201901019659,
922.134996121665, 917.610324052986, 992.059286431433, 1042.05240231832,
1018.99804250179, 911.976009884021, 918.215389274037, 931.037495260958,
913.49701806948, 981.032280455129, 983.700699744073, 989.716307418049,
911.476759038955, 918.554393750162, 920.391856289719, 911.795802370903,
994.583211567691, 1006.58290843226, 1005.52479816571, 908.665064025178,
917.940176257067, 922.746174825048, 921.752449434568, 986.419049170517,
1042.41789735969, 1082.89658057517, 916.02310296116, 918.254868924698,
931.01648294424, 924.221021573334, 982.154409713674, 1008.54477137219,
996.577798511801, 912.914857937818, 916.937508116615, 920.933077377339,
917.443294381608, 997.669828575817, 1007.44452218386, 1151.25894192961,
909.463528658898, 915.293665875472, 921.917039784441, 912.073280663674,
983.866984633392, 1002.04551764872, 986.791628665069, 907.695668282537,
917.845214744473, 932.330755620455, 917.500330773026, 972.609449456089,
1155.55960936774, 1083.40557091613, 909.903267624225, 914.846316952797,
921.279328283221, 914.498616645498, 1000.3672969178, 1021.78461788922,
1011.40975353271, 915.037273600535, 914.099859036178, 924.116937361394,
913.523739017819, 994.428182266452, 1123.09745015276, 1004.1485272116,
914.431649376896, 915.27037594587, 929.411251949862, 910.549315840806,
974.273124973661, 1145.99211507205, 1013.58184367388, 913.467056616881,
920.213007520924, 919.794369158301, 912.333012054637, 983.816025282468,
1103.11322201674, 974.792027063404, 910.532609655114, 917.616832229923,
923.462599912213, 913.432298686233, 1015.24811721269, 1070.61183211249,
1016.57332551186, 910.196695694198, 923.403802532832), wind.speed = c(0.8,
0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 0.8, 0.8, 0.8, 0.8, 0.2, 0.2,
0.2, 0.8, 0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 0.8, 0.8, 0.8, 0.8,
0.2, 0.2, 0.2, 0.8, 0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 0.8, 0.8,
0.8, 0.8, 0.2, 0.2, 0.2, 0.8, 0.8, 0.8, 0.8, 0.2, 0.2, 0.2,
0.8, 0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 0.8, 0.8, 0.8, 0.8, 0.2,
0.2, 0.2, 0.8, 0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 0.8, 0.8, 0.8,
0.8, 0.2, 0.2, 0.2, 0.8, 0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 0.8,
0.8, 0.8, 0.8, 0.2, 0.2, 0.2, 0.8, 0.8, 0.8, 0.8, 0.2, 0.2,
0.2, 65, 65)), row.names = c(85L, 86L, 87L, 88L, 89L, 90L,
91L, 99L, 100L, 101L, 102L, 103L, 104L, 105L, 113L, 114L, 115L,
116L, 117L, 118L, 119L, 127L, 128L, 129L, 130L, 131L, 132L, 133L,
141L, 142L, 143L, 144L, 145L, 146L, 147L, 155L, 156L, 157L, 158L,
159L, 160L, 161L, 169L, 170L, 171L, 172L, 173L, 174L, 175L, 183L,
184L, 185L, 186L, 187L, 188L, 189L, 197L, 198L, 199L, 200L, 201L,
202L, 203L, 211L, 212L, 213L, 214L, 215L, 216L, 217L, 225L, 226L,
227L, 228L, 229L, 230L, 231L, 239L, 240L, 241L, 242L, 243L, 244L,
245L, 253L, 254L, 255L, 256L, 257L, 258L, 259L, 267L, 268L, 269L,
270L, 271L, 272L, 273L, 615L, 616L), class = "data.frame")
Thanks for any help!
EDIT!!
I ran terms(fit1) as suggested in the comments, the results were as follows:
terms(fit1)
Values ~ stimuli + timeperiod + scale(poly(distance.code, 3,
raw = FALSE)) * habitat + wind.speed
attr(,"variables")
list(Values, stimuli, timeperiod, scale(poly(distance.code, 3,
raw = FALSE)), habitat, wind.speed)
attr(,"factors")
stimuli timeperiod scale(poly(distance.code, 3, raw = FALSE)) habitat wind.speed
Values 0 0 0 0 0
stimuli 1 0 0 0 0
timeperiod 0 1 0 0 0
scale(poly(distance.code, 3, raw = FALSE)) 0 0 1 0 0
habitat 0 0 0 1 0
wind.speed 0 0 0 0 1
scale(poly(distance.code, 3, raw = FALSE)):habitat
Values 0
stimuli 0
timeperiod 0
scale(poly(distance.code, 3, raw = FALSE)) 1
habitat 1
wind.speed 0
attr(,"term.labels")
[1] "stimuli" "timeperiod"
[3] "scale(poly(distance.code, 3, raw = FALSE))" "habitat"
[5] "wind.speed" "scale(poly(distance.code, 3, raw = FALSE)):habitat"
attr(,"order")
[1] 1 1 1 1 1 2
attr(,"intercept")
[1] 1
attr(,"response")
[1] 1
attr(,".Environment")
<environment: R_GlobalEnv>
attr(,"predvars")
list(Values, stimuli, timeperiod, scale(poly(distance.code, 3,
raw = FALSE)), habitat, wind.speed)
Here is a simple parallel example illustrating that wrapping poly() in scale() is the culprit:
> library(emmeans)
> mod1 = lm(mpg ~ am + poly(disp, 3), data = mtcars)
> ref_grid(mod1)
'emmGrid' object with variables:
am = 0, 1
disp = 230.72
> mod2 = lm(mpg ~ am + scale(poly(disp, 3)), data = mtcars)
> ref_grid(mod2)
Error in poly(disp, 3) :
'degree' must be less than number of unique points
Specifically, the call to scale() messes up the predvars attribute in the model's terms component:
> attr(terms(mod1), "predvars")
list(mpg, am, poly(disp, 3, coefs = list(alpha = c(230.721875,
279.549822668452, 298.198735227759), norm2 = c(1, 32, 476184.7946875,
5315202742.2241, 64139299346388.8))))
This provides the coefficients needed to construct the orthogonal polynomial basis; whereas...
> attr(terms(mod2), "predvars")
list(mpg, am, scale(poly(disp, 3)))
That information is excluded.
Note that the scale() call is completely unnecessary anyway, as poly() generates an orthonormal matrix of predictors.
I managed to create a faceted boxplot with my 2 quantitative variables;
I know how to run a kruskal-wallis followed by a Wilcoxon test and show the significant differences with letters in the boxplot but only in a simple boxplot, with one variable and without facet. How can I do ?
(If possible, I would like to put the siginificant differences with letters, I wish I would be able to post the pictures of what I already done but apparently I'm not allowed)
Also, I have another question; Which test does the function stat_function_mean execute ? I tried to use this function, but I don't know how to use it... Here is my code without the test, only the facetted boxplot with my two variables :
Code for my facet boxplot with 2 measured variables ( FF and FM)
dat.m2 <- melt(pheno,id.vars=c("fusion","Genotype","Hormone"),
measure.vars=c('FF','MF'))
dat.m2$fusion<-factor(dat.m2$fusion, levels=c("Control", "CK 20 mg/L", "CK 100 mg/L", "CK 500 mg/L", "GA 20 mg/L", "GA 100 mg/L", "GA 500 mg/L"))
levels(dat.m2$fusion)
ggplot(dat.m2) +
geom_boxplot(aes(x=fusion, y=value, colour=variable))+
facet_wrap(~Genotype)+
xlab(" ")+
ylab("Days after sowing")
Code to add significant differences on the graph, with letters, but with only 1 measured variable (FF), without facet
mymat <-tri.to.squ(pp$p.value)
mymat
myletters <- multcompLetters(mymat,compare="<=",threshold=0.05,Letters=letters)
myletters
myletters_df <- data.frame(fusion=names(myletters$Letters),letter = myletters$Letters )
myletters_df
ggplot(pheno, aes(x=fusion, y=FF, colour=fusion))+
geom_boxplot()+
geom_text(data = myletters_df, aes(label = letter, y = 30 ), colour="black", size=5)+
ylab("Days after sowing")+
xlab("")+
labs(title="Days to female flower production")+
theme(plot.title = element_text(hjust = 0.5))+
> dput(pheno)
structure(list(Genotype = structure(c(2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L,
3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L,
3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L), .Label = c("F1045",
"FF", "M1585", "M1610"), class = "factor"), X = structure(c(1L,
105L, 116L, 127L, 138L, 149L, 160L, 171L, 182L, 2L, 13L, 24L,
35L, 46L, 57L, 68L, 79L, 90L, 101L, 106L, 107L, 108L, 109L, 110L,
111L, 112L, 113L, 114L, 115L, 117L, 118L, 119L, 120L, 121L, 122L,
123L, 124L, 125L, 126L, 128L, 129L, 130L, 131L, 132L, 133L, 134L,
135L, 136L, 137L, 139L, 140L, 141L, 142L, 143L, 144L, 145L, 146L,
147L, 148L, 150L, 151L, 152L, 153L, 154L, 155L, 156L, 157L, 158L,
159L, 161L, 162L, 163L, 164L, 165L, 166L, 167L, 168L, 169L, 170L,
172L, 173L, 174L, 175L, 176L, 177L, 178L, 179L, 180L, 181L, 183L,
184L, 185L, 186L, 187L, 188L, 189L, 190L, 191L, 192L, 3L, 4L,
5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 14L, 15L, 16L, 17L, 18L, 19L,
20L, 21L, 22L, 23L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L,
34L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 47L, 48L,
49L, 50L, 51L, 52L, 53L, 54L, 55L, 56L, 58L, 59L, 60L, 61L, 62L,
63L, 64L, 65L, 66L, 67L, 69L, 70L, 71L, 72L, 73L, 74L, 75L, 76L,
77L, 78L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 89L, 91L,
92L, 93L, 94L, 95L, 96L, 97L, 98L, 99L, 100L, 102L, 103L, 104L
), .Label = c("H1", "H10", "H100", "H101", "H102", "H103", "H104",
"H105", "H106", "H107", "H108", "H109", "H11", "H110", "H111",
"H112", "H113", "H114", "H115", "H116", "H117", "H118", "H119",
"H12", "H120", "H121", "H122", "H123", "H124", "H125", "H126",
"H127", "H128", "H129", "H13", "H130", "H131", "H132", "H133",
"H134", "H135", "H136", "H137", "H138", "H139", "H14", "H140",
"H141", "H142", "H143", "H144", "H145", "H146", "H147", "H148",
"H149", "H15", "H150", "H151", "H152", "H153", "H154", "H155",
"H156", "H157", "H158", "H159", "H16", "H160", "H161", "H162",
"H163", "H164", "H165", "H166", "H167", "H168", "H169", "H17",
"H170", "H171", "H172", "H173", "H174", "H175", "H176", "H177",
"H178", "H179", "H18", "H180", "H181", "H182", "H183", "H184",
"H185", "H186", "H187", "H188", "H189", "H19", "H190", "H191",
"H192", "H2", "H20", "H21", "H22", "H23", "H24", "H25", "H26",
"H27", "H28", "H29", "H3", "H30", "H31", "H32", "H33", "H34",
"H35", "H36", "H37", "H38", "H39", "H4", "H40", "H41", "H42",
"H43", "H44", "H45", "H46", "H47", "H48", "H49", "H5", "H50",
"H51", "H52", "H53", "H54", "H55", "H56", "H57", "H58", "H59",
"H6", "H60", "H61", "H62", "H63", "H64", "H65", "H66", "H67",
"H68", "H69", "H7", "H70", "H71", "H72", "H73", "H74", "H75",
"H76", "H77", "H78", "H79", "H8", "H80", "H81", "H82", "H83",
"H84", "H85", "H86", "H87", "H88", "H89", "H9", "H90", "H91",
"H92", "H93", "H94", "H95", "H96", "H97", "H98", "H99"), class = "factor"),
Hormone = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3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L,
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L,
1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L,
2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 6L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 8L, 4L, 6L, 6L, 6L, 4L, 3L, 4L, 4L, 3L,
4L, 3L, 3L, 3L, 3L, 6L, 6L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 4L, 3L, 4L, 3L, 3L, 3L, 4L, 3L, 6L, 6L, 8L, 6L, 4L, 4L,
4L, 8L, 4L, 4L, 2L, 3L, 3L, 3L, 3L, 6L, 3L, 5L, 4L, 5L, 5L,
4L, 3L), .Label = c("16-apr", "17-apr", "18-apr", "19-apr",
"21-mei", "23-apr", "26-apr", "30-apr"), class = "factor"),
ff = structure(c(14L, 20L, 4L, 10L, 20L, 3L, 1L, 14L, 9L,
11L, 20L, 11L, 9L, 9L, 9L, 11L, 12L, 12L, 6L, 12L, 12L, 16L,
12L, 12L, 17L, 17L, 12L, 16L, 17L, 18L, 12L, 6L, 20L, 20L,
15L, 15L, 15L, 20L, 20L, 11L, 11L, 11L, 9L, 9L, 9L, 9L, 20L,
20L, 20L, 4L, 1L, 4L, 4L, 4L, 8L, 20L, 4L, 20L, 12L, 4L,
14L, 14L, 11L, 11L, 15L, 15L, 11L, 11L, 9L, 15L, 9L, 9L,
11L, 11L, 14L, 1L, 5L, 4L, 4L, 20L, 20L, 20L, 20L, 20L, 20L,
20L, 20L, 20L, 15L, 15L, 14L, 13L, 15L, 15L, 11L, 9L, 9L,
11L, 9L, 11L, 1L, 20L, 1L, 20L, 20L, 20L, 20L, 1L, 1L, 4L,
20L, 20L, 20L, 15L, 15L, 14L, 15L, 1L, 15L, 15L, 20L, 11L,
11L, 11L, 11L, 15L, 10L, 10L, 16L, 10L, 12L, 10L, 17L, 8L,
16L, 12L, 8L, 4L, 4L, 8L, 20L, 10L, 1L, 20L, NA, 12L, 10L,
20L, 20L, 20L, 1L, 20L, 1L, 20L, 12L, 16L, 12L, 2L, 8L, 4L,
10L, 4L, 4L, 4L, 10L, 8L, 4L, 8L, 20L, 20L, 20L, NA, 20L,
1L, 20L, 1L, 8L, 20L, 1L, 1L, 7L, 17L, 19L, 19L, 12L, 10L,
12L, 19L, 10L, 10L, 10L, 17L), .Label = c("10-mei", "13-jun",
"14-apr", "14-mei", "17-mei", "18-jun", "21-jun", "21-mei",
"23-apr", "24-mei", "26-apr", "28-mei", "3-apr", "3-mei",
"30-apr", "31-mei", "4-jun", "5-jul", "7-jun", "7-mei"), class = "factor"),
FH = c(3.5, 6, 9, 16, 5.5, 12, 11.5, 4, 4.5, 6, 8, 5, 4.5,
3.5, 4, 5, 20, 42, 14, 40, 27, 42, 27, 26, 16, 18, 35, 17,
20, 28, 15, 20, 33, 32, 14.5, 14.5, 14.5, 35, 32, 12.5, 13.5,
12, 14.5, 12, 15, 14.5, 18, 18, 18.5, 35, 23, 25, 30, 37,
53, 27.5, 37, 25.5, 35, 47, 8.5, 20.5, 13, 14.5, 13.5, 18.5,
10.5, 10, 14.3, 18.5, 15.3, 11.7, 16, 15, 13.5, 26, 36, 30,
43, 23.5, 23.5, 31.5, 29, 30.5, 30, 29, 30, 24.5, 19, 23,
21.5, 26.5, 18.5, 20, 15, 12.3, 17, 12, 15, 13, 43614, 25,
27, 22.5, 35, 23.5, 30, 42, 42, 55, 32.5, 26, 26, 9.5, 4.5,
5.5, 5, 15.5, 10, 4.5, 8.5, 6, 5, 5.5, 5, 4.5, 30, 20, 16,
16, 20, 22, 30, 22, 25, 11, 13.5, 11, 11, 14, 6, NA, 5.5,
7, NA, 12, 14, 7, 9.5, 6.5, 9, 8.5, 12.5, 8, 27, 33, 35,
32, 17, 14, 22, 11, 17, 12, 25, 22, 15, 10, 5, 3, 4, NA,
5, 8, 4.5, 6, 7, 5, 5.5, 7, 42, 23, 23, 21, 14, 21, 17, 22,
19, 18, 17, 17), SRDT = structure(c(2L, 7L, 14L, NA, 7L,
8L, 7L, NA, NA, NA, 3L, NA, 18L, 15L, 17L, 17L, 18L, 18L,
NA, 18L, 15L, 17L, 15L, 20L, 2L, NA, 11L, 17L, 18L, 2L, 2L,
2L, 14L, 12L, 17L, 15L, 12L, 9L, 9L, 6L, 6L, 15L, 15L, 15L,
15L, NA, 17L, 15L, 10L, 11L, 11L, 10L, 11L, 17L, 5L, 21L,
6L, NA, 20L, 5L, 12L, 7L, NA, 17L, 17L, 15L, 15L, 10L, 10L,
6L, 10L, 10L, 21L, NA, 15L, 15L, 5L, 15L, 15L, 11L, 10L,
21L, 1L, 21L, 21L, 21L, 1L, 5L, 18L, 2L, 9L, 9L, NA, 12L,
10L, NA, 16L, 6L, 6L, 15L, 6L, 10L, 10L, 10L, 1L, 10L, 1L,
21L, 21L, 1L, 21L, 5L, 18L, 2L, 17L, 20L, 9L, 14L, 5L, 9L,
9L, 11L, NA, 18L, 10L, 18L, 20L, 4L, 9L, 7L, 2L, 2L, 7L,
5L, 17L, 17L, 11L, 10L, 12L, 2L, 14L, 19L, 19L, 19L, NA,
NA, 2L, 11L, 17L, 14L, 17L, 9L, 10L, 10L, 2L, 7L, 17L, 14L,
2L, 11L, 20L, 2L, 15L, 15L, 11L, 5L, NA, 10L, NA, 2L, 8L,
NA, NA, 14L, 5L, 15L, 15L, NA, 22L, NA, 9L, 9L, 19L, 9L,
9L, 22L, 20L, 13L, 7L, 20L, 15L, 20L), .Label = c("10-mei",
"11-jun", "13-jun", "13-mei", "14-mei", "17-mei", "18-jun",
"2-jul", "21-jun", "21-mei", "24-mei", "25-jun", "26-jun",
"28-jun", "28-mei", "3-mei", "31-mei", "4-jun", "5-jul",
"7-jun", "7-mei", "9-jul"), class = "factor"), MH = c(26,
50, 58, NA, 46, 58, 61, NA, NA, NA, 40, NA, 68, 48, 47, 42,
26, 50, NA, 48, 27, 42, 27, 48, 25, NA, 25, 17, 20, 18, 32,
19, 75, 75, 65, 70, 73, 73, 71, 65, 70, 60, 80, 70, 70, NA,
54, 45, 45, 45, 45, 40, 49, 53, 45, 27.5, 44, NA, NA, 47,
47, 62, NA, 75, 60, 75, 70, 65, 80, 67, 80, 75, 52, NA, 67,
68, 26, 55, 60, 60, 60, 31.5, 39, 30.5, 30, 29, 39, 39, 86,
74, 80, 76, NA, 69, 80, NA, 44, 70, 70, 65, 43, 60, 57, 57,
45, 60, 39, 35, 32.5, 27, 32.5, 43, 70, 75, 60, 66, 58, 48,
41, NA, 44, 42, NA, 44, 39, 40, 48, 53, 50, 50, 45, 45, 50,
13, 25, 11, 21, 20.5, 46, 44, 54, 25, 20, 25, NA, NA, 28,
33, 36, 40, 21, 36, 23.5, 21, 44, 60, 37, 37, 55, 24, 45,
45, 35, 30, 25, 12, 27, 10, NA, 53, 35, NA, NA, 43, 11, 13,
7, NA, 22, NA, 42, 46, NA, 41, 43, 40, 26, 45, 35, 29, 17,
22), SEEDT = structure(c(2L, 4L, 9L, NA, 4L, 5L, 4L, NA,
NA, NA, 4L, NA, 12L, 11L, 11L, 11L, 4L, 3L, NA, 4L, 15L,
4L, 8L, 5L, 7L, NA, 2L, 2L, 8L, 13L, 8L, NA, 13L, 8L, 15L,
15L, 8L, 7L, 7L, 10L, 10L, 11L, 6L, 10L, 10L, NA, 3L, 11L,
12L, 12L, 12L, 12L, 4L, 4L, 12L, 12L, 12L, NA, 9L, 12L, NA,
4L, NA, 2L, 15L, 2L, 15L, 14L, 10L, 12L, 12L, 11L, 11L, NA,
2L, 12L, 8L, 3L, 15L, 11L, 11L, 10L, 10L, 10L, 10L, 10L,
10L, 10L, 2L, 2L, 7L, 7L, NA, 8L, 10L, NA, 10L, 10L, 10L,
15L, 10L, 12L, 12L, 10L, 11L, 11L, 10L, 10L, 10L, 11L, 10L,
11L, 12L, 2L, 12L, 4L, 7L, 9L, 10L, 7L, 7L, 10L, NA, 12L,
10L, 15L, 2L, 4L, 8L, 8L, 4L, 4L, 13L, 12L, NA, NA, 4L, 7L,
NA, 7L, 13L, 13L, 13L, NA, NA, NA, 2L, 2L, NA, NA, NA, 8L,
NA, NA, 4L, 4L, 2L, NA, 4L, 2L, 7L, 7L, 7L, 2L, 2L, 15L,
1L, 15L, NA, 2L, 5L, NA, NA, 5L, 13L, NA, NA, NA, NA, NA,
16L, 16L, 13L, 16L, 7L, 1L, 7L, 16L, 7L, 7L, 7L, NA), .Label = c("11-jul",
"11-jun", "13-jun", "18-jun", "2-jul", "20-mei", "21-jun",
"25-jun", "28-jun", "28-mei", "31-mei", "4-jun", "5-jul",
"6-apr", "7-jun", "9-jul"), class = "factor"), FERMK = c(7L,
8L, 8L, 7L, 8L, 8L, 8L, 4L, NA, NA, 5L, 7L, 7L, 6L, 7L, 6L,
4L, 6L, NA, 4L, 3L, 4L, 4L, 4L, 2L, NA, 2L, 2L, 2L, 1L, 2L,
2L, 8L, 6L, 6L, 6L, 7L, 7L, 7L, 6L, 6L, 7L, 7L, 6L, 4L, 6L,
6L, 5L, 6L, 5L, 5L, 6L, 5L, 4L, 2L, 5L, NA, NA, 4L, 2L, 5L,
5L, NA, 7L, 7L, 8L, 6L, 6L, 7L, NA, 7L, 7L, 6L, 5L, 5L, 5L,
4L, 4L, 6L, 7L, 6L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 8L, 7L, 7L,
7L, 7L, 7L, 7L, NA, 7L, 7L, 7L, 7L, 5L, 5L, 4L, 5L, 6L, 4L,
6L, 2L, 2L, 2L, 5L, 4L, 7L, 6L, 8L, 7L, 6L, 6L, 8L, 7L, 7L,
7L, 7L,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,
43L, 50L, 60L, 43L, 20L, 46L, 39L, 29L, 32L, 43L, 32L, 29L,
29L, 29L, 32L, 64L, 64L, 85L, 64L, 64L, 67L, 64L, 64L, 71L,
71L, 64L, 67L, 71L, 102L, 64L, 85L, 43L, 43L, 36L, 36L, 36L,
43L, 43L, 32L, 32L, 32L, 29L, 29L, 29L, 29L, 43L, 43L, 43L,
50L, 46L, 50L, 50L, 50L, 57L, 43L, 50L, 43L, 64L, 50L, 39L,
39L, 32L, 32L, 36L, 36L, 32L, 32L, 29L, 36L, 29L, 29L, 32L,
32L, 39L, 46L, 53L, 50L, 50L, 43L, 43L, 43L, 43L, 43L, 43L,
43L, 43L, 43L, 36L, 36L, 39L, 9L, 36L, 36L, 32L, 29L, 29L,
32L, 29L, 32L, 46L, 43L, 46L, 43L, 43L, 43L, 43L, 46L, 46L,
50L, 43L, 43L, 43L, 36L, 36L, 39L, 36L, 46L, 36L, 36L, 43L,
32L, 32L, 32L, 32L, 36L, 60L, 60L, 67L, 60L, 64L, 60L, 71L,
57L, 67L, 64L, 57L, 50L, 50L, 57L, 43L, 60L, 46L, 43L, NA,
64L, 60L, 43L, 43L, 43L, 46L, 43L, 46L, 43L, 64L, 67L, 64L,
80L, 57L, 50L, 60L, 50L, 50L, 50L, 60L, 57L, 50L, 57L, 43L,
43L, 43L, NA, 43L, 46L, 43L, 46L, 57L, 43L, 46L, 46L, 88L,
71L, 74L, 74L, 64L, 60L, 64L, 74L, 60L, 60L, 60L, 71L), MF = c(78L,
85L, 95L, NA, 85L, 99L, 85L, NA, NA, NA, 80L, NA, 71L, 64L,
67L, 67L, 71L, 71L, NA, 71L, 64L, 67L, 64L, 74L, 78L, NA,
60L, 67L, 71L, 78L, 78L, 78L, 95L, 92L, 67L, 64L, 92L, 88L,
88L, 53L, 53L, 64L, 64L, 64L, 64L, NA, 67L, 64L, 57L, 60L,
60L, 57L, 60L, 67L, 50L, 43L, 53L, NA, 74L, 50L, 92L, 85L,
NA, 67L, 67L, 64L, 64L, 57L, 57L, 53L, 57L, 57L, 43L, NA,
64L, 64L, 50L, 64L, 64L, 60L, 57L, 43L, 46L, 43L, 43L, 43L,
46L, 50L, 71L, 78L, 88L, 88L, NA, 92L, 57L, NA, 39L, 53L,
53L, 64L, 53L, 57L, 57L, 57L, 46L, 57L, 46L, 43L, 43L, 46L,
43L, 50L, 71L, 78L, 67L, 74L, 88L, 95L, 50L, 88L, 88L, 60L,
NA, 71L, 57L, 71L, 74L, 49L, 88L, 85L, 78L, 78L, 85L, 50L,
67L, 67L, 60L, 57L, 92L, 78L, 95L, 102L, 102L, 102L, NA,
NA, 78L, 60L, 67L, 95L, 67L, 88L, 57L, 57L, 78L, 85L, 67L,
95L, 78L, 60L, 74L, 78L, 64L, 64L, 60L, 50L, NA, 57L, NA,
78L, 99L, NA, NA, 95L, 50L, 64L, 64L, NA, 106L, NA, 88L,
88L, 102L, 88L, 88L, 106L, 74L, 93L, 85L, 74L, 64L, 74L),
speed = c(0.08974359, 0.139534884, 0.18, 0.266666667, 0.127906977,
0.6, 0.25, 0.102564103, 0.155172414, 0.1875, 0.186046512,
0.15625, 0.155172414, 0.120689655, 0.137931034, 0.15625,
0.3125, 0.65625, 0.164705882, 0.625, 0.421875, 0.626865672,
0.421875, 0.40625, 0.225352113, 0.253521127, 0.546875, 0.253731343,
0.281690141, 0.274509804, 0.234375, 0.235294118, 0.76744186,
0.744186047, 0.402777778, 0.402777778, 0.402777778, 0.813953488,
0.744186047, 0.390625, 0.421875, 0.375, 0.5, 0.413793103,
0.517241379, 0.5, 0.418604651, 0.418604651, 0.430232558,
0.7, 0.5, 0.5, 0.6, 0.74, 0.929824561, 0.639534884, 0.74,
0.593023256, 0.546875, 0.94, 0.217948718, 0.525641026, 0.40625,
0.453125, 0.375, 0.513888889, 0.328125, 0.3125, 0.493103448,
0.513888889, 0.527586207, 0.403448276, 0.5, 0.46875, 0.346153846,
0.565217391, 0.679245283, 0.6, 0.86, 0.546511628, 0.546511628,
0.73255814, 0.674418605, 0.709302326, 0.697674419, 0.674418605,
0.697674419, 0.569767442, 0.527777778, 0.638888889, 0.551282051,
2.944444444, 0.513888889, 0.555555556, 0.46875, 0.424137931,
0.586206897, 0.375, 0.517241379, 0.40625, 948.1304348, 0.581395349,
0.586956522, 0.523255814, 0.813953488, 0.546511628, 0.697674419,
0.913043478, 0.913043478, 1.1, 0.755813953, 0.604651163,
0.604651163, 0.263888889, 0.125, 0.141025641, 0.138888889,
0.336956522, 0.277777778, 0.125, 0.197674419, 0.1875, 0.15625,
0.171875, 0.15625, 0.125, 0.5, 0.333333333, 0.23880597, 0.266666667,
0.3125, 0.366666667, 0.422535211, 0.385964912, 0.373134328,
0.171875, 0.236842105, 0.22, 0.22, 0.245614035, 0.139534884,
NA, 0.119565217, 0.162790698, NA, 0.1875, 0.233333333, 0.162790698,
0.220930233, 0.151162791, 0.195652174, 0.197674419, 0.27173913,
0.186046512, 0.421875, 0.492537313, 0.546875, 0.4, 0.298245614,
0.28, 0.366666667, 0.22, 0.34, 0.24, 0.416666667, 0.385964912,
0.3, 0.175438596, 0.11627907, 0.069767442, 0.093023256, NA,
0.11627907, 0.173913043, 0.104651163, 0.130434783, 0.122807018,
0.11627907, 0.119565217, 0.152173913, 0.477272727, 0.323943662,
0.310810811, 0.283783784, 0.21875, 0.35, 0.265625, 0.297297297,
0.316666667, 0.3, 0.283333333, 0.23943662), ratiofm = c(7,
4, 8, 7, 8, 8, 8, NA, NA, NA, 5, 3.5, NA, NA, NA, NA, 4,
6, NA, 4, 3, 2, 4, 4, 0.5, NA, 0.4, 0.4, 0.5, 0.2, 0.666666667,
0.5, 8, 6, 6, 6, 7, 7, 7, 3, 3, 3.5, 3.5, 6, 4, NA, 3, 2.5,
3, 5, 2.5, 3, 5, 4, 0.5, 1, NA, NA, 0.8, 0.333333333, 5,
5, NA, 7, 7, NA, 6, 6, 7, NA, 3.5, 7, 3, NA, 2.5, NA, 1,
1.333333333, 3, 3.5, 6, 1, 0.4, 0.4, 0.5, 0.4, 0.285714286,
0.333333333, 8, 7, 7, 7, NA, 7, 3.5, NA, 7, 7, 7, 7, 1.666666667,
1.666666667, 4, 1.25, 1.2, 2, 1.5, 0.285714286, 0.4, 0.25,
1, 2, NA, 6, 8, 7, 0.857142857, 6, NA, 7, 7, NA, NA, NA,
NA, NA, 3.5, 1.666666667, 5, 4, 2, 4, 2, 0.333333333, 0.333333333,
NA, 0.75, 0.5, NA, 1.5, 3, 5, 5, 6, NA, 6, 4, 2, 5, 5, 5,
5, NA, NA, 4, 4, 3, 2.5, 3, 2.5, 2.333333333, 3.5, 3.5, 0.6,
0.4, 0.75, 3, 1, NA, 2.5, 5, NA, NA, 2.5, 1.5, NA, NA, NA,
4, NA, 1.25, 2, 5, 2.5, 6, 2, 1, 3, 1.5, 1, 1.666666667,
NA)), class = "data.frame", row.names = c(NA, -192L))
It would be more clear with pictures of my graphs, but apparently I'm not allowed yet to include pictures in my posts, sorry
Thanks in advance for your help
you can try
library(tidyverse)
df %>%
as_tibble() %>%
ggplot(aes(x=fusion, y=FF)) +
geom_boxplot(aes(colour=fusion))+
ggsignif::geom_signif(comparisons = combn(levels(df$fusion), 2, simplify = F), step_increase = 0.3) +
ggpubr::stat_compare_means() +
facet_wrap(~Genotype)+
xlab(" ")+
ylab("Days after sowing")
This language is still a bit alien to me. I want to make a complicate graph with two axis and data plotted by groups.
The nature of my data STAT. I will write it as code, otherwise I cannot manage to publish the post:
4 time points ("0", "3", "5" and "7"), column Day.
Data divided in 5 groups, column SNu ("1", "2", "3", "4", "5") or SNa (the actual name of each group).
There are 4 values per group and time point, column Rep. Graph could plot the mean of these four values.
Data1 based on the area between the actual measures of one day and the following day, column SAr (some values are 0, between 0 and 205, some of them with decimals). I want to plot this in the primary y axis.
Data2, column DW (values between 0 and 1, all of them with 4 decimals). I want to plot this in the secondary axis.
I show below some modified data as an example.
structure(list(Sname = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 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2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 1L,
1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 1L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L), Diff = c(0L,
0L, 160L, 200L, 0L, 10L, 140L, 160L, 0L, 0L, 50L, 170L, 0L, 10L,
70L, 150L, 0L, 10L, 210L, 140L, 0L, 0L, 0L, 120L, 0L, 30L, 70L,
160L, 0L, 20L, 110L, 140L, 0L, 30L, 190L, 150L, 0L, 10L, 80L,
130L, 0L, 10L, 90L, 140L, 0L, 0L, 170L, 170L, 0L, 80L, 200L,
410L, 0L, 10L, 150L, 0L, 90L, 200L, 390L, 0L, 50L, 220L, 600L,
0L, 0L, 0L, 100L, 0L, 0L, 0L, 70L, 0L, 20L, 10L, 150L, 0L, 20L,
40L, 140L), Sum = c(0L, 0L, 160L, 360L, 0L, 10L, 150L, 310L,
0L, 0L, 50L, 220L, 0L, 10L, 80L, 230L, 0L, 10L, 220L, 360L, 0L,
0L, 0L, 120L, 0L, 30L, 100L, 260L, 0L, 20L, 130L, 270L, 0L, 30L,
220L, 370L, 0L, 10L, 90L, 220L, 0L, 10L, 100L, 240L, 0L, 0L,
170L, 340L, 0L, 80L, 280L, 690L, 0L, 10L, 160L, 0L, 90L, 290L,
680L, 0L, 50L, 270L, 870L, 0L, 0L, 0L, 100L, 0L, 0L, 0L, 70L,
0L, 20L, 30L, 180L, 0L, 20L, 60L, 200L), Sumarea = structure(c(1L,
1L, 17L, 33L, 1L, 2L, 16L, 29L, 1L, 1L, 3L, 22L, 1L, 2L, 9L,
22L, 1L, 2L, 22L, 32L, 1L, 1L, 1L, 14L, 1L, 20L, 12L, 23L, 1L,
13L, 15L, 24L, 1L, 20L, 22L, 31L, 1L, 2L, 11L, 21L, 1L, 2L, 12L,
23L, 1L, 1L, 18L, 31L, 1L, 4L, 27L, 7L, 1L, 2L, 17L, 1L, 6L,
28L, 5L, 1L, 30L, 25L, 10L, 1L, 1L, 1L, 12L, 1L, 1L, 1L, 8L,
1L, 13L, 26L, 17L, 1L, 13L, 6L, 19L), .Label = c("0", "1,6",
"12,5", "13,3", "147,5", "15", "152,5", "17,5", "20", "205",
"22,5", "25", "3,3", "30", "32,5", "37,5", "40", "42,5", "45",
"5", "52,5", "55", "57,5", "62,5", "67,5", "7,5", "70", "72,5",
"75", "8,3", "85", "87,5", "90"), class = "factor"), Sumarea10 = c(0L,
0L, 400L, 900L, 0L, 16L, 375L, 750L, 0L, 0L, 125L, 550L, 0L,
16L, 200L, 550L, 0L, 16L, 550L, 875L, 0L, 0L, 0L, 300L, 0L, 50L,
250L, 575L, 0L, 33L, 325L, 625L, 0L, 50L, 550L, 850L, 0L, 16L,
225L, 525L, 0L, 16L, 250L, 575L, 0L, 0L, 425L, 850L, 0L, 133L,
700L, 1525L, 0L, 16L, 400L, 0L, 150L, 725L, 1475L, 0L, 83L, 675L,
2050L, 0L, 0L, 0L, 250L, 0L, 0L, 0L, 175L, 0L, 33L, 75L, 400L,
0L, 33L, 150L, 450L), Dweight = structure(c(1L, 6L, 34L, 38L,
1L, 7L, 32L, 45L, 1L, 8L, 31L, 48L, 1L, 9L, 30L, 44L, 1L, 11L,
37L, 50L, 1L, 11L, 33L, 49L, 1L, 13L, 35L, 51L, 1L, 18L, 36L,
52L, 1L, 21L, 47L, 53L, 1L, 19L, 43L, 54L, 1L, 20L, 46L, 56L,
1L, 22L, 42L, 55L, 1L, 17L, 28L, 39L, 1L, 15L, 27L, 1L, 13L,
26L, 41L, 1L, 17L, 29L, 40L, 1L, 5L, 10L, 24L, 1L, 3L, 14L, 24L,
1L, 4L, 16L, 23L, 1L, 2L, 12L, 25L), .Label = c("0", "0,0003",
"0,0006", "0,0007", "0,0008", "0,0011", "0,0017", "0,0026", "0,0033",
"0,004", "0,0045", "0,0048", "0,005", "0,0051", "0,0053", "0,0055",
"0,0056", "0,006", "0,007", "0,0074", "0,0082", "0,0086", "0,0142",
"0,0204", "0,0222", "0,0333", "0,0342", "0,0345", "0,038", "0,0423",
"0,0426", "0,0637", "0,0668", "0,0679", "0,0736", "0,0808", "0,0922",
"0,0952", "0,0986", "0,0989", "0,0996", "0,1078", "0,1215", "0,1242",
"0,1349", "0,1483", "0,1512", "0,1576", "0,1682", "0,1731", "0,1949",
"0,2099", "0,262", "0,2676", "0,2742", "0,2808"), class = "factor"),
Wweight = structure(c(1L, 3L, 40L, 42L, 1L, 4L, 37L, 44L,
1L, 8L, 26L, 48L, 1L, 9L, 24L, 43L, 1L, 10L, 41L, 49L, 1L,
11L, 39L, 46L, 1L, 12L, 35L, 50L, 1L, 14L, 38L, 53L, 1L,
22L, 52L, 57L, 1L, 20L, 47L, 58L, 1L, 17L, 51L, 60L, 1L,
21L, 45L, 59L, 1L, 15L, 34L, 54L, 1L, 19L, 32L, 1L, 16L,
31L, 56L, 1L, 18L, 36L, 55L, 1L, 7L, 13L, 27L, 1L, 6L, 29L,
25L, 1L, 5L, 30L, 23L, 1L, 2L, 33L, 28L), .Label = c("0",
"0,0089", "0,0105", "0,0136", "0,0144", "0,0147", "0,0152",
"0,0201", "0,0265", "0,0339", "0,0345", "0,0371", "0,045",
"0,0463", "0,0569", "0,0583", "0,0587", "0,0596", "0,0602",
"0,0649", "0,069", "0,0834", "0,1264", "0,1829", "0,1897",
"0,1909", "0,1974", "0,2309", "0,3", "0,344", "0,3491", "0,3547",
"0,364", "0,3729", "0,3756", "0,3932", "0,4357", "0,4361",
"0,451", "0,4634", "0,479", "0,5109", "0,6594", "0,7182",
"0,7423", "0,7865", "0,7938", "0,8406", "0,8407", "0,9152",
"0,9347", "0,9675", "1", "1,0908", "1,1366", "1,1465", "1,6905",
"1,7799", "1,8875", "1,9493"), class = "factor")), class = "data.frame", row.names = c(NA, -79L))
#Pretreat dataframe by creating factors for every column.
STAT<- read.table("Biomass.txt", header=TRUE, fill=TRUE)
SNa <- as.factor(STAT$Sname)
SNu <- as.factor(STAT$Snumber)
Day <- as.numeric(STAT$Day)
Rep <- as.numeric(STAT$Replica)
Dif <- as.numeric(STAT$Diff)
Sum <- as.numeric(STAT$Sum)
SAr10 <- as.numeric(STAT$Sumarea10)
SAr <- c(SAr10/10)
DW <- as.numeric(STAT$Dweight)
WW <- as.numeric(STAT$Wweight)
#I first tried to plot Dataone (`SAr`) as follows:
points1 <- geom_point(aes(colour = SNa), size =.8)
lines1 <- geom_smooth(method = loess, aes(colour = SNa), size =.5, se=TRUE, alpha=.2)
text1 <- labs(title=expression (Biomass~and~CO[2]~production~summed~ area), x=expression(Time~" "~(days)), y=expression(CO[2]~production~sum~" "~(ppm)))
g <- ggplot(data=STAT, aes(x=Day, y=SAr, group=SNa, fill=SNa, colour=SNa), par(mar=Marg))
g <- g + points1 + lines1 + text1
This is the result:
So far so good, but here start the problems.
1. SHADE
I would like to shade the area below the graphs. I have tried:
area1 <- geom_ribbon(data = STAT[STAT$Snumber == '1',],
aes(ymin = 0, ymax = predict(loess(Day ~ Sumarea))),
alpha = 0.3, fill = "#114477")
g <- g + points1 + lines1 + text1 + area1
plot(g) returns:
Error in loess(Day ~ Sumarea) : predictors must all be numeric
I have tried to put the numeric factors I created at the beginning, but Day and SAr do not have the same length
Error in model.frame.default(formula = Day ~ SAr) :
variable lengths differ (found for 'SAr').
I have also tried to make this with a density function and a geom_area but none of them resulted in what I wanted.
2. PLOT DATA2
I want the Datatwo (DW) attachted to the secondary y axis.
#Secondary y axis
y2 <- scale_y_continuous(sec.axis = sec_axis(~./150, name = "Dry
weight"))
#Grouped bars per time point
bars2 <- geom_bar(aes(factor(Day), DW), stat="identity", position = "dodge")
g <- g + points1 + lines1 + text1 + y2 + bars2
plot(g) returns:
Error: Discrete value supplied to continuous scale
I know that there cannot be a continuous scale on variable of the factor type (Plotting with ggplot2: "Error: Discrete value supplied to continuous scale" on categorical y-axis). But their solution does not work for me either.
ggplot(STAT[STAT$SNu == 1,], aes(x = STAT$Day, y = STAT$DW)) +
scale_x_continuous(limits=c(0,7)) +
scale_y_continuous(limits=c(0,1))
Returning
Error: Aesthetics must be either length 1 or the same as the data
(79): x, y`
If anyone can help me with this two issues it would be super appreciated. As I am new in this code, I also encourage you to ask me about specific details that might have relevance and I did not add in the post. Also any improvement in my code even not related with my questions would be very welcome.
I have a dataframe df
df<-structure(list(subject = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L,
10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L,
23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L,
36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L,
49L, 50L, 51L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L,
12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L, 23L, 24L,
25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L, 36L, 37L,
38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L,
51L), sex = c(1L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 2L,
1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L,
1L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 2L, 2L, 2L, 1L,
2L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 2L, 2L, 1L,
1L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L,
1L, 2L, 2L, 1L, 1L, 2L, 1L, 1L, 1L, 2L, 2L, 2L, 1L, 2L, 1L, 2L,
2L, 2L, 1L, 2L, 2L, 1L, 2L, 1L, 2L, 1L), age = c(29L, 54L, 67L,
36L, 48L, 37L, 25L, 46L, 37L, 33L, 25L, 26L, 28L, 59L, 46L, 50L,
55L, 56L, 37L, 30L, 38L, 30L, 50L, 39L, 29L, 46L, 48L, 46L, 55L,
32L, 66L, 35L, 48L, 54L, 38L, 31L, 42L, 36L, 27L, 63L, 45L, 31L,
26L, 38L, 43L, 52L, 36L, 43L, 65L, 46L, 42L, 29L, 54L, 67L, 36L,
48L, 37L, 25L, 46L, 37L, 33L, 25L, 26L, 28L, 59L, 46L, 50L, 55L,
56L, 37L, 30L, 38L, 30L, 50L, 39L, 29L, 46L, 48L, 46L, 55L, 32L,
66L, 35L, 48L, 54L, 38L, 31L, 42L, 36L, 27L, 63L, 45L, 31L, 26L,
38L, 43L, 52L, 36L, 43L, 65L, 46L, 42L), edu = c(4L, 3L, 3L,
3L, 4L, 2L, 3L, 3L, 1L, 3L, 4L, 4L, 5L, 1L, 1L, 2L, 2L, 3L, 4L,
4L, 4L, 4L, 4L, 4L, 2L, 2L, 1L, 2L, 2L, 4L, 2L, 4L, 4L, 3L, 3L,
4L, 5L, 3L, 3L, 4L, 1L, 1L, 3L, 1L, 3L, 1L, 3L, 1L, 6L, 1L, 3L,
4L, 3L, 3L, 3L, 4L, 2L, 3L, 3L, 1L, 3L, 4L, 4L, 5L, 1L, 1L, 2L,
2L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 2L, 1L, 2L, 2L, 4L, 2L, 4L,
4L, 3L, 3L, 4L, 5L, 3L, 3L, 4L, 1L, 1L, 3L, 1L, 3L, 1L, 3L, 1L,
6L, 1L, 3L), biz_exp = c(5L, 15L, 3L, 4L, 10L, 6L, 0L, 5L, 8L,
5L, 0L, 8L, 3L, 23L, 5L, 7L, 5L, 11L, 4L, 4L, 11L, 3L, 15L, 4L,
4L, 6L, 6L, 5L, 13L, 2L, 13L, 6L, 8L, 27L, 7L, 3L, 11L, 5L, 1L,
4L, 8L, 8L, 4L, 15L, 18L, 30L, 9L, 14L, 18L, 21L, 16L, 5L, 15L,
3L, 4L, 10L, 6L, 0L, 5L, 8L, 5L, 0L, 8L, 3L, 23L, 5L, 7L, 5L,
11L, 4L, 4L, 11L, 3L, 15L, 4L, 4L, 6L, 6L, 5L, 13L, 2L, 13L,
6L, 8L, 27L, 7L, 3L, 11L, 5L, 1L, 4L, 8L, 8L, 4L, 15L, 18L, 30L,
9L, 14L, 18L, 21L, 16L), turnov = c(36L, NA, 12L, 9L, 48L, 9L,
8L, 24L, 4L, 250L, NA, 600L, 6L, 6L, 10L, 10L, 5L, 4L, 250L,
200L, 50L, 150L, 48L, NA, 9L, 6L, 2L, NA, NA, 3L, 7L, 23L, 75L,
7L, 5L, NA, 20L, 450L, 5L, 32L, 21L, 12L, 6L, 4L, 24L, 7L, 10L,
12L, 12L, 14L, 18L, 36L, NA, 12L, 9L, 48L, 9L, 8L, 24L, 4L, 250L,
NA, 600L, 6L, 6L, 10L, 10L, 5L, 4L, 250L, 200L, 50L, 150L, 48L,
NA, 9L, 6L, 2L, NA, NA, 3L, 7L, 23L, 75L, 7L, 5L, NA, 20L, 450L,
5L, 32L, 21L, 12L, 6L, 4L, 24L, 7L, 10L, 12L, 12L, 14L, 18L),
loc_pr = c(1L, 1L, 1L, 6L, 1L, 6L, 4L, 1L, 8L, 5L, 1L, 3L,
1L, 1L, 1L, 1L, 5L, 8L, 2L, 1L, 1L, 1L, 1L, 2L, 8L, 2L, 4L,
4L, 2L, 2L, 2L, 1L, 4L, 5L, 4L, 4L, 4L, 4L, NA, 4L, 5L, 5L,
5L, 8L, 1L, 2L, 4L, 3L, 3L, 4L, 3L, 1L, 1L, 1L, 6L, 1L, 6L,
4L, 1L, 8L, 5L, 1L, 3L, 1L, 1L, 1L, 1L, 5L, 8L, 2L, 1L, 1L,
1L, 1L, 2L, 8L, 2L, 4L, 4L, 2L, 2L, 2L, 1L, 4L, 5L, 4L, 4L,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, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L), investment = c(86L,
100L, 100L, 75L, 100L, 59L, 68L, 86L, 80L, 100L, 86L, 100L,
100L, 100L, 100L, 100L, 100L, 93L, 64L, 100L, 24L, 18L, 89L,
75L, 80L, 29L, 54L, 65L, 100L, 27L, 59L, 30L, 59L, 43L, 59L,
59L, 5L, 26L, 100L, 75L, 59L, 5L, 59L, 74L, 59L, 79L, 75L,
75L, 86L, 66L, 86L, 55L, 100L, 68L, 1L, 75L, 1L, 1L, 79L,
1L, 54L, 48L, 33L, 55L, 90L, 85L, 39L, 70L, 1L, 45L, 54L,
33L, 3L, 44L, 75L, 1L, 1L, 1L, 1L, 96L, 26L, 1L, 23L, 66L,
1L, 89L, 83L, 52L, 61L, 1L, 88L, 45L, 72L, 60L, 1L, 60L,
2L, 86L, 10L, 63L, 1L, 88L)), .Names = c("subject", "sex",
"age", "edu", "biz_exp", "turnov", "loc_pr", "type", "age_rec",
"biz_exp_rec", "turnov_rec", "bundle", "investment"), class = "data.frame", row.names = c(NA,
-102L))
In this dataframe investment is my dependent variable and the other variables are my independent variables. My subjects are crossed within type of bundle. First of all, I would like know whether my subjects do bundle or not (bundle= 1 means that people bundle and bundle=0 means that people do not bundle), it will have an effect on the investment.
I have done this mixed effect linear model but I am not sure if this is correct as my p-value are equal to zero.
library(nlme)
model <- lme(investment~bundle, random = ~1|subject/bundle, data=df)
I have also tried to make an anova with repeated measures as such:
aov(investment~bundle+ Error(subject/bundle), data=df)
It works but not sure if the model formula is right
Anyone could help me with that?