Displaying 20 results from an estimated 275 matches for "pmax".
Did you mean:
max
2003 Jan 31
2
minor error in documentation of pmax in base (PR#2513)
The documentation says, "pmax and pmin take several vectors as
arguments and return a single vector giving the parallel maxima
(or minima) of the vectors."
I discovered that, if you use a matrix or array instead of a
vector, pmax returns a matrix or array, respectively.
This makes pmax and pmin much more useful, and shou...
2010 Sep 07
0
AHRQ - Creation of Comorbidity Variables
...ndrg = c(305, paste(0, 79, sep = ""))
psydrg = c(885)
obesedrg = c(619:621)
deprsdrg = c(881)
### FLAG
###################################################################
flag = matrix(0, 1, 30)
tmp = matrix(0, 1, 10)
for (i in 2:50) {
flag[1, 1] = pmax(flag[1, 1], as.numeric(c(DX[1, i] %in%
chf)))
flag[1, 2] = pmax(flag[1, 2], as.numeric(c(DX[1, i] %in%
valve)))
flag[1, 3] = pmax(flag[1, 3], as.numeric(c(DX[1, i] %in%
pulmcirc)))
flag[1, 4] = pmax(flag[1, 4], as.numeric(c(DX[1, i] %in...
2015 Dec 24
2
override pmin/pmax for my own matrix
Hello,
I'm trying to override pmin and pmax for my own matrix. These two
functions have ... as an argument. I tried to override them as
follows:
setMethod("pmax", class_name, function(x, ..., na.rm) { ... })
I use this way to override primitive functions such as min/max and it
works fine.
But it doesn't work for pmin and p...
2005 Apr 14
0
predict.glm(..., type="response") dropping names (and a propsed (PR#7792)
...0:03.000000000 -0500
+++ R-beta-fix/src/library/stats/R/family.R 2005-04-14
08:30:03.000000000 -0400
@@ -25,9 +25,9 @@
else if(!is.character(link) && !is.na(lambda <- as.numeric(link))) {
linkfun <- function(mu) mu^lambda
linkinv <- function(eta)
- pmax(.Machine$double.eps, eta^(1/lambda))
+ pmax(eta^(1/lambda), .Machine$double.eps)
mu.eta <- function(eta)
- pmax(.Machine$double.eps, (1/lambda) * eta^(1/lambda - 1))
+ pmax((1/lambda) * eta^(1/lambda - 1), .Machine$double.eps)
valideta <- fun...
2024 Jul 16
2
Automatic Knot selection in Piecewise linear splines
...* sin(pi/8*x) * abs((x-50)/20)^1.25 - (x-40)*(12-x)/64
curve(f(x), 0, 100, n = 1000, col=2, lwd=2)
set.seed(11)
y <- f(x) + 10*rnorm(x)
m.sspl <- smooth.spline(x,y) # base line "standard smoother"
require(earth)
fm1 <- earth(x, y) # default settings
summary(fm1, style = "pmax") #-- got 10 knots (x = 44 "used twice") below
## Call: earth(x=x, y=y)
## y =
## 175.9612
## - 10.6744 * pmax(0, x - 4.625)
## + 9.928496 * pmax(0, x - 10.875)
## - 5.940857 * pmax(0, x - 20.25)
## + 3.438948 * pmax(0, x - 27.125)
## - 3.828...
2019 Jan 21
2
pmax and long vector
I see that base::pmax() does not support long vectors.
Is R-devel interested in reports like this; ie. is there a goal of full
support for long vectors in "basic" functions, something I at least would
greatly appreciate?
MRE:
> pmax(rep(1L, 3*10^9), 0)
Error in pmax(rep(1L, 3 * 10^9), 0) :
long vector...
2005 Dec 20
0
pmin(), pmax() - slower than necessary for common cases
A few hours ago, I was making a small point on the R-SIG-robust
mailing list on the point that ifelse() was not too efficient
in a situation where pmax() could easily be used instead.
However, this has reminded me of some timing experiments that I
did 13 years ago with S-plus -- where I found that pmin() /
pmax() were really relatively slow for the most common case
where they are used with only two arguments {and typically one
of the arguments is...
2019 Jan 21
2
pmax and long vector
Kasper,
If you're not interested or dont have time to create said patch yourself
let me know and i can do it.
Best,
~G
On Mon, Jan 21, 2019, 11:36 AM Duncan Murdoch <murdoch.duncan at gmail.com
wrote:
> On 21/01/2019 12:35 p.m., Kasper Daniel Hansen wrote:
> > I see that base::pmax() does not support long vectors.
> >
> > Is R-devel interested in reports like this; ie. is there a goal of full
> > support for long vectors in "basic" functions, something I at least would
> > greatly appreciate?
> >
> > MRE:
> >
> >> p...
2024 Jul 26
1
Automatic Knot selection in Piecewise linear splines
...x)/64
> curve(f(x), 0, 100, n = 1000, col=2, lwd=2)
>
> set.seed(11)
> y <- f(x) + 10*rnorm(x)
>
> m.sspl <- smooth.spline(x,y) # base line "standard smoother"
>
> require(earth)
> fm1 <- earth(x, y) # default settings
> summary(fm1, style = "pmax") #-- got 10 knots (x = 44 "used twice") below
> ## Call: earth(x=x, y=y)
>
> ## y =
> ## 175.9612
> ## - 10.6744 * pmax(0, x - 4.625)
> ## + 9.928496 * pmax(0, x - 10.875)
> ## - 5.940857 * pmax(0, x - 20.25)
> ## + 3.438948...
2012 Oct 30
4
There is pmin and pmax each taking na.rm, how about psum?
Hi,
Please consider the following :
x = c(1,3,NA,5)
y = c(2,NA,4,1)
min(x,y,na.rm=TRUE) # ok
[1] 1
max(x,y,na.rm=TRUE) # ok
[1] 5
sum(x,y,na.rm=TRUE) # ok
[1] 16
pmin(x,y,na.rm=TRUE) # ok
[1] 1 3 4 1
pmax(x,y,na.rm=TRUE) # ok
[1] 2 3 4 5
psum(x,y,na.rm=TRUE)
[1] 3 3 4 6 # expected result
Error: could not find function "psum" # actual result
I realise that + is already like psum, but what about NA?
x+y
[1] 3 NA NA 6 # can't supply `na.rm=TRUE`...
2024 Jul 09
1
Automatic Knot selection in Piecewise linear splines
How can I do automatic knot selection while fitting piecewise linear
splines to two variables x and y? Which package to use to do it simply? I
also want to visualize the splines (and the scatter plot) with a graph.
Anupam
[[alternative HTML version deleted]]
2015 Dec 24
0
override pmin/pmax for my own matrix
Yes, functions like c, min and max are special cases, as they are
primitives. For ordinary functions, you just need to promote them with
"..." as the signature:
setGeneric("pmax", signature="...")
setMethod("pmax", "Class", function(..., na.rm=FALSE) { })
One caveat is that all arguments passed via "..." must derive from the
class specified for "..." in the method signature. At some point we
should solve that by intro...
2008 Jul 04
2
create a zero matrix & fill
...:Object cannot be transformed in double)
> plot(Variation[1],Variation[2])
Fehler in as.double.default(x) : (list) Objekt kann nicht nach 'double'
umgewandelt werden
Any suggestion?
Hier is the function:
#Computing variation of the power
VAR<-function(power,length){
tvar=pmean=pmin=pmax=varmax=varmin<-matrix(data=0,ncol=(length-tml0))
for(i in tml0:length){
tvar[i]=i
pmean[i]=mean(power[i:(i+deltat)])
pmin[i]=min(power[i:(i+deltat)])
pmax[i]=max(power[i:(i+deltat)])
varmax[i]=100*(pmax[i]-pmean[i])/pmean[i]
varmin[i]=100*(pmean[i]-pmin[i])/pmean[i]
Results=list(tvar,pmean,pmin,...
2018 Jan 20
1
max and pmax of NA and NaN
Extremes.Rd, that documents 'max' and 'pmax', has this in "Details" section, in the paragraph before the last.
By definition the min/max of a numeric vector containing an NaN is NaN, except that the min/max of any vector containing an NA is NA even if it also contains an NaN.
------------------
>>>>> Michal Burd...
2019 Jan 21
0
pmax and long vector
On 21/01/2019 12:35 p.m., Kasper Daniel Hansen wrote:
> I see that base::pmax() does not support long vectors.
>
> Is R-devel interested in reports like this; ie. is there a goal of full
> support for long vectors in "basic" functions, something I at least would
> greatly appreciate?
>
> MRE:
>
>> pmax(rep(1L, 3*10^9), 0)
>
> Er...
2019 Jan 22
0
pmax and long vector
...nt have time to create said patch yourself
> let me know and i can do it.
>
> Best,
> ~G
>
> On Mon, Jan 21, 2019, 11:36 AM Duncan Murdoch <murdoch.duncan at gmail.com
> wrote:
>
>> On 21/01/2019 12:35 p.m., Kasper Daniel Hansen wrote:
>> > I see that base::pmax() does not support long vectors.
>> >
>> > Is R-devel interested in reports like this; ie. is there a goal of full
>> > support for long vectors in "basic" functions, something I at least
>> would
>> > greatly appreciate?
>> >
>> &g...
2018 Jan 15
1
max and pmax of NA and NaN
Dear R users,
is the following OK?
> max(NA, NaN)
[1] NA
> max(NaN, NA)
[1] NA
> pmax(NaN, NA)
[1] NA
> pmax(NA, NaN)
[1] NaN
...or is it a bug? Documentation says that NA has a higher priority over
NaN.
Best regards, Michal Burda
[[alternative HTML version deleted]]
2015 Mar 25
2
[LLVMdev] Optimization puzzle...
...quot;e-m:o-i64:64-f80:128-n8:16:32:64-S128"
> target triple = "x86_64-apple-macosx10.10.0"
>
> ; Function Attrs: nounwind readnone ssp uwtable
> define { <2 x float>, float } @_Z18sampleNullOperator5PointS_(i64
%pmin.coerce0, i32 %pmin.coerce1, i64 %pmax.coerce0, i32 %pmax.coerce1) #0
{
> _ZN15SamplingClosureD1Ev.exit:
> %0 = icmp sgt i32 %pmin.coerce1, %pmax.coerce1
> ret { <2 x float>, float } zeroinitializer
> }
>
> attributes #0 = { nounwind readnone ssp uwtable
"less-precise-fpmad"=&qu...
2007 Feb 19
6
Data frame: how to create list of row max?
Dear all,
Can anyone please shed some light onto how to do this?
This will give me all "intensity" columsn in my data frame:
intensityindeces <- grep("^Intensity",names(dataframe),value=TRUE)
This will give me the maximum intensity for the first row:
intensityone <- max(dataframe[1,intensityindeces])
What I'm now looking for is how to dfo this for the whole data
2015 Mar 25
3
[LLVMdev] Optimization puzzle...
...uot;
>> > target triple = "x86_64-apple-macosx10.10.0"
>> >
>> > ; Function Attrs: nounwind readnone ssp uwtable
>> > define { <2 x float>, float } @_Z18sampleNullOperator5PointS_(i64
>> %pmin.coerce0, i32 %pmin.coerce1, i64 %pmax.coerce0, i32 %pmax.coerce1) #0
>> {
>> > _ZN15SamplingClosureD1Ev.exit:
>> > %0 = icmp sgt i32 %pmin.coerce1, %pmax.coerce1
>> > ret { <2 x float>, float } zeroinitializer
>> > }
>> >
>> > attributes #0 = { no...