r - Error: object 'mle.result' not found -


i wrote these r codes simulation , estimation given below.

library(numderiv) library(matrix) library(lambertw)  alpha=3.5 beta=2.0 theta=0.5 lambda=4.0  n=50 #generate random variable uniform distribution u<-0 u=seq(0,0.99,0.01)  (q in 1:n) {    x[q]<- (lambda/beta)*     w((((beta/lambda^2)*log(1-theta*u[q]/(1-u[q]))*           exp(beta/lambda)))^(1/alpha),branch = 0) }  bxiiwg_ll <- function(par){   -sum(log(par[1]*par[2]*x^(par[2]-1)*(1+x)+    par[3]*par[2]*x^(par[2]-1))*(1-par[4])*(1+x^par[2])^(-par[3]-1)*         exp(-par[1]*x^par[2])/(1-par[4]          (1+x^par[2])^(-par[3])*exp(-par[1]*x^par[2]))^(2))  #maximum likelihood estimation mle.result <- nlminb(c(alpha,beta,theta,lambda),     bxiiwg_ll,lower=0,upper=inf) 

the results got follows:

(1) error: object 'mle.result' not found.
(2) warnings: in w((((beta/lambda^2) * log(1 - theta * u[q]/(1 - u[q])) : values of (((beta/lambda^2) * log(1 - theta * u[q]/(1 - u[q])) * exp(beta/lambda)))^(1/alpha) na or nan. returning 'na' these entries.

how solve these problems?

your problem due result in

  (((beta/lambda^2)*log(1-theta*u[q]/(1-u[q]))*               exp(beta/lambda)))^(1/alpha) 

for q=2 obtain (-0.001043497)^ 0.2857143 =nan.. , suppose same q>2 want?

also.. function bxiiwg_ll uses x, doesn't receive x input.. right?

try this: library(numderiv) library(matrix) library(lambertw) library(pracma)

alphaden=7 alphanum=2 beta=2.0 theta=0.5 lambda=4.0  n=50 #generate random variable uniform distribution u<-0 u=seq(0,0.99,0.01) x= c()  (q in 1:n) {   numb =((beta/lambda^2)*log(1-theta*u[q]/(1-u[q]))*exp(beta/lambda))   numbpow = numb^alphanum   sqrtnumb= nthroot(numbpow,alphaden)   x[q]<- (lambda/beta)*numb     w(,branch = 0) } 

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -