Displaying 20 results from an estimated 2000 matches similar to: "Faster way for weighted matching?"
2003 Jan 16
0
Summary: Faster way for weighted matching
I received some great ideas (see below) from a number of people to whom I am grateful. Here is the code I put together from many of their suggestions:
lx <- length(x)
lw <- length(w)
z <- matrix(abs( rep( x , lw ) - rep( w, each = lx ) ),
nrow=lw, ncol=lx, byrow=TRUE)
s <- pmax( abs( w - min(x) ), abs( w - max(x) ) )
z <- (1 - (z/rep(s,length=lx*lw))^3)^3
sums <-
2013 Jan 08
1
Problem getting loess tricubic weights
Hi
I am trying to get the tricube weights from the loess outputs as I need to
calculate an error function which requires the weight.
So I have used the following example from the R:
cars.lo <- loess(dist ~ speed, cars, span=0.5, degree=1, family="symmetric")
Then i try to get the weights:
cars.lo$weights
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
2007 Jul 25
3
loess prediction algorithm
Hello,
I need help with the details of loess prediction algorithm. I would like
to get it implemented as a part of a measurement system programmed in
LabView. My job is provide a detailed description of the algorithm. This
is a simple one-dimensional problem - smoothing an (x, y) data set.
I found quite a detailed description of the fitting procedure in the "white
book". It is also
2008 May 09
0
applying cor.test to a (m, n) matrix - SUMMARY
Hi again,
I've got few very good options from the list and since they were not posted to the list, I will provide a summary. Thank you very much to all who answered and I hope this summary will benefit others interested in solving similar problems like that.
Yasir Kaheil re-wrote my original code in a more streamlined way:
pr<-array(0,c(dim(x)[2],dim(x)[2]));
for (i in 1:dim(x)[2]) for
2000 Apr 25
0
Wrong SEs in predict.lm(..., type="terms")
predict.lm(..., type="terms") gives wrong standard errors.
Below, I have provided what I believe are the necessary fixes.
However, there are subtleties, and the code needs careful
checking. Some of the looping is surely not necessary, but
it is surely best to begin with the minimum necessary changes.
My tests, including checks against S-PLUS, have extended to fitting
spline curves. I
2005 Feb 11
1
Help concerning Lasso::l1ce
Hi,
First, when I try the example Prostate with bound 0.44
(as in the manual), I got a different result:
> l1c.P <- l1ce(lpsa ~ ., Prostate, bound=0.44)
> l1c.P
....
Coefficients:
(Intercept) lcavol lweight age
lbph svi
1.0435803 0.4740831 0.1953156 0.0000000
0.0000000 0.3758199
lcp gleason pgg45
0.0000000 0.0000000
2000 Apr 26
0
Wrong SEs in predict.lm(..., type="terms") (PR#528)
>From e980153 Tue Apr 25 14:42:27 2000
To: r-help@stat.math.ethz.ch
Subject: Wrong SEs in predict.lm(..., type="terms")
For what it is worth, I am using RW-1.0.0 under Windows 98.
I submitted this earlier to r-help. There is one change
below to my proposed corrected code:
predict.lm(..., type="terms") gives wrong standard errors.
Below, I have provided what I believe are
2011 Mar 17
1
Using barplot() with zoo -- names.arg not permitted?
I've used barplot(), including the anmes.arg parameter, on data frames
successfully, but I'm even newer to using zoo than I am to R. :-}
I am working on a functon that accepts a data frame ("df") as its
primary argument, extracts information from it to create a zoo, then
generates a plot based on that.
The data frame has a column called "time" which is a standard
2003 Sep 25
1
apply on a 4D array
I am trying to multiply a 3D array of 4x4x4 by the 4 3D arrays of a 4D array
with dimensions 4x4x4x4 (the last dimension being the one that I want to
split by).
(4x4x4 array)
> hiaAry
, , a1
i1 i2 i3 i4
h1 9.5936098 6.001040 0.08772 0.3138600
h2 1.2003500 1.454570 2.79248 0.0000000
h3 0.1346500 0.201220 0.39256 0.5464000
h4 0.0109000 0.012270 0.16417 0.2766900
,
2004 Mar 05
1
row-echelon form (was no subject)
I think one needs an LU decomposition rather than QR.
However, I couldn't find anything off the shelf to do
an LU, other than learning that determinant() now
uses LU instead of QR or SVD, so the code to do it must
be in there for those that want it.
You'll probably need to divide rows of U by the first
entry if you insist on the unique reduced REF.
However, I can't see any reason
2010 Jul 14
1
Entropy of a Markov chain
Does anyone have any "R" code for computing the entropy of a simple
first or second order Markov chain, given a transition matrix something
like the following (or the symbol vector from which it is computed)?
AGRe ARIe CSRe DIRe DSCe eos
HRMe SPTe TOBe
AGRe 0.0000000 0.0000000 0.0000000 0.0000000 1.0000000 0.0000000
0.0000000 0.0000000
2005 May 24
0
output of mars() in package mda; how do I read the pairwise interaction terms from the output?
Hi,
I have run mars() with the default degree=1, and have constructed
splines which are similar to what I would get from Salford System's
MARS. I then use these splines as potential predictors, along with
rpart( ) terminal nodes and other potential predictors, in logistic
regression in SAS. The output of mars() and the splines I created are
shown below (pardon the lengthy output):
>
2013 Mar 14
1
ggplot2 problem
Hello all!
I have a problem with ggplot2 library. I want to do an heat map and the y
variables are the year months. If I use the following code, he y values are
in alphabetical order, but I want it in month order.
The code is:
library(reshape)
library(ggplot2)
library(scales)
p <- ggplot(data.m, aes(variable, Month)) + geom_tile(aes(fill = value),
2010 Jan 20
1
sum column by colnames
Hi,
I've this dataframes:
> data1
1 2 3 4 5 6
5 0.4963017 0 0 0.2481509 1.9852069 0.4963017
10 0.0000000 0 0 0.0000000 0.6317266 0.0000000
15 0.0000000 0 0 0.0000000 0.0000000 0.0000000
20 0.0000000 0 0 3.3955301 0.0000000 0.0000000
25 0.0000000 0 0 0.0000000 0.0000000 0.0000000
30 0.0000000 0 0 0.0000000 0.0000000
2012 Feb 24
1
help filtering points from a scatterplot
Dear useRs,
I'm having trouble with what is likely a very simple issue with a simple graph. I have data in the format pasted below - total from which this is a subset is > 3 million rows. I'm plotting "Window" on the x axis, and either of the other two columns on the y axis. In both the second and third columns, the values are in a range from 0 to 1. I want to be able to plot
2012 May 15
2
Renaming names in R matrix
I have the following matrix:
> dat
[,1] [,2] [,3] [,4]
foo 0.7574657 0.2104075 0.02922241 0.002705617
foo 0.0000000 0.0000000 0.00000000 0.000000000
foo 0.0000000 0.0000000 0.00000000 0.000000000
foo 0.0000000 0.0000000 0.00000000 0.000000000
foo 0.0000000 0.0000000 0.00000000 0.000000000
foo 0.0000000 0.0000000 0.00000000 0.000000000
and given this:
1997 May 01
0
R-alpha: eigen()
eigen() seems to work for symmetric matrices only. This is out of sync
with the help file.
> trpr.37
0 1 2 3 4
0 1.00000000 0.0000000 0.0000000 0.0000000 0.0000000
1 0.44444444 0.5555556 0.0000000 0.0000000 0.0000000
2 0.02439024 0.2439024 0.7317073 0.0000000 0.0000000
3 0.00000000 0.0000000 0.2307692 0.7692308 0.0000000
4 0.00000000 0.0000000
2009 Jun 29
2
How to read a list into R??
Dear R helpers:
I have tried many times to find some way to read a list into R. But I faid. Here is an example:
I have a file 'List.txt' which includes data as follows:
[[1]]
[1] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.5 0.0 0.0 0.0
[19] 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
[[2]]
[1] 0.0000000 0.5000000 0.0000000 0.0000000
2011 Jan 11
1
Writing diagonal matrix in opposite direction
Hi, is there any direct R function to write an diagonal matrix in an opposite way? for example I want to get like:
> diag(rnorm(5))[,5:1]
[,1] [,2] [,3] [,4] [,5]
[1,] 0.0000000 0.0000000 0.0000000 0.000000 -0.1504687
[2,] 0.0000000 0.0000000 0.0000000 -2.139669 0.0000000
[3,] 0.0000000 0.0000000 -0.2102133 0.000000 0.0000000
[4,] 0.0000000
2012 May 10
0
Time series and stl in R: Error only univariate series are allowed
I am doing analysis on hourly precipitation on a file that is disorganized.
However, I managed to clean it up and store it in a dataframe (called CA1)
which takes the form as followed:
Station_ID Guage_Type Lat Long Date Time_Zone Time_Frame H0
H1 H2 H3 H4 H5 H6 H7 H8 H9 H10 H11
H12 H13 H14 H15 H16 H17 H18 H19 H20 H21 H22 H23
1