[R] 3d plot

2008-03-31 Thread kate
Hi,
I would like to have 3d plot, and I found that there is a command 
scatterplot3d. x is V, y=sigmaV, and z=TSE (note: After some calculation, I 
update TSE). How could I do to have 3d plot I want? 

V-seq(1279,1280,,100)
sigmaV-seq(0.28,0.29,,100)
TSE-matrix(0, length(V),length(sigmaV))

ps: TSE[i,j] corresponds to V[i] and sigmaV[j].

Thanks,

Kate 
[[alternative HTML version deleted]]

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


[R] solver in R

2008-03-31 Thread Roslina Zakaria
Dear R-users,
Is there any function in R that works similarly like solver in Excel.  I have a 
set of daily rainfall data and I would like to estimate alpha and beta for the 
gamma function.

Here is my daily rainfall data:
[1]  0.2  1.2  0.0  0.0  0.0  0.0  0.0  0.6  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
0.0  4.8  1.6  0.0  1.8  1.8  0.0  2.6
 [24] 33.0 19.0  0.0  0.0  0.6  0.0  0.0  6.8  0.2  0.0  0.0  0.0  0.0  0.2  
0.0  0.0  0.0  0.0  0.0  0.0  1.6  5.4  0.0
 [47]  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.2  0.0  0.0  6.0  6.6  
0.0  0.0  0.0  0.0  0.2  0.0  0.0  0.0  0.0
 [70]  0.0  0.0  0.0  0.0  0.0  0.0  0.0 12.8  0.0  0.0  0.0  0.0  0.0  0.0  
0.2  0.0  3.8  2.2  1.2 12.2  3.0  0.0  0.0
 [93]  0.0  0.0  5.0  3.6  0.0  0.0  0.0  1.8  1.8  1.2  1.2  1.6  3.6  0.2  
0.8  0.0  0.0  0.0  0.0  0.0  1.4 16.6  0.0
[116]  1.6  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.8  5.4
[139]  1.6  5.8  0.4 34.2  0.0  0.4  0.4  1.4  1.8  0.0  0.0  0.2  0.0  2.4 
24.2  0.4  0.0  0.0  0.0  1.6  0.0  0.0  0.0
[162]  0.0  0.2  0.0  0.0  0.0  4.4  0.0  4.4 21.2  3.0  0.4  0.0  0.0  0.0  
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
[185]  0.0  0.8  0.8  3.6  0.0  1.2  0.0  0.0  0.0  0.0  0.0  0.0 13.8  1.6  
6.6  5.0  0.0  1.2  0.0  1.0  1.2  2.4  6.0
[208]  2.8  7.0  0.2  0.6  0.0  0.0  0.0  0.0  0.0  3.2  0.2  2.4  0.0  0.0  
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  2.0
[231]  0.0  0.0  0.0  0.0  0.0  0.0  0.0  1.2  6.6  2.4  1.0  0.0  0.0  0.0  
0.0  0.0  0.0  0.0  0.0  1.6  0.0  0.0  0.0
[254]  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.4  2.6  0.0  0.6  
4.8  0.0  0.2  3.8 17.0  0.2  0.0  0.0  0.0
[277] 43.6  2.6  0.0  0.0  0.0  0.4  8.2 14.4  0.2  0.0  0.0  0.0  1.8  0.0  
0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  1.2
[300]  0.0

Thank you in advance for your help.


  

Looking for last minute shopping deals?

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


Re: [R] Finding a mean value of a variable holding a dummyvariablefixed

2008-03-31 Thread Daniel Malter
(I don't recall any Prime Minister called Johnson or Nixon, by the way...) 

That's why the variable was called president. prime.minister is four
letters and a dot longer. That was too complicated ;)


-
cuncta stricte discussurus
-

-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Gesendet: Sunday, March 30, 2008 11:50 PM
An: [EMAIL PROTECTED]; [EMAIL PROTECTED]; r-help@r-project.org
Betreff: RE: [R] Finding a mean value of a variable holding a
dummyvariablefixed

Here is another way, starting with similar dummy data:



PMData - 
data.frame(PM = c(Thatcher, Thatcher, Thatcher, Thatcher,
   Thatcher, Thatcher,Major, Major, Major,
   Major, Major, Major),
approval = c(3, 4, 5, 6, 7, 8, 6, 5, 4, 3, 2, 1))
 
PMData - transform(PMData, Month = 1:nrow(PMData))  ## add the time
variable

PM_average - with(PMData, tapply(approval, PM, mean))

PM_span - with(PMData, sapply(tapply(Month, PM, range),
  function(x) structure(approval[Month[x]],
names = c(First, Last


 rbind(mean = PM_average, PM_span)
  Major Thatcher
mean3.5  5.5
First   6.0  3.0
Last1.0  8.0 


(I don't recall any Prime Minister called Johnson or Nixon, by the way...)

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

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Daniel Malter
Sent: Monday, 31 March 2008 1:22 PM
To: 'Alexander Ovodenko'; r-help@r-project.org
Subject: Re: [R] Finding a mean value of a variable holding a
dummyvariablefixed

I found a solution. It's probably not the easiest one, but it works.  It
assumes that your data frame is ordered from earliest to latest record for
each president, but it can be easily adjusted if you want to make it
dependent on a third column. The final vector index gives you the line
indices for the first record for each president. If you replace min by
max you get the last instead of the first record. You can then find the
values by


##Sample data

president=c(Johnson,Johnson,Johnson,Johnson,Johnson,Johnson,Nix
on,Nixon,Nixon,Nixon,Nixon,Nixon)
approval=c(3,4,5,6,7,8,6,5,4,3,2,1)
tapply(approval,president,mean)

##Find index for first row of each president; assumes ascending order of
observations; change min to max to find last record

index=NULL
for(i in 1:length(unique(president)))
  index[i]=min(which((president==unique(president)[i])==TRUE))

index

##Generate table with first approvals

first.approval=data.frame(cbind(index,president[index],approval[index]))
names(first.approval)=c(Index,President,Approval)
first.approval

Cheers,
Daniel




-
cuncta stricte discussurus
-

-Ursprüngliche Nachricht-
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im
Auftrag von Alexander Ovodenko
Gesendet: Sunday, March 30, 2008 9:47 PM
An: r-help@r-project.org
Betreff: [R] Finding a mean value of a variable holding a dummy
variablefixed

I have time-series data on approval ratings of British Prime Ministers.  The
prime ministers dating from MacMillan onward till today are coded as dummy
variables and the approval ratings are entered for each month.  I want to
know the mean value of the approval rating of each Prime Minister in the
dataset and the approval rating during his/her first month and last month as
PM.  What R code should I enter for these data?  In other words, I want hold
the dummy corresponding to each Prime Minister fixed at value one and know
the first rating that PM has, the last rating s/he has, and the mean rating
s/he has.  Thanks.

[[alternative HTML version deleted]]

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

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

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


Re: [R] solver in R

2008-03-31 Thread Richard Rowe
library(MASS) check out fitdistr( )  ... ?fitdistr
This isn't 'solver', but then again R isn't MS Excel!

Roslina Zakaria wrote:
 Dear R-users,
 Is there any function in R that works similarly like solver in Excel.  I have 
 a set of daily rainfall data and I would like to estimate alpha and beta for 
 the gamma function.

 Here is my daily rainfall data:
 [1]  0.2  1.2  0.0  0.0  0.0  0.0  0.0  0.6  0.0  0.0  0.0  0.0  0.0  0.0  
 0.0  0.0  4.8  1.6  0.0  1.8  1.8  0.0  2.6
  [24] 33.0 19.0  0.0  0.0  0.6  0.0  0.0  6.8  0.2  0.0  0.0  0.0  0.0  0.2  
 0.0  0.0  0.0  0.0  0.0  0.0  1.6  5.4  0.0
  [47]  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.2  0.0  0.0  6.0  6.6  
 0.0  0.0  0.0  0.0  0.2  0.0  0.0  0.0  0.0
  [70]  0.0  0.0  0.0  0.0  0.0  0.0  0.0 12.8  0.0  0.0  0.0  0.0  0.0  0.0  
 0.2  0.0  3.8  2.2  1.2 12.2  3.0  0.0  0.0
  [93]  0.0  0.0  5.0  3.6  0.0  0.0  0.0  1.8  1.8  1.2  1.2  1.6  3.6  0.2  
 0.8  0.0  0.0  0.0  0.0  0.0  1.4 16.6  0.0
 [116]  1.6  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.8  5.4
 [139]  1.6  5.8  0.4 34.2  0.0  0.4  0.4  1.4  1.8  0.0  0.0  0.2  0.0  2.4 
 24.2  0.4  0.0  0.0  0.0  1.6  0.0  0.0  0.0
 [162]  0.0  0.2  0.0  0.0  0.0  4.4  0.0  4.4 21.2  3.0  0.4  0.0  0.0  0.0  
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0
 [185]  0.0  0.8  0.8  3.6  0.0  1.2  0.0  0.0  0.0  0.0  0.0  0.0 13.8  1.6  
 6.6  5.0  0.0  1.2  0.0  1.0  1.2  2.4  6.0
 [208]  2.8  7.0  0.2  0.6  0.0  0.0  0.0  0.0  0.0  3.2  0.2  2.4  0.0  0.0  
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  2.0
 [231]  0.0  0.0  0.0  0.0  0.0  0.0  0.0  1.2  6.6  2.4  1.0  0.0  0.0  0.0  
 0.0  0.0  0.0  0.0  0.0  1.6  0.0  0.0  0.0
 [254]  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.4  2.6  0.0  0.6  
 4.8  0.0  0.2  3.8 17.0  0.2  0.0  0.0  0.0
 [277] 43.6  2.6  0.0  0.0  0.0  0.4  8.2 14.4  0.2  0.0  0.0  0.0  1.8  0.0  
 0.0  0.0  0.0  0.0  0.0  0.0  0.0  0.0  1.2
 [300]  0.0

 Thank you in advance for your help.


   
 
 Looking for last minute shopping deals?

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

   


-- 
Dr Richard Rowe
Zoology  Tropical Ecology
School of Marine  Tropical Biology
James Cook University
Townsville 4811
AUSTRALIA

ph +61 7 47 81 4851
fax +61 7 47 25 1570
JCU has CRICOS Provider Code 00117J

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


[R] Comparing Time Series

2008-03-31 Thread nathan3073

Dear All,
I need to compare hundreds (about 200-300) of time series. Would anyone tell
me how to do this in R? If R has no package for doing this, can I get some
insight what method I should use?

best regards,
Nathanael Gratias
-- 
View this message in context: 
http://www.nabble.com/Comparing-Time-Series-tp16392632p16392632.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] MANOVA, SCC and multiple comparisons

2008-03-31 Thread Frédéric Chiroleu
Bonjour,

we wanted to fit a manova as descripted in Marieta /et al./ 2003, 
convergent habitat segregation of /Aedes aegyptii/ and /Aedes 
albopictus/ (Diptera: /Culicidae/) in Southern Brazil and Florida, /J. 
Med. Entomol./, *40* (6), 785-794. They did their analysis with SAS 
software.
We have the same kind of data with two insect species and city, habitat 
and season factors. We used the function manova() and it was OK for 
multivariate analysis. We have two questions (we have searched, with the 
help tools we know, on the site and on many packages without success ) :

1/ The next step of our analysis was to calculate the Standardized 
Canonical Coefficients (SCC); we have no idea of how to do. Is there 
some link with a PCA on Instrumental Variables ? The explaination in the 
article was not clear for us.

2/ As in a ANOVA, we wanted to realize mean comparisons. Marieta et al. 
used bivariate pairwise contrasts of a factor within each level of the 
other factor (for significant interactions) using Dunn-Sidak method and 
univariate contrasts of pairs of main effects (for significant main 
effects) using Dunn-Sidak method. We tried to use the glht() function 
(from multcomp package) without success because of the nature of 
manova() object. Has someone an helpful advice to give ?

Merci beaucoup, (Thanks a lot)

Bien cordialement, (Sincerely yours)

Frédéric. 
-- 
Dr. Frédéric Chiroleu
Biométricien
CIRAD-Systèmes Biologiques (Cirad-Bios)
UMR 53 PVBMT (Peuplements Végétaux et Bio-agresseurs en Milieu Tropical)
Laboratoire d'Ecologie Terrestre et de Lutte Intégrée (LETLI)
Pôle de Protection des Plantes (3P)
7, chemin de l'IRAT - Ligne Paradis
97410 Saint-Pierre
Île de la Réunion - France
Tél. : +262 (0)262 499 230
Standard : +262 (0)262 499 200
Fax : +262 (0)262 499 293
Courriel : [EMAIL PROTECTED]

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


[R] Number of variables in lrm (Design)

2008-03-31 Thread Paul Sweeting
Hi

 

I'm sure this is straightforward, but I can't find an answer.

 

I'm trying to find the function that returns the number of dependent
variables/rank of the regression/degrees of freedom/something similar.  Any
ideas?

 

Thanks!

 

Paul


[[alternative HTML version deleted]]

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


Re: [R] S4 : the list of all the object

2008-03-31 Thread Martin Maechler
 CG == Christophe Genolini [EMAIL PROTECTED]
 on Sat, 29 Mar 2008 16:20:41 +0100 writes:

CG Hi the list, Is it possible to get the list of all the
CG S4 user define classes? 

do you mean those in .GlobalEnv?
If you have written a package using S4 classes, these are also 
user defined ..

CG S4 user define classes? I would like to set up a
CG package.skeleton.S4 but for that, I need the list of
CG the classes...

But (I thought you knew  ??) package.skeleton does work in
R-devel and R-alpha,
so we'd rather be very glad if you used R-alpha and told use
about deficiencies you'll find in package.skeleton() there..
{I'm sure there still are some, so we'd be very interested in
 well-tested patches against 
 https://svn.r-project.org/R/trunk/src/library/utils/R/package.skeleton.R
}

Bonnes salutations,
Martin

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


Re: [R] Comparing Time Series

2008-03-31 Thread Prof Brian Ripley
Surely you need the insight before choosing a package?

What is the problem you are trying to solve?  There are many different 
aspects of time series which could be of interest, and we have no idea 
which are relevant to your problem.

On Sun, 30 Mar 2008, nathan3073 wrote:


 Dear All,
 I need to compare hundreds (about 200-300) of time series. Would anyone tell
 me how to do this in R? If R has no package for doing this, can I get some
 insight what method I should use?

 best regards,
 Nathanael Gratias
 --
 View this message in context: 
 http://www.nabble.com/Comparing-Time-Series-tp16392632p16392632.html
 Sent from the R help mailing list archive at Nabble.com.

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


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

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


Re: [R] ggplot2 argument handling odd

2008-03-31 Thread Sebastian Weber
Hi Hadley,

I tried today your solution to this problem. However, the finally
working code was like

eval(substitute(ggplot( aes_string(...) ))

The qplot code below did not work at all, neither works a 

ggplot(aes_string(...))

BTW: Since I am always writing scripts to produce my plots, how can I
split accross multiple lines one command in a R-script? These ggplot
commands can become rather long and the syntax

pl - ggplot( ... long expression . )
pl - pl + some_layer( ... )

is not very intuituve. So, how do I break lines in R-Scripts.

These questions must sound like beginner questions - but I have searched
archives and documentation without success. As we speak of it - is your
book finally out?

Greetings,

Sebastian Weber

On Thu, 2008-03-27 at 07:57 -0500, hadley wickham wrote:
   Ok, I will try that, thanks. BTW, where is this aes_string option
   documented, sounds useful? How could I do the same thing with facetting?
   If I want to save something like . ~ groupVar as a string in a
   variable, could I pass it with facet_string to ggplot?
 
 It's a see also from ?aes (or at least it is in the development
 version).  facet_grid should already accept a string instead of a
 function, so it should just work.
 
   But anyway, I would be curious how to do it with qplot. The basic
   question is: How to pass the string of a variable to a function which is
   supposed to interpret it. Aka:
 
   var - magicVar
 
   fun(doSomeMagic(var))
 
   doSomeMagic should then write magicVar at the place.
 
 In general, you can use as.name, substitute and eval:
 
 x - as.name(mpg)
 y - as.name(wt)
 
 eval(substitute(qplot(x, y, data=mtcars), list(x=x, y=y)))
 
 Hadley


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


Re: [R] WinXP exhibits sluggish graphics window movement mouse tracking (repainting?) over windows graphics devices

2008-03-31 Thread Prof Brian Ripley
I don't see this on a much older and slower machine, so suspect a problem 
with your Windows.  It looks like something is set up to ask R to repaint 
after the mouse pointer, whereas Windows ought to be doing that.  Even 
then, R uses double buffering, so the repaint should be fast (provided 
graphics acceleration is turned on).

If you want to try updated versions of R, we suggest you use 2.7.0 alpha 
and not R-patched.  But R updates will not solve Windows problems.

On Mon, 31 Mar 2008, Richard Yeh wrote:

 I just noticed when using 2.6.1, 2.6.2 (2008-02-08), 2.6.2pat
 (2008-02-21 r44582), and 2.6.2pat (2008-03-24 r44975) on my poor old
 Celeron D330 (2.6 GHz; 3.5 years old) running Windows XP, that the
 mouse cursor appears to be redrawn more sluggishly when the pointer is
 over R windows graphics devices than over the R console window or
 other applications' windows. The slowdown seems to start only after I
 plotting something in the window (running windows() to open the
 device does not cause any slowdown), but the behavior starts after a
 plot(rnorm(100)). The slowdown seems to depend on the area of the R
 graphics window that is visible. The slowdown also occurs when moving
 the plot window.  For example, if the graphics window is frontmost,
 and I want to move it until it is mostly offscreen, then the movement
 is jerky.  However, once the window is mostly offscreen, dragging it
 back onto the screen is smooth and fast.  (When I drag windows, I only
 see the frame, not the contents.) This seems to affect SDI and MDI
 modes.  The Windows task manager confirms that when the plot window is
 frontmost, Rgui.exe takes most of the CPU time.

 My graphics card is based on an ATI Radeon 7000, with 32 MB of RAM.

 I am surprised that I never noticed this before. Nobody else seems to
 have reported it to the r-help list. Is this problem restricted to my
 system? (My work machine is much newer, and I do not notice the
 problem there.)

 --
 607-351-4838 / [EMAIL PROTECTED]

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


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

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


[R] hsv2rgb in R

2008-03-31 Thread Dieter Menne
I noted that there is a hsv2rgb in the C-API, but no corresponding function in
R, while rgb2hsv is available in R.

Does the functionality of hsv2rgb hide under some other name?

Dieter

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


[R] R-packages installation problems

2008-03-31 Thread Roberto Cremonini
Dear,

I've installed the following R version on HP compaq 6710 b under Fedora 8:

  version
_
platform i386-redhat-linux-gnu
arch i386
os linux-gnu
system i386, linux-gnu
status
major 2
minor 6.2
year 2008
month 02
day 08
svn rev 44383
language R
version.string R version 2.6.2 (2008-02-08)

When I try to install some R packages I receive the following message:
[EMAIL PROTECTED] R-packages]# R CMD INSTALL gtools_2.4.0.tar.gz
* Installing to library '/usr/lib/R/library'
* Installing *source* package 'gtools' ...
** libs
gcc -m32 -std=gnu99 -I/usr/include/R -I/usr/include/R 
-I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 
-march=i386 -mtune=generic -fasynchronous-unwind-tables -c 
setTCPNoDelay.c -o setTCPNoDelay.o
setTCPNoDelay.c:1:15: error: R.h: No such file or directory
setTCPNoDelay.c:2:24: error: Rinternals.h: No such file or directory
setTCPNoDelay.c: In function ‘checkStatus’:
setTCPNoDelay.c:66: warning: implicit declaration of function ‘strncpy’
setTCPNoDelay.c:66: warning: incompatible implicit declaration of 
built-in function ‘strncpy’
setTCPNoDelay.c:72: warning: implicit declaration of function ‘strerror’
setTCPNoDelay.c:72: warning: passing argument 2 of ‘strncpy’ makes 
pointer from integer without a cast
make: *** [setTCPNoDelay.o] Error 1
ERROR: compilation failed for package 'gtools'
** Removing '/usr/lib/R/library/gtools'

Indeed R headers (R.h and Rinternals.h) don' t exist on my filesystem. 
Where can I find them? How can I install them?

Thanks for help,

Best regards, Roberto



-- 
ARPA Piemonte
SC05 - Area Previsione e Monitoraggio Ambientale
Roberto Cremonini
via Pio VII, 9
10135 TORINO ITALIA
Tel. +39 011 1968 0282
Fax. +39 011 1968 1341

Riservatezza/Confidentiality

In ottemperanza al D.Lgs. n. 196 del 30.06.2003 in materia di protezione dei 
dati personali, le informazioni contenute in questo messaggio sono strettamente 
riservate ed esclusivamente indirizzate al destinatario indicato (oppure alla 
persona responsabile di rimetterlo al destinatario).
Vogliate tener presente che qualsiasi uso, riproduzione o divulgazione di 
questo messaggio è vietato. Nel caso in cui aveste ricevuto questo messaggio 
per errore, vogliate cortesemente avvertire il mittente e distruggere il 
presente messaggio.

According to Italian law D.Lgs. 196/2003 concerning privacy, if you are not the 
addressee (or responsible for delivery of the message to such person) you are 
hereby notified that any disclosure, reproduction, distribution or other 
dissemination or use of this communication is strictly prohibited.
If you have received this message in error, please destroy it and notify us by 
email.

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


Re: [R] hsv2rgb in R

2008-03-31 Thread Martin Maechler
 DM == Dieter Menne [EMAIL PROTECTED]
 on Mon, 31 Mar 2008 08:06:39 + (UTC) writes:

DM I noted that there is a hsv2rgb in the C-API, but no
DM corresponding function in R, while rgb2hsv is available
DM in R.

DM Does the functionality of hsv2rgb hide under some other
DM name?

yes: hsv()

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


[R] Odp: I need really help

2008-03-31 Thread Petr PIKAL
Hi

1.  Install R
2.  Read some intro documents (doc folder)
3.  Try to reproduce simple examples from let say R-intro.pdf and/or 
R-data.pdf
4.  Try to follow examples with your data
5.  When there is an error read a message and try to get some 
explanation in help page associated with particular command
6.  If this does not lead to success, make a simple reproducible 
example and post it together with your question.

From what you write, I deduct that ?read.table and maybe ?reshape could be 
your first choice.

Regards

Petr
[EMAIL PROTECTED]

[EMAIL PROTECTED] napsal dne 30.03.2008 23:26:42:

 Dear , Madam/Sir
 
   I'm student doing master in statistics, I'd like to know how i can set 
data 
 in R and apply meta-analysis. i have tries many ways but I'm really 
stuck.
   i really appreciate if you can help me in this matter.
 
   Mohammed Owlowa
 
 
 
 
 -
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] R-packages installation problems

2008-03-31 Thread Prof Brian Ripley
How did you install R?  If from the F8 RPMs, it looks like you missed the 
R-devel RPM (which was always recommended to install packages, and has 
become necessary in the F8 RPM for 2.6.2).


Note that Fedora are responsible for making clear what you need to install 
from their re-packaged distributions (the R developers do not recommend 
splitting up R), so if this was not clear to you, please file a Fedora bug 
report.


See also https://stat.ethz.ch/pipermail/r-help/2008-March/158262.html

On Mon, 31 Mar 2008, Roberto Cremonini wrote:


Dear,

I've installed the following R version on HP compaq 6710 b under Fedora 8:

 version
_
platform i386-redhat-linux-gnu
arch i386
os linux-gnu
system i386, linux-gnu
status
major 2
minor 6.2
year 2008
month 02
day 08
svn rev 44383
language R
version.string R version 2.6.2 (2008-02-08)

When I try to install some R packages I receive the following message:
[EMAIL PROTECTED] R-packages]# R CMD INSTALL gtools_2.4.0.tar.gz
* Installing to library '/usr/lib/R/library'
* Installing *source* package 'gtools' ...
** libs
gcc -m32 -std=gnu99 -I/usr/include/R -I/usr/include/R
-I/usr/local/include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2
-fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32
-march=i386 -mtune=generic -fasynchronous-unwind-tables -c
setTCPNoDelay.c -o setTCPNoDelay.o
setTCPNoDelay.c:1:15: error: R.h: No such file or directory
setTCPNoDelay.c:2:24: error: Rinternals.h: No such file or directory
setTCPNoDelay.c: In function ‘checkStatus’:
setTCPNoDelay.c:66: warning: implicit declaration of function ‘strncpy’
setTCPNoDelay.c:66: warning: incompatible implicit declaration of
built-in function ‘strncpy’
setTCPNoDelay.c:72: warning: implicit declaration of function ‘strerror’
setTCPNoDelay.c:72: warning: passing argument 2 of ‘strncpy’ makes
pointer from integer without a cast
make: *** [setTCPNoDelay.o] Error 1
ERROR: compilation failed for package 'gtools'
** Removing '/usr/lib/R/library/gtools'

Indeed R headers (R.h and Rinternals.h) don' t exist on my filesystem.
Where can I find them? How can I install them?

Thanks for help,

Best regards, Roberto



--
ARPA Piemonte
SC05 - Area Previsione e Monitoraggio Ambientale
Roberto Cremonini
via Pio VII, 9
10135 TORINO ITALIA
Tel. +39 011 1968 0282
Fax. +39 011 1968 1341

Riservatezza/Confidentiality

In ottemperanza al D.Lgs. n. 196 del 30.06.2003 in materia di protezione dei 
dati personali, le informazioni contenute in questo messaggio sono strettamente 
riservate ed esclusivamente indirizzate al destinatario indicato (oppure alla 
persona responsabile di rimetterlo al destinatario).
Vogliate tener presente che qualsiasi uso, riproduzione o divulgazione di 
questo messaggio è vietato. Nel caso in cui aveste ricevuto questo messaggio 
per errore, vogliate cortesemente avvertire il mittente e distruggere il 
presente messaggio.

According to Italian law D.Lgs. 196/2003 concerning privacy, if you are not the 
addressee (or responsible for delivery of the message to such person) you are 
hereby notified that any disclosure, reproduction, distribution or other 
dissemination or use of this communication is strictly prohibited.
If you have received this message in error, please destroy it and notify us by 
email.

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



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


Re: [R] hsv2rgb in R

2008-03-31 Thread Richard . Cotton
 I noted that there is a hsv2rgb in the C-API, but no corresponding 
function in
 R, while rgb2hsv is available in R.
 
 Does the functionality of hsv2rgb hide under some other name?

I agree that it does seem like such a function ought to exist.  You can 
use col2rgb(hsv(...)) to get what you want.

Regards,
Richie.

Mathematical Sciences Unit
HSL




ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

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


Re: [R] 3d plot

2008-03-31 Thread Uwe Ligges
If you want to plot some surface, use persp(); or wireframe() from 
package lattice; or persp3d() from package rgl or therelike.

Uwe Ligges

kate wrote:
 Hi,
 I would like to have 3d plot, and I found that there is a command 
 scatterplot3d. x is V, y=sigmaV, and z=TSE (note: After some calculation, I 
 update TSE). How could I do to have 3d plot I want? 
 
 V-seq(1279,1280,,100)
 sigmaV-seq(0.28,0.29,,100)
 TSE-matrix(0, length(V),length(sigmaV))
 
 ps: TSE[i,j] corresponds to V[i] and sigmaV[j].
 
 Thanks,
 
 Kate 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


[R] png file in batch mode

2008-03-31 Thread mysimbaa

Dear R users,
I have an R script which produce me a plot. I run it in batch mode.
The outputed file is .ps
How ca I ouput the plot in .png in stead of .ps ?
I found in R FAQ 7.19 the solution but it is for Linux, and I'm using
Windows.

Thanks for your help,
Ciao,
Adel

-- 
View this message in context: 
http://www.nabble.com/png-file-in-batch-mode-tp16395299p16395299.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Reorder the x-axis using lattice

2008-03-31 Thread Tom Cohen
Dear list,
   
   Is there a way to reorder the xaxis using lattice. Using the following data, 
the x-axis is ordered as BP GH MH PF RE RP SF VT but I would like the x-axis to 
be ordered as PF RP BP GH VT SF RE MH.
   
Kön Skalor Tillfälle Medelvärde
1  Kvinnor BP 1-inskrivning   36.45283
2  Kvinnor GH 1-inskrivning   38.62255
3  Kvinnor MH 1-inskrivning   62.9
4  Kvinnor PF 1-inskrivning   39.80710
5  Kvinnor RE 1-inskrivning   41.50943
6  Kvinnor RP 1-inskrivning   22.2
7  Kvinnor SF 1-inskrivning   59.19811
8  Kvinnor VT 1-inskrivning   34.84568
9  Kvinnor BP 2-utskrivning   43.14815
10 Kvinnor GH 2-utskrivning   44.11321
11 Kvinnor MH 2-utskrivning   77.2
12 Kvinnor PF 2-utskrivning   44.74280
13 Kvinnor RE 2-utskrivning   68.95425
14 Kvinnor RP 2-utskrivning   39.90385
15 Kvinnor SF 2-utskrivning   64.62264
16 Kvinnor VT 2-utskrivning   51.97531

   
  bwplot(Medelvärde ~ Skalor| Kön , kt, panel = panel.superpose,
   groups = Tillfälle,scales = list(x = list(rot = 
45),cex=0.7,alternating=2),
   panel.groups = 
panel.linejoin,lty=c(1:3),lwd=3,col=c(steelblue,grey50,green4),
   ylab = list(label = skalpoäng (0-100), cex = 0.8),
   xlab = list(label = skalor, cex = 0.8),
   key = list(lines = 
Rows(list(col=c(steelblue,grey50,green4),lty=c(1:3)),
c(1:3, 0)),cex=0.8,text = list(lab = 
as.character(unique(kt$Tillfälle))),
  columns = 2, title = SF-36: Skalpoäng för respektive kön vid 
3 mättillfälle ,
  cex.title=0.9))
   
  Thanks in advance,
  Tom

   
-

Jämför pris på flygbiljetter och hotellrum: 
http://shopping.yahoo.se/c-169901-resor-biljetter.html
[[alternative HTML version deleted]]

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


Re: [R] Reverse seq

2008-03-31 Thread Chuck Cleland
On 3/31/2008 6:31 AM, Mario Maiworm wrote:
 Hi all,
 I thought I was not SUCH a nooby:) 
 How can I reverse a sequence/ vector?
 i.e., turn 
 X - 3 5 4 2 6 5 4 3 6
 Into 
 X - 6 3 4 5 6 2 4 5 3
 I mean without looping and indexing.
 There should be a very easy solution, shouldn't it?

  rev(X)
[1] 6 3 4 5 6 2 4 5 3

?rev

 Mario
 
 
 __
 
 Mario Maiworm
 Biological Psychology and Neuropsychology
 University of Hamburg
 Von-Melle-Park 11
 D-20146 Hamburg
 
 Phone: +49 40 42838 3515
 Fax: +49 40 42838 6591
 
 http://bpn.uni-hamburg.de/Maiworm_e.html
 http://cinacs.org
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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

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


[R] aov and errors used for interaction effects

2008-03-31 Thread O.Langner

Dear list-members,

I just switched to R, so here probably a newbie question, I couldn't find a
answer for yet:

Assume a design with three repeated measures factors (F1-F3), I tried to run
the following:
aov(rt ~ F1*F2*F3 + Error(subject / (F1*F2*F3)))

Comparing the output from here and SPSS (General Linear Model - Repeated
measures) I found, that R does all calculations right for the main effects
of F1-F3, but seems to do something different for the interactions: Whereas
SPSS gets the F for an interaction by dividing the MS of the interaction
term (e.g. F1*F2) by the corresponding MS of the interaction with subject
(then F1*F2*subject), R just divides all interaction MS by the residual MS.

Could somebody point out to me, what I'm doing wrong or how I can get aov to
use the appropriate error terms also for the higher order interactions?

Thanks for helping!
-- 
View this message in context: 
http://www.nabble.com/aov-and-errors-used-for-interaction-effects-tp16395617p16395617.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] plot 3dimensional points with log axes

2008-03-31 Thread Hung-Hsuan Chen (Sean)
Dear R users
I am looking for functions that can plot 3 dimensional
figures *with logarithmic axes*.

I tried scatterplot3d (under package scatterplot3d) but
the log parameter is not implemented (although log
appears in the parameter list).

Does anyone has some suggestions? Thanks a lot

Austin

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


[R] Reverse seq

2008-03-31 Thread Mario Maiworm
Hi all,
I thought I was not SUCH a nooby:) 
How can I reverse a sequence/ vector?
i.e., turn 
X - 3 5 4 2 6 5 4 3 6
Into 
X - 6 3 4 5 6 2 4 5 3
I mean without looping and indexing.
There should be a very easy solution, shouldn't it?

Mario


__

Mario Maiworm
Biological Psychology and Neuropsychology
University of Hamburg
Von-Melle-Park 11
D-20146 Hamburg

Phone: +49 40 42838 3515
Fax: +49 40 42838 6591

http://bpn.uni-hamburg.de/Maiworm_e.html
http://cinacs.org

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


[R] L-BFGS-B needs finite values of 'fn'

2008-03-31 Thread Paul Smith
Dear All,

I am trying to solve the optimization problem below, but I am always
getting the following error:

Error in optim(rep(20, nvar), f, gr, method = L-BFGS-B, lower = rep(0,  :
  L-BFGS-B needs finite values of 'fn'

Any ideas?

Thanks in advance,

Paul

---

k - 1
b - 0.3

f - function(x) {

  n - length(x)

  r - sum((b^(0:(n-1)))*log(x)) - 200*(sum(x)-k)^2

  return(r)

}

gr - function(x) {

  n - length(x)

  r - (b^(0:(n-1)))*(1/x) - 400*(sum(x)-k)

  return(r)

}

nvar - 10
(sols - 
optim(rep(20,nvar),f,gr,method=L-BFGS-B,lower=rep(0,nvar),upper=rep(k,nvar),control=list(fnscale=-1,parscale=rep(2000,nvar),factr=1e-300,pgtol=1e-300)))

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


Re: [R] L-BFGS-B needs finite values of 'fn'

2008-03-31 Thread Prof Brian Ripley
Your function gives -Inf at the lower bound on the parameters, so you are 
minimizing a function without a lower bound.

Using the trace facilities of optim() would have got you thereeasily 
enough.


On Mon, 31 Mar 2008, Paul Smith wrote:

 Dear All,

 I am trying to solve the optimization problem below, but I am always
 getting the following error:

 Error in optim(rep(20, nvar), f, gr, method = L-BFGS-B, lower = rep(0,  :
  L-BFGS-B needs finite values of 'fn'

 Any ideas?

 Thanks in advance,

 Paul

 ---

 k - 1
 b - 0.3

 f - function(x) {

  n - length(x)

  r - sum((b^(0:(n-1)))*log(x)) - 200*(sum(x)-k)^2

  return(r)

 }

 gr - function(x) {

  n - length(x)

  r - (b^(0:(n-1)))*(1/x) - 400*(sum(x)-k)

  return(r)

 }

 nvar - 10
 (sols - 
 optim(rep(20,nvar),f,gr,method=L-BFGS-B,lower=rep(0,nvar),upper=rep(k,nvar),control=list(fnscale=-1,parscale=rep(2000,nvar),factr=1e-300,pgtol=1e-300)))

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


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

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


Re: [R] Clash between alr3 and AlgDesign. (Was: Re: Second subsequent calls to function fails. Please help debug.)

2008-03-31 Thread Martin Oliver Sailer
Dear all,

thanks for the advice. The latest version of crossdes (1.0-8) on CRAN  
now has namespaces. Hope this helps.

Regards
Oliver Sailer
 

Duncan Murdoch schrieb:
 On 30/03/2008 8:43 AM, Michael Kubovy wrote:
 Thanks, Duncan,

 I started a new session under the suspicion that packages were clashing.

  ...

 #
 # BAD INTERACTION BETWEEN alr3 and AlgDesign
 #

 What now?

 There's not much you can do; this is up to the package authors to fix. 
 Some advice for them:

 alr3, crossdes, faraway, and HH don't use a namespace.  This makes 
 them very vulnerable to this sort of interaction, because they don't 
 get to choose where the functions they use come from.  They should add 
 one.

 In my opinion, all packages should have namespaces, and I'd like to 
 create a default one if the author doesn't.  (The default would be: 
 import what is listed in the Depends clause, export everything.)  I 
 don't think this will happen for 2.7.0, though package.skeleton might 
 start creating one.

 Duncan Murdoch

-- 
--
 Dipl.-Stat. Oliver Sailer
 Fakultät Statistik
 Technische Universität Dortmund

 D-44221 Dortmund

 Tel.: ++49 (0)231 755 - 5409
 Fax:  ++49 (0)231 755 - 3454

 E-Mail: [EMAIL PROTECTED]

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


[R] lmer function.

2008-03-31 Thread Boikanyo Makubate
I am using the lmer function from the lme4 package.  I wrote the 
following statement, specifying the method to be adaptive Gaussian 
quadrature. I am getting an error saying method = AGQ not yet 
implemented for supernodal representation.  Please help.

  fit - 
lmer(response~beta1+(1|patient),family=binomial,method=AGQ,data=data.2)

Boikanyo.

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


[R] ggplots - how to increase the number of levels

2008-03-31 Thread Ptit_Bleu

Hi,

Thanks to Hadley Wickham, I am now able to plot some nice weather graphs
(see 
http://www.nabble.com/how-to-plot-image%28%29-without-painting-a-map-%28the-background%29-td15546906.html#a15584405
How to plot a graph on a map ).
For some parameters, I would like to increase the number of levels (the
number of grey tinges in fact (nuances in french - not sure tinges is
the correct english translation)).
I tried to add nlevels=10 to the following command :

p - qplot(data=lonlat1, longitude, latitude, geom=tile, fill=TCDC,
xlab=, ylab=) + 
scale_fill_gradient(low=white, high=grey) + geom_contour(aes(z = TCDC))
+ france_map

... but nothings changes.
I have always 5 levels for TCDC : 20 / 40 / 60 / 80 /100.
http://www.nabble.com/file/p16396028/tcdc_map.jpg 


Could you please tell me how to solve this easy (except for me) problem ?
Have a nice week,
Ptit Bleu.
-- 
View this message in context: 
http://www.nabble.com/ggplots---how-to-increase-the-number-of-levels-tp16396028p16396028.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] plot 3dimensional points with log axes

2008-03-31 Thread Duncan Murdoch
On 3/31/2008 7:05 AM, Hung-Hsuan Chen (Sean) wrote:
 Dear R users
 I am looking for functions that can plot 3 dimensional
 figures *with logarithmic axes*.
 
 I tried scatterplot3d (under package scatterplot3d) but
 the log parameter is not implemented (although log
 appears in the parameter list).
 
 Does anyone has some suggestions? Thanks a lot

A general way to do this sort of thing is to take the logs yourself, and 
get the general purpose function to draw without axes.  You can then add 
ticks, etc. after the fact.

Duncan Murdoch

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


[R] unexpected GAM result - at least for me!

2008-03-31 Thread Monica Pisica


Hi


I am afraid i am not understanding something  very fundamental and does not 
matter how much i am looking into the book Generalized Additive Models  of S. 
Wood i still don't understand my result.

I am trying to model presence / absence (presence = 1, absence = 0) of a 
species using some lidar metrics (i have 4 of these). I am using different 
models and such  and when i used gam i got this very weird (for me) result 
which i thought it is not possible - or i have no idea how to interpret it.

 can3.gam - gam(can0~s(be)+s(crr)+s(ch)+s(home), family = 'binomial')
 summary(can3.gam)
Family: binomial
Link function: logit
Formula:
can 0 ~ s(be) + s(crr) + s(ch) + s(home)
Parametric coefficients:
Estimate Std. Error z value Pr(|z|)
(Intercept)85.39 162.88   0.524  0.6
Approximate significance of smooth terms:
  edf Est.rank Chi.sq p-value
s(be)   1.0001  0.100   0.751
s(crr)  3.9298  0.380   1.000
s(ch)   6.8209  0.396   1.000
s(home) 1.0001  0.314   0.575
R-sq.(adj) =  1   Deviance explained =  100%
UBRE score = -0.81413  Scale est. = 1 n = 148

Is this a perfect fit with no statistical significance, an over-estimating or 
what It seems that the significance of the smooths terms is null. Of 
course with such a model i predict perfectly presence / absence of species.

Again, i hope you don't mind i'm asking you this. Any explanation will be very 
much appreciated.

Thanks,

Monica

PS. I've contacted the author of the book who is the package maintainer as well 
but until now i didn't get a reply.

_


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


Re: [R] Generating maps in R

2008-03-31 Thread Roger Bivand
Aleksandr Andreev aleksandr.andreev at duke.edu writes:

 
 Roger Bivand Roger.Bivand at nhh.no writes:
 
  Merge using:
  FS1 - spCbind(FS, agg2)
 
 This call fails, because:
 Error in spCbind(FS, agg2) : different numbers of rows

This was exactly why I emphasised care. One way to try to do this is 
to extract the FS data slot:

FSd - as(FS, data.frame)

and then merge() FSd and agg2, using - untried - something like:

FS1d - merge(FSd, agg2, by=row.names, all=TRUE)

and check

str(FS1d)

for sanity, and possibly eyeball:

match(row.names(FS1d), sapply(slot(FS, polygons),
 function(x) slot(x, ID)))

before moving on to:

FS1 - SpatialPolygonsDataFrame(as(FS, SpatialPolygons), data=FSD1)

The alternative is to subset FS to remove the geometries for which there 
is no data, but using merge to insert NAs ought to work too.

Roger

 
 The reason is because I have data in a001ter for 79 Federal Subjects,
 but russia.shp contains 193 labeled objects (93 Federal Subjects plus
 100 Arctic Ocean Islands and other things). Is there a way I can merge
 without an equal number of rows, labeling the data for the Arctic
 islands as missing?
 
 Thanks,
 
 Aleks Andreev
 Duke University


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


Re: [R] unexpected GAM result - at least for me!

2008-03-31 Thread Duncan Murdoch
On 3/31/2008 8:34 AM, Monica Pisica wrote:
 
 Hi
 
 
 I am afraid i am not understanding something  very fundamental and does 
 not matter how much i am looking into the book Generalized Additive Models  
 of S. Wood i still don't understand my result.
 
 I am trying to model presence / absence (presence = 1, absence = 0) of a 
 species using some lidar metrics (i have 4 of these). I am using different 
 models and such  and when i used gam i got this very weird (for me) 
 result which i thought it is not possible - or i have no idea how to 
 interpret it.
 
 can3.gam - gam(can0~s(be)+s(crr)+s(ch)+s(home), family = 'binomial')
 summary(can3.gam)
 Family: binomial
 Link function: logit
 Formula:
 can 0 ~ s(be) + s(crr) + s(ch) + s(home)
 Parametric coefficients:
 Estimate Std. Error z value Pr(|z|)
 (Intercept)85.39 162.88   0.524  0.6
 Approximate significance of smooth terms:
   edf Est.rank Chi.sq p-value
 s(be)   1.0001  0.100   0.751
 s(crr)  3.9298  0.380   1.000
 s(ch)   6.8209  0.396   1.000
 s(home) 1.0001  0.314   0.575
 R-sq.(adj) =  1   Deviance explained =  100%
 UBRE score = -0.81413  Scale est. = 1 n = 148
 
 Is this a perfect fit with no statistical significance, an over-estimating or 
 what It seems that the significance of the smooths terms is null. Of 
 course with such a model i predict perfectly presence / absence of species.
 
 Again, i hope you don't mind i'm asking you this. Any explanation will be 
 very much appreciated.

Look at the data.  You can get a perfect fit to a logistic regression 
model fairly easily, and it looks as though you've got one.  (In fact, 
the huge intercept suggests that all predictions will be 1.  Do you 
actually have any variation in the data?)

Duncan Murdoch

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


Re: [R] L-BFGS-B needs finite values of 'fn'

2008-03-31 Thread Paul Smith
Thanks for you help and for having called my attention to the trace
facilities of optim(), which are really helpful.

Paul



On Mon, Mar 31, 2008 at 12:43 PM, Prof Brian Ripley
[EMAIL PROTECTED] wrote:
 Your function gives -Inf at the lower bound on the parameters, so you are
  minimizing a function without a lower bound.

  Using the trace facilities of optim() would have got you thereeasily
  enough.




  On Mon, 31 Mar 2008, Paul Smith wrote:

   Dear All,
  
   I am trying to solve the optimization problem below, but I am always
   getting the following error:
  
   Error in optim(rep(20, nvar), f, gr, method = L-BFGS-B, lower = rep(0,  :
L-BFGS-B needs finite values of 'fn'
  
   Any ideas?
  
   Thanks in advance,
  
   Paul
  
   ---
  
   k - 1
   b - 0.3
  
   f - function(x) {
  
n - length(x)
  
r - sum((b^(0:(n-1)))*log(x)) - 200*(sum(x)-k)^2
  
return(r)
  
   }
  
   gr - function(x) {
  
n - length(x)
  
r - (b^(0:(n-1)))*(1/x) - 400*(sum(x)-k)
  
return(r)
  
   }
  
   nvar - 10
   (sols - 
 optim(rep(20,nvar),f,gr,method=L-BFGS-B,lower=rep(0,nvar),upper=rep(k,nvar),control=list(fnscale=-1,parscale=rep(2000,nvar),factr=1e-300,pgtol=1e-300)))
  
   __
   R-help@r-project.org mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
   and provide commented, minimal, self-contained, reproducible code.
  

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


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


Re: [R] Comparing Time Series

2008-03-31 Thread nathan3073

It is a reaction time experiment. My program will display 25 circles,
arranged in a 5x5 square. The program will light one circle at a time, which
the subject should click ASAP. The time interval between two lighting is
1.5s. If the subject fails to click in approriate time, the data will be
considered missing.

The one I want to explore is the relationship between intellegence and the
ability to recognize visual stimuli regularity. I arrange the experiment so
there will be 4 repeated pattern. At last, after all pattern have been
displayed, my program will light the circle randomly.

I want to check the time series plots, in order to clarify my hypothesis
that the 'smart' and the 'average' deal with stimuli in a different way. For
example, because of 'smart' people is known to be able to recognize
regularity faster, we may expect their plot to decline quite rapidly. But,
because of their automation, we may also expect that they will find some
difficulties to adapt when the pattern has changed. The adaptation
difficulty may be represented (hopefully) by an increasing reaction time.

I think to check every subject's plot, and determine their ARIMA(p,d,q)
model. Then, if they all follow same ARIMA model, obviously my hypothesis is
wrong, and I may conclude that there are no differences in the way subject
deal with stimuli. But, if let's say 20 subject follow ARIMA(1,0,1) and the
others follow ARIMA(0,0,2) I can say that there are differences in the
subject's cognitive ability for dealing with stimuli. For now, I set aside
what the differences is and its psychological explanation.

The problem is, it will be very frustating to have 200 subjects and
determine approriate ARIMA model for each plot. So, there're only 2 ways
left. One, I reduce the number of subjects to manageable quantity, let's say
30 subjects. Or two, I know method(s) that make me possible to analyze
multiple time series plot, and say whether they follow same or different
model.

Thank you,
regards,
Nathanael

PS: please forgive grammatical error


Prof Brian Ripley wrote:
 
 Surely you need the insight before choosing a package?
 
 What is the problem you are trying to solve?  There are many different 
 aspects of time series which could be of interest, and we have no idea 
 which are relevant to your problem.
 
 On Sun, 30 Mar 2008, nathan3073 wrote:
 

 Dear All,
 I need to compare hundreds (about 200-300) of time series. Would anyone
 tell
 me how to do this in R? If R has no package for doing this, can I get
 some
 insight what method I should use?

 best regards,
 Nathanael Gratias
 --
 View this message in context:
 http://www.nabble.com/Comparing-Time-Series-tp16392632p16392632.html
 Sent from the R help mailing list archive at Nabble.com.

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

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

-- 
View this message in context: 
http://www.nabble.com/Comparing-Time-Series-tp16392632p16396039.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] unexpected GAM result - at least for me!

2008-03-31 Thread Monica Pisica

Thanks Duncan.
 
Yes i do have variation in the lidar metrics (be, ch, crr, and home) although i 
have a quite high correlation between ch and home. But even if i eliminate one 
metric (either ch or home) i end up with a deviation of 99.99. The species has 
values of 0 and 1 since i try to predict presence / absence.
 
Do you think it is still a valid result?
 
Thanks again,
 
Monica Date: Mon, 31 Mar 2008 08:47:48 -0400 From: [EMAIL PROTECTED] To: 
[EMAIL PROTECTED] CC: r-help@r-project.org Subject: Re: [R] unexpected GAM 
result - at least for me!  On 3/31/2008 8:34 AM, Monica Pisica wrote:
Hi  I am afraid i am not understanding something very fundamental 
and does not matter how much i am looking into the book Generalized Additive 
Models of S. Wood i still don't understand my result.I am trying to 
model presence / absence (presence = 1, absence = 0) of a species using some 
lidar metrics (i have 4 of these). I am using different models and such  
and when i used gam i got this very weird (for me) result which i thought it is 
not possible - or i have no idea how to interpret it.can3.gam - 
gam(can0~s(be)+s(crr)+s(ch)+s(home), family = 'binomial')  
summary(can3.gam)  Family: binomial  Link function: logit  Formula:  
can 0 ~ s(be) + s(crr) + s(ch) + s(home)  Parametric coefficien!
 ts:  Estimate Std. Error z value Pr(|z|)  (Intercept) 85.39 162.88 0.524 
0.6  Approximate significance of smooth terms:  edf Est.rank Chi.sq 
p-value  s(be) 1.000 1 0.100 0.751  s(crr) 3.929 8 0.380 1.000  s(ch) 
6.820 9 0.396 1.000  s(home) 1.000 1 0.314 0.575  R-sq.(adj) = 1 Deviance 
explained = 100%  UBRE score = -0.81413 Scale est. = 1 n = 148Is this 
a perfect fit with no statistical significance, an over-estimating or what 
It seems that the significance of the smooths terms is null. Of course with 
such a model i predict perfectly presence / absence of species.Again, i 
hope you don't mind i'm asking you this. Any explanation will be very much 
appreciated.  Look at the data. You can get a perfect fit to a logistic 
regression  model fairly easily, and it looks as though you've got one. (In 
fact,  the huge intercept suggests that all predictions will be 1. Do you  
actually have any variation in the data?)  Duncan Murdoch
_


esh_realtime_042008
[[alternative HTML version deleted]]

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


Re: [R] Reorder the x-axis using lattice

2008-03-31 Thread Richard . Cotton
Is there a way to reorder the xaxis using lattice. Using the 
 following data, the x-axis is ordered as BP GH MH PF RE RP SF VT but
 I would like the x-axis to be ordered as PF RP BP GH VT SF RE MH.
 
 Kön Skalor Tillfälle Medelvärde
 1  Kvinnor BP 1-inskrivning   36.45283
 2  Kvinnor GH 1-inskrivning   38.62255
 3  Kvinnor MH 1-inskrivning   62.9
 4  Kvinnor PF 1-inskrivning   39.80710

   bwplot(Medelvärde ~ Skalor| Kön , kt, panel = panel.superpose,
groups = Tillfälle,scales = list(x = list(rot = 45),cex=0.7,
 alternating=2),
 ...

When the x-axis is a factor, bwplot plots in order of the factor levels. 
You'll need to explicitly set the levels in your data frame:

Skalor - factor(c(BP, GH, MH, PF, RE, RP, SF, VT, BP, 
GH, MH, PF, RE, RP, SF, VT), levels=c(PF, RP, BP, 
GH, VT, SF, RE, MH))
kt - data.frame(Kon=Kon, Skalor=Skalor, ...)
bwplot(...) #as before

Regards,
Richie.

Mathematical Sciences Unit
HSL


[EMAIL PROTECTED] wrote on 31/03/2008 11:05:18:

 Dear list,
 

 5  Kvinnor RE 1-inskrivning   41.50943
 6  Kvinnor RP 1-inskrivning   22.2
 7  Kvinnor SF 1-inskrivning   59.19811
 8  Kvinnor VT 1-inskrivning   34.84568
 9  Kvinnor BP 2-utskrivning   43.14815
 10 Kvinnor GH 2-utskrivning   44.11321
 11 Kvinnor MH 2-utskrivning   77.2
 12 Kvinnor PF 2-utskrivning   44.74280
 13 Kvinnor RE 2-utskrivning   68.95425
 14 Kvinnor RP 2-utskrivning   39.90385
 15 Kvinnor SF 2-utskrivning   64.62264
 16 Kvinnor VT 2-utskrivning   51.97531
 
 

panel.groups = panel.linejoin,lty=c(1:3),lwd=3,
 col=c(steelblue,grey50,green4),
ylab = list(label = skalpoäng (0-100), cex = 0.8),
xlab = list(label = skalor, cex = 0.8),
key = list(lines = 
 Rows(list(col=c(steelblue,grey50,green4),lty=c(1:3)),
 c(1:3, 0)),cex=0.8,text = list(lab = as.
 character(unique(kt$Tillfälle))),
   columns = 2, title = SF-36: Skalpoäng för 
 respektive kön vid 3 mättillfälle ,
   cex.title=0.9))
 
   Thanks in advance,
   Tom
 
 
 -
 
 Jämför pris på flygbiljetter och hotellrum: http://shopping.yahoo.
 se/c-169901-resor-biljetter.html
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


ATTENTION:

This message contains privileged and confidential inform...{{dropped:21}}

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


Re: [R] Comparing Time Series

2008-03-31 Thread Gabor Grothendieck
You could look at the dtw package.  If x and y are two time series,
dtw(x, y)$distance returns the distance between them in the sense
discussed in the package.

On Mon, Mar 31, 2008 at 8:37 AM, nathan3073 [EMAIL PROTECTED] wrote:

 It is a reaction time experiment. My program will display 25 circles,
 arranged in a 5x5 square. The program will light one circle at a time, which
 the subject should click ASAP. The time interval between two lighting is
 1.5s. If the subject fails to click in approriate time, the data will be
 considered missing.

 The one I want to explore is the relationship between intellegence and the
 ability to recognize visual stimuli regularity. I arrange the experiment so
 there will be 4 repeated pattern. At last, after all pattern have been
 displayed, my program will light the circle randomly.

 I want to check the time series plots, in order to clarify my hypothesis
 that the 'smart' and the 'average' deal with stimuli in a different way. For
 example, because of 'smart' people is known to be able to recognize
 regularity faster, we may expect their plot to decline quite rapidly. But,
 because of their automation, we may also expect that they will find some
 difficulties to adapt when the pattern has changed. The adaptation
 difficulty may be represented (hopefully) by an increasing reaction time.

 I think to check every subject's plot, and determine their ARIMA(p,d,q)
 model. Then, if they all follow same ARIMA model, obviously my hypothesis is
 wrong, and I may conclude that there are no differences in the way subject
 deal with stimuli. But, if let's say 20 subject follow ARIMA(1,0,1) and the
 others follow ARIMA(0,0,2) I can say that there are differences in the
 subject's cognitive ability for dealing with stimuli. For now, I set aside
 what the differences is and its psychological explanation.

 The problem is, it will be very frustating to have 200 subjects and
 determine approriate ARIMA model for each plot. So, there're only 2 ways
 left. One, I reduce the number of subjects to manageable quantity, let's say
 30 subjects. Or two, I know method(s) that make me possible to analyze
 multiple time series plot, and say whether they follow same or different
 model.

 Thank you,
 regards,
 Nathanael

 PS: please forgive grammatical error



 Prof Brian Ripley wrote:
 
  Surely you need the insight before choosing a package?
 
  What is the problem you are trying to solve?  There are many different
  aspects of time series which could be of interest, and we have no idea
  which are relevant to your problem.
 
  On Sun, 30 Mar 2008, nathan3073 wrote:
 
 
  Dear All,
  I need to compare hundreds (about 200-300) of time series. Would anyone
  tell
  me how to do this in R? If R has no package for doing this, can I get
  some
  insight what method I should use?
 
  best regards,
  Nathanael Gratias
  --
  View this message in context:
  http://www.nabble.com/Comparing-Time-Series-tp16392632p16392632.html
  Sent from the R help mailing list archive at Nabble.com.
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
  --
  Brian D. Ripley,  [EMAIL PROTECTED]
  Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
  University of Oxford, Tel:  +44 1865 272861 (self)
  1 South Parks Road, +44 1865 272866 (PA)
  Oxford OX1 3TG, UKFax:  +44 1865 272595
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 

 --
 View this message in context: 
 http://www.nabble.com/Comparing-Time-Series-tp16392632p16396039.html

 Sent from the R help mailing list archive at Nabble.com.

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


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


Re: [R] Comparing Time Series

2008-03-31 Thread Ingmar Visser
Nathanael,

On 31 Mar 2008, at 14:37, nathan3073 wrote:


 It is a reaction time experiment. My program will display 25 circles,
 arranged in a 5x5 square. The program will light one circle at a  
 time, which
 the subject should click ASAP. The time interval between two  
 lighting is
 1.5s. If the subject fails to click in approriate time, the data  
 will be
 considered missing.

 The one I want to explore is the relationship between intellegence  
 and the
 ability to recognize visual stimuli regularity. I arrange the  
 experiment so
 there will be 4 repeated pattern. At last, after all pattern have been
 displayed, my program will light the circle randomly.

 I want to check the time series plots, in order to clarify my  
 hypothesis
 that the 'smart' and the 'average' deal with stimuli in a different  
 way. For
 example, because of 'smart' people is known to be able to recognize
 regularity faster, we may expect their plot to decline quite  
 rapidly. But,
 because of their automation, we may also expect that they will find  
 some
 difficulties to adapt when the pattern has changed. The adaptation
 difficulty may be represented (hopefully) by an increasing reaction  
 time.

How important is the time series aspect here? Why not just do some anova
on the difference between these blocks of trials?
If the time information is essential, repeated measures anova could  
be applied.

 I think to check every subject's plot, and determine their ARIMA 
 (p,d,q)
 model. Then, if they all follow same ARIMA model, obviously my  
 hypothesis is
 wrong, and I may conclude that there are no differences in the way  
 subject
 deal with stimuli. But, if let's say 20 subject follow ARIMA(1,0,1)  
 and the
 others follow ARIMA(0,0,2) I can say that there are differences in the
 subject's cognitive ability for dealing with stimuli. For now, I  
 set aside
 what the differences is and its psychological explanation.

This sounds like you need a mixture of ARIMA models. Is that indeed  
the hypothesis
that you want to test: whether there are different strategies that  
result in either
an AR learning process or in an MA learning process?

 The problem is, it will be very frustating to have 200 subjects and

Who said doing research was going to be fun (-;

 determine approriate ARIMA model for each plot. So, there're only 2  
 ways
 left. One, I reduce the number of subjects to manageable quantity,  
 let's say
 30 subjects. Or two, I know method(s) that make me possible to analyze
 multiple time series plot, and say whether they follow same or  
 different
 model.

Using a mixture of ARIMA models would allow you to analyze these data
simultaneously.

hth, Ingmar


 Thank you,
 regards,
 Nathanael

 PS: please forgive grammatical error


 Prof Brian Ripley wrote:

 Surely you need the insight before choosing a package?

 What is the problem you are trying to solve?  There are many  
 different
 aspects of time series which could be of interest, and we have no  
 idea
 which are relevant to your problem.

 On Sun, 30 Mar 2008, nathan3073 wrote:


 Dear All,
 I need to compare hundreds (about 200-300) of time series. Would  
 anyone
 tell
 me how to do this in R? If R has no package for doing this, can I  
 get
 some
 insight what method I should use?

 best regards,
 Nathanael Gratias
 --
 View this message in context:
 http://www.nabble.com/Comparing-Time-Series-tp16392632p16392632.html
 Sent from the R help mailing list archive at Nabble.com.

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


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

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



 -- 
 View this message in context: http://www.nabble.com/Comparing-Time- 
 Series-tp16392632p16396039.html
 Sent from the R help mailing list archive at Nabble.com.

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

Ingmar Visser
Department of Psychology, University of Amsterdam
Roetersstraat 15
1018 WB Amsterdam
The Netherlands
t: +31-20-5256723



[[alternative HTML version deleted]]


Re: [R] lmer function.

2008-03-31 Thread Douglas Bates
On Mon, Mar 31, 2008 at 7:13 AM, Boikanyo Makubate
[EMAIL PROTECTED] wrote:
 I am using the lmer function from the lme4 package.  I wrote the
  following statement, specifying the method to be adaptive Gaussian
  quadrature. I am getting an error saying method = AGQ not yet
  implemented for supernodal representation.  Please help.

fit -
  lmer(response~beta1+(1|patient),family=binomial,method=AGQ,data=data.2)

As the message indicates, the AGQ method has not yet been implemented.

It is very tricky to implement the AGQ method.  For one thing it would
be infeasible for more than one grouping factor for the random effects
if these were non-nested.  The Laplacian method is the default method
in the development version of the lme4 package, available as

install.packages(lme4, repos = http://r-forge.r-project.org;)

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


Re: [R] unexpected GAM result - at least for me!

2008-03-31 Thread Duncan Murdoch
On 3/31/2008 9:01 AM, Monica Pisica wrote:
   Thanks Duncan.
  
 Yes i do have variation in the lidar metrics (be, ch, crr, and home) 
 although i have a quite high correlation between ch and home. But even 
 if i eliminate one metric (either ch or home) i end up with a deviation 
 of 99.99. The species has values of 0 and 1 since i try to predict 
 presence / absence.
  
 Do you think it is still a valid result?

I repeat:  look at the data. Compare the observed and predicted. That's 
the only way to know whether this is reasonable or not.

If you're getting reasonable predictions, then it's a valid fit.  (The 
tests and approximations used in the reported p-values may not be at all 
valid.  I don't know what the requirements are for those in a GAM, but 
if you're getting a perfect fit, then they probably aren't being met.)

Duncan Murdoch


  
 Thanks again,
  
 Monica
 
   Date: Mon, 31 Mar 2008 08:47:48 -0400
   From: [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   CC: r-help@r-project.org
   Subject: Re: [R] unexpected GAM result - at least for me!
  
   On 3/31/2008 8:34 AM, Monica Pisica wrote:
   
Hi
   
   
I am afraid i am not understanding something very fundamental 
 and does not matter how much i am looking into the book Generalized 
 Additive Models of S. Wood i still don't understand my result.
   
I am trying to model presence / absence (presence = 1, absence = 0) 
 of a species using some lidar metrics (i have 4 of these). I am using 
 different models and such  and when i used gam i got this very weird 
 (for me) result which i thought it is not possible - or i have no idea 
 how to interpret it.
   
can3.gam - gam(can0~s(be)+s(crr)+s(ch)+s(home), family = 'binomial')
summary(can3.gam)
Family: binomial
Link function: logit
Formula:
can 0 ~ s(be) + s(crr) + s(ch) + s(home)
Parametric coefficients:
Estimate Std. Error z value Pr(|z|)
(Intercept) 85.39 162.88 0.524 0.6
Approximate significance of smooth terms:
edf Est.rank Chi.sq p-value
s(be) 1.000 1 0.100 0.751
s(crr) 3.929 8 0.380 1.000
s(ch) 6.820 9 0.396 1.000
s(home) 1.000 1 0.314 0.575
R-sq.(adj) = 1 Deviance explained = 100%
UBRE score = -0.81413 Scale est. = 1 n = 148
   
Is this a perfect fit with no statistical significance, an 
 over-estimating or what It seems that the significance of the 
 smooths terms is null. Of course with such a model i predict perfectly 
 presence / absence of species.
   
Again, i hope you don't mind i'm asking you this. Any explanation 
 will be very much appreciated.
  
   Look at the data. You can get a perfect fit to a logistic regression
   model fairly easily, and it looks as though you've got one. (In fact,
   the huge intercept suggests that all predictions will be 1. Do you
   actually have any variation in the data?)
  
   Duncan Murdoch
 
 
 In a rush? Get real-time answers with Windows Live Messenger. 
 http://www.windowslive.com/messenger/overview.html?ocid=TXT_TAGLM_WL_Refresh_realtime_042008

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


[R] convert delimited string to vector

2008-03-31 Thread Brad Christoffersen
Hi R Users,

Simple question:  How might I convert the text a, b, c (or for that matter a
b c with any delimiter - space, comma, etc.) into a 3-element character
vector?

[1] a b c

Thanks,
Brad

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


Re: [R] Number of variables in lrm (Design)

2008-03-31 Thread Frank E Harrell Jr
Paul Sweeting wrote:
 Hi
 
  
 
 I'm sure this is straightforward, but I can't find an answer.
 
  
 
 I'm trying to find the function that returns the number of dependent
 variables/rank of the regression/degrees of freedom/something similar.  Any
 ideas?
 
  
 
 Thanks!
 
  
 
 Paul

Design does not allow for singularities.  To get the regression d.f. you 
can use length(coef(fit))-num.intercepts(fit) or just fit$stats['d.f.']

Frank

-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

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


[R] Retrieving locations of element of a vector or matrix

2008-03-31 Thread Yemi Oyeyemi
Hello all,
  I have a problem of getting the locations of elements in a vector or matrix. 
I know one can use the command which.min or which.max to get the location of 
minimum or maximum values in a vector. But is there any command to get the 
first k minimum values or maximum values in a vector.
  Thanks

   
-
You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.
[[alternative HTML version deleted]]

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


Re: [R] L-BFGS-B needs finite values of 'fn'

2008-03-31 Thread Zaihra T

   try something like  this before wrapping up your function else i guess u'll
   have to stick to Prof Brian Ripley  suggestion his suggestions are usually
   best bet .

f - function(x) {

   n - length(x)
   r - sum((b^(0:(n-1)))*log(x)) - 200*(sum(x)-k)^2
if(!is.finite(r))

   r-1e+20 return(r)
   }

   have a nice day.

   On Mon, 31 Mar 2008 12:24:09 +0100 Paul Smith wrote:
Dear All,
   
I am trying to solve the optimization problem below, but I am always
getting the following error:
   
Error in optim(rep(20, nvar), f, gr, method = L-BFGS-B, lower = rep(0, :
L-BFGS-B needs finite values of 'fn'
   
Any ideas?
   
Thanks in advance,
   
Paul
   
-! --
   
k - 1
b - 0.3
   
f - function(x) {
   
n - length(x)
   
r - sum((b^(0:(n-1)))*log(x)) - 200*(sum(x)-k)^2
   
return(r)
   
}
   
gr - function(x) {
   
n - length(x)
   
r - (b^(0:(n-1)))*(1/x) - 400*(sum(x)-k)
   
return(r)
   
}
   
nvar - 10
(sols -
   
   optim(rep(20,nvar),f,gr,method=L-BFGS-B,lower=rep(0,nvar),upper=rep(k,nvar
   ),control=list(fnscale=-1,parscale=rep(2000,nvar),factr=1e-300,pgtol=1e-300)
   ))
   
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
   http://www.R-project.org/posting-guide.htm! l
and provide commented, minimal, self-contained, reproduci ble code.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] convert delimited string to vector

2008-03-31 Thread Chuck Cleland
On 3/31/2008 9:43 AM, Brad Christoffersen wrote:
 Hi R Users,
 
 Simple question:  How might I convert the text a, b, c (or for that matter 
 a
 b c with any delimiter - space, comma, etc.) into a 3-element character
 vector?
 
 [1] a b c
 
 Thanks,
 Brad

unlist(strsplit(a b c, split= ))
[1] a b c

unlist(strsplit(a, b, c, split=, ))
[1] a b c

?strsplit

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

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

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


Re: [R] Defining reference category for a cph model summary inside of a for loop

2008-03-31 Thread Wells, Brian
Frank, 

Thanks again, I didn't realize that continuous variables could be
manipulated that way inside of the summary function. 

I realize that my code was kind of confusing. 

The variables A...F are all categorical variables. They each have
four levels named 1st Quartile4th Quartile

I tried the code below with the same result. 
print(summary(f, eval(parse(text=paste(i,='1st Quartile', sep='')

In the output, the reference category is different for each of the
variables. 

Brian 
-Original Message-
From: Frank E Harrell Jr [mailto:[EMAIL PROTECTED] 
Sent: Sunday, March 30, 2008 9:14 AM
To: Wells, Brian
Cc: r-help@r-project.org
Subject: Re: [R] Defining reference category for a cph model summary
inside of a for loop

Wells, Brian wrote:
 Dr. Harrell, 
 Thanks for you help. 
 
 I tried:
 
 print(summary(f,parse(text=paste(i,'=1st Quartile', sep=''
 
 Same result. No error, the reference category simply doesn't change. 

That's good, because the default in summary is to compare the outer 
quartiles for a continuous variable.  And as I said before the string 
'1st Quartile' has no special meaning for R or Design.

Get what you are trying to do to work without parse (and you'll need 
eval() with parse) first.  When you want total control over a setting, 
say getting a hazard ratio for the .2 to the .8 quantile, do something
like

summary(f, age=quantile(age,c(.2,.8),na.rm=TRUE))

Frank

 
 Brian 
 
 -Original Message-
 From: Frank E Harrell Jr [mailto:[EMAIL PROTECTED] 
 Sent: Friday, March 28, 2008 8:34 PM
 To: Wells, Brian
 Cc: r-help@r-project.org
 Subject: Re: [R] Defining reference category for a cph model summary
 inside of a for loop
 
 Wells, Brian wrote:
 I have the following code. 

  

  

 f - cph(formula = Surv(TimeToDeath, Dead == Yes)
 ~1,data=single.dat, x=T, y=T, surv=T)

 for(i in c('A', 'B', 'C', 'D', 'E', 'F')){
 f -update(f,as.formula(paste('Surv(TimeToDeath, Dead ==
 Yes)~',i,sep='')))

 print(summary(f, paste(i,=1st Quartile, sep='')))
  

  

 There is no error message generated in R, but R ignores the reference
 category defined with paste in the summary function for the cph
model.
 
  

 The output uses the 1st Quartile as the reference category to
 calculate hazards for some of the variables defined by i, but not all
 of
 them. 
 
 
 Your code is confusing.  What is to the right of ~ in a formula is a 
 predictor variable name, not a value.  If your variables are named A,
B,
 
 C, ... you are OK.
 
 '1st Quartile' has no special meaning to R or Design, and you can't
pass
 
 a character string as a second argument to summary and expect it to
 work.
 
 You will need parse(text=paste(...)) to create an appropriate
 expression.
 
 But Design gives you inter-quartile range hazard ratios by default
 anyway.
 
 Beware of getting hazard ratios that are not adjusted for other 
 variables needed in the model.
 
 Frank Harrell
 
  

  

 Any help would be greatly appreciated. 

  

 thanks

  

 Brian J. Wells, MD, MS

 Research Associate

 Quantitative Health Sciences

 Cleveland Clinic

 


-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt
University



P Please consider the environment before printing this e-mail

Cleveland Clinic is ranked one of the top hospitals
in America by U.S. News  World Report (2007).  
Visit us online at http://www.clevelandclinic.org for
a complete listing of our services, staff and
locations.


Confidentiality Note:  This message is intended for use\...{{dropped:13}}

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


Re: [R] convert delimited string to vector

2008-03-31 Thread Henrique Dallazuanna
Or:

scan(textConnection(a, b, c), what=character, sep=,)

On 31/03/2008, Brad Christoffersen [EMAIL PROTECTED] wrote:
 Hi R Users,

  Simple question:  How might I convert the text a, b, c (or for that matter 
 a
  b c with any delimiter - space, comma, etc.) into a 3-element character
  vector?

  [1] a b c

  Thanks,
  Brad

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



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

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


Re: [R] Retrieving locations of element of a vector or matrix

2008-03-31 Thread Henrique Dallazuanna
I think that you can use:

x - sample(1:20, 10)
head(sort(x), 5) #First 5 minimum values
head(sort(x, decreasing = TRUE), 5) #First 5 maximum values

On 31/03/2008, Yemi Oyeyemi [EMAIL PROTECTED] wrote:
 Hello all,
   I have a problem of getting the locations of elements in a vector or 
 matrix. I know one can use the command which.min or which.max to get the 
 location of minimum or maximum values in a vector. But is there any command 
 to get the first k minimum values or maximum values in a vector.
   Thanks


  -
  You rock. That's why Blockbuster's offering you one month of Blockbuster 
 Total Access, No Cost.
 [[alternative HTML version deleted]]

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



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

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


Re: [R] Retrieving locations of element of a vector or matrix

2008-03-31 Thread Henrique Dallazuanna
For the position use order indeed of sort

On 31/03/2008, Henrique Dallazuanna [EMAIL PROTECTED] wrote:
 I think that you can use:

  x - sample(1:20, 10)
  head(sort(x), 5) #First 5 minimum values
  head(sort(x, decreasing = TRUE), 5) #First 5 maximum values


  On 31/03/2008, Yemi Oyeyemi [EMAIL PROTECTED] wrote:
   Hello all,
 I have a problem of getting the locations of elements in a vector or 
 matrix. I know one can use the command which.min or which.max to get the 
 location of minimum or maximum values in a vector. But is there any command 
 to get the first k minimum values or maximum values in a vector.
 Thanks
  
  
-
You rock. That's why Blockbuster's offering you one month of Blockbuster 
 Total Access, No Cost.
   [[alternative HTML version deleted]]
  
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
  



 --
  Henrique Dallazuanna
  Curitiba-Paraná-Brasil
  25° 25' 40 S 49° 16' 22 O



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

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


Re: [R] Defining reference category for a cph model summary inside of a for loop

2008-03-31 Thread Frank E Harrell Jr
Wells, Brian wrote:
 Frank, 
 
 Thanks again, I didn't realize that continuous variables could be
 manipulated that way inside of the summary function. 
 
 I realize that my code was kind of confusing. 
 
 The variables A...F are all categorical variables. They each have
 four levels named 1st Quartile4th Quartile
 
 I tried the code below with the same result. 
 print(summary(f, eval(parse(text=paste(i,='1st Quartile', sep='')
 
 In the output, the reference category is different for each of the
 variables. 
 
 Brian 

Thanks for clarifying.  That approach will NOT provide estimates at the 
quartiles.  For example a hazard ratio for the upper quartile category 
to the lower quartile category will estimate the ratio of hazards when 
XQ3 to when XQ1 where outer quartiles are Q1 and Q3.  This represents 
a hazard ratio of an unknown mixture of distributions and will not 
transport to another sample with a different mixture.

In addition you will have serious residual confounding with that 
approach by not adjusting for all the information in continuous predictors.

Frank

 -Original Message-
 From: Frank E Harrell Jr [mailto:[EMAIL PROTECTED] 
 Sent: Sunday, March 30, 2008 9:14 AM
 To: Wells, Brian
 Cc: r-help@r-project.org
 Subject: Re: [R] Defining reference category for a cph model summary
 inside of a for loop
 
 Wells, Brian wrote:
 Dr. Harrell, 
 Thanks for you help. 

 I tried:

 print(summary(f,parse(text=paste(i,'=1st Quartile', sep=''
 Same result. No error, the reference category simply doesn't change. 
 
 That's good, because the default in summary is to compare the outer 
 quartiles for a continuous variable.  And as I said before the string 
 '1st Quartile' has no special meaning for R or Design.
 
 Get what you are trying to do to work without parse (and you'll need 
 eval() with parse) first.  When you want total control over a setting, 
 say getting a hazard ratio for the .2 to the .8 quantile, do something
 like
 
 summary(f, age=quantile(age,c(.2,.8),na.rm=TRUE))
 
 Frank
 
 Brian 

 -Original Message-
 From: Frank E Harrell Jr [mailto:[EMAIL PROTECTED] 
 Sent: Friday, March 28, 2008 8:34 PM
 To: Wells, Brian
 Cc: r-help@r-project.org
 Subject: Re: [R] Defining reference category for a cph model summary
 inside of a for loop

 Wells, Brian wrote:
 I have the following code. 

  

  

 f - cph(formula = Surv(TimeToDeath, Dead == Yes)
 ~1,data=single.dat, x=T, y=T, surv=T)

 for(i in c('A', 'B', 'C', 'D', 'E', 'F')){
 f -update(f,as.formula(paste('Surv(TimeToDeath, Dead ==
 Yes)~',i,sep='')))

 print(summary(f, paste(i,=1st Quartile, sep='')))
  

  

 There is no error message generated in R, but R ignores the reference
 category defined with paste in the summary function for the cph
 model.
  

 The output uses the 1st Quartile as the reference category to
 calculate hazards for some of the variables defined by i, but not all
 of
 them. 

 Your code is confusing.  What is to the right of ~ in a formula is a 
 predictor variable name, not a value.  If your variables are named A,
 B,
 C, ... you are OK.

 '1st Quartile' has no special meaning to R or Design, and you can't
 pass
 a character string as a second argument to summary and expect it to
 work.

 You will need parse(text=paste(...)) to create an appropriate
 expression.

 But Design gives you inter-quartile range hazard ratios by default
 anyway.

 Beware of getting hazard ratios that are not adjusted for other 
 variables needed in the model.

 Frank Harrell

  

  

 Any help would be greatly appreciated. 

  

 thanks

  

 Brian J. Wells, MD, MS

 Research Associate

 Quantitative Health Sciences

 Cleveland Clinic

 
 


-- 
Frank E Harrell Jr   Professor and Chair   School of Medicine
  Department of Biostatistics   Vanderbilt University

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


[R] Memory in R.

2008-03-31 Thread R RR
Hi,

I am pretty new in R.
In fact, I started using R last month.
So, be indulgent if my questions seem
too boring or obvious.

I have 2 basic questions:

1 - I want to increase memory, but I can't find
the right way. E.g: in stata, you just type set memory 1g.
When I try to load huge datasets, R crashes.

2 - I want to clear the memory (no object or data), such as the
clear command in stata.

Best regards.

Amadou DIALLO.
PhD student.
Cerdi, University of Auvergne
France.

[[alternative HTML version deleted]]

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


[R] concatenating two successive time series

2008-03-31 Thread Jędrzej Bojanowski
Dear Helpers,

I am looking for methods and tools to compare and then to concatenate 
two successive time series. They are both in the same frequency and they 
describe one phenomena. There is no time gap between them. The problem 
is that the method of measurements has changed between both time series 
and they are no statistically the same. I would like to merge them to 
receive one homogeneous time series.

Here is an example of time series ts1 (1982-1999) and ts2 (2000-2006). 
Zeros are NA's.

 ts1 - structure(c(100, 48, 31, 10, 16, 25, 56, 81, 51, 45, 73, 112,
103, 60, 30, 21, 10, 26, 60, 55, 40, 46, 78, 125, 55, 21, 22,
11, 13, 20, 38, 25, 17, 27, 49, 68, 40, 29, 44, 10, 21, 28, 58,
71, 50, 68, 88, 38, 71, 37, 51, 11, 30, 30, 52, 59, 40, 47, 91,
95, 62, 31, 44, 12, 27, 35, 36, 69, 32, 50, 81, 88, 72, 47, 28,
20, 9, 15, 34, 38, 10, 18, 56, 124, 79, 26, 29, 9, 16, 21, 71,
74, 52, 49, 80, 84, 52, 36, 37, 12, 21, 23, 70, 75, 69, 69, 81,
66, 53, 26, 18, 12, 12, 11, 45, 60, 40, 39, 64, 80, 72, 30, 23,
9, 18, 22, 53, 77, 45, 31, 54, 59, 26, 16, 14, 4, 4, 12, 20,
21, 7, 13, 28, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 36,
17, 18, 12, 28, 99, 90, 72, 69, 98, 78, 56, 31, 48, 11, 15, 31,
70, 79, 67, 80, 107, 76, 43, 15, 29, 13, 17, 30, 70, 86, 52,
35, 45, 93, 80, 49, 29, 16, 12, 23, 68, 80, 38, 52, 86, 94, 67,
30, 14, 10, 14, 21, 35, 49, 33, 20, 39, 77), .Tsp = c(1982, 
1999.917,
12), class = ts)

 ts2 - structure(c(0, 0, 0, 220, 72, 45, 45, 56, 60, 80, 81, 99, 97,
92, 220, 141, 85, 40, 74, 115, 88, 97, 127, 107, 90, 86, 185,
193, 100, 43, 45, 73, 74, 95, 87, 107, 77, 63, 163, 123, 106,
35, 102, 122, 103, 96, 104, 140, 135, 87, 215, 173, 56, 38, 80,
90, 113, 72, 86, 95, 88, 93, 198, 128, 40, 28, 76, 133, 80, 89,
72, 108, 102, 86, 199, 204, 84, 60, 49, 103, 121, 98, 108, 165
), .Tsp = c(2000, 2006.917, 12), class = ts)

When we plot them together the difference is visible:

 ts12 - ts(c(ts1,ts2),start=1982,frequency=12)
 plot(ts12)

but
 plot(decompose(ts12))
confirm that both describe one phenomena.

I have dozens of such pairs and I would like to find a method to 
recalculate one ts to the other to make one homogeneous ts.

Do you have any suggestions how to statistically concatenate those two 
ts or zoo (I tried this package) objects?   Thanks in advance for the 
answer and the precious time you might waste.

Regards,

Jedrzej


PS. Włącz radio w Twoim komputerze!
Muzyka idealna do pracy i do zabawy! - Kliknij:
http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fradiokosci.htmlsid=291

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


[R] Cannot find new threads: generic error when require(RODBC) with -d gdb

2008-03-31 Thread Matthew Dowle
Hi,
 
We have the error below.  Any ideas ?
 
Regards, Matt

 
$  R --vanilla -d gdb

GNU gdb 6.7.1-debian

Copyright (C) 2007 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later
http://gnu.org/licenses/gpl.html

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type show
copying

and show warranty for details.

This GDB was configured as x86_64-linux-gnu...

Using host libthread_db library /lib/libthread_db.so.1.

(gdb) run

Starting program: /misc/local/R-2.4.0/bin/exec/R --vanilla

 

R version 2.4.0 (2006-10-03)

Copyright (C) 2006 The R Foundation for Statistical Computing

ISBN 3-900051-07-0

 

R is free software and comes with ABSOLUTELY NO WARRANTY.

You are welcome to redistribute it under certain conditions.

Type 'license()' or 'licence()' for distribution details.

 

  Natural language support but running in an English locale

 

R is a collaborative project with many contributors.

Type 'contributors()' for more information and

'citation()' on how to cite R or R packages in publications.

 

Type 'demo()' for some demos, 'help()' for on-line help, or

'help.start()' for an HTML browser interface to help.

Type 'q()' to quit R.

 

 require(RODBC)

Loading required package: RODBC

[Thread debugging using libthread_db enabled]

Error while reading shared library symbols:

Cannot find new threads: generic error

Cannot find new threads: generic error

(gdb) 

 

 





This message and any files attached are intended solely for the use of the 
individual or the entity to whom they are addressed and may contain information 
that is confidential. Please notify the sender by e-mail if you are not the 
intended recipient and if you are not the intended recipient you are hereby 
notified that any dissemination, distribution or copying of this message, any 
attachments or their content is prohibited.

To the extent this message contains information regarding any of the investment 
funds managed by Concordia, you should be aware that such funds may only be 
offered pursuant to the relevant private placement or information memorandum. 
Any information contained in this message must be reviewed and considered in 
connection with, and no one is authorized to make any representations or 
warranties or provide information which is inconsistent with, or in addition to 
the relevant private placement or information memorandum. To the extent this 
message contains any performance information, you should be aware that past 
performance is not necessarily indicative of future results.


[[alternative HTML version deleted]]

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


Re: [R] concatenating two successive time series

2008-03-31 Thread Gabor Grothendieck
It might just be a matter of scaling:

ts12s - ts(c(scale(ts1), scale(ts2)), start = 1982, frequency = 12)
plot(ts12s)
plot(decompose(ts12s))


2008/3/31 Jędrzej Bojanowski [EMAIL PROTECTED]:
 Dear Helpers,

 I am looking for methods and tools to compare and then to concatenate
 two successive time series. They are both in the same frequency and they
 describe one phenomena. There is no time gap between them. The problem
 is that the method of measurements has changed between both time series
 and they are no statistically the same. I would like to merge them to
 receive one homogeneous time series.

 Here is an example of time series ts1 (1982-1999) and ts2 (2000-2006).
 Zeros are NA's.

  ts1 - structure(c(100, 48, 31, 10, 16, 25, 56, 81, 51, 45, 73, 112,
 103, 60, 30, 21, 10, 26, 60, 55, 40, 46, 78, 125, 55, 21, 22,
 11, 13, 20, 38, 25, 17, 27, 49, 68, 40, 29, 44, 10, 21, 28, 58,
 71, 50, 68, 88, 38, 71, 37, 51, 11, 30, 30, 52, 59, 40, 47, 91,
 95, 62, 31, 44, 12, 27, 35, 36, 69, 32, 50, 81, 88, 72, 47, 28,
 20, 9, 15, 34, 38, 10, 18, 56, 124, 79, 26, 29, 9, 16, 21, 71,
 74, 52, 49, 80, 84, 52, 36, 37, 12, 21, 23, 70, 75, 69, 69, 81,
 66, 53, 26, 18, 12, 12, 11, 45, 60, 40, 39, 64, 80, 72, 30, 23,
 9, 18, 22, 53, 77, 45, 31, 54, 59, 26, 16, 14, 4, 4, 12, 20,
 21, 7, 13, 28, 56, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 36,
 17, 18, 12, 28, 99, 90, 72, 69, 98, 78, 56, 31, 48, 11, 15, 31,
 70, 79, 67, 80, 107, 76, 43, 15, 29, 13, 17, 30, 70, 86, 52,
 35, 45, 93, 80, 49, 29, 16, 12, 23, 68, 80, 38, 52, 86, 94, 67,
 30, 14, 10, 14, 21, 35, 49, 33, 20, 39, 77), .Tsp = c(1982,
 1999.917,
 12), class = ts)

  ts2 - structure(c(0, 0, 0, 220, 72, 45, 45, 56, 60, 80, 81, 99, 97,
 92, 220, 141, 85, 40, 74, 115, 88, 97, 127, 107, 90, 86, 185,
 193, 100, 43, 45, 73, 74, 95, 87, 107, 77, 63, 163, 123, 106,
 35, 102, 122, 103, 96, 104, 140, 135, 87, 215, 173, 56, 38, 80,
 90, 113, 72, 86, 95, 88, 93, 198, 128, 40, 28, 76, 133, 80, 89,
 72, 108, 102, 86, 199, 204, 84, 60, 49, 103, 121, 98, 108, 165
 ), .Tsp = c(2000, 2006.917, 12), class = ts)

 When we plot them together the difference is visible:

  ts12 - ts(c(ts1,ts2),start=1982,frequency=12)
  plot(ts12)

 but
  plot(decompose(ts12))
 confirm that both describe one phenomena.

 I have dozens of such pairs and I would like to find a method to
 recalculate one ts to the other to make one homogeneous ts.

 Do you have any suggestions how to statistically concatenate those two
 ts or zoo (I tried this package) objects?   Thanks in advance for the
 answer and the precious time you might waste.

 Regards,

 Jedrzej

 
 PS. Włącz radio w Twoim komputerze!
 Muzyka idealna do pracy i do zabawy! - Kliknij:
 http://klik.wp.pl/?adr=http%3A%2F%2Fcorto.www.wp.pl%2Fas%2Fradiokosci.htmlsid=291

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

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


[R] how to extract terms from aov

2008-03-31 Thread Weidong Gu
I couldn't find clues from the achieve of R help that allow to retrieve
the terms of aov. 

 

av2- summary(aov(Prevalence~Random*Bednet*Flight)); av2

 

   Df   Sum Sq  Mean Sq F value  Pr(F)

Targeted2 2.11e+10 1.05e+10  102.90  2e-16 ***

Bednet  2 9.48e+09 4.74e+09   46.35 1.2e-13 ***

Flight  1 1.08e+09 1.08e+09   10.55  0.0018 ** 

Targeted:Bednet 4 6.32e+09 1.58e+09   15.45 3.6e-09 ***

Targeted:Flight 2 7.19e+08 3.59e+083.51  0.0350 *  

Bednet:Flight   2 5.12e+08 2.56e+082.50  0.0889 .  

Targeted:Bednet:Flight  4 3.41e+08 8.53e+070.83  0.5082

Residuals  72 7.37e+09 1.02e+08

 

I would like to extract the first unlabeled column: terms like Targeted,
Bednet... for producing a table, and I know how to extract the others
such as Df, F...

 

Help is appreciated

 

Weidong Gu, 

 

Department of Medicine
University of Alabama, Birmingham
1900 University Blvd., Birmingham, Alabama 35294
Email: [EMAIL PROTECTED]
PH: (205)-975-9053

 


[[alternative HTML version deleted]]

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


Re: [R] how to extract terms from aov

2008-03-31 Thread talepanda
you can access it as a data frame by

  av3-av2[[1]]

then,

  dimnames(av3)[[1]]

gives you the leftmost labels, and also,

  av3$Df
  av3$Sum

etc, gives the values.


  str(object)

always help you to find out the structure of object and how to access 
the information.


HTH


  I couldn't find clues from the achieve of R help that allow to retrieve
  the terms of aov.
 
 
  av2- summary(aov(Prevalence~Random*Bednet*Flight)); av2
 
 
 
 Df   Sum Sq  Mean Sq F value  Pr(F)
  Targeted2 2.11e+10 1.05e+10  102.90  2e-16 ***
 
  Bednet  2 9.48e+09 4.74e+09   46.35 1.2e-13 ***
 
  Flight  1 1.08e+09 1.08e+09   10.55  0.0018 **
  Targeted:Bednet 4 6.32e+09 1.58e+09   15.45 3.6e-09 ***
 
  Targeted:Flight 2 7.19e+08 3.59e+083.51  0.0350 *
  Bednet:Flight   2 5.12e+08 2.56e+082.50  0.0889 .
  Targeted:Bednet:Flight  4 3.41e+08 8.53e+070.83  0.5082
  Residuals  72 7.37e+09 1.02e+08
 
 
 
  I would like to extract the first unlabeled column: terms like Targeted,
  Bednet... for producing a table, and I know how to extract the others
  such as Df, F...
 
 
 
  Help is appreciated
 
 
 
  Weidong Gu,
 
 
  Department of Medicine
  University of Alabama, Birmingham
  1900 University Blvd., Birmingham, Alabama 35294
  Email: [EMAIL PROTECTED]
  PH: (205)-975-9053
 
 
 
 
  [[alternative HTML version deleted]]
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide 
http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Journal for R

2008-03-31 Thread John Vokey
Yes.  Try: Tutorials in Quantitative Methods for Psychology 
http://www.tqmp.org/ 
  (I am on the Editorial Board).

On 31-Mar-08, at 4:00 AM, [EMAIL PROTECTED] wrote:
 Hi the list

 I made up a new statistical procedure. I will publish it in a medical
 journal, but there will be only the way of using it, no calculation or
 algorithme detail.
 So is there a journal (I mean scientific journal) with selection  
 commity
 to submit an article describing the detail of a package?

 Christophe

--
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html

-Dr. John R. Vokey

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


[R] operators %/% bug?

2008-03-31 Thread Lo, Ken
Dear  all,

 

I have come across a strange behavior of the %/% operator, and I wasn't
sure if this was intended.

 

i.e. 

a - 1.2

b - 1.0

(a-b) %/% 0.1  results in 1?

Whereas

0.2 %/% 0.1 results in 2.

 

Am I missing something obvious here?  It seems to be consistent up to R
2.6.0 running in WinXP (haven't upgraded yet).

 

Best,

 

Ken



This email message may contain legally privileged and/or confidential 
information.  If you are not the intended recipient(s), or the employee or 
agent responsible for the delivery of this message to the intended 
recipient(s), you are hereby notified that any disclosure, copying, 
distribution, or use of this email message is prohibited.  If you have received 
this message in error, please notify the sender immediately by e-mail and 
delete this email message from your computer. Thank you.
[[alternative HTML version deleted]]

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


Re: [R] operators %/% bug?

2008-03-31 Thread jim holtman
FAQ 7.31

a-b != 0.2

 a - 1.2

 b - 1.0

 a-b-.2
[1] -5.551115e-17




On 3/31/08, Lo, Ken [EMAIL PROTECTED] wrote:
 Dear  all,



 I have come across a strange behavior of the %/% operator, and I wasn't
 sure if this was intended.



 i.e.

 a - 1.2

 b - 1.0

 (a-b) %/% 0.1  results in 1?

 Whereas

 0.2 %/% 0.1 results in 2.



 Am I missing something obvious here?  It seems to be consistent up to R
 2.6.0 running in WinXP (haven't upgraded yet).



 Best,



 Ken



 This email message may contain legally privileged and/or confidential 
 information.  If you are not the intended recipient(s), or the employee or 
 agent responsible for the delivery of this message to the intended 
 recipient(s), you are hereby notified that any disclosure, copying, 
 distribution, or use of this email message is prohibited.  If you have 
 received this message in error, please notify the sender immediately by 
 e-mail and delete this email message from your computer. Thank you.
[[alternative HTML version deleted]]

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



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

What is the problem you are trying to solve?

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


Re: [R] DE optimization with equality constraint

2008-03-31 Thread Hans W. Borchers
Paul Smith phhs80 at gmail.com writes:
 The problem with DEoptim approach is that is not guaranteed that it
 converges to the solution. Moreover, from my experience, it seems to
 be quite slow when the optimization problem is high-dimensional (i.e.,
 with many variables).
 
 Paul

There is a difference between local and global optimization:

'optim' realizes *local* optimization using a gradient-based approach.
This is fast, but will get stuck in local optima (except method SANN). 
'DEoptim' is one of many approaches to *global* optimization, of which
each has its advantages and drawbacks.

 ...not guaranteed that it converges to the solution.

  As a local optimization routine, also 'optim' does not guarantee to
  reach a (global) optimum.

 [DEoptim] seems to be quite slow...

  This is normal for routines in global optimization as they have to
  search a quite large space.

Hans Werner

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


Re: [R] Memory in R.

2008-03-31 Thread jim holtman
On 3/31/08, R RR [EMAIL PROTECTED] wrote:
 Hi,

 I am pretty new in R.
 In fact, I started using R last month.
 So, be indulgent if my questions seem
 too boring or obvious.

 I have 2 basic questions:

 1 - I want to increase memory, but I can't find
 the right way. E.g: in stata, you just type set memory 1g.
 When I try to load huge datasets, R crashes.

PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

What exactly are you doing?  How much memory do you have on your
system?  What is hugh?  All your R objects have to fit in physical
memory; you don't want to page.  So some more information is needed.

 2 - I want to clear the memory (no object or data), such as the
 clear command in stata.

?rm


 Best regards.

 Amadou DIALLO.
 PhD student.
 Cerdi, University of Auvergne
 France.

[[alternative HTML version deleted]]

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



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

What is the problem you are trying to solve?

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


Re: [R] operators %/% bug?

2008-03-31 Thread Spencer Graves
Consider also the following: 

a - 1.2
b - 1.0

  (a-b)%%.1
[1] 0.1
  (a-b)%/%.1
[1] 1
  .2%%.1
[1] 0
  .2%/%.1
[1] 2

  This performs as described on ?%/%.  In particular, the second 
paragraph under Value: 

 '%%' indicates 'x mod y' and '%/%' indicates integer division.  It
 is guaranteed that 'x == (x %% y) + y * ( x %/% y )' (up to
 rounding error) unless 'y == 0' where the result is 'NA_integer_'
 or 'NaN' (depending on the 'typeof' of the arguments).  See URL:
 http://en.wikipedia.org/wiki/Modulo_operation for the rationale.

  hope this helps. 
  Spencer

jim holtman wrote:
 FAQ 7.31

 a-b != 0.2

   
 a - 1.2

 b - 1.0

 a-b-.2
 
 [1] -5.551115e-17
   



 On 3/31/08, Lo, Ken [EMAIL PROTECTED] wrote:
   
 Dear  all,



 I have come across a strange behavior of the %/% operator, and I wasn't
 sure if this was intended.



 i.e.

 a - 1.2

 b - 1.0

 (a-b) %/% 0.1  results in 1?

 Whereas

 0.2 %/% 0.1 results in 2.



 Am I missing something obvious here?  It seems to be consistent up to R
 2.6.0 running in WinXP (haven't upgraded yet).



 Best,



 Ken



 This email message may contain legally privileged and/or confidential 
 information.  If you are not the intended recipient(s), or the employee or 
 agent responsible for the delivery of this message to the intended 
 recipient(s), you are hereby notified that any disclosure, copying, 
 distribution, or use of this email message is prohibited.  If you have 
 received this message in error, please notify the sender immediately by 
 e-mail and delete this email message from your computer. Thank you.
[[alternative HTML version deleted]]

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

 




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


[R] mean vs sum behavior

2008-03-31 Thread Emmanuel Castella
Dear all
Could someone explain me why
lapply(split(x,fac),mean)
returns means per levels of fac for each column of x
whereas
lapply(split(x,fac),sum)
does not return sums per level of fac and columns of x, but adds all 
columns together?
Hence, how can I get sum to behave as mean in this instance?
Thank you very much in advance
E. Castella

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


Re: [R] mean vs sum behavior

2008-03-31 Thread Gavin Simpson
On Mon, 2008-03-31 at 18:41 +0200, Emmanuel Castella wrote:
 Dear all
 Could someone explain me why
 lapply(split(x,fac),mean)
 returns means per levels of fac for each column of x
 whereas
 lapply(split(x,fac),sum)
 does not return sums per level of fac and columns of x, but adds all 
 columns together?
 Hence, how can I get sum to behave as mean in this instance?
 Thank you very much in advance
 E. Castella

You didn't tell us what x is, but I suspect a data.frame. mean has a
method for class data.frame, which returns the mean of each column.
Sum doesn't have any methods and hence works by summing all the numbers.

If you want to replicate the mean behaviour with sum, the following
would suffice:

 fac - gl(4, 50)
 dat - data.frame(a = rnorm(200), b = rnorm(200), c = rnorm(200))
 sp - split(dat, fac)

then

 lapply(sp, function(x) sapply(x, sum))

or even quicker and easier:

 lapply(sp, colSums)

HTH

G

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

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


[R] SiZer plots in R

2008-03-31 Thread stephanie watkins
Hello,

I am a graduate student at UNC Chapel Hill, and I am attempting to create a 
SiZer plot for a nonparametric analysis. I have found the file to use this 
program in Matlab, however I was hoping to find a package to use this in R. 
Does anyone know of a package that can create this type of graph?


Thanks,

Stephanie


  

You rock. That's why Blockbuster's offering you one month of Blockbuster Total 
Access, No Cost.

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


[R] ps or pdf

2008-03-31 Thread Francois Pepin
Hi everyone,

I have been making a fair amount of figures in R recently that I've
been touching up with Illustrator and I've found a difference between
pdf and ps files and I was wondering if someone could enlighten me
about them.

While the figures look the same, the ps version tends to have
truncated strings. The last character of short strings tends to be on
a string of its own, located right beside the rest. This makes it a bit 
awkward to manipulate, especially if scaling is involved. Is there a 
reason for this differences?

There also seems to be somewhat arbitrary grouping of the last column 
cells in heatmaps in ps files.

I used to prefer the ps because they embed more easily in latex
documents (although pdf are not difficult and conversions are trivial
anyhow), but I'm curious if there are other reasons why one format might
be preferred over the other in this context.

This is with R 2.6 on linux, and I've seen this behavior with older R
version also.

Francois

sessionInfo()
R version 2.6.0 (2007-10-03)
x86_64-unknown-linux-gnu

locale:
LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

loaded via a namespace (and not attached):
[1] rcompgen_0.1-15

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


Re: [R] L-BFGS-B needs finite values of 'fn'

2008-03-31 Thread Paul Smith
On Mon, Mar 31, 2008 at 2:57 PM, Zaihra T [EMAIL PROTECTED] wrote:
 try something like  this before wrapping up your function else i guess u'll
 have to stick to Prof Brian Ripley  suggestion his suggestions are usually
 best bet .

  f - function(x) {

  n - length(x)

 r - sum((b^(0:(n-1)))*log(x)) - 200*(sum(x)-k)^2
  if(!is.finite(r))

 r-1e+20 return(r)

 }

 have a nice day.




 On Mon, 31 Mar 2008 12:24:09 +0100 Paul Smith wrote:
  Dear All,
 
  I am trying to solve the optimization problem below, but I am always
  getting the following error:
 
  Error in optim(rep(20, nvar), f, gr, method = L-BFGS-B, lower = rep(0, :
  L-BFGS-B needs finite values of 'fn'
 
  Any ideas?
 
  Thanks in advance,
 
  Paul
 
  -! --
 
  k - 1
  b - 0.3
 
  f - function(x) {
 
  n - length(x)
 
  r - sum((b^(0:(n-1)))*log(x)) - 200*(sum(x)-k)^2
 
  return(r)
 
  }
 
  gr - function(x) {
 
  n - length(x)
 
  r - (b^(0:(n-1)))*(1/x) - 400*(sum(x)-k)
 
  return(r)
 
  }
 
  nvar - 10
  (sols -
 
 optim(rep(20,nvar),f,gr,method=L-BFGS-B,lower=rep(0,nvar),upper=rep(k,nvar),control=list(fnscale=-1,parscale=rep(2000,nvar),factr=1e-300,pgtol=1e-300)))

Not much progress, Zaihra. Unfortunately! I am wondering whether one
can transform the original problem into an equivalent one and solvable
with optim.

I know the analytical solution; I am just trying to check how far can
R go regarding optimization problems.

Paul

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


Re: [R] ps or pdf

2008-03-31 Thread Prof Brian Ripley
On Mon, 31 Mar 2008, Francois Pepin wrote:

 Hi everyone,

 I have been making a fair amount of figures in R recently that I've
 been touching up with Illustrator and I've found a difference between
 pdf and ps files and I was wondering if someone could enlighten me
 about them.

 While the figures look the same, the ps version tends to have
 truncated strings. The last character of short strings tends to be on
 a string of its own, located right beside the rest. This makes it a bit
 awkward to manipulate, especially if scaling is involved. Is there a
 reason for this differences?

Please see the footer of this message.  Neither postscript() nor pdf() 
graphics devices split up strings they are passed (by e.g. text()), so 
this is being done either by the code used to create the plot (and we have 
no idea what that is) or by the viewer.  I suspect the problem is rather 
in the viewer, but without the example we asked for it is impossible to 
know.

 There also seems to be somewhat arbitrary grouping of the last column
 cells in heatmaps in ps files.

Again, we need an example.

 I used to prefer the ps because they embed more easily in latex
 documents (although pdf are not difficult and conversions are trivial
 anyhow), but I'm curious if there are other reasons why one format might
 be preferred over the other in this context.

The graphics devices are very similar (they share a lot of code).  One 
small difference is that PostScript has an arc primitive, and PDF does 
not.

 This is with R 2.6 on linux, and I've seen this behavior with older R
 version also.

Nothing has changed at that level for a long time -- not even in 
current versions of R (and 2.6.0 is obsolete).


 Francois

 sessionInfo()
 R version 2.6.0 (2007-10-03)
 x86_64-unknown-linux-gnu

 locale:
 LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C

 attached base packages:
 [1] stats graphics  grDevices utils datasets  methods   base

 loaded via a namespace (and not attached):
 [1] rcompgen_0.1-15

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


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

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


[R] adding device size-independent y=0 line to a lattice plot

2008-03-31 Thread Levi Waldron
Using the following lattice plot as an example, I would like to add
horizontal lines where y=0:

library(lattice)
library(grid)
fac - gl(4,12)
x - letters[rep(1:3,16)]
y - runif(48,min=0.0)
dotplot(y~x|fac)

I've tried it with grid.lines using npc and native units, which works
fine unless I change the size of the output device - then the lines
are in the wrong place.  Is there a way to do this that is independent
of the output device size?

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


Re: [R] adding device size-independent y=0 line to a lattice plot

2008-03-31 Thread Deepayan Sarkar
On 3/31/08, Levi Waldron [EMAIL PROTECTED] wrote:
 Using the following lattice plot as an example, I would like to add
  horizontal lines where y=0:

  library(lattice)
  library(grid)
  fac - gl(4,12)
  x - letters[rep(1:3,16)]
  y - runif(48,min=0.0)
  dotplot(y~x|fac)

  I've tried it with grid.lines using npc and native units, which works
  fine unless I change the size of the output device - then the lines
  are in the wrong place.  Is there a way to do this that is independent
  of the output device size?

The obvious thing to try would be

dotplot(y~x|fac,
panel = function(...) {
panel.abline(h = 0)
panel.dotplot(...)
})

Does this not work?

-Deepayan

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


Re: [R] ps or pdf

2008-03-31 Thread Francois Pepin
Prof Brian Ripley wrote:
 Please see the footer of this message.  

Sorry, here is an example. For some reason, I cannot reproduce it 
without using actual gene names.

set.seed(1)
##The row names were originally obtained using the hgug4112a library 
##from bioconductor. I set it manually for people who don't have it 
##installed.
##library(hgug4112a);row-sample(na.omit(unlist(as.list(hgug4112aSYMBOL))),50)
row-c(BDNF, EMX2, ZNF207, HELLS, PWP1, PDXDC1,  BTD, 
NETO1, SLCO4C1, FZD7, NICN1, TMSB4Y, PSMB7,  CADM2, 
SIRT3, ADH6, TM6SF1, AARS, TMEM88, CP110,  ADORA2A, 
ATAD3A, VAPA, NXPH3, IL27RA, NEBL, FANCF,  PTPRG, 
HSU79275, CCDC34, EPDR1, FBLN1, PCAF, AP1B1,  TXNRD2, 
MUC20, MBNL1, STAU2, STK32C, PPIAL4, TGFBR2,  DPY19L2P3, 
TMEM50B, ENY2, MAN2A2, ZFYVE26, TECTA,  CD55, LOC400794, 
SLC19A3)
postscript('/tmp/heatmap.ps',paper='letter',horizontal=F)
heatmap(matrix(rnorm(2500),50),labRow=row)
dev.off()

 Neither postscript() nor pdf() 
 graphics devices split up strings they are passed (by e.g. text()), so 
 this is being done either by the code used to create the plot (and we 
 have no idea what that is) or by the viewer.  I suspect the problem is 
 rather in the viewer, but without the example we asked for it is 
 impossible to know.

Example of row names that are truncated in Illustrator (* denoting 
truncation):
CCDC3*4 (2nd row)
MUC2*0 (3rd row)
MBNL*1 (8th row)
...

It is likely that Illustrator (CS 3, OS X version) is at fault.  I do 
not see any truncation if I look at the ps file by hand (lines 4801 and 
4802):

540.22 545.88 (MUC20) 0 0 0 t
540.22 553.90 (CCDC34) 0 0 0 t

 There also seems to be somewhat arbitrary grouping of the last column
 cells in heatmaps in ps files.
 
 Again, we need an example.

The top right cell (26, TXNRD2) is grouped with the cell just below it 
(26, CCDC34). It's more of a curiosity than anything else.

 I used to prefer the ps because they embed more easily in latex
 documents (although pdf are not difficult and conversions are trivial
 anyhow), but I'm curious if there are other reasons why one format might
 be preferred over the other in this context.
 
 The graphics devices are very similar (they share a lot of code).  One 
 small difference is that PostScript has an arc primitive, and PDF does not.

This is what I thought at first, which is why I found these differences 
surprising. I think your idea of blaming the viewer is correct. I 
thought that Adobe of all people could deal with Postscript files 
properly, but I guess I was overly trusting.

Thanks for the help,

Francois

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


[R] 3d line smoothing

2008-03-31 Thread Gregory Jefferis
Dear R People,

I would like to smooth some 3d lines, which consist of line segments
specified by start and end 3d coordinates.  These are experimentally derived
from microscope images of neurons, so there is no sense in which one axis is
any different from any other (predictor vs response).

I have tried doing repeated smoothing interpolation with smooth.splines (see
below), but this doesn't behave that well with some of my data which can be
multivalued with respect to x and is not a directly 3d approach since.

Could anyone suggest a package which might have appropriate functionality or
a link to read up about possible approaches?

With many thanks for your help,

Greg Jefferis.

PS As an aside, wouldn't categorising the 1350 downloadable packages on CRAN
according to their content make a nice exercise in applied statistical
learning/visualisation?

--

LineSmooth3d-function(l){
lxy=smooth.spline(l[,1:2])
lxz=smooth.spline(l[,c(1,3)])
cbind(l[,1],predict(lxy,l[,1])$y,predict(lxz,l[,1])$y)
}

# First 2 segments of a neuron
l=structure(c(2.240391, 5.629143, 8.140456, 9.94432, 12.295891,
13.457473, 15.170222, 17.758942, 18.290545, 20.334337, 22.027239,
23.263636, 24.24404, 26.234032, 27.411226, 29.369003, 30.806803,
32.68042, 35.012493, 37.436077, 40.567665, 46.615963, 49.906017,
57.803772, 62.236923, 63.849625, 131.309967, 129.133469, 127.194168,
125.517822, 123.464272, 121.037727, 118.98951, 116.41317, 114.511192,
111.733353, 108.64267, 106.416183, 103.347008, 100.653694, 98.72525,
96.918602, 95.4189, 94.231995, 92.493828, 91.070656, 88.901505,
86.535431, 86.055229, 86.209984, 86.143341, 86.368622, 9.116494,
10.510942, 12.17625, 14.124721, 17.23107, 21.285524, 24.150547,
26.97097, 29.702291, 32.635288, 35.791851, 39.013748, 41.252228,
42.638962, 44.100445, 45.742134, 47.191525, 49.838848, 51.361511,
52.929546, 55.789406, 60.742428, 61.489536, 60.880463, 61.653023,
61.472942), .Dim = c(26L, 3L), .Dimnames = list(NULL, c(X, Y, Z)))

l2=structure(list(X = c(63.849625, 63.710838, 64.202766, 64.650017,
64.965698, 64.609695, 64.352356), Y = c(86.368622, 83.420357,
80.972359, 79.352409, 77.604141, 76.094627, 74.800072), Z = c(61.472942,
62.381229, 62.161339, 63.138336, 64.076202, 65.080811, 68.487137
)), .Names = c(X, Y, Z), row.names = c(26, 27, 28,
29, 30, 31, 32), class = data.frame)

# install.packages('rgl')
require(rgl)
# First line OK
rgl.linestrips(l)
rgl.linestrips(LineSmooth3d(l),col='red')
# second line not so good
rgl.linestrips(l2)
rgl.linestrips(LineSmooth3d(l2),col='red')

-- 
Gregory Jefferis, PhD   and:
Research Fellow
Department of Zoology   St John's College
University of Cambridge Cambridge
Downing Street  CB2 1TP
Cambridge, CB2 3EJ 
United Kingdom

Lab Tel: +44 (0)1223 336683 Office: +44 (0)1223 339899
Lab Fax: +44 (0)1223 336676

[EMAIL PROTECTED]
http://www.zoo.cam.ac.uk/zoostaff/jefferis.html
http://www.neuroscience.cam.ac.uk/directory/profile.php?gsxej2
http://flybrain.stanford.edu

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


[R] Can not load msm package

2008-03-31 Thread John Sorkin
windows XP
R 2.6.0
I have tried to install the msm package several times. Each time the  
installation appears to work. I then go to PACKAGES-LOAD PACKAGE but the msm 
package does not appear in the SELECT ONE dialog box. Can someone suggest how I 
can get msm to run on my system?
Thanks,
John

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}

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


[R] tkconfigure throws an error

2008-03-31 Thread stephen bond
Thanks everybody for looking at this. I am trying to assign a script to 
a button
please help:


library(tcltk)
tt- tktoplevel()
tktitle(tt)-the title
heading-tklabel(tt,text=Enter date as -MM-DD)
l1-tklabel(tt,text=Reporting date)
b1=tkbutton(tt,text=Run)
d.val-tkentry(tt,width=12)
tkgrid(heading,columnspan=2)
tkgrid(l1,d.val)
tkgrid(b1,columnspan=2)
tkconfigure(b1,command=source(./src/f.imm2.R))
#
and get inconsistent errors:
1. Error in structure(.External(dotTclObjv, objv, PACKAGE = 
tcltk), class = tclObj) : 
[tcl] invalid command name .6.4.  ## when the tkconfigure is 
entered from R buffer
2. tkconfigure(b1,command=source(./src/f.imm2.R))
Error in switch(storage.mode(x), character = .External
(RTcl_ObjFromCharVector,  : 
cannot handle object of mode 'list' # when I run the full source 
buffer (stuff pasted above)

the script just needs the date from the tcl window and everything else 
is conventional R code.

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


[R] investing in ideas and decision support system experimentation

2008-03-31 Thread davosjhitch

we're looking for help to analyze some theoretical data-sets, essentially
outlining the progress of a given number of ideas over time, by using R in
conjunction with mysql databases.

let's say there is a game, and the point of the game is to find the most
worthwhile solution. let's extend that and say that this solution (or number
of solutions) need to be validated by a community. and that community can,
and has incentive to, promote ideas they think are good. they can do this in
multiple ways: investing $ into an idea, rating, commenting on, and adding
to the idea. 

we need to consider investments, including time of investment relative to
life of idea (and life of idea within the game's timeline), and risk taken
by the investor at time of investment. it may also be important to look at
investment amount trends (and possibly risk trends) in the context of time.
the ratio of investment count to unique investment count is also potentially
important. investments will not be entirely transparent, that is, a player
can see their percentage stake in an idea, but not necessarily how much the
other players have invested. 

let's say we also introduce a rating system and a way for initial ideas to
be 'enhanced.'

now we have multiple possibly estimable parameters that could tell us a
story and allow the 'best ideas' within our construct to bubble to the top. 

we need help approaching our data sets in a mathematical, algorithmic way.
we'd ultimately like help on how to make the decision of *what's the most
validated idea* but we don't know quite what distributions or statistical
models would be appropriate to use for comparative analyses. 

Possible values:
rating: scale from 1-10
investment: limited to individual's available holdings. holdings can range
from nothing to potentially billions (although at the time of this writing
hover around a max of 50,000).

Rules:
• ideas and their enhancements may both be rated, but only initial ideas
carry an investment value.
• time to submit ideas and vote on or invest in them is limited and that
limitation varies widely, but typically ranges from a few hours to many
weeks.

some things we're concerned about: 
favoring early adopters of ideas; avoiding players 'gaming the system' to
push an idea through; making investment importance relative to actual
support by the community, not just to larger investors. 
-- 
View this message in context: 
http://www.nabble.com/investing-in-ideas-and-decision-support-system-experimentation-tp16399082p16399082.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] tkconfigure throws an error

2008-03-31 Thread Greg Snow
The command argument in the tkconfigure call should be a function, you
have the results of sourcing the file, probably not the correct thing.

Try something like:

tkconfigure(b1,command=function(...){source(./src/f.imm2.R)})


Hope this helps,


-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of stephen bond
 Sent: Monday, March 31, 2008 2:45 PM
 To: r-help@r-project.org
 Subject: [R] tkconfigure throws an error
 
 Thanks everybody for looking at this. I am trying to assign a 
 script to a button please help:
 
 
 library(tcltk)
 tt- tktoplevel()
 tktitle(tt)-the title
 heading-tklabel(tt,text=Enter date as -MM-DD) 
 l1-tklabel(tt,text=Reporting date)
 b1=tkbutton(tt,text=Run)
 d.val-tkentry(tt,width=12)
 tkgrid(heading,columnspan=2)
 tkgrid(l1,d.val)
 tkgrid(b1,columnspan=2)
 tkconfigure(b1,command=source(./src/f.imm2.R))
 #
 and get inconsistent errors:
 1. Error in structure(.External(dotTclObjv, objv, PACKAGE = 
 tcltk), class = tclObj) : 
   [tcl] invalid command name .6.4.  ## when the 
 tkconfigure is entered from R buffer 2. 
 tkconfigure(b1,command=source(./src/f.imm2.R))
 Error in switch(storage.mode(x), character = .External 
 (RTcl_ObjFromCharVector,  : 
   cannot handle object of mode 'list' # when I run the 
 full source buffer (stuff pasted above)
 
 the script just needs the date from the tcl window and 
 everything else is conventional R code.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

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


Re: [R] Dendrogram orientation

2008-03-31 Thread Henric Nilsson (Public)
Lassana TOURE wrote:

 I am using the two functions hclust and plot to draw a dendrogram. The
 result is a vertical dendrogram , but I prefer a horizontal one.
 
 Need help.

Take a look at `?dendrogram'.


HTH,
Henric



 
 This is my script:
 
  
 
 dd1=hclust(d1, method=ward)
 
 plot(dd1)
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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


[R] as.character ()

2008-03-31 Thread benlafleche
Hello,

I'm trying to tranform a numeric vector into a character vector.

  x=c(2.00,1.20,5.00,6.56)
  y= as.character(x)
  y
[1] 21.2  56.56

What I want is :

[1] 2.001.20  5.006.56


Does someone know how to do this please ?


Benoit Bruneau

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


Re: [R] as.character ()

2008-03-31 Thread jim holtman
Is this what you want:

 x=c(2.00,1.20,5.00,6.56)
 sprintf(%.2f, x)
[1] 2.00 1.20 5.00 6.56


On Mon, Mar 31, 2008 at 4:45 PM, benlafleche [EMAIL PROTECTED] wrote:
 Hello,

 I'm trying to tranform a numeric vector into a character vector.

   x=c(2.00,1.20,5.00,6.56)
   y= as.character(x)
   y
 [1] 21.2  56.56

 What I want is :

 [1] 2.001.20  5.006.56


 Does someone know how to do this please ?


 Benoit Bruneau

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




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

What is the problem you are trying to solve?

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


[R] question about levelplot panel arrangement

2008-03-31 Thread Jimin Pei
The default arrangement of multiple panels in a lattice plot is from 
bottom left to top right. Are there any ways to change that, for example, 
from top left to bottom right? Thank you.

J.P.

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


Re: [R] Memory in R.

2008-03-31 Thread Liviu Andronic
Hello Amadou,

On Mon, Mar 31, 2008 at 4:53 PM, R RR [EMAIL PROTECTED] wrote:
  1 - I want to increase memory, but I can't find
  the right way. E.g: in stata, you just type set memory 1g.
  When I try to load huge datasets, R crashes.

You will find this recent thread [1] interesting. You'd also want to
check packages filehash, ff and sqldf.
Regards,
Liviu

[1] http://www.nabble.com/How-to-read-HUGE-data-sets--tt15729830.html

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


Re: [R] question about levelplot panel arrangement

2008-03-31 Thread Deepayan Sarkar
On 3/31/08, Jimin Pei [EMAIL PROTECTED] wrote:
 The default arrangement of multiple panels in a lattice plot is from
  bottom left to top right. Are there any ways to change that, for example,
  from top left to bottom right? Thank you.

Add

as.table=TRUE

to your call.

-Deepayan

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


[R] download.file error

2008-03-31 Thread CHIB CO
Dear all,

I am looking for a way to work out if a file on the internet exists before 
attempting to download it using the function download.file(). For example,
using a url that does not exist

url - http://finance.yahoo.com/ftse.csv;
destfile - tempfile()
download.file(url = url, destfile = destfile)

# gives the following response ...

trying URL 'http://finance.yahoo.com/ftse.csv'
Error in download.file(url = url, destfile = destfile) : 
  cannot open URL 'http://finance.yahoo.com/ftse.csv'
In addition: Warning message:
In download.file(url = url, destfile = destfile) :
  cannot open: HTTP status was '404 Not Found'

When I am using the download.file() function in a loop over multiple URLs, the 
above error will cause the loop to terminate, so I want to avoid this by 
checking if the file exists first then wrapping the subsequent functions in an 
if() statment. The original fault came from the function get.hist.quote() in 
the tseries package. I was trying to iterate over various stocks, but some 
stocks listed in the yahoo website do not have any downloadable data associated 
with them, which causes the loop to terminate. The workhorse function of 
get.hist.quote() is the download.file() function.

Kind Regards

Chib

_
Win 100’s of Virgin Experience days with BigSnapSearch.com

[[alternative HTML version deleted]]

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


Re: [R] download.file error

2008-03-31 Thread jim holtman
?try

On Mon, Mar 31, 2008 at 6:26 PM, CHIB CO [EMAIL PROTECTED] wrote:
 Dear all,

 I am looking for a way to work out if a file on the internet exists before 
 attempting to download it using the function download.file(). For example,
 using a url that does not exist

 url - http://finance.yahoo.com/ftse.csv;
 destfile - tempfile()
 download.file(url = url, destfile = destfile)

 # gives the following response ...

 trying URL 'http://finance.yahoo.com/ftse.csv'
 Error in download.file(url = url, destfile = destfile) :
  cannot open URL 'http://finance.yahoo.com/ftse.csv'
 In addition: Warning message:
 In download.file(url = url, destfile = destfile) :
  cannot open: HTTP status was '404 Not Found'

 When I am using the download.file() function in a loop over multiple URLs, 
 the above error will cause the loop to terminate, so I want to avoid this by 
 checking if the file exists first then wrapping the subsequent functions in 
 an if() statment. The original fault came from the function get.hist.quote() 
 in the tseries package. I was trying to iterate over various stocks, but 
 some stocks listed in the yahoo website do not have any downloadable data 
 associated with them, which causes the loop to terminate. The workhorse 
 function of get.hist.quote() is the download.file() function.

 Kind Regards

 Chib

 _
 Win 100's of Virgin Experience days with BigSnapSearch.com

[[alternative HTML version deleted]]


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





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

What is the problem you are trying to solve?

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


Re: [R] Comparing Time Series

2008-03-31 Thread nathan3073

Hai Ingmar,
nice to see you again.
well, I consider time series as the most important aspect in my experiment.
ANOVA can only show whether the mean are different, and combined with Turkey
HSD, the greatest they can do is showing the difference for each pair of
subject. Time Series in other side, can give  whether the smart has real
difference with the average, in term of their cognitive process. Their
learning time, their capability to adapt their mental representation when
dealing with new pattern or regularity. They can all be plotted and we can
check it.

Of course by the plot alone, we can say something meaningfull. But, the
conclusion is more subjective than objective and is not as strong as
statistical approach.

Anyway, my hypothesis for this is the subject follow different models. I
don't care if the model being followed are ARIMA(1,2,0) with AR(2); or AR(2)
and MA(1). I just want to know if the models are different. So far, the only
way I have is checking their model one by one. I'm curious if there is
another way to check the hypothesis


best regards,
Nathanael


Ingmar Visser wrote:
 
 Nathanael,
 
 
 How important is the time series aspect here? Why not just do some anova
 on the difference between these blocks of trials?
 If the time information is essential, repeated measures anova could  
 be applied.
 
 This sounds like you need a mixture of ARIMA models. Is that indeed  
 the hypothesis
 that you want to test: whether there are different strategies that  
 result in either
 an AR learning process or in an MA learning process?
 
 Using a mixture of ARIMA models would allow you to analyze these data
 simultaneously.
 
 hth, Ingmar
 
 
-- 
View this message in context: 
http://www.nabble.com/Comparing-Time-Series-tp16392632p16400910.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] garch prediction

2008-03-31 Thread fernandito

Hello
I want to predict the future values of time series with Garch
When I specified my model like this:
library(fGarch)
ret - diff(log(x))*100
fit = garchFit(~arma(1,0,0)+garch(1, 1), data =ret)
predict(fit, n.ahead = 10)

 meanForecast  meanError standardDeviation
10.01371299 0.030863500.03305819
20.01211893 0.030945190.03350248


I know that if I use fit = garchFit(~garch(1, 1), data =ret) I  got constant
mean, so trherefore I include amra term to move with mean

Iam not sure what values are hiding in this output.
1. Does menForecast hold my future predicted values?
2.Or I am able to just compute the confidence intervals for my prediction
like meanForecast +-2*standardDeviation  ??
3Or I need to compute the future values like
yt=meanForecast+meanError*sqrt(standardDeviation)  ???
My return looks like standard return series with plus and minus values,
[748,]  0.008184311  
[749,]  0.024548914  
[750,] -0.008182302

so I hope I would get similar prediction to this return, not just a postive
mean constant.

thanks??
-- 
View this message in context: 
http://www.nabble.com/garch-prediction-tp16400909p16400909.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Dendrogram orientation

2008-03-31 Thread Gabor Grothendieck
Try:

plot(as.dendrogram(dd1), horiz = TRUE, nodePar = list(lab.cex = .4))


On Thu, Mar 27, 2008 at 1:08 PM, Lassana TOURE [EMAIL PROTECTED] wrote:
 I am using the two functions hclust and plot to draw a dendrogram. The
 result is a vertical dendrogram , but I prefer a horizontal one.

 Need help.

 This is my script:



 dd1=hclust(d1, method=ward)

 plot(dd1)


[[alternative HTML version deleted]]

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


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


Re: [R] as.character ()

2008-03-31 Thread Bill.Venables
An older alternative uses format()

 x - c(2.00, 1.20, 5.00, 6.56)
 format(x)
[1] 2.00 1.20 5.00 6.56



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of jim holtman
Sent: Tuesday, 1 April 2008 7:48 AM
To: benlafleche
Cc: R-help@r-project.org
Subject: Re: [R] as.character ()

Is this what you want:

 x=c(2.00,1.20,5.00,6.56)
 sprintf(%.2f, x)
[1] 2.00 1.20 5.00 6.56


On Mon, Mar 31, 2008 at 4:45 PM, benlafleche [EMAIL PROTECTED]
wrote:
 Hello,

 I'm trying to tranform a numeric vector into a character vector.

   x=c(2.00,1.20,5.00,6.56)
   y= as.character(x)
   y
 [1] 21.2  56.56

 What I want is :

 [1] 2.001.20  5.006.56


 Does someone know how to do this please ?


 Benoit Bruneau

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




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

What is the problem you are trying to solve?

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

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