Re: [R] ANOVA: Does a Between-Subjects Factor belong in the Error Term?

2007-07-09 Thread Christophe Pallier
On 7/9/07, Alex Baugh <[EMAIL PROTECTED]> wrote:
>
> I am executing a Repeated Measures Analysis of Variance with 1 DV
> (LOCOMOTOR
> RESPONSE),  2 Within-Subjects Factors (AGE, ACOUSTIC CONDITION), and 1
> Between-Subjects Factor (SEX).
>
> Does anyone know whether the between-subjects factor (SEX) belongs in the
> Error Term of the aov or not?



It does not.

If you have between-subjects factors A, B and within-subjects factors X, Y,
Z, use:

aov( dv ~ a*b*x*y*z + Error(subj/(x*y*z))

The subj/(x*y*z) formula includes subj:x subj:y subj:z and all their
interactions as error terms.

The effect of a within subject factor 'x' is assessed against the error term
subj:x

-- 
Christophe Pallier (http://www.pallier.org)

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help in installing rggobi in ubuntu linux

2007-07-09 Thread Dirk Eddelbuettel

On 9 July 2007 at 22:38, Michael Lawrence wrote:
| Looks like rggobi can't find GGobi. Make sure that PKG_CONFIG_PATH contains
| the path to your ggobi.pc file. For example:
| 
| export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
| 
| I would have assumed, however, that the ggobi package would have installed
| to the /usr prefix, in which case pkg-config should have no problem finding
| GGobi.
| 
| On 7/8/07, Kenneth Cabrera <[EMAIL PROTECTED]> wrote:
| >
| > Hi R users.
| >
| > I am experimenting with ubuntu 7.04 Feisty.
| >
| > I install the ggobi package with apt-get.
| >
| > I got almost all the packages, but
| > when I try to obtain rggobi, I got
| > this message:

Why don;t you install the Rggobi that is provided via Ubuntu?  It is version
2.1.4-4-1 and it corresponds to the 2.1.4-2 version of Ggobi you just
installed. Just do 'sudo apt-get install r-omegahat-ggobi'

On Debian, we are now at 2.1.5-* for both (and we renamed it r-cran-rggobi as
it now resides on CRAN).

Hth, Dirk

-- 
Hell, there are no rules here - we're trying to accomplish something. 
  -- Thomas A. Edison

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Help in installing rggobi in ubuntu linux

2007-07-09 Thread Michael Lawrence
Looks like rggobi can't find GGobi. Make sure that PKG_CONFIG_PATH contains
the path to your ggobi.pc file. For example:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

I would have assumed, however, that the ggobi package would have installed
to the /usr prefix, in which case pkg-config should have no problem finding
GGobi.

On 7/8/07, Kenneth Cabrera <[EMAIL PROTECTED]> wrote:
>
> Hi R users.
>
> I am experimenting with ubuntu 7.04 Feisty.
>
> I install the ggobi package with apt-get.
>
> I got almost all the packages, but
> when I try to obtain rggobi, I got
> this message:
>
>
> -
> install.packages("rggobi")
> Aviso en install.packages("rggobi") : argument 'lib' is missing: using
> '/usr/local/lib/R/site-library'
> --- Please select a CRAN mirror for use in this session ---
> Loading Tcl/Tk interface ... done
> probando la URL
> 'http://cran.at.r-project.org/src/contrib/rggobi_2.1.4-4.tar.gz'
> Content type 'application/x-gzip' length 401451 bytes
> URL abierta
> ==
> downloaded 392Kb
>
> * Installing *source* package 'rggobi' ...
> checking for pkg-config... /usr/bin/pkg-config
> checking pkg-config is at least version 0.9.0... yes
> checking for GGOBI... configure: creating ./config.status
> config.status: creating src/Makevars
> ** libs
> gcc -std=gnu99 -I/usr/share/R/include -I/usr/share/R/include -g
> -DUSE_EXT_PTR=1 -D_R_=1  -fpic  -g -O2 -c brush.c -o brush.o
> En el fichero incluído de brush.c:1:
> RSGGobi.h:5:22: error: GGobiAPI.h: No existe el fichero ó directorio
> In file included from RSGGobi.h:6,
>   from brush.c:1:
> conversion.h:174: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
> ‘__attribute__’ before ‘asCLogical’
> conversion.h:176: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or
> ‘__attribute__’ before ‘asCRaw’
>
> --- snip ---
>
> brush.c:124: error: ‘t’ no se declaró aquí (primer uso en esta
> función)
> brush.c:124: error: ‘s’ no se declaró aquí (primer uso en esta
> función)
> brush.c:124: error: el objeto ‘GGOBI()’ llamado
> no es una función
> brush.c: En el nivel principal:
> brush.c:135: error: expected ‘)’ before ‘cid’
> make: *** [brush.o] Error 1
> chmod: no se puede acceder a
> `/usr/local/lib/R/site-library/rggobi/libs/*': No existe el fichero ó
> directorio
> ERROR: compilation failed for package 'rggobi'
> ** Removing '/usr/local/lib/R/site-library/rggobi'
>
> The downloaded packages are in
>  /tmp/RtmpVCacJd/downloaded_packages
> Warning message:
> installation of package 'rggobi' had non-zero exit status in:
> install.packages("rggobi")
>
> ---
>
> What am I doing wrong?
>
> Thank you for your help.
> --
> Kenneth Roy Cabrera Torres
> Cel 315 504 9339
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] [R-pkgs] CRANberries -- An RSS feed about New and Updated CRAN packages

2007-07-09 Thread Roger Peng
LOL!

-roger

On 7/9/07, Barry Rowlingson <[EMAIL PROTECTED]> wrote:
> Dirk Eddelbuettel wrote:
>
> > but the easiest way may just be to subscribe to Elijah's wonderful 'Planet 
> > R'
> > feed aggregator
>
> My favourite RSS reader at the moment is the RSS cat caption generator:
>
> http://lol.ianloic.com/feed/dirk.eddelbuettel.com/cranberries/index.rss
>
> Barry
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Roger D. Peng  |  http://www.biostat.jhsph.edu/~rpeng/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Within matrix

2007-07-09 Thread Bill.Venables
Unless you want to do this millions of times, efficiecy is probably not
a big issue here, but simplicity always pays off.

I'm presuming you are dealing with a single classification setup.

Let f (n x 1) be a *factor* defining the classes
Let X (n x p) be the data matrix.

Then the steps I would use to find the between and within SSP matrices,
'by hand' are as follows:

Tot <- scale(X, scale = FALSE)  # sweep out the grand means
Res <- resid(aov(X ~ f))# sweep out the class means

WSS <- crossprod(Res)   # within SSP matrix
BSS <- crossprod(Tot - Res) # between SSP matrix

 


Bill Venables
CSIRO Laboratories
PO Box 120, Cleveland, 4163
AUSTRALIA
Office Phone (email preferred): +61 7 3826 7251
Fax (if absolutely necessary):  +61 7 3826 7304
Mobile: +61 4 8819 4402
Home Phone: +61 7 3286 7700
mailto:[EMAIL PROTECTED]
http://www.cmis.csiro.au/bill.venables/ 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Tuesday, 10 July 2007 9:25 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Within matrix

Hi all,

I am working on cluster, I am trying to evaluate a within and between 
matrix. Is there any facility for that ? I did my own function, but I 
am not a programmer, so I am affraid I am not really able to programme 
efficiant and fast function...

Thanks

Christophe


Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Extracting sums for individual factors in data frames

2007-07-09 Thread Norm.Good
Try this I used today

 

aggregate(data, by=list(factor.name=data$FACTOR.NAME), sum)

 

Norm Good

CMIS/e-Health Research Centre

A joint venture between CSIRO and the Queensland Government

Lvl 20, 300 Adelaide Street BRISBANE QLD 4000
PO Box 10842 Adelaide Street BRISBANE QLD 4000

Ph: 07 3024 1640 Fx: 07 3024 1690 
Em: [EMAIL PROTECTED]  Web: http://e-hrc.net/ 

 


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Question for svm function in e1071

2007-07-09 Thread adschai
thank you. This is definitely doable. - adschai- Original Message 
-From: David Meyer Date: Friday, July 6, 2007 6:34 amSubject: Re: [R] 
Question for svm function in e1071To: [EMAIL PROTECTED]: 
r-help@stat.math.ethz.ch> Adschai:> > The function is written in C++, so 
debugging the source code of > the R > svm() function will not really help. 
What you can do to make the > C-code > more verbose is the following:> > - get 
the sources of e1071> - in the src/ directory, look up the svm.cpp file> - In 
line 37, there is:> > > #if 0> void info(char *fmt,...)> > [...]> > replace the 
first line by:> > #if 1> > - build and install the package again.> > Best> 
David> > > > Sorry that I have many questions 
today. I am using svm function > on about> 180,000 points of training set. It 
takes very long time to run. > However,I would like it to spit out something to 
make sure that > the run is not> dead in between.  Would you please suggest 
anyway to do !
 so?> >

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] making groups

2007-07-09 Thread jim holtman
It would be nice if you could supply an example of what your input
looks like and then what you would like your output to look like.  You
would probably use 'tapply', but I would have to see what you data
looks like.

On 7/9/07, Mag. Ferri Leberl <[EMAIL PROTECTED]> wrote:
> Dear everybody!
> If I have an array of numbers e.g. the points my students got at an
> examination, and a  key to group the numbers, e.g. the key which
> interval corresponds with which mark (two arrays of the same length or
> one 2x(number of marks)), how can I get the array of absolute
> frequencies of marks?
> I hope I have expressed my problem clearly.
> Thank you in advance.
> Mag. Ferri Leberl
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Within matrix

2007-07-09 Thread cgenolin
Hi all,

I am working on cluster, I am trying to evaluate a within and between 
matrix. Is there any facility for that ? I did my own function, but I 
am not a programmer, so I am affraid I am not really able to programme 
efficiant and fast function...

Thanks

Christophe


Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] parsing strings

2007-07-09 Thread jim holtman
Is this what you want:

> x <- "A10B10A10  B5AB 10 CD 12A10CD2EF3"
> x <- gsub(" ", "", x)  # remove blanks
> y <- gregexpr("[A-Z]+\\s*[0-9]+", x )[[1]]
>
> substring(x, y, y + attr(y, 'match.length') - 1)
[1] "A10"  "B10"  "A10"  "B5"   "AB10" "CD12" "A10"  "CD2"  "EF3"
>


On 7/9/07, Drescher, Michael (MNR) <[EMAIL PROTECTED]> wrote:
> Hi All,
>
>
>
> I have strings made up of an unknown number of letters, digits, and
> spaces. Strings always start with one or two letters, and always end
> with one or two digits. A set of letters (one or two letters) is always
> followed by a set of digits (one or two digits), possibly with one or
> more spaces between the sets of letters and digits. A set of letters
> always belongs to the following set of digits and I want to parse the
> strings into these groups. As an example, the strings and the desired
> parsing results could look like this:
>
>
>
> A10B10, desired parsing result: A10 and B10
>
> A10  B5, desired parsing result: A10 and B5
>
> AB 10 CD 12, desired parsing result: AB10 and CD12
>
> A10CD2EF3, desired parsing result: A10, CD2, and EF3
>
>
>
> I assume that it is possible to search a string for letters and digits
> and then break the string where letters are followed by digits, however
> I am a bit clueless about how I could use, e.g., the 'charmatch' or
> 'parse' commands to achieve this.
>
>
>
> Thanks a lot in advance for your help.
>
>
>
> Best, Michael
>
>
>
>
>
>
>
> Michael Drescher
>
> Ontario Forest Research Institute
>
> Ontario Ministry of Natural Resources
>
> 1235 Queen St East
>
> Sault Ste Marie, ON, P6A 2E3
>
> Tel: (705) 946-7406
>
> Fax: (705) 946-2030
>
>
>
>
>[[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] parsing strings

2007-07-09 Thread Gabor Grothendieck
strapply in package gsubfn can do that.  The following matches the
indicated regular expression against x and applies the function
given in formula notation (which removes spaces) to each match,
outputting the result as a list:

library(gsubfn)
x <- c("AB10B10", "A10 B5", "AB 10 CD 12", "A10CD2EF3")
strapply(x, "[[:alpha:]] *[[:digit:]]+", ~ gsub(" ", "", x))


For more info, see the gsubfn home page at:
   http://code.google.com/p/gsubfn/
and the various Links there.


On 7/9/07, Drescher, Michael (MNR) <[EMAIL PROTECTED]> wrote:
> Hi All,
>
>
>
> I have strings made up of an unknown number of letters, digits, and
> spaces. Strings always start with one or two letters, and always end
> with one or two digits. A set of letters (one or two letters) is always
> followed by a set of digits (one or two digits), possibly with one or
> more spaces between the sets of letters and digits. A set of letters
> always belongs to the following set of digits and I want to parse the
> strings into these groups. As an example, the strings and the desired
> parsing results could look like this:
>
>
>
> A10B10, desired parsing result: A10 and B10
>
> A10  B5, desired parsing result: A10 and B5
>
> AB 10 CD 12, desired parsing result: AB10 and CD12
>
> A10CD2EF3, desired parsing result: A10, CD2, and EF3
>
>
>
> I assume that it is possible to search a string for letters and digits
> and then break the string where letters are followed by digits, however
> I am a bit clueless about how I could use, e.g., the 'charmatch' or
> 'parse' commands to achieve this.
>
>
>
> Thanks a lot in advance for your help.
>
>
>
> Best, Michael
>
>
>
>
>
>
>
> Michael Drescher
>
> Ontario Forest Research Institute
>
> Ontario Ministry of Natural Resources
>
> 1235 Queen St East
>
> Sault Ste Marie, ON, P6A 2E3
>
> Tel: (705) 946-7406
>
> Fax: (705) 946-2030
>
>
>
>
>[[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Split graphs

2007-07-09 Thread jim holtman
How many columns do you have?  Is it 2 or 1000; can not tell from your
email.  A histogram of 2 values does not seem meaningful.

Do you want 1000 separate histograms, one per page, or multiple per
page?  Yes you can do it, the question is what/how do you want to do
it.

On 7/9/07, tian shen <[EMAIL PROTECTED]> wrote:
> Hello All,
>  I have a question, which somehow I think it is easy, however, I just 
> couldn't get it.
>  I want to histogram each row of a 1000*2 matrix( means it has 1000 rows), 
> and I want to see those 1000 pictures together. How can I do this? Am I able 
> to split a graph into 1000 parts and in each parts it contains a histogram 
> for one row?
>
>  Thank you very much
>
>  Jessie
>
>
> -
>
>
>[[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] histogram with absolute figures

2007-07-09 Thread Sarah Goslee
Well, how about an example of what you are doing, and a
description of what the results you get and the results you
want are?

When I do a histogram, I get frequencies.

Sarah

On 7/9/07, Mag. Ferri Leberl <[EMAIL PROTECTED]> wrote:
> Meanwhile I have recognized, that the breaks-option enforces density as
> the default. But if I try to force frequencies (freq=TRUE) I get the
> following feedback:
>
> Warning message:
> the AREAS in the plot are wrong -- rather use freq=FALSE in:
> plot.histogram(r, freq = freq, col = col, border = border, angle =
> angle,
>
> And the machine hasn't promised too much: the result IS wrong.
> Yours,
> Mag. Ferri Leberl
>
>
>
> Am Freitag, den 06.07.2007, 16:17 -0400 schrieb Sarah Goslee:
> > The default of hist() is counts rather than percentages.
> >
> > Sarah
> >
> > On 7/6/07, Mag. Ferri Leberl <[EMAIL PROTECTED]> wrote:
> > > Dear everybody!
> > > Is ist easily possible to make up a histogram with absolute numbers
> > > instead of percentages?
> > > Thank you in advance!
> > > Yours, Mag. Ferri Leberl
> > >
> > > ___
>
>


-- 
Sarah Goslee
http://www.functionaldiversity.org

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to use mle with a defined function

2007-07-09 Thread Lin Pan

Hi all,

sorry for the misleading in the previous email. here is my function to
calculate the maximum likelihood function for a multinormial distribution:

mymle <- function (sigmaX, sigmaY, constraints, env){

# build omega
omegaX = abs(sigmaX) * kin + abs(env) * diag(1.0, n, n)
omegaY = abs(sigmaY) * kin + abs(env) * diag(1.0, n, n)
omegaXY = (sqrt(sigmaX * sigmaY) - abs(constraints)) * kin
omega = array(0, c(2*n, 2*n))
for(i in 1:n){
for(j in 1:n){
omega[i, j] = omegaX[i, j]
omega[i+n, j+n] = omegaY[i, j]
omega[i+n, j] = omegaXY[i, j]
omega[i, j+n] = omegaXY[i, j]
}
}

# obtain det of omega
odet = unlist(determinant(omega))[1]

# Cholesky decomposition
C = chol(omega)

# beta parameter estimates
newY = t(C)%*%Y
newX = t(C)%*%X

# maximum likelihood estimates
Z = Y - X%*%(lm(newY~newX-1)$coef)
V = solve(t(C), Z)

# compute the -2log-likelihood
square = t(V)%*%V
0.5*odet + 0.5*square
}

here kin, n, X and Y are known, for example

> kin
   [,1]   [,2]   [,3]   [,4]   [,5]   [,6]
[1,] 1.02276611 0.04899597 0.05076599 0.06727600 0.05561066 0.05561066
[2,] 0.04899597 1.02087402 0.11497498 0.07623291 0.06423950 0.06423950
[3,] 0.05076599 0.11497498 1.02291870 0.07189941 0.11162567 0.11162567
[4,] 0.06727600 0.07623291 0.07189941 1.03277588 0.05522156 0.05522156
[5,] 0.05561066 0.06423950 0.11162567 0.05522156 1.03971863 0.54769897
[6,] 0.05561066 0.06423950 0.11162567 0.05522156 0.54769897 1.03971863
> Y
 [1] 0.4054651 0.6931472 0.7884574 0.6931472 0.5306283 0.5306283 3.1696856
3.5467397 3.5862929 2.5494452 3.1354942 3.2188758
> X
  [,1] [,2] [,3] [,4]
 [1,]1   6900
 [2,]1   6500
 [3,]1   5000
 [4,]1   5400
 [5,]1   4800
 [6,]1   4200
 [7,]0011
 [8,]0012
 [9,]0012
[10,]0012
[11,]0011
[12,]0011
> n
[1] 6


when I call the function
fit <- mle(corr_add, start=list(sigmaX=0.855, sigmaY=0.5, constraints=0.15,
env=0.199), 
method = "L-BFGS-B", lower=c(0.001, 0.001, 0.001, 0.001),
upper=c(1000,1000,1000,1000))

it always gave me error message something like
"Error in chol(omega) : the leading minor of order 8 is not positive
definite"

I checked the eigenvalues at each iteration and found that when it stopped
there existed negative eigenvalues. I don't know why this is not working
since omega supposed to be positive definite at each iteration. Any hints
would be very appreciated.



Lin





Lin Pan wrote:
> 
> Hi all,
> 
> I am trying to use mle() to find a self-defined function. Here is my
> function:
> 
> test <- function(a=0.1, b=0.1, c=0.001, e=0.2){
> 
> # omega is the known covariance matrix, Y is the response vector, X is the
> explanatory matrix
> 
> odet = unlist(determinant(omega))[1]
>  
> # do cholesky decomposition
> 
> C = chol(omega)
> 
> # transform data
> 
> U = t(C)%*%Y
> WW=t(C)%*%X
> 
> beta = lm(U~W)$coef
> 
> Z=Y-X%*%beta
> V=solve(t(C), Z)
> 
> 0.5*odet + 0.5*(t(V)%*%V)
> 
> }
> 
> and I am trying to call mle() to calculate the maximum likelihood
> estimates for function (0.5*odet+0.5*(t(V)%*%V)) by
> 
> result = mle(test, method="Nelder-Mead")
> 
> But I get the following error message:
> 
> Error in optim(start, f, method = method, hessian = TRUE, ...) : 
> (list) object cannot be coerced to 'double'
> 
> I am pretty sure that the matrices, parameters etc are numerical before
> importing to the function. But why I still get such error message? Could
> anybody give some help on this? thanks a lot.
> 
> 
> Lin
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-use-mle-with-a-defined-function-tf4015002.html#a11511446
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Split graphs

2007-07-09 Thread Charles Annis, P.E.
Jessie:

How many pixels would you need to allocate for each of these 1000 parts?  Is
that feasible?

Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of tian shen
Sent: Monday, July 09, 2007 3:43 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Split graphs

Hello All,
  I have a question, which somehow I think it is easy, however, I just
couldn't get it. 
  I want to histogram each row of a 1000*2 matrix( means it has 1000 rows),
and I want to see those 1000 pictures together. How can I do this? Am I able
to split a graph into 1000 parts and in each parts it contains a histogram
for one row? 
   
  Thank you very much
   
  Jessie

 
-


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] parsing strings

2007-07-09 Thread Drescher, Michael (MNR)
Hi All,

 

I have strings made up of an unknown number of letters, digits, and
spaces. Strings always start with one or two letters, and always end
with one or two digits. A set of letters (one or two letters) is always
followed by a set of digits (one or two digits), possibly with one or
more spaces between the sets of letters and digits. A set of letters
always belongs to the following set of digits and I want to parse the
strings into these groups. As an example, the strings and the desired
parsing results could look like this:

 

A10B10, desired parsing result: A10 and B10

A10  B5, desired parsing result: A10 and B5

AB 10 CD 12, desired parsing result: AB10 and CD12

A10CD2EF3, desired parsing result: A10, CD2, and EF3

 

I assume that it is possible to search a string for letters and digits
and then break the string where letters are followed by digits, however
I am a bit clueless about how I could use, e.g., the 'charmatch' or
'parse' commands to achieve this.

 

Thanks a lot in advance for your help.

 

Best, Michael

 

 

 

Michael Drescher

Ontario Forest Research Institute

Ontario Ministry of Natural Resources

1235 Queen St East

Sault Ste Marie, ON, P6A 2E3

Tel: (705) 946-7406

Fax: (705) 946-2030

 


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Split graphs

2007-07-09 Thread tian shen
Hello All,
  I have a question, which somehow I think it is easy, however, I just couldn't 
get it. 
  I want to histogram each row of a 1000*2 matrix( means it has 1000 rows), and 
I want to see those 1000 pictures together. How can I do this? Am I able to 
split a graph into 1000 parts and in each parts it contains a histogram for one 
row? 
   
  Thank you very much
   
  Jessie

 
-


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] making groups

2007-07-09 Thread Mag. Ferri Leberl
Dear everybody!
If I have an array of numbers e.g. the points my students got at an
examination, and a  key to group the numbers, e.g. the key which
interval corresponds with which mark (two arrays of the same length or
one 2x(number of marks)), how can I get the array of absolute
frequencies of marks?
I hope I have expressed my problem clearly.
Thank you in advance.
Mag. Ferri Leberl

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Subject: transform excel data into graph

2007-07-09 Thread Nguyen Dinh Nguyen
Is this you want?
library(gplots)

n
<-(0.465,0.422,0.45,0.59,0.543,0.498,0.44,0.35,0.64,0.5,0.473,0.134,0.543,0.
11,0.32)
graph <- matrix(n, nrow=5, ncol=3)

colnames(graph) <- c("Nick", "John", "Peter")
rownames(graph) <- c("Lesson1","Lesson2","Lesson3", "Lesson4","Lesson5")

g <- barplot2(graph, beside = TRUE,
col = "black",
angle=c(45,45,90,-45,180),
density=c(0,20,20,20,20),
legend = rownames(graph),
ylim = c(0, 1),
ylab="lable here",
plot.grid = TRUE)

N.Nguyen

What I want to do is a 2d-graph plot where I will have  the name of the
student in the X-axis and the name of the lesson in the Y-axis and the
number from each pair will be used to construct the plot. I am newbie with R
and I don't know which package shall I use nor the commands with which I
will import my data in R so that the plot will be created...

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Writing Excel (.xls) files on non-Windows OSs using Perl

2007-07-09 Thread Gregory Warnes

Since I wrote the xls2csv.pl and read.xls() code for gdata, a perl  
module for writing MS-Excel files has come on the scene.  I don't  
have the time at the moment to create an csv2xls.pl file, but it  
should be straightforward, and I would gladly add it to the gdata  
package.

-G


On Jul 9, 2007, at 12:15PM , Uwe Ligges wrote:

>
>
> Gabor Grothendieck wrote:
>> Note that there already is a function, read.xls, in gdata that  
>> uses Perl.
>
> Note that Marc talked about *writing* in his original message.
>
> Uwe Ligges
>
>
>> On 7/9/07, Marc Schwartz <[EMAIL PROTECTED]> wrote:
>>> On Mon, 2007-07-09 at 16:42 +0300, Hans-Peter wrote:
 Hi,

 2007/7/8, Marc Schwartz <[EMAIL PROTECTED]>:
> [snip]
> There exists the xlsReadWrite package on CRAN by Hans-Peter  
> Suter, which
> is restricted to Windows, since it utilizes the non-FOSS MS  
> Office API
> to write the Excel formats.
 The non-FOSS API is not the problem(#) but its implementation is:

 The 3rd party library I use is written in Pascal and supports  
 Delphi
 and Kylix. Kylix would allow to port the package to Linux but as  
 Kylix
 has unfortunately been abandoned by CodeGear (Borland) I am not
 ready/interested to spend my time on this dead road. Though it
 probably could be done quickly.

 A much more interesting way is to port the package using  
 FreePascal.
 --> I plan to do this since long but...
 --> Maybe someone fluent on Linux and FreePascal could have a  
 look at
 the pascal header files (treetron.googlepages.com) and make the  
 demos
 run on Linux..., that would be great and speed up an eventual
 xlsReadWrite port!
>>> Thanks for the clarification.
>>>
>>> However, I think that if you are going to pursue a cross-platform
>>> solution, providing source code requiring compilation (as opposed  
>>> to a
>>> pre-compiled Windows binary), you should consider what the  
>>> installation
>>> requirements for your package would then be.
>>>
>>> If you are going to take the step of requiring a prospective end- 
>>> user to
>>> have a particular Pascal compiler in place, you may as well have the
>>> requirement for a Perl interpreter and associated packages. Since  
>>> Perl
>>> is widely available and you are more likely to find Perl-fluent  
>>> coders
>>> as opposed to Pascal-fluent coders (eg. I have not used Pascal  
>>> since the
>>> late 80's), I would urge you to consider Perl as a future  
>>> substrate for
>>> your functions.
>>>
>>> While compiled code will run faster than interpreted code, for these
>>> types of file I/O functions, I am not sure that you lose much  
>>> with Perl
>>> from a performance standpoint and you certainly gain the eyes of  
>>> a wider
>>> audience with respect to use, debugging and enhancements.
>>>
>>> To that end, you (or any other interested parties) are free to  
>>> utilize
>>> my code in any way you deem appropriate. I did not state this in my
>>> original post, but I make the code available under GPL(v2),  
>>> freeing you
>>> from any restrictions in its use, including your "Pro" version,  
>>> as long
>>> as you make the source available in a fashion consistent with the  
>>> GPL
>>> requirements.
>>>
>>> Regards,
>>>
>>> Marc Schwartz
>>>
>>> __
>>> R-help@stat.math.ethz.ch mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posting- 
>>> guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting- 
>> guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting- 
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problems with e1071 and SparseM

2007-07-09 Thread David Meyer
Chris:

yes, this is indeed a bug (in predict.svm) - will be fixed in the next 
release of e1071.

Thanks for pointing this out,

David

--

Hello all,


I am trying to use the "svm" method provided by e1071 (Version: 1.5-16)
together with a matrix provided by the SparseM package (Version: 0.73)
but it fails with this message:

 > > model <- svm(lm, lv, scale = TRUE, type = 'C-classification', kernel =
'linear')
Error in t.default(x) : argument is not a matrix

although lm was created before with read.matrix.csr (from the e1071)
package.

I also tried to simply convert a normal matrix to a SparseM matrix and
then pass it, but I get the same error again.

According to the manual of svm(), this is supposed to work though:

"   x: a data matrix, a vector, or a sparse matrix (object of class
   'matrix.csr' as provided by the package 'SparseM')."

Used R version: R version 2.4.0 Patched (2006-11-25 r39997)

Does anyone know how I can use Sparse Matrices with e1071? This would be
really important because the matrix is simply too large to write it out.


Best regards,


Chris

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] histogram with absolute figures

2007-07-09 Thread Mag. Ferri Leberl
Meanwhile I have recognized, that the breaks-option enforces density as
the default. But if I try to force frequencies (freq=TRUE) I get the
following feedback:

Warning message:
the AREAS in the plot are wrong -- rather use freq=FALSE in:
plot.histogram(r, freq = freq, col = col, border = border, angle =
angle,

And the machine hasn't promised too much: the result IS wrong.
Yours,
Mag. Ferri Leberl



Am Freitag, den 06.07.2007, 16:17 -0400 schrieb Sarah Goslee:
> The default of hist() is counts rather than percentages.
> 
> Sarah
> 
> On 7/6/07, Mag. Ferri Leberl <[EMAIL PROTECTED]> wrote:
> > Dear everybody!
> > Is ist easily possible to make up a histogram with absolute numbers
> > instead of percentages?
> > Thank you in advance!
> > Yours, Mag. Ferri Leberl
> >
> > ___

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] factanal frustration!

2007-07-09 Thread Prof Brian Ripley
factanal() does not have an argument method="mle".

Trying to do factor analysis on 1000 columns is quite unrealistic, but you 
may find rescaling the matrix helps.

On Mon, 9 Jul 2007, Talbot Katz wrote:

> Hi.
>
> It seems that nearly every time I try to use factanal I get the following
> response:
>
>> faa2db1<-factanal(mretdb1,factors=2,method="mle",control=list(nstart=25))
> Error in factanal(mretdb1, factors = 2, method = "mle", control =
> list(nstart = 25)) :
>unable to optimize from these starting value(s)
>>
>
> In the case cited above, mretdb1 is synthetic data created from two factors,
> that is, mretdb1 has dimensions 3050*1000, and each of the thousand columns
> has the form
> c[i]=a1[i]*f1 + a2[i]*f2 + a3[i]*fn[,i]
> where a1, a2, a3 are each vectors of length 1000, f1 and f2 are vectors of
> length 3050, and fn is a matrix of dimension 3050*1000, such that f1, f2,
> and all the columns of fn are mutually uncorrelated.  I wanted to see how
> closely the factors returned by factanal are to the ones that generated the
> data.  But, as you can see, factanal hasn't cooperated!
>
> I would greatly appreciate advice from factanal users, especially those who
> have experienced the same error.  Thanks!
>
> --  TMK  --
> 917-656-5351  cell
> 212-460-5430  home
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ANOVA: Does a Between-Subjects Factor belong in the Error Term?

2007-07-09 Thread Peter Dalgaard
Alex Baugh wrote:
> I am executing a Repeated Measures Analysis of Variance with 1 DV (LOCOMOTOR
> RESPONSE),  2 Within-Subjects Factors (AGE, ACOUSTIC CONDITION), and 1
> Between-Subjects Factor (SEX).
>
> Does anyone know whether the between-subjects factor (SEX) belongs in the
> Error Term of the aov or not? And if it does belong, where in the Error Term
> does it go? The 3 possible scenarios are listed below:
>
>
>
> e.g.,
>
> 1. Omit Sex from the Error Term:
>
>   
>> My.aov = aov(Locomotor.Response~(Age*AcousticCond*Sex) + Error
>> 
> (Subject/(Timepoint*Acx.Cond)), data=locomotor.tab)
>
>   note: Placing SEX outside the double paretheses of the Error Term has the
> same statistical outcome effect as omitting it all together from the Error
> Term (as shown above in #1).
>
>
>
> 2.  Include SEX inside the Error Term (inside Double parentheses):
>
>   
>> My.aov = aov(Locomotor.Response~(Age*AcousticCond*Sex) + Error
>> 
> (Subject/(Timepoint*Acx.Cond+Sex)), data=locomotor.tab)
>
>
>
> 3.  Include SEX inside the Error Term (inside Single parentheses):
>
>
>   
>> My.aov = aov(Locomotor.Response~(Age*AcousticCond*Sex) + Error
>> 
> (Subject/(Timepoint*Acx.Cond)+Sex), data=locomotor.tab)
>
> note: Placing SEX inside the single parentheses (as shown above in #3)
> generates no main effect of Sex. Thus, I'm fairly confident that option #3
> is incorrect.
>
>
>
> Scenarios 1,2, and 3 yield different results in the aov summary.
>
>   
You don't generally want terms with systematic effects to appear as 
error terms also, so 3 is wrong.

In 2 you basically have a random effect of sex within subject, which is 
nonsensical since the subjects presumably have only one sex each. This 
presumably generates an error stratum with 0 DF, which may well be harmless.

That leaves 1 as the likely solution.

You'll probably do yourself a favour if you learn to expand error terms, 
a/b == a + a:b, etc.; that's considerably more constructive than trying 
to think in terms of whether things are inside or outside parentheses.

>
> Thanks for your help!
>
> Alex
>
>
>
>
>
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Antwort: Re: pgup/pgdown in R Graphics Window under Linux ['Watchdog': checked]

2007-07-09 Thread Deepayan Sarkar
On 7/8/07, Paul Matthias Diderichsen
<[EMAIL PROTECTED]> wrote:
> Hi Deepayan,
>
> "Deepayan Sarkar" <[EMAIL PROTECTED]> schrieb am 06.07.2007
> 02:05:02:
> > On 7/5/07, Paul Matthias Diderichsen
> > <[EMAIL PROTECTED]> wrote:
> >> library(lattice)
> >>> xyplot(speed~dist|speed, data=cars, layout=c(3,3))
> > If this is your use case, you might be interested in
> > http://cran.r-project.org/src/contrib/Descriptions/plotAndPlayGTK.html
>
> Thanks a lot for the pointer; this package seems to be very useful when
> coding your own plots. However, it's not exactly my use case - rather an
> example to illustrate the the X11 graphics device is apparently not too
> useful for multi-page plots.
>
> The motivation for my question was that I want to use xpose4 (
> http://xpose.sourceforge.net/) under linux. Xpose is a program that
> provides functions for producing diagnostic plots for population PKPD
> model evaluation. I am not able to rewrite the entire package, wrapping
> every call to multi-page plot functions with plotAndPlayGTK.
>
> That's why I was hoping that there exist some obscure configuration option
> for X11 (seems not to be the case, cf. Prof Ripley's reply) or an
> alternative graphic device that runs under linux.

The tools seem to be there already (recordPlot and replayPlot), and it
seems mostly a matter of capturing the relevant keypresses etc. I have
no idea how hard that would be with the X11 device, but I have added
some basic functionality to the Qt based device I've been playing
with. You are welcome to try it --- details can be found at

http://dsarkar.fhcrc.org/R/R-Qt.html

I'm sure doing something similar with the Gtk/Cairo devices wouldn't
be too hard (for those who know what they are doing).

-Deepayan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Loading problem with XML_1.9

2007-07-09 Thread Duncan Temple Lang

Weijun and I corresponded off-list so that I could
get a copy of the data.

On a relatively modest machine with 2G of RAM, 10G swap,
dual core 1Ghz 64bit AMDs, the code below takes approximately
100 seconds. It is not optimized in any particular way, so
there is room for improvement.

doc <- xmlTreeParse("mi1.txt.gz", useInternal = TRUE)
mols <- getNodeSet(doc, "//molecule")

ans =
lapply(mols,
function(node, targets) {

   names = as.character(xpathApply(node, "//name/text()",
 xmlValue))
   if(any(names %in% targets))
 xpathApply(node, "//moleculeName", xmlValue)
   else
 character()
}, c("Vps4b", "SKD1", "frm-1"))

ans = ans[sapply(ans, length) > 0]


We can read the file without uncompressing which probably
slows things down slightly.
The parsing of the tree takes about 20 seconds and occupies
approximately 1G (very roughly).
Then we find all the  nodes of which there
are 25452.  Then we loop over each of these and
do a sub-query using XPath and see if
the text child in the  nodes are in the set
of interest (entirely made up for my test), and if so
fetch the content of any  within this
 node.

It would be nice if we could build the hash for targets
just once.
And we could get clever with the XPath query to try do
the matching and selection in one query. This might actually slow things
down.

(There are garbage collection issues with XPath sub-queries
for which I am still deciding on the optimal strategy.)

So perhaps the lesson her is that for those working with XML,
XPath is worth using before more specialized approaches
and large XML data files can fit into memory. The tree
is not using contiguous memory so nodes can be squeezed into
available spaces.

D.


Luo Weijun wrote:
> Thanks, Dr. Lang,
> I used xmlEventParse() + branches concept as you
> suggested, it really works, and the memory issue is
> gone. Now I can query large XML files from within R.
> but here is another problem: it is too slows (a simple
> query has not finished for 1.5h), even though the
> number of relevant records is very limited, but the
> whole XML file has more than 500 thousand
> similarly-structured records. And the parser has to go
> through all of them as to find the matches. Attached
> is part of the XML files with two records. I am trying
> to retrieve the content of  nodes from
>  records where  nodes bear specific
> gene names.
> Is it possible to locate based on node content (or
> xmlValue) rather than node names (since they are the
> same in all records) first and then parse the xml
> record locally? Would query based on XPath be faster
> in this case? I understand that we do have the
> facility in the XML package for XPath based queries,
> called getNodeSet(). But that requires reading the
> whole XML tree into the memory first, which is not
> feasible for my large XML file. Or can I call
> XML::XPath statements using your R-Perl interface
> package? Any suggestions/thoughts? Thank you!
> Weijun
> 
> 
> Part of my XML file: 
> 
> 
> 20119043
> protein20
> 1009020
> 20GI6677981
> SKD120
> Vps4b20
> 8030489C12Rik20
> Mouse homologue of
> yeast Vacuolar protein sorting 4 (Vps4); Suppressor of
> potassium transport defect 1. Mem
> ber of mammalian class E Vps proteins involved in
> endosomal transport; AAA-type
> ATPase.20Mo
> use homologue of yeast  Vacuolar protein sorting 4
> (Vps4); Suppressor of potassium  transport defect 1.
> Member of  mammalian class E Vps prot
> eins involved in endosomal transport; AAA-type
> ATPase.20
> 
> 337974miClust80
> 
> 
> 200
> 
> 20158189434SBP1
> 00
> 20158217953mVps2
> 00
> 
> 
> 
> 30116226
> protein30
> 960630
> 30HGNC9859
> RAP1GDS130
> GDS130
> MGC11885930
> MGC11886130
> 
> 300
> 
> 93569116280RAC1
> 00
> 104132103040RHOA
> 00
> 12181874726MBIP
> 00
> 
> 
> --- Duncan Temple Lang <[EMAIL PROTECTED]>
> wrote:
> 
>> Well, as you mention at the end of the mail,
>> several people have given you suggestions about
>> how to solve the problem using different approaches.
>> You might search on the Web for how to install a 64
>> bit version of libxml2?
>> Using xmlTreeParse(, useInternalNodes = TRUE) is an
>> approach
>> to reducing the memory consumption as is using the
>> handlers
>> argument. And if size is really the issue, you
>> should consider
>> the SAX model which is very memory efficient and
>> made available
>> via the xmlEventParse() function in the XML package.
>> And it even provides the concepts of branches to
>> provide a
>> hybrid of SAX and DOM-style parsing together.
>>
>> However, to solve the problem of the xmlMemDisplay
>> symbol not being found, you can look for where
>> that is used and remove it.It is in
>> src/DocParse.c
>> in the routine RS_XML_MemoryShow().  You can remove
>> the line
>>   xmlMemDisplay(stderr)
>> or indeed the entire routine.  Then re-install and
>> reload the package.
>>
>>  D.
>>
>>
>> Luo Weijun wrote:
>>> Hello Dr. Lang an

Re: [R] a little problem on selecting a subset from dataset A accordingto dataset B?

2007-07-09 Thread jim holtman
You might want to be careful since what you are comparing is floating
point numbers.  You might want to scale them and then convert to
integers to make sure that you are getting the numbers you think you
should be getting. (FAQ 7.31)

On 7/9/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > AB <- with(B, subset(A, coords.x1 %in% X1))
> > AB
>   coords.x1 coords.x2
> 0   542250.9   3392404
> 7   541512.5   3394722
> 8   541479.3   3394878
> 9   538903.4   3395943
> 18  543274.0   3389919
> 19  543840.8   3392012
>
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of zhijie zhang
> Sent: Monday, 9 July 2007 2:43 AM
> To: R-help@stat.math.ethz.ch
> Subject: [R] a little problem on selecting a subset from dataset A
> accordingto dataset B?
>
> Dear Friends,
>   I want to extract the records from A according to B, but the results
> are
> not correct because R says :
>  The length of long object is not integer times on the length of short
> object.
>  Anybody have met the same problem? How to do it correctly?
>
> length(A)=47
> length(B)=6
>
> A[A$coords.x1==B$X1,]   #the program for the above task. I should get 6
> records, but i only get former 4 records for the above reason.
>
> Thanks.
>  The folloing shows dataset A and B.
>
>
> > A
>   coords.x1 coords.x2
> 0  542250.89 3392404.1
> 1  538813.87 3388339.0
> 2  536049.19 3385821.6
> 3  533659.62 3383194.2
> 4  530642.30 3376834.9
> 5  529573.15 3378177.8
> 6  530853.82 3394838.8
> 7  541512.51 3394721.6
> 8  541479.33 3394877.8
> 9  538903.39 3395942.5
> 10 536019.95 3396286.1
> 11 538675.23 3384213.2
> 12 535127.95 3381255.4
> 13 533852.24 3378660.4
> 14 531360.91 3379273.8
> 15 539289.14 3375759.8
> 16 543410.51 3384353.1
> 17 543089.27 3388170.1
> 18 543274.03 3389919.2
> 19 543840.77 3392012.4
> 20 553383.55 3402401.8
> 21 554621.51 3397938.9
> 22 564096.42 3397524.4
> 23 567529.64 3398702.9
> 24 561798.76 3404864.0
> 25 562868.34 3405502.2
> 26 563145.22 3403192.1
> 27 562419.87 3404090.4
> 28 558321.85 3403879.9
> 29 567050.74 3404973.1
> 30 570609.70 3408742.4
> 31 556777.57 3397858.0
> 32 531353.38 3368596.6
> 33 533513.50 3372749.3
> 34 537543.19 3364284.8
> 35 538779.41 3368224.8
> 36 525930.09 3374067.7
> 37 522990.85 3369213.1
> 38 528826.37 3359019.0
> 39 533865.85 3362595.4
> 40 531200.25 3365053.0
> 41 551054.10 3377181.3
> 42 546974.19 3369284.8
> 43 572315.59 3359541.1
> 44 562703.63 3355173.4
> 45 558959.31 3357804.4
> 46 558531.39 3361741.1
>
>
> > B
> X1X2
> 1 542250.89 3392404.1
> 2 541512.51 3394721.6
> 3 541479.33 3394877.8
> 4 538903.39 3395942.5
> 5 543274.03 3389919.2
> 6 543840.77 3392012.4
>
> --
> With Kind Regards,
>
> oooO:
> (..):
> :\.(:::Oooo::
> ::\_)::(..)::
> :::)./:::
> ::(_/
> :
> [***
> ]
> Zhi Jie,Zhang ,PHD
> Tel:86-21-54237149
> Dept. of Epidemiology,School of Public Health,Fudan University
> Address:No. 138 Yi Xue Yuan Road,Shanghai,China
> Postcode:200032
> Email:[EMAIL PROTECTED]
> Website: www.statABC.com
> [***
> ]
> oooO:
> (..):
> :\.(:::Oooo::
> ::\_)::(..)::
> :::)./:::
> ::(_/
> :
>
>[[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] ANOVA: Does a Between-Subjects Factor belong in the Error Term?

2007-07-09 Thread Alex Baugh
I am executing a Repeated Measures Analysis of Variance with 1 DV (LOCOMOTOR
RESPONSE),  2 Within-Subjects Factors (AGE, ACOUSTIC CONDITION), and 1
Between-Subjects Factor (SEX).

Does anyone know whether the between-subjects factor (SEX) belongs in the
Error Term of the aov or not? And if it does belong, where in the Error Term
does it go? The 3 possible scenarios are listed below:



e.g.,

1. Omit Sex from the Error Term:

>My.aov = aov(Locomotor.Response~(Age*AcousticCond*Sex) + Error
(Subject/(Timepoint*Acx.Cond)), data=locomotor.tab)

  note: Placing SEX outside the double paretheses of the Error Term has the
same statistical outcome effect as omitting it all together from the Error
Term (as shown above in #1).



2.  Include SEX inside the Error Term (inside Double parentheses):

>My.aov = aov(Locomotor.Response~(Age*AcousticCond*Sex) + Error
(Subject/(Timepoint*Acx.Cond+Sex)), data=locomotor.tab)



3.  Include SEX inside the Error Term (inside Single parentheses):


>My.aov = aov(Locomotor.Response~(Age*AcousticCond*Sex) + Error
(Subject/(Timepoint*Acx.Cond)+Sex), data=locomotor.tab)

note: Placing SEX inside the single parentheses (as shown above in #3)
generates no main effect of Sex. Thus, I'm fairly confident that option #3
is incorrect.



Scenarios 1,2, and 3 yield different results in the aov summary.



Thanks for your help!

Alex





-- 
Alexander T Baugh
Institute for Neuroscience
Univ. of Texas at Austin
Austin, TX 78712
512.475.6164

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] factanal frustration!

2007-07-09 Thread Talbot Katz
Hi.

It seems that nearly every time I try to use factanal I get the following 
response:

>faa2db1<-factanal(mretdb1,factors=2,method="mle",control=list(nstart=25))
Error in factanal(mretdb1, factors = 2, method = "mle", control = 
list(nstart = 25)) :
unable to optimize from these starting value(s)
>

In the case cited above, mretdb1 is synthetic data created from two factors, 
that is, mretdb1 has dimensions 3050*1000, and each of the thousand columns 
has the form
c[i]=a1[i]*f1 + a2[i]*f2 + a3[i]*fn[,i]
where a1, a2, a3 are each vectors of length 1000, f1 and f2 are vectors of 
length 3050, and fn is a matrix of dimension 3050*1000, such that f1, f2, 
and all the columns of fn are mutually uncorrelated.  I wanted to see how 
closely the factors returned by factanal are to the ones that generated the 
data.  But, as you can see, factanal hasn't cooperated!

I would greatly appreciate advice from factanal users, especially those who 
have experienced the same error.  Thanks!

--  TMK  --
917-656-5351cell
212-460-5430home

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Clustering nested data

2007-07-09 Thread Scott Bearer
Hi all,

I am interested in performing a cluster analysis on ecological data from
forests in Pennsylvania.  I would like to develop definitions for forest
types (red maple forests, upland oak forests, etc.(AH AR in attached table))
based on measured attributes in each forest type.  To do this, I would like
to 'draw clusters' around forest types based on information from various
tree species (red maple, red oak, etc.(837, 832 in attached table))
occurring in those forests.  Each row of data includes mean values on a
particular species occurring within a forest type at a particular site.  In
other words, if we monitored 10 sites in red maple forests, we would only
have 10 rows of data for the tree species 'red maple', even though we
measured 100 trees.

I have used classification trees to examine this data, which I like because
of it's predictive abilities for later 'unknown' datasets.  However, my
concern is that the mean species attributes (columns Diameter:Avgnumtrees in
attached table) are associated with the tree species (nested?)(column
Treespecies in attached table) and are not independent attributes, but are
directly associated with the species listed in that row.

My question is, what is the best way to conduct a clustering (I have also
tried hclust, cclust and flexclust) or CART model with this sort of nested
data?
Also, what is the preferrable method for predicting a new dataset once these
clusters or CART models have been developed?

Any help would be greatly appreciated.

Kind regards,
Scott

PS-Due to r-help email size restrictions, I cannot post the table.  Please
let me know if you would like me to forward an example to you.





  Scott L. Bearer, Ph.D.
  Forest Ecologist

  [EMAIL PROTECTED]
  (570) 321-9092 (Office)
  (570) 321-9096 (Fax)
  (570) 460-0778 (Mobile)   The Nature Conservancy
in Pennsylvania


  Community Arts Center
  220 West Fourth Street, 3rd Floor
  Williamsport, PA  17701


  nature.org


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] character string to name

2007-07-09 Thread Jim Lemon
Jim Lemon wrote:
> Hi folks,
> 
> I thought I recalled a request for turning a character string into an 
> object name as in:
> 
> x$as.name("y")<-1:4
 > ...
Thanks to those who replied to this eminently dumb question.

OT:
I put this down to the Euthermic Model of Cognitive Efficiency. This 
model, recently developed in Sydney, Australia, proposes that cognitive 
efficiency is maximized at the most comfortable ambient temperature for 
the thinker. Thus after riding home in the cold Sydney rain last night, 
I was unable to think of the simplest answer:

names(x)<-"y"

until I had gone to bed and warmed up. Then I awoke in the early morning 
and thought of Gabor's suggestion:

x[["y"]]<-...

I felt compelled to arise and publish this amazing theory, that not only 
explains why the rate of intellectual and technical innovation is 
greatest in the temperate climes, but more importantly, gives me an 
excuse for asking the question.

Jim

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Clustering nested data

2007-07-09 Thread Scott Bearer
My apologies for cross-postings

Hi all,

I am interested in performing a cluster analysis on ecological data from
forests in Pennsylvania.  I would like to develop definitions for forest
types (red maple forests, upland oak forests, etc.(AH AR in attached table))
based on measured attributes in each forest type.  To do this, I would like
to 'draw clusters' around forest types based on information from various
tree species (red maple, red oak, etc.(837, 832 in attached table))
occurring in those forests.  Each row of data includes mean values on a
particular species occurring within a forest type at a particular site.  In
other words, if we monitored 10 sites in red maple forests, we would only
have 10 rows of data for the tree species 'red maple', even though we
measured 100 trees.

I have used classification trees to examine this data, which I like because
of it's predictive abilities for later 'unknown' datasets.  However, my
concern is that the mean species attributes (columns Diameter:Avgnumtrees in
attached table) are associated with the tree species (nested?)(column
Treespecies in attached table) and are not independent attributes, but are
directly associated with the species listed in that row.

My question is, what is the best way to conduct a clustering (I have also
tried hclust, cclust and flexclust) or CART model with this sort of nested
data?
Also, what is the preferrable method for predicting a new dataset once these
clusters or CART models have been developed?

Any help would be greatly appreciated.

Kind regards,
Scott

> head(data_hal_dom, 15)
ForestType  COMMON_NAME BasalArea   TreesperAcreDeadperAcre 
VolumeperAcre
BiomassperAcre  AverageDiameter STDERRDIAM  AVGHT   STDERRHT
AVGNUMTREES
AH  blackoak50  31.525.1NA  950.9   47955   15.1
1.1 86.815.24
AH  chestnutoak 50  11.212  NA  231.9   16713.8 13.1
0.3 55  4.2 2
AH  northernoak 50  45.337.6NA  1319.7  82508.2 
14.70.9 81.57   6
AH  redmaple50  51.966.2NA  1564.4  60960.9 12  
0.2 70.32.5 3
AH  redpine 50  8.8 9.3 NA  189.4   8106.9  13.20   
42  0   1
AH  scarletoak  50  41.227.9NA  121167645.6 16.3
1.5 80.312.43
AH  whiteoak50  10.49.2 NA  264.1   15738.6 14.4
0.3 73.30   1.3
AR  northernoak 50  47.230.112  1506.4  93490   
16.90.9 84.210.75
AR  paperbirch  50  7.5 6   NA  243.7   963715.1
0   77  0   1
AR  redmaple50  7.1 6   6   226.7   9102.2  14.6
0   75  0   1
AR  sweetbirch  50  4.7 6   NA  146.3   6676.2  12  
0   75.50   1
AR  whiteash50  6.8 6   NA  261.5   9474.5  14.4
0   106 0   1
AR  yellow-poplar   50  23.818.1NA  962.1   28302.8 15.3
2.1 99.36.8 3
AR  easternhemlock  70  16.66   NA  512.6   17125.8 22.5
0   94  0   1
AR  northernoak 70  16.26   12  583.4   38060.4 
22.20   110 0   1

Scott Bearer
Forest Ecologist
The Nature Conservancy
 in Pennsylvania
Community Arts Center
220 West Fourth Street, 3rd Floor
Williamsport, PA  17701

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] When is the periodogram is consistent with white noise?

2007-07-09 Thread Andre Bastos
Hello everyone,

 

This is my first time posting to the list, thanks in advance.

 

I am calculating the smoothed periodogram for the residuals of an AR model
that I fit to EEG data. The autocorrelation plot of the residuals shows the
series is now approximately white (i.e. ACF = 1 at lag 0, and close to 0 for
all other lags). I would like to show that the spectrum of the series is
also approximately white.  When I calculate the periodogram using
spec.pgram, what I get indeed looks white, but I would like to add
horizontal threshold lines between which one can be 95% confident the
spectrum is white.

 

Thanks,

 

-Andre


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] similar limma's contrasts.fit() for lme (mixed effect model)object

2007-07-09 Thread Kuhn, Max
Shirley,

Well, you picked the type of contrast that proves my statement wrong.
The interface in the contrast package (and the Design package) may not
be well suited for the type that you are interested in (or other types,
such as SAS's "lsmeans" type contrasts).

The good news is that the function contrast:::contrastCalc currently
does most of the work for all types of models. A modified version of
that function can be used for your situation. The top part of the
function works to generate two objects: xa and xb. Looking at the limma
documentation, this might correspond to vectors given for WT.SvsU and
Mu.SvsU. 

I'll attach the modified version in an off-list email with an lme
example. (and I'll think about how to let the contrasts be specified by
the coefficient vectors for a future release)

Max


-Original Message-
From: shirley zhang [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 09, 2007 11:50 AM
To: Kuhn, Max
Cc: R-help@stat.math.ethz.ch
Subject: Re: [R] similar limma's contrasts.fit() for lme (mixed effect
model)object

Hi Max,

Thanks for your prompt reply. Actually I have already checked contrast
package, but I still could not figure out how to set the contrast
matrix for a 2x2 factorial design.

I would like to set a contrast exactly similar to the limma's user
guide, 8.7 Factorial Designs (page 45). For example, after a mixed
linear model fit with the default contr.treatment, I want to compute
an estimated coefficient as the sum of the third and fourth
coefficients of the original lme model (2x2 factorial design).

Could you give me an example how to implement this using  the contrast
package?

Thanks,
Shirley

On 7/9/07, Kuhn, Max <[EMAIL PROTECTED]> wrote:
> Shirley,
>
> The contrast package can do this. The method of specifying the
contrast
> conditions/coefficients is different (and I think easier).
>
> Max
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of shirley zhang
> Sent: Monday, July 09, 2007 11:16 AM
> To: R-help@stat.math.ethz.ch
> Subject: [R] similar limma's contrasts.fit() for lme (mixed effect
> model)object
>
> Dear R help,
>
> In limma package, contrasts.fit() function is very useful. I am
> wondering whether there is a similar function for lme object, which
> means given a mixed linear model fit, compute estimated coefficients
> and standard errors for a given set of contrasts.
>
> Thanks,
> Shirley
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
> --
> LEGAL NOTICE
> Unless expressly stated otherwise, this message is confidential and
may be privileged.  It is intended for the addressee(s) only.  Access to
this E-mail by anyone else is unauthorized.  If you are not an
addressee, any disclosure or copying of the contents of this E-mail or
any action taken (or not taken) in reliance on it is unauthorized and
may be unlawful.  If you are not an addressee, please inform the sender
immediately.
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] Reshape version 0.8

2007-07-09 Thread hadley wickham
Reshape version 0.8
http://had.co.nz/reshape

Reshape is an R package for flexibly restructuring and aggregating
data.  It's inspired by Excel's pivot tables, and it (hopefully) makes
it very easy to get your data into the shape that you want.  You can find out
more at http://had.co.nz/reshape

This version brings a few minor changes to make the output more
attractive and less surprising.  If you have any code that relies on
the exact output structure you might need to tweak it a little.

* preserve.na renamed to na.rm to be consistent with other R functions

* Column names are no longer automatically converted to valid R names.
You may need to use `` (those are backticks) to access these names.

* Margins now displayed with (all) instead of NA

* melt.array can now deal with cases where there are partial dimnames
- Thanks to Roberto Ugoccioni

 * Added the Smiths dataset to the package

 * Fixed a bug when displaying margins with multiple result variables

Regards,

Hadley

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] [R-pkgs] CRANberries -- An RSS feed about New and Updated CRAN packages

2007-07-09 Thread Barry Rowlingson
Dirk Eddelbuettel wrote:

> but the easiest way may just be to subscribe to Elijah's wonderful 'Planet R'
> feed aggregator 

My favourite RSS reader at the moment is the RSS cat caption generator:

http://lol.ianloic.com/feed/dirk.eddelbuettel.com/cranberries/index.rss

Barry

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] CRANberries -- An RSS feed about New and Updated CRAN packages

2007-07-09 Thread Dirk Eddelbuettel

Announcing CRANberries -- An RSS feed about New and Updated CRAN packages

A new RSS feed [1] is now available that summarizes uploads to CRAN.  This
makes it possibly to quickly obtain concise information about which (of the
now over one thousand !!) packages were added or updated at CRAN and its
mirrors.

To this end, two basic variants are provided:
 - a feed for new packages where we display the DESCRIPTION file
 - a feed for updated packages where we display the output of diffstat(1) 
   between the old and new source tar archives.
  
As the URLs for these are in a hierarchy, one can subscribe to both or
individual feeds.  The URLs are as follows:

   Everything
http://dirk.eddelbuettel.com/cranberries/index.rss

   Just CRAN (so far the same as All)
http://dirk.eddelbuettel.com/cranberries/cran/index.rss

   New CRAN packages
http://dirk.eddelbuettel.com/cranberries/cran/new/index.rss

   Updated CRAN packages
http://dirk.eddelbuettel.com/cranberries/cran/updated/index.rss

but the easiest way may just be to subscribe to Elijah's wonderful 'Planet R'
feed aggregator which already sources the 'Everything' variant above.  Beside
giving you lots of other R information, it also points to a more reliable
back-end than my small server at home.

Lastly, I could add other repositories. However, to provide updates in the
current format, my code relies on some CRAN features not available on all
other repos (i.e an Archive/ section with old tarballs, and the various
Descriptions/$package.DESCRIPTION files).

For the technically inclined, this is implemented using a few lines of R
executed by littler [2] storing data via R/DBI in a SQLite db and writing
simple text files that are then aggregated by the Blosxom [3] blog engine.

Comments, questions, criticism most welcome.

Best regards,  Dirk

[1] See the Wikipedia entry at http://en.wikipedia.org/wiki/Rss if that term
is unfamiliar. RSS feeds can be read in web browsers, numerous stand-alone
applications, or web-services such as Google Reader.

[2] See http://dirk.eddelbuettel.com/code/littler.html

[3] See http://blosxom.sourceforge.net/ and http://blosxom.sourceforge.net/
but not that Blosxom development seems to have ceased. There are many 
alternatives such as PyBlosxom and Nanoblogger.


-- 
Hell, there are no rules here - we're trying to accomplish something. 
  -- Thomas A. Edison

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] calculating p-values of columns in a dataframe

2007-07-09 Thread Thomas Pujol
Uwe- thanks.  After a little trial and error, I created these two very simple 
custom functions that calculate the t.stat and p.value of columns in a 
dataframe.

I "think" they work correctly and as intended. I welcome comments & critiques.

myfn.t.stat <- function(df) { apply(df,2,function(x) if(fn.count(x)==0) NA else 
t.test(x)$statistic) }

myfn.p.val  <- function(df) { apply(df,2,function(x) if(fn.count(x)==0) NA else 
t.test(x)$p.value)   }



Uwe Ligges <[EMAIL PROTECTED]> wrote: 

Thomas Pujol wrote:
> I have a dataframe ("mydf") that contains "differences of means".
> I wish to test whether these differences are significantly different from 
> zero.
> 
> Below, I calculate the t-statistic for each column.
> 
> What is a "good" method to calculate/look-up the p-value for each column?
> 
> 
> mydf=data.frame(a=c(1,-22,3,-4),b=c(5,-6,-7,9))
> 
> mymean=mean(mydf)
> mysd=sd(mydf)
> mynn=sapply(mydf, function(x) {sum ( as.numeric(x) >= -Inf) })
> myse=mysd/sqrt(mynn)
> myt=mymean/myse
> myt

You can do the whole lot with
   L <- lapply(mydf, t.test)
or if you only want the t statistics and p-values now:
   sapply(L, "[", c("statistic", "p.value"))

If you want to follow your initial approach quickly, you can calculate 
the probability function of the t distribution with 3 degrees of freedom 
(for your data) with
   2 * pt(-abs(myt), df = nrow(mydf) - 1)

Uwe Ligges




> 
>  
> -
> Food fight? Enjoy some healthy debate
> 
>  [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


   
-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Writing Excel (.xls) files on non-Windows OSs using Perl

2007-07-09 Thread Uwe Ligges


Gabor Grothendieck wrote:
> Note that there already is a function, read.xls, in gdata that uses Perl.

Note that Marc talked about *writing* in his original message.

Uwe Ligges


> On 7/9/07, Marc Schwartz <[EMAIL PROTECTED]> wrote:
>> On Mon, 2007-07-09 at 16:42 +0300, Hans-Peter wrote:
>>> Hi,
>>>
>>> 2007/7/8, Marc Schwartz <[EMAIL PROTECTED]>:
 [snip]
 There exists the xlsReadWrite package on CRAN by Hans-Peter Suter, which
 is restricted to Windows, since it utilizes the non-FOSS MS Office API
 to write the Excel formats.
>>> The non-FOSS API is not the problem(#) but its implementation is:
>>>
>>> The 3rd party library I use is written in Pascal and supports Delphi
>>> and Kylix. Kylix would allow to port the package to Linux but as Kylix
>>> has unfortunately been abandoned by CodeGear (Borland) I am not
>>> ready/interested to spend my time on this dead road. Though it
>>> probably could be done quickly.
>>>
>>> A much more interesting way is to port the package using FreePascal.
>>> --> I plan to do this since long but...
>>> --> Maybe someone fluent on Linux and FreePascal could have a look at
>>> the pascal header files (treetron.googlepages.com) and make the demos
>>> run on Linux..., that would be great and speed up an eventual
>>> xlsReadWrite port!
>> Thanks for the clarification.
>>
>> However, I think that if you are going to pursue a cross-platform
>> solution, providing source code requiring compilation (as opposed to a
>> pre-compiled Windows binary), you should consider what the installation
>> requirements for your package would then be.
>>
>> If you are going to take the step of requiring a prospective end-user to
>> have a particular Pascal compiler in place, you may as well have the
>> requirement for a Perl interpreter and associated packages. Since Perl
>> is widely available and you are more likely to find Perl-fluent coders
>> as opposed to Pascal-fluent coders (eg. I have not used Pascal since the
>> late 80's), I would urge you to consider Perl as a future substrate for
>> your functions.
>>
>> While compiled code will run faster than interpreted code, for these
>> types of file I/O functions, I am not sure that you lose much with Perl
>> from a performance standpoint and you certainly gain the eyes of a wider
>> audience with respect to use, debugging and enhancements.
>>
>> To that end, you (or any other interested parties) are free to utilize
>> my code in any way you deem appropriate. I did not state this in my
>> original post, but I make the code available under GPL(v2), freeing you
>> from any restrictions in its use, including your "Pro" version, as long
>> as you make the source available in a fashion consistent with the GPL
>> requirements.
>>
>> Regards,
>>
>> Marc Schwartz
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] similar limma's contrasts.fit() for lme (mixed effect model)object

2007-07-09 Thread shirley zhang
Hi Max,

Thanks for your prompt reply. Actually I have already checked contrast
package, but I still could not figure out how to set the contrast
matrix for a 2x2 factorial design.

I would like to set a contrast exactly similar to the limma's user
guide, 8.7 Factorial Designs (page 45). For example, after a mixed
linear model fit with the default contr.treatment, I want to compute
an estimated coefficient as the sum of the third and fourth
coefficients of the original lme model (2x2 factorial design).

Could you give me an example how to implement this using  the contrast package?

Thanks,
Shirley

On 7/9/07, Kuhn, Max <[EMAIL PROTECTED]> wrote:
> Shirley,
>
> The contrast package can do this. The method of specifying the contrast
> conditions/coefficients is different (and I think easier).
>
> Max
>
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of shirley zhang
> Sent: Monday, July 09, 2007 11:16 AM
> To: R-help@stat.math.ethz.ch
> Subject: [R] similar limma's contrasts.fit() for lme (mixed effect
> model)object
>
> Dear R help,
>
> In limma package, contrasts.fit() function is very useful. I am
> wondering whether there is a similar function for lme object, which
> means given a mixed linear model fit, compute estimated coefficients
> and standard errors for a given set of contrasts.
>
> Thanks,
> Shirley
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
> --
> LEGAL NOTICE
> Unless expressly stated otherwise, this message is confidential and may be 
> privileged.  It is intended for the addressee(s) only.  Access to this E-mail 
> by anyone else is unauthorized.  If you are not an addressee, any disclosure 
> or copying of the contents of this E-mail or any action taken (or not taken) 
> in reliance on it is unauthorized and may be unlawful.  If you are not an 
> addressee, please inform the sender immediately.
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] similar limma's contrasts.fit() for lme (mixed effect model)object

2007-07-09 Thread Kuhn, Max
Shirley,

The contrast package can do this. The method of specifying the contrast
conditions/coefficients is different (and I think easier).

Max


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of shirley zhang
Sent: Monday, July 09, 2007 11:16 AM
To: R-help@stat.math.ethz.ch
Subject: [R] similar limma's contrasts.fit() for lme (mixed effect
model)object

Dear R help,

In limma package, contrasts.fit() function is very useful. I am
wondering whether there is a similar function for lme object, which
means given a mixed linear model fit, compute estimated coefficients
and standard errors for a given set of contrasts.

Thanks,
Shirley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

--
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] No convergence using ADAPT

2007-07-09 Thread Ravi Varadhan
Since the covariance is zero (i.e. you have independent normals), you can
simplify your problem so that you just need to perform one-dimensional
integration.  Here is how you can do it:


trial2 <- function(input) {
#pmvnorm(lower = c(0,0), upper = c(10, 10), mean = input, sigma =
matrix(c(.01, 0, 0, .01), nrow = 2, ncol = 2, byrow = FALSE)) 
pnorm(q=10, mean = input, sd = sqrt(.01)) - pnorm(q=0, mean = input, sd =
sqrt(.01))
}

bottomB <- -5*sqrt(.01)
topB <- 10 + 5*sqrt(.01)
areaB <- (topB - bottomB)^2

new.ans <- 1/areaB * (integrate(f=trial2, lo = bottomB, up = topB)$val)^2
> new.ans
[1] 0.8264463

Hope this is helpful,
Ravi.


---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Philip Turk
Sent: Saturday, July 07, 2007 3:20 PM
To: r-help@stat.math.ethz.ch
Subject: [R] No convergence using ADAPT

I am trying calculate a probability using numerical integration. The first 
program I ran spit out an answer in a very short time. The program is below:

## START PROGRAM

trial <- function(input)

{
pmvnorm(lower = c(0,0), upper = c(2, 2), mean = input, sigma = matrix(c(.1,
0, 
0, .1), nrow = 2, ncol = 2, byrow = FALSE)) 
}

require(mvtnorm)
require(adapt)

bottomB <- -5*sqrt(.1)
topB <- 2 + 5*sqrt(.1)
areaB <- (topB - bottomB)^2

unscaled.Po.in.a <- adapt(2, lo = c(bottomB, bottomB), up = c(topB, topB), 
minpts = 1000, eps = 1e-4, functn = trial)

(1/areaB)*unscaled.Po.in.a$value

## FINISH PROGRAM

I tried to run the program again changing a.) sigma in the trial function,
b.) 
upper in the trial function, and c.) the bounds of integration; that is, 
bottomB and topB.  The new program is below:

## START PROGRAM

trial <- function(input)

{
pmvnorm(lower = c(0,0), upper = c(10, 10), mean = input, sigma =
matrix(c(.01, 
0, 0, .01), nrow = 2, ncol = 2, byrow = FALSE)) 
}

require(mvtnorm)
require(adapt)

bottomB <- -5*sqrt(.01)
topB <- 10 + 5*sqrt(.01)
areaB <- (topB - bottomB)^2

unscaled.Po.in.a <- adapt(2, lo = c(bottomB, bottomB), up = c(topB, topB), 
minpts = 1000, eps = 1e-4, functn = trial)

(1/areaB)*unscaled.Po.in.a$value

## FINISH PROGRAM

Now, the program just runs and runs (48 hours at last count!).  By playing 
around with the program, I have deduced the program is highly sensitive to 
changing the upper option in the trial function.  For example, using a
vector 
like (4, 4) causes no problems and the program quickly yields an answer.  I 
have a couple of other programs where I can easily obtain a simulation-based

answer, but I would ultimately like to know what's up with this program
before 
I give up on it so I can learn a thing or two.  Does anyone have any clues
or 
tricks to get around this problem?  My guess is that it will simply be very 
difficult (impossible?) to obtain this type of relative error (eps = 1e-4)
and 
I will have no choice but to pursue the simulation approach.

Thanks for any responses ([EMAIL PROTECTED])!

-- Phil

Philip Turk
Assistant Professor of Statistics
Northern Arizona University
Department of Mathematics and Statistics
PO Box 5717
Flagstaff, AZ 86011
Phone: 928-523-6884
Fax: 928-523-5847
E-mail: [EMAIL PROTECTED]
Web Site: http://jan.ucc.nau.edu/~stapjt-p/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] about scagnostics

2007-07-09 Thread Olivier ETERRADOSSI
Hi Hadley,
thank you for providing this "scagnostics" primer
I was trying to do some basic testing, and I see that I probably missed 
some points :
first it's not clear for me if the argument of "scagnostics" should be 
raw data or "processed" data (results of calling "splom" or whatever...).
If the first, I thought (from Wilkinson & al.) that if taking as an 
example variables x and y being the coordinates of a circle, I should 
find in scagnostics(x,y)$s :
Skinny = 0 and Convex =1.
I get Skinny = 1 and Convex =0 What am I missing ?
(My God, I'm feeling myself going to be "Ripleyed" !.)
Regards, Olivier

-- 
Olivier ETERRADOSSI
Maître-Assistant
CMGD / Equipe "Propriétés Psycho-Sensorielles des Matériaux"
Ecole des Mines d'Alès
Hélioparc, 2 av. P. Angot, F-64053 PAU CEDEX 9
tel std: +33 (0)5.59.30.54.25
tel direct: +33 (0)5.59.30.90.35 
fax: +33 (0)5.59.30.63.68
http://www.ema.fr

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] similar limma's contrasts.fit() for lme (mixed effect model) object

2007-07-09 Thread shirley zhang
Dear R help,

In limma package, contrasts.fit() function is very useful. I am
wondering whether there is a similar function for lme object, which
means given a mixed linear model fit, compute estimated coefficients
and standard errors for a given set of contrasts.

Thanks,
Shirley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] using the function unique(), but asking it to ignore a column of a data.frame

2007-07-09 Thread Andrew Yee
Thanks, this works perfectly.

On 7/9/07, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
> On Mon, 9 Jul 2007, Andrew Yee wrote:
>
> > Thanks.  But in this specific case, I would like the output to include
> > all three columns, including the "ignored" column (in this case, I'd
> > like it to ignore column a).
>
> sample.data.frame[!duplicated(sample.data.frame[-1]), ]
>
> (index to exclude columns as you wish).
>
> > Thanks,
> > Andrew
> >
> > On 7/9/07, hadley wickham <[EMAIL PROTECTED]> wrote:
> >> On 7/9/07, Andrew Yee <[EMAIL PROTECTED]> wrote:
> >>> Take for example the following data.frame:
> >>>
> >>> a<-c(1,1,5)
> >>> b<-c(3,2,3)
> >>> c<-c(5,1,5)
> >>> sample.data.frame<-data.frame(a=a,b=b,c=c)
> >>>
> >>> I'd like to be able to use unique(sample.data.frame), but have
> >>> unique() ignore column a when determining the unique elements.
> >>>
> >>> However, I figured that this would be setting for incomparables=, but
> >>> it appears that this funcationality hasn't been incorporated.  Is
> >>> there a work around for this, i.e. to be able to get unique to only
> >>> look at selected columns of a data frame?
> >>
> >> unique(df[,c("a","c")]) ?
> >>
> >> Hadley
> >>
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
> --
> Brian D. Ripley,  [EMAIL PROTECTED]
> Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
> University of Oxford, Tel:  +44 1865 272861 (self)
> 1 South Parks Road, +44 1865 272866 (PA)
> Oxford OX1 3TG, UKFax:  +44 1865 272595
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Writing Excel (.xls) files on non-Windows OSs using Perl

2007-07-09 Thread Gabor Grothendieck
Note that there already is a function, read.xls, in gdata that uses Perl.

On 7/9/07, Marc Schwartz <[EMAIL PROTECTED]> wrote:
> On Mon, 2007-07-09 at 16:42 +0300, Hans-Peter wrote:
> > Hi,
> >
> > 2007/7/8, Marc Schwartz <[EMAIL PROTECTED]>:
> > > [snip]
> > > There exists the xlsReadWrite package on CRAN by Hans-Peter Suter, which
> > > is restricted to Windows, since it utilizes the non-FOSS MS Office API
> > > to write the Excel formats.
> >
> > The non-FOSS API is not the problem(#) but its implementation is:
> >
> > The 3rd party library I use is written in Pascal and supports Delphi
> > and Kylix. Kylix would allow to port the package to Linux but as Kylix
> > has unfortunately been abandoned by CodeGear (Borland) I am not
> > ready/interested to spend my time on this dead road. Though it
> > probably could be done quickly.
> >
> > A much more interesting way is to port the package using FreePascal.
> > --> I plan to do this since long but...
> > --> Maybe someone fluent on Linux and FreePascal could have a look at
> > the pascal header files (treetron.googlepages.com) and make the demos
> > run on Linux..., that would be great and speed up an eventual
> > xlsReadWrite port!
>
> Thanks for the clarification.
>
> However, I think that if you are going to pursue a cross-platform
> solution, providing source code requiring compilation (as opposed to a
> pre-compiled Windows binary), you should consider what the installation
> requirements for your package would then be.
>
> If you are going to take the step of requiring a prospective end-user to
> have a particular Pascal compiler in place, you may as well have the
> requirement for a Perl interpreter and associated packages. Since Perl
> is widely available and you are more likely to find Perl-fluent coders
> as opposed to Pascal-fluent coders (eg. I have not used Pascal since the
> late 80's), I would urge you to consider Perl as a future substrate for
> your functions.
>
> While compiled code will run faster than interpreted code, for these
> types of file I/O functions, I am not sure that you lose much with Perl
> from a performance standpoint and you certainly gain the eyes of a wider
> audience with respect to use, debugging and enhancements.
>
> To that end, you (or any other interested parties) are free to utilize
> my code in any way you deem appropriate. I did not state this in my
> original post, but I make the code available under GPL(v2), freeing you
> from any restrictions in its use, including your "Pro" version, as long
> as you make the source available in a fashion consistent with the GPL
> requirements.
>
> Regards,
>
> Marc Schwartz
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Planet R - a weblog aggregator for statistical computing

2007-07-09 Thread elw

Announcing...

Planet R - a weblog aggregator for statistical computing

Q: What is it?

A: An aggregator for weblog posts about statistical computing topics,
focused primarily around the R community.

Q2: Where is it?

A2: For now, at http://planetr.stderr.org

Q3: What's it good for?

A3: Hopefully, collecting resources and weblog posts from people who might
 otherwise not know about each other.  Community-building, you see?

Q4: How do I get my stuff on there?

A4: Send mail to [EMAIL PROTECTED], with a representative subject line (e.g.
 'please add to planet r' will be fine..); I'll need the link to the
 RSS feed of your blog or other resource.  If you'd like a personal
 icon in the style of Planet Debian or Planet Gnome (or one of those
 other planetplanet-based sites..) feel free to send along a smallish
 picture or icon as well. (Think 80-by-80 pixels...)

Q5: What sort of things are there?

A5: A selection of weblogs about statistical computing, a feed from
 omegahat, some bioconductor-related content, feeds from a couple of
 journals (including JoSS content, as a subset of the J Computational
 and Graphical Statistics, as well as Royal Statistical Society
 content sourced from IngentaConnect...), the changes feed from the R
 Wiki, and a few other things of great utility to the R community.


Please feel free to contact me directly with further content, media, 
suggestions, et cetera, that you think would enhance the utility of this 
site as a resource to the community.


thanks,

--elijah wright
indiana university bloomington
school of library and information science

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Writing Excel (.xls) files on non-Windows OSs using Perl

2007-07-09 Thread Marc Schwartz
On Mon, 2007-07-09 at 16:42 +0300, Hans-Peter wrote:
> Hi,
> 
> 2007/7/8, Marc Schwartz <[EMAIL PROTECTED]>:
> > [snip]
> > There exists the xlsReadWrite package on CRAN by Hans-Peter Suter, which
> > is restricted to Windows, since it utilizes the non-FOSS MS Office API
> > to write the Excel formats.
> 
> The non-FOSS API is not the problem(#) but its implementation is:
> 
> The 3rd party library I use is written in Pascal and supports Delphi
> and Kylix. Kylix would allow to port the package to Linux but as Kylix
> has unfortunately been abandoned by CodeGear (Borland) I am not
> ready/interested to spend my time on this dead road. Though it
> probably could be done quickly.
> 
> A much more interesting way is to port the package using FreePascal.
> --> I plan to do this since long but...
> --> Maybe someone fluent on Linux and FreePascal could have a look at
> the pascal header files (treetron.googlepages.com) and make the demos
> run on Linux..., that would be great and speed up an eventual
> xlsReadWrite port!

Thanks for the clarification.

However, I think that if you are going to pursue a cross-platform
solution, providing source code requiring compilation (as opposed to a
pre-compiled Windows binary), you should consider what the installation
requirements for your package would then be.

If you are going to take the step of requiring a prospective end-user to
have a particular Pascal compiler in place, you may as well have the
requirement for a Perl interpreter and associated packages. Since Perl
is widely available and you are more likely to find Perl-fluent coders
as opposed to Pascal-fluent coders (eg. I have not used Pascal since the
late 80's), I would urge you to consider Perl as a future substrate for
your functions.

While compiled code will run faster than interpreted code, for these
types of file I/O functions, I am not sure that you lose much with Perl
from a performance standpoint and you certainly gain the eyes of a wider
audience with respect to use, debugging and enhancements.

To that end, you (or any other interested parties) are free to utilize
my code in any way you deem appropriate. I did not state this in my
original post, but I make the code available under GPL(v2), freeing you
from any restrictions in its use, including your "Pro" version, as long
as you make the source available in a fashion consistent with the GPL
requirements.

Regards,

Marc Schwartz

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] possible bug in ggplot2 v0.5.2???

2007-07-09 Thread hadley wickham
On 7/6/07, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
> On Wed, 4 Jul 2007, hadley wickham wrote:
>
> > On 7/4/07, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
> >> On Tue, 3 Jul 2007, hadley wickham wrote:
> >>
> >> > Hi Stephane,
> >> >
> >> > The problem is that the windows graphics device doesn't support
> >> > transparent colours.  You can get around this in two ways:
> >>
> >> It certainly does!  Try col="transparent" (and perhaps consult your
> >> dictionary).  It was news to me that the windows() graphics device worked
> >> on
> >> Linux i586.
> >
> > Well my dictionary defines transparent as "allowing light to pass
> > through so that objects behind can be distinctly seen" which I believe
> > applies here (ie. stained glass windows and blue points with alpha 0.5
> > are both transparent).  What does your dictionary say?
>
> Not quite the same, but even by your definition col="transparent" is
> transparent.  In this context
>
> http://en.wikipedia.org/wiki/Transparency_%28graphic%29
>
> seems more pertinent.

col="transparent" is transparent by any reasonable definition, but
does it make sense to claim that a graphics device "supports"
transparency?  How can you tell the difference between a transparent
object and nothing?

> >> What it does not support as yet is translucent colours, and that is a
> >> restriction imposed by Windows (translucency support was introduced for
> >> Windows XP, and we still try to support older versions of Windows, unlike
> >> the MacOS people).  I have been working on a workaround, so translucency
> >> support is likely to be implemented in R 2.6.0 for users of XP or later.
> >
> > I am confused by your implication that windows (prior to XP) does not
> > support translucency.  Perhaps it is not supported at the operating
> > system level, but it has certainly been available at the application
> > level for a very long time.
>
> Really? It's hard to reply to unspecific assertions.  But remember XP has
> been out since 2001, almost as long as PDF has supported translucency.

Yes, I agree, and thank you for providing some support to your
statements.  Java has supported transparency since 1.2 (with the
Graphics2D class), and was released on Dec 4, 1998, so certainly some
applications were drawing transparent graphics on windows.

> >> Given that neither of the two main screen devices and neither of the
> >> standard print devices support translucency, the subject line looks
> >> correct to me: the problem surely lies in the assumptions made in ggplot2.
> >
> > The features of the windows and X11 devices clearly lag behind the
> > quartz and pdf devices.  I can program for the lowest common
> > denominator or I can use modern features that support the tasks I am
> > working on.  I choose the later, and it is certainly your prerogative
> > to declare that a bug in me.
>
> I think to make undocumented assumptions about the environment is unkind
> to your would-be users.  Ideally the graphics devices would detect and

I have tried to point that out in most places where I used
alpha-blending in the documentation, but I did miss a few.  I think
part of my job is to educate users about what is possible with R, even
though it might be currently available for their default set up.

> report that, but that is not how support for semi-transparency was added.
> As a by-product of adding limited translucency support on the windows()
> family of devices, they do now warn.

That's great news.

> You also need to check that the extra features work correctly.  I found
> some problems with all the devices I tried that support translucency (or
> at least with device+viewer combinations for pdf and svg).  Issues include
> whether translucent fills are rendered at all, blending translucent
> colours with transparent backgrounds, and the model used (is it the light
> intensity or the perceptual colours that are being blended?).

Could you provide more details about these bugs so that I can look
into the implications for my code?  I haven't seen any problems with
preview or acrobat on the mac.

Regards,

Hadley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] using the function unique(), but asking it to ignore a column of a data.frame

2007-07-09 Thread Prof Brian Ripley
On Mon, 9 Jul 2007, Andrew Yee wrote:

> Thanks.  But in this specific case, I would like the output to include
> all three columns, including the "ignored" column (in this case, I'd
> like it to ignore column a).

sample.data.frame[!duplicated(sample.data.frame[-1]), ]

(index to exclude columns as you wish).

> Thanks,
> Andrew
>
> On 7/9/07, hadley wickham <[EMAIL PROTECTED]> wrote:
>> On 7/9/07, Andrew Yee <[EMAIL PROTECTED]> wrote:
>>> Take for example the following data.frame:
>>>
>>> a<-c(1,1,5)
>>> b<-c(3,2,3)
>>> c<-c(5,1,5)
>>> sample.data.frame<-data.frame(a=a,b=b,c=c)
>>>
>>> I'd like to be able to use unique(sample.data.frame), but have
>>> unique() ignore column a when determining the unique elements.
>>>
>>> However, I figured that this would be setting for incomparables=, but
>>> it appears that this funcationality hasn't been incorporated.  Is
>>> there a work around for this, i.e. to be able to get unique to only
>>> look at selected columns of a data frame?
>>
>> unique(df[,c("a","c")]) ?
>>
>> Hadley
>>
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] using the function unique(), but asking it to ignore a column of a data.frame

2007-07-09 Thread hadley wickham
On 7/9/07, Peter Dalgaard <[EMAIL PROTECTED]> wrote:
> Andrew Yee wrote:
> > Thanks.  But in this specific case, I would like the output to include
> > all three columns, including the "ignored" column (in this case, I'd
> > like it to ignore column a).
> >
> df[!duplicated(df[,c("a","c")]),]
>
> or perhaps
>
> df[!duplicated(df[-2]),]

Yes - of course.  I was momentarily confused about unique vs. duplicated.  Oops!

Hadley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] about scagnostics

2007-07-09 Thread hadley wickham
Hi Olivier,

You can call scagnostics either with two vectors, or a data.frame (in
which case it computes all pairwise scagnostics).

I just double checked to make sure I didn't accidentally misname the
vector of scagnostics in R, and it doesn't look like I did, so could
you please send me a reproducible example so I can look into it more
closely.

Thanks,

Hadly

On 7/9/07, Olivier ETERRADOSSI <[EMAIL PROTECTED]> wrote:
> Hi Hadley,
> thank you for providing this "scagnostics" primer
> I was trying to do some basic testing, and I see that I probably missed
> some points :
> first it's not clear for me if the argument of "scagnostics" should be
> raw data or "processed" data (results of calling "splom" or whatever...).
> If the first, I thought (from Wilkinson & al.) that if taking as an
> example variables x and y being the coordinates of a circle, I should
> find in scagnostics(x,y)$s :
> Skinny = 0 and Convex =1.
> I get Skinny = 1 and Convex =0 What am I missing ?
> (My God, I'm feeling myself going to be "Ripleyed" !.)
> Regards, Olivier
>
> --
> Olivier ETERRADOSSI
> Maître-Assistant
> CMGD / Equipe "Propriétés Psycho-Sensorielles des Matériaux"
> Ecole des Mines d'Alès
> Hélioparc, 2 av. P. Angot, F-64053 PAU CEDEX 9
> tel std: +33 (0)5.59.30.54.25
> tel direct: +33 (0)5.59.30.90.35
> fax: +33 (0)5.59.30.63.68
> http://www.ema.fr
>
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] character string to name

2007-07-09 Thread Thomas Lumley
On Mon, 9 Jul 2007, Jim Lemon wrote:

> Hi folks,
>
> I thought I recalled a request for turning a character string into an
> object name as in:

Yes. It's a FAQ.

-thomas


> x$as.name("y")<-1:4
>
> OR
>
> x<-data.frame(as.name("y")=1:4)
>
> However, as.name and a few other uninformed attempts didn't even come
> close. A search of "character to name" produced no helpful functions.
> This isn't a very urgent request, but if anyone knows some trick to
> perform this transformation, I would like to hear about it. Thanks.
>
> Jim
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] New package "proxy" for distances and similiarities

2007-07-09 Thread David Meyer
Dear useRs,

a new package for computing distance and similarity matrices made it to 
CRAN, and will propagate to the mirrors soon.

It includes an enhanced version of "dist()" with support for more than 
40 popular similarity and distance measures, both for auto- and 
cross-distances. Some important ones are implemented in C.

The proximity measures are stored in a registry which can easily be 
queried and extended by users at run-time. For adding a new measure, the 
simplest way is to provide the distance measure as a small R function, 
the package code will do the loops on the C code level to create the 
proximity matrix. It is of course also possible to use more efficient C 
implementations---either for the distance measure alone, or the whole 
matrix computation.

Input data is not restricted to matrices: provided the proximity measure 
can handle it, lists and data frames are also accepted.

The formulas for binary proximities can conveniently be specified in the 
a/b/c/d/n format, where the number of concordant/discordant pairs is 
precomputed on the C code level.

We are currently working on support for sparse data.

This is also a "Call for Measures": if you feel that a particular 
similarity of distance measure is missing, please send the formula and a 
reference (or, ideally, the whole registry entry) to one of the package 
maintainers who will happily add it.

David and Christian.

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] using the function unique(), but asking it to ignore a column of a data.frame

2007-07-09 Thread Peter Dalgaard
Andrew Yee wrote:
> Thanks.  But in this specific case, I would like the output to include
> all three columns, including the "ignored" column (in this case, I'd
> like it to ignore column a).
>   
df[!duplicated(df[,c("a","c")]),]

or perhaps

df[!duplicated(df[-2]),]
> Thanks,
> Andrew
>
> On 7/9/07, hadley wickham <[EMAIL PROTECTED]> wrote:
>   
>> On 7/9/07, Andrew Yee <[EMAIL PROTECTED]> wrote:
>> 
>>> Take for example the following data.frame:
>>>
>>> a<-c(1,1,5)
>>> b<-c(3,2,3)
>>> c<-c(5,1,5)
>>> sample.data.frame<-data.frame(a=a,b=b,c=c)
>>>
>>> I'd like to be able to use unique(sample.data.frame), but have
>>> unique() ignore column a when determining the unique elements.
>>>
>>> However, I figured that this would be setting for incomparables=, but
>>> it appears that this funcationality hasn't been incorporated.  Is
>>> there a work around for this, i.e. to be able to get unique to only
>>> look at selected columns of a data frame?
>>>   
>> unique(df[,c("a","c")]) ?
>>
>> Hadley
>>
>> 
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>   


-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Speeding up

2007-07-09 Thread ONKELINX, Thierry
Dear Bjorn,

Do you know that mean(xy*ind)+mean(xy*!ind) yields the same value for
all i? Maybe you meant mean(xy[ind]) + mean(xy[!ind])

sapply(xord, function(xordi, xy = x){
  ind <- xy < xordi
  mean(xy*ind)+mean(xy*!ind)
})

Cheers,

Thierry



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
[EMAIL PROTECTED]
www.inbo.be 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

 

> -Oorspronkelijk bericht-
> Van: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] Namens Van Campenhout Bjorn
> Verzonden: maandag 9 juli 2007 15:12
> Aan: r-help@stat.math.ethz.ch
> Onderwerp: [R] Speeding up
> 
> Hi R-helpers,
> 
> I am new in programming and R, so this may be basic.  I need 
> to speed up a procedure where I minimize some function on 
> different partitions of the data. I can do this with a loop, 
> as for instance in:
> 
> i<-1
> meanmin<-Inf
> while (i   ind<-x   if (some function to be minimized   meanmin<-some function to be minimized
>   indmin<-xord[i]
>   }
> i<-i+1
> }
> print(indmin)
> 
> I learned that I should avoid loops, so I found the following
> alternative:
> 
> dmat<-outer(x,xord,"<")*1
> ss<-apply(dmat,2,function (z) some function to be minimized) 
> indmin<-xord[which.min(ss)]
> print(indmin)
> 
> But this does not lead to spectacular improvements 
> (obviously, this is dependent on the function and the length 
> of x, and this dmat does not seem to be an elegant solution 
> to me).  Is there scope for substantial improvement? Any 
> pointers will be greatly appreciated.  Below an example with 
> some timings.
> 
> 
> > set.seed(12345)
> > x <- rnorm(1000, mean = 5, sd = 2)
> > xord<-x[order(x)]
> > 
> > system.time({i<-1
> + meanmin<-Inf
> + while (i + ind<-x + if ((mean(x*ind)+mean(x*!ind)) + meanmin<-mean(x*ind)+mean(x*!ind)
> + indmin<-xord[i]
> + }
> + i<-i+1
> + }
> + print(indmin)})
> [1] 3.826595
>user  system elapsed 
>0.140.000.14 
> > 
> > 
> > 
> > system.time({dmat<-outer(x,xord,"<")*1
> + ss<-apply(dmat,2,function (z) mean(x*z)+mean(x*!z)) 
> + indmin<-xord[which.min(ss)]
> + print(indmin)})
> [1] 3.826595
>user  system elapsed 
>0.420.060.49 
> > 
> >
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Several quick questions

2007-07-09 Thread Sébastien
Thanks all of you guys for your help. It will most helpful.


[EMAIL PROTECTED] a écrit :
> On 7/7/07, Sébastien <[EMAIL PROTECTED]> wrote:
>> Dear R users,
>>
>> Here is a couple a quick questions, for which I was unable to not find
>> any answer in the list archives and in the help:
>
> [...]
>
>> 2- When a log scale is called in a graph, the label takes a format like
>> 10^n.
>
> That's true for lattice, but not traditional graphics, as far as I know.
>
>> Is there a way to come back to a regular number format like 1, 10,
>> 100... without having to create a custom axis ?
>
> Depends on what you mean by "custom axis". You don't need to manually
> choose the tick positions etc, but you still need to define the rules
> that determine how they are calculated. See example(axis.default) for
> an example where the tick positions remain the same (as the defaults),
> but the labels change.  The slightly different rule used in
> traditional graphics is available through the axTicks() function,
> which basically boils down to this:
>
> logTicks <- function (lim, loc = c(1, 5))
> {
>ii <- floor(log10(range(lim))) + c(-1, 2)
>main <- 10^(ii[1]:ii[2])
>r <- as.numeric(outer(loc, main, "*"))
>r[lim[1] <= r & r <= lim[2]]
> }
>
> where 'lim' is the limits in the original scale. So we have
>
>> logTicks(c(1, 100))
> [1]   1   5  10  50 100
>> logTicks(c(1, 100), loc = c(2, 5, 10))
> [1]   1   2   5  10  20  50 100
>
>> 3- In lattice graphics, how does the default value of the "axs" argument
>> influence the values of "limits" ?
>> This question should be considered in the following context. The help
>> states that a 4% extension is applied by default to the axis range in
>> base graphics. So, I have tried to apply this 4 % extension to create
>> some custom lattice graphics. I worked on a dataset in which the
>> independent variable ranged from 0  to 120, so I basically customized my
>> axis using limits=c(-4.8,124.8). The results of the graphics with and
>> without the limits command were not identical...
>
> The extension is user-settable in lattice, and defaults to 7% (I think
> this value came from Trellis specs, but I don't remember the exact
> details).
>
>> lattice.getOption("axis.padding")
> $numeric
> [1] 0.07
>
> $factor
> [1] 0.6
>
> -Deepayan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] HTML.data.frame

2007-07-09 Thread elyakhlifi mustapha
I can't use the HTML.data.frame function maybe because the good package should 
however be charged I charged R2HTML and HTMLapplets could you indicate to me in 
which package this function is?


  
_ 

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Writing Excel (.xls) files on non-Windows OSs using Perl

2007-07-09 Thread Hans-Peter
Hi,

2007/7/8, Marc Schwartz <[EMAIL PROTECTED]>:
> [snip]
> There exists the xlsReadWrite package on CRAN by Hans-Peter Suter, which
> is restricted to Windows, since it utilizes the non-FOSS MS Office API
> to write the Excel formats.

The non-FOSS API is not the problem(#) but its implementation is:

The 3rd party library I use is written in Pascal and supports Delphi
and Kylix. Kylix would allow to port the package to Linux but as Kylix
has unfortunately been abandoned by CodeGear (Borland) I am not
ready/interested to spend my time on this dead road. Though it
probably could be done quickly.

A much more interesting way is to port the package using FreePascal.
--> I plan to do this since long but...
--> Maybe someone fluent on Linux and FreePascal could have a look at
the pascal header files (treetron.googlepages.com) and make the demos
run on Linux..., that would be great and speed up an eventual
xlsReadWrite port!

-- 
Regards,
Hans-Peter

(#) at least for people who are not in principle opposed to run a
package which contains a non-FOSS code part.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] using the function unique(), but asking it to ignore a column of a data.frame

2007-07-09 Thread Andrew Yee
Thanks.  But in this specific case, I would like the output to include
all three columns, including the "ignored" column (in this case, I'd
like it to ignore column a).

Thanks,
Andrew

On 7/9/07, hadley wickham <[EMAIL PROTECTED]> wrote:
> On 7/9/07, Andrew Yee <[EMAIL PROTECTED]> wrote:
> > Take for example the following data.frame:
> >
> > a<-c(1,1,5)
> > b<-c(3,2,3)
> > c<-c(5,1,5)
> > sample.data.frame<-data.frame(a=a,b=b,c=c)
> >
> > I'd like to be able to use unique(sample.data.frame), but have
> > unique() ignore column a when determining the unique elements.
> >
> > However, I figured that this would be setting for incomparables=, but
> > it appears that this funcationality hasn't been incorporated.  Is
> > there a work around for this, i.e. to be able to get unique to only
> > look at selected columns of a data frame?
>
> unique(df[,c("a","c")]) ?
>
> Hadley
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] using the function unique(), but asking it to ignore a column of a data.frame

2007-07-09 Thread hadley wickham
On 7/9/07, Andrew Yee <[EMAIL PROTECTED]> wrote:
> Take for example the following data.frame:
>
> a<-c(1,1,5)
> b<-c(3,2,3)
> c<-c(5,1,5)
> sample.data.frame<-data.frame(a=a,b=b,c=c)
>
> I'd like to be able to use unique(sample.data.frame), but have
> unique() ignore column a when determining the unique elements.
>
> However, I figured that this would be setting for incomparables=, but
> it appears that this funcationality hasn't been incorporated.  Is
> there a work around for this, i.e. to be able to get unique to only
> look at selected columns of a data frame?

unique(df[,c("a","c")]) ?

Hadley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] using the function unique(), but asking it to ignore a column of a data.frame

2007-07-09 Thread Andrew Yee
Take for example the following data.frame:

a<-c(1,1,5)
b<-c(3,2,3)
c<-c(5,1,5)
sample.data.frame<-data.frame(a=a,b=b,c=c)

I'd like to be able to use unique(sample.data.frame), but have
unique() ignore column a when determining the unique elements.

However, I figured that this would be setting for incomparables=, but
it appears that this funcationality hasn't been incorporated.  Is
there a work around for this, i.e. to be able to get unique to only
look at selected columns of a data frame?

Thanks,
Andrew

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Speeding up

2007-07-09 Thread Van Campenhout Bjorn
Hi R-helpers,

I am new in programming and R, so this may be basic.  I need to speed up
a procedure where I minimize some function on different partitions of
the data. I can do this with a loop, as for instance in:

i<-1
meanmin<-Inf
while (i set.seed(12345)
> x <- rnorm(1000, mean = 5, sd = 2)
> xord<-x[order(x)]
> 
> system.time({i<-1
+ meanmin<-Inf
+ while (i 
> 
> 
> system.time({dmat<-outer(x,xord,"<")*1 
+ ss<-apply(dmat,2,function (z) mean(x*z)+mean(x*!z))
+ indmin<-xord[which.min(ss)]
+ print(indmin)})
[1] 3.826595
   user  system elapsed 
   0.420.060.49 
> 
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] transform excel data into graph

2007-07-09 Thread John Kane
I am not sure exactly what you want but see if this
will work. It will give you a dotchart.  

Assume your data.frame is dat
First give the lessons column a name. See ?names

convert numbers in data.frame to a matrix for dotchart

dmat <- as.matrix(dat[,2:4])

Draw dotchart using dat$lessons as a 
dotchart(dmat, labels = dat[,1])

--- cross123 <[EMAIL PROTECTED]> wrote:

> 
> Hello everyone,
> I have a set of data in the following form, which
> are stored in an Excel
> file:
>  nick   john   peter
> 
> lesson1   0.465 0.498 0.473
> lesson2   0.422  0.44  0.134   
> lesson3   0.45   0.35   0.543   
>   
> lesson4   0.590  0.64  0.11 
> 
> lesson5   0.543  0.50.32
>  
> 
> What I want to do is a 2d-graph plot where I will
> have  the name of the
> student in the X-axis and the name of the lesson in
> the Y-axis and the
> number from each pair will be used to construct the
> plot.
> I am newbie with R and I don't know which package
> shall I use nor the
> commands with which I will import my data in R so
> that the plot will be
> created...
> 
> Any help would be greatly appreciated.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] character string to name

2007-07-09 Thread Gabor Grothendieck
Is one of these alternatives what you want?

# 1
x <- list()
x[["y"]] <- 1:4
x <- as.data.frame(x)
x

# 2
x <- data.frame(1:4)
names(x) <- "y"
x

# 3
x <- as.data.frame(sapply("y", function(x, y) y, 1:4, simplify = FALSE))
x

On 7/9/07, Jim Lemon <[EMAIL PROTECTED]> wrote:
> Hi folks,
>
> I thought I recalled a request for turning a character string into an
> object name as in:
>
> x$as.name("y")<-1:4
>
> OR
>
> x<-data.frame(as.name("y")=1:4)
>
> However, as.name and a few other uninformed attempts didn't even come
> close. A search of "character to name" produced no helpful functions.
> This isn't a very urgent request, but if anyone knows some trick to
> perform this transformation, I would like to hear about it. Thanks.
>
> Jim
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] why function 'sum' within 'aggregate' need an 'index'?

2007-07-09 Thread Gavin Simpson
On Mon, 2007-07-09 at 20:14 +0800, jingjiang yan wrote:
> Hi, people.
> I am using R-2.5.0 now, when tried the function aggregate with sum, it
> showed an  error as following:
> > a <- gl(3,10)
> > b <- rnorm(30)
> > aggregate(b,list(a),sum)
> #  here is the error message,  it complained that an error in FUN(X[[1L]],
> missing "INDEX", and no defaults value.
> 
> but the tapply function will be okay.
> > tapply(b,list(a),sum)
> 1 2 3
>  2.113349 -5.972195  4.854731
> 
> furthermore, when I was using the R-2.5.0 pre-release version before.
> it could work well.
> > a <- gl(3,10)
> > b <- rnorm(30)
> > aggregate(b,list(a),sum)  # it works well
>   Group.1  x
> 1   1 -1.0330482
> 2   2  0.1235796
> 3   3 -1.0086930
> > tapply(b,list(a),sum)# so does tapply
>  1  2  3
> -1.0330482  0.1235796 -1.0086930
> 
> So, who can tell what should I do to overcome this?
> thanks a lot.

Update to R 2.5.1 as your first example works for me [version info
below]. If that is not possible, just use the tapply version for now.

G

> version
   _
platform   i686-pc-linux-gnu
arch   i686
os linux-gnu
system i686, linux-gnu
status Patched
major  2
minor  5.1
year   2007
month  07
day05
svn rev42131
language   R
version.string R version 2.5.1 Patched (2007-07-05 r42131)

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] character string to name

2007-07-09 Thread Jim Lemon
Hi folks,

I thought I recalled a request for turning a character string into an 
object name as in:

x$as.name("y")<-1:4

OR

x<-data.frame(as.name("y")=1:4)

However, as.name and a few other uninformed attempts didn't even come 
close. A search of "character to name" produced no helpful functions. 
This isn't a very urgent request, but if anyone knows some trick to 
perform this transformation, I would like to hear about it. Thanks.

Jim

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] why function 'sum' within 'aggregate' need an 'index'?

2007-07-09 Thread jingjiang yan
Hi, people.
I am using R-2.5.0 now, when tried the function aggregate with sum, it
showed an  error as following:
> a <- gl(3,10)
> b <- rnorm(30)
> aggregate(b,list(a),sum)
#  here is the error message,  it complained that an error in FUN(X[[1L]],
missing "INDEX", and no defaults value.

but the tapply function will be okay.
> tapply(b,list(a),sum)
1 2 3
 2.113349 -5.972195  4.854731

furthermore, when I was using the R-2.5.0 pre-release version before.
it could work well.
> a <- gl(3,10)
> b <- rnorm(30)
> aggregate(b,list(a),sum)  # it works well
  Group.1  x
1   1 -1.0330482
2   2  0.1235796
3   3 -1.0086930
> tapply(b,list(a),sum)# so does tapply
 1  2  3
-1.0330482  0.1235796 -1.0086930

So, who can tell what should I do to overcome this?
thanks a lot.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Problem with Sweave and pdf version 1.4

2007-07-09 Thread ONKELINX, Thierry
Dear useRs,

I'm trying to use ggplot2 in Sweave (R 2.5.1). The plots use the alpha
channel, so I need to use pdf version 1.4. Search the mailinglist
archive I found two solutions: \SweaveOpts{echo = FALSE,
pdf.version=1.4} and explicit writing to a pdf 1.4 file. The latter
works but the first doesn't. Probably I'm doing something wrong (see the
Rnw file below). The file tmp_tmp.pdf is generated but is corrupt.
Using the second option, is there a way to create the filename based on
some variable. Something like 
x <- "sometext"
filename <- paste(x, ".pdf", sep = "")
pdf(file=filename, version="1.4") 

But how can I pass the filename to \includegraphics?

The Rnw file

\documentclass[11pt]{report}
\usepackage{Sweave}
\SweaveOpts{echo = FALSE, pdf.version=1.4, eps = FALSE}
\begin{document}
\begin{figure}
\centering
<>=
  library(ggplot2)
  x <- runif(100)
  dataset <- data.frame(x = x, y = 5 * x + rnorm(100))
  ggplot(dataset, aes(y = y, x = x)) + stat_smooth() + geom_jitter()
@
\caption{Here comes a caption.}
\label{fig:tmp}
\end{figure}
\begin{figure}
\centering
<>=
  pdf(file="foo.pdf", version="1.4") 
  ggplot(dataset, aes(y = y, x = x)) + stat_smooth() + geom_jitter()
  dev.off() 
@ 
\incudegraphics{foo} 
\caption{Here comes a caption.}
\label{fig:foo}
\end{figure}
\end{document}


Thanks in advance,

Thierry



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
[EMAIL PROTECTED]
www.inbo.be 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] a little problem on selecting a subset from dataset A accordingto dataset B?

2007-07-09 Thread Bill.Venables
> AB <- with(B, subset(A, coords.x1 %in% X1))
> AB
   coords.x1 coords.x2
0   542250.9   3392404
7   541512.5   3394722
8   541479.3   3394878
9   538903.4   3395943
18  543274.0   3389919
19  543840.8   3392012

 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of zhijie zhang
Sent: Monday, 9 July 2007 2:43 AM
To: R-help@stat.math.ethz.ch
Subject: [R] a little problem on selecting a subset from dataset A
accordingto dataset B?

Dear Friends,
   I want to extract the records from A according to B, but the results
are
not correct because R says :
  The length of long object is not integer times on the length of short
object.
  Anybody have met the same problem? How to do it correctly?

length(A)=47
length(B)=6

A[A$coords.x1==B$X1,]   #the program for the above task. I should get 6
records, but i only get former 4 records for the above reason.

Thanks.
 The folloing shows dataset A and B.


> A
   coords.x1 coords.x2
0  542250.89 3392404.1
1  538813.87 3388339.0
2  536049.19 3385821.6
3  533659.62 3383194.2
4  530642.30 3376834.9
5  529573.15 3378177.8
6  530853.82 3394838.8
7  541512.51 3394721.6
8  541479.33 3394877.8
9  538903.39 3395942.5
10 536019.95 3396286.1
11 538675.23 3384213.2
12 535127.95 3381255.4
13 533852.24 3378660.4
14 531360.91 3379273.8
15 539289.14 3375759.8
16 543410.51 3384353.1
17 543089.27 3388170.1
18 543274.03 3389919.2
19 543840.77 3392012.4
20 553383.55 3402401.8
21 554621.51 3397938.9
22 564096.42 3397524.4
23 567529.64 3398702.9
24 561798.76 3404864.0
25 562868.34 3405502.2
26 563145.22 3403192.1
27 562419.87 3404090.4
28 558321.85 3403879.9
29 567050.74 3404973.1
30 570609.70 3408742.4
31 556777.57 3397858.0
32 531353.38 3368596.6
33 533513.50 3372749.3
34 537543.19 3364284.8
35 538779.41 3368224.8
36 525930.09 3374067.7
37 522990.85 3369213.1
38 528826.37 3359019.0
39 533865.85 3362595.4
40 531200.25 3365053.0
41 551054.10 3377181.3
42 546974.19 3369284.8
43 572315.59 3359541.1
44 562703.63 3355173.4
45 558959.31 3357804.4
46 558531.39 3361741.1


> B
 X1X2
1 542250.89 3392404.1
2 541512.51 3394721.6
3 541479.33 3394877.8
4 538903.39 3395942.5
5 543274.03 3389919.2
6 543840.77 3392012.4

-- 
With Kind Regards,

oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:
[***
]
Zhi Jie,Zhang ,PHD
Tel:86-21-54237149
Dept. of Epidemiology,School of Public Health,Fudan University
Address:No. 138 Yi Xue Yuan Road,Shanghai,China
Postcode:200032
Email:[EMAIL PROTECTED]
Website: www.statABC.com
[***
]
oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] rpart weight prior

2007-07-09 Thread Prof Brian Ripley

On Sun, 8 Jul 2007, Aurélie Davranche wrote:


Hi!

Could you please explain the difference between "prior" and "weight" in 
rpart? It seems to be the same. But in this case why including a weight 
option in the latest versions? For an unbalanced sampling what is the best to 
use : weight, prior or the both together?


The 'weight' argument (sic) has been there for a decade, and is not the 
same as the 'prior' param.


The help file (which you seem unfamiliar with) says

 weights: optional case weights.

   parms: optional parameters for the splitting function. Anova
  splitting has no parameters. Poisson splitting has a single
  parameter, the coefficient of variation of the prior
  distribution on the rates.  The default value is 1.
  Exponential splitting has the same parameter as Poisson. For
  classification splitting, the list can contain any of: the
  vector of prior probabilities (component 'prior'), the loss
  matrix (component 'loss') or the splitting index (component
  'split').  The priors must be positive and sum to 1.  The
  loss matrix must have zeros on the diagonal and positive
  off-diagonal elements.  The splitting index can be 'gini' or
  'information'.  The default priors are proportional to the
  data counts, the losses default to 1, and the split defaults
  to 'gini'.

The rpart technical report at

http://mayoresearch.mayo.edu/mayo/research/biostat/upload/61.pdf

may help you understand this.

--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] a little problem on selecting a subset from dataset A according to dataset B?

2007-07-09 Thread Chuck Cleland
zhijie zhang wrote:
> Dear Friends,
>I want to extract the records from A according to B, but the results are
> not correct because R says :
>   The length of long object is not integer times on the length of short
> object.
>   Anybody have met the same problem? How to do it correctly?
> 
> length(A)=47
> length(B)=6
> 
> A[A$coords.x1==B$X1,]   #the program for the above task. I should get 6
> records, but i only get former 4 records for the above reason.
> 
> Thanks.

A[A$coords.x1 %in% B$X1,]
   coords.x1 coords.x2
1   542250.9   3392404
8   541512.5   3394722
9   541479.3   3394878
10  538903.4   3395943
19  543274.0   3389919
20  543840.8   3392012

?is.element

>  The folloing shows dataset A and B.
> 
> 
>> A
>coords.x1 coords.x2
> 0  542250.89 3392404.1
> 1  538813.87 3388339.0
> 2  536049.19 3385821.6
> 3  533659.62 3383194.2
> 4  530642.30 3376834.9
> 5  529573.15 3378177.8
> 6  530853.82 3394838.8
> 7  541512.51 3394721.6
> 8  541479.33 3394877.8
> 9  538903.39 3395942.5
> 10 536019.95 3396286.1
> 11 538675.23 3384213.2
> 12 535127.95 3381255.4
> 13 533852.24 3378660.4
> 14 531360.91 3379273.8
> 15 539289.14 3375759.8
> 16 543410.51 3384353.1
> 17 543089.27 3388170.1
> 18 543274.03 3389919.2
> 19 543840.77 3392012.4
> 20 553383.55 3402401.8
> 21 554621.51 3397938.9
> 22 564096.42 3397524.4
> 23 567529.64 3398702.9
> 24 561798.76 3404864.0
> 25 562868.34 3405502.2
> 26 563145.22 3403192.1
> 27 562419.87 3404090.4
> 28 558321.85 3403879.9
> 29 567050.74 3404973.1
> 30 570609.70 3408742.4
> 31 556777.57 3397858.0
> 32 531353.38 3368596.6
> 33 533513.50 3372749.3
> 34 537543.19 3364284.8
> 35 538779.41 3368224.8
> 36 525930.09 3374067.7
> 37 522990.85 3369213.1
> 38 528826.37 3359019.0
> 39 533865.85 3362595.4
> 40 531200.25 3365053.0
> 41 551054.10 3377181.3
> 42 546974.19 3369284.8
> 43 572315.59 3359541.1
> 44 562703.63 3355173.4
> 45 558959.31 3357804.4
> 46 558531.39 3361741.1
> 
> 
>> B
>  X1X2
> 1 542250.89 3392404.1
> 2 541512.51 3394721.6
> 3 541479.33 3394877.8
> 4 538903.39 3395942.5
> 5 543274.03 3389919.2
> 6 543840.77 3392012.4

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Message Acknowledgement

2007-07-09 Thread OrderInfo
 
This is just a quick confirmation to let you know that we received your  
message below at [EMAIL PROTECTED] 
 
Your input is important to us and we will get back to you as soon as we can. 
If you have any other questions please feel free to send us email or call 
our customer service department at 1-800-651-1415. Email customer service is 
availible 8:00 AM - 5:00 PM Central Time, Monday through Friday. 
 
Sincerely, 
 
Customer Service
HomeVisions
www.HomeVisions.com 
 
Your Message: 
-- 
CI:00864890

Your message was not delivered due to the following reason(s):

Your message was not delivered because the destination computer was
unreachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.

Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.

Your message was not delivered within 1 days:
Mail server 178.23.220.84 is not responding.

The following recipients did not receive this message:
<[EMAIL PROTECTED]>

Please reply to [EMAIL PROTECTED]
if you feel this message to be in error.





File attachment: homevisions.com
A file attached to this email was removed
because it was infected with a virus.

Virus Name:  [EMAIL PROTECTED]
Virus ID:34256

 

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] a little problem on selecting a subset from dataset A according to dataset B?

2007-07-09 Thread zhijie zhang
Dear Friends,
   I want to extract the records from A according to B, but the results are
not correct because R says :
  The length of long object is not integer times on the length of short
object.
  Anybody have met the same problem? How to do it correctly?

length(A)=47
length(B)=6

A[A$coords.x1==B$X1,]   #the program for the above task. I should get 6
records, but i only get former 4 records for the above reason.

Thanks.
 The folloing shows dataset A and B.


> A
   coords.x1 coords.x2
0  542250.89 3392404.1
1  538813.87 3388339.0
2  536049.19 3385821.6
3  533659.62 3383194.2
4  530642.30 3376834.9
5  529573.15 3378177.8
6  530853.82 3394838.8
7  541512.51 3394721.6
8  541479.33 3394877.8
9  538903.39 3395942.5
10 536019.95 3396286.1
11 538675.23 3384213.2
12 535127.95 3381255.4
13 533852.24 3378660.4
14 531360.91 3379273.8
15 539289.14 3375759.8
16 543410.51 3384353.1
17 543089.27 3388170.1
18 543274.03 3389919.2
19 543840.77 3392012.4
20 553383.55 3402401.8
21 554621.51 3397938.9
22 564096.42 3397524.4
23 567529.64 3398702.9
24 561798.76 3404864.0
25 562868.34 3405502.2
26 563145.22 3403192.1
27 562419.87 3404090.4
28 558321.85 3403879.9
29 567050.74 3404973.1
30 570609.70 3408742.4
31 556777.57 3397858.0
32 531353.38 3368596.6
33 533513.50 3372749.3
34 537543.19 3364284.8
35 538779.41 3368224.8
36 525930.09 3374067.7
37 522990.85 3369213.1
38 528826.37 3359019.0
39 533865.85 3362595.4
40 531200.25 3365053.0
41 551054.10 3377181.3
42 546974.19 3369284.8
43 572315.59 3359541.1
44 562703.63 3355173.4
45 558959.31 3357804.4
46 558531.39 3361741.1


> B
 X1X2
1 542250.89 3392404.1
2 541512.51 3394721.6
3 541479.33 3394877.8
4 538903.39 3395942.5
5 543274.03 3389919.2
6 543840.77 3392012.4

-- 
With Kind Regards,

oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:
[***]
Zhi Jie,Zhang ,PHD
Tel:86-21-54237149
Dept. of Epidemiology,School of Public Health,Fudan University
Address:No. 138 Yi Xue Yuan Road,Shanghai,China
Postcode:200032
Email:[EMAIL PROTECTED]
Website: www.statABC.com
[***]
oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] ggplot 0.5.4

2007-07-09 Thread hadley wickham
ggplot2
===

ggplot2 is a plotting system for R, based on the grammar of graphics,
which tries to take the good parts of base and lattice graphics and
avoid bad parts. It takes care of many of the fiddly details
that make plotting a hassle (like drawing legends) as well as
providing a powerful model of graphics that makes it easy to produce
complex multi-layered graphics.

Find out more at http://had.co.nz/ggplot2, and check out the over 500
examples of ggplot in use.

Changes in version 0.5.4 --

* border now drawn on top of geoms, instead of below - this results in
better appearance when adjusting scale limits
* ggplot() + aes() now modifies existing default aesthetic mapping,
rather than overwriting
* polished examples in facet_grid

Changes in version 0.5.3 --

* added experimental scatterplot matrix, see ?plotmatrix
* added new border.colour and grid.minor.colour options for better
control over plot appearance
* updated theme_bw to do better when drawing a plot with white background
* better default colour choices for gradients (and more discussion in examples)
* fixed bug in ScaleGradient2 where scales with different positive and
negative ranges were not scaled correctly
* allow expressions as result from strip.text
* fixed rare bug in geom_vline and geom_hline
* fixed example in geom_abline
* tweaked display of multiline axis labels

Regards,

Hadley

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] adding latex, html docs. to new packag

2007-07-09 Thread Uwe Ligges


Edna Bell wrote:
> Hi again!
> 
> How do I create the Latex and HTML files for documentation for a new
> package, please?
> 
> Is there something in the R CMD stuff that would do it, or do I need
> to produce by hand, pleaes?


As the manual "Writing R Extensions" suggests, please write your 
documentation in the Rd format. Those files are converted automatically 
to latex and html (among other format) when the package is installed.

Skeletons for the help files can be generated using prompt() or for a 
whole package, see ?package.skeleton.

Uwe Ligges







> thanks,
> eb
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] EM algorithm for Missing Data.

2007-07-09 Thread Ted Harding
On 09-Jul-07 02:20:47, Marcus Vinicius wrote:
>  Dear all,
> I need to use the EM algorithm where data are missing.
> Example:
> x<- c(60.87, NA, 61.53, 72.20, 68.96, NA, 68.35, 68.11, NA, 71.38)
> 
> May anyone help me?
> 
> Thanks.
> 
> Marcus Vinicius

The Dempster, Laird & Rubin reference given by Simon Blomberg
is the classical account of the EM Algorithm for incomplete
information, though there has been a lot more published since.

However, more to the point in the present case: If the above
is typical of your data, you had better state what you want to
do with the data.

Do you want to fit a distribution by estimating parameters?
Are they observations of a "response" variable with covariates
and you want to fit a linear model estimating the coefficients?
Are they data from a time-series and you need to interpolate
at the missing values?
Etc.??

Depending on what you want to do, the way you apply the general
EM Algorithm procedure may be very different; and a lot of
applications are not covered by Dempster, Laird & Rubin (1977).

And there may possibly be no point anyway: If all you want to do
is estimate the mean of the distribution of the data, then the
best procedure may simply be to ignore the missing data.

Best wishes,
Ted.


E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 09-Jul-07   Time: 09:18:56
-- XFMail --

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] random sampling with some limitive conditions?

2007-07-09 Thread Gavin Simpson
Dear Jian,

This came up on R-help recently; I haven't got time to find the thread
for you, but it shouldn't take too much hunting out.

I suggested the following approach, based on the swap method of Roberts
and Stone (1990) Island-sharing by archipelago species. Oecologia 85:
560-567. The code for this is appended at the end of this message. Below
is an example:

> dat <- matrix(scan(), ncol = 8, byrow = TRUE)
1: 1 0 0 0 1 1 0 0
9: 0 1 1 1 0 1 0 1
17: 1 0 0 0 1 0 1 0
25: 0 0 0 1 0 1 0 1
33: 1 0 1 0 0 0 0 0
41: 0 1 0 1 1 1 1 1
49: 1 0 0 0 0 0 0 0
57: 0 0 0 1 0 1 0 1
65:
Read 64 items
> dat ## your data
 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,]10001100
[2,]01110101
[3,]10001010
[4,]00010101
[5,]10100000
[6,]01011111
[7,]10000000
[8,]00010101

rBinMat is the function appended below. We search for elements of dat
that that are diagonal:

10  or 01
01 10

We do this by randomly selecting two rows and columns to find a 2x2
sub-matrix of dat. We check if it is diagonal, and if it is, we swap the
1's and 0's. This retains the row and column sums. If the sub-matrix is
non-diagonal, we simply leave it as it is. This process is repeated many
times in a "burn in" period, after which, random binary matrices can be
produced.

In the line below we use a burn in of 3 swaps - which takes about 9
seconds to prime the matrix. (in fact this matrix is achieved after
making a further 1000 swaps as per argument skip = 1000)

> system.time(ran.mat1 <- rBinMat(dat, burn.in = 3))
   user  system elapsed
  9.556   0.104   9.683
> ran.mat1
 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,]01001001
[2,]01101110
[3,]10110000
[4,]00010101
[5,]10010000
[6,]10011111
[7,]00000100
[8,]10000101
> rowSums(ran.mat1)
[1] 3 5 3 3 2 6 1 3
> colSums(ran.mat1)
[1] 4 2 2 4 3 5 2 4

Having primed our random matrix, we can use this matrix and produce a
new random matrix from it by making a smaller number of swaps (default
1000), by setting the burn in to be 0.

> ran.mat2 <- rBinMat(ran.mat1, burn.in = 0)
> ran.mat2
 [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
[1,]10001100
[2,]10110101
[3,]10100010
[4,]00011001
[5,]01000001
[6,]01011111
[7,]00000100
[8,]10010100
> rowSums(ran.mat2)
[1] 3 5 3 3 2 6 1 3
> colSums(ran.mat2)
[1] 4 2 2 4 3 5 2 4
>

As you can see, the row and column sums are as per your original matrix.

There are other methods to achieve these random binary matrices - some
of which were mentioned in the recent thread.

HTH

G

Ps: I cooked this up over lunch in response to the earlier thread. It
could no doubt be improved upon.

###
##   ##
## rBinMat() ##
##   ##
## Function: ##
## = ##
## Generates random binary matrices that preserve row and column ##
## sums using the swap method of Roberts and Stone (1990) Island-##
## sharing by archipelago species. Oecologia 85: 560-567.##
##   ##
## Arguments:##
## ==##
## x   : Species presence/absence matrix (binary, 1/0s)  ##
## burn.in : The "burn in" period required --- how many swaps to ##
##   make to 'x' before a random matrix can be generated?##
## skip: The number of swaps to skip before drawing a matrix.##
##   Once a matrix is burned in, it can be used in sub-  ##
##   sequent calls to rBinMat() [using "burn.in = 0"] for##
##   generating further random matrices. In such cases, one  ##
##   might wish to skip n swaps before drawing the next  ##
##   matrix. ##
##   ##
## Author  : Gavin L. Simpson##
## Date:

[R] display data.frame with lines and colimns

2007-07-09 Thread elyakhlifi mustapha
hello,
to display a data.frame I use this syntax

dir.create(file.path(tempdir(),"R2HTML"))
target <- HTMLInitFile(file.path(tempdir(),"R2HTML"),filename="sample", 
BackGroundColor="#EE")
HTML("Don't forget to use the CSS file in order to benefit from fixed-width 
font",file=target)
tmp <- as.data.frame(matrix(rnorm(100),ncol=10))
HTML(tmp,file=target)
HTMLEndFile()

I obtain a good result but I'd like to display my data.frame with lines and 
columns and when I use the syntax FOR R don't display all the data.frame just 
for the last boucle (for).
Can you help me please?
thanks.


  
_ 

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help on fisher.test(stats)?

2007-07-09 Thread Stefan Grosse
 Original Message  
Subject: [R] help on fisher.test(stats)?
From: zhijie zhang <[EMAIL PROTECTED]>
To: R-help@stat.math.ethz.ch
Date: 09.07.2007 09:03
> Dear friends,
>   My dataset have many zeros, so i must use fisher exact test .
> Unfortunately, the fisher.test(stats) function fail to do it.
>   Anybody knows how to do the fisher exact test with many zeros in the
> dataset?
> My dataset is:
> a<-matrix(c(0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,1,1,0,2,1,5,1,1,6,4,4,1,17,2,8,5,7,1,1,24,3,6,1,1,3,2,16,7,4,0,2,4,0,17,0,1,0,0,0,1,2),nrow=8,byrow=TRUE)
> data.frame(a)
> b<-a[,-7]
> as.matrix(b)
> c<-as.matrix(b)
>
>   
>> c
>> 
>  [,1] [,2] [,3] [,4] [,5] [,6]
> [1,]010000
> [2,]010000
> [3,]011021
> [4,]116441
> [5,]285711
> [6,]361132
> [7,]740240
> [8,]010001
>   
>> fisher.test(c,workspace=20)
>> 
> ŽíÎóÓÚfisher.test(c, workspace = 2e+17) :
> ÍâœÓº¯Êýµ÷ÓÃʱ²»ÄÜÓÐNA(arg10)
> ŽËÍâ: Warning message:
> Ç¿Öƞıä¹ý³ÌÖвúÉúÁËNA
>
> Any suggestion or help are greatly appreciated.
>   
Your workspace is by far to large. I have done it with
> fisher.test(c,workspace=4000)

Fisher's Exact Test for Count Data

data:  c
p-value = 0.01548
alternative hypothesis: two.sided

(btw. it took half an hour...)

Simulation would also be an alternative approach:

> fisher.test(c,simulate=T)

Fisher's Exact Test for Count Data with simulated p-value (based
on 2000 replicates)

data:  c
p-value = 0.01349
alternative hypothesis: two.sided

As you see the p-value is not that different, you could use more
replications:

> fisher.test(c,simulate=T,B=100)

Fisher's Exact Test for Count Data with simulated p-value (based
on 1e+06 replicates)

data:  c
p-value = 0.01514
alternative hypothesis: two.sided

and it is still much faster...

Stefan
-=-=-
... The most incomprehensible thing about the world is that it is
comprehensible. (A. Einstein)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] transform excel data into graph

2007-07-09 Thread cross123

Hello everyone,
I have a set of data in the following form, which are stored in an Excel
file:
 nick   john   peter 
lesson1   0.465 0.498 0.473
lesson2   0.422  0.44  0.134   
lesson3   0.45   0.35   0.543  
lesson4   0.590  0.64  0.11  
lesson5   0.543  0.50.32  

What I want to do is a 2d-graph plot where I will have  the name of the
student in the X-axis and the name of the lesson in the Y-axis and the
number from each pair will be used to construct the plot.
I am newbie with R and I don't know which package shall I use nor the
commands with which I will import my data in R so that the plot will be
created...

Any help would be greatly appreciated.

-- 
View this message in context: 
http://www.nabble.com/transform-excel-data-into-graph-tf4046056.html#a11493073
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] rpart weight prior

2007-07-09 Thread Aurélie Davranche

Hi!

Could you please explain the difference between "prior" and "weight" in 
rpart? It seems to be the same. But in this case why including a weight 
option in the latest versions? For an unbalanced sampling what is the 
best to use : weight, prior or the both together?


Thanks a lot.

Aurélie Davranche.
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Calling R function in C

2007-07-09 Thread Deb Midya
Hi R Users!
   
  Thanks in advance.
   
  I am using R-2.5.1 on Windows XP and I have installed all necessary tools 
such as perl and tools.exe.
   
  I am trying to use sample(1:100, 3, rep=F) in C. How can I use this R 
function in C?
   
  Once again thank you very much for your time.
   
  Regards,
   
  Debabrata (Deb)
  Statistician
  NSW Department of Commerce
  Sydney, Australia.
   
   

   
-

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] boot.ci

2007-07-09 Thread Fredrik Lundgren
Dear boot.ers,

I ran a small program for training purposes and ended with problems in 
boot.ci

bush <- c(rep(1, 840), rep(0, 660))
> f.mean <- function(y, id) {mean(y[id])}
> bushB <- boot(bush, f.mean, 1000)
> boot.ci(bushB, conf = 0.95, type = c('perc', 'bca'))
Error in bca.ci(boot.out, conf, index[1], L = L, t = t.o, t0 = t0.o, h = 
h,  :
 estimated adjustment 'a' is NA
>

What's wrong in my setup? boot appears to work OK

Sincerly Fredrik Lundgren

PS. By the way - anyone who has "Resampling stats, standalone" for sale? 
DS

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] help on fisher.test(stats)?

2007-07-09 Thread zhijie zhang
Dear friends,
  My dataset have many zeros, so i must use fisher exact test .
Unfortunately, the fisher.test(stats) function fail to do it.
  Anybody knows how to do the fisher exact test with many zeros in the
dataset?
My dataset is:
a<-matrix(c(0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,1,1,0,2,1,5,1,1,6,4,4,1,17,2,8,5,7,1,1,24,3,6,1,1,3,2,16,7,4,0,2,4,0,17,0,1,0,0,0,1,2),nrow=8,byrow=TRUE)
data.frame(a)
b<-a[,-7]
as.matrix(b)
c<-as.matrix(b)

> c
 [,1] [,2] [,3] [,4] [,5] [,6]
[1,]010000
[2,]010000
[3,]011021
[4,]116441
[5,]285711
[6,]361132
[7,]740240
[8,]010001
> fisher.test(c,workspace=20)
´íÎóÓÚfisher.test(c, workspace = 2e+17) :
Íâ½Óº¯Êýµ÷ÓÃʱ²»ÄÜÓÐNA(arg10)
´ËÍâ: Warning message:
Ç¿ÖƸıä¹ý³ÌÖвúÉúÁËNA

Any suggestion or help are greatly appreciated.
-- 
With Kind Regards,

oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:
[***]
Zhi Jie,Zhang ,PHD
Tel:86-21-54237149
Dept. of Epidemiology,School of Public Health,Fudan University
Address:No. 138 Yi Xue Yuan Road,Shanghai,China
Postcode:200032
Email:[EMAIL PROTECTED]
Website: www.statABC.com
[***]
oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.