Re: [R] scatterplot of 100000 points and pdf file format

2004-11-25 Thread Witold Eryk Wolski
Prof Brian Ripley wrote:
On Wed, 24 Nov 2004 [EMAIL PROTECTED] wrote:
On 24-Nov-04 Witold Eryk Wolski wrote:
Hi,
I want to draw a scatter plot with 1M  and more points
and save it as pdf.
This makes the pdf file large.
So i tried to save the file first as png and than convert
it to pdf. This looks OK if printed but if viewed e.g. with
acrobat as document figure the quality is bad.
Anyone knows a way to reduce the size but keep the quality?

If you want the PDF file to preserve the info about all the
1M points then the problem has no solution. The png file
will already have suppressed most of this (which is one
reason for poor quality).
I think you should give thought to reducing what you need
to plot.
Think about it: suppose you plot with a resolution of
1/200 points per inch (about the limit at which the eye
begins to see rough edges). Then you have 4 points
per square inch. If your 1M points are separate but as
closely packed as possible, this requires 25 square inches,
or a 5x5 inch (= 12.7x12.7 cm) square. And this would be
solid black!
Presumably in your plot there is a very large number of
points which are effectively indistinguisable from other
points, so these could be eliminated without spoiling
the plot.
I don't have an obviously best strategy for reducing what
you actually plot, but perhaps one line to think along
might be the following:
1. Multiply the data by some factor and then round the
  results to an integer (to avoid problems in step 2).
  Factor chosen so that the result of (4) below is
  satisfactory.
2. Eliminate duplicates in the result of (1).
3. Divide by the factor you used in (1).
4. Plot the result; save plot to PDF.
As to how to do it in R: the critical step is (2),
which with so many points could be very heavy unless
done by a well-chosen procedure. I'm not expert enough
to advise about that, but no doubt others are.

unique will eat that for breakfast
x - runif(1e6)
system.time(xx - unique(round(x, 4)))
[1] 0.55 0.09 0.64 0.00 0.00
length(xx)
[1] 10001


?table - reduces the data
and
?image - shows it.
And this is doing exactly what I need. (not my idea but one of Thomas 
Unternäher).  Thanks Thomas.

/E
--
Dipl. bio-chem. Witold Eryk Wolski
MPI-Moleculare Genetic
Ihnestrasse 63-73 14195 Berlin
tel: 0049-30-83875219 __(_
http://www.molgen.mpg.de/~wolski  \__/'v'
http://r4proteomics.sourceforge.net||/   \
mail: [EMAIL PROTECTED]^^ m m
 [EMAIL PROTECTED]
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] what does order() stand for in an lme formula?

2004-11-25 Thread Martin Maechler
 PD == Peter Dalgaard [EMAIL PROTECTED]
 on 24 Nov 2004 19:35:45 +0100 writes:

PD Harry Athanassiou [EMAIL PROTECTED]
PD writes:
 I'm a beginner in R, and trying to fit linear models with
 different intercepts per group, of the type y ~ A*x1 + B,
 where x1 is a numerical variable. I cannot understand
 whether I should use y1 ~ x1 +1 or y1 ~ order(x1) + 1

 Although in the toy example included it makes a small
 difference, in models with many groups the models without
 order() converge slower if at all!

PD Er?

PD What gave you the idea of using order in the first
PD place? To the best of my knowledge, order(x) is also in
PD this context just a function, which for the nth
PD observation returns the position of the nth largest
PD observation in x. This is not likely to make sense as a
PD predictor in a model.

where on the other hand,  
  rank(x1)
may make sense and what Harry really intended to use.

Martin Maechler, ETH Zurich

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Creating lists from matrices

2004-11-25 Thread Alexander Sokol
Hello,

I am using R 1.9.1 on Windows 2000 SP4. I have the following problem:

Say I have a matrix,

my.matrix
   [,1]   [,2]   [,3]
[1,]   A   B   C
[2,]   D   E   F
[3,]   G   H   I

I would like to apply an operation to this matrix which returns a list my.list 
containing the following 3 elements,

my.list
[[1]]
[1] A B C
[[2]]
[2] D E F
[[3]]
[3] G H I

That is, each row of the original matrix is turned into a vector and these 
vectors are collected to a list. How do I do this?

Thanks,
 Alexander

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Creating lists from matrices

2004-11-25 Thread Peter Dalgaard
Alexander Sokol [EMAIL PROTECTED] writes:

 [1] A B C
 [[2]]
 [2] D E F
 [[3]]
 [3] G H I
 
 That is, each row of the original matrix is turned into a vector and these 
 vectors are collected to a list. How do I do this?

split(my.matrix, row(my.matrix))

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Creating lists from matrices

2004-11-25 Thread Prof Brian Ripley
my.matrix - matrix(LETTERS[1:9],3,3,byrow=TRUE)
split(my.matrix, row(my.matrix))
$1
[1] A B C
$2
[1] D E F
$3
[1] G H I
which even names the rows for you.
On Thu, 25 Nov 2004, Alexander Sokol wrote:
Hello,
I am using R 1.9.1 on Windows 2000 SP4. I have the following problem:
Say I have a matrix,
my.matrix
  [,1]   [,2]   [,3]
[1,]   A   B   C
[2,]   D   E   F
[3,]   G   H   I
I would like to apply an operation to this matrix which returns a list my.list
containing the following 3 elements,
my.list
[[1]]
[1] A B C
[[2]]
[2] D E F
[[3]]
[3] G H I
That is, each row of the original matrix is turned into a vector and these
vectors are collected to a list. How do I do this?
Thanks,
Alexander
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Danish characters i R2.0.1 vs R1.9.1 under winXP

2004-11-25 Thread Prof Brian Ripley
On Thu, 25 Nov 2004, Jean Coursol wrote:
The same is true in french under linux.
No, it is not the same.  Windows XP does this even in the Danish locale, 
and that is a problem (in Windows).

Your problem is simply that you should be using a French locale to use 
French characters.  You should not expect French characters to be 
recognised in a non-French locale, and if they were, that was a bug in R 
1.9.1.

From ?Sys.setlocale
 The locale describes aspects of the internationalization of a
 program. Initially most aspects of the locale of R are set to
 'C' (which is the default for the C language and reflects
 North-American usage). R does set 'LC_CTYPE' and 'LC_COLLATE',
 which allow the use of a different character set (typically ISO
 Latin 1) and alphabetic comparisons in that character set
 (including the use of 'sort') 
Something changed
from 1.9.1 to 2.0.0.
Yes, that has already be explained in this thread, so please read earlier 
replies.

To summarize: a bug has been corrected so R now works as it has always 
been documented to do, print()ing only the printable characters of the 
current locale.  Unfortunately for German and Scandinavian locales (at 
least), Windows XP does not correctly identify some of the characters in 
their locales as used in the locale.  As from 2.0.1 patched, we no longer 
believe Windows, but we do still believe other OSes.


First, it is necessary to have .inputrc (in $HOME)
(or $INPUTRC defined) to enter and display 8-bits
characters under bash and R.
Enter from the console, yes, but not e.g. from a file.
#.inputrc (for readline library)
set input-meta on
set output-meta on
set convert-meta off
Then
Under R2.0.1, I have:
In what locale?  It matters!
élément - é   # error for object name
Error: syntax error
element - é
element
[1] \351 # different from R1.9.1 (=é)
Sys.setlocale('LC_ALL','fr_FR')
The setting you need is LC_CTYPE: see the help page.
[1] fr_FR
élément - é   # OK for object name
élément
[1] é# OK for display
--
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__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] eval in correct frame?

2004-11-25 Thread Christian Hoffmann
I am trying, without success, to find out how to formulate correctly the 
parameters of eval.

My code snippet looks like:
proutside - function(txt) {
  cat(\n,txt,\n);
  print(eval(parse(text = txt)))
}
vari - function(Ob) {
  prininside - function(txt) {
cat(\n,txt,\n);
print(eval(parse(text = txt)))
  }
  prininside('inside'; 2*Ob)
  proutside('outside'; 2*Ob)
}
Obs - matrix(rnorm(9),nrow=3,ncol=3)
 vari(Obs)
 'inside'; 2*Ob
  [,1] [,2] [,3]
[1,] -1.566331 -1.98257 0.127522
[2,]  3.161932 -4.88416 2.355412
[3,] -0.763759  2.33552 2.165868
 'outside'; 2*Ob
Error in eval(expr, envir, enclos) : Object Ob not found

My aim is to be able to use a function of type proutside as deep 
inside a function within a function... as I wish. I suppose, that the 
call of eval within proutside should have envir = parent.frame(), 
enclos = , but I cannot figure that out correctly.

Thank for any help.
Christian
--
Dr.sc.math.Christian W. Hoffmann, 
http://www.wsl.ch/staff/christian.hoffmann
Mathematics + Statistical Computing   e-mail: [EMAIL PROTECTED]
Swiss Federal Research Institute WSL  Tel: ++41-44-73922-   -77  (office)
CH-8903 Birmensdorf, Switzerland -11(exchange), -15  (fax)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] eval in correct frame?

2004-11-25 Thread Peter Dalgaard
Christian Hoffmann [EMAIL PROTECTED] writes:

 I am trying, without success, to find out how to formulate correctly
 the parameters of eval.
 
 My code snippet looks like:
 
 proutside - function(txt) {
cat(\n,txt,\n);
print(eval(parse(text = txt)))
 }
 
 vari - function(Ob) {
prininside - function(txt) {
  cat(\n,txt,\n);
  print(eval(parse(text = txt)))
}
prininside('inside'; 2*Ob)
proutside('outside'; 2*Ob)
 }
 Obs - matrix(rnorm(9),nrow=3,ncol=3)
   vari(Obs)
 
   'inside'; 2*Ob
[,1] [,2] [,3]
 [1,] -1.566331 -1.98257 0.127522
 [2,]  3.161932 -4.88416 2.355412
 [3,] -0.763759  2.33552 2.165868
 
   'outside'; 2*Ob
 Error in eval(expr, envir, enclos) : Object Ob not found
  
 
 My aim is to be able to use a function of type proutside as deep
 inside a function within a function... as I wish. I suppose, that the
 call of eval within proutside should have envir = parent.frame(),
 enclos = , but I cannot figure that out correctly.

I think you are looking for eval.parent() (in both cases; try using
prinside on something called txt)

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Running R from CD?

2004-11-25 Thread Prof Brian Ripley
On Mon, 22 Nov 2004, Prof Brian Ripley wrote:
[...]
BTW, I believe running R 2.0.x from a CD will be a lot slower than 1.9.1
because of lazy loading and frequent file accesses: that's a theoretical 
issue we intend to address for 2.1.0, but not one anyone has yet commented 
that it is a problem.
I collected some data (under Windows XP).
On a modern desktop, running R from a CD-R or from a USB 2.0 thumbdrive 
was perfectably acceptable, with startup times of about 5 secs and little 
delay when running.

On a 2.5year old laptop with a USB 1.1 port (but the same thumbdrive) it 
took about 15secs to start and with frequent delays the first time an 
object was used -- I would not find that tolerable.  The laptop's CD drive 
was slower than the desktop and there were delays when it powered down, 
but it was acceptable.

This was less performance penalty than I was expecting, and less than I 
have seen on a high-latency network file system. So it looks as if all we 
can do is trade a slower startup time (by caching files) for removing 
hiatuses when running.  (Caching the pkg.rdb and pkg.rdx files when a 
package is opened would probably only take up a little over 1Mb in a 
typical session.)

Writing to the thumbdrive took about 20mins, as R has so many small files
and the drive has a VFAT file system.
--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] substitute accents

2004-11-25 Thread Manuel Gutierrez
I have an openoffice spreadsheet with a column of
character strings.
Some of them contain accents.
I want to read it in R so I have saved it as a csv
file using Western Europe (ISO-8859-1) character set
(the default, I've tried other sets but it doesn't
help).
R reads it fine with 

CharMatrix-read.csv(test.csv,header=F,sep=,,as.is=TRUE);
Say I wan't to replace the 'o' with accent in the
first cell.
I've tried:
gsub('ó','o', CharMatrix[1,1])
But, It doesn't make any substitution

Trying to find a solution I input the character string
in R and do the substitution:
CharMatrix[1,1]-hóla
gsub('ó','o', CharMatrix[1,1])
And it works. I think the difference is that when I
now print the content of CharMatrix I get a \201
before the ó while I didn't get it with the openoffice
imported csv file.
I'm sure it is a problem with my understanding of how
accents can be specified. Can someone give me any
solutions / references?
Thanks,
M

 _
platform i686-pc-linux-gnu
arch i686 
os   linux-gnu
system   i686, linux-gnu  
status
major2
minor0.0  
year 2004 
month10   
day  04   
language R   





__
Renovamos el Correo Yahoo!: ¡100 MB GRATIS!
Nuevos servicios, más seguridad

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] help with error message

2004-11-25 Thread Michael Griffiths
Before I receive a barrage of 'try looking in the help file' messages, I
have and to no avail. For a new user of R I would like to point out that
in order to be able to use the help files/manuals effectively one must
know the correct question and that only comes with using R!

Could someone please direct me to why I keep getting the following
error message

Error: subscript out of bounds

when the following code is run

z.score-function (group)   {
for (t in levels(group$Country)){   # this will give
t countries
y-subset(group,factor(Country)==t) #particular
analyte over all countries equal to y

#calculate overall huber mean and sigma for a
particular analyte over all countries
ov.mu-hubers(group$X)$mu
ov.sigma-hubers(group$X)$s

#define arrays
#p.mu-array()
#p.sigma-array()
#z.value-array()

#calculate huber mean and sigma for given
analyte (defined by group) by selected country (y)
p.mu-hubers(y$X)$mu
#p.sigma-hubers(y$X)$s

#calculate z score for particular
analyte:country combination 
#z.value-as.vector((p.mu[t]-ov.mu)/ov.sigma)
}
#data-list(mean=ov.mu,sd=ov.sigma)
return(p.mu)
}



# group entered as group=subset(sub2, factor(Analyte)==Cholesterol)
for example
#
#
#
#
#


Please ignore the commented out lines, these were put in for my own
use. The code gave the same error message with them removed.

Thankyou for your help

Mike Griffiths


Michael Griffiths, Ph.D.
Chemometrician
Training, Quality and Statistics Group
LGC Limited
Queens Road
Teddington
Middlesex, TW11 0LY, UK
Tel: +44 (0)20 8943 7352
Fax: +44 (0)20 8943 2767
e-mail: [EMAIL PROTECTED]
***
This email and any attachments are confidential. Any use, co...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] substitute accents

2004-11-25 Thread Prof Brian Ripley
Can you please tell us what locale you are working in?
This looks as if the problem might be the use of a UTF-8 locale, which R 
does not currently support and which some Linux distros have made their 
default.  However, R does issue a warning -- so did you get one?

On Thu, 25 Nov 2004, Manuel Gutierrez wrote:
I have an openoffice spreadsheet with a column of
character strings.
Some of them contain accents.
I want to read it in R so I have saved it as a csv
file using Western Europe (ISO-8859-1) character set
(the default, I've tried other sets but it doesn't
help).
R reads it fine with
CharMatrix-read.csv(test.csv,header=F,sep=,,as.is=TRUE);
Say I wan't to replace the 'o' with accent in the
first cell.
I've tried:
gsub('ó','o', CharMatrix[1,1])
But, It doesn't make any substitution
Trying to find a solution I input the character string
in R and do the substitution:
CharMatrix[1,1]-hóla
gsub('ó','o', CharMatrix[1,1])
And it works. I think the difference is that when I
now print the content of CharMatrix I get a \201
before the ó while I didn't get it with the openoffice
imported csv file.
I'm sure it is a problem with my understanding of how
accents can be specified. Can someone give me any
solutions / references?
Thanks,
M
_
platform i686-pc-linux-gnu
arch i686
os   linux-gnu
system   i686, linux-gnu
status
major2
minor0.0
year 2004
month10
day  04
language R


__
Renovamos el Correo Yahoo!: ¡100 MB GRATIS!
Nuevos servicios, más seguridad
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--
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__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

RE: [R] help with error message - problem solved

2004-11-25 Thread Michael Griffiths
Apologies to the listing, the problem was with the data set and not the
code

Thanks


Michael Griffiths, Ph.D.
Chemometrician
Training, Quality and Statistics Group
LGC Limited
Queens Road
Teddington
Middlesex, TW11 0LY, UK
Tel: +44 (0)20 8943 7352
Fax: +44 (0)20 8943 2767
e-mail: [EMAIL PROTECTED]

 Michael Griffiths [EMAIL PROTECTED] 25/11/2004
11:20:56 
Before I receive a barrage of 'try looking in the help file' messages,
I
have and to no avail. For a new user of R I would like to point out
that
in order to be able to use the help files/manuals effectively one must
know the correct question and that only comes with using R!

Could someone please direct me to why I keep getting the following
error message

Error: subscript out of bounds

when the following code is run

z.score-function (group)   {
for (t in levels(group$Country)){   # this will
give
t countries
y-subset(group,factor(Country)==t) #particular
analyte over all countries equal to y

#calculate overall huber mean and sigma for a
particular analyte over all countries
ov.mu-hubers(group$X)$mu
ov.sigma-hubers(group$X)$s

#define arrays
#p.mu-array()
#p.sigma-array()
#z.value-array()

#calculate huber mean and sigma for given
analyte (defined by group) by selected country (y)
p.mu-hubers(y$X)$mu
#p.sigma-hubers(y$X)$s

#calculate z score for particular
analyte:country combination 
#z.value-as.vector((p.mu[t]-ov.mu)/ov.sigma)
}
#data-list(mean=ov.mu,sd=ov.sigma)
return(p.mu)
}



# group entered as group=subset(sub2, factor(Analyte)==Cholesterol)
for example
#
#
#
#
#


Please ignore the commented out lines, these were put in for my own
use. The code gave the same error message with them removed.

Thankyou for your help

Mike Griffiths


Michael Griffiths, Ph.D.
Chemometrician
Training, Quality and Statistics Group
LGC Limited
Queens Road
Teddington
Middlesex, TW11 0LY, UK
Tel: +44 (0)20 8943 7352
Fax: +44 (0)20 8943 2767
e-mail: [EMAIL PROTECTED] 
***
This email and any attachments are confidential. Any use,\ c...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Error using glm with poisson family and identity link

2004-11-25 Thread Federico Gherardini
Hi all
I'm trying to use the function glm from the MASS package to do the 
following fit.

fit - glm(FP ~ rand, data = tab, family = poisson(link = identity), 
subset = rand = 1)
(FP is = 0)

but I get the following error
Error: no valid set of coefficients has been found:please supply 
starting values
In addition: Warning message:
NaNs produced in: log(x)

in contrast if I fit a model without intercept
fit - glm(FP ~ rand - 1, data = tab, family = poisson(link = 
identity), subset = rand = 1)

everything goes fine.
Now my guess is that the points naturally have a negative intercept so 
the error is produced because I'm using the poisson distribution for the 
y and negative values are of course not admitted. Am I right?
Also if this is the cause, shouldn't the function always try to do the 
best fit given the parameters? I mean shouldn't it fit a model with 
intercept 0 anyway and report it as a bad fit?

Thanks
Federico
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] R vs SPSS

2004-11-25 Thread Vito Ricci
Dear all,

in last weeks you discussed about R vs SAS. 
I want to ask your opinion about a comparison between
R and SPSS. I don't know this software, but some weeks
ago I went to a presentation of this product. I found
it really user-friendly with GUI (even if I'd prefer
command line) and very usefull and simple to use in
creation and managing tables, OLAP tecniques, pivot
table.
What you think about?
Cordially
Vito

=
Diventare costruttori di soluzioni
Became solutions' constructors

The business of the statistician is to catalyze 
the scientific learning process.  
George E. P. Box


Visitate il portale http://www.modugno.it/
e in particolare la sezione su Palese  http://www.modugno.it/archivio/palese/

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] substitute accents

2004-11-25 Thread Manuel Gutierrez
$ locale
LANG=en_GB
LC_CTYPE=en_GB
LC_NUMERIC=en_GB
LC_TIME=en_GB
LC_COLLATE=en_GB
LC_MONETARY=en_GB
LC_MESSAGES=en_GB
LC_PAPER=en_GB
LC_NAME=en_GB
LC_ADDRESS=en_GB
LC_TELEPHONE=en_GB
LC_MEASUREMENT=en_GB
LC_IDENTIFICATION=en_GB
LC_ALL=

  
$ locale charmap
ISO-8859-1

I have tried changing the locales with no difference.
Is this fine?
And, no, I didn't get any warning message.
My sistem is a debian sid under kde 3.3.
Thanks,
M

 --- Prof Brian Ripley [EMAIL PROTECTED]
escribió: 
 Can you please tell us what locale you are working
 in?
 
 This looks as if the problem might be the use of a
 UTF-8 locale, which R 
 does not currently support and which some Linux
 distros have made their 
 default.  However, R does issue a warning -- so did
 you get one?
 
 On Thu, 25 Nov 2004, Manuel Gutierrez wrote:
 
  I have an openoffice spreadsheet with a column of
  character strings.
  Some of them contain accents.
  I want to read it in R so I have saved it as a csv
  file using Western Europe (ISO-8859-1) character
 set
  (the default, I've tried other sets but it doesn't
  help).
  R reads it fine with
 
 

CharMatrix-read.csv(test.csv,header=F,sep=,,as.is=TRUE);
  Say I wan't to replace the 'o' with accent in the
  first cell.
  I've tried:
  gsub('ó','o', CharMatrix[1,1])
  But, It doesn't make any substitution
  Trying to find a solution I input the character
 string
  in R and do the substitution:
  CharMatrix[1,1]-hóla
  gsub('ó','o', CharMatrix[1,1])
  And it works. I think the difference is that when
 I
  now print the content of CharMatrix I get a \201
  before the ó while I didn't get it with the
 openoffice
  imported csv file.
  I'm sure it is a problem with my understanding of
 how
  accents can be specified. Can someone give me any
  solutions / references?
  Thanks,
  M
 
  _
  platform i686-pc-linux-gnu
  arch i686
  os   linux-gnu
  system   i686, linux-gnu
  status
  major2
  minor0.0
  year 2004
  month10
  day  04
  language R
 
 
 
 
 
  __
  Renovamos el Correo Yahoo!: ¡100 MB GRATIS!
  Nuevos servicios, más seguridad
 
  __
  [EMAIL PROTECTED] mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 
 
 -- 
 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 



__
Renovamos el Correo Yahoo!: ¡100 MB GRATIS!
Nuevos servicios, más seguridad

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] MASS problem -- glmmPQL and anova

2004-11-25 Thread Andrew R. Criswell
Hello:

I am really stuck on this problem. Why do I get an error message with
anova() when I compare these two equations?

Hope someone can help.

ANDREW


 fm1 - glmmPQL(choice ~ day + stereotypy,
+random = ~ 1 | bear, data = learning, family = binomial)

 fm2 - glmmPQL(choice ~ day + envir + stereotypy,
+random = ~ 1 | bear, data = learning, family = binomial)

 anova(fm1, fm2)

Error in anova.lme(fm1, fm2) : Objects must inherit from classes gls,
gnls lm,lmList, lme,nlme,nlsList, or nls

 anova(fm1)

numDF denDF   F-value p-value
(Intercept) 1  2032   7.95709  0.0048
day 1  2032 213.98391  .0001
stereotypy  1  2032   0.42810  0.5130

 anova(fm2)

numDF denDF   F-value p-value
(Intercept) 1  2031   5.70343  0.0170
day 1  2031 213.21673  .0001
envir   1  2031  12.50388  0.0004
stereotypy  1  2031   0.27256  0.6017

-- 
Andrew R. Criswell, Ph.D.
Graduate School, Bangkok University

mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R vs SPSS

2004-11-25 Thread Laurent Valdes
Hi,
Le 25 nov. 04, à 13:15, Vito Ricci a écrit :
command line) and very usefull and simple to use in
I do not know R so much, nor SPSS.
Then I appreciate SPSS, because tools are very practical to use.
Every transformation, model analysis are easily made.
In the other hand, let me say it doesn't run on Mac OS X 10.3 (only on 
Mac OS X 10.2), then the software editor didn't manage to update its 
product. R's communauty does.

R is really made to make big computations on big servers, that's not 
SPSS cup of tea.

Laurent
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] R multithreading skills

2004-11-25 Thread Laurent Valdes
Hi folks,
is it possible to read more things about R behavior in multiprocessor / 
multihost environment ?
Is there any distributed computation project associated to it ?

Laurent
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Turning strings into expressions

2004-11-25 Thread Alexander Sokol
Hello,

I am running R 1.9.1 om Windows 2000 SP4. My problem is as follows:

Say I have a dataframe my.frame with column names A and B. I have a string,

my.string
[1] A==1  B==2

And I would like to retrieve the subset corresponding to my.string, that is, 
from my.frame and my.string I would like to get the result of

subset(my.frame,A==1  B==2)

So I need to find a way to convert

A==1  B==2

to

A==1  B==2

I at first hoped that get() could do the job, but this does not work. Does 
anyone know how to do this?

Thanks,
 Alexander

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Turning strings into expressions

2004-11-25 Thread Duncan Murdoch
On Thu, 25 Nov 2004 14:09:14 +0100, Alexander Sokol
[EMAIL PROTECTED] wrote :

Hello,

I am running R 1.9.1 om Windows 2000 SP4. My problem is as follows:

Say I have a dataframe my.frame with column names A and B. I have a string,

my.string
[1] A==1  B==2

And I would like to retrieve the subset corresponding to my.string, that is, 
from my.frame and my.string I would like to get the result of

subset(my.frame,A==1  B==2)

So I need to find a way to convert

A==1  B==2

to

A==1  B==2

I at first hoped that get() could do the job, but this does not work. Does 
anyone know how to do this?

parse() does the conversion to an expression, but doesn't evaluate it.
So you probably want 

  eval(parse(text = A == 1  B == 2))

but you may want to set the envir argument to eval, to tell R where to
go looking for A and B.

Duncan Murdoch

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] (no subject)

2004-11-25 Thread Angela Re
Good morning,
I'd like to know how to superimpose to a distribution of Pearson 
coefficient the Student cumulative distribution function.
Thank you of helping me.
Angela

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Turning strings into expressions

2004-11-25 Thread Dimitris Rizopoulos
Hi Alexander,
you could try:
my.string - A==1  B==2
(my.frame - data.frame(A=sample(1:2, 20, TRUE), B=sample(1:2, 20, 
TRUE)))
subset(my.frame, eval(parse(text=my.string)))

I hope it helps.
Best,
Dimitris

Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
- Original Message - 
From: Alexander Sokol [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, November 25, 2004 2:09 PM
Subject: [R] Turning strings into expressions


Hello,
I am running R 1.9.1 om Windows 2000 SP4. My problem is as follows:
Say I have a dataframe my.frame with column names A and B. I have a 
string,

my.string
[1] A==1  B==2
And I would like to retrieve the subset corresponding to my.string, 
that is,
from my.frame and my.string I would like to get the result of

subset(my.frame,A==1  B==2)
So I need to find a way to convert
A==1  B==2
to
A==1  B==2
I at first hoped that get() could do the job, but this does not 
work. Does
anyone know how to do this?

Thanks,
Alexander
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] (no subject)

2004-11-25 Thread Angela Re
Good  morning,
I tried to apply the ks test to a Student distribution by ks.test(input, 
pt, ncp = 0, df = 58) or ks.test(input, pt, df = 58) without success 
where input contains my data and 58 is the fredoom degree number. Why?
Thank you, Angela

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Making legend() look like my plot()

2004-11-25 Thread Dan Bolser

Hello,

I am using code like the following to create as simple plot...



plot(x,y,type='b')
lines(lowess(x,y),lwd=3,lty=3,col=2)

I want to add a legend which shows lines looking exactly like those used
in my plot, i.e. a thin black line with gaps taken up by circles (the
default for type='b', and a thick dashed red line with no pch at all).

I have two problems, 

1) making the pch on the first like look like type = 'b' (gaps around pch)
2) surpressing a pch on for the second line


Any help with these two problems would be greatly appreciated.

Any archive of plots and code to browse which could help me visually find
what I want and then copy the code?


An online user contributable database of 'graphics in R' would be
smashing.


How come some smart people dont just let me do something like

legend(xpos,ypos,legend=add)

to add a legend to the current plot for all the relevant points and lines
which have been added so far?

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Re: how to remove time series trend in R?

2004-11-25 Thread Vito Ricci
Hi Terry,

If I understood your problem you would estimate trend
and seasonal (as sum of sin and cos) in a ts.

If t is time, Y is your ts, T=f(t) is trend function
of time (it could be linear, quadratic, etc. as better
is for your data), e=errors/residuals  

Your model to fit will'be:

Y(t)=T(t)+a*cos(2*pi*t/12)+b*sin(2*pi*t/12)+e(t) 

using lm() function to estimate a linear/polinomial
trend and sin/cos seasonal:

cos.t - cos(2*pi*t/12)
sin.t - sin(2*pi*t/12)
gfit-lm(y~t+cos.t+sin.t, data=yourdf)

see this example:

 t-seq(1:48)
 t
 [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16
17 18 19 20 21 22 23 24 25
[26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
42 43 44 45 46 47 48

y-10+5*t+0.5*cos(2*pi*t/12)+0.2*sin(2*pi*t/12)+rnorm(48)
 cos.t - cos(2*pi*t/12)
 sin.t - sin(2*pi*t/12)
 gfit-lm(y~t+cos.t+sin.t)
 summary(gfit)

Call:
lm(formula = y ~ t + cos.t + sin.t)

Residuals:
 Min   1Q   Median   3Q  Max 
-2.10222 -0.62184 -0.09387  0.50586  2.74299 

Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept) 10.304660.30009  34.339   2e-16 ***
t4.989870.01071 465.793   2e-16 ***
cos.t0.302070.20604   1.4660.150
sin.t0.086990.20961   0.4150.680
---
Signif. codes:  0 `***' 0.001 `**' 0.01 `*' 0.05 `.'
0.1 ` ' 1 

Residual standard error: 1.008 on 44 degrees of
freedom
Multiple R-Squared: 0.9998, Adjusted R-squared:
0.9998 
F-statistic: 7.525e+04 on 3 and 44 DF,  p-value: 
2.2e-16 

I hope I helped you.

Best
Vito
 



=
Diventare costruttori di soluzioni
Became solutions' constructors

The business of the statistician is to catalyze 
the scientific learning process.  
George E. P. Box


Visitate il portale http://www.modugno.it/
e in particolare la sezione su Palese  http://www.modugno.it/archivio/palese/

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] LDA with previous PCA for dimensionality reduction

2004-11-25 Thread Bjørn-Helge Mevik
Torsten Hothorn writes:

 as long as one does not use the information in the response (the class
 variable, in this case) I don't think that one ends up with an
 optimistically biased estimate of the error

I would be a little careful, though.  The left-out sample in the
LDA-cross-validation, will still have influenced the PCA used to build
the LDA on the rest of the samples.  The sample will have a tendency
to lie closer to the centre of the complete PCA than of a PCA on the
remaining samples.  Also, if the sample has a high leverage on the
PCA, the directions of the two PCAs can be quite different.  Thus, the
LDA is built on data that fits better to the left-out sample than if
the sample was a completely new sample.

I have no proofs or numerical studies showing that this gives
over-optimistic error rates, but I would not recommend placing the PCA
outside the cross-validation.  (The same for any resampling-based
validation.)

-- 
Bjørn-Helge Mevik

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R multiprocessor/multihost skills

2004-11-25 Thread Dirk Eddelbuettel
On Thu, Nov 25, 2004 at 02:11:12PM +0100, Laurent Valdes wrote:
 Hi folks,
 
 is it possible to read more things about R behavior in multiprocessor / 
 multihost environment ?
 Is there any distributed computation project associated to it ?

Sure. I'd start with the paper 'Simple Parallel Statistical Computing in R' by
Tony Rossini, Luke Tierney and Na Li:

   http://www.bepress.com/uwbiostat/paper193/

and the references therein.  The underlying software (SNOW, Rmpi, Rpvm, ...)
is readily available on CRAN, but you may have to do some work to get the
communications libraries needed (lam, mpi, pvm, ...) built.  

One way to get a head start on deployment is to grab a Quantian dvd image:

   http://dirk.eddelbuettel.com/quantian
   
which not only contains R alongside Snow, Rmpi, Rpvm for explicit parallelism
using message parsing, but also provides a ready-to-use openMosix clustering
environment where you can boot nodes 2, 3, ... right over the net off the
first machine booted from the dvd.

Hth, Dirk

PS I amended your subject line as you really asked about multiprocessor and
mulithost rather than multithreading (which is typically inside one cpu, and
which R doesn't do, see http://developer.r-project.org).

-- 
If your hair is standing up, then you are in extreme danger.
  -- http://www.usafa.af.mil/dfp/cockpit-phys/fp1ex3.htm

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] (no subject)

2004-11-25 Thread Uwe Ligges
Angela Re wrote:
Good  morning,
I tried to apply the ks test to a Student distribution by ks.test(input, 
pt, ncp = 0, df = 58) or ks.test(input, pt, df = 58) without success 
where input contains my data and 58 is the fredoom degree number. Why?
Thank you, Angela

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

Please do what the appended messages tells you to do:
read the posting guide and learn to use a sensible subject line!
The following works for me, so please also specify a reproducible 
example that shows what does not work

 input - rnorm(100)
 ks.test(input, pt, ncp = 0, df = 58)
Uwe Ligges
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Automatic file reading

2004-11-25 Thread Douglas Bates
Sean Davis wrote:
If you simply want read all files in a given directory, you can do 
something like:

fullpath = /home/andersm/tmp
filenames - dir(fullpath,pattern=*)
pair - sapply(filenames,function(x) 
{read.table(paste(fullpath,'/',x,sep=))})
Slightly off-topic but it is more portable to use the file.path function 
instead of paste when creating a file name.

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Re: (no subject)

2004-11-25 Thread Vito Ricci
Angela Re wrote:

 Good  morning,
 I tried to apply the ks test to a Student
distribution by ks.test(input, 
 pt, ncp = 0, df = 58) or ks.test(input, pt, df =
58) without success 
 where input contains my data and 58 is the fredoom
degree number. Why?
 Thank you, Angela

It runs also for me:

 input-rt(100,58)
 ks.test(input, pt, ncp = 0, df = 58)

One-sample Kolmogorov-Smirnov test

data:  input 
D = 0.0827, p-value = 0.5003
alternative hypothesis: two.sided 

Vito


=
Diventare costruttori di soluzioni
Became solutions' constructors

The business of the statistician is to catalyze 
the scientific learning process.  
George E. P. Box


Visitate il portale http://www.modugno.it/
e in particolare la sezione su Palese  http://www.modugno.it/archivio/palese/

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] scatterplot of 100000 points and pdf file format

2004-11-25 Thread Ted Harding
Hi Andy,

On 25-Nov-04 Liaw, Andy wrote:
 From: [EMAIL PROTECTED]
 [...]
  X-round(rnorm(1e6),3);Y-round(rnorm(1e6),3)
  system.time(unique(X))
 [1] 0.74 0.07 0.81 0.00 0.00
  system.time(unique(cbind(X,Y)))
 [1] 350.81   4.56 356.54   0.00   0.00
 
 Do you know if majority of that time is spent in unique() itself?
  If so, which method?  What I see is:
 
 X-round(rnorm(1e6),3);Y-round(rnorm(1e6),3)
 system.time(unique(X), gcFirst=TRUE)
 [1] 0.25 0.01 0.26   NA   NA
 system.time(unique(cbind(X,Y)), gcFirst=TRUE)
 [1] 101.80   0.34 104.61 NA NA
 system.time(dat - data.frame(x=X, y=Y), gcFirst=TRUE)
 [1] 10.17  0.00 10.24NANA
 system.time(unique(dat), gcFirst=TRUE)
 [1] 23.94  0.11 24.15NANA
 
 Andy

I want to look into this a bit more systematically (I have
an idea why 'unique' may be taking longer on the array from
'cbind' than on the dataframe), but I will be doing this on
a much faster machine than I immediately have to hand, so
will report results (if interesting) later.

Meanwhile, I'm not sure what you mean by which method?,
and I'm also wondering what gcFirst is about.

Thanks,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861  [NB: New number!]
Date: 25-Nov-04   Time: 14:30:39
-- XFMail --

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R vs SPSS

2004-11-25 Thread Frank E Harrell Jr
Vito Ricci wrote:
Dear all,
in last weeks you discussed about R vs SAS. 
I want to ask your opinion about a comparison between
R and SPSS. I don't know this software, but some weeks
ago I went to a presentation of this product. I found
it really user-friendly with GUI (even if I'd prefer
command line) and very usefull and simple to use in
creation and managing tables, OLAP tecniques, pivot
table.
What you think about?
Cordially
Vito

What worries me about SPSS is that it often results in poor statistical 
practice.  The defaults in dialog boxes are not very good in some cases, 
and like SAS, SPSS tends to lead users to make to many assumptions 
(linearity in regression being one of the key ones).
--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Searching for a string in RSQLite

2004-11-25 Thread Duncan Murdoch
I'd like to search for a particular string in an SQLite database using
RSQLite, but I'm running into problems constructing the query
properly, because of embedded quotes and parens in the string.

Is there a function that escapes these for me, or some other fixup
that would let me do the queries below?  In the real situation I don't
have control over what strings get searched for.

Example based on ?SQLite:

 library(RSQLite)
 m - dbDriver(SQLite)
 con - dbConnect(m, dbname = base.dbms)
 data(USArrests)
 dbWriteTable(con, USArrests, USArrests, overwrite = T)
[1] TRUE
 state - Wyoming

# this works fine:

 dbGetQuery(con, paste(SELECT * from USArrests where 
 row_names=',state,',sep=))
  row_names Murder Assault UrbanPop Rape
1   Wyoming6.8 161   60 15.6

# Buf if the search string contains characters that SQL interprets, I
# get an error

 state - messy:  ' (
 dbGetQuery(con, paste(SELECT * from USArrests where 
 row_names=',state,',sep=))
Error in sqliteExecStatement(con, statement) : 
RS-DBI driver: (error in statement: near (: syntax error)

Duncan Murdoch

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] logistic regression and 3PL model

2004-11-25 Thread John Fox
Dear Mike,

Pinheiro and Bates discuss a three-parameter logistic growth model in their
Mixed Effects Models in S and S-PLUS, but as far as I know there's no direct
way to fit the 3PL IRT model in R. It should be possible to fit such a model
using one of the general optimisers in R, such as nlm() or optimise(), and I
think that it would be a nice project to produce an IRT package for R. 

Regards,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Michael Lau
 Sent: Wednesday, November 24, 2004 10:26 PM
 To: [EMAIL PROTECTED]
 Subject: [R] logistic regression and 3PL model
 
 Hello colleagues,
 
  
 
 I am a novice with R and am stuck with an analysis I am 
 trying to conduct.
 Any suggestions or feedback would be very much appreciated.
 
  
 
 I am analyzing a data set of psi (ESP) ganzfeld trials.  The 
 response variable is binary (correct/incorrect), with a 25% 
 base rate.  I've looked around the documentation and other 
 online resources and cannot find how I can correct for that 
 base rate when I conduct a logistic regression.  I understand 
 that the correction would be equivalent to the three 
 parameter logistic model (3PL) in IRT but am unsure how to 
 best fit it from a logistic regression in R.
 
  
 
 Thanks much,
 
  
 
 Mike Lau
 
  
 
 __
 Michael Y. Lau, M.A. 
 118 Haggar Hall
 Department of Psychology
 University of Notre Dame
 Notre Dame, IN 46556 
  
   
 
  
 
 
   [[alternative HTML version deleted]]
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Error using glm with poisson family and identity link

2004-11-25 Thread Prof Brian Ripley
On Thu, 25 Nov 2004, Federico Gherardini wrote:
Hi all
I'm trying to use the function glm from the MASS package to do the following
It's in the stats package.
fit.
fit - glm(FP ~ rand, data = tab, family = poisson(link = identity), subset 
= rand = 1)
(FP is = 0)

but I get the following error
Error: no valid set of coefficients has been found:please supply starting 
values
In addition: Warning message:
NaNs produced in: log(x)
And did you follow the advice in the error message?
in contrast if I fit a model without intercept
fit - glm(FP ~ rand - 1, data = tab, family = poisson(link = identity), 
subset = rand = 1)

everything goes fine.
Now my guess is that the points naturally have a negative intercept so the 
error is produced because I'm using the poisson distribution for the y and 
negative values are of course not admitted. Am I right?
We don't have your data, but it is plausible.
Also if this is the cause, shouldn't the function always try to do the best 
fit given the parameters? I mean shouldn't it fit a model with intercept 0 
anyway and report it as a bad fit?
Well, I believe functions should do what they say on the box (and the help 
page), and not what some user hopes they might do by mind-reading.

You do have a suitable set of starting values from the second fit, so why 
not just follow the rather explicit advice?

--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] R vs SPSS

2004-11-25 Thread Nassar
Vito,


I use SPSS mainly for descriptive analysis (tables, graphs, factor
analysis..) and for data manipulation (you can see your data and
verify/control each step of your manipulation), mainly exploring the
analysis I need to develop in R (advanced clustering modelling,
simulations..).
SPSS huge worry : ITS VALUE.. Just actualize the annual fees ..
If you have a lot of data manipulation and table/easy graphs production, you
can consider it..
For statistical issues, spend the money into R trainings and R contribution


Best regards
Naji
-Message d'origine-
De : [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] la part de Frank E Harrell
Jr
Envoyé : jeudi 25 novembre 2004 15:57
À : Vito Ricci
Cc : [EMAIL PROTECTED]
Objet : Re: [R] R vs SPSS


Vito Ricci wrote:
 Dear all,

 in last weeks you discussed about R vs SAS.
 I want to ask your opinion about a comparison between
 R and SPSS. I don't know this software, but some weeks
 ago I went to a presentation of this product. I found
 it really user-friendly with GUI (even if I'd prefer
 command line) and very usefull and simple to use in
 creation and managing tables, OLAP tecniques, pivot
 table.
 What you think about?
 Cordially
 Vito


What worries me about SPSS is that it often results in poor statistical
practice.  The defaults in dialog boxes are not very good in some cases,
and like SAS, SPSS tends to lead users to make to many assumptions
(linearity in regression being one of the key ones).
--
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Problem with ODBC access to SQL database

2004-11-25 Thread Lindveld, Charles
I have the following problem in getting the sqlSave function from the
example code in the R package RODBC to work with MySQL as ODBC server:
 - a new database is created, but no data is written to it
 - the example code works just fine when I use MS Access as ODBC server.
 
--- offending code and output ---
 library(RODBC);
 channel - odbcConnect(opus);

 data(USArrests) # R  2.0.0 only

 sqlSave(channel, USArrests, rownames = state, addPK=TRUE)
Error in sqlColumns(channel, tablename) : USArrests : table not found on
channel 
Check case parameter in odbcConnect

 sqlSave(channel, USArrests, rownames = state, addPK=TRUE)
Error in sqlSave(channel, USArrests, rownames = state, addPK = TRUE) :

[RODBC] ERROR: Could not SQLExecDirect

 odbcGetErrMsg(channel)
character(0)
 
 sqlTables(channel)
  TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS
1  opus  usarrests  TABLE MySQL table
-
 
 
The next thing I did was to check from the MySQL commandline what the
status of the database was.
 
 
 MySQL commandline query
---
mysql use opus;
Database changed
mysql show tables;
++
| Tables_in_opus |
++
| usarrests  |
++
1 row in set (0.00 sec)
 
mysql describe usarrests;
+--+--+--+-+-+---+
| Field| Type | Null | Key | Default | Extra |
+--+--+--+-+-+---+
| state| varchar(255) |  | PRI | |   |
| Murder   | double   | YES  | | NULL|   |
| Assault  | int(11)  | YES  | | NULL|   |
| UrbanPop | int(11)  | YES  | | NULL|   |
| Rape | double   | YES  | | NULL|   |
+--+--+--+-+-+---+
5 rows in set (0.01 sec)
 
mysql select * from usarrests;
Empty set (0.00 sec)
 

-
 
 
So: the table is created, but not filled. As noted, the example code
works OK with MS access.
 
The software versions I use are: 
- OS: Windows XP SP2
- R: 2.0.1; installed as binary
- RODBC: latest version from CRAN
- MySQL: 4.0.21-nt
 
P.S. The problem has low priority for me bacause I can simply use
Microsoft Access as RODBC server, but in future I would like to revert
back to MySQL. 
 
 

[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] logistic regression and 3PL model

2004-11-25 Thread Prof Brian Ripley
On Thu, 25 Nov 2004, John Fox wrote:
Pinheiro and Bates discuss a three-parameter logistic growth model in their
Mixed Effects Models in S and S-PLUS, but as far as I know there's no direct
way to fit the 3PL IRT model in R. It should be possible to fit such a model
using one of the general optimisers in R, such as nlm() or optimise(), and I
optim(), not optimize() as there are at least two free parameters, I 
believe.

think that it would be a nice project to produce an IRT package for R.
As I understand it this is a logistic regression and not a logistic growth 
curve, the latter being fitted by least squares.

For a known baseline (which is thus a 2-free PL model but what seems asked 
for here), a glm family can be constructed to allow glm() to do the 
fitting.  This is model described at

http://work.psych.uiuc.edu/irt/modeling_dich1.asp
with c known to be 0.25.  It would certainly be worth having an 
implementation of that in R, with c=0.5 being the most common case.

It is quite straightforward to fit such models by direct optimization of 
the likelihood, and MASS4 p. 445 gives you a template for logistic 
regression that could easily be modified.


-Original Message-
To: [EMAIL PROTECTED]
Subject: [R] logistic regression and 3PL model
Hello colleagues,
I am a novice with R and am stuck with an analysis I am
trying to conduct.
Any suggestions or feedback would be very much appreciated.
I am analyzing a data set of psi (ESP) ganzfeld trials.  The
response variable is binary (correct/incorrect), with a 25%
base rate.  I've looked around the documentation and other
online resources and cannot find how I can correct for that
base rate when I conduct a logistic regression.  I understand
that the correction would be equivalent to the three
parameter logistic model (3PL) in IRT but am unsure how to
best fit it from a logistic regression in R.
--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R vs SPSS

2004-11-25 Thread Ronán Conroy
Frank E Harrell Jr wrote:
What worries me about SPSS is that it often results in poor statistical
practice.  The defaults in dialog boxes are not very good in some cases,
and like SAS, SPSS tends to lead users to make to many assumptions
(linearity in regression being one of the key ones).
--
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University
__
My worry about SPSS is that it encourages people to do analysis and 
dataset manipulation 'on-the-fly', without leaving behind an audit trail 
that can be used to reconstruct the dataset and results. Certainly, SPSS 
has a 'paste' button which allows you to save a 'syntax' file of 
commands, but most users appear to ignore it. And post-hoc editing of 
graphs and tables cannot be saved thus (unless I'm missing out something 
here).

--
Ronan M Conroy ([EMAIL PROTECTED]) 
Senior Lecturer in Biostatistics 
Royal College of Surgeons 
Dublin 2, Ireland 
+353 1 402 2431 (fax 2764) 
 
Just say no to drug reps 
http://www.nofreelunch.org/

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Searching for a string in RSQLite

2004-11-25 Thread David James
Single quotes in a string are escaped by putting two single quotes in
a row.  E.g., 

   state - mess: '' (

Regards,

--
David

Duncan Murdoch wrote:
 I'd like to search for a particular string in an SQLite database using
 RSQLite, but I'm running into problems constructing the query
 properly, because of embedded quotes and parens in the string.
 
 Is there a function that escapes these for me, or some other fixup
 that would let me do the queries below?  In the real situation I don't
 have control over what strings get searched for.
 
 Example based on ?SQLite:
 
  library(RSQLite)
  m - dbDriver(SQLite)
  con - dbConnect(m, dbname = base.dbms)
  data(USArrests)
  dbWriteTable(con, USArrests, USArrests, overwrite = T)
 [1] TRUE
  state - Wyoming
 
 # this works fine:
 
  dbGetQuery(con, paste(SELECT * from USArrests where 
  row_names=',state,',sep=))
   row_names Murder Assault UrbanPop Rape
 1   Wyoming6.8 161   60 15.6
 
 # Buf if the search string contains characters that SQL interprets, I
 # get an error
 
  state - messy:  ' (
  dbGetQuery(con, paste(SELECT * from USArrests where 
  row_names=',state,',sep=))
 Error in sqliteExecStatement(con, statement) : 
 RS-DBI driver: (error in statement: near (: syntax error)
 
 Duncan Murdoch
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] urgent

2004-11-25 Thread Jennifer Wilson
Hello,

My name is Mrs. Jennifer Wilson i am a dying woman who have decided to donate 
what i have to you/ church.I am 59 years old and i was diagnosed for cancer for 
about 2 years ago,immediately after the death of my husband, who has left me 
everything he worked for.

I have been touched by God to donate from what i have inherited from my late 
husband to the you for the god work of God,rather than allow my relatives to 
use my husband hard earned funds ungodly.Please pray,that the good Lord forgive 
me my sins.I have asked God to forgive me and i beleive he has because He is a 
merciful God. I will be going in for an operation in less than one hour.

I decided to WILL/donate the sum of $1,500,000 (One million five hundred 
thousand dollars) to you for the good work of the lord, and also to help the 
motherless and less privilege and also for the assistance of the widows 
according to (JAMES 1:27).

At the moment i cannot take any telephone calls right now due to the fact that 
my relatives are around me and my health status.I have adjusted my WILL and my 
lawyer is aware i have changed my will you and he will arrange the transfer of 
the funds from my account to you.

I wish you all the best and may the good Lord bless you abundantly, and please 
use the funds well and always extend the good work to others. Contact my lawyer 
with this specified email   [EMAIL PROTECTED]   and tell him that i have WILLED 
($1,500,000.00) to you and i have also notified him that i am WILLING that 
amount to you for a specific and good work.I know i dont know you but i have 
been directed to do this.Thanks and God bless.

NB: I will appreciate your utmost confidentiality in this matter until the task 
is accomplished as I don't want anything that will Jeopardize my last wish. And 
Also I will be contacting with you by email as I don't want my relation or 
anybody to know because they are always around me. 

Regards,
Jennifer Wilson

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] logistic regression and 3PL model

2004-11-25 Thread Dimitris Rizopoulos
I don't know if I am missing something, but isn't there also a latent 
variable (trait) that must be integrated out using maybe Gauss-Hermite 
which might complicate a bit the calculations? So is this possible 
with `glm()'?

Best,
Dimitris

Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
- Original Message - 
From: Prof Brian Ripley [EMAIL PROTECTED]
To: John Fox [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Thursday, November 25, 2004 5:13 PM
Subject: RE: [R] logistic regression and 3PL model


On Thu, 25 Nov 2004, John Fox wrote:
Pinheiro and Bates discuss a three-parameter logistic growth model 
in their
Mixed Effects Models in S and S-PLUS, but as far as I know there's 
no direct
way to fit the 3PL IRT model in R. It should be possible to fit 
such a model
using one of the general optimisers in R, such as nlm() or 
optimise(), and I
optim(), not optimize() as there are at least two free parameters, I 
believe.

think that it would be a nice project to produce an IRT package for 
R.
As I understand it this is a logistic regression and not a logistic 
growth curve, the latter being fitted by least squares.

For a known baseline (which is thus a 2-free PL model but what seems 
asked for here), a glm family can be constructed to allow glm() to 
do the fitting.  This is model described at

http://work.psych.uiuc.edu/irt/modeling_dich1.asp
with c known to be 0.25.  It would certainly be worth having an 
implementation of that in R, with c=0.5 being the most common case.

It is quite straightforward to fit such models by direct 
optimization of the likelihood, and MASS4 p. 445 gives you a 
template for logistic regression that could easily be modified.


-Original Message-
To: [EMAIL PROTECTED]
Subject: [R] logistic regression and 3PL model
Hello colleagues,
I am a novice with R and am stuck with an analysis I am
trying to conduct.
Any suggestions or feedback would be very much appreciated.
I am analyzing a data set of psi (ESP) ganzfeld trials.  The
response variable is binary (correct/incorrect), with a 25%
base rate.  I've looked around the documentation and other
online resources and cannot find how I can correct for that
base rate when I conduct a logistic regression.  I understand
that the correction would be equivalent to the three
parameter logistic model (3PL) in IRT but am unsure how to
best fit it from a logistic regression in R.
--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Error using glm with poisson family and identity link

2004-11-25 Thread Spencer Graves
Dear Federico: 

 Why do you use the identity link?  That can produce situations 
with an average of (-2) Poisson defects per unit, for example.  That's 
physical nonsense.  Also, it seems essentially to be generating your 
error message. 

 Also, have you considered the following: 

fit - glm(FP ~ offset(log(rand)), data = tab, family = poisson, subset 
= rand = 1)

 I haven't tried this, but it looks like this model is virtually 
equivalent to the one you wrote: 

 FP ~ rand-1 with link = identity says estimate 'b' in 
PoissonMean = b*rand. 

 FP ~ offset(log(rand)) with link = log (the default) says 
estimate 'a' in log(PoissonMean)-log(rand) = a. 

 If I haven't made an error, then log(b) = a. 

 In more general situations, if you really need the identity 
link, have you considered searching for good starting values, as Prof. 
Ripley suggested?  You could build up to your final model by estimating 
simpler models and obtaining trial fits using the default log link?  
With those results and a little thought, you should be able to obtain 
reasonable starting values. 

 hope this helps. 
 spencer graves

Prof Brian Ripley wrote:
On Thu, 25 Nov 2004, Federico Gherardini wrote:
Hi all
I'm trying to use the function glm from the MASS package to do the 
following

It's in the stats package.
fit.
fit - glm(FP ~ rand, data = tab, family = poisson(link = 
identity), subset = rand = 1)
(FP is = 0)

but I get the following error
Error: no valid set of coefficients has been found:please supply 
starting values
In addition: Warning message:
NaNs produced in: log(x)

And did you follow the advice in the error message?
in contrast if I fit a model without intercept
fit - glm(FP ~ rand - 1, data = tab, family = poisson(link = 
identity), subset = rand = 1)

everything goes fine.
Now my guess is that the points naturally have a negative intercept 
so the error is produced because I'm using the poisson distribution 
for the y and negative values are of course not admitted. Am I right?

We don't have your data, but it is plausible.
Also if this is the cause, shouldn't the function always try to do 
the best fit given the parameters? I mean shouldn't it fit a model 
with intercept 0 anyway and report it as a bad fit?

Well, I believe functions should do what they say on the box (and the 
help page), and not what some user hopes they might do by mind-reading.

You do have a suitable set of starting values from the second fit, so 
why not just follow the rather explicit advice?

--
Spencer Graves, PhD, Senior Development Engineer
O:  (408)938-4420;  mobile:  (408)655-4567
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Avoiding for-loops

2004-11-25 Thread John
Hello R-users,

I have a symmetric matrix of numerical values and I
want to obtain those values in the upper or lower
triangle of the matrix in a vector. I tried to do the
job by using two for-loops but it doens't seem to be a
clever way, and I'd like to know a more efficient code
for a large matrix of thousands of rows and columns.
Below is my code for your reference. 

Thanks a lot.

John



# mtx.sym is a symmetric matrix

 my.ftn - function(size_mtx, mtx) {
+ my.vector - c()
+ for ( i in 1:size_mtx ) {
+ cat(.)
+ for ( j in 1:size_mtx ) {
+ if ( upper.tri(mtx)[i,j] ) {
+ my.vector - c(my.vector, mtx[i,j])
+ }}}
+ cat(\n)
+ }

# if I have a matrix, mtx.sym, of 100x100
 my.ftn(100, mtx.sym)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Searching for a string in RSQLite

2004-11-25 Thread Dr Mike Waters
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Duncan Murdoch
 Sent: 25 November 2004 15:38
 To: [EMAIL PROTECTED]
 Subject: [R] Searching for a string in RSQLite
 
 
 I'd like to search for a particular string in an SQLite 
 database using RSQLite, but I'm running into problems 
 constructing the query properly, because of embedded quotes 
 and parens in the string.
 
 Is there a function that escapes these for me, or some other 
 fixup that would let me do the queries below?  In the real 
 situation I don't have control over what strings get searched for.
 
 Example based on ?SQLite:
 
  library(RSQLite)
  m - dbDriver(SQLite)
  con - dbConnect(m, dbname = base.dbms)
  data(USArrests)
  dbWriteTable(con, USArrests, USArrests, overwrite = T)
 [1] TRUE
  state - Wyoming
 
 # this works fine:
 
  dbGetQuery(con, paste(SELECT * from USArrests where 
  row_names=',state,',sep=))
   row_names Murder Assault UrbanPop Rape
 1   Wyoming6.8 161   60 15.6
 
 # Buf if the search string contains characters that SQL 
 interprets, I # get an error
 
  state - messy:  ' (
  dbGetQuery(con, paste(SELECT * from USArrests where 
  row_names=',state,',sep=))
 Error in sqliteExecStatement(con, statement) : 
 RS-DBI driver: (error in statement: near (: syntax error)
 
 Duncan Murdoch
 
 __
 [EMAIL PROTECTED] mailing list 
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 

The normal character for escaping the next character to prevent it being
interpreted in SQL (including SQLite) is the backslash (i.e. \). Unless, of
course, I'm not understanding the precise nature of your request.

Regards

Mike

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Turning strings into expressions

2004-11-25 Thread Peter Dalgaard
Dimitris Rizopoulos [EMAIL PROTECTED] writes:

 Hi Alexander,
 
 you could try:
 
 my.string - A==1  B==2
 (my.frame - data.frame(A=sample(1:2, 20, TRUE), B=sample(1:2, 20,
 TRUE)))
 subset(my.frame, eval(parse(text=my.string)))

Hmm, considering the nonstandard evaluation that is going on inside
subset(), I think I'd rather try

 my.frame - data.frame(A=sample(1:2, 20, TRUE), B=sample(1:2, 20,TRUE))
 my.string - A==1  B==2
 l - as.list(parse(text=my.string))
 names(l)-sub
 eval(substitute(subset(my.frame, sub), l))
   A B
18 1 2


(or perhaps l - list(sub=parse(text=my.string)[[1]]) is less
cryptic).

Point being that this way you'll literally evaluate

 substitute(subset(my.frame, sub), l)
subset(my.frame, A == 1  B == 2)


-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Searching for a string in RSQLite

2004-11-25 Thread hadley wickham
 You may find dQuote() and sQuote() to be helpful, but a better

Ooops, dQuote() and sQuote() won't be of much use as they escape
quotes with quotes.

A regular expression should do the trick: gsub(', ', Hi
y'all).  (Note that this looks like it has too many backslashes, but
this is just the way R prints escaped strings, use str() to see the
unescaped string)

Hadley

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Spam {Re: [R] urgent}

2004-11-25 Thread Martin Maechler
I'm sorry for this spam that astonishingly came through to the
mailing list.

It seems these guys have been exercising against known spam
filters and achieved more than in the past.
Also, recent versions of our spamfilter have been tuned such as
to rather produce a few false negatives {spam not detected}
with hardly ever any false positive {non-spam not delivered to recipient},
which makes a lot of sense.

We (I and local e-mail administrators) do keep an eye on this, 
me spending a little time for manual tuning, but we do not
want to allocate too much time for this. 

PLEASE do not reply to this e-mail (at least not to R-help!). 
It is *not* relevant to R and not worth the time (also since too
many people think they know what they are talking about :-).

If you want, reply to me privately.

Martin Maechler, ETH Zurich

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] scatterplot of 100000 points and pdf file format

2004-11-25 Thread Peter Dalgaard
(Ted Harding) [EMAIL PROTECTED] writes:

 I want to look into this a bit more systematically (I have
 an idea why 'unique' may be taking longer on the array from
 'cbind' than on the dataframe),

Just look inside the functions. One is pasting columns together, the
other is using a paste() construct inside an apply() function. So with
two columns by 1e6 rows, one is doing one large paste and the other a
million small ones.


-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Avoiding for-loops

2004-11-25 Thread roger koenker
lower triangle can be obtained by
A[row(A)col(A)]
url:www.econ.uiuc.edu/~rogerRoger Koenker
email   [EMAIL PROTECTED]   Department of Economics
vox:217-333-4558University of Illinois
fax:217-244-6678Champaign, IL 61820
On Nov 25, 2004, at 11:15 AM, John wrote:
Hello R-users,
I have a symmetric matrix of numerical values and I
want to obtain those values in the upper or lower
triangle of the matrix in a vector. I tried to do the
job by using two for-loops but it doens't seem to be a
clever way, and I'd like to know a more efficient code
for a large matrix of thousands of rows and columns.
Below is my code for your reference.
Thanks a lot.
John

# mtx.sym is a symmetric matrix
my.ftn - function(size_mtx, mtx) {
+ my.vector - c()
+ for ( i in 1:size_mtx ) {
+ cat(.)
+ for ( j in 1:size_mtx ) {
+ if ( upper.tri(mtx)[i,j] ) {
+ my.vector - c(my.vector, mtx[i,j])
+ }}}
+ cat(\n)
+ }

# if I have a matrix, mtx.sym, of 100x100
my.ftn(100, mtx.sym)
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Avoiding for-loops

2004-11-25 Thread Uwe Ligges
John wrote:
Hello R-users,
I have a symmetric matrix of numerical values and I
want to obtain those values in the upper or lower
triangle of the matrix in a vector. I tried to do the
job by using two for-loops but it doens't seem to be a
clever way, and I'd like to know a more efficient code
for a large matrix of thousands of rows and columns.
Below is my code for your reference. 

See ?upper.tri
Uwe Ligges

Thanks a lot.
John

# mtx.sym is a symmetric matrix

my.ftn - function(size_mtx, mtx) {
+ my.vector - c()
+ for ( i in 1:size_mtx ) {
+ cat(.)
+ for ( j in 1:size_mtx ) {
+ if ( upper.tri(mtx)[i,j] ) {
+ my.vector - c(my.vector, mtx[i,j])
+ }}}
+ cat(\n)
+ }
# if I have a matrix, mtx.sym, of 100x100
my.ftn(100, mtx.sym)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Avoiding for-loops

2004-11-25 Thread Deepayan Sarkar
On Thursday 25 November 2004 11:15, John wrote:
 Hello R-users,

 I have a symmetric matrix of numerical values and I
 want to obtain those values in the upper or lower
 triangle of the matrix in a vector. I tried to do the
 job by using two for-loops but it doens't seem to be a
 clever way, and I'd like to know a more efficient code
 for a large matrix of thousands of rows and columns.
 Below is my code for your reference.

Try 

mtx[lower.tri(mtx)]

which should give you the same order as your code (untested).

HTH,

Deepayan



 Thanks a lot.

 John

 

 # mtx.sym is a symmetric matrix

  my.ftn - function(size_mtx, mtx) {

 + my.vector - c()
 + for ( i in 1:size_mtx ) {
 + cat(.)
 + for ( j in 1:size_mtx ) {
 + if ( upper.tri(mtx)[i,j] ) {
 + my.vector - c(my.vector, mtx[i,j])
 + }}}
 + cat(\n)
 + }

 # if I have a matrix, mtx.sym, of 100x100

  my.ftn(100, mtx.sym)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] arrows in histograms

2004-11-25 Thread Rogerio Rosa da Silva
Dear all,

I have a null frequency histogram of  pairwise associations values.
How can I put  an arrow on the histogram to indicate the critical value
obtained from the null distribution? [In this case, quantile 0.05].

Thanks
-- 
Rogério R. Silva
MZUSP http://www.mz.usp.br
Linux User # 354364
Linux counter http://counter.li.org

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Error using glm with poisson family and identity link

2004-11-25 Thread Peter Dalgaard
Spencer Graves [EMAIL PROTECTED] writes:

 Dear Federico: Why do you use the identity link?  That can
 produce situations with an average of (-2) Poisson defects per unit,
 for example.  That's physical nonsense. 

So is _not_ using the identity link when the model is manifestly
additive on the identity scale. E.g. calibrating differential
spectrofluorometry with photon counters recording linear combinations
of intensities at different wavelengths.

I've bumped into similar situations before (binomial(link=identity), I
think it was then) and the glm.fit algorithm could use improvement in
dealing with the parameter constraints in these cases. With the
standard IRLS algorithm, if the maximum is on the boundary, you
basically hit a random point on the boundary and get stuck there with
a search direction pointing out of the valid region.
 
-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Avoiding for-loops

2004-11-25 Thread Ted Harding
On 25-Nov-04 John wrote:
 Hello R-users,
 
 I have a symmetric matrix of numerical values and I
 want to obtain those values in the upper or lower
 triangle of the matrix in a vector. I tried to do the
 job by using two for-loops but it doens't seem to be a
 clever way, and I'd like to know a more efficient code
 for a large matrix of thousands of rows and columns.

The two functions uuper.tri and lower.tri do just this job!

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861  [NB: New number!]
Date: 25-Nov-04   Time: 18:54:20
-- XFMail --

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Error using glm with poisson family and identity link

2004-11-25 Thread Spencer Graves
Hi, Peter: 

 What do you do in such situations? 

 Sundar Dorai-Raj and I have extended glm concepts to models 
driven by a sum of k independent Poissons, with the a linear model for 
log(defectRate[i]) for each source (i = 1:k).  To handle convergence 
problems, etc., I think we need to use informative Bayes, but we're not 
there yet.  In any context where things are done more than once [which 
covers most human activities], informative Bayes seems sensible. 

 A related question comes with data representing the differences 
between Poisson counts, e.g., with d[i] = X[i]-X[i-1] = the number of 
new defects added between steps i-1 and i in a manufacturing process.  
Most of the time, d[i] is nonnegative.  However, in some cases, it can 
be negative, either because of metrology errors in X[i] or because of 
defect removal between steps i-1 and i. 

 Comments?
 Best Wishes,
 Spencer Graves
Peter Dalgaard wrote:
Spencer Graves [EMAIL PROTECTED] writes:
 

Dear Federico: Why do you use the identity link?  That can
produce situations with an average of (-2) Poisson defects per unit,
for example.  That's physical nonsense. 
   

So is _not_ using the identity link when the model is manifestly
additive on the identity scale. E.g. calibrating differential
spectrofluorometry with photon counters recording linear combinations
of intensities at different wavelengths.
I've bumped into similar situations before (binomial(link=identity), I
think it was then) and the glm.fit algorithm could use improvement in
dealing with the parameter constraints in these cases. With the
standard IRLS algorithm, if the maximum is on the boundary, you
basically hit a random point on the boundary and get stuck there with
a search direction pointing out of the valid region.
 

--
Spencer Graves, PhD, Senior Development Engineer
O:  (408)938-4420;  mobile:  (408)655-4567
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Making legend() look like my plot()

2004-11-25 Thread Dan Bolser

Is this an impossible task?

How about just problem 2 below, having one pch in one legend entry, but no
pch in the second?




On Thu, 25 Nov 2004, Dan Bolser wrote:


Hello,

I am using code like the following to create as simple plot...



plot(x,y,type='b')
lines(lowess(x,y),lwd=3,lty=3,col=2)

I want to add a legend which shows lines looking exactly like those used
in my plot, i.e. a thin black line with gaps taken up by circles (the
default for type='b', and a thick dashed red line with no pch at all).

I have two problems, 

1) making the pch on the first like look like type = 'b' (gaps around pch)
2) surpressing a pch on for the second line


Any help with these two problems would be greatly appreciated.

Any archive of plots and code to browse which could help me visually find
what I want and then copy the code?


An online user contributable database of 'graphics in R' would be
smashing.


How come some smart people dont just let me do something like

legend(xpos,ypos,legend=add)

to add a legend to the current plot for all the relevant points and lines
which have been added so far?

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] arrows in histograms

2004-11-25 Thread Ted Harding
On 25-Nov-04 Rogerio Rosa da Silva wrote:
 Dear all,
 
 I have a null frequency histogram of _pairwise associations values.
 How can I put _an arrow on the histogram to indicate the critical value
 obtained from the null distribution? [In this case, quantile 0.05].

?Something like

  q05 - qnorm(0.95)  ## or qnorm(0.05) -- not sure which you really want
  hist(x,xlim=c(-5,5))
  arrows(q05,400,q05,0,length=0.1)
  text(q05+0.1,400,5 per cent point,adj=0)

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861  [NB: New number!]
Date: 25-Nov-04   Time: 19:46:15
-- XFMail --

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] R-2.0.1 reinstall non-CRAN pkg

2004-11-25 Thread Anthony Westerling
I am trying to upgrade to R-2.0.1 from R-1.9 on a Mac running OS X 10.3.
I have some simple packages I wrote myself that have to be reinstalled 
to be recognized as valid packages.  I have been using them for a while 
on earlier versions of R, so didn't expect to have any problems.

I am probably going about this the wrong way?  I simply used
R CMD build mypkgdir
and then
R CMD install mypkgdir.tar.gz
the package installs without any error messages.
however, library(mypkgname) still generates spiteful
	Error in library(mypkgname) : 'mypkgname' is not a valid package -- 
installed  2.0.0?

messages.
My apologies if answers to this kind of question have already been 
posted.  I have looked over the archived r-help threads for the last 
couple of months.

Best
Anthony Westerling
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Making legend() look like my plot()

2004-11-25 Thread Uwe Ligges
Dan Bolser wrote:
Is this an impossible task?
How about just problem 2 below, having one pch in one legend entry, but no
pch in the second?
Please be at least a little bit patient! This is not a hotline! People 
are not working 24 hours a day just to answer your questions at once - 
they are answering questions on a voluntary basis!

answer 1) is not straightforward, but you might want to use one of 
fillable symbols mentioned in ?points, e.g. number 21

answer 2) pch = c(1, NA) should do the trick.
legend(., pch=c(21,NA), lwd=c(1,3), lty=c(1,3), pt.bg=white, col=1:2)
Uwe Ligges


On Thu, 25 Nov 2004, Dan Bolser wrote:

Hello,
I am using code like the following to create as simple plot...

plot(x,y,type='b')
lines(lowess(x,y),lwd=3,lty=3,col=2)
I want to add a legend which shows lines looking exactly like those used
in my plot, i.e. a thin black line with gaps taken up by circles (the
default for type='b', and a thick dashed red line with no pch at all).
I have two problems, 

1) making the pch on the first like look like type = 'b' (gaps around pch)
2) surpressing a pch on for the second line
Any help with these two problems would be greatly appreciated.
Any archive of plots and code to browse which could help me visually find
what I want and then copy the code?
An online user contributable database of 'graphics in R' would be
smashing.
How come some smart people dont just let me do something like
legend(xpos,ypos,legend=add)
to add a legend to the current plot for all the relevant points and lines
which have been added so far?
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Error using glm with poisson family and identity link

2004-11-25 Thread Peter Dalgaard
Spencer Graves [EMAIL PROTECTED] writes:

 Hi, Peter: What do you do in such situations? Sundar Dorai-Raj
 and I have extended glm concepts to models driven by a sum of k
 independent Poissons, with the a linear model for log(defectRate[i])
 for each source (i = 1:k).  To handle convergence problems, etc., I
 think we need to use informative Bayes, but we're not there yet.  In
 any context where things are done more than once [which covers most
 human activities], informative Bayes seems sensible. A related
 question comes with data representing the differences between Poisson
 counts, e.g., with d[i] = X[i]-X[i-1] = the number of new defects
 added between steps i-1 and i in a manufacturing process.  Most of the
 time, d[i] is nonnegative.  However, in some cases, it can be
 negative, either because of metrology errors in X[i] or because of
 defect removal between steps i-1 and i. Comments?

I haven't got all that much experience with it, but obviously, the
various algorithms for constrained optimization (box- or otherwise) at
least allow you to find a proper maximum likelihood estimator.


-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Error using glm with poisson family and identity link

2004-11-25 Thread Spencer Graves
Hi, Peter: 

 Thanks for the comment and reply. 

 I generally avoid constrained optimizers for three reasons: 

 1.  My experience with them has included many cases where the 
optimizer would stop with an error when testing parameter values that 
violate the constraints.  If I transform the parameter space to remove 
the constraints, that never happens.  The constrained optimizers in R 
2.0.1 may not exhibit this behavior, but I have not checked. 

 2.  In a few cases, I've plotted the log(likelihood) vs. parameter 
values using various transformations.  When I've done that, I typically 
found that the most nearly parabolic performance used unconstrained 
parameterizations.  This makes asymptotic normality more useful and 
increases the accuracy of simple, approximate sequential Bayesian 
procedures. 

 3.  When I think carefully about a particular application, I often 
find a rationale for claiming that a certain unconstrained 
parameterization provides a better description of the application.  For 
example, interest income on investments is essentially additive on the 
log scale.  Similarly, the concept of materiality in Accounting is 
closer to being constant in log space:  One might look for an error of a 
few Euros in the accounts of a very small business, but in auditing some 
major government accounts, errors on the order of a few Euros might not 
be investigated.  Also, measurement errors with microvolts are much 
smaller than with megavolts;  expressing the measurements in decibels 
(i.e., on the log scale) makes the measurement errors more nearly 
comparable. 

 Thanks again for your comments. 
 Best Wishes,
 Spencer Graves

Peter Dalgaard wrote:
Spencer Graves [EMAIL PROTECTED] writes:
 

Hi, Peter: What do you do in such situations? Sundar Dorai-Raj
and I have extended glm concepts to models driven by a sum of k
independent Poissons, with the a linear model for log(defectRate[i])
for each source (i = 1:k).  To handle convergence problems, etc., I
think we need to use informative Bayes, but we're not there yet.  In
any context where things are done more than once [which covers most
human activities], informative Bayes seems sensible. A related
question comes with data representing the differences between Poisson
counts, e.g., with d[i] = X[i]-X[i-1] = the number of new defects
added between steps i-1 and i in a manufacturing process.  Most of the
time, d[i] is nonnegative.  However, in some cases, it can be
negative, either because of metrology errors in X[i] or because of
defect removal between steps i-1 and i. Comments?
   

I haven't got all that much experience with it, but obviously, the
various algorithms for constrained optimization (box- or otherwise) at
least allow you to find a proper maximum likelihood estimator.
 

--
Spencer Graves, PhD, Senior Development Engineer
O:  (408)938-4420;  mobile:  (408)655-4567
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Making legend() look like my plot()

2004-11-25 Thread Dan Bolser
On Thu, 25 Nov 2004, Uwe Ligges wrote:

Dan Bolser wrote:
 Is this an impossible task?
 
 How about just problem 2 below, having one pch in one legend entry, but no
 pch in the second?

Please be at least a little bit patient! This is not a hotline! People 
are not working 24 hours a day just to answer your questions at once - 
they are answering questions on a voluntary basis!

answer 1) is not straightforward, but you might want to use one of 
fillable symbols mentioned in ?points, e.g. number 21

answer 2) pch = c(1, NA) should do the trick.

legend(., pch=c(21,NA), lwd=c(1,3), lty=c(1,3), pt.bg=white, col=1:2)

Ahhh... I tried pch=c(1,NULL), pt.bg='white' I couldn't work out what was
going on..

thanks very much for the info



Uwe Ligges


 
 
 
 On Thu, 25 Nov 2004, Dan Bolser wrote:
 
 
Hello,

I am using code like the following to create as simple plot...



plot(x,y,type='b')
lines(lowess(x,y),lwd=3,lty=3,col=2)

I want to add a legend which shows lines looking exactly like those used
in my plot, i.e. a thin black line with gaps taken up by circles (the
default for type='b', and a thick dashed red line with no pch at all).

I have two problems, 

1) making the pch on the first like look like type = 'b' (gaps around pch)
2) surpressing a pch on for the second line


Any help with these two problems would be greatly appreciated.

Any archive of plots and code to browse which could help me visually find
what I want and then copy the code?


An online user contributable database of 'graphics in R' would be
smashing.


How come some smart people dont just let me do something like

legend(xpos,ypos,legend=add)

to add a legend to the current plot for all the relevant points and lines
which have been added so far?

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

 
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] support vector machine

2004-11-25 Thread stephenc
Hi Everyone
 
Thanks to those who responded last time.
 
I am still having problems.  I really want to find one of those
tutorials on how to use svm() so I can then get going using it myself.
Issues are which kernel to choose, how to tune the parameters.  If
anyone know of a tutorial please let me know.
 
Stephen

[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] help with glmmPQL

2004-11-25 Thread Andrew Criswell
Hello:
Will someone PLEASE help me with this problem. This is the third time 
I've posted it.

When I appply anova() to two equations estimated using glmmPQL, I get a 
complaint,

anova(fm1, fm2)
Error in anova.lme(fm1, fm2) : Objects must inherit from classes gls,
gnls lm,lmList, lme,nlme,nlsList, or nls

The two equations I estimated are these:
fm1 - glmmPQL(choice ~ day + stereotypy,
+random = ~ 1 | bear, data = learning, family = binomial)
fm2 - glmmPQL(choice ~ day + envir + stereotypy,
+random = ~ 1 | bear, data = learning, family = binomial)
Individually, I get results from anova():
anova(fm1)
  numDF denDF   F-value p-value
(Intercept) 1  2032   7.95709  0.0048
day 1  2032 213.98391  .0001
stereotypy  1  2032   0.42810  0.5130
anova(fm2)
  numDF denDF   F-value p-value
(Intercept) 1  2031   5.70343  0.0170
day 1  2031 213.21673  .0001
envir   1  2031  12.50388  0.0004
stereotypy  1  2031   0.27256  0.6017

I did look through the archives but didn't finding anything relevant to 
my problem.

Hope someone can help.
ANDREW

   _
platform i586-mandrake-linux-gnu
arch i586
os   linux-gnu
system   i586, linux-gnu
status
major2
minor0.0
year 2004
month10
day  04
language R

--
Andrew R. Criswell, Ph.D.
Graduate School, Bangkok University
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Testing for S4 objects

2004-11-25 Thread John Fox
Dear r-help list members,

Is there a way to test whether an object is an S4 object? The best that I've
been able to come up with is

isS4object - function(object) !(is.null(slotNames(object)))

which assumes that an S4 object has at least one slot. I think this is safe,
but perhaps I'm missing something.

Thanks,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] How to expand the size limit of a vector?

2004-11-25 Thread Guoqi Qian
Hi everybody on this list,

Could somebody please tell me how to expand the size limit of a vector
in R?
In my simulation I get the following error message:

 x=kronecker(diag(1,100),matrix(1,100,100))
Error: cannot allocate vector of size 781250 Kb
In addition: Warning message: 
Reached total allocation of 511Mb: see help(memory.size)

Thanks in advance

Yours sincerely,

Guoqi Qian

-
Guoqi Qian
Department of Statistics  
La Trobe University   
Bundoora, VIC 3086 
AUSTRALIA 
Email:[EMAIL PROTECTED]
Tel:  +61 3 9479 2609
Fax:  +61 3 9479 2466
http://www.latrobe.edu.au/www/statistic/

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] R vs SPSS

2004-11-25 Thread Jim Lemon
As I started out using SPSS when there was no GUI (in fact, no interactive 
interface at all), I automatically open up the syntax editing window when I 
have to use it. It's a workable text editor, you can run all or part of the 
code at will, and build up a code file in much the same way as R.

On the other hand, it does encourage the user who has not taken Pope to heart 
(A little learning...) to put their data through a high-powered analysis 
while convincing themselves that they know what they are doing. I confess to 
having done it more than once in the past. It was when I began reviewing 
other researcher's papers, and thinking 'This guy didn't know what he was 
doing.' and then, 'And you've done it too, brother.' that I resolved to be 
more circumspect.

Jim

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Response Surface

2004-11-25 Thread dvrecko
Hi. I'm a student at Simon Fraser University in British Columbia, Canada. I
can't for the life of me figure out how to plot a 3D surface (A 3D response
surface to be more specific) in R. I found your email address on a web
board, and saw someone mention wireframe(), but using the help in R yielded
no results. Any suggestions?

Thanks.

Dean Vrecko

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Response Surface

2004-11-25 Thread Deepayan Sarkar
On Thursday 25 November 2004 22:35, [EMAIL PROTECTED] wrote:
 Hi. I'm a student at Simon Fraser University in British Columbia,
 Canada. I can't for the life of me figure out how to plot a 3D
 surface (A 3D response surface to be more specific) in R. I found
 your email address on a web board, and saw someone mention
 wireframe(), but using the help in R yielded no results. Any
 suggestions?

Read

 help(persp)

and run

 example(persp)
 demo(persp)

Deepayan

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Response Surface

2004-11-25 Thread Austin, Matt
wireframe() is available in the package lattice.

--Matt

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED]
 Sent: Thursday, November 25, 2004 20:36 PM
 To: [EMAIL PROTECTED]
 Subject: [R] Response Surface
 
 
 Hi. I'm a student at Simon Fraser University in British 
 Columbia, Canada. I
 can't for the life of me figure out how to plot a 3D surface 
 (A 3D response
 surface to be more specific) in R. I found your email address on a web
 board, and saw someone mention wireframe(), but using the 
 help in R yielded
 no results. Any suggestions?
 
 Thanks.
 
 Dean Vrecko
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Response Surface

2004-11-25 Thread Mulholland, Tom
type ?wireframe rather than wireframe()

Tom Mulholland

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Friday, 26 November 2004 12:36 PM
To: [EMAIL PROTECTED]
Subject: [R] Response Surface


Hi. I'm a student at Simon Fraser University in British Columbia, Canada. I
can't for the life of me figure out how to plot a 3D surface (A 3D response
surface to be more specific) in R. I found your email address on a web
board, and saw someone mention wireframe(), but using the help in R yielded
no results. Any suggestions?

Thanks.

Dean Vrecko

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] help with glmmPQL

2004-11-25 Thread A.J. Rossini
For better or worse, it's holidays in the states.  Very amusing for me
being in a non-Thanksgiving celebrating country.

In addition, it's not a problem.  The complaint is valid.  Probably no
one has coded up the right solution yet for comparison.

I can't recall if one would want those statistics for a binomial
random effects model, but I do recall some issues with model
comparison in that setting, though they are a bit dated (say, 2 years
or so).

On Fri, 26 Nov 2004 09:31:40 +0700, Andrew Criswell
[EMAIL PROTECTED] wrote:
 Hello:
 
 Will someone PLEASE help me with this problem. This is the third time
 I've posted it.
 
 When I appply anova() to two equations estimated using glmmPQL, I get a
 complaint,
 
  anova(fm1, fm2)
 
 Error in anova.lme(fm1, fm2) : Objects must inherit from classes gls,
 gnls lm,lmList, lme,nlme,nlsList, or nls
 
 
 
 The two equations I estimated are these:
 
  fm1 - glmmPQL(choice ~ day + stereotypy,
 
 +random = ~ 1 | bear, data = learning, family = binomial)
 
  fm2 - glmmPQL(choice ~ day + envir + stereotypy,
 
 +random = ~ 1 | bear, data = learning, family = binomial)
 
 Individually, I get results from anova():
 
  anova(fm1)
 
   numDF denDF   F-value p-value
 (Intercept) 1  2032   7.95709  0.0048
 day 1  2032 213.98391  .0001
 stereotypy  1  2032   0.42810  0.5130
 
 
  anova(fm2)
 
   numDF denDF   F-value p-value
 (Intercept) 1  2031   5.70343  0.0170
 day 1  2031 213.21673  .0001
 envir   1  2031  12.50388  0.0004
 stereotypy  1  2031   0.27256  0.6017
 
 
 
 I did look through the archives but didn't finding anything relevant to
 my problem.
 
 Hope someone can help.
 
 ANDREW
 
_
 platform i586-mandrake-linux-gnu
 arch i586
 os   linux-gnu
 system   i586, linux-gnu
 status
 major2
 minor0.0
 year 2004
 month10
 day  04
 language R
 
 --
 Andrew R. Criswell, Ph.D.
 Graduate School, Bangkok University
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


-- 

best,
-tony

---
A.J. Rossini
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] barplot(2?) with CI from a zero reference line

2004-11-25 Thread Jean-Louis Abitbol
Dear R Users, (and dear Marc)

First of all many thanks for the answers to my previous questions.

I would like to barplot the mean percent change of a variate with it's
CI. Bars should start from the zero reference line to height (in
barplot2).

Is there a way to tweak barplot2, for example,  to do that ? 

I have tried to see what the function was but unlike other functions was
not able to list it by  barplot2. Is it because it is called through
UseMethods ? 

Thanks for any help.

Jean-Louis

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] support vector machine

2004-11-25 Thread Christian Schulz
http://www.maths.lth.se/help/R/.R/library/e1071/doc/svmdoc.pdf
regards, christian
stephenc wrote:
Hi Everyone
Thanks to those who responded last time.
I am still having problems.  I really want to find one of those
tutorials on how to use svm() so I can then get going using it myself.
Issues are which kernel to choose, how to tune the parameters.  If
anyone know of a tutorial please let me know.
Stephen
[[alternative HTML version deleted]]
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Error using glm with poisson family and identity link

2004-11-25 Thread Prof Brian Ripley
On Thu, 25 Nov 2004, Spencer Graves wrote:
I generally avoid constrained optimizers for three reasons: 
1.  My experience with them has included many cases where the optimizer 
would stop with an error when testing parameter values that violate the 
constraints.  If I transform the parameter space to remove the constraints, 
that never happens.  The constrained optimizers in R 2.0.1 may not exhibit 
this behavior, but I have not checked.
They do not, and OTOH if the MLE really does lie on the boundary (and here 
it may well, with one data point fitted with mean zero) transformation 
will often not find a good solution.

Constrained optimization is a hard problem, good methods are very 
complex and good code to implement them is usually expensive.

--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to expand the size limit of a vector?

2004-11-25 Thread Prof Brian Ripley
On Fri, 26 Nov 2004, Guoqi Qian wrote:
Hi everybody on this list,
Could somebody please tell me how to expand the size limit of a vector
in R?
You must be using Windows, without telling us. The rw-FAQ tells you the 
answer, as well as the help page that message refers to.  It's better for 
you that you learn to use these resources than ask 2000 people to read 
them for you.

You may also need to get a bigger computer, since you are trying to create 
a single object bigger than your computer's RAM memory and a high 
proportion of the address space of a Windows machine.  It might be more 
sensible to ask your more senior colleagues for advice on your statistical 
computing and see if you can avoid this computation.

In my simulation I get the following error message:
x=kronecker(diag(1,100),matrix(1,100,100))
Error: cannot allocate vector of size 781250 Kb
In addition: Warning message:
Reached total allocation of 511Mb: see help(memory.size)

PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
which asks you to read the rw-FAQ before posting.
--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] barplot(2?) with CI from a zero reference line

2004-11-25 Thread Mulholland, Tom
I didn't know how to do this but I knew it had to been asked about.

Try getS3method(barplot2,default)

Make sure you've loaded gplots. I guessed default, but I wonder how you would 
find out the class if it had been something else. I guess that's something to 
work on when I'm next twiddling my thumbs.

Tom Mulholland

-Original Message-
From: Jean-Louis Abitbol [mailto:[EMAIL PROTECTED]
Sent: Friday, 26 November 2004 2:56 PM
To: [EMAIL PROTECTED]
Subject: [R] barplot(2?) with CI from a zero reference line


Dear R Users, (and dear Marc)

First of all many thanks for the answers to my previous questions.

I would like to barplot the mean percent change of a variate with it's
CI. Bars should start from the zero reference line to height (in
barplot2).

Is there a way to tweak barplot2, for example,  to do that ? 

I have tried to see what the function was but unlike other functions was
not able to list it by  barplot2. Is it because it is called through
UseMethods ? 

Thanks for any help.

Jean-Louis

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html