search for: mydist

Displaying 16 results from an estimated 16 matches for "mydist".

2006 Oct 11
1
panel-dependent distribution in qqmath
...? I've tried set.seed(1) mydata <- data.frame(ind = factor(rep(2:4, each = 100))) mydata$val <- rt(300, df=rep(2:4, each = 100)) plot<-qqmath(~ val | ind, layout=c(3,1), data = mydata, prepanel = function(x, distribution, ...) { mydist<-function(p) qt(p, df = panel.number() + 1) prepanel.qqmathline(x, distribution=mydist,...) }, panel = function(x, distribution, ...) { mydist<-function(p) qt(p, df = panel.number() + 1) panel.qqmathline(x, distribution...
2011 Aug 31
1
agnes not working
Hello! I created a distances matrix for 13 objects using daisy (see the attached file). I am trying to clusteranalyse it using agnes but it's not working. What might be the problem: mydistances<-read.csv("Results of daisy.csv") mycluster<-agnes(mydistances, method="ward") I am getting: Error in agnes(mydistances, method = "ward") : NA/NaN/Inf in foreign function call (arg 15) I am using R 2.13.1. Thank you very much! -- Dimitri Liakhovitski ma...
1999 Apr 07
1
library
...mothod of random variable generation, I have the C code which calls a function which returns the ordinates of the distribution to be sampled. Since I do not want to generate normals or betas but distributions estimated from lowess or splines the said function have to be written in R. Say it is MyDist() So I need a 'Setup" function that calls the C and set up parameters and passes the name of the R function to compute the distribution and a "Rand" function that just calls a C function that returns the random variate. Now in R I put .C("Setup_system",as.double(par1...
2001 Oct 01
1
dataframe manipulation
...77 split using the vector c(3, 1) results in 2 dataframes of 3 and 1 column. 10 20 30 24 90 34 12 44 67 and 40 12 77 2) To find the abs() of the difference between every element of a dataframe and the element in the nth column in the *same row*, i use the following code: n <- 4 apply(df, 1, myDist, df[n,]) myDist <- function(x, y) { dist <- sum(abs(x-y)); return (dist); } This however, produces an error message: Fails as: Error in abs: non-numeric argument to function I guess its because df[n,] creates a dataframe and not a vector. Any suggestions on how to modify the functio...
2005 Apr 05
4
lists: removing elements, iterating over elements,
...one for each individual item. I find this does what I want for (i in 1:length(cluslist)) But I found out the hard way :) Oh, one more quirk that fooled me. Why does unique() applied to a distance matrix throw away the 0's???? I think that's really bad! > x <- rnorm(5) > myDist <- dist(x,diag=T,upper=T) > myDist 1 2 3 4 5 1 0.0000000 1.2929976 1.6658710 2.6648003 0.5494918 2 1.2929976 0.0000000 0.3728735 1.3718027 0.7435058 3 1.6658710 0.3728735 0.0000000 0.9989292 1.1163793 4 2.6648003 1.3718027 0.9989292 0.0000000 2.1153...
2002 Dec 10
1
Lognormal distribution
I am trying to fit a lognormal distribution to a set of data and test its goodness of fit with regard to predicted values. I managed to get so far: > y <- c(2,6,2,3,6,7,6,10,11,6,12,9,15,11,15,8,9,12,6,5) > library(MASS) > fitdistr(y,"lognormal",start=list(meanlog=0.1,sdlog=0.1)) meanlog sdlog 1.94810515 0.57091032 (0.12765945) (0.09034437) But I would
2006 Nov 09
1
dissimilarity matrices
...(Y) and I can happily now run either hclust(X) or agnes(X). So that the various bits of output are labelled correctly I would dearly like to be able to give names to the columns and rows of X, as would happen if I ran: mydata<-read.table("clipboard",header=T) mydata2<-t(mydata) mydists<-dist(mydata2) Many thanks for your help. Best wishes, Kris Lockyear.
2006 Apr 20
1
Own CentOS distribution
Hi All, I have my own distribution CD for RH 7.2 . and when i am i trying creted for CentOS i am facing some problem . I am not able to change the anaconda installer . Thanks in advance Regards juliet
2012 Oct 04
1
Ops.factor(point1, point2) : - not meaningful for factors
Hi, can anyone help me in this problem :(. I am a total beginner in R software. It took me 2 days just to look into this problem. Due to this problem. I cant do looping. i want to find the distance between x and DSi > DSi i Si 1 1 (5, 20) 2 2 (20, 2) 3 3 (25, 32) 4 4 (8, 39) 5 5 (10, 17) 6 6 (35, 20) 7 7 (38, 10) > str (DSi) 'data.frame': 7 obs. of 2 variables: $ i
2003 Feb 26
0
Re: R-help digest, Vol 1 #89 - 53 msgs
...(200, sd = 0.2) library(modreg) example.spline <- smooth.spline(example.data) plot(example.data) lines(example.spline) X1 <- c(0.25, 0.75) points(X1[1], X1[2], pch = "x") # What's the point on the curve defined by example.spline # that's closest to X1? # Euclidean distance MyDistance <- function(x1, x2) { sqrt(sum((x2 - x1)^2)) } # For convenient re-use, a function that makes point-specific loss functions. # (For some model objects, the predict method requires something # like "predict(CurveObject, newdata = data.frame(x = s))".) MakeLoss <- functio...
2004 Sep 15
4
Density Estimation
Hi there, Sorry if this is a rather loing post. I have a simple list of single feature data points from which I would like to generate a probability that an unseen point comes from the same distribution. To do this I am trying to estimate the probability density of the list of points and use this to generate a probability for the new unseen points. I have managed to use the R density function to
2003 Jan 17
2
Negative Binomial modelling
I have some data which I am trying to fit with a negative binomial distribution. I have found the glm.nb function from MASS. I have reason to believe that the mean parameter mu depends on certain factors, and that the shape parameter theta depends on others. If, say, the factors are P and Q, it might be that mu ~ P:Q and theta ~ P (where mu ~ P:Q means that mu is a function of the pair (P,Q))
2012 Dec 06
1
clustering of binary data
...wever, I'm not convinced by the distance matrix. Association between variables are indeed different from results obtained in PAST by using Ward on a Jaccard matrix (that should be ok for binary data). Moreover, when I try to obtain a Jaccard matrix in R from my data, by using the Vegan package mydistance<-vegdist(t(data),method="jaccard") I receive the following error message: Error in rowSums(x, na.rm = TRUE) : 'x' must be numeric below an subset from my dataset: variable1 variable2 variable3 variable4 variable5 variable6 variable7 variable8 variable9 variable...
2004 Jan 30
1
How to create own distance measure in cluster ?
Hi everyone, I want to create my own distance measure, other than 'euclidean' or 'manhatan', to use in cluster pckgs. To do this I think that I need to change dist(), in mva pckg, or daisy(), in cluster pckg. (or is there a cleaver way ?) But this functions are in fact things like: .Fortran( "daisy", ... ) or .C("dist",...). I tried unsuccessfully to find
2006 Jan 18
0
r-help, how can i use my own distance matrix without usin g dist()
Use something like hclust(as.dist(mydist), ...) ought to work. Andy -----Original Message----- From: r-help-bounces at stat.math.ethz.ch [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of ucecgxu at ucl.ac.uk Sent: Wednesday, January 18, 2006 4:47 PM To: r-help at stat.math.ethz.ch Subject: [R] r-help, how can i use my own distan...
2010 Nov 13
2
how to store a vector of vectors
Hi, I'm trying to write a function to determine the euclidean distance between x (one point) and y (a set of n points). How should I pass y to the function? Until now, I used a matrix like that: | [,1] [,2] [,3] [1,] 0 2 1 [2,] 1 1 1 | Which would pass the points (0,2,1) and (1,1,1) to that function. However, when I pass x as a normal (column) vector,