Trying to build and evaluate a function in R

##################### THE MLE PARAMETERS ESTIMATE FOR 5 PARAMETERS WEIBULL-LOMAX DISTRIBUTION ########################################################################

  "logLik.NWL" <- function(θ,x){
    
  n = length(x)  
  α = θ[1]
  β = θ[2]
  a = θ[3]
  λ = θ[4]
  μ = min(x)
  p = (((x-μ)/λ)+1)
  logl <- (n*log(α*β*a))
            -(n*log(λ))
            +((a-1)*(sum(log(p))))
            + (β-1)*sum(log(((p^a)-1)))
            -(α*sum(((p^a)-1)^β))
            return(-logl)
 }

x <- airquality$Solar.R

optim(par=c(1,1,1,1), x = x, fn = logLik.NWL,
      method ="L-BFGS-B",
      lower = c(1,1,1,1), upper = c(Inf,Inf,Inf,Inf),
      hessian = T)

Hi @Yubaba ,

Could you say a little more about what you're trying to achieve and what is going wrong?

I'm trying to find the MLE optimization of the parameters. let me show you my outputs;

as the attachment is showing,
if I run the codes, it doesn't even give output, it stays the same, and the red element that signifies something is still running never disappears until I press enter or escape. this means that there is continuous loop without stop, I think.

you should use triple backticks like

``` 
your code here
```

in order to format your code for the forum; what you shared was not legible.

This is the "stop sign" icon, which appears when R is either busy running your code, or when the code you have provided R is not a complete statement, in which case R is waiting for you complete the statement.

From your screenshot, I can see it would be good to familiarize yourself with the basics of R syntax and how R works, so I would suggest this as a starting place:

and as you work through the basics, you can post again if any questions arise for you.