Displaying 20 results from an estimated 900 matches similar to: "a faster and shorter way to perform calculations?"
2007 Aug 28
1
alternate methods to perform a calculation
Consider a data frame (x) with 2 variables, x1 and x2, having equal values.
It looks like:
x1 x2
1 1
2 2
3 3
Now, consider a second data frame (xk):
xk1 xk2
0.5 0.5
1.0 0.5
1.5 0.5
2.0 0.5
0.5 1
1.0 1
1.5 1
2.0 1
0.5 1.5
1.0 1.5
1.5 1.5
2.0 1.5
0.5 2
1.0 2
1.5 2
2.0 2
I have written code to calculate some differences between these
2007 Aug 31
2
memory.size help
I keep getting the 'memory.size' error message when I run a program I have
been writing. It always it cannot allocate a vector of a certain size. I
believe the error comes in the code fragement below where I have multiple
arrays that could be taking up space. Does anyone know a good way around
this?
w1 <- outer(xk$xk1, data[,x1], function(y,z) abs(z-y))
w2 <- outer(xk$xk2,
2008 Feb 21
0
extending code to handle more variables
useR's,
Consider the variables defined below:
yvals <- c(25,30,35)
x1 <- c(1,2,3)
x2 <- c(3,4,5)
x3 <- c(6,7,8)
x <- as.data.frame(cbind(x1,x2,x3))
delta <- c(2.5, 1.5, 0.5)
h <- delta/2
vars <- 3
xk1 <- seq(min(x1)-0.5, max(x1)+0.5, 0.5)
xk2 <- seq(min(x2)-0.5, max(x2)+0.5, 0.5)
xk3 <- seq(min(x3)-0.5, max(x3)+0.5, 0.5)
xks <- list(xk1,xk2,xk3)
xk <-
2008 Jan 30
1
re stricting points in a data frame
useR's,
Consider some variables and a data frame of points:
x1 <- c(1,2,3)
x2 <- c(3,4,5)
xk1 <- seq(min(x1)-.5, max(x1)+.5,.5)
xk2 <- seq(min(x2)-.5, max(x2)+.5,.5)
expand.grid(xk1=xk1,xk2=xk2)
xk1 xk2
1 0.5 2.5
2 1.0 2.5
3 1.5 2.5
4 2.0 2.5
5 2.5 2.5
6 3.0 2.5
7 3.5 2.5
...
46 2.0 5.5
47 2.5 5.5
48 3.0 5.5
49 3.5 5.5
I want to restrict the data frame to only contain
2008 Jan 07
1
Avoiding FOR loops
useR's,
I would like to know if there is a way to avoid using FOR loops to perform
the below calculation.
Consider the following data:
> x
[,1] [,2] [,3]
[1,] 4 11 1
[2,] 1 9 2
[3,] 7 3 3
[4,] 3 6 4
[5,] 6 8 5
> xk
Var1 Var2 Var3
1 -0.25 1.75 0.5
2 0.75 1.75 0.5
3 1.75 1.75 0.5
4 2.75 1.75 0.5
5 3.75 1.75
2001 Nov 21
2
distances from points to line
Dear all,
I have discovered that there are many things that I used to do in my GIS
which are easily done directly in R, for example calculating interpoint
distances using geoR and pick out points inside a polygon using splancs.
I now wonder, is there a function to create a line object like a
watercourse and then calculate the distances between many points in space
and this line?
I couldn't
1997 Apr 30
2
R-alpha: New Incomplete Beta Function
Here is a drop-in replacement for the R incomplete beta function.
src/math/pbeta.c
It is a slightly modified version of the cephes library one from
Netlib. In the few cases I tried it seems to give at least 14
digit agreement with the one in S-PLUS (its hard to get more).
I'm not sure what performance is like. I'd like to know if it
helps with some of the problems which have been
2008 Jul 29
3
finding a faster way to do an iterative computation
useR's,
I am trying trying to find out if there is a faster way to do a certain
computation. I have successfully used FOR loops and the apply function to
do this, but it can take some time to fully compute, but I was wondering if
anyone may know of a different function or way to do this:
> x
[1] 1 2 3 4 5
> xk
[1] 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0
I want to do:
1997 Aug 21
1
R-alpha: another ctest question
I have the following problem. Consider a `classical' test which works
for k .ge. 2 samples. Possible interfaces are e.g.
xxx.test(x, g) x ... all data, g ... corresponding groups
xxx.test(x1, ..., xk)
xxx.test(list(x1, ..., xk))
etc etc.
Clearly, the first and the second one are nice, but cannot be combined
without making `g' (i.e., `group') a named argument.
Hence, in
1997 Sep 01
1
R-alpha: old Rdoc 2 new Rdoc
--xk+LtGr+JJ
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Attached is a conversion script for converting current R doc files to
the proposed new format ... I'm not sure if it handles everything
correctly, as I made just some random checks. The main purpose for
posting the thing to the list is such that those interested can get a
look at the new format.
Of
2007 Nov 30
0
Is there any multivariate regression function to combine all variables from a dataset?
Hi everybody,
I've been looking for a function that combines all variables from a
dataset because I need to do multivariate regression.
If we have linear regression with an expression like f(x) = a0 +
sum(ai*xi) what I want to do is something like f(x) = a0 + sum(ai*xi) +
sum(sum(bij * xi * xj)) + sum(sum(sum(cijk*xi*xj*xk))) + ...
So I need a function that combines all the values from
2009 Nov 04
4
unexpected results in comparison (x == y)
Dear readers of the list,
I have a problem a comparison of two data from a vector. The comparison
yields FALSE but should be TRUE. I have checked for mode(), length() and
attributes(). See the following code (R2.10.0):
-----------------------------------------------
# data vector of 66 double data
X =
2003 Oct 28
2
outer function problems
I'm pulling my hair (and there's not much left!) on this one. Basically I'm
not getting the same result t when I "step" through the program and evaluate
each element separately than when I use the outer() function in the
FindLikelihood() function below.
Here's the functions:
Dk<- function(xk,A,B)
{
n0 *(A*exp(-0.5*(xk/w)^2) + B)
}
FindLikelihood <-
2009 Jul 23
1
[PATCH server] changes required for fedora rawhide inclusion.
Signed-off-by: Scott Seago <sseago at redhat.com>
---
AUTHORS | 17 ++++++
README | 10 +++
conf/ovirt-agent | 12 ++++
conf/ovirt-db-omatic | 12 ++++
conf/ovirt-host-browser | 12 ++++
2006 Jun 05
1
Survey - twophase
Dear WizaRds,
I am struggling with the use of twophase in package survey. My goal
is to compute a simple example in two phase sampling:
phase 1: I sample n1=1000 circuit boards and find 80 non functional
phase 2: Given the n1=1000 sample I sample n2=100 and find 15 non
functional. Let's say, phase 2 shows this result together with phase 1:
...................phase1........
2007 Nov 19
2
All nonnegative integer solution
Dear all,
Is there any method in R to find all possible nonnegative integer
solutions to the linear equation with unit coefficients as follow:
X1+X2+...+Xk=N
Thank you,
Amin Zollanvari
2009 Jan 19
2
Using apply to generate matrix from rows?
Dear all,
I have a simple question which I unfortunately do not seem to be able
to solve myself. I have a (NxK) matrix and want to generate a new
matrix by multiplying each row with itself such that the new matrix
has dimension ((N*K)xK) (or better, generate an array with dimension
(K,K,N)). I tried apply, but that did not work. Any suggestions?
Thanks!
Stephan
## Here is a simple
2005 Nov 22
1
[PATCH] Introducing Zero-Knowledge user authentication
Hello!
With this email we release an extension to OpenSSH that was initially
developed as project for our studies at the Univerity of Applied Sciences in
Hagenberg.
First we would like to describe the purpose of using Zero-Knowledge (ZK) for
user authentication. Traditional authentication methods like
challenge-response with passwords or public keys leak information about the
credentials of
2010 Nov 14
1
score test for logistic regression
Dear R experts,
I'm trying to find a code to calculate the p-value from the score test for the logistic regression. My fit is like this: logit=beta0+beta1*x1+beta2*x2 +....+ betak* xk. And my H0 is beta1=beta2=...=betak =0.
Any help will be highly appreciated. Thank you!
Ying
2009 Sep 27
1
Clustering with R - efficient processing of large sparse data sets (text data)
I checked the R procedure HCLUST (hierarchical clustering) but it
looks like it requires a full triangular n x n similarity matrix as
input, where n = number of observations. The number of variables is
200.
My data set has n = 50,000 observations (keywords), and I use ad-hoc
similarity measures, not available in R, to measure keyword
similarity. Here, the vast majority of the n x n similarities