Error in f(x, …) : argument “x” is missing, with no default in nlm
问题 rm(list=ls(all=TRUE)) data <- read.csv("con.csv", header=TRUE, sep = ",") x <- data$X0 n = length(x); T1 <- 1 f <- function(a,b) { L <- (n*log(a))+(n*a*log(T1))+(n*a*log(b))-(n*log((T1^a)-(b^a)))- ((a+1)*sum(log(b+x))) return(-L) } ML <- nlm(f, c(0.01,0.17)) Result in Error in f(x, ...): argument "x" is missing, with no default help me to figure out error and solution to solve it out 回答1: The argument passed to the function f must be a single vector. Here is the correct definition: f <-