0

我正在运行以下代码,它返回以下错误 - 任何解决方案将不胜感激。

## UQdata = Positive count abundance only data (i.e. positive values only)

        aa2<-gam(UQdata~s(MudUQ,bs="ps", k=15) ,family=Gamma(link=log),data=Antho)
        xmin <- ceiling(min(Antho$MudUQ[Antho$Bin==1]))
        xmax <- floor(max(Antho$MudUQ[Antho$Bin==1]))
        Mudnew <- seq(from=xmin, to=xmax, by=0.1)
      **Error in if (del == 0 && to == 0) return(to) : 
                      missing value where TRUE/FALSE needed**
        pred.dat <- data.frame(Mudnew)
        names(pred.dat) <- "MudUQ"
        pred.aa2 <- data.frame(predict.gam(aa2, pred.dat, se.fit=TRUE, type="response"))
        pred.aa2.comb <- data.frame(pred.dat, pred.aa2)
        names(pred.aa2.comb)
        plot(fit ~ MudUQ, data=pred.aa2.comb, type="l", lwd=2, col=1, ylab="Density per 0.0132 m2", xlab="Mud content (%)")
4

1 回答 1

1

Perhaps:

    xmin <- ceiling( min( Antho$MudUQ[Antho$Bin==1] , na.rm=TRUE) )
    xmax <- floor( max( Antho$MudUQ[Antho$Bin==1] , na.rm=TRUE) )

I think the error is being thrown by the seq function.

于 2013-08-15T23:31:54.710 回答