Hi All, I am receiving this error Error in eval(expr, envir, enclos) : could not find function ?LL? the following is in a for loop and all the variables are defined and have values. Prob[i,1]=log(((((sigma)^((1-M[i,1]))))* factorial(M[i,1]-1))*(Fmul[i,1])*(Fsum[i,1])*(EV1[i,1])/((EV2[i,1])^(M[i,1]))) LL=LL*Prob[i,1] thanks
You assert "all the variables are defined and have values" but something is wrong that you are not showing us. Please read [1] and make your example reproducible. Also post in plain text (a setting in your email software) so we don't have to decipher a mangled version of what you write on this plain-text-only mailing list. [1] http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example --------------------------------------------------------------------------- Jeff Newmiller The ..... ..... Go Live... DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/Batteries O.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --------------------------------------------------------------------------- Sent from my phone. Please excuse my brevity. On November 4, 2015 7:18:25 AM PST, Alaa Sindi <alaasindi at gmail.com> wrote:>Hi All, > >I am receiving this error > >Error in eval(expr, envir, enclos) : could not find function ?LL? > >the following is in a for loop and all the variables are defined and >have values. > >Prob[i,1]=log(((((sigma)^((1-M[i,1]))))* >factorial(M[i,1]-1))*(Fmul[i,1])*(Fsum[i,1])*(EV1[i,1])/((EV2[i,1])^(M[i,1]))) > > > LL=LL*Prob[i,1] > >thanks > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.
You need to show more (e.g., the entire function, the output of traceback() after the error) to get a definitive answer, but that error message can occur if you mistakenly use parentheses instead of square brackets when subscripting LL. E.g., > LL <- 11:20 > LL[3:4] [1] 13 14 > LL(3:4) Error: could not find function "LL" Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Nov 4, 2015 at 7:18 AM, Alaa Sindi <alaasindi at gmail.com> wrote:> Hi All, > > I am receiving this error > > Error in eval(expr, envir, enclos) : could not find function ?LL? > > the following is in a for loop and all the variables are defined and have > values. > > Prob[i,1]=log(((((sigma)^((1-M[i,1]))))* > factorial(M[i,1]-1))*(Fmul[i,1])*(Fsum[i,1])*(EV1[i,1])/((EV2[i,1])^(M[i,1]))) > > LL=LL*Prob[i,1] > > thanks > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.[[alternative HTML version deleted]]
No, I meant for you to (a) show an example that anyone could run and reproduce your problem (b) show the output you get when calling traceback() after you ran into the error. The lines and error messages you show now are different than the ones you showed before, but I see you are call mlogit.optim, which I assume comes from the mlogit pacakge. help(mlogit.optim) shows mlogit.optim(logLik, start, method = c("bfgs", "nr", "bhhh"), iterlim = 2000, tol = 1E-06, ftol = 1e-08, steptol = 1e-10, print.level = 0, constPar = NULL, ...) Arguments: logLik: the likelihood function to be maximized, It looks like your LL is a numeric vector and mlogit.optim expects a function, so the original error message may come from there. By the way, you should stop at the first error message and straighten things out before proceeding. Otherwise all is likely to be garbage. Bill Dunlap TIBCO Software wdunlap tibco.com On Wed, Nov 4, 2015 at 8:05 AM, Alaa Sindi <alaasindi at gmail.com> wrote:> Do you mean these lines? Thanks > > Prob[i,1]=log(((((sigma)^((1-M[i,1]))))* > factorial(M[i,1]-1))*(Fmul[i,1])*(Fsum[i,1])*(EV1[i,1])/((EV2[i,1])^(M[i,1]))) > + > + LL=LL*Prob[i,1] > + } > Error in HICKSEXP[i, 1] : incorrect number of dimensions > > > > > Start=c(1,1,1,1,1,1,1,1,1,1,1,1) > > > > > > semsem=mlogit.optim > ( LL , Start, method = 'nr', iterlim = 2000, tol = 1E-06, ftol = 1e-08, > steptol = 1e-10, print.level = 0) > Error in eval(expr, envir, enclos) : could not find function ?LL" > > > On Nov 4, 2015, at 10:56 AM, William Dunlap <wdunlap at tibco.com> wrote: > > You need to show more (e.g., the entire function, the output of traceback() > after the error) to get a definitive answer, but that error message can > occur > if you mistakenly use parentheses instead of square brackets when > subscripting > LL. E.g., > > LL <- 11:20 > > LL[3:4] > [1] 13 14 > > LL(3:4) > Error: could not find function "LL" > > > Bill Dunlap > TIBCO Software > wdunlap tibco.com > > On Wed, Nov 4, 2015 at 7:18 AM, Alaa Sindi <alaasindi at gmail.com> wrote: > >> Hi All, >> >> I am receiving this error >> >> Error in eval(expr, envir, enclos) : could not find function ?LL? >> >> the following is in a for loop and all the variables are defined and have >> values. >> >> Prob[i,1]=log(((((sigma)^((1-M[i,1]))))* >> factorial(M[i,1]-1))*(Fmul[i,1])*(Fsum[i,1])*(EV1[i,1])/((EV2[i,1])^(M[i,1]))) >> >> LL=LL*Prob[i,1] >> >> thanks >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide >> http://www.R-project.org/posting-guide.html >> <http://www.r-project.org/posting-guide.html> >> and provide commented, minimal, self-contained, reproducible code. > > > >[[alternative HTML version deleted]]