Displaying 14 results from an estimated 14 matches for "funx".
Did you mean:
func
2006 Dec 02
2
nonlinear quantile regression
Hello, I?m with a problem in using nonlinear quantile regression, the
function nlrq.
I want to do a quantile regression o nonlinear function in the form
a*log(x)-b, the coefficients ?a? and ?b? is my objective. I try to use the
command:
funx <- function(x,a,b){
res <- a*log(x)-b
res
}
Dat.nlrq <- nlrq(y ~ funx(x, a, b), data=Dat, tau=0.25, trace=TRUE)
But a can?t solve de problem, How I put the formula ?y ~ funx(x,a,b)??
_________________________________________________________________
MSN Busca: f?cil, r?pido, direto ao po...
2007 Dec 10
2
bug in by.data.frame, R-2.6.1 (PR#10506)
...lt;- gl(2,5)
by(X, g, colMeans)
Suggested fix:
--- by-old.R 2007-12-10 15:26:22.501086600 +0100
+++ by.R 2007-12-10 15:25:58.390477200 +0100
@@ -26,7 +26,7 @@
IND[[1]] <- INDICES
names(IND) <- deparse(substitute(INDICES))[1]
} else IND <- INDICES
- FUNx <- function(x) FUN(data[x,], ...)
+ FUNx <- function(x) FUN(data[x, , drop=FALSE], ...)
nd <- nrow(data)
ans <- eval(substitute(tapply(1:nd, IND, FUNx)), data)
attr(ans, "call") <- match.call()
_
platform i386-pc-mingw32
arch...
2010 Sep 13
2
value returned by by()
...----------start------------------->---
function (data, INDICES, FUN, ..., simplify = TRUE)
{
if (!is.list(INDICES)) {
IND <- vector("list", 1L)
IND[[1L]] <- INDICES
names(IND) <- deparse(substitute(INDICES))[1L]
}
else IND <- INDICES
FUNx <- function(x) FUN(data[x, , drop = FALSE], ...)
nd <- nrow(data)
ans <- eval(substitute(tapply(1L:nd, IND, FUNx, simplify = simplify)),
data)
attr(ans, "call") <- match.call()
class(ans) <- "by"
ans
}
<environment: namespace:base&g...
2008 Apr 15
1
by inconsistently strips class - with fix
...the call to tapply in the function "by":
by.data.frame = function (data, INDICES, FUN, ...)
{
if (!is.list(INDICES)) {
IND <- vector("list", 1)
IND[[1]] <- INDICES
names(IND) <- deparse(substitute(INDICES))[1]
}
else IND <- INDICES
FUNx <- function(x) FUN(data[x, ], ...)
nd <- nrow(data)
<<<<
ans <- eval(substitute(tapply(1:nd, IND, FUNx)), data)
====
ans <- eval(substitute(tapply(1:nd, IND, FUNx, simplify=FALSE)),
data)
>>>>
attr(ans, "call") <- match.call()
class...
2007 Oct 05
1
Sklyar's inline package: how to return a list?
...ix results. Thanks in advance for any code snipplets/advice!
Regards,
Ken
# --------------------------------------------------------------------------------------------------------------------------
> my.mat
[,1] [,2] [,3]
[1,] 1.5 4.5 7.5
[2,] 2.5 5.5 8.5
[3,] 3.5 6.5 9.5
> funx( a=my.mat )
[,1] [,2] [,3]
[1,] -1.5 -4.5 -7.5
[2,] -2.5 -5.5 -8.5
[3,] -3.5 -6.5 -9.5
>
# --------------------------------------------------------------------------------------------------------------------------
library( inline )
c.code <- "
SEXP res;
int nprotect = 0,...
2007 May 22
2
inline C/C++ in R: question and suggestion
...ode[13] <- " d2 = (x-cx)*(x-cx) + (y-cy)*(y-cy);"
code[14] <- " rdata[x + y*nx] = data[x + y*nx] * exp(-d2/sigma2);"
code[15] <- " }}"
code[16] <- " UNPROTECT(nprotect);"
code[17] <- " return res;"
library(inline)
funx <- cfunction(signature(a="array", s="numeric", centre="numeric"), code)
x <- array(runif(50*50), c(50,50,1))
res <- funx(a=x, s=15, centre=c(30,35))
image(res[,,1])
res <- funx(x, 10, c(15,15))
x11(); image(res[,,1])
--
Dr Oleg Sklyar * EBI/EMBL, Cambri...
2000 Jan 31
1
Is there a "by()" function in R like in S?
Hallo R-users,
I'm a R (release 0.65) novice, but have read some about S. Is there a
similar function in R like the S function "by()" ?
This function groups data typically from a matrix by a variable and
applies a function on the grouped data. Example in S:
> by(data, year, summary)
where "data" is a matrix containing the variable "year". After grouping
2000 Apr 28
0
using by() in a function
I have a fix to by.data.frame() that works for my example. Can anyone see a
problem with this?
The old code has:
> get("by.data.frame",3)
function (data, INDICES, FUN, ...)
{
### code skipped to save space
ans <- eval(substitute(tapply(1:nrow(data), IND, FUNx)), ### The problem
seems to be here
data)
attr(ans, "call") <- match.call()
class(ans) <- "by"
ans
}
>
My change is:
Nseq <- 1:nrow(data)
ans <- eval(substitute(tapply(Nseq, IND, FUNx)),
data)
I think what happens in the or...
2011 Jul 12
1
LOESS function Newton optimization
I have a question about running an optimization function on an existing LOESS
function defined in R. I have a very large dataset (1 million observations)
and have run a LOESS regression. Now, I want to run a Newton-Raphson
optimization to determine the point at which the slope change is the
greatest.
I am relatively new to R and have tried several permutations of the maxNR
and nlm functions with
2009 Dec 22
0
Rcpp 0.7.0: R/C++ integration now even easier
...ned long) seed);
for (int i=0; i<len; i++) {
v[i] = gsl_rng_get (r);
}
gsl_rng_free(r);
return RcppSexp(v).asSexp();
'
## turn into a function that R can call
## compileargs redundant on Debian/Ubuntu as gsl headers are found anyway
funx <- cfunction(signature(s="numeric", n="numeric"),
gslrng,
includes="#include <gsl/gsl_rng.h>",
Rcpp=TRUE,
cppargs="-I/usr/include",
libargs=...
2009 Dec 22
0
Rcpp 0.7.0: R/C++ integration now even easier
...ned long) seed);
for (int i=0; i<len; i++) {
v[i] = gsl_rng_get (r);
}
gsl_rng_free(r);
return RcppSexp(v).asSexp();
'
## turn into a function that R can call
## compileargs redundant on Debian/Ubuntu as gsl headers are found anyway
funx <- cfunction(signature(s="numeric", n="numeric"),
gslrng,
includes="#include <gsl/gsl_rng.h>",
Rcpp=TRUE,
cppargs="-I/usr/include",
libargs=...
2000 Apr 28
1
Using 'by()' in a function
I have a list of dataframes, and want to apply a function to subsets of the rows
of each dataframe. It seemed natural to write a function that takes a dataframe
as an argument, and uses 'by() within it to apply the function to the dataframe
subsets. However, I cannot get it to work. The problem seems to be passing the
data argument of by() as a function argument. Is this bug, or am I
2008 Sep 09
1
survey package
Version 3.9 of the survey package is now on CRAN. Since the last
announcement (version 3.6-11, about a year ago) the main changes are
- Database-backed survey objects: the data can live in a SQLite (or other
DBI-compatible) database and be loaded as needed.
- Ordinal logistic regression
- Support for the 'mitools' package and multiply-imputed data
- Conditioning plots,
2008 Sep 09
1
survey package
Version 3.9 of the survey package is now on CRAN. Since the last
announcement (version 3.6-11, about a year ago) the main changes are
- Database-backed survey objects: the data can live in a SQLite (or other
DBI-compatible) database and be loaded as needed.
- Ordinal logistic regression
- Support for the 'mitools' package and multiply-imputed data
- Conditioning plots,