Displaying 20 results from an estimated 200 matches similar to: "setMethod() woes"
2006 Aug 30
1
setMethod() and log()
Hi
I am having difficulty with setMethod(). I have a "brob" class of
objects whose
representation has two slots: "x" and "positive". Slot "x" (double)
holds the log
of a number and slot "positive" (logical) its sign. The idea is
that large numbers
can be handled.
I'm trying to implement a log() method using an analogue of the
2006 Oct 31
1
setReplaceMethod
Hi
If x <- 1:10 then x[5] <- 1i will promote
x to be a complex vector.
Suppose I have an S4 class "brob", and have functions
is.brob(), as.brob(), as.numeric() and so forth (minimal self-contained
code below).
If x is numeric (1:10, say) and y is a brob, what
is the best way to make
x[5] <- y
promote x to a brob in the same way as the complex example?
Or is
2008 May 28
1
indexing lists, using brobdingnagian
Dear R-Gurus,
I have ended up with a calculation problem where I need to use brobs.
I have to work my way through a vector with a for loop to act on each
element in a calculation (refering to the previous
value in the new vector of results -- so as far as I know I can't use
"apply") -- this produces a list of brobs.
My problem is, how do I act on, plot this list, or do vector
2007 Aug 30
7
Behaviour of very large numbers
Dear all,
I am struggling to understand this.
What happens when you raise a negative value to a power and the result
is a very large number?
B
[1] 47.73092
> -51^B
[1] -3.190824e+81
# seems fine
# now this:
> x <- seq(-51,-49,length=100)
> x^B
[1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN <snip>
> is.numeric(x^B)
[1] TRUE
> is.real(x^B)
[1]
2006 Sep 04
1
setMethod("Summary")
Hi everyone and thanks for being patient. I've used "!.foo"() et
seq pro tem.
Next problem: how to define "Summary" methods for brobs.
?max says
'max' and 'min' are generic functions: methods can be defined for
them individually or via the 'Summary' group generic. For this to
work properly, the arguments '...' should be
2006 Sep 01
1
setMethod("Logic", ...)
Hi
In V&R the "polynomial" class is explicitly specified to have no
logical operators:
setMethod("Logic", signature(e1="polynomial"), function(e1,e2){stop
("...")})
I too have a class of objects for which I want to
specify that Logic operators do not work, but executing
setClass("brob",
representation = representation
2010 Oct 08
2
Error message in as.brob Usage
I am getting the following error message while using the as.brob function in
some computations:
Error in out.x[ss] <- pmax(x1[ss], x2[ss]) + log1p(+exp(-abs(x1[ss] - :
NAs are not allowed in subscripted assignments
Is there any obvious mistake I am making here that can resolve the above
error message?
Thanks for your help.
Chow
--
View this message in context:
2007 Jan 12
0
Dummy's guide to S4 methods: package Brobdingnag
Hello List.
please find uploaded to CRAN a new package, Brobdingnag.
This package does two things:
(1) allows computation of very large numbers using a logarithmic
representation.
(2) provides a "Hello, World" example of S4 methods in use: there are
two classes of object
(brob and glub) and one virtual class (swift). The package
includes a vignette that is a
2007 Nov 21
1
equivalent of Matlab robustfit?
Hi,
I've been using the Matlab robustfit function for linear regressions
where I suspect some data points are outliers. Is there an equivalent
function in R?
Take care, Darren
PS, This is the Matlab help on robustfit:
>> help robustfit
ROBUSTFIT Robust linear regression
B = ROBUSTFIT(X,Y) returns the vector B of regression coefficients,
obtained by performing robust
2006 Sep 12
1
package.skeleton() in R-2.4.1
Hi
R version 2.4.0 alpha (2006-09-06 r39158)
MacOSX 10.4.7
There was a thread some time ago as to whether the structure created by
package.skeleton() would pass R CMD check.
I have an example where package.skeleton() gives an R file that gives an
error when sourced.
If I type
setClass("brob",
representation = representation
2019 Feb 03
1
Inefficiency in df$col
While doing some performance testing with the new version of pqR (see
pqR-project.org), I've encountered an extreme, and quite unnecessary,
inefficiency in the current R Core implementation of R, which I think
you might want to correct.
The inefficiency is in access to columns of a data frame, as in
expressions such as df$col[i], which I think are very common (the
alternatives of
2012 Sep 28
1
ConfBridge dtmf_passthrough=no doesn't have any effect. Bug?
Hi list!
ConfBridge dtmf_passthrough=no doesn't seem to have any effect. DTMF
gets transmitted throughout the conference. I've tried Asterisk 10.7.1
from the official RPMs and 10.8.0 compiled from source.
I've confirmed that it's disabled via the CLI "confbridge show profile
user <profilename>".
It's an all-SIP scenario with RFC2833 as the DTMF protocol.
2019 Jun 23
2
Calculation of e^{z^2/2} for a normal deviate z
I agree with many the sentiments about the wisdom of computing very
small p-values (although the example below may win some kind of a prize:
I've seen people talking about p-values of the order of 10^(-2000), but
never 10^(-(10^8)) !). That said, there are a several tricks for
getting more reasonable sums of very small probabilities. The first is
to scale the p-values by dividing the
2009 Feb 11
5
How to handle large numbers?
Dear R,
I have two questions:
1, Why both R and Matlab give 0*Inf==NaN? To my knowledge, it should be zero
mathematically. Am I right?
2, I need to calculate e.g. exp(a)/(exp(b)+c), where both a and b are very
large numbers (>>1000, e.g a=1000, b=1007, and c=5). R gives me NaN when I
use the following command:
> exp(1000)/(exp(1007)+5)
[1] NaN
I am pretty sure this should be close to
2008 Sep 16
0
FW: odesolve dynload example
HI R Gurus,
> This is my first foray into using c-code with R, so ...
> I had a look at the archives and did not find anything on this, so
> hopefully I am not doubling up.
>
I have previously used the following approach where I needed some very
small numbers/large (using Brobdingnag):
surfacewithdiff <- function(t, y, p)
{
const=p["const"]
kay
2008 Sep 16
0
lsoda( linking to GMP for big numbers from C code)
Hi R used with C-code experts,
I had a look at the archives and did not find anything on this, so
hopefully I am not doubling up.
I have previously used the following approach where I needed some very
small/large numbers (using Brobdingnag):
surfacewithdiff <- function(t, y, p)
{
const=p["const"]
kay =p["kay"]
psii=p["psii"]
2008 May 21
2
\S4method in combination with "[" and "[<-"
Dear developers,
We want to use "\S4method" to document new S4-methods for "[" and "[<-".
We use this for other functions/methods and it works without any
problem, but in case of "[" and "[<-" we didn't manage to bring this to
work.
The problem occurs in the development version of our package "distrSim"
which can be found
2019 Jun 24
2
Calculation of e^{z^2/2} for a normal deviate z
>>>>> William Dunlap via R-devel
>>>>> on Sun, 23 Jun 2019 10:34:47 -0700 writes:
>>>>> William Dunlap via R-devel
>>>>> on Sun, 23 Jun 2019 10:34:47 -0700 writes:
> include/Rmath.h declares a set of 'logspace' functions for use at the C
> level. I don't think there are core R functions that call
2019 Jun 23
0
Calculation of e^{z^2/2} for a normal deviate z
include/Rmath.h declares a set of 'logspace' functions for use at the C
level. I don't think there are core R functions that call them.
/* Compute the log of a sum or difference from logs of terms, i.e.,
*
* log (exp (logx) + exp (logy))
* or log (exp (logx) - exp (logy))
*
* without causing overflows or throwing away too much accuracy:
*/
double Rf_logspace_add(double
2019 Jun 24
0
Calculation of e^{z^2/2} for a normal deviate z
Hi All,
Thanks for all your comments which allows me to appreciate more of these in Python and R.
I just came across the matrixStats package,
## EXAMPLE #1
lx <- c(1000.01, 1000.02)
y0 <- log(sum(exp(lx)))
print(y0) ## Inf
y1 <- logSumExp(lx)
print(y1) ## 1000.708
and
> ly <- lx*100000
> ly
[1] 100001000 100002000
> y1 <- logSumExp(ly)
> print(y1)
[1] 100002000