Nevil Amos
2012-Jan-11 00:55 UTC
[R] Vegan(ordistep) error: Error in if (aod[1, 5] <= Pin) { : missing value where TRUE/FALSE needed
I am getting the following erro rmessage in ordistep. I have a number of similarly structured datasets using ordistep in a loop, and the message only occurs for some of the datasets. I cannot include a reproducible sample - the specific datasets where this is occur ing are fairly large and there are several pcnm's in the rhs of the formula. thanks for any pointers that may allow me to track down the cause of the error. Error in if (aod[1, 5] <= Pin) { : missing value where TRUE/FALSE needed In addition: There were 50 or more warnings (use warnings() to see the first 50) traceback() 9: ordistep(myrda0, scope = formula(myrda1), direction = "both", Pin = 0.05, Pout = 0.1) at RDAPARTIALSexandAgeConnectandGEOGraphy2.R#86 8: eval(expr, envir, enclos) at RDAPARTIALSexandAgeConnectandGEOGraphy2.R#86 7: eval(expr, pf) at RDAPARTIALSexandAgeConnectandGEOGraphy2.R#86 6: withVisible(eval(expr, pf)) at RDAPARTIALSexandAgeConnectandGEOGraphy2.R#86 5: evalVis(expr) at RDAPARTIALSexandAgeConnectandGEOGraphy2.R#86 4: capture.output(ordistep(myrda0, scope = formula(myrda1), direction "both", Pin = 0.05, Pout = 0.1)) at RDAPARTIALSexandAgeConnectandGEOGraphy2.R#86 3: eval.with.vis(expr, envir, enclos) 2: eval.with.vis(ei, envir) 1: source("~/Documents/Dropbox/thesis/CH3/Analysis/RDAPARTIALSexandAgeConnectandGEOGraphy2.R") print(myrda1) Call: rda(formula = mygenind@tab ~ pcnmTRE_25_100_CS25 + pcnmTRE_25_10_CS25 + pcnmTRE_25_2_CS25 + pcnmTRE_25_5_CS25 + mydata$TreeCov + mydata$Hab_Config + pcnmEYR_EO_100_CS25 + pcnmEYR_EO_5000_CS25 + pcnmEYR_TH_10_CS25 + pcnmEYR_TH_2_CS25 + mydata$Site_No + mydata$Landscape + Condition(pcnmCS_NULL + mydata$LAT.x + mydata$LONG.x), na.action "na.omit") Inertia Proportion Rank Total 1.8110 1.0000 Conditional 0.8681 0.4793 32 Constrained 0.0000 0.0000 0 Unconstrained 0.9429 0.5207 29 Inertia is variance Some constraints were aliased because they were collinear (redundant) Eigenvalues for unconstrained axes: PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 0.16008 0.14733 0.12183 0.09054 0.07380 0.06971 0.05578 0.04215 (Showed only 8 of all 29 unconstrained eigenvalues) -- Nevil Amos Molecular Ecology Research Group Australian Centre for Biodiversity Monash University CLAYTON VIC 3800 Australia [[alternative HTML version deleted]]
Jari Oksanen
2012-Jan-11 09:45 UTC
[R] Vegan(ordistep) error: Error in if (aod[1, 5] <= Pin) { : missing value where TRUE/FALSE needed
Nevil Amos <nevil.amos <at> monash.edu> writes:> > I am getting the following erro rmessage in ordistep. I have a number of > similarly structured datasets using ordistep in a loop, and the message > only occurs for some of the datasets. > > I cannot include a reproducible sample - the specific datasets where this > is occur ing are fairly large and there are several pcnm's in the rhs of > the formula. > > Error in if (aod[1, 5] <= Pin) { : missing value where TRUE/FALSE needed >Nevil, It seems to me that the source of the problem appears in this table:> Inertia Proportion Rank > Total 1.8110 1.0000 > Conditional 0.8681 0.4793 32 > Constrained 0.0000 0.0000 0 > Unconstrained 0.9429 0.5207 29 > Inertia is variance > Some constraints were aliased because they were collinear (redundant) >The key point is that "Constrained" component is completely alaised (Inertia 0, Rank 0) and therefore it cannot be analysed in permutation tests. You get the same error message with this model: mod <- rda(dune ~ Moisture + Condition(Moisture), dune.env) and for the same reason. In your case, PCNM's seem to explain everything and there is nothing left for other variables, and therefore you cannot analyse them. Cheers, Jari Oksanen I can see how to fix this in vegan. All I can do is to handle these cases smoothly and with comprehensible error messages, though. They cannot be handled with permutation tests since there is nothing to do if "Constrained" component is zeroed. Cheers, Jari Oksanen
Nevil Amos
2012-Jan-11 20:09 UTC
[R] Vegan(ordistep) error: Error in if (aod[1, 5] <= Pin) { : missing value where TRUE/FALSE needed
Whilst the constrained proportion was 0 in the example below I am getting the error in cases where this is not so. See new output pasted below [1] "ORDISTEP RDA1 BOTH WAYS" [1] "________________________________________________________________________________________________" [1] "SFW ALL Adult" [1] mds3dSFW_EO_100_CS25 mds3dSFW_EO_5000_CS25 mds3dSFW_TH_10_CS25 mds3dSFW_TH_2_CS25 Call: rda(formula = mygenind@tab ~ mds3dTRE_25_100_CS25 + mds3dTRE_25_10_CS25 + mds3dTRE_25_2_CS25 + mds3dTRE_25_5_CS25 + mydata$TreeCov + mydata$Hab_Config + mydata$Site_No + mydata$Landscape + mds3dCS_NULL + mydata$LAT.x + mydata$LONG.x, na.action = "na.omit") Inertia Proportion Rank Total 4.5099 1.0000 Constrained 1.2635 0.2802 29 Unconstrained 3.2464 0.7198 142 Inertia is variance Some constraints were aliased because they were collinear (redundant) Eigenvalues for constrained axes: RDA1 RDA2 RDA3 RDA4 RDA5 RDA6 RDA7 RDA8 RDA9 RDA10 RDA11 0.173325 0.126065 0.093396 0.086910 0.072219 0.063064 0.062034 0.058022 0.050743 0.045038 0.043567 RDA12 RDA13 RDA14 RDA15 RDA16 RDA17 RDA18 RDA19 RDA20 RDA21 RDA22 0.039200 0.035363 0.033358 0.029372 0.028224 0.025715 0.024484 0.024007 0.021999 0.020480 0.018853 RDA23 RDA24 RDA25 RDA26 RDA27 RDA28 RDA29 0.017277 0.015510 0.015091 0.012845 0.011089 0.009377 0.006886 Eigenvalues for unconstrained axes: PC1 PC2 PC3 PC4 PC5 PC6 PC7 PC8 0.2037 0.1710 0.1670 0.1450 0.1343 0.1155 0.1120 0.1015 (Showed only 8 of all 142 unconstrained eigenvalues) Error in if (aod[1, 5] <= Pin) { : missing value where TRUE/FALSE needed In addition: There were 50 or more warnings (use warnings() to see the first 50)> > > > traceback()6: ordistep(myrda0, scope = formula(myrda1), direction = "both", Pin = 0.05, Pout = 0.1) at #55 5: eval(expr, envir, enclos) at #55 4: eval(expr, pf) at #55 3: withVisible(eval(expr, pf)) at #55 2: evalVis(expr) at #55 1: capture.output(ordistep(myrda0, scope = formula(myrda1), direction = "both", Pin = 0.05, Pout = 0.1)) at #55 Cheers Nevil Amos> > Nevil Amos <nevil.amos <at> monash.edu> writes: > >> >> I am getting the following erro rmessage in ordistep. I have a number of >> similarly structured datasets using ordistep in a loop, and the message >> only occurs for some of the datasets. >> >> I cannot include a reproducible sample - the specific datasets where this >> is occur ing are fairly large and there are several pcnm's in the rhs of >> the formula. >> >> Error in if (aod[1, 5] <= Pin) { : missing value where TRUE/FALSE needed >> > Nevil, > > It seems to me that the source of the problem appears in this table: > >> Inertia Proportion Rank >> Total 1.8110 1.0000 >> Conditional 0.8681 0.4793 32 >> Constrained 0.0000 0.0000 0 >> Unconstrained 0.9429 0.5207 29 >> Inertia is variance >> Some constraints were aliased because they were collinear (redundant) >> > > The key point is that "Constrained" component is completely alaised (Inertia 0, > Rank 0) and therefore it cannot be analysed in permutation tests. You get the > same error message with this model: > > mod <- rda(dune ~ Moisture + Condition(Moisture), dune.env) > > and for the same reason. In your case, PCNM's seem to explain everything and > there is nothing left for other variables, and therefore you cannot analyse them. > > Cheers, Jari Oksanen > > I can see how to fix this in vegan. All I can do is to handle these cases > smoothly and with comprehensible error messages, though. They cannot be handled > with permutation tests since there is nothing to do if "Constrained" component > is zeroed. > > Cheers, Jari Oksanen[[alternative HTML version deleted]]
Possibly Parallel Threads
- Error message in vegan ordistep
- VEGAN ordistep, stepwise model selection in CCA - familywise error correction.
- vegan moved to GitHub and vegan 2.2-0 is coming (are you ready?)
- partial dbRDA or CCA with two distance objects in Vegan.
- Using PCNM() in Vegan and calculating Moran's I