What will be the output of the following R code? [code] function(p) { params[!fixed] <- p mu <- params[1]

Nguyễn Pháp

New member
What will be the output of the following R code?
Code:
function(p) {
          params[!fixed] <- p
          mu <- params[1]
          sigma <- params[2]
## Calculate the Normal density
          a <- -0.5*length(data)*log(2*pi*sigma^2)
          b <- -0.5*sum((data-mu)^2) / (sigma^2)
          -(a + b)
}
> ls(environment(nLL))
A. “data” “fixed” “param”
B. “data” “variable” “params”
C. “data” “fixed” “params”
D. “data” “param”
 

Tìm kiếm

Back
Top