Displaying 20 results from an estimated 5000 matches similar to: "self-defined distance function to be computed on matrix"
2012 Jul 26
4
names function not working at the 2nd place in a program
Hello,
I am using names function to name an array.
It works first time when I use *as.numeric(names(myVar1)*
However, at a place later, when I tried to use a very similar line of code
*as.numeric(names(myVar2)*, it always returned 'numeric(0)' (or if I only
type 'names(myVar2), it gave me NULL'.
Both myVar1 and myVar2 are type of integer. The only difference that I can
tell is
2002 Jan 09
1
Distance matrix by cosine?
Hello,
a. is there a possibility to obtain a distance matrix with the cosine between vectors?? hclust, hierclust, dist will not work and seem to be hard to extend.
b. if there is not: Is the cosine between vectors implemented somewhere?
Thanks for all hints and advice!
Petra Steiner
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
2003 Apr 02
8
lm with an arbitrary number of terms
Hello folks,
Any ideas how to do this?
data.frame is a data frame with column names "x1",...,"xn"
y is a response variable of length dim(data.frame)[1]
I want to write a function
function(y, data.frame){
lm(y~x1+...+xn)
}
This would be easy if n was always the same.
If n is arbitrary how could I feed the x1+...+xn terms into lm(response~terms)?
Thanks
Richard
--
Dr.
2018 Apr 12
1
WGCNA package installation segmentation fault
Hi all,
a user contacted me about a segfault when installing WGCNA package
dowloaded from CRAN. I also see a segfault like that on certain
installs of R.
The package passes all CRAN checks, so presumably this has something
to do with the R installation or environment. The R versions here are
not the newest but I would guess that this is not an R version issue.
I'm attaching two
2018 Feb 13
4
Setting the path to Rtools for package compilation on Windows
Hi all,
I'm trying to set up the Windows Rtools toolset for building packages
with compiled code. I installed for Windows R-3.4.3 from CRAN and
installed Rtools-3.4 in a custom location M:\R\R-3.4.3 and
M:\R\Rtools-3.4
Following the instructions, in shell, I set
Path=M:\R\Rtools-3.4\bin;M:\R\Rtools-3.4\gcc-4.6.3\bin;M:\R\R-3.4.3\bin;...
(the ... are other paths irrelevant for R/Rtools).
2017 Jun 17
3
Prediction with two fixed-effects - large number of IDs
Dear all,
I am running a panel regression with time and location fixed effects:
###
reg1 <- lm(lny ~ factor(id) + factor(year) + x1+ I(x1)^2 + x2+ I(x2)^2 ,
data=mydata, na.action="na.omit")
###
My goal is to use the estimation for prediction. However, I have 8,500 IDs,
which is resulting in very slow computation. Ideally, I would like to do
the following:
###
reg2 <-
2017 Jul 09
1
Error in WGCNA package
Dear all ,
I would like to reconstruct coexpression networks from proteomic count data
having integer values. Some internal function doesn't like to work well
with integers. How can this error be rectified?
> adjacency = adjacency(datExpr, power = softPower, type = "signed");
Error in cor(datExpr, use = "p") :
REAL() can only be applied to a 'numeric', not a
2011 Jul 06
2
wgcna
Hi,
I'm running a tutorial ("Meta-analyses of data from two (or more) microarray data sets"), which use wgcna package. I have an error in the function modulePreservation (it is below).
I'm using R2.13
Can you help me? Do you know, what is happens?
Thanks
Raquel
multiExpr = list(A = list(data=t(badea)),B = list(data=t(mayo)))
# two independent datasets (dim = 13447 x 36)
mp =
2012 Feb 28
2
update.formula has 512 char buffer?
Hello,
I am trying to "paste" together a formula to use in the mob function of
party. This means the formula will be of the form y ~ x1+ ...+xM | z1+..zN.
I am doing some preliminary fits of y ~ x1+ ...+xM, then want to add the
conditional part of the equation using update().
Here's the test code:
var1 <- 1:78
x1 <- paste("x", var1, sep="")
f1 <-
2012 Oct 18
1
WGCNA: Combining block-wise dendrograms and modules into a single figure
Hello fellow R users,
I am currently learning to use R, so please forgive me if there is an
obvious explanation for the following problem. My goal is to perform WGCNA
on a dataset of 19776 genes, so I opted to follow the block-wise network
construction (Section 2c) in the WGCNA R Tutorial by Peter Langfelder and
Steve Horvath.
I ended up with 10 blocks and am able to plot the dendrograms and
2017 Jun 17
0
Prediction with two fixed-effects - large number of IDs
I have no direct experience with such horrific models, but your formula is a mess and Google suggests the biglm package with ffdf.
Specifically, you should convert your discrete variables to factors before you build the model, particularly since you want to use predict after the fact, for which you will need a new data set with the exact same levels in the factors.
Also, your use of I() is
2010 Sep 29
1
cor() alternative for huge data set
Hi,
I am have a data set of around 43000 probes(rows), and have to calculate correlation matrix. When I run cor function in R, its throwing an error message of RAM shortage which was obvious for such huge number of rows. I am not getting a logical way to cut off this huge number of entities, is there an alternative to pearson correlation or with other dist() methods calculation(euclidean) that
2012 Sep 17
1
self defined distance matrix in NbClust
i m using a package NbClust for cluster analysis. in the following algorithm
->NbClust(m, diss="NULL", distance = "euclidean", min.nc=2, max.nc=15, method = "ward", index = "all", alphaBeale = 0.1)
i want to define my own dissimilarity matrix of dimension 38*38. my original data "m" is a matrix of 365*38. whenever i define my own dissimilarity
2006 May 05
1
A question about linear optimizaton
Dear all,
I am trying to find a solution satisfying the below equations
in R.
Set up the problem
9 X1+ X2 + X3 = 2
X1+ X2 + X3 = 1
which is subjected to
0 < X1 < X2 < X3 < 2.
I have downloaded the packages \'linprog\' and \'lpSolve\' but can
not see how to solve the question.
Thank you for your help.
With
2016 Jul 27
2
K MEANS clustering
Hey Parth,
Thanks for the reply.
I am considering implementing a cosine distance metric too, along with
euclidian distance because of the dimensionality issue that comes in with
K-Means and euclidian distance metric.
That does help when we deal with sparse vectors for documents. The
particular problem I'm having is representing centroids in an efficient way.
For example, when we find the mean
2011 Aug 08
3
Distance between a vector and matrix rows
I am trying to find the distance between a vector and each row of a
dataframe. I am using the function "distancevector" in the package "hopach"
as follows:
mydata<-as.data.frame(matrix(c(1,1,1,1,0,1,1,1,1,0),nrow=2))
V1 V2 V3 V4 V5
1 1 1 0 1 1
2 1 1 1 1 0
vec <- c(1,1,1,1,1)
d2<-distancevector(mydata,vec,d="euclid")
The Euclidean distance
From THE R BOOK -> Warning: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
2010 Mar 30
3
From THE R BOOK -> Warning: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
Dear friends,
I am testing glm as at page 514/515 of THE R BOOK by M.Crawley, that is
on proportion data.
I use glm(y~x1+,family=binomial)
y is a proportion in (0,1), and x is a real number.
I get the error:
In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!
But that is exactly what was suggested in the book, where there is no
mention of a similar warning. Where am I
2020 Sep 09
3
constrained cosine rounding mode behavior
Hi:
I am trying to implement interval arithmetic through llvm. I have a problem with the rounding mode with llvm.experimental.constrained.cos
I have two pieces of codes:
; Function Attrs: norecurse nounwind readnone ssp uwtable
define double @cosine_down(double returned) local_unnamed_addr #0 {
; call the llvm intrinsic to perform downward cosine
2008 Jul 10
2
Position in a vector of the last value > n
This shouldn't be hard, but it's just not
coming to me:
Given a vector, e.g.,
v <- c(20, 134, 45, 20, 24, 500, 20, 20, 20)
how can I get the index of the last value in
the vector having a value greater than n, in
this case, greater than 20? I'm looking for
an efficient function I can use on very large
matrices, as the FUN argument in the apply()
command.
Confidentiality
2010 Jun 23
5
Plotrix Trick
Dear All,
I am using the plotrix library to plot some matrices.
I have a problem: some of my data are outliers, hence using a linear
color scale does not work very well (you would see too many cells having
a similar, indistinguishable color). See the code snipped at the end of
the email.
Plotting the logarithm of the data gets the job done, but my problem is
that I would like to write in every