Displaying 20 results from an estimated 4000 matches similar to: "problem with function involving ifelse and integrate"
2002 Jul 14
1
help with adapt function
Dear People,
I'm trying to use the function adapt, from the adapt library package,
which does multidimensional numerical integration. I think I must be using
the wrong syntax or something, because even a simple example does not
work. Consider
foo <- function(x){x[1]*x[2]}
and
adapt(2, lo = c(-1,-1), up = c(1,1), functn = foo)
This simply hangs. A more complicated example crashes R,
2007 Nov 14
0
R Crashes on certain calls of Adapt
I'm having trouble with adapt. I'm trying to use it in a Bayesian setting,
to integrate the posterior distribution, and to find posterior means. I
tried using the following script, and things went ok:
data = rnorm(100,0.2,1.1)
data = c(data,rnorm(10,3,1))
data = data[abs(data)<2*sd(data)]
prior = function(x){
dgamma(x[2],shape=2,scale=1)*dnorm(x[1],0,.5)
}
liklihood =
2007 Mar 28
1
warnings on adapt
Hi all
I was wondering if someone could help me.
I have to estimate some parameters, so I am using the function nlm. Inside
this function I have to integrate, hence
I am using the function adapt.
I don't understand why it is giving the following warnings:
At the beginning:
Warning: a final empty element has been omitted
the part of the args list of 'c' being evaluated was:
2000 Sep 14
0
modifying Openssh config script for KTH-KRB (fwd)
Dear OpenSSH developers,
Hi, taking the liberty of sending this to your mailing list in the hope
someone will be able to help. The KTH version of Kerberos 4 was the only
one I was able to find.
In case you don't want to look at all the stuff below, the situation is
briefly that I am trying to compile openssh with kerberos 4 support, which
it apparently has. However, it can't find krb.h,
2001 Feb 07
1
Re: failed rpm installation of R 1.2-1 (fwd)
On Wed, 7 Feb 2001, Faheem Mitha wrote:
> Dear Albrecht,
>
> Just sent the following message out to r-help. Have you any idea what this
> problem could be?
>
> Sincerely, Faheem Mitha.
>
> ---------- Forwarded message ----------
> Date: Wed, 7 Feb 2001 00:04:35 -0500 (EST)
> From: Faheem Mitha <faheem at email.unc.edu>
> To:
2001 Mar 08
1
inconsistent results when calling functions with other func (PR#869)
Hello Bug people,
I have an unexpected behavior and am unsure whether the problem is in my
thinking, my implementation or the program R.
Basically I get two different answers depending on how I call a function
which takes other functions as arguments as indicated below.
To me it should make no difference if f is a function that returns the
function g then z(f(x)) whould give the same as
y<-
2001 Feb 08
0
RE: [R] Re: failed rpm installation of R 1.2-1 (fwd) (PR#841)
I'm forwarding this to R-bugs.
In R 1.2.1 the file $R_HOME/bin/maketitle.awk is installed as an
executable. It should not be since it is just a set of awk commands,
not a script file that can be run from the shell (This is a change from
R 1.2.0 in which the file $R_HOME/bin/maketitle was a shell script).
This confuses an rpm utility called "find-requires" which scans all
executable
2000 Feb 29
0
Re: R-1.0.0 is released
Faheem Mitha <faheem@email.unc.edu> writes:
> Dear Dr. Dalgaard,
>
> I am sending this message only to you since it is probably not of general
> interest. Forward it to anyone you like.
>
> Congratulations to the R development team on the release of version 1.0.0
> of R. If you will excuse me asking, I was wondering if there are any plans
> to release a rpm of
2000 Sep 03
1
installing OpenSSH rpm on SuSE 6.2
I am taking the liberty of forwarding this message to the list. I am
not subscribed to it. If you want to reply to me, please send email to
faheem at email.unc.edu
Thanks, Faheem Mitha.
---------- Forwarded message ----------
From: Faheem Mitha <faheem at email.unc.edu>
Newsgroups: comp.security.ssh
Subject: installing OpenSSH rpm on SuSE 6.2
Dear people,
I tried
2002 Jun 15
2
using integrate on a function defined with if
Dear R People,
I getting some curious behaviour with the integrate function. Consider the
function
foo <- function(x)
{
if(x==0)
4
else
0
}
I get the error
> integrate(foo,0,1)
Error in integrate(foo, 0, 1) : evaluation of function gave a result of
wrong length
But now consider
foo <- function(x)
{
ifelse(x==0,4,0)
}
> integrate(foo,0,1)
0 with absolute error
2007 Oct 29
1
meaning of lenwrk value in adapt function
R-listers,
In using the adapt function, I am getting the following warning:
Ifail=2, lenwrk was too small. -- fix adapt() !
Check the returned relerr! in: adapt(ndim = 2, lower = lower.limit,
upper = upper.limit, functn = pr.set,
Would someone explain what the 'lenwrk' value indicates in order to help
diagnose this issue.
Also, what are the possible codes for Ifail, so I can set
2001 Sep 23
1
plot with no tick marks
Dear R people,
I have the following simple bit of code to make a plot. I want to suppress
tick marks on the axes of the plot. I've been trying everything I can
think of to do so, but have been unsuccessful. Can you help me? If you
reply, please cc me, I'm not currently subscribed to the list.
Thanks in advance.
Sincerely, Faheem Mitha.
num <- 1:i
inc
2001 Oct 18
1
rsync logging and permission problems
Dear rsync people,
I have just started using rsync for backups. I have had a couple of
issues. Note I'm trying to use rsync as user using ssh between two
machines both running Debian GNU/Linux potato (2.2r3). The local machine
is currently running 2.4.6-1 and the remote 2.3.2-1.2.
1) When I run rsync with the vv option, stuff scrolls of my screen faster
than I can read it. I was wondering if
2001 Feb 08
4
eps file not positioned properly in latex document
Dear People,
I am trying to include a barplot (see code below), in a latex document.
However, the plot appears in totally the wrong position. I know this is
not an R question as such, but the eps file is produced by R and I thought
that perhaps other people had had similar problems and could give me
pointers. Am I doing anything obviously wrong?
Sincerely, Faheem Mitha.
PS.
2001 Mar 13
1
passing arguments to R CMD SHLIB
Dear People,
I want to run gcc with optimisation turned on (-O2), and with -Wall (all
warnings) enabled, when using R CMD SHLIB. When I do make, which is
R CMD SHLIB -Wall -O2 cftp.c mcmc.c latticefn.c -lm
in this case, I get
faheem ~/research/cftp>make
R CMD SHLIB -Wall -O2 cftp.c mcmc.c latticefn.c -lm
make[1]: Entering directory `/home/faheem/research/cftp'
gcc -I/usr/lib/R/include
2002 Jul 24
1
loading compiled C++ code as shared library
Dear People,
Over the last few days I've been writing C++ to compile as a shared
library (previously I have always used C). Not entirely to my surprise, I
am getting errors. Specifically, when I try to load the shared library, I
get
Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to load shared library
"/home/faheem/research/thesis/sim/ms/ms.so":
2000 Apr 07
1
lme questions (was difference between splus and R)
> Date: Fri, 7 Apr 2000 09:55:08 -0400 (EDT)
> From: Faheem Mitha <faheem at email.unc.edu>
[I have given a more meaningful subject line.]
> On Fri, 7 Apr 2000, Prof Brian D Ripley wrote:
>
> > On Thu, 6 Apr 2000, Faheem Mitha wrote:
> >
> > > I'm running splus 5 on a solaris platform remotely, and running R on linux
> > > on my home machine.
2003 Mar 16
1
R CMD SHLIB uses foo.c instead of foo.cc if both are present (PR#2644)
Full_Name: Faheem Mitha
Version: 1.6.2
OS: Debian GNU/Linux
Submission from: (NULL) (209.42.199.193)
Suppose you are making a shared library using
R CMD SHLIB foo.cc
If there is a file called foo.c in the same directory, then it will be used
instead.
faheem ~/scratch/r-base>R CMD SHLIB foo.cc
gcc-3.0 -I/usr/lib/R/include -D__NO_MATH_INLINES -mieee-fp -fPIC -g -O2
-c foo.c -o foo.o
2001 Feb 27
1
using fmod in C code to be loaded into R
Dear People,
I wrote the following bit of C code and (along with other bits) called it
mycode.c, and compiled the file into a shared library to load into R,
using R CMD SHLIB mycode.c. This was Ok, but when I tried to load this
into R using dyn.load("mycode.so") I got the error
> dyn.load("mycode.so")
Error in dyn.load(x, as.logical(local), as.logical(now)) :
unable to
2001 Mar 12
1
loading shared libraries at startup
Dear people,
I compiled a bit of C code into a shared library cftpR.so, and load it
into R at runtime using
> dyn.load("cftpR.so")
This works fine, however when I put
.First <- function()
{
dyn.load("/home/faheem/research/cftp/cftpR.so")
}
(using absolute path names; also tried with just dyn.load("cftpR.so")),
into my .Rprofile to load the library at