Does the following pattern resemble what you have?
Here are a couple of functions that use the same code for finding the
location of the minimum of a function fn:
f1 <- function(x) {
fn <- function(beta) {
sum((x-beta)^2)
}
argMinFn <- function() {
bet
In line
On 03/10/2015 23:56, Steven Yen wrote:
Thanks Bill. Simplified content of max.calls.R (with repeated calls to
maxLik removed) are shown below in the message. No, fn does not exist in
the environment.
Which explains why R cannot find it.
I call a routine (say probit.R compiled into a
Thanks Bill. Simplified content of max.calls.R (with repeated calls to
maxLik removed) are shown below in the message. No, fn does not exist in
the environment. I call a routine (say probit.R compiled into a library) to
use maxLik. Inside this routine,
1. In probit.R. likelihood function is defined
Does an object called 'fn' exist anywhere after you call source()?
Start looking by typing
fn
and see if it is the global environment.
You will have to show what is in the file "z:\\R\\yenlib\\lib\\max.calls.R".
Some people like to start such files with things like
remove(list=objects())
(T
Thanks Michael. I am a new hand with R so this is over my head. I will
slowly explore all options suggested but for now I'd glad to get one option
to work. How do you 'declare the function into the routine I am sourcing,
i.e., max.calls? Is there something I can read?
On Sat, Oct 3, 2015 at 8:47 A
You did put the declaration of the function fn into the file you are
sourcing, didn't you?
If it were me I would
1 - make fn a parameter of max.calls
2 - use the ellipsis ... so I could pass other arguments in to MaxLike
3 - fix the errors I got from making it a package. It does not lie when
it
Hi
I collect a list of calls to a package in a function (routine) so that I do
not need to repeat the same sets of codes from program to program. In the
following, inserting the function into each program works. Then, I place
the function elsewhere in a PC folder, and include in with a 'source'
com
7 matches
Mail list logo