[R] Plotting math functions

2003-07-24 Thread Jonck van der Kogel
Hi all,
I was wondering whether it is possible to plot math functions, for 
example sin, cos or a Gaussian type function, in R, and if so, how to 
do it. I have been searching through the archives and the R manual but 
had no luck in finding any hints on how to go about this.
Any help is much appreciated!
Thanks, Jonck

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] GeneSOM viewer

2003-06-26 Thread Jonck van der Kogel
Hi all,
Recently I have written a small application, SOMviewer, that is able to 
graphically display a self organizing map produced with the som 
algorithm found in the GeneSOM package, clustered by any hierarchical 
clustering method that produces a merge matrix (agnes, diana, hclust 
etc..). This application makes it very easy to analyse a 
self-organizing map.
Anyone that would like a copy of SOMviewer can drop me a line, I am 
making it available as freeware for the R community. It runs under 
windows (XP, ME, 2000 etc...) and Mac OS X.
Cheers, Jonck

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Macintosh plots

2003-06-18 Thread Jonck van der Kogel
Hi Ian,
Not 100% sure on this, but I've recently been wrestling with producing 
plots in R and I think I know the answer to your question. As far as I 
could tell, all the parameters for graphics are stored using par(). 
There is a parameter $bg, which for me is set to transparent, but 
I'll bet that for you it's set to charcoal or something like that :-)
I would not be surprised if you could set the background of your plot 
to transparent with the following command:
par$bg - transparent

HTH, Jonck

This may be a dumb question, but I've wasted several hours trying to 
find an answer

When I do a plot with no parameters set eg: ' plot(d1)' it comes up 
with a dark gray background and blue data points.  I can modify the 
data points using 'plot(d1, col = red)', but I have not been able 
to modify the background color.  'plot(d1, bg = white)' does not 
work.  Any help would be most appreciated.

Cheers,
Ian.
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Clustering quality measure

2003-06-17 Thread Jonck van der Kogel
Hi all,
I am running a series of experiments where after manipulating my data I 
run several clustering algorithms (agnes, diana and a clustering method 
of my own) on the data. I wanted to determine which clustering method 
did the best job, so therefore I had defined my own quality measure 
using two criteria: compactness of the data within the clusters 
themselves and the amount of seperation between the clusters. Anyway, 
my quality measure does not work, since according to my quality measure 
the quality gets increasingly better as more clusters are formed untill 
every data instance is a cluster by itself.
Therefore I was wondering if any of you are aware of any libraries or 
functions within R that determine quality measures of clusterings, I am 
very much intrigued by the definition of quality measures that do work.
Thanks very much, Jonck

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] more efficient sum of matrix columns

2003-06-15 Thread Jonck van der Kogel
Hi,
Maybe I'm not understanding you correctly, but wouldn't the following 
be the fastest way to compute the sum of a column:

 x - matrix(c(1:4462), nrow=4462, ncol=1) #setting up a column of 
4462 elements to be able to make a comparison
 sum(x[,1])
[1] 9956953
 system.time(sum(x[,1]))
[1] 0 0 0 0 0

As you can see this took so little time it actually came out as 0. And 
my system is not fast at all (powermac 9600 with a G4 700 MHz upgrade).
HTH, Jonck


From: Jean Eid [EMAIL PROTECTED]
Date: zon jun 15, 2003  02:51:29 Europe/Amsterdam
To: [EMAIL PROTECTED]
Subject: [R] more efficient sum of matrix columns
Dear R users,
I am looking for a more efficient way to compute the sum of columns of 
a
matrix.
I am currently using apply(data, 2, sum) however, I am building a data 
set
from another one by summing the columns of some parts of the matrix.
the loop is taking too long (about 1/2 hour) for a 4462 * 202 matrix.
thanks,
Jean Eid
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Missing data augmentation

2003-06-14 Thread Jonck van der Kogel
Hi all,
A short while ago I asked a question about multiple imputation and I 
got several helpful replies, thanks! I have untill now tried to use the 
packages mice and norm but both give me errors however.

mice does not even run to start with and gives me the following error 
right away:
iter imp variable
  1   1  Liquidity.ratioError in chol((v + t(v))/2) : the leading minor 
of order 1 is not positive definite

To be honest I have no idea whatsoever what that error message means, 
so my experiments with mice were shortlived :-)

I then tried the package norm. I got some ways with the experiment, 
following the help file:
s - prelim.norm(as.matrix(myDataSet))
thetahat - em.norm(s)
rngseed(1234567)
theta - da.norm(s, thetahat, steps=20, showits=TRUE)

At this stage however I get the following error:
Steps of Data Augmentation:
1...2...Error: NA/NaN/Inf in foreign function call (arg 2)
This seems strange to me, since the whole purpose of this routine is to 
work with NA values. So why is it complaining about NA values?

After this I got it to work in an unlikely fashion: I first 
standardized my dataset using scale(). After that I was able to run the
theta - da.norm(s, thetahat, steps=20, showits=TRUE) line 
succesfully. Which seems strange to me, since s still creates NA 
values, so why is it not complaining about them this time. I have 
repeated the process several times, with subsets of my original dataset 
and the same problems arise each time.

Standardizing, calculating the missing values, imputing them and then 
standardizing again does not seem the correct way to go to me however. 
In my opionion the correct way of doing things would be to impute the 
missing values and then standardize the dataset. In other words, the 
way that seems correct to me is not working.

Any helpful comments on the problems described would be much 
appreciated!
Thanks, Jonck

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Multiple imputation

2003-06-12 Thread Jonck van der Kogel
Hi all,
I'm currently working with a dataset that has quite a few missing 
values and after some investigation I figured that multiple imputation 
is probably the best solution to handle the missing data in my case. I 
found several references to functions in S-Plus that perform multiple 
imputation (NORM, CAT, MIX, PAN). Does R have corresponding functions?
I searched the archives but was not able to find anything conclusive 
there.
Any help on this subject is much appreciated.
Thanks, Jonck

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Multiple match function?

2003-06-10 Thread Jonck van der Kogel
Hi all,
I have (yet another) question about a function in R. What I would like 
to do is test for the presence of a certain value in a vector, and have 
the positions that this value is at returned to me.
For example, let's say I have a vector:
x - c(1,1,2,2,3,3,4,4)

Now I would like a function that would return positions 3 and 4 should 
I test for the value 2. Or 5 and 6 should I test for 3.

Could someone please tell me how I should do this? The match function 
only returns the first position that a value is found at. Of course I 
could write my own function that loops through the vector and tests for 
the presence of each value manually but it seems likely that a function 
that does this is already present in R. No need to re-invent the wheel 
:-)

Thanks very much, Jonck

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Appending elements to an array

2003-06-09 Thread Jonck van der Kogel
Hi all,
I am having a bit of trouble with the array structure of R. What I want 
to do is dynamically add/remove elements to an array. For example:
Let's say I have created an array:
 myArray - array(c(3,8), dim=c(1,2))
 myArray
 [,1] [,2]
[1,]38

And I now want to, for example, push an element (5,6) on to this array 
so it will read:
 [,1] [,2]
[1,]38
[2,]56

And then pop the first element of the array so the array now reads:
 [,1] [,2]
[1,]56
How would I do this? So far I've only read how to create an array if 
you know the dimensions beforehand, but I've been unable to find how to 
dynamically add/remove elements to/from an array.

I've figured out how to do this with lists and vectors, but not with 
arrays. For this particular structure I need to work with arrays.

Any help on how to do something like this would be much appreciated.
Thanks, Jonck
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help