Displaying 8 results from an estimated 8 matches for "nclust".
Did you mean:
hclust
2012 Jan 25
4
formula error inside function
I want use survfit() and basehaz() inside a function, but it doesn't work.
Could you take a look at this problem. Thanks for your help. Following is my
codes:
library(survival)
n <- 50 # total sample size
nclust <- 5 # number of clusters
clusters <- rep(1:nclust,each=n/nclust)
beta0 <- c(1,2)
set.seed(13)
#generate phmm data set
Z <- cbind(Z1=sample(0:1,n,replace=TRUE),
Z2=sample(0:1,n,replace=TRUE),
Z3=sample(0:1,n,replace=TRUE))
b <-
cbind(rep(rnorm(nclust),each=n/nclust),re...
2001 Feb 28
2
Automating the job?
Hi!
I just started to use R recently, and would like to ask a help about
automating the job.
I need to use "kmeans" function with my own 300 data files, and wonder if
it's possible to do it automatically. For example,
> library (mva)
> mydata <- read.table ("data1")
> cl <- kmeans(mydata, 5, 20)
and I just need to save "cl" info (i.e. the center
2008 May 23
1
Shared Library Error
..._patterns_file'))
print(is.loaded('merge_xtabs_patterns_file_'))
.Fortran('merge_xtabs_patterns_file_',ydim[1],ydim[2],x=as.integer(as.matrix(y)),na=as.integer(c),
maxD=as.integer(maxD),lrowmem=length(rowmem),rowmem=as.integer(rowmem),
sequential=as.integer(Sequential),nclust=as.integer(nclust))
The corresponding output:
[1] FALSE
[1] TRUE
Error in .Fortran("merge_xtabs_patterns_file_", ydim[1], ydim[2], x =
as.integer(as.matrix(y)), :
Fortran symbol name "merge_xtabs_patterns_file_" not in load table
Why is it that I get a TRUE for is.l...
2010 Jan 11
1
K-means recluster data with given cluster centers
...s
Peter
1: R code to find cluster center and save them to file
#---INITIAL CLUSTERING TO FIND CLUSTER CENTERS
# LOAD LIB
library(cluster)
# LOAD DATA
data_unclean <- read.table("dataset1.dat")
data.matrix<-as.matrix(data_unclean,"any")
# CLUSTER
Nclust <- 100 # amount cluster centers
Imax <- 200 # amount of iteration for convergence of clustering
set.seed(100) # set seed of random nr generator
init <- sample(dim(data.matrix)[1], Nclust) # this is the initial Nclust prototypes
km <- kmeans(data.matrix, centers=data.matrix[i...
2006 Mar 17
1
Neyman-Scott cluster process
Hi there,
I want to generate a random point pattern using the Neyman-Scott
cluster process using spatstat package in R. After running the
following procedures, why i can not see any figures?
> nclust <- function(x0, y0, radius, n) {return(runifdisc(n, radius, x0, y0))}
> nclust
function(x0, y0, radius, n) {return(runifdisc(n, radius, x0, y0))}
> X <- rNeymanScott(10, 0.2, nclust, radius=0.2, n=5)
> X
planar point pattern: 67 points
window: rectangle = [ 0 , 1 ] x [ 0 , 1 ]
>...
2004 Sep 12
0
Help needed: division by zero in winword etc.
...ge
"didivsion by zero in ReadFATSuperblock. I was able to
track the problem down to the following lines in
volume.c (starting from line 502)
nsect -= GETWORD(buff, 0x0e) + buff[0x10] * sz +
(GETWORD(buff, 0x11) * 32 + (GETWORD(buff,
0x0b) - 1)) / GETWORD(buff, 0x0b);
nclust = nsect / buff[0x0d];
when i change these into this:
nsect -= GETWORD(buff, 0x0e) + buff[0x10] * sz +
(GETWORD(buff, 0x11) * 32 + (GETWORD(buff,
0x0b) - 1)) / (GETWORD(buff, 0x0b)-1);
nclust = nsect / (buff[0x0d]+1);
i can (obviuosly) avoid the division by zero and
everyth...
2004 Jun 11
1
bug or correct behaviour ?
This is the general outline of my code::
main(argc,argv){
...
Rf_initEmbeddedR(argc,argv);
...
Test_tryEval("source(test.r)");
...
}
#############
# test.r
#############
...
dyn.load("toload.so")
tmp <-matrix(data=1,nrow=narray*2,ncol=nclust)
.Call("Init",tmp,...)
while(...) {
criteria <-feval(tmp)
if (criteria < criteria.min)
tmp.last <- tmp
else
tmp <- tmp.last
...
.Call("replace",tmp,...)
}
####################################
When I try to recover tmp
tmp...
2002 Oct 23
0
Obtaining covariance matrices for kmeans output clusters
...E)
> imagedat
Red Green Blue
0_0 5 7 8
1_0 5 5 18
2_0 7 8 49
3_0 22 8 76
4_0 54 10 67
5_0 50 9 28
6_0 18 10 15
7_0 9 7 6
8_0 2 5 7
...
I cluster using
> cl <- kmeans(imagedat, nclust, maxsteps)
> cl
$cluster
[1] 1 1 9 8 2 9 1 1 1 1 1 1 1 1 1 8 8 8 8 4
[25] 9 9 8 8 8 2 2 9 1 1 9 9 7 10 10 10 10 10 10 10 10
...
$centers
Red Green Blue
1 9.940421 7.744428 11.11652
2 85.198120 18.363348 68.10173
3 109....