Problem with Df when performing an ANOVA test

Hi! I have been performing a series of ANOVA tests concerning plant species and three variables. With two of them (DBH and Height) the ANOVA test goes smoothly and I get the right Df (17) according to the number of species (Art) I have (18). However, when performing said analysis on the third variable (Crown_volume) the Df suddendly goes down to 15. I have checked the data and everything seems to be ok, so I am not sure where I am making a mistake. Here is the data:

Art Ind DBH Height Crown_volume
Acer buergerianum 1 NA NA NA
Acer buergerianum 2 NA NA NA
Acer buergerianum 3 18 371 10502268,84
Acer buergerianum 4 14,8 397 14099593,49
Acer buergerianum 5 9,8 303 3558796,158
Acer rufinerve 1 NA NA NA
Acer rufinerve 2 NA NA NA
Acer rufinerve 3 10 352 5682839,517
Acer rufinerve 4 10 309 2074791,564
Acer rufinerve 5 10,2 337 2853219,581
Caprinus japonica 1 11,4 251 3029877,619
Caprinus japonica 2 10 293 6064027,804
Caprinus japonica 3 11,6 313 7757187,07
Caprinus japonica 4 11,2 307 5746726,946
Caprinus japonica 5 9,6 270 6001262,971
Celtis australis 1 12 372 3464967,257
Celtis australis 2 11,8 379 3032667,353
Celtis australis 3 11,8 372 3621213,321
Celtis australis 4 13,2 362 2779073,805
Celtis australis 5 13,7 385 2952678,215
Celtis occidentalis 1 10,4 337 3310857,477
Celtis occidentalis 2 11 338 5150151,067
Celtis occidentalis 3 13 318 3281632,288
Celtis occidentalis 4 11 316 1980761,602
Celtis occidentalis 5 11,2 318 2208966,892
Cladrastis lutea 1 8 327 2228268,837
Cladrastis lutea 2 NA NA NA
Cladrastis lutea 3 10,2 368 5162202,217
Cladrastis lutea 4 NA NA NA
Cladrastis lutea 5 10,6 351 4272880,168
Cornus controversa 1 12 331 10735098,56
Cornus controversa 2 12,2 324 12033305,17
Cornus controversa 3 12,4 332 11706830,86
Cornus controversa 4 10,2 273 733172,3271
Cornus controversa 5 12 301 6028716,302
Cornus officinalis 1 10,4 307 2925501,345
Cornus officinalis 2 8 331 620904,3721
Cornus officinalis 3 9 338 1631533,785
Cornus officinalis 4 9 261 980176,9079
Cornus officinalis 5 9,4 300 2559652,408
Magnolia denudata 1 9 331 972863,2802
Magnolia denudata 2 8,6 301 1314777,469
Magnolia denudata 3 8,6 327 2344583,164
Magnolia denudata 4 8,2 343 8846724,913
Magnolia denudata 5 8,2 310 2213758,868
Ostrya carpinifolia 1 9,4 300 9341605,342
Ostrya carpinifolia 2 10,4 425 6664365,216
Ostrya carpinifolia 3 11,2 374 6068853,29
Ostrya carpinifolia 4 9,8 343 7728912,736
Ostrya carpinifolia 5 10 384 1927178,597
Ostrya japonica 1 8 367 3171211,589
Ostrya japonica 2 8,2 336 3857071,531
Ostrya japonica 3 10,2 372 6699383,502
Ostrya japonica 4 10,2 379 7788033,321
Ostrya japonica 5 10,4 379 4045843,55
Phellodendrok amurense 1 13 325 2409090,533
Phellodendrok amurense 2 17,8 273 2381151,302
Phellodendrok amurense 3 NA NA NA
Phellodendrok amurense 4 13,4 341 3136076,017
Phellodendrok amurense 5 NA NA NA
Pterocarya fraxinifolia 1 20,2 437 18683679,83
Pterocarya fraxinifolia 2 21 502 24881413,82
Pterocarya fraxinifolia 3 17,8 409 16055465,3
Pterocarya fraxinifolia 4 22 393 7465102,729
Pterocarya fraxinifolia 5 272 565 50825942,59
Quercus cerris 1 12,8 405 12750308,77
Quercus cerris 2 19,4 425 34050214,81
Quercus cerris 3 12,8 384 12698317,51
Quercus cerris 4 15 420 21157173,01
Quercus cerris 5 18 389 24367951,91
Quercus shumardii 1 13,2 383 12468981,24
Quercus shumardii 2 9 432 17638291,84
Quercus shumardii 3 12,2 449 12627543,71
Quercus shumardii 4 9,2 403 15666075,37
Quercus shumardii 5 8,6 409 4966229,667
Quercus texana 1 11,8 412 5546184,426
Quercus texana 2 13 444 6665328,638
Quercus texana 3 13,6 446 9092648,785
Quercus texana 4 NA NA NA
Quercus texana 5 13,8 408 4222300,526
Quercus x hispanica 1 9 247 1567026,416
Quercus x hispanica 2 11,2 337 3819070,826
Quercus x hispanica 3 11,4 240 1734159,145
Quercus x hispanica 4 11,8 230 2629002,019
Quercus x hispanica 5 9,2 310 6458310,248
Zelkova serrata 1 19,4 462 59232635,09
Zelkova serrata 2 12,6 444 24234245,73
Zelkova serrata 3 15,8 392 31145121,25
Zelkova serrata 4 16,6 425 27416092,66
Zelkova serrata 5 12,1 374 24437066,95

Any idea on where the problem could be? I am quite puzzled by this. Thank you.

can you copy and paste the output dput(yourdataframe)? And the code you used?

1 Like

Of course. Here is the code I used:

dataStartSeason <- read.csv("Species_measurements_merged_StartSeason.csv", header = TRUE, sep=";", dec=",") #For tree traits (CVP, DBH, Height)
dataStartSeason <- dataStartSeason %>%
mutate(across(where(is.character), ~na_if(., "NA"))) %>%
type.convert(as.is=F)
one.wayCVMay <- aov(Crown_volume ~ Art, data=dataStartSeason)
summary(one.wayCAMay)

And the otput of dput:

structure(list(Art = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 2L,
2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L,
5L, 5L, 6L, 6L, 6L, 6L, 6L, 7L, 7L, 7L, 7L, 7L, 8L, 8L, 8L, 8L,
8L, 9L, 9L, 9L, 9L, 9L, 10L, 10L, 10L, 10L, 10L, 11L, 11L, 11L,
11L, 11L, 12L, 12L, 12L, 12L, 12L, 13L, 13L, 13L, 13L, 13L, 14L,
14L, 14L, 14L, 14L, 15L, 15L, 15L, 15L, 15L, 16L, 16L, 16L, 16L,
16L, 17L, 17L, 17L, 17L, 17L, 18L, 18L, 18L, 18L, 18L), levels = c("Acer buergerianum ",
"Acer rufinerve ", "Caprinus japonica ", "Celtis australis ",
"Celtis occidentalis ", "Cladrastis lutea", "Cornus controversa",
"Cornus officinalis ", "Magnolia denudata ", "Ostrya carpinifolia ",
"Ostrya japonica", "Phellodendrok amurense ", "Pterocarya fraxinifolia ",
"Quercus cerris ", "Quercus shumardii", "Quercus texana", "Quercus x hispanica ",
"Zelkova serrata "), class = "factor"), Ind = c(1L, 2L, 3L, 4L,
5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L,
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L,
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L,
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L,
4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L,
5L, 1L, 2L, 3L, 4L, 5L), DBH = c(NA, NA, 18, 14.8, 9.8, NA, NA,
10, 10, 10.2, 11.4, 10, 11.6, 11.2, 9.6, 12, 11.8, 11.8, 13.2,
13.7, 10.4, 11, 13, 11, 11.2, 8, NA, 10.2, NA, 10.6, 12, 12.2,
12.4, 10.2, 12, 10.4, 8, 9, 9, 9.4, 9, 8.6, 8.6, 8.2, 8.2, 9.4,
10.4, 11.2, 9.8, 10, 8, 8.2, 10.2, 10.2, 10.4, 13, 17.8, NA,
13.4, NA, 20.2, 21, 17.8, 22, 272, 12.8, 19.4, 12.8, 15, 18,
13.2, 9, 12.2, 9.2, 8.6, 11.8, 13, 13.6, NA, 13.8, 9, 11.2, 11.4,
11.8, 9.2, 19.4, 12.6, 15.8, 16.6, 12.1), Height = c(NA, NA,
371L, 397L, 303L, NA, NA, 352L, 309L, 337L, 251L, 293L, 313L,
307L, 270L, 372L, 379L, 372L, 362L, 385L, 337L, 338L, 318L, 316L,
318L, 327L, NA, 368L, NA, 351L, 331L, 324L, 332L, 273L, 301L,
307L, 331L, 338L, 261L, 300L, 331L, 301L, 327L, 343L, 310L, 300L,
425L, 374L, 343L, 384L, 367L, 336L, 372L, 379L, 379L, 325L, 273L,
NA, 341L, NA, 437L, 502L, 409L, 393L, 565L, 405L, 425L, 384L,
420L, 389L, 383L, 432L, 449L, 403L, 409L, 412L, 444L, 446L, NA,
408L, 247L, 337L, 240L, 230L, 310L, 462L, 444L, 392L, 425L, 374L
), Crown_volume = c(NA, NA, 10502268.84, 14099593.49, 3558796.158,
NA, NA, 5682839.517, 2074791.564, 2853219.581, 3029877.619, 6064027.804,
7757187.07, 5746726.946, 6001262.971, 3464967.257, 3032667.353,
3621213.321, 2779073.805, 2952678.215, 3310857.477, 5150151.067,
3281632.288, 1980761.602, 2208966.892, 2228268.837, NA, 5162202.217,
NA, 4272880.168, 10735098.56, 12033305.17, 11706830.86, 733172.3271,
6028716.302, 2925501.345, 620904.3721, 1631533.785, 980176.9079,
2559652.408, 972863.2802, 1314777.469, 2344583.164, 8846724.913,
2213758.868, 9341605.342, 6664365.216, 6068853.29, 7728912.736,
1927178.597, 3171211.589, 3857071.531, 6699383.502, 7788033.321,
4045843.55, 2409090.533, 2381151.302, NA, 3136076.017, NA, 18683679.83,
24881413.82, 16055465.3, 7465102.729, 50825942.59, 12750308.77,
34050214.81, 12698317.51, 21157173.01, 24367951.91, 12468981.24,
17638291.84, 12627543.71, 15666075.37, 4966229.667, 5546184.426,
6665328.638, 9092648.785, NA, 4222300.526, 1567026.416, 3819070.826,
1734159.145, 2629002.019, 6458310.248, 59232635.09, 24234245.73,
31145121.25, 27416092.66, 24437066.95)), row.names = c(NA, -90L
), class = "data.frame")

while summary(one.wayCVMay ) gives Df 17; you wrote summary(one.wayCAMay) which on our systems would error; due to no object so named existing;
for emphasis - one.wayCVMay != one.wayCAMay

if this doesnt error but gives you a summary with df 15; then this is just a case of mistaken identity where you thought you were checking one aov but really seeing another that you did before.

It is exactly as you explained. I have just found out while looking at the code once again. Such a silly mistake! :rofl: :rofl:
Thanks everyone for your help. Hopefully I see things like this next time before I make another post.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.