[R] How could plot a chart with some Chinese's words text?

2003-06-30 Thread Ken Lee
Dear all,
  I want to plot a chart title with some Chinese words at unix system, but I do 
not how to do.
first, it is no problem when  I use write.table like:
 
a-
write.table(a,file=z.txt,sep=\t) 

second, I try 

bitmap(file=z.png)
plot(1:10,main=a)
dev.off()

I can't get a chart with the right title = 

Why have this difference?

Thanks a lot

ken

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


Re: [R] How could plot a chart with some Chinese's words text?

2003-06-30 Thread Prof Brian Ripley
On Mon, 30 Jun 2003, Ken Lee wrote:

 Dear all,
   I want to plot a chart title with some Chinese words at unix system, but I do 
 not how to do.
 first, it is no problem when  I use write.table like:
  
 a-中文
 write.table(a,file=z.txt,sep=\t) 

Not, that is not Chinese for me and I suspect almost all your readers.

 second, I try 
 
 bitmap(file=z.png)
 plot(1:10,main=a)
 dev.off()
 
 I can't get a chart with the right title =中文 
 
 Why have this difference?

Encodings.

bitmap(() uses postscript() and that is set up to use ISO-Latin1 on Unix.
You can change it (see its help file) provided your version of gs has the 
fonts you need.  It is almost certainly easier to use the png() device
*if* you can plot the title you want on an x11() device.

-- 
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://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] ./configure needs /sw/lib?

2003-06-30 Thread Prof Brian Ripley
On Sun, 29 Jun 2003, Tony Marlboro wrote:

 Hello,
 
   I am using R on Mac OS X.  I have tried to install the package
 netCDF, but have run into a problem.  The install.packages command
 fails during a call to the configure shell script in the package
 build directory, because it cannot find the netCDF libraries on my
 system.  Those libraries are installed in /sw/lib, as they were
 installed with fink, and this system puts everything in /sw.  
 
   Either I need a way to give configure flags to
 install.packages(), or this package is broken.  Note that
 /sw/lib/R/etc/Makeconf has all the right build flags.  Is there a
 mechanism for handling problems of this nature?

Yes, to use R CMD INSTALL directly: use R CMD INSTALL --help to find out 
how.  You need to supply --with-netCDF=/sw, I believe (but then the 
headers may not be found).

It should be simpler to fix your OS: if you put /sw/include in your
INCLUDE path and /sw/lib in your LIBRARY path then configure in netCDF
should work `out of the box'.  I would consider this to be a problem with
your setup, not with R nor netCDF: why should netCDF know anything about
fink?

-- 
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://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Fitting inter-arrival time data

2003-06-30 Thread Prof Brian Ripley
On Sun, 29 Jun 2003, M. Edward Borasky wrote:

 I have a collection of data which includes inter-arrival times of requests
 to a server. What I've done so far with it is use sm.density to explore
 the distribution, which found two large peaks. However, the peaks are made
 up of Gaussians, and that's not really correct, because the inter-arrival
 time can never be less than zero. In fact, the leftmost peak is centered at
 somewhere around ten seconds, and quite a bit of it extends into negative
 territory.
 
 What I'd like to do is fit this dataset to a mixture (sum) of exponentials,
 hyper-exponentials and hypo-exponentials. My preference is to use the
 well-known branching Erlang approximation (exponential stages) to the hyper-
 and hypo-exponentials. In this approximation, a distribution is specified by
 its mean and coefficient of variation.
 
 So far, what I've been able to come up with in a literature search has been
 something called the Expectation Maximization algorithm. And I haven't been
 able to locate R code for this. So my questions are:

 1. Is EM the right way to go about this, or is there something better?

Even for normal mixtures, direct likelihood maximization was considered to 
be better in several studies.  The EM method converges notoriously slowly.

 2. Is there some EM code in R that I could experiment with, or do I need to
 write my own?

It's not an algorithm (despite its common name) so cannot be coding
generically.  There is EM code for normal mixtures in several places, e.g.
in packages emclust and mda.  Direct ML would be easier to code, I expect.

 3. Is there a way this could be done using the existing R kernel density
 estimators and some kind of kernel that is zero for negative values of its
 argument? 

No, but there are ways to do by transforming the x scale.  Local 
polynomial estimators (KernSmooth, locfit) will do better.  For all of 
these see MASS (the book) and its on-line complements.

-- 
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://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Returning contour co-ordinates

2003-06-30 Thread Ted Harding
On 29-Jun-03 Paul Murrell wrote:
 There is a partial implementation of this available via a tiny R
 package 
 (http://www.stat.auckland.ac.nz/~paul/R/clines_1.0.tar.gz)

Excellent! Thanks.

 [...]
 This will become available via a call to contour() in the future.

Even better! (Really tiny: I like that sort of program).

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 167 1972
Date: 30-Jun-03   Time: 08:35:12
-- XFMail --

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


Re: [R] Fitting inter-arrival time data

2003-06-30 Thread Adelchi Azzalini
On Monday 30 June 2003 01:23, M. Edward Borasky wrote:
 I have a collection of data which includes inter-arrival times of requests
 to a server. What I've done so far with it is use sm.density to explore
 the distribution, which found two large peaks. However, the peaks are made
 up of Gaussians, and that's not really correct, because the inter-arrival
 time can never be less than zero. In fact, the leftmost peak is centered at
 somewhere around ten seconds, and quite a bit of it extends into negative
 territory.

if you data are positive, you could use

  sm.density(..., positive=TRUE)

and possibly make use of the additional parameter delta for fine tuning

best wishes,

Adelchi Azzalini

-- 
Adelchi Azzalini  [EMAIL PROTECTED]
Dipart.Scienze Statistiche, Università di Padova, Italia
http://azzalini.stat.unipd.it/

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


[R] R as COM client (rather than server)

2003-06-30 Thread DED (David George Edwards)
Hello all

Can R be used as a COM client (rather than as a COM server)? The following
(Splus) code shows the sort of thing I'd like to do:

pMIM - create.ole.object(mim31.Server)
NoOutputLines - call.ole.method(pMIM, SendCmdLine, show w) 
for (i in 1:NoOutputLines) show(call.ole.method(pMIM,
GetOutputLine))
release.ole.object(pMIM)
I've tried to look at the RDCOM documentation but could not figure out
whether this can be done.
Regards
David

David Edwards, Biostatistics, 
Novo Nordisk A/S, Bagsværd, Denmark.
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
Tlf: +45 44 42 62 35. Fax: +45 44 42 14 80


[[alternative HTML version deleted]]

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


[R] symbol size on a plot

2003-06-30 Thread Philippe Hupé
Hi,

I would like to get from a plot the size of the symbols plotted.
Imagine I have the following plot function :
plot(1:2,1:2, pch=15, cex=4)
I would like the get the values SIZE1 and SIZE2 so that if I plot the 
following rectangle :
rect(1.5,1.5, 1.5+SIZE1, 1.5+SIZE2) then the size of this square is 
exactely the same as the one of the symbols that have been plotted.

Thanks for any idea.
--
--

Philippe Hupé
Institut Curie - Equipe Bioinformatique
26, rue d'Ulm - 75005 PARIS France
+33 (0)1 42 34 65 29
[EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

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


[R] Rmpi: send a function to a slave from master and let it run?

2003-06-30 Thread lun li
Hello All,

Can send different functions  to different slaves from master and let each 
slave run itself function using Rmpi? From the Rmpi version 0.4.2, I know 
how to send a function to all slaves and let slave run the function.  
mpi.send.Robj may send a function to a slave, but how let the salve run the 
function?

Thanks.

Lun

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


Re: [R] repeatedly applying function with matrix-rows as argument

2003-06-30 Thread Prof Brian Ripley
apply(mymatrix, 1, function(x) myfun(x[1], x[2], x[3]))

On Mon, 30 Jun 2003, Maarten Speekenbrink wrote:

 Suppose I have a function which takes three arguments. I would like to
 repeatedly apply the function, using a matrix N*3 in which each row
 supplies the three argements for the function. Is this possible? Thank
 you for your help in advance!
 

-- 
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://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] french map

2003-06-30 Thread Peyrard Nathalie
Hello,

I would like to know if (as the usa map with Splus), it is possible with 
R to plot the french map and to add points (representing towns for 
instance) on the figure in the appropriate (x,y) system.
Thank you.

 Nathalie Peyrard

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


[R] R CMD check

2003-06-30 Thread John Bjørnar Bremnes
when using R CMD check mypkg I get the error message
...
* checking R files for library.dynam ... OK
* checking generic/method consistency ... WARNING
Error in .loadPackageQuietly(package, lib.loc) :
Error in parse(file, n, text, prompt) : syntax error on line 95
Execution halted
* checking for assignment functions with final arg not named 'value' ... 
WARNING
Error in .loadPackageQuietly(package, lib.loc) :
Error in parse(file, n, text, prompt) : syntax error on line 95
Execution halted
...

What can I do to avoid this? I use R-1.7.0 on Linux RedHat.

Any suggestions are appreciated.

--
John Bjornar Bremnes
Norwegian Meteorological Institute (met.no)
Research and Development Department
P.O.Box 43 Blindern, N-0313 Oslo, Norway
Phone: (+47) 2296 3326. Fax: (+47) 2269 6355
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] R as COM client (rather than server)

2003-06-30 Thread Duncan Temple Lang
There is also the Omegahat collection of packages for DCOM 
which supports R as a client, user-definable server objects and event handlers.
Together, RDCOMClient and  RDCOMServer  (and the SWinRegistry and SWinTypeLibs 
packages)
provide a general way to handle arbitrary data types in R and COM.
There is a description of how this differs from the S-Plus approach  and Thomas' rdcom 
package.

See http://www.omegahat.org/RDCOMClient


Erich Neuwirth wrote:
 It can be done.
 But it is still in development and therefore not on CRAN.
 There is a library rcom which does exactly what you are asking for.
 
 http://sunsite.univie.ac.at/rcom/
 
 always has the latest version of the R COM package,
 currently including the package for R as a client also.
 
 There is a special mailing list for questions
 related to R and (D)COM
 you can subscribe to it at
 
 http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l
 
 
 
 
 DED (David George Edwards) wrote:
  Hello all
  
  Can R be used as a COM client (rather than as a COM server)? The following
  (Splus) code shows the sort of thing I'd like to do:
  
  pMIM - create.ole.object(mim31.Server)
  NoOutputLines - call.ole.method(pMIM, SendCmdLine, show w) 
  for (i in 1:NoOutputLines) show(call.ole.method(pMIM,
  GetOutputLine))
  release.ole.object(pMIM)
  I've tried to look at the RDCOM documentation but could not figure out
  whether this can be done.
  Regards
  David
  
  David Edwards, Biostatistics, 
  Novo Nordisk A/S, Bagsværd, Denmark.
  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
  Tlf: +45 44 42 62 35. Fax: +45 44 42 14 80
  
  
  [[alternative HTML version deleted]]
  
  __
  [EMAIL PROTECTED] mailing list
  https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help

-- 
___

Duncan Temple Lang[EMAIL PROTECTED]
Bell Labs, Lucent Technologiesoffice: (908)582-3217
700 Mountain Avenue, Room 2C-259  fax:(908)582-3340
Murray Hill, NJ  07974-2070   
 http://cm.bell-labs.com/stat/duncan

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


RE: [R] R as COM client (rather than server)

2003-06-30 Thread DED (David George Edwards)
Hi Duncan

Thanks for the information, this looks very nice. 

Best regards
David

PS Some of the links on http://www.omegahat.org/RDCOMClient are broken.


-Original Message-
From: Duncan Temple Lang [mailto:[EMAIL PROTECTED] 
Sent: 30 June 2003 15:58
To: Erich Neuwirth
Cc: DED (David George Edwards); '[EMAIL PROTECTED]'
Subject: Re: [R] R as COM client (rather than server)


There is also the Omegahat collection of packages for DCOM 
which supports R as a client, user-definable server objects and event
handlers. Together, RDCOMClient and  RDCOMServer  (and the SWinRegistry and
SWinTypeLibs packages) provide a general way to handle arbitrary data types
in R and COM. There is a description of how this differs from the S-Plus
approach  and Thomas' rdcom package.

See http://www.omegahat.org/RDCOMClient


Erich Neuwirth wrote:
 It can be done.
 But it is still in development and therefore not on CRAN. There is a 
 library rcom which does exactly what you are asking for.
 
 http://sunsite.univie.ac.at/rcom/
 
 always has the latest version of the R COM package,
 currently including the package for R as a client also.
 
 There is a special mailing list for questions
 related to R and (D)COM
 you can subscribe to it at
 
 http://mailman.csd.univie.ac.at/mailman/listinfo/rcom-l
 
 
 
 
 DED (David George Edwards) wrote:
  Hello all
  
  Can R be used as a COM client (rather than as a COM server)? The 
  following
  (Splus) code shows the sort of thing I'd like to do:
  
  pMIM - create.ole.object(mim31.Server)
  NoOutputLines - call.ole.method(pMIM, SendCmdLine, show w) 
  for (i in 1:NoOutputLines) show(call.ole.method(pMIM,
  GetOutputLine))
  release.ole.object(pMIM)
  I've tried to look at the RDCOM documentation but could not figure 
  out whether this can be done. Regards
  David
  
  David Edwards, Biostatistics,
  Novo Nordisk A/S, Bagsværd, Denmark.
  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] 
  Tlf: +45 44 42 62 35. Fax: +45 44 42 14 80
  
  
  [[alternative HTML version deleted]]
  
  __
  [EMAIL PROTECTED] mailing list 
  https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 
 
 __
 [EMAIL PROTECTED] mailing list 
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help

-- 
___

Duncan Temple Lang[EMAIL PROTECTED]
Bell Labs, Lucent Technologiesoffice: (908)582-3217
700 Mountain Avenue, Room 2C-259  fax:(908)582-3340
Murray Hill, NJ  07974-2070   
 http://cm.bell-labs.com/stat/duncan

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


Re: [R] ./configure needs /sw/lib?

2003-06-30 Thread Prof Brian Ripley
On Mon, 30 Jun 2003, Tony Marlboro wrote:

 
 Thank you for your reply, Professor Ripley.
 
  Yes, to use R CMD INSTALL directly: use R CMD INSTALL --help to find
  out how.  You need to supply --with-netCDF=/sw, I believe (but then
  the headers may not be found).
 
 R CMD INSTALL --configure-args=--with-netCDF=/sw netCDF_1.5.tar.gz
 was the correct incantation, thanks.
 
 I spent a considerable amount of time trying to figure this out on my
 own, and I think it would have been easier if the Add-on packages
 section of the R Installation manual were more complete.  It would
 be nice to highlight the differences between install.packages() and R
 CMD INSTALL, if at least to mention the extra capabilities of R CMD INSTALL.
 I would like to submit a documentation patch.  With whom should I
 correspond? 

It's in the FAQ.  Of course, it would be nice for the rest of us if 
MacOS X were not so out-of-kilter.

  It should be simpler to fix your OS: if you put /sw/include in your
  INCLUDE path and /sw/lib in your LIBRARY path then configure in
  netCDF should work `out of the box'.
 
 Are you referring to environment variables called INCLUDE and LIBRARY?
 I tried setting them, then running R CMD INSTALL without any extra
 args to configure, and it failed.  I'm quite curious what you mean by
 INCLUDE path and LIBRARY path.

On a normal Unix system, something like C_INCLUDE_PATH and
LD_LIBRARY_PATH, who knows on such a system as MacOS X.

-- 
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://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] french map

2003-06-30 Thread Barry Rowlingson
Peyrard Nathalie wrote:

I would like to know if (as the usa map with Splus), it is possible with 
R to plot the french map and to add points (representing towns for 
instance) on the figure in the appropriate (x,y) system.
 You can use my Rmap library 
(http://www.maths.lancs.ac.uk/Software/Rmap/) to plot geographic maps in 
R. You then need to get the data for France. Rmap is tested mostly with 
ESRI shapefile datasets.

 Here are two web sites with French department data sets, but you must 
make sure your use of them conforms with the licensing of the data set:

http://www.cdc.gov/epiinfo/EIeurope.htm
http://www.ign.fr/affiche_rubrique.asp?rbr_id=809lng_id=FR
 Rmap is in very early stages of development, and so you may have 
problems getting it working on your machine. It is mainly tested on 
Linux platforms, so Windows users may have problems.

Barry Rowlingson
Maths and Stats
Lancaster University
Lancaster, UK
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Your Message to Bonzi.com has an Attachment [T2003063000K3]

2003-06-30 Thread TechSupport


===

IMPORTANT!

The message that you have sent to BONZI Software has a file attached to it.  Due to 
the high level of virus messages we are currently receiving, your message has been 
discarded.  Please reply to this message, make sure that there are no attachments to 
the message, and re-state your question.  Any message that arrives with no attachments 
will receive a response.

BonziMAIL messages include attachments and are not accepted by our mail system.  
Please open your regular e-mail program and write us a message using only plain text.

You will not be able to send us messages in HTML format with background or foreground 
images attached to them.  Send your messages as plain or rich text only.

IncrediMail users... With a new message open, you must go to your Message menu and 
click on Plain Text before sending your message.  Any regular message using 
IncrediMail will contain attachments and cause your message to be discarded, so you 
must convert your support message to plain text only before you send it.

Thank you for your cooperation.

Customer Service
BONZI Software

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


Re: [R] ./configure needs /sw/lib?

2003-06-30 Thread Tony Marlboro

Thank you for your reply, Professor Ripley.

 Yes, to use R CMD INSTALL directly: use R CMD INSTALL --help to find
 out how.  You need to supply --with-netCDF=/sw, I believe (but then
 the headers may not be found).

R CMD INSTALL --configure-args=--with-netCDF=/sw netCDF_1.5.tar.gz
was the correct incantation, thanks.

I spent a considerable amount of time trying to figure this out on my
own, and I think it would have been easier if the Add-on packages
section of the R Installation manual were more complete.  It would
be nice to highlight the differences between install.packages() and R
CMD INSTALL, if at least to mention the extra capabilities of R CMD INSTALL.
I would like to submit a documentation patch.  With whom should I
correspond? 

 It should be simpler to fix your OS: if you put /sw/include in your
 INCLUDE path and /sw/lib in your LIBRARY path then configure in
 netCDF should work `out of the box'.

Are you referring to environment variables called INCLUDE and LIBRARY?
I tried setting them, then running R CMD INSTALL without any extra
args to configure, and it failed.  I'm quite curious what you mean by
INCLUDE path and LIBRARY path.


Regards,
Tony

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


Re: [R] french map

2003-06-30 Thread Spencer Graves
Have you tried www.r-project.org - search - R Site Search?

There are several geographers who follow this list.  From the above 
mentioned search, I found an exchange with subject Mapping in R 
discussing such a thing dated mercredi 21 novembre 2001 17:21, from:

Christophe DECLERCQ, MD
Observatoire Régional de la Santé Nord-Pas-de-Calais
13, rue Faidherbe 59046 LILLE Cedex FRANCE
Phone +33 3 20 15 49 24
Fax   +33 3 20 55 92 30
E-mail [EMAIL PROTECTED]
hope this helps.  spencer graves

Peyrard Nathalie wrote:
Hello,

I would like to know if (as the usa map with Splus), it is possible with 
R to plot the french map and to add points (representing towns for 
instance) on the figure in the appropriate (x,y) system.
Thank you.

 Nathalie Peyrard

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


Re: [R] R CMD check

2003-06-30 Thread Prof Brian Ripley
You have an error in the R files of your package.  Before you even do
R CMD check, do try loading the package in R.

On Mon, 30 Jun 2003, John Bjørnar Bremnes wrote:

 when using R CMD check mypkg I get the error message
 ...
 * checking R files for library.dynam ... OK
 * checking generic/method consistency ... WARNING
 Error in .loadPackageQuietly(package, lib.loc) :
  Error in parse(file, n, text, prompt) : syntax error on line 95
 Execution halted
 * checking for assignment functions with final arg not named 'value' ... 
 WARNING
 Error in .loadPackageQuietly(package, lib.loc) :
  Error in parse(file, n, text, prompt) : syntax error on line 95
 Execution halted
 ...
 
 What can I do to avoid this? I use R-1.7.0 on Linux RedHat.
 
 Any suggestions are appreciated.
 
 

-- 
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://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] spatial correlation test

2003-06-30 Thread Martin Wegmann
hello, 

I want to do a test for spatial correlation.
I tried it with geary.test() but I don't understand the required input. 
x= a numeric vector the same length as the neighbours list in listw (my 
sampled data, I assume)
listw= a listw object created for example by nb2listw (well when I check 
nb2listw() I get to neighbours - an object of class nb - but I couldn't 
figure out, what nb is or how I create such a class

with sp.mantel.mc {spdep} I have the same problem: listw created by nb2listw

isn't there a more straight forward method ;-)  to check for spatial 
correlation? like x and y coordinates plus my sampled data?


thanks, Martin


BTW thanks everybody for their help with my last problem - [R] regression for 
several responses - it worked perfectly

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


[R] if else statements in R

2003-06-30 Thread Michael Rennie

Hi, there

I am a grad student struggling to get my syntax right in a model I am 
building in R.

I am trying to specify a variable,W, in a loop, such that on the first 
iteration, it is equal to Wo, my starting value, which I have already 
specified with

Wo-9.2

  On any other iteration other than the first, I want W to equal the 
previous value of W in the iteration. plus an increment from that previous 
iteration, divided by another value.  This then becomes the value used in 
all calculations in the iteration at hand.

Here is my code, that does not work:

W- function(w)
{
if (comp[i,1]=1) W[i]-Wo else
W[i]-(work[i-1,5]work[i-1,13]*/Ef)
}


work is the dataframe that I am rbinding my interations into, and the W 
variable is the 5th variable in that frame, and the additive to W is the 
13th variable in that frame.

However, this is where the program stalls on me:

{
+
+ W- function(w)
+ {
+ if (comp[i,1]=1) W[i]-Wo else
Error: syntax error
Execution halted

I've also attempted this variation;

W- function(w)

if (comp[i,1]=1) {W[i]-Wo} else
W[i]-(work[i-1,5]work[i-1,13]*/Ef)

Which meets with an equal lack of success, and stalls in the same spot as 
the previous version.

Does anyone have any hints on how to make this if else statement work to do 
what I need?  This is my first time trying to use these statements, and the 
S-plus manual i have is proving to be terribly unhelpful.

What am I doing wrong?

Mike


Michael Rennie
M.Sc. Candidate
University of Toronto at Mississauga
3359 Mississauga Rd. N.
Mississauga, ON  L5L 1C6
Ph: 905-828-5452  Fax: 905-828-3792
[[alternative HTML version deleted]]

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


[R] sample from a list of names for random groups

2003-06-30 Thread Daniele Medri
Dear R-users,

I need to sample from a list of names (people) and create 2 random groups with 
unique item. Sure sample() function is a good point to start but I can't find 
example to solve my work.

any tips? example?

Thank
-- 
Daniele Medri

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


[R] if else statements in R

2003-06-30 Thread Michael Rennie

Hi, there

I am a grad student struggling to get my syntax right in a model I am 
building in R.

I am trying to specify a variable,W, in a loop, such that on the first 
iteration, it is equal to Wo, my starting value, which I have already 
specified with

Wo-9.2

  On any other iteration other than the first, I want W to equal the 
previous value of W in the iteration. plus an increment from that previous 
iteration, divided by another value.  This then becomes the value used in 
all calculations in the iteration at hand.

Here is my code, that does not work:

W- function(w)
{
if (comp[i,1]=1) W[i]-Wo else
W[i]-(work[i-1,5]work[i-1,13]*/Ef)
}


work is the dataframe that I am rbinding my interations into, and the W 
variable is the 5th variable in that frame, and the additive to W is the 
13th variable in that frame.

However, this is where the program stalls on me:

{
+
+ W- function(w)
+ {
+ if (comp[i,1]=1) W[i]-Wo else
Error: syntax error
Execution halted

I've also attempted this variation;

W- function(w)

if (comp[i,1]=1) {W[i]-Wo} else
W[i]-(work[i-1,5]work[i-1,13]*/Ef)

Which meets with an equal lack of success, and stalls in the same spot as 
the previous version.

Does anyone have any hints on how to make this if else statement work to do 
what I need?  This is my first time trying to use these statements, and the 
S-plus manual i have is proving to be terribly unhelpful.

What am I doing wrong?

Mike

Michael Rennie
M.Sc. Candidate
University of Toronto at Mississauga
3359 Mississauga Rd. N.
Mississauga, ON  L5L 1C6
Ph: 905-828-5452  Fax: 905-828-3792
[[alternative HTML version deleted]]

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


[R] Novice Questions

2003-06-30 Thread Bruce Moore
I'm writing a program to perform linear regressions to
estimate the number of bank teller transactions per
hour of various types based upon day of week, time of
day, week of month and several prices.  I've got about
25,000 records in my dataset, 85 columns of
transaction counts (used 1 at a time), about 50
columns of binary indicators (day, week, pay period,
hour, branch), and a half dozen real valued prices.

My program hangs on some regressions as I add
interactions, probably due to logic problems in my
code or collinearity problems in the data.

1) I'm running my program via the source() command. 
It appears that source() does not print any messages
until it completes.  

Is there a way to get diagnostic messages to
print immediately rather than when the source()
command has completed?

2) I'm fairly certain that I've got some collinearity
in the data set and the interactions.  I've found an
append (Ott Toomet 5/30/2003) that talks about a
procedure to find collinearity problems using
model.matrix() to generate the dataset with
interactions and kappa() to determine the condition
number of the matrix.  

Is there a more automated way to find collinear
variables?

3) Is there a way to get lm() and/or step() or some
other package to give a model with only coefficients
that are significant at a particular level?

4) Is there a way to suppress display of a password
when using the RODBC odbcConnect() function, or to get
the function to prompt for a password?

5) What is the practical size limit on the number of
terms in model?  I know that I won't be able to
consider all interactions, but would like to have some
idea when to give up and go with what I've got.



=
Bruce Moore

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


Re: [R] if else statements in R

2003-06-30 Thread Timur Elzhov
On Mon, Jun 30, 2003 at 11:21:52AM -0400, Michael Rennie wrote:

 W- function(w)
 {
 if (comp[i,1]=1) W[i]-Wo else
== is comparison operator, but = is assignment one.
This code also doesn't work:

 x - 0
 if (x = 1)
Error: syntax error

But this works:
 if (x == 1)
+ 

Chack also help(==), help(=)

--
WBR,
Timur.

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


Re: [R] NLME Covariates

2003-06-30 Thread Douglas Bates
Harold Doran [EMAIL PROTECTED] writes:

 In HLM, one can specify a covariate at one of the levels. For
 example, if the data structure are repeated observations nested
 within students nested within schools, school size might be a
 covariate that is used at level 3, but not at the other levels. In
 HLM this is rather easy to do.
  
 However, how can one specify a covariate in R for only one of the
 levels? I have a sample data set with the structure as described
 above. I fit the unconditional model in R as
  
 model1-lme(math~year, random=~year|schoolid/childid, data=datafile)
  
 Now, if I want to enter female as a covariate at level 2 only, how
 might I modify the code to accomplish this?

There is no distinction between level 1 and level 2 variables in the
fixed-effects part of an lme model.  Once the data are organized in a
composite table (i.e. one table that includes the value of each
covariate for each observation) one simply writes a linear model
expression for the fixed effects.

You need to incorporate the female indicator into your 'datafile' data
frame.  The merge function is a good way to do this (I had forgotten
about the merge function when we spoke about this a few weeks ago).
After that you could fit a model using, say,

model2 - lme(math ~ year * female, random=~year|schoolid/childid,
  data = datafile)

-- 
Douglas Bates[EMAIL PROTECTED]
Statistics Department608/262-2598
University of Wisconsin - Madisonhttp://www.stat.wisc.edu/~bates/

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


Re: [R] if else statements in R

2003-06-30 Thread Andrew Perrin
This is untested, so try it first, but my approach would be:

W- function(w)
{
W[i]-ifelse(comp[i,1]==1, Wo, (work[i-1,5]work[i-1,13]*/Ef))
}

Best,
Andy Perrin

--
Andrew J Perrin - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
[EMAIL PROTECTED] * andrew_perrin (at) unc.edu


On Mon, 30 Jun 2003, Michael Rennie wrote:


 Hi, there

 I am a grad student struggling to get my syntax right in a model I am
 building in R.

 I am trying to specify a variable,W, in a loop, such that on the first
 iteration, it is equal to Wo, my starting value, which I have already
 specified with

 Wo-9.2

   On any other iteration other than the first, I want W to equal the
 previous value of W in the iteration. plus an increment from that previous
 iteration, divided by another value.  This then becomes the value used in
 all calculations in the iteration at hand.

 Here is my code, that does not work:

 W- function(w)
 {
 if (comp[i,1]=1) W[i]-Wo else
 W[i]-(work[i-1,5]work[i-1,13]*/Ef)
 }


 work is the dataframe that I am rbinding my interations into, and the W
 variable is the 5th variable in that frame, and the additive to W is the
 13th variable in that frame.

 However, this is where the program stalls on me:

 {
 +
 + W- function(w)
 + {
 + if (comp[i,1]=1) W[i]-Wo else
 Error: syntax error
 Execution halted

 I've also attempted this variation;

 W- function(w)

 if (comp[i,1]=1) {W[i]-Wo} else
 W[i]-(work[i-1,5]work[i-1,13]*/Ef)

 Which meets with an equal lack of success, and stalls in the same spot as
 the previous version.

 Does anyone have any hints on how to make this if else statement work to do
 what I need?  This is my first time trying to use these statements, and the
 S-plus manual i have is proving to be terribly unhelpful.

 What am I doing wrong?

 Mike


 Michael Rennie
 M.Sc. Candidate
 University of Toronto at Mississauga
 3359 Mississauga Rd. N.
 Mississauga, ON  L5L 1C6
 Ph: 905-828-5452  Fax: 905-828-3792
   [[alternative HTML version deleted]]

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


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


RE: [R] french map

2003-06-30 Thread Christophe Declercq
Nathalie,

You could have a look at the web site of the Institut Géographique National
(http://www.ign.fr) where you can download a free SHAPEFILE with polygon
data for the French départements. You can choose one of two projections:
LAMBERT II étendu or LAMBERT 93
(http://www.ign.fr/affiche_rubrique.asp?rbr_id=810lng_id=FR). In the
associated DBF file, you get the name and the x,y coordinates for the
préfecture of each département.

You could use these data in R with one of the packages which read shapefiles
(for example, 'shapefiles' which is on CRAN or the draft package 'maptools'-
see http://spatial.nhh.no/R/ - which is already very useful as it is).

I hope it helps.

Christophe
--
Christophe DECLERCQ, MD
Observatoire Régional de la Santé Nord-Pas-de-Calais
13, rue Faidherbe 59046 LILLE Cedex FRANCE
Phone +33 3 20 15 49 24
Fax   +33 3 20 55 92 30
E-mail [EMAIL PROTECTED]

 -Message d'origine-
 De : [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] la part de Peyrard Nathalie
 Envoyé : lundi 30 juin 2003 15:21
 À : [EMAIL PROTECTED]
 Objet : [R] french map


 Hello,

 I would like to know if (as the usa map with Splus), it is possible with
 R to plot the french map and to add points (representing towns for
 instance) on the figure in the appropriate (x,y) system.
 Thank you.

   Nathalie Peyrard

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


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


Re: [R] spatial correlation test

2003-06-30 Thread Stephane DRAY
At 18:48 30/06/2003, Martin Wegmann wrote:
hello,

I want to do a test for spatial correlation.
I tried it with geary.test() but I don't understand the required input.
x= a numeric vector the same length as the neighbours list in listw (my
sampled data, I assume)
listw= a listw object created for example by nb2listw (well when I check
nb2listw() I get to neighbours - an object of class nb - but I couldn't
figure out, what nb is or how I create such a class
with sp.mantel.mc {spdep} I have the same problem: listw created by nb2listw

isn't there a more straight forward method ;-)  to check for spatial
correlation? like x and y coordinates plus my sampled data?
This functions require a list of spatial weights for each geographical 
unit. To construct this list, you must firstly establish the neighborhood 
relationships (who are the neighbors of a point). There are different ways 
to construct this neighborhood: based on distances (dnearneigh), number of 
nearest neighbors (knearneigh)... Then, you must transform this 
neighborhood to weights (see nb2listw for example). Here is a small example 
requiring the tripack library based on tesselation and voronoi mosaic to 
create the neighboorhood:

xy=matrix(rnorm(20),5,2)
z=rnorm(5)
library(spdep)
mynb=tri2nb(xy)
mylw=nb2listw(mynb)
geary.mc(z,mylw,10)

Monte-Carlo simulation of Geary's C

data:  z
weights: mylw
number of simulations + 1: 11
There is no simplest method.

statistic = 0.8384, observed rank = 2, p-value = 0.1818
alternative hypothesis: less
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] within group variance of the coeficients in LME

2003-06-30 Thread Douglas Bates
J.R. Lockwood [EMAIL PROTECTED] writes:

  
  Dear listers, 
  
  I can't find the variance or se of the coefficients in a multilevel model 
  using lme. 
  
 
 The component of an lme() object called apVar provides the estimated
 asymptotic covariance matrix of a particular transformation of the
 variance components. Dr. Bates can correct me if I'm wrong but I
 believe it is the matrix logarithm of Cholesky decomposition of the
 covariance matrix of the random effects.  I believe the details are in
 the book by Pinheiro and Bates.  Once you know the transformation you
 can use the apVar elements to get estimated asympotic standard
 errors for your variance components estimates using the delta method.
 
 J.R. Lockwood
 412-683-2300 x4941
 [EMAIL PROTECTED]
 http://www.rand.org/methodology/stat/members/lockwood/

First, thanks to those who answered the question.  I have been away
from my email for about a week and am just now catching up on the
r-help list.

As I understand the original question from Andrej he wants to obtain
the standard errors for coefficients in the fixed effects part of the
model.  Those are calculated in the summary method for lme objects and
returned as the component called 'tTable'.  Try

library(nlme)
example(lme)
summary(fm2)$tTable

to see the raw values.

Other software for fitting mixed-effects models, such as SAS PROC
MIXED and HLM, return standard errors along with the estimates of the
variances and covariances of the random effects.  We don't return
standard errors of estimated variances because we don't think they are
useful.  A standard error for a parameter estimate is most useful when
the distribution of the estimator is approximately symmetric, and
these are not.

Instead we feel that the variances and covariances should be converted
to an unconstrained scale, and preferably a scale for which the
log-likelihood is approximately quadratic.  The apVar component that
you mention is an approximate variance-covariance matrix of the
variance components on an unbounded parameterization that uses the
logarithm of any standard deviation and Fisher's z transformation of
any correlations.  If all variance-covariance matrices being estimated
are 1x1 or 2x2 then this parameterization is both unbounded and
unconstrained.  If any are 3x3 or larger then this parameterization
must be further constrained to ensure positive definiteness.
Nevertheless, once we have finished the optimization we convert to
this 'natural' parameterization to assess the variability of the
estimates because these parameters are easily interpreted.

The actual optimization of the profiled log-likelihood is done using
the log-Cholesky parameterization that you mentioned because it is
always unbounded and unconstrained.  Interpreting elements of this
parameter vector is complicated.

I hope this isn't too confusing.

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


[R] Seemingly unrelated regressions

2003-06-30 Thread Richard A. Hinrichsen
Is there an implementation of SUR in R?
These are used commonly in economics.
Thanks

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


Re: [R] sample from a list of names for random groups

2003-06-30 Thread Spencer Graves
 n1 - 2
 n2 - 3
 (S - sample(letters, n1+n2))
[1] f a d n l
 (S1 - sample(S, n1))
[1] l n
 (S2 - S[!is.element(S, S1)])
[1] f a d

hope this helps.  spencer graves
Daniele Medri wrote:
Dear R-users,

I need to sample from a list of names (people) and create 2 random groups with 
unique item. Sure sample() function is a good point to start but I can't find 
example to solve my work.

any tips? example?

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


Re: [R] if else statements in R

2003-06-30 Thread kjetil brinchmann halvorsen
On 30 Jun 2003 at 11:24, Michael Rennie wrote:

Hola!

 
 Hi, there
 
 I am a grad student struggling to get my syntax right in a model I am 
 building in R.
 
 I am trying to specify a variable,W, in a loop, such that on the first 
 iteration, it is equal to Wo, my starting value, which I have already 
 specified with
 
 Wo-9.2
 
   On any other iteration other than the first, I want W to equal the 
 previous value of W in the iteration. plus an increment from that previous 
 iteration, divided by another value.  This then becomes the value used in 
 all calculations in the iteration at hand.
 
 Here is my code, that does not work:

There are multiple problems with this code
1)  You use W as a name of a function AND as a name of an array 
inside that function. Might not be a syntax error (?), but is asking 
for problems. Use an other name for your array, and assign it first.
2) The variable i is not given a value anywhere in your code.
3)The condition in the if statement uses = and not ==, = is 
assignment, == is test lfor equality. Actuallt, your comp[i,1] gets 
assigned 1, that is also the value of the assignment, and in the 
logical test the 1 will be interpreted as TRUE, so you will never get 
the else branch!

 
 W- function(w)
 {
 if (comp[i,1]=1) W[i]-Wo else
 W[i]-(work[i-1,5]work[i-1,13]*/Ef)
 }

Maybe youwant something like:

W - function(w) {
result - numeric(length=?)
if (comp[i,1]==1) result[i] - W0 else
  result[i] - work[i-1,5] * work[i-1,13]/Ef
}

but it is really impossible to tell, as your function are using 
global variables. Another good idea is to avoid global variables.

Kjetil Halvorsen


 
 
 work is the dataframe that I am rbinding my interations into, and the W 
 variable is the 5th variable in that frame, and the additive to W is the 
 13th variable in that frame.
 
 However, this is where the program stalls on me:
 
 {
 +
 + W- function(w)
 + {
 + if (comp[i,1]=1) W[i]-Wo else
 Error: syntax error
 Execution halted
 
 I've also attempted this variation;
 
 W- function(w)
 
 if (comp[i,1]=1) {W[i]-Wo} else
 W[i]-(work[i-1,5]work[i-1,13]*/Ef)
 
 Which meets with an equal lack of success, and stalls in the same spot as 
 the previous version.
 
 Does anyone have any hints on how to make this if else statement work to do 
 what I need?  This is my first time trying to use these statements, and the 
 S-plus manual i have is proving to be terribly unhelpful.
 
 What am I doing wrong?
 
 Mike
 
 Michael Rennie
 M.Sc. Candidate
 University of Toronto at Mississauga
 3359 Mississauga Rd. N.
 Mississauga, ON  L5L 1C6
 Ph: 905-828-5452  Fax: 905-828-3792
   [[alternative HTML version deleted]]
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help

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


Re: [R] degrees of freedom in a LME model

2003-06-30 Thread Douglas Bates
Federico Calboli [EMAIL PROTECTED] writes:

 Dear All,
 
 I am analysing some data for a colleague (not my data, gotta be published
 so I cannot divulge).
 
 My response variable is the number of matings observed per day for some
 fruitlies.
 
 My factors are:
 Day: the observations were taken on 9 days
 Regime: 3 selection regimes
 Line: 3 replicates per selection regime.
 
 I have 81 observations in total
 
 The lines are coded A to I, so I do not need to do any extra grouping.
 
 my model is:
 
 anova(lme(Matings ~ Day * Regime, random = ~1| Line/Day, mydata))
 
 I would expect to have:
 1 df per Day
 2 df per Regime
 2 df per Day * Regime
 6 df per Line %in% Regime
 6 df per Day * Line %in% Regime,
 
 
 so my anova would have:
 
   numDF   denDF
 int   1   63
 Day   1   6
 Regime2   6
 D*R   2   6
 
 what I get is:
 
   numDF   denDF
 int   1   69
 Day   1   69
 Regime2   6
 D*R   2   69
 
 why is lme not calculating correctly the Line/Day interation ?

I think your calculation is based on using only within-strata
information whereas lme uses both within-strata and between-strata
information for estimates of effects.

The way that we calculate denominator degrees of freedom is described
on pp. 90-91 of Pinheiro and Bates (2000).  For each term in the
fixed-effects we determine the innermost level of the random effects
at which is it changing.  Because Regime is constant for each Line it
has the fewest degrees of freedom but Day is changing within Line so
terms in Day have more degrees of freedom.  Is this what you intended?

I must admit I am having difficulty understanding the structure of the
experiment but it is still Monday morning for me so perhaps that is
not surprising.

 I am using R 1.7.0 under W2K, although I updated the packages and I get the
 warning nlme lib built under R1.7.1...
 
 Regards,
 
 Federico 


-- 
Douglas Bates[EMAIL PROTECTED]
Statistics Department608/262-2598
University of Wisconsin - Madisonhttp://www.stat.wisc.edu/~bates/

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


[R] make 1.7.1 crashes in Mac OS X

2003-06-30 Thread Michael Herron
I trying to compile R-.1.7.1 under OS X.

Configure worked fine; then make crashes with:

/sw/lib/libg2c.a(err.o) definition of common _f__formatted (size 4)
/sw/lib/libg2c.a(err.o) definition of common _f__hiwater (size 4)
/sw/lib/libg2c.a(err.o) definition of common _f__putn (size 4)
/sw/lib/libg2c.a(err.o) definition of common _f__reading (size 4)
/sw/lib/libg2c.a(err.o) definition of common _f__recpos (size 4)
/sw/lib/libg2c.a(err.o) definition of common _f__sequential (size 4)
/sw/lib/libg2c.a(err.o) definition of common _f__getn (size 4)
/sw/lib/libg2c.a(err.o) definition of common _f__icptr (size 4)
/sw/lib/libg2c.a(err.o) definition of common f(short, void, int, char) 
(size 4)
/usr/bin/libtool: internal link edit command failed
make[4]: *** [libRlapack.dylib] Error 1
make[3]: *** [R] Error 2
make[2]: *** [R] Error 1
make[1]: *** [R] Error 1
make: *** [R] Error 1
[beethoven:~/INSTALL/R-1.7.1] herron%

Any ideas here?

Thanks, michael

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


Re: [R] make 1.7.1 crashes in Mac OS X

2003-06-30 Thread Prof Brian Ripley
This is described in the MacOS X section of the R-admin manual.
The file INSTALL does ask you to read it: please don't expect R-help 
readers to do so for you.

On Mon, 30 Jun 2003, Michael Herron wrote:

 I trying to compile R-.1.7.1 under OS X.
 
 Configure worked fine; then make crashes with:
 
 /sw/lib/libg2c.a(err.o) definition of common _f__formatted (size 4)
 /sw/lib/libg2c.a(err.o) definition of common _f__hiwater (size 4)
 /sw/lib/libg2c.a(err.o) definition of common _f__putn (size 4)
 /sw/lib/libg2c.a(err.o) definition of common _f__reading (size 4)
 /sw/lib/libg2c.a(err.o) definition of common _f__recpos (size 4)
 /sw/lib/libg2c.a(err.o) definition of common _f__sequential (size 4)
 /sw/lib/libg2c.a(err.o) definition of common _f__getn (size 4)
 /sw/lib/libg2c.a(err.o) definition of common _f__icptr (size 4)
 /sw/lib/libg2c.a(err.o) definition of common f(short, void, int, char) 
 (size 4)
 /usr/bin/libtool: internal link edit command failed
 make[4]: *** [libRlapack.dylib] Error 1
 make[3]: *** [R] Error 2
 make[2]: *** [R] Error 1
 make[1]: *** [R] Error 1
 make: *** [R] Error 1
 [beethoven:~/INSTALL/R-1.7.1] herron%
 
 Any ideas here?
 
 Thanks, michael
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help
 

-- 
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://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] dropping factor levels in subset

2003-06-30 Thread Douglas Bates
Adaikalavan Ramasamy [EMAIL PROTECTED] writes:

 Another option is pruneLevels() in library nlme.
 
 x - factor( c( 0,1,2,1,2 ) )
  x
 [1] 0 1 2 1 2
 Levels: 0 1 2
  pruneLevels( x[-1] )
 [1] 1 2 1 2
 Levels: 1 2

That function has been removed from the latest release of the nlme
package because it not needed.  All uses of pruneLevels in nlme were
replaced by code of the form

 myfactor[] = myfactor[, drop = TRUE]

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


Re: [R] spatial correlation test

2003-06-30 Thread Martin Wegmann
On Monday 30 June 2003 15:23, Barry Rowlingson wrote:
   Think you may be looking at the wrong sort of spatial correlation! For
 Geary tests you are comparing 'adjacent' objects, where adjacency is
 defined however you want - N-nearest neighbours, shared border between
 regions etc etc.

sorry, I misunderstood the purpose of geary's I test, thanks for this info. 

   When you say 'sampled data' it sounds more like you've got samples
 taken at locations, and you want to investigate spatial correlation as a
 function of distance between samples? Am I guessing right?

Yes you are right. I want to look for spatial correlation of my samples as a 
function of distances between sampling sites (x,y coords). 

   Take a look at some of the R kriging libraries, which will have
 functions to plot variograms. This is a plot of something like
 E(|Y_i - Y_j|) against distance.

 Baz

I found variograms() and correlograms(), but is there a way to get the a 
p-value for spatial correlation? 
additionaly I found sp.correlogram() but again with this mysterious nb 
class.


thanks, martin

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


[R] pairs and points

2003-06-30 Thread Christian Hennig
Hi,

I am plotting a matrix/data frame with 10 variables by pairs. Is it
possible to add another 10-dimensional point afterwards by something like
points does for two-dimensional plots?

Best,
Christian

-- 
***
Christian Hennig
Seminar fuer Statistik, ETH-Zentrum (LEO), CH-8092 Zuerich (currently)
and Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg
[EMAIL PROTECTED], http://stat.ethz.ch/~hennig/
[EMAIL PROTECTED], http://www.math.uni-hamburg.de/home/hennig/
###
ich empfehle www.boag.de

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


Re: [R] degrees of freedom in a LME model

2003-06-30 Thread Federico Calboli
Dear Prof. Bates,

Thank you for your reply. I did actually check the book at pages 89-92, but
I have to say I found it a bit cryptic, if not downright confusing, for a
genetist like me. Any day of the week. 

To use the example in the book, I cannot see why MACHINE is inner to
WORKER. Or where the Pi = sum of df for the term estimatet at level i... 

To me it's just a two way anova with one random effect + one interaction.
My df correspond to those in the book, but I calculated them in the bog
standard way of 2 df for 3 machines, 5 df for 6 workers and 2 * 5 = 10 df
for the interaction...oh well...

I attach the datasest (I did a sample with replace = TRUE, should have
thought of this earlier...). I hope thing would be clearer. It is obvious
that if I consider day a factor, as I have just one datapoint per day per
line within regime, I end up using all my degrees of freedom:

2 df for 3 regimes
6 df for line within regime
8 df for day (9 days, day as factor)
16 df for regime * day
48 df for line * day
total 80 df, with 0 df remaining for the error. A bit of a problem I
daresay, but I did not collect the data!

BUT I did calculate my anova considering day as a continuous variable,

2 df for 3 regimes
6 df for line within regime
1 df for day (day as a number)
2 df for regime * day
6 df for line * day
total 17 df, with 63 df remaining for the error. 

I still do not get why the interaction term Regime*Day is not tested on the
interaction Line-in-regime*Day... In my analysis LME is clumping Error and
Line-in-regime*Day together, judging by the df I was talking about in my
previuos email. To me it should be just another bog standard
situation...But if I were smart enough to be a statistician I would not be
here doing genetics ;)

Regards,
Federico Calboli



Day LineRegime  Matings
2   501 es  0.4
4   501 es  0.32989691
9   501 es  0.48484848
11  501 es  0.72727273
16  501 es  0.34042553
18  501 es  0.56470588
25  501 es  0.37509377
30  501 es  0.
32  501 es  0.7778
2   502 es  0.57142857
4   502 es  1.0667
9   502 es  0.16
11  502 es  0.4
16  502 es  0.4
18  502 es  0.
25  502 es  0.80808081
30  502 es  0.48
32  502 es  0.25531915
2   503 es  0
4   503 es  0.72727273
9   503 es  0.3
11  503 es  0.7778
16  503 es  0.34042553
18  503 es  1.0667
25  503 es  0.32989691
30  503 es  1.2444
32  503 es  0.19153725
2   fb1 fb  0.72727273
4   fb1 fb  0.42105263
9   fb1 fb  0.32989691
11  fb1 fb  0.32323232
16  fb1 fb  0.37509377
18  fb1 fb  0.51612903
25  fb1 fb  0.4
30  fb1 fb  0.24742268
32  fb1 fb  0.24742268
2   fb2 fb  1.
4   fb2 fb  0.25263158
9   fb2 fb  0.6667
11  fb2 fb  1.0667
16  fb2 fb  0.97959184
18  fb2 fb  0.42105263
25  fb2 fb  0.57142857
30  fb2 fb  1.1556
32  fb2 fb  0.80808081
2   fb3 fb  0.18952106
4   fb3 fb  0.6667
9   fb3 fb  1.22033898
11  fb3 fb  0.35955056
16  fb3 fb  1.68421053
18  fb3 fb  0.57461174
25  fb3 fb  0.93506493
30  fb3 fb  0.80808081
32  fb3 fb  0.57461174
2   mb1 mb  0.
4   mb1 mb  0.3902439
9   mb1 mb  0.42105263
11  mb1 mb  0.48484848
16  mb1 mb  0.5556
18  mb1 mb  1.68421053
25  mb1 mb  0.4
30  mb1 mb  0.16
32  mb1 mb  0.09523809
2   mb2 mb  0.7778
4   mb2 mb  0.68817204
9   mb2 mb  0.25263158
11  mb2 mb  1.
16  mb2 mb  0.5
18  mb2 mb  0.37509377
25  mb2 mb  0.16494845
30  mb2 mb  2.46153846
32  mb2 mb  0.47058824
2   mb3 mb  1.0667
4   mb3 mb  0.5
9   mb3 mb  0.5
11  mb3 mb  0.38095238
16  mb3 mb  0.26373626
18  mb3 mb  0.87912088
25  mb3 mb  0.5556
30  mb3 mb  0.74418605
32  mb3 mb  1.


I think your calculation is based on using only within-strata
information whereas lme uses both within-strata and between-strata
information for estimates of effects.

The way that we calculate denominator degrees of freedom is described
on pp. 90-91 of Pinheiro and Bates (2000).  For each term in the
fixed-effects we determine the innermost level of the random effects
at which is it changing.  Because Regime is constant for each 

Re: [R] spatial correlation test

2003-06-30 Thread Roger Bivand
(I think Barry Rowlingson replied off-list, both his advice and Stéphane 
Dray's reply are relevant)

On Mon, 30 Jun 2003, Martin Wegmann wrote:

 On Monday 30 June 2003 15:23, Barry Rowlingson wrote:
Think you may be looking at the wrong sort of spatial correlation! For
  Geary tests you are comparing 'adjacent' objects, where adjacency is
  defined however you want - N-nearest neighbours, shared border between
  regions etc etc.
 
 sorry, I misunderstood the purpose of geary's I test, thanks for this info. 
 
When you say 'sampled data' it sounds more like you've got samples
  taken at locations, and you want to investigate spatial correlation as a
  function of distance between samples? Am I guessing right?
 
 Yes you are right. I want to look for spatial correlation of my samples as a 
 function of distances between sampling sites (x,y coords). 
 
Take a look at some of the R kriging libraries, which will have
  functions to plot variograms. This is a plot of something like
  E(|Y_i - Y_j|) against distance.
 
  Baz
 
 I found variograms() and correlograms(), but is there a way to get the a 
 p-value for spatial correlation? 
 additionaly I found sp.correlogram() but again with this mysterious nb 
 class.
 
There is a literature that you will find referenced on help pages of the 
functions that you are interested in. For geary.test(), the reference is: 
Cliff, A. D., Ord, J. K. 1981 Spatial processes, Pion, p. 21.

For sp.correlogram(): Cliff, A. D., Ord, J. K. 1981 Spatial processes,
Pion, pp.  118-122, Martin, R. L., Oeppen, J. E. 1975 The identification
of regional forecasting models using space-time correlation functions,
Transactions of the Institute of British Geographers, 66, 95-118.

These are the places to look first. For nb2listw() - Tiefelsdorf, M.,
Griffith, D. A., Boots, B. 1999 A variance-stabilizing coding scheme for
spatial link matrices, Environment and Planning A, 31, pp. 165-180.

The nb class defines neighbour relations needed to carry out further
calculations, and is a list of integer vectors containing neighbour
region number ids, quoting its documentation in the example Stéphane 
Dray used, tri2nb() to generate neighbours from points by triangulation.

If your point data are not areal but are sampled from a possibly
continuous surface, then, as Barry Rowlingson suggested, you could look at
one or other of the geostatistical packages, for example sgeostat.
However, asking for a p-value implies that you are testing some kind of a
hypothesis, doesn't it?

It is possible to do Moran tests within a testing framework in
sp.correlogram(), and indeed to provide nb2listw() with inverse distance
weights, but it isn't clear that this would answer your underlying 
research question.

Roger

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: [EMAIL PROTECTED]

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


[R] date to age

2003-06-30 Thread William Briggs
I have files which have columns of data that look like this:

DOB
9/27/1964
...

That is, dates in month/day/year format.  When variables like DOB are read
in, they are converted to factors.

So, I wrote this to convert from date to age in years:

age-function(x)
{as.numeric(Sys.time()-strptime(as.character(x),format=%m/%d/%Y))/365.25}

This isn't very precise or pretty, but it works.

Does anybody have something better?

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


Re: [R] date to age

2003-06-30 Thread Prof Brian Ripley
On Mon, 30 Jun 2003, William Briggs wrote:

 I have files which have columns of data that look like this:
 
 DOB
 9/27/1964
 ...
 
 That is, dates in month/day/year format.  When variables like DOB are read
 in, they are converted to factors.

Why?  You can avoid that, of course.

 So, I wrote this to convert from date to age in years:
 
 age-function(x)
 {as.numeric(Sys.time()-strptime(as.character(x),format=%m/%d/%Y))/365.25}
 
 This isn't very precise or pretty, but it works.
 
 Does anybody have something better?

Convert to POSIXlt and compare differences in years, months, days etc.
Write an extension to difftime() to handle years and contribute it?

-- 
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://www.stat.math.ethz.ch/mailman/listinfo/r-help


Re: [R] Seemingly unrelated regressions

2003-06-30 Thread SATO Masaei
 Is there an implementation of SUR in R?
 These are used commonly in economics.
 Thanks
 
 -- 
 Richard A. Hinrichsen

You can use the function 'sur' in the library 'systemfit'.

Masaei Sato

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


[R] Deciphering an error message

2003-06-30 Thread Suzanne E. Blatt

Hello,

I'm working in spatstat and having difficulty with the ppp objects.  I can get a ppp 
object for one set of data, but with the same code applied to a second data set (all I 
am changing is the field identifier), I get the following error message:

Error in switch(w$type, rectangle={: internal error: some total scores are neither 0 
nor 1

Any thoughts on what this means and how to correct it would be most appreciated.

Thanks,
Suzanne

__
McAfee VirusScan Online from the Netscape Network.
Comprehensive protection for your entire computer. Get your free trial today!
http://channels.netscape.com/ns/computing/mcafee/index.jsp?promo=393397

Get AOL Instant Messenger 5.1 free of charge.  Download Now!

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


Re: [R] Novice Questions

2003-06-30 Thread Spencer Graves
Hi, Bruce:

	  I'm overwhelmed.  Questioners seem to get quicker, more informative 
responses to questions that are short, well written and easily and 
quickly understood, and preferably include a toy example that someone 
else can run quickly to reproduce the problem and to evaluate 
alternative solutions.

	  I see you are using source and would like to get more output.  Did 
you check ?source?  This function in R has arguments echo and 
verbose, which may produce what you want.  If you've already tried 
that, then the problem may be output buffering, and I don't know how to 
modify that parameter.  A search of www.r-project.org - search - R 
Site Search might help.  Or ask a question focused specifically on 
that, giving also which version of R you are using under which operating 
system.

	  I rarely use source.  More often, I have R commands in another file 
and copy and paste into R the commands I want to run.  That makes it 
easier for me to isolate errors, etc.

	  This does not address all your questions, but it's a start.

Hope this helps.
spencer graves
Bruce Moore wrote:
I'm writing a program to perform linear regressions to
estimate the number of bank teller transactions per
hour of various types based upon day of week, time of
day, week of month and several prices.  I've got about
25,000 records in my dataset, 85 columns of
transaction counts (used 1 at a time), about 50
columns of binary indicators (day, week, pay period,
hour, branch), and a half dozen real valued prices.
My program hangs on some regressions as I add
interactions, probably due to logic problems in my
code or collinearity problems in the data.
1) I'm running my program via the source() command. 
It appears that source() does not print any messages
until it completes.  

Is there a way to get diagnostic messages to
print immediately rather than when the source()
command has completed?
2) I'm fairly certain that I've got some collinearity
in the data set and the interactions.  I've found an
append (Ott Toomet 5/30/2003) that talks about a
procedure to find collinearity problems using
model.matrix() to generate the dataset with
interactions and kappa() to determine the condition
number of the matrix.  

Is there a more automated way to find collinear
variables?
3) Is there a way to get lm() and/or step() or some
other package to give a model with only coefficients
that are significant at a particular level?
4) Is there a way to suppress display of a password
when using the RODBC odbcConnect() function, or to get
the function to prompt for a password?
5) What is the practical size limit on the number of
terms in model?  I know that I won't be able to
consider all interactions, but would like to have some
idea when to give up and go with what I've got.


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


[R] dev.copy()

2003-06-30 Thread David Brahm
In a batch script (i.e. there is no screen device), I would like to create both
a PDF file and a PNG file from the same plot.  I thought this would be the way
to do it, but it isn't:

 R bitmap(copy.png, png16m, res=300)
 R pdf(copy.pdf)
 R plot(1:10, 1:10) # Plot into pdf file
 R dev.copy(which=2)# Copy to png file
 R dev.off(3)   # Close pdf
 R dev.off(2)   # Close png

The PDF comes out fine, but the PNG appears blank.  Any ideas what I'm doing
wrong?  TIA.
-- 
  -- David Brahm ([EMAIL PROTECTED])

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


[R] Constructing loops in which i+1st element depends on ith

2003-06-30 Thread Michael Rennie

I feel greedy posting for help twice in one day- please forgive me, but the 
thesis can't wait.

I have been trying to get an “if…else” statement working in a loop I am 
writing, in which I specify a variable value to 9.2 (Wo) on the first 
iteration, but for subsequent iterations, to adopt a value as a function of 
variables from the previous iteration.

When I comment out the “if…else” statement, let W = Wo, and adjust the rest of 
the file so I am reading the first row of the variables specified instead of 
entire columns in my calculations, the calculations all work nicely without 
errors - I get the numbers I ought to in one row of “bio”.

When I activate the loop and try to run the file with “the if….else”, it looks 
like it wants to work, but here’s where it stalls;


Error in [-(*tmp*, i, value = ((bio[i - 1, 1] * bio[i - 1, 9])/Ef)) : 
nothing to replace with
Execution halted

(see complete data file below)...

I guess it’s because it can’t find the alternate case because it hasn’t written 
it yet. 

So, my problem is two-fold:

1.  How can I write my loop properly so that at the end of each iteration, 
it records the row of data from “bio” such that I can cbind it back to my “Day” 
data?

2.  How can I specify the loop to use information from the i+1st element in 
calculations for calculations in the ith? 

I’m pretty sure my problem is in where I create and specify files in the loop, 
but beyond that, I don’t know.

Here’s the part of my command file that’s giving me trouble.  Everything before 
this is simply specifying variable names to numbers, which is not giving be 
problems.



#Bring in temp file

temper - scan(temp2.dat, na.strings = ., list(Day=0, Temp=0))

#Day = day on which iteration begins, starts at day 1, ends on 366
#Temp = temperature

Day - temper$Day ; Temp-temper$Temp ; 

temp- cbind (Day, Temp)

#temp [,2]

p- 0.558626306252032
ACT - 1.66764519286918

Vc-((CTM-temp[,2])/(CTM-CTO))
Vr-((RTM-temp[,2])/(RTM-RTO))


comp- cbind (Day, Temp, Vc, Vr)


bio-NULL
M- length(Day) #number of days iterated
for (i in 1:M)
{

weight- function(Day)
{
W-NULL
if (Day[i]==1) W[i] - Wo
{W[i] - ((bio[i-1,1]*bio[i-1,9])/Ef)
}
W
}

W-weight(Day)
#W-Wo

C- p*CA*(W^CB)*((comp[,3]^Xc)*(exp(Xc*(1-comp[,3]*Pc

ASMR- (ACT*RA*(W^(RB))*((comp[,4]^Xa)*(exp(Xa*(1-comp[,4])

SMR- (ASMR/ACT)

A- (ASMR-SMR)

F- (FA*(comp[,2]^FB)*(exp(FG*p))*C)

U- (UA*(comp[,2]^UB)*(exp(UG*p))*(C-F))

SDA- (S*(C-F))

Gr- (C-(ASMR+F+U+SDA))

bio- rbind(c(W, C, ASMR, SMR, A, F, U, SDA, Gr))

dimnames (bio) -list(NULL, c
(W, C, ASMR, SMR, A, F, U, SDA, Gr))

}

bio


I would be grateful for any suggestions people might have.

Thanks, 

Mike



-- 
Michael Rennie
M.Sc. Candidate
University of Toronto at Mississauga
3359 Mississauga Rd. N.
Mississauga ON  L5L 1C6
Ph: 905-828-5452  Fax: 905-828-3792

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


Re: [R] sample from a list of names for random groups

2003-06-30 Thread kjetil brinchmann halvorsen
On 30 Jun 2003 at 17:11, Daniele Medri wrote:

You should really try to specify better what you want. Lets try

names # character vector with your names
m - length(names)
n1 - 5
n2 - 10
muestra - sample(names, m, replace=FALSE)
muestra1 - muestra[1:n1]
muestra2 - muestra[(n1+1):(n1+n2)]

Is this what you want?

Kjetil Halvorsen



 Dear R-users,
 
 I need to sample from a list of names (people) and create 2 random groups with 
 unique item. Sure sample() function is a good point to start but I can't find 
 example to solve my work.
 
 any tips? example?
 
 Thank
 -- 
 Daniele Medri
 
 __
 [EMAIL PROTECTED] mailing list
 https://www.stat.math.ethz.ch/mailman/listinfo/r-help

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


[R] crossed random effects

2003-06-30 Thread Sarah Mclean
Hi,

I have a data set on germination and plant growth with
the following variables:

dataset=fm
mass (response)
sub (fixed effect)
moist (fixed effect)
pop (fixed effect)
mum (random effect nested within population)
iheight (covariate)
plot (random effect- whole plot factor for split-plot
design).

I want to see if moist or sub interacts with mum for
any of the pops, but I am getting an error message. 

This is the formula I used:
fm$pmu - getGroups(fm, ~1|pop/mum, level=2)
fm$grp = as.factor(rep(1,nrow(fm)))
fm$pl - getGroups(fm, ~1|plot)
fm$mo - getGroups(fm, ~1|moist)
fm$su - getGroups(fm, ~1|sub)
 fm1 - lme(sqrt(mass) ~ iheight + moist*sub*pop,
data=fm, random=list(grp=pdBlocked(list(pdIdent(~pl -
1), pdIdent(~pmu - 1),  pdIdent(~pmu:su - 1),
pdIdent(~pmu:mo - 1)
Error in chol((value + t(value))/2) : non-positive
definite matrix in chol

I know the problem is with the random interaction
terms, but I don't know how to overcome this.

Any advice would be greatly appreciated. I'm new to R
and analysis such as this.

Thank you,

Sarah Mclean
[EMAIL PROTECTED]


http://mobile.yahoo.com.au - Yahoo! Mobile
- Check  compose your email via SMS on your Telstra or Vodafone mobile.

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


[R] Creating a loop that works....

2003-06-30 Thread Michael Rennie

Hi there,

First off, thanks to everyone who has helped me so far.  Sorry to keep 
pestering you all.

I'm including my code here, and I will comment down it where it is that I am 
having problems figuring out how to write this damn thing.


 temper - scan(temp2.dat, na.strings = ., list(Day=0, Temp=0))
Read 366 records
 
 Day - temper$Day ; Temp-temper$Temp ; 
 
 temp- cbind (Day, Temp)
 #Day = number of days modelled, Temp = daily avg. temp.
 #temp [,2]
 
 p- 0.558626306252032
 ACT - 1.66764519286918
 
 Vc-((CTM-temp[,2])/(CTM-CTO))
 Vr-((RTM-temp[,2])/(RTM-RTO))
 
 
 comp- cbind (Day, Temp, Vc, Vr)
 
 
 bio-NULL
 M- length(Day) #number of days iterated
 for (i in 1:M)
+ {
+ 
+ weight- function(Day)
+ {
+ W-NULL
+   if (Day[i]==1) {W[i] - Wo}
+ elseif (Day[i]1) {W[i] - ((bio[i-1,1]*bio[i-1,9])/Ef)
+   }
+   W
+ }
+ 
+ W-weight(Day)

The problem, as many of you have already identified, is right here. I hope I 
finally have the syntax right, but even if the if else is coded properly, I 
don't think R can find the values in the second condition I list. I need W in 
each step of the iteration to change slightly, based on the mess of 
calculations below (which are using parameters that I have already specified).  
After all the calculations are made, I hope to get values in bio[i,1] and bio
[i,9] corresponding to the iteration that just occured, then return to the top 
of the loop to combine them into the value of W for the next iteration. What I 
think is happening here is that R is looking for values in the condition before 
they are actually there- the way I've written it, they can't be there until I 
get past the conditional step.  Which means I am coding this all wrong.  That 
said, I'm not sure how else to do it;  the value of W in the next iteration is 
dependent on the values of Gr and W in the previous iteration, with the 
exception of the first one (Day=1).  I've tried defining bio as 

bio-matrix(NA, ncol=9, nrow=366)

but that doesn't help either.

Perhaps my rbind at the end of the file is incorrect? I think maybe I'm getting 
mixed up between calculating vectors and values-- should I be specifying [i] 
for everything below where I am now specifying vecotrs?  

+ #W-Wo
+ 
+ C- p*CA*(W^CB)*((comp[,3]^Xc)*(exp(Xc*(1-comp[,3]*Pc
+ 
+ ASMR- (ACT*RA*(W^(RB))*((comp[,4]^Xa)*(exp(Xa*(1-comp[,4])
+ 
+ SMR- (ASMR/ACT)
+ 
+ A- (ASMR-SMR)
+ 
+ F- (FA*(comp[,2]^FB)*(exp(FG*p))*C)
+ 
+ U- (UA*(comp[,2]^UB)*(exp(UG*p))*(C-F))
+ 
+ SDA- (S*(C-F))
+ 
+ Gr- (C-(ASMR+F+U+SDA))
+ #Day, Temp, Vc, Vr, W, C, ASMR, SMR, A, F, U, SDA, Gr)
+ 
+ bio- rbind(c(W, C, ASMR, SMR, A, F, U, SDA, Gr))
+ 
+ dimnames (bio) -list(NULL, c
(W, C, ASMR, SMR, A, F, U, SDA, Gr))
+ 
+ }
Error: length of dimnames[2] not equal to array extent
Execution halted


-- 
Michael Rennie
M.Sc. Candidate
University of Toronto at Mississauga
3359 Mississauga Rd. N.
Mississauga ON  L5L 1C6
Ph: 905-828-5452  Fax: 905-828-3792

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


RE: [R] Fitting inter-arrival time data

2003-06-30 Thread M. Edward Borasky
Unfortunately, the data are *non-negative*, not strictly positive. Zero is a
valid and frequent inter-arrival time. It is, IIRC, the most likely value of
a (negative) exponential distribution.

-- 
M. Edward (Ed) Borasky
mailto:[EMAIL PROTECTED]
http://www.borasky-research.net
 
Suppose that tonight, while you sleep, a miracle happens - you wake up
tomorrow with what you have longed for! How will you discover that a miracle
happened? How will your loved ones? What will be different? What will you
notice? What do you need to explode into tomorrow with grace, power, love,
passion and confidence? -- L. Michael Hall, PhD


 -Original Message-
[snip]

 if you data are positive, you could use
 
   sm.density(..., positive=TRUE)

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


RE: [R] Fitting inter-arrival time data

2003-06-30 Thread M. Edward Borasky
Thanks!! It does look like the easiest thing is direct ML; the code for a
normal mixture is in the book, so all I have to do is modify that for a sum
of a hyper-exponential, for which I have an approximate mean and CV, and a
normal, for which I have an approximate mean and SD.

I have two big peaks, one near zero which is probably hyperexponential with
a CV about 3, and the other near 600 seconds (a refresh that happens every
ten minutes) which looks Gaussian with a very small standard deviation. I
think what I'm going to do is fit the two peaks using ML, since I know where
they are, then subtract them out and look at the structure of the residuals.
The stuff over 600 seconds is sparse and totally uninteresting. After I'm
done with this, I get to look at the distribution of the network traffic.
The good news is that I get those inter-arrival times to the nearest
microsecond. :)

-- 
M. Edward (Ed) Borasky
mailto:[EMAIL PROTECTED]
http://www.borasky-research.net
 
Suppose that tonight, while you sleep, a miracle happens - you wake up
tomorrow with what you have longed for! How will you discover that a miracle
happened? How will your loved ones? What will be different? What will you
notice? What do you need to explode into tomorrow with grace, power, love,
passion and confidence? -- L. Michael Hall, PhD


 -Original Message-
[snip]

 For all of these see MASS (the book) and its on-line complements.

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


[R] crossed random effects

2003-06-30 Thread Sarah Mclean
Hi,

if I have posted this twice, please ignore this. I'm
not sure if I sent it to the correct e-mail address
the first time.

I have a data set on germination and plant growth with
the following variables:

dataset=fm
mass (response)
sub (fixed effect)
moist (fixed effect)
pop (fixed effect)
mum (random effect nested within population)
iheight (covariate)
plot (random effect- whole plot factor for split-plot
design).

I want to see if moist or sub interacts with mum for
any of the pops, but I am getting an error message. 

This is the formula I used:
fm$pmu - getGroups(fm, ~1|pop/mum, level=2)
fm$grp = as.factor(rep(1,nrow(fm)))
fm$pl - getGroups(fm, ~1|plot)
fm$mo - getGroups(fm, ~1|moist)
fm$su - getGroups(fm, ~1|sub)
 fm1 - lme(sqrt(mass) ~ iheight + moist*sub*pop,
data=fm, random=list(grp=pdBlocked(list(pdIdent(~pl -
1), pdIdent(~pmu - 1),  pdIdent(~pmu:su - 1),
pdIdent(~pmu:mo - 1)
Error in chol((value + t(value))/2) : non-positive
definite matrix in chol

I know the problem is with the random interaction
terms, but I don't know how to overcome this.

Any advice would be greatly appreciated. I'm new to R
and analysis such as this.

Thank you,

Sarah Mclean
[EMAIL PROTECTED]


http://mobile.yahoo.com.au - Yahoo! Mobile
- Check  compose your email via SMS on your Telstra or Vodafone mobile.

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