Re: [R] Test for equality of coefficients in multivariate multipleregression

2006-07-19 Thread John Fox
Dear Berwin,

Simply stacking the problems and treating the resulting observations as
independent will give you the correct coefficients, but incorrect
coefficient variances and artificially zero covariances.

The approach that I suggested originally -- testing a linear hypothesis
using the coefficient estimates and covariances from the multivariate linear
model -- seems simple enough. For example, to test that all three
coefficients are the same across the two equations,

 b - as.vector(coef(x.mlm))
 
 V - vcov(x.mlm)
 
 L - c(1, 0, 0,-1, 0, 0,
0, 1, 0, 0,-1, 0,
0, 0, 1, 0, 0,-1)
 L - matrix(L, nrow=3, byrow=TRUE)
 
 t(L %*% b)  %*% (L %*% V %*% t(L)) %*% (L %*% b)

The test statistic is chi-square with 3 df under the null hypothesis. (Note:
not checked carefully.)

(BTW, it's a bit unclear to me how much of this exchange was on r-help, but
I'm copying to r-help since at least one of Ulrich's messages referring to
alternative approaches appeared there. I hope that's OK.)

Regards,
 John


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

 -Original Message-
 From: Berwin A Turlach 
 [mailto:[EMAIL PROTECTED] On Behalf Of Berwin 
 A Turlach
 Sent: Tuesday, July 18, 2006 9:28 PM
 To: Andrew Robinson
 Cc: Ulrich Keller; John Fox
 Subject: Re: [R] Test for equality of coefficients in 
 multivariate multipleregression
 
 G'day all,
 
  AR == Andrew Robinson [EMAIL PROTECTED] writes:
 
 AR I suggest that you try to rewrite the model system into a
 AR single mixed-effects model, [...] Why a mixed-effect 
 model, wouldn't a fixed effect be o.k. too?
 
 Something like:
 
  DF-data.frame(x1=rep(c(0,1),each=50),x2=rep(c(0,1),50))
  tmp-rnorm(100)
  DF$y1-tmp+DF$x1*.5+DF$x2*.3+rnorm(100,0,.5)
  DF$y2-tmp+DF$x1*.5+DF$x2*.7+rnorm(100,0,.5)
  x.mlm-lm(cbind(y1,y2)~x1+x2,data=DF)
  coef(x.mlm)
  y1  y2
 (Intercept) -0.08885266 -0.05749196
 x1   0.33749086  0.60395258
 x2   0.72017894  1.11932077
 
 
  DF2 - with(DF, data.frame(y=c(y1,y2)))
  DF2$x11 - with(DF, c(x1, rep(0,100)))
  DF2$x21 - with(DF, c(x2, rep(0,100)))
  DF2$x12 - with(DF, c(rep(0,100), x1))
  DF2$x22 - with(DF, c(rep(0,100), x2))
  DF2$x1 - with(DF, c(x1, x1))
  DF2$wh - rep(c(0,1), each=100)
  fm1 - lm(y~wh + x11 + x21 + x12 + x22, DF2)
  fm1
 
 Call:
 lm(formula = y ~ wh + x11 + x21 + x12 + x22, data = DF2)
 
 Coefficients:
 (Intercept)   wh  x11  x21  
 x12  x22  
-0.08885  0.03136  0.33749  0.72018  
 0.60395  1.11932  
 
  fm2 - lm(y~wh + x1 + x21 + x22, DF2)
  anova(fm2,fm1)
 Analysis of Variance Table
 
 Model 1: y ~ wh + x1 + x21 + x22
 Model 2: y ~ wh + x11 + x21 + x12 + x22
   Res.Df RSS  Df Sum of Sq  F Pr(F)
 1195 246.919
 2194 246.031   1 0.888 0.6998 0.4039
 
 
 Cheers,
 
 Berwin
 
 == Full address 
 Berwin A Turlach  Tel.: +61 (8) 6488 3338 
 (secr)   
 School of Mathematics and Statistics+61 (8) 6488 3383 
 (self)  
 The University of Western Australia   FAX : +61 (8) 6488 1028
 35 Stirling Highway   
 Crawley WA 6009e-mail: [EMAIL PROTECTED]
 Australiahttp://www.maths.uwa.edu.au/~berwin


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


Re: [R] Test for equality of coefficients in multivariate multipleregression

2006-07-19 Thread Berwin A Turlach
G'day John,

 JF == John Fox [EMAIL PROTECTED] writes:

JF Simply stacking the problems and treating the resulting
JF observations as independent will give you the correct
JF coefficients, but incorrect coefficient variances
Yes, after Andrew's (off-list) answer I realised this too.  If I am
not mistaken, all variances/covariances should be off by a factor of
1/2 or something like that.

JF and artificially zero covariances.
Well, I must admit that I misread Ulrich's code for most of the day.
I hadn't realised that the variable `tmp' introduces a correlation
between `y1' and `y2' in his code:

 DF-data.frame(x1=rep(c(0,1),each=50),x2=rep(c(0,1),50))
 tmp-rnorm(100)
 DF$y1-tmp+DF$x1*.5+DF$x2*.3+rnorm(100,0,.5)
 DF$y2-tmp+DF$x1*.5+DF$x2*.7+rnorm(100,0,.5)

for some reason, my brain kept parsing this as generate *one* random
intercept for y1 and *one* random intercept for y2, not that each
individual observation has a random intercept.  Under the model that
my brain kept parsing, one would have zero covariances. :)

Now I understand why Andrew suggested the use of mixed models and
would go down that way too.  But I believe your approach is valid too.

JF (BTW, it's a bit unclear to me how much of this exchange was
JF on r-help,
Easy, all those that have r-help either in the TO: or CC: field.
Those were Ulrich's original message and the answer by you and Andrew,
I kept all my mails so far off-list.

JF but I'm copying to r-help since at least one of Ulrich's
JF messages referring to alternative approaches appeared there.
Yes, I noticed that and answered off-list.  In that message, if I read
it correctly, he had confused Andrew and me.

JF I hope that's OK.)
Sure, why not? :)

Cheers,

Berwin

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


[R] How would you export a 3-dimensional array to an SQL database?

2006-07-19 Thread Lapointe, Pierre
Hello,

How would you export a 3-dimensional array to an SQL database?

a-array(1:24, 2:4)

Is there an open source DB that would be more adequate for this type of
operation?

Is there a way to reshape/flatten a 3-dimensional array?

Regards,

Pierre Lapointe

**
AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}}

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


Re: [R] Fitting a distribution to peaks in histogram

2006-07-19 Thread Petr Pikal
Hi

There are some packages for mass spectra processing (spectrino, 
caMassClass). I did not use them so I do not know how they suit your 
needs.

However you can compute area (integrate) by these functions

# uses information interactively from plot(x,y)
# first it replots data between corners *replot(x,y)*
# then it computes sum between x axis and y values - osum -
# and between baseline and y values - cista - based
# on locator positions

integ-function (x,y)
{
replot(x,y)
meze-locator(2)
dm-meze$x[1]
hm-meze$x[2]
abline(v=c(dm,hm),col=2)
vyber-x=hmx=dm
f3 - splinefun(x, y)
osum-integrate(f3, dm, hm)$value
o1-(y[x==min(x[vyber])]+y[x==max(x[vyber])])*(max(x[vyber])-
min(x[vyber]))/2
cista-osum-o1
return(c(osum,cista))
}

# similar as integ but you has to supply upper and lower limits (dm, 
# hm) manually if you do not want to perform integration of whole # 
area under the curve.


integ1-function (x,y,dm=-Inf,hm=+Inf)
{
ifelse(dm==-Inf, dm-min(x), dm-dm)
ifelse(hm==+Inf, hm-max(x), hm-hm)
vyber-x=hmx=dm
f3 - splinefun(x, y)
osum-integrate(f3, dm, hm)$value
o1-(y[x==min(x[vyber])]+y[x==max(x[vyber])])*(max(x[vyber])-
min(x[vyber]))/2
cista-osum-o1
return(c(osum,cista))
}



On 19 Jul 2006 at 11:58, Ulrik Stervbo wrote:

Date sent:  Wed, 19 Jul 2006 11:58:38 +0200
From:   Ulrik Stervbo [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject:[R] Fitting a distribution to peaks in histogram

 Hello list!
 
 I would like to fit a distribution to each of the peaks in a
 histogram, such as this:
 http://photos1.blogger.com/blogger/7029/2724/1600/DU145-Bax3-Bcl-xL.pn
 g .
 
 The peaks are identified using Petr Pikal peaks function (
 http://finzi.psych.upenn.edu/R/Rhelp02a/archive/33097.html), but after
 that I am quite stuck.
 
 Any idea as to how I can:
 Fit a distribution to each peak
 Integrate the area between each two peaks, using the means and widths
 of the distributions fitted to the two peaks. I will be using the
 integrate function
 
 The histogram is based on approximately 15000 events, which makes
 Mclust and pam (which both delivers the information I need) less
 useful.
 
 The whole point of this exercise is to find the percentage of cells in
 peak 1, 2, 3, and so on, and between peak 1-2, peak 2-3, peak 3-4 and
 so on. Having more that 6 peaks does not appears likely.
 
 I am quite new to R and apologise if the solution is fairly basic.
 
 Thank you in advance for any help and suggestions
 
 Sincerely,
 Ulrik
 
  [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html and provide commented,
 minimal, self-contained, reproducible code.

Petr Pikal
[EMAIL PROTECTED]

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


[R] Stirling numbers

2006-07-19 Thread Robin Hankin
Hi

anyone coded up Stirling numbers in R?

[I need unsigned Stirling numbers of the first kind]


cheers

Robin




--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

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


[R] Output and Word

2006-07-19 Thread Kuhn, Max
On page 2 of the manual, Section 2 (Requirements) has

  The package also requires a utility to zip and unzip compressed
files, 
  such as unzip, Winzip or jar.

With a footnote that unzip can be found at

  http://www.info-zip.org/

for free. You can use any utility that can zip/unzip pkzip formatted
files.
If you want to use something else, you can. See ?odfWeaveControl.

I didn't use utils::zip.unpack since there did not appear to be an
analogous
utility for re-zipping the file. Is this incorrect?

I will put an automatic check on package startup for the above utilities
and print a warning if nothing is found.

Max

 0n Wed, 19 Jul 2006, David Hajage wrote:
 
  thank you Greg Snow for this information !
  
  But I have this message :
  
   odfWeave(c:/simple.odt, c:/essai.odt)
Setting wd
Copying  c:/simple.odt
Decompressing ODF file using unzip -o
  C:\DOCUME~1\Maud\LOCALS~1\Temp\RtmpF0hdqb/simple.odt
  Erreur dans odfWeave(c:/simple.odt, c:/essai.odt) :
  Error unzipping file
  De plus : Warning message:
  unzip introuvable
  
  R says that it doesn't find unzip... What is this program ?
 
 It is in the Rtools.zip bundle used to build source packages for R
under 
 Windows (your unstated OS, it seems).
 
 However, you should take this up with the package maintainer, as R has
the 
 capability to unzip files builtin (utils::zip.unpack) on Windows.
 
  
  2006/7/18, Greg Snow Greg.Snow at intermountainmail.org:
  
--
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

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


Re: [R] R and DDE (Dynamic Data Exchange)

2006-07-19 Thread Gabor Grothendieck
On 7/19/06, Philippe Grosjean [EMAIL PROTECTED] wrote:
 Richard M. Heiberger wrote:
  I am thrilled to learn tcltk2 has DDE capability.
  It is the piece I have been needing to make ESS work directly
  with the RGUI on Windows.  GNU emacs on Windows has a ddeclient,
  but no access to COM.  So if R, or tcltk2 talking in both directions to R,
  has a ddeserver, all should be possible.  I will be reading the 
  documentation
  closely in a few weeks to tie it together and then intend to make it happen.
 
  Do you, or any other list member, have a sense of the size, complexity, 
  ease,
  magnitude of the task I just defined?  Any advice as I get started on it?
 
  Rich

 Well, to be honest, DDE is an old exchange protocol (the first one
 proposed by M$ in Windows version 1 or 2). It is not that reliable. In
 practice, when the communication is working fine, you have no problems
 with it. But if something fails in either the server or the client, you
 got a very bad behaviour sometimes.

There is a good discussion in this DDE FAQ of when DDE would
be preferred and when COM would be:

http://www.angelfire.com/biz/rhaminisys/ddeinfo.html#DDEpreferred

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


[R] Progress in a loop

2006-07-19 Thread Florent Bresson
Hi, I have to use a loop to perform a quite computer
intensive estimation and I would like to know the
progress of the loop during the process. I tried to
include something like

  print(paste(k,date(),sep= : ))

where k is the number of the iteration, but the result
appears only at the end of the loop. Can someone help
me please ?






___ 
Découvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet !

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


Re: [R] Stirling numbers

2006-07-19 Thread Martin Maechler
 Robin == Robin Hankin [EMAIL PROTECTED]
 on Wed, 19 Jul 2006 14:25:21 +0100 writes:

Robin Hi anyone coded up Stirling numbers in R?

Sure ;-)

Robin [I need unsigned Stirling numbers of the first kind]

but with my quick search, I can only see those for which I had
2nd kind :

-o--o---

##-- Stirling numbers of the 2nd kind
##-- (Abramowitz/Stegun: 24,1,4 (p. 824-5 ; Table 24.4, p.835)

## S^{(m)}_n = number of ways of partitioning a set of $n$ elements into $m$
## non-empty subsets

Stirling2 - function(n,m)
{
## Purpose:  Stirling Numbers of the 2-nd kind
##  S^{(m)}_n = number of ways of partitioning a set of
##  $n$ elements into $m$ non-empty subsets
## Author: Martin Maechler, Date:  May 28 1992, 23:42
## 
## Abramowitz/Stegun: 24,1,4 (p. 824-5 ; Table 24.4, p.835)
## Closed Form : p.824 C.
## 

if (0  m || m  n) stop('m' must be in 0..n !)
k - 0:m
sig - rep(c(1,-1)*(-1)^m, length= m+1)# 1 for m=0; -1 1 (m=1)
## The following gives rounding errors for (25,5) :
## r - sum( sig * k^n /(gamma(k+1)*gamma(m+1-k)) )
ga - gamma(k+1)
round(sum( sig * k^n /(ga * rev(ga
}

options(digits=15)
for (n in 11:31) cat(n =, n, S_n(5) =, Stirling2(n,5), \n)
n - 25
for(k in c(3,5,10))
cat( S_,n,^(,formatC(k,wid=2),) = , Stirling2(n,k),\n,sep = )

for (n in 1:15)
cat(formatC(n,w=2),:, sapply(1:n, Stirling2, n = n),\n)
##  1 : 1
##  2 : 1 1
##  3 : 1 3 1
##  4 : 1 7 6 1
##  5 : 1 15 25 10 1
##  6 : 1 31 90 65 15 1
##  7 : 1 63 301 350 140 21 1
##  8 : 1 127 966 1701 1050 266 28 1
##  9 : 1 255 3025 7770 6951 2646 462 36 1
## 10 : 1 511 9330 34105 42525 22827 5880 750 45 1
## 11 : 1 1023 28501 145750 246730 179487 63987 11880 1155 55 1
## 12 : 1 2047 86526 611501 1379400 1323652 627396 159027 22275 1705 66 1
## 13 : 1 4095 261625 2532530 7508501 9321312 5715424 1899612 359502 39325 2431 
78 1
## 14 : 1 8191 788970 10391745 40075035 63436373 49329280 20912320 5135130 
752752 66066 3367 91 1
## 15 : 1 16383 2375101 42355950 210766920 420693273 408741333 216627840 
67128490 12662650 1479478 106470 4550 105 1


plot(6:30, sapply(6:30, Stirling2, m=5), log = y, type = l)
## Abramowitz says something like  S2(n,m) ~ m^n / m!
## --
nn - 6:30; sapply(nn, Stirling2, m=5)  / (5^nn / gamma(5+1))
## 0.114 0.21 .. 0.99033 0.992266 0.993812

-o--o---

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


[R] WLS ins systemfit question

2006-07-19 Thread Benn Fine
How does one specify the weights for WLS in the
systemfit command ?

That is, there is a weight option in lm(), but there
doesn't seem to be weight option for systemfit(WLS)

Thanks!

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


Re: [R] Progress in a loop

2006-07-19 Thread Uwe Ligges
Florent Bresson wrote:
 Hi, I have to use a loop to perform a quite computer
 intensive estimation and I would like to know the
 progress of the loop during the process. I tried to
 include something like
 
   print(paste(k,date(),sep= : ))
 
 where k is the number of the iteration, but the result
 appears only at the end of the loop. Can someone help
 me please ?


Please read the R for Windows FAQ:
When using Rgui the output to the console seems to be delayed.

Uwe Ligges



 
   
 
   
   
 ___ 
 Découvrez un nouveau moyen de poser toutes vos questions quelque soit le 
 sujet !
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Progress in a loop

2006-07-19 Thread Doran, Harold
Look for progress() in the svMisc package

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Florent Bresson
 Sent: Wednesday, July 19, 2006 10:13 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Progress in a loop
 
 Hi, I have to use a loop to perform a quite computer 
 intensive estimation and I would like to know the progress of 
 the loop during the process. I tried to include something like
 
   print(paste(k,date(),sep= : ))
 
 where k is the number of the iteration, but the result 
 appears only at the end of the loop. Can someone help me please ?
 
 
   
 
   
   
 __
 _
 Découvrez un nouveau moyen de poser toutes vos questions 
 quelque soit le sujet !
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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


Re: [R] Progress in a loop

2006-07-19 Thread Gavin Simpson
On Wed, 2006-07-19 at 16:12 +0200, Florent Bresson wrote:
 Hi, I have to use a loop to perform a quite computer
 intensive estimation and I would like to know the
 progress of the loop during the process. I tried to
 include something like
 
   print(paste(k,date(),sep= : ))
 
 where k is the number of the iteration, but the result
 appears only at the end of the loop. Can someone help
 me please ?

Windows I assume - you are asked to provide some rudimentary information
about your system when asking for help as the posting guide states.

You need to use flush.console() on Windows, as in:

dat - matrix(runif(20), ncol = 2)
res - numeric(length = 10)
for(i in 1:10) {
   res[i] - sum(dat[i, ])
   cat(paste(Iteration #:, i, -, date(), \n))
   flush.console()
}

Depending on how you want the printed statements to appear on the
screen, you'd be better off with cat not print, e.g.: 

cat(paste(k,date(),sep= : ))

If this isn't the solution, post a reply containing information about
your R version, OS, and a reproducible example (simple code  data as I
did) to show us the problem.

HTH

G
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC  ENSIS, 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/cv/
 UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

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


[R] plain shading (not residuals) in mosaic plot

2006-07-19 Thread Kie Zuraw
Hello. I've been using R for a couple of months and enjoying it a lot. 
This is my first post to R-help.

I'm using the vcd package to make mosaic plots with labels on the tiles 
indicating the number of items in each cell.

For example, I've made this plot:


 allmorph-structure(c(10, 26, 17, 100, 70, 97, 253, 430, 185, 177, 
 25, 1), .Dim = as.integer(c(6, 2)), .Dimnames = 
 structure(list(Stem.initial.obstruent = c(p, t,s, 
 k,b,d,g),Subst.behavior=c(unsubstituted,substituted)), 
 .Names = c(Stem-initial obstruent,Behavior according to 
 dictionary)), class = table)
 mosaic(allmorph,direction=v,pop=FALSE)
 labeling_cells(text=allmorphs,margin=0)(allmorph)


So far so good. What I can't figure out how to do--after searching 
through the vcd documentation 
(http://cran.r-project.org/doc/packages/vcd.pdf), Googling, and 
checking the r-help archive--is how to shade the tiles according to 
their values for the variables rather than to reflect residuals. That 
is, I want all the tiles at the bottom, whose value for the x-axis 
variable is substituted, to be dark grey, and those at the top, in 
the unsubstituted category, to be light grey.

I know how to do it with mosaicplot():

 mosaicplot(morphs3,color=c(grey(0.8),grey(0.4)))

...but this doesn't work with mosaic(): the command 
mosaic(morphs3,color=c(grey(0.8),grey(0.4))) yields a plot with all 
tiles the same color. And conversely, I can't find a way to use 
mosaicplot() and add numeric labels to the tiles--without much hope of 
success, I tried combining mosaicplot() with labeling_cells(), but, 
unsurprisingly, it didn't work:

 mosaicplot(morphs3,color=c(grey(0.8),grey(0.4)),pop=FALSE)
Warning message:
extra argument(s) 'pop' will be disregarded in: 
mosaicplot.default(morphs3, color = c(grey(0.8), grey(0.4)),
 labeling_cells(text=morphs3,margin=0)(morphs3)
Error in downViewport.vpPath(vpPathDirect(name), strict, recording = 
recording) :Viewport 'cell:Stem-initial obstruent=p,Behavior 
according to dictionary=unsubstituted' was not found


Does anyone know how to get both the shading I want and the labels I 
want, whether with mosaic(), with mosaicplot(), or in some other way?

Thanks for your attention.

-Kie Zuraw

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


Re: [R] R and DDE (Dynamic Data Exchange)

2006-07-19 Thread Richard M. Heiberger
Gabor,

Thank you for that information.

The reason for choosing DDE is that GNU emacs doesn't speak COM.
Every year or so I ask on the emacs-for-windows list, and every year
I get the answer no.

DDE is the technology that I have been using in ESS for sending
information to the S-Plus Commands window in the S-Plus GUI on
Windows.  I want to send information to the Rgui window on
Windows in the same way.

The Rterm window runs on Windows emacs in an *R* buffer exactly
the way R runs on Unix.  But it doesn't interact smoothly with
other Windows programs.

The specific difficulty that I want to solve now is the
interaction with RExcel.  RExcel and RGui work together smoothly.
RExcel and Rterm in an emacs *R* buffer do not work
smoothly (emacs buffers freeze requiring ^G to get control back).


Rich

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


Re: [R] Problem with ordered logistic regression using polr function.

2006-07-19 Thread Thomas Lumley
On Wed, 19 Jul 2006, Debarchana Ghosh wrote:

 Hi,
 I'm trying to fit a ordered logistic regression. The response variable
 (y) has three levels (0,1,2).
 The command I've used is:

 /ordlog-polr(y~x1+x2+x3+x4, data=finalbase, subset=heard, weight=wt,
 na.action=na.omit)
 /

 (There are no NA's in y but there are NA's in X's)

 The error I'm getting is:
 /Warning messages:
 1: non-integer #successes in a binomial glm! in: eval(expr, envir, enclos)
 2: design appears to be rank-deficient, so dropping some coefs in:
 polr(right.ans ~ S107 + children + work + rel + media + V013 +
 /

Those are not errors. They are warnings (and I told you yesterday that the 
first one would happen and would be harmless with probability weights). 
The second warning may indicate a real problem or not: you can tell by 
looking at which coefficients have been dropped.

Also, if that is the warning message then the polr() call you used is not 
the one you said you were using.

 Also, if I write
 /summary(ordlog)/

 I'm getting the following error:

 /Re-fitting to get Hessian

 Error in if (all(pr  0)) -sum(wt * log(pr)) else Inf :
missing value where TRUE/FALSE needed

 /Could anybody point out the problem?

You can specify Hess=TRUE in the original polr() call so that refitting 
would not be necessary.  This is sensible anyway if you know you are going 
to be computing standard errors.

-thomas

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

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


[R] RE : Re: Progress in a loop

2006-07-19 Thread Florent Bresson
Thanks, it is exactly what I was looking for.

Florent Bresson

--- Gavin Simpson [EMAIL PROTECTED] a écrit :

 On Wed, 2006-07-19 at 16:12 +0200, Florent Bresson
 wrote:
  Hi, I have to use a loop to perform a quite
 computer
  intensive estimation and I would like to know the
  progress of the loop during the process. I tried
 to
  include something like
  
print(paste(k,date(),sep= : ))
  
  where k is the number of the iteration, but the
 result
  appears only at the end of the loop. Can someone
 help
  me please ?
 
 Windows I assume - you are asked to provide some
 rudimentary information
 about your system when asking for help as the
 posting guide states.
 
 You need to use flush.console() on Windows, as in:
 
 dat - matrix(runif(20), ncol = 2)
 res - numeric(length = 10)
 for(i in 1:10) {
res[i] - sum(dat[i, ])
cat(paste(Iteration #:, i, -, date(), \n))
flush.console()
 }
 
 Depending on how you want the printed statements to
 appear on the
 screen, you'd be better off with cat not print,
 e.g.: 
 
 cat(paste(k,date(),sep= : ))
 
 If this isn't the solution, post a reply containing
 information about
 your R version, OS, and a reproducible example
 (simple code  data as I
 did) to show us the problem.
 
 HTH
 
 G
 -- 

%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
  Gavin Simpson [t] +44 (0)20 7679
 0522
  ECRC  ENSIS, 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/cv/
  UK. WC1E 6BT. [w]
 http://www.ucl.ac.uk/~ucfagls/

%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 
 







___ 
Découvrez un nouveau moyen de poser toutes vos questions quelque soit le sujet !

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


Re: [R] How would you export a 3-dimensional array to an SQL database?

2006-07-19 Thread Neuro LeSuperHéros
Here's a way to flatten and unflatten your array.

a -array(1:24, 2:4)
d -dim(a)

flattened -cbind(expand.grid(1:d[1],1:d[2],1:d[3]),as.vector(a))

unflattened -array(flattened[,4],d)

identical(a,unflattened)
a==unflattened

NeuroRox


From: Lapointe, Pierre [EMAIL PROTECTED]
To: 'r-help@stat.math.ethz.ch' r-help@stat.math.ethz.ch
Subject: [R] How would you export a 3-dimensional array to an SQL database?
Date: Wed, 19 Jul 2006 08:45:42 -0400

Hello,

How would you export a 3-dimensional array to an SQL database?

a-array(1:24, 2:4)

Is there an open source DB that would be more adequate for this type of
operation?

Is there a way to reshape/flatten a 3-dimensional array?

Regards,

Pierre Lapointe

**
AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}}

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

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


[R] connection network - influence of site

2006-07-19 Thread Guillaume Blanchet
Dear R users,

I'm trying to construct a distance matrix based on a nb object 
created by spdep where sites must have a larger influence in one 
direction then in the other.

Here is an example to better illustrate what I need:

Let say I have the following Gabriel connection network


library(spdep)
library(ade4)
data(orbatid)

nbgab-graph2nb(gabrielneigh(as.matrix(oribatid$xy)))
plot(nbgab,oribatid$xy)

text(oribatid$xy,as.character(1:70),pos=1) # site number
arrows(-0.3,0,-0.3,10) # gradient direction


In that example, site 1 shouldn't influence site 2 (so it should have 
a distance if 0 in the distance matrix). However site 1 should 
influence site 7 (1 in the distance matrix), it should also influence 
site 12 and 10 (2 in the distance matrix), and site 13,14,17 and 20 
(3 in the distance matrix) and so on for every site. Also, the 
smallest number of jumps from one site to the other has to be 
considered (e.g. 1 to 20 can be connected through 3 links (1 - 7 - 
10 - 20) or through 4 links (1 - 7 -  12 - 13 - 20)).

Considering the gradient, it has to be noted that the distance matrix 
will be asymmetric (e.g. site 7 doesn't influence site 1).

This needs to be done for various connection network, going from 
regular grid (rook connections) to networks such as the one presented 
above.

Can it be done ? If it can, I would be very happy for some one to 
give me a hand. And if it has already been done I would be glad to be 
pointed in the right direction.


Thanks in advance !!

Guillaume Blanchet

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


[R] trellis.focus with postscript device

2006-07-19 Thread Soukup, Mat
Hello.

First: R 2.3.1 on Windows XP.

I am trying to add information (sample size) to the Trellis strips which
I am successful using the trellis.focus function with the default
Windows device. However, I typically use the postscript device as I use
LaTeX and \includegraphic for incorporating graphs into stat reviews. 

Here's some example code (apologies for the lack of creativity and
resemblance to a real example)

yy - c(rnorm(20,2),rnorm(35,3), rnorm(30,2),rnorm(20,3),rnorm(4,2),
rnorm(10,3))
xx - c(1:20,1:35,1:30,1:20,1:4,1:10)
gg - rep(c('A','B','A','B','A','B'), c(20,35,30,20,4,10))
pp - rep(c('Cond 1','Cond 2','Cond 3'), c(55, 50, 14))

xyplot(yy ~ xx | pp, groups=gg)
trellis.focus('strip', 1, 1)
ltext(0,.5,'20',col='red', pos=4)
ltext(1,.5,'35',col='black', pos=2)
trellis.unfocus()
trellis.focus('strip', 2, 1)
ltext(0,.5,'30',col='red', pos=4)
ltext(1,.5,'20',col='black', pos=2)
trellis.unfocus()
trellis.focus('strip', 1, 2)
ltext(0,.5,'4',col='red', pos=4)
ltext(1,.5,'10',col='black', pos=2)
trellis.unfocus()

This works. But if I do,

postscript('C:/TEMP/example.eps')
# All code as above
dev.off()

I notice a problem with the graphic. When looking at the EPS figure, the
only strip with added data is the first one (bottom left) with the strip
still highlighted in red (i.e. it doesn't appear that trellis.unfocus()
was executed). Work arounds that I can think of are to simply save the
Windows device as postscript and save to the correct directory or better
yet, write my own strip function. However, I was curious if there was
another way using the strategy of postscript(), graph code,
trellis.focus() code, dev.off().

Thanks,

Mat

***
Mat Soukup, Ph.D.
Food and Drug Administration
10903 New Hampshire Ave. 
BLDG 22 RM 5329
Silver Spring, MD 20993-0002
Phone: 301.796.1005
***


[[alternative HTML version deleted]]

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


Re: [R] plain shading (not residuals) in mosaic plot

2006-07-19 Thread Gabor Grothendieck
If you look at ?mosaic the ... argument says it gets passed to strucplot and
looking at ?strucplot we see it accepts a gp= arg so try this (same
as your plus gp= arg):

cols - c(grey(0.8),grey(0.4))
mosaic(allmorph, direction = v, pop = FALSE, gp = list(col = cols))

On 7/19/06, Kie Zuraw [EMAIL PROTECTED] wrote:
 Hello. I've been using R for a couple of months and enjoying it a lot.
 This is my first post to R-help.

 I'm using the vcd package to make mosaic plots with labels on the tiles
 indicating the number of items in each cell.

 For example, I've made this plot:


  allmorph-structure(c(10, 26, 17, 100, 70, 97, 253, 430, 185, 177,
  25, 1), .Dim = as.integer(c(6, 2)), .Dimnames =
  structure(list(Stem.initial.obstruent = c(p, t,s,
  k,b,d,g),Subst.behavior=c(unsubstituted,substituted)),
  .Names = c(Stem-initial obstruent,Behavior according to
  dictionary)), class = table)
  mosaic(allmorph,direction=v,pop=FALSE)
  labeling_cells(text=allmorphs,margin=0)(allmorph)


 So far so good. What I can't figure out how to do--after searching
 through the vcd documentation
 (http://cran.r-project.org/doc/packages/vcd.pdf), Googling, and
 checking the r-help archive--is how to shade the tiles according to
 their values for the variables rather than to reflect residuals. That
 is, I want all the tiles at the bottom, whose value for the x-axis
 variable is substituted, to be dark grey, and those at the top, in
 the unsubstituted category, to be light grey.

 I know how to do it with mosaicplot():

  mosaicplot(morphs3,color=c(grey(0.8),grey(0.4)))

 ...but this doesn't work with mosaic(): the command
 mosaic(morphs3,color=c(grey(0.8),grey(0.4))) yields a plot with all
 tiles the same color. And conversely, I can't find a way to use
 mosaicplot() and add numeric labels to the tiles--without much hope of
 success, I tried combining mosaicplot() with labeling_cells(), but,
 unsurprisingly, it didn't work:

  mosaicplot(morphs3,color=c(grey(0.8),grey(0.4)),pop=FALSE)
 Warning message:
 extra argument(s) 'pop' will be disregarded in:
 mosaicplot.default(morphs3, color = c(grey(0.8), grey(0.4)),
  labeling_cells(text=morphs3,margin=0)(morphs3)
 Error in downViewport.vpPath(vpPathDirect(name), strict, recording =
 recording) :Viewport 'cell:Stem-initial obstruent=p,Behavior
 according to dictionary=unsubstituted' was not found


 Does anyone know how to get both the shading I want and the labels I
 want, whether with mosaic(), with mosaicplot(), or in some other way?

 Thanks for your attention.

 -Kie Zuraw

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


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


[R] Fwd: Classification error rate increased by bagging - any ideas?

2006-07-19 Thread Anthony Staines
Hi,

I'm analysing some anthropometric data on fifty odd skull bases. We know the
gender of each skull,  and we are trying to develop a predictor to identify the
sex of unknown skulls.

Rpart with cross-validation produces two models - one of which predicts gender
for Males well, and Females poorly, and the other does the opposite (Females
well, and Males poorly). In both cases the error rate for the worse predicted
gender is close to 50%, and for the better predicted gender about 15%.

Bagging tree models produces a model which classifies both males and
females equally well (or equally poorly), but has an overall error rate
(just over 30%) higher than either of the rpart models (about 25%).

My instinct is to go for the bagging results, as they seem more reasonable,
but my colleagues really like the lower overall error rate. Any thoughts?

Ta,
Anthony Staines--
Dr. Anthony Staines, Senior Lecturer in Epidemiology.
School  of Public Health and Population Sciences, UCD, Earlsfort
Terrace, Dublin 2, Ireland.
Tel:- +353 1 716 7345. Fax:- +353 1 716 7407 Mobile:- +353 86 606 9713
Web:- http://phm.ucd.ie

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


[R] how to use large data set ?

2006-07-19 Thread Yohan CHOUKROUN
Hello R users,

 

Sorry for my English, i'm French.

 

I want to use a large dataset (3 millions of rows and 70 var) but I don't
know how to do because my computer crash quickly (P4 2.8Ghz, 1Go ).

I have also a bi Xeon with 2Go so I want to do computation on this computer
and show the results on mine. Both of them are on Windows XP...

 

To do shortly I have: 

 

1 server with a MySQL database

1computer

and I want to use them with a large dataset. 

 

I'm trying to use RDCOM to connect the database and installing (but it's
hard for me..) Rpad.

 

Is there another solutions ?

 

Thanks in advance

 

 

Yohan C.



--
Ce message est confidentiel. Son contenu ne represente en aucun cas un
engagement de la part du Groupe Soft Computing sous reserve de tout accord
conclu par ecrit entre vous et le Groupe Soft Computing. Toute publication,
utilisation ou diffusion, meme partielle, doit etre autorisee prealablement.
Si vous n'etes pas destinataire de ce message, merci d'en avertir
immediatement l'expediteur. 
This message is confidential. Its content does not constitute a commitment
by Soft Computing Group except where provided for in a written agreement
between you and Soft Computing Group. Any unauthorised disclosure, use or
dissemination, either whole or partial, is prohibited. If you are not the
intended recipient of this message, please notify the sender immediately. 
-- 



[[alternative HTML version deleted]]

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


Re: [R] trellis.focus with postscript device

2006-07-19 Thread Deepayan Sarkar
On 7/19/06, Soukup, Mat [EMAIL PROTECTED] wrote:
 Hello.

 First: R 2.3.1 on Windows XP.

 I am trying to add information (sample size) to the Trellis strips which
 I am successful using the trellis.focus function with the default
 Windows device. However, I typically use the postscript device as I use
 LaTeX and \includegraphic for incorporating graphs into stat reviews.

 Here's some example code (apologies for the lack of creativity and
 resemblance to a real example)

 yy - c(rnorm(20,2),rnorm(35,3), rnorm(30,2),rnorm(20,3),rnorm(4,2),
 rnorm(10,3))
 xx - c(1:20,1:35,1:30,1:20,1:4,1:10)
 gg - rep(c('A','B','A','B','A','B'), c(20,35,30,20,4,10))
 pp - rep(c('Cond 1','Cond 2','Cond 3'), c(55, 50, 14))

 xyplot(yy ~ xx | pp, groups=gg)
 trellis.focus('strip', 1, 1)
 ltext(0,.5,'20',col='red', pos=4)
 ltext(1,.5,'35',col='black', pos=2)
 trellis.unfocus()
 trellis.focus('strip', 2, 1)
 ltext(0,.5,'30',col='red', pos=4)
 ltext(1,.5,'20',col='black', pos=2)
 trellis.unfocus()
 trellis.focus('strip', 1, 2)
 ltext(0,.5,'4',col='red', pos=4)
 ltext(1,.5,'10',col='black', pos=2)
 trellis.unfocus()

 This works. But if I do,

 postscript('C:/TEMP/example.eps')
 # All code as above
 dev.off()

 I notice a problem with the graphic. When looking at the EPS figure, the
 only strip with added data is the first one (bottom left) with the strip
 still highlighted in red (i.e. it doesn't appear that trellis.unfocus()
 was executed).

Actually, you have produced a multiple-page postscript file, with what
you really want in the last page. If you highlight the strips when
calling trelis.focus, they have to be un-highlighted by
trellis.unfocus. In theory, this is just a removal of a rectangle
object. In practice, grid achieves this by drawing a new page. You
need to avoid this.

Your options are:

(1) add 'highlight = FALSE' to all trellis.focus() calls
(2) run the script in batch mode, where the default highlight =
interactive() is FALSE

I'll think about adding an option to control the default.

Deepayan

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


Re: [R] Random structure of nested design in lme

2006-07-19 Thread ESCHEN Rene
Although I know it's not correct, this is what I tried in lme:

anova(lme(NA.1~soiltype*habitat,random=~1|destination/habitat/origin/soiltype))

# numDF denDF   F-value p-value
#(Intercept)  1   130 12.136195  0.0007
#soiltype 1   130 15.099792  0.0002
#habitat  110  0.699045  0.4226
#soiltype:habitat 1   130  2.123408  0.1475

René.

-Original Message-
From: Doran, Harold [mailto:[EMAIL PROTECTED]
Sent: Wed 2006-07-19 13:53
To: ESCHEN Rene; r-help@stat.math.ethz.ch
Subject: RE: [R] Random structure of nested design in lme
 
Can you provide an example of what you have done with lme so we might be able 
to evaluate the issue? 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of ESCHEN Rene
 Sent: Wednesday, July 19, 2006 7:37 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Random structure of nested design in lme
 
 All,
 
 I'm trying to analyze the results of a reciprocal transplant 
 experiment using lme(). While I get the error-term right in 
 aov(), in lme() it appears impossible to get as expected. I 
 would be greatful for any help.
 
 My experiment aimed to identify whether two fixed factors 
 (habitat type and soil type) affect the development of 
 plants. I took soil from six random sites each of two types 
 (arable and grassland) and transplanted them back into the 
 sites of origin in such way that in each of the sites there 
 were six pots containing arable soil and six pots of 
 grassland soil, each containing a seedling.
 
 With aov(), I got the analysis as I expected, with habitat 
 type tested against destination site, and soil type tested 
 against origin site:
 
 summary(aov(response~soiltype*habitat+Error(destination+origin)))
 #
 #Error: destination
 #  Df  Sum Sq Mean Sq F value Pr(F)
 #habitat1  1.  1.   0.699 0.4226
 #Residuals 10 14.3056  1.4306   
 #
 #Error: origin
 #  Df  Sum Sq Mean Sq F value   Pr(F)   
 #soiltype   1 1.8 1.8  11.636 0.006645 **
 #Residuals 10 1.52778 0.15278
 #---
 #Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #
 #Error: Within
 #  Df  Sum Sq Mean Sq F value Pr(F)
 #soiltype:habitat   1  0.2500  0.2500  2.1774 0.1427
 #Residuals120 13.7778  0.1148 
 
 However, when I try to replicate this analysis in lme, I am 
 unable to get the structure of the random factors (origin and 
 destination) correct. Does anyone have a suggestion how to 
 resolve this problem?
 
 Thanks in advance.
 
 René Eschen
 
 CABI Bioscience Centre Switzerland
 Rue des Grillons 1
 2800 Delémont
 Switzerland
 
   [[alternative HTML version deleted]]
 
 


[[alternative HTML version deleted]]

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


Re: [R] Sweave and multipage lattice

2006-07-19 Thread Sundar Dorai-Raj


Dieter Menne wrote:
 Dear R-Listeners,
 
 as the Sweave faq says:
 
 http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html
 
 creating several figures from one figure chunk does not work, and for
 standard graphics, a workaround is given. Now I have a multipage trellis
 plot with an a-priori unknown number of pages, and I don't see an elegant
 way of dividing it up into multiple pdf-files.
 
 I noted there is a page event handler in the ... parameters, which would
 provide a handle to open/close the file.
 
 Any good idea would be appreciated.
 
 Dieter
 

Hi, Dieter,

I haven't seen a reply to this and I don't know Sweave. However, will 
the following example work? It does require you know the layout for one 
page.

--sundar

library(lattice)

trellis.device(postscript, file = barley%02d.eps,
width = 5, height = 3, onefile = FALSE,
paper = special)
## from ?xyplot
dotplot(variety ~ yield | site, data = barley, groups = year,
 key = simpleKey(levels(barley$year), space = right),
 xlab = Barley Yield (bushels/acre) ,
 aspect=0.5, layout = c(1, 1), ylab=NULL)
dev.off()

files - list.files(pattern = glob2rx(barley*.eps))
for(file in files)
   cat(\\includegraphics{, file, }\n\n, sep=)

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


Re: [R] trellis.focus with postscript device

2006-07-19 Thread Richard M. Heiberger
It works fine as long as you give it the layout.  I used

xyplot(yy ~ xx | pp, groups=gg, layout=c(2,2))

This is needed to make sure that the rows and columns of the trellis
that you reference are consistent with the layout that xyplot has chosen.

Another way to handle this is to change the factor labels

pp - factor(pp)
levels(pp) - c(20  Cond 1  35, 30  Cond 2  20, 4  Cond 3  10)
xyplot(yy ~ xx | pp, groups=gg)


Rich

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


Re: [R] Fitting a distribution to peaks in histogram

2006-07-19 Thread hadley wickham
 I would like to fit a distribution to each of the peaks in a histogram, such
 as this: 
 http://photos1.blogger.com/blogger/7029/2724/1600/DU145-Bax3-Bcl-xL.png

As a first shot, I'd try fitting a mixture of gamma distributions (say
3), plus a constant term for the highest bin.  You could do this using
ML.  If the number of peaks is truly unknown, this will be a little
trickier but still possible and you could use the LRT to chose between
them.

 Integrate the area between each two peaks, using the means and widths of the
 distributions fitted to the two peaks. I will be using the integrate
 function

Why do you want to do this?


 The histogram is based on approximately 15000 events, which makes Mclust and
 pam (which both delivers the information I need) less useful.

If you have unbinned data, it would be better (more precise/powerful)
to use that.

Regards,

Hadley

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


Re: [R] WLS ins systemfit question

2006-07-19 Thread Arne Henningsen
On Wednesday 19 July 2006 16:22, Benn Fine wrote:
 How does one specify the weights for WLS in the
 systemfit command ?

 That is, there is a weight option in lm(), but there
 doesn't seem to be weight option for systemfit(WLS)

WLS in systemfit means that the different _equations_ (not the observations) 
are weighted differently. The weights of the equations are taken from a 
first-step OLS regression by taking the (inverse of the) residual variances 
of each equation. Of course, this can be iterated. The WLS estimation is 
similar to SUR but in WLS all off-diagonal elements of the residual 
covariance matrix are constrained to be zero.

Best regards,
Arne



 Thanks!

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

-- 
Arne Henningsen
Department of Agricultural Economics
University of Kiel
Olshausenstr. 40
D-24098 Kiel (Germany)
Tel: +49-431-880 4445
Fax: +49-431-880 1397
[EMAIL PROTECTED]
http://www.uni-kiel.de/agrarpol/ahenningsen/

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


Re: [R] trellis.focus with postscript device

2006-07-19 Thread Soukup, Mat
Thanks Deepayan.

Adding the argument highlight=FALSE to each trellis.focus() call worked
marvelously.

Cheers,

Mat 

-Original Message-
From: Deepayan Sarkar [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 19, 2006 11:58 AM
To: Soukup, Mat
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] trellis.focus with postscript device

On 7/19/06, Soukup, Mat [EMAIL PROTECTED] wrote:
 Hello.

 First: R 2.3.1 on Windows XP.

 I am trying to add information (sample size) to the Trellis strips
which
 I am successful using the trellis.focus function with the default
 Windows device. However, I typically use the postscript device as I
use
 LaTeX and \includegraphic for incorporating graphs into stat reviews.

 Here's some example code (apologies for the lack of creativity and
 resemblance to a real example)

 yy - c(rnorm(20,2),rnorm(35,3), rnorm(30,2),rnorm(20,3),rnorm(4,2),
 rnorm(10,3))
 xx - c(1:20,1:35,1:30,1:20,1:4,1:10)
 gg - rep(c('A','B','A','B','A','B'), c(20,35,30,20,4,10))
 pp - rep(c('Cond 1','Cond 2','Cond 3'), c(55, 50, 14))

 xyplot(yy ~ xx | pp, groups=gg)
 trellis.focus('strip', 1, 1)
 ltext(0,.5,'20',col='red', pos=4)
 ltext(1,.5,'35',col='black', pos=2)
 trellis.unfocus()
 trellis.focus('strip', 2, 1)
 ltext(0,.5,'30',col='red', pos=4)
 ltext(1,.5,'20',col='black', pos=2)
 trellis.unfocus()
 trellis.focus('strip', 1, 2)
 ltext(0,.5,'4',col='red', pos=4)
 ltext(1,.5,'10',col='black', pos=2)
 trellis.unfocus()

 This works. But if I do,

 postscript('C:/TEMP/example.eps')
 # All code as above
 dev.off()

 I notice a problem with the graphic. When looking at the EPS figure,
the
 only strip with added data is the first one (bottom left) with the
strip
 still highlighted in red (i.e. it doesn't appear that
trellis.unfocus()
 was executed).

Actually, you have produced a multiple-page postscript file, with what
you really want in the last page. If you highlight the strips when
calling trelis.focus, they have to be un-highlighted by
trellis.unfocus. In theory, this is just a removal of a rectangle
object. In practice, grid achieves this by drawing a new page. You
need to avoid this.

Your options are:

(1) add 'highlight = FALSE' to all trellis.focus() calls
(2) run the script in batch mode, where the default highlight =
interactive() is FALSE

I'll think about adding an option to control the default.

Deepayan

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


Re: [R] Fitting a distribution to peaks in histogram

2006-07-19 Thread Ulrik Stervbo
On 7/19/06, hadley wickham [EMAIL PROTECTED] wrote:
  I would like to fit a distribution to each of the peaks in a histogram, such
  as this: 
  http://photos1.blogger.com/blogger/7029/2724/1600/DU145-Bax3-Bcl-xL.png

 As a first shot, I'd try fitting a mixture of gamma distributions (say
 3), plus a constant term for the highest bin.  You could do this using
 ML.  If the number of peaks is truly unknown, this will be a little
 trickier but still possible and you could use the LRT to chose between
 them.

Can you be a bit more excact? I a biologist and relatively new to R


  Integrate the area between each two peaks, using the means and widths of the
  distributions fitted to the two peaks. I will be using the integrate
  function

 Why do you want to do this?

I am measureing the amount of DNA in cells, and I need to know the
percentage of cells in a part of the cell cycle; that the percentage
of cells in the first peak, in the second peak and so on. I want to
integrate the area between to two cells, because that apparently is
how its none (as far as I can tell from the literature)


 
  The histogram is based on approximately 15000 events, which makes Mclust and
  pam (which both delivers the information I need) less useful.

 If you have unbinned data, it would be better (more precise/powerful)
 to use that.

It very probably is better, but mclust had no result after running for
at least 2 hours (I terminated the function after two hours), and as I
generate 50-100 datasets, such as the one used for the histogram, as
week, I would like to find a faster solution

 Regards,

 Hadley


Thanks
Ulrik
-- 
Blog: http://ulrikstervbo.blogspot.com

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


Re: [R] Stirling numbers

2006-07-19 Thread davidr
Well, given Martin's 2nd kind function and the fact that the 1st and 2nd

kind matrices are inverses, you can get at least some of what you want
by:

... # fill a matrix S2 with second kind numbers and zeros
 S2
 [,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,]1000000
[2,]1100000
[3,]1310000
[4,]1761000
[5,]1   15   25   10100
[6,]1   31   90   65   1510
[7,]1   63  301  350  140   211
 abs(round(solve(S2)))
 [,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,]1000000
[2,]1100000
[3,]2310000
[4,]6   1161000
[5,]   24   50   35   10100
[6,]  120  274  225   85   1510
[7,]  720 1764 1624  735  175   211 

Not sure how big arguments you need.

HTH,
David L. Reiner
Rho Trading Securities, LLC
Chicago  IL  60605
312-362-4963

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Martin Maechler
Sent: Wednesday, July 19, 2006 9:19 AM
To: Robin Hankin
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Stirling numbers

 Robin == Robin Hankin [EMAIL PROTECTED]
 on Wed, 19 Jul 2006 14:25:21 +0100 writes:

Robin Hi anyone coded up Stirling numbers in R?

Sure ;-)

Robin [I need unsigned Stirling numbers of the first kind]

but with my quick search, I can only see those for which I had
2nd kind :

-o--o-
--

##-- Stirling numbers of the 2nd kind
##-- (Abramowitz/Stegun: 24,1,4 (p. 824-5 ; Table 24.4, p.835)

## S^{(m)}_n = number of ways of partitioning a set of $n$ elements
into $m$
## non-empty subsets

Stirling2 - function(n,m)
{
## Purpose:  Stirling Numbers of the 2-nd kind
##  S^{(m)}_n = number of ways of partitioning a set of
##  $n$ elements into $m$ non-empty subsets
## Author: Martin Maechler, Date:  May 28 1992, 23:42
## 
## Abramowitz/Stegun: 24,1,4 (p. 824-5 ; Table 24.4, p.835)
## Closed Form : p.824 C.
## 

if (0  m || m  n) stop('m' must be in 0..n !)
k - 0:m
sig - rep(c(1,-1)*(-1)^m, length= m+1)# 1 for m=0; -1 1 (m=1)
## The following gives rounding errors for (25,5) :
## r - sum( sig * k^n /(gamma(k+1)*gamma(m+1-k)) )
ga - gamma(k+1)
round(sum( sig * k^n /(ga * rev(ga
}

options(digits=15)
for (n in 11:31) cat(n =, n, S_n(5) =, Stirling2(n,5), \n)
n - 25
for(k in c(3,5,10))
cat( S_,n,^(,formatC(k,wid=2),) = , Stirling2(n,k),\n,sep =
)

for (n in 1:15)
cat(formatC(n,w=2),:, sapply(1:n, Stirling2, n = n),\n)
##  1 : 1
##  2 : 1 1
##  3 : 1 3 1
##  4 : 1 7 6 1
##  5 : 1 15 25 10 1
##  6 : 1 31 90 65 15 1
##  7 : 1 63 301 350 140 21 1
##  8 : 1 127 966 1701 1050 266 28 1
##  9 : 1 255 3025 7770 6951 2646 462 36 1
## 10 : 1 511 9330 34105 42525 22827 5880 750 45 1
## 11 : 1 1023 28501 145750 246730 179487 63987 11880 1155 55 1
## 12 : 1 2047 86526 611501 1379400 1323652 627396 159027 22275 1705 66
1
## 13 : 1 4095 261625 2532530 7508501 9321312 5715424 1899612 359502
39325 2431 78 1
## 14 : 1 8191 788970 10391745 40075035 63436373 49329280 20912320
5135130 752752 66066 3367 91 1
## 15 : 1 16383 2375101 42355950 210766920 420693273 408741333 216627840
67128490 12662650 1479478 106470 4550 105 1


plot(6:30, sapply(6:30, Stirling2, m=5), log = y, type = l)
## Abramowitz says something like  S2(n,m) ~ m^n / m!
## --
nn - 6:30; sapply(nn, Stirling2, m=5)  / (5^nn / gamma(5+1))
## 0.114 0.21 .. 0.99033 0.992266 0.993812

-o--o-
--

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

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


[R] Answer found: Re: How to write a function in a graph

2006-07-19 Thread junguo liu
Dear Thomas and Simon,
   
  Thank you for your messages. I have found the best solution based on your 
advice. FAQ 7.13 does provide an effective way to answer my question.
   
  Kind regards,
  Junguo

Thomas Lumley [EMAIL PROTECTED] wrote:
  On Tue, 18 Jul 2006, junguo liu wrote:

 Dear R-ers,

 I conducted a regression analysis, and then intended to add the 
 regression function (y=4.33+1.07x) in a graph. But the following code 
 can only give me a text like y=a+bx. Who can help me out? Thank you very 
 much in advance.

This is FAQ 7.13.

-thomas



 CODE

 # Read data
 x - c(1, 2, 3, 4, 5, 6, 7, 8, 9)
 y - c(6, 5, 8, 9, 11, 10, 11, 12, 15)
 data01 - data.frame(x, y)

 # Regression analysis
 res.lm.y - nls(y~a+b*x, start=list(a=1, b=2),data=data01)

 # Obtain parameters
 a- coef(res.lm.y)[a]
 b- coef(res.lm.y)[b]
 a
 b
 #a=4.33
 #b=1.07

 # Plot the results
 def.par - par()
 par(mfrow=c(1,1),xaxs=i,yaxs=i)
 plot(data01$x,data01$y,main=Fit,xlab=x,ylab=y)
 lines(data01$x,predict(res.lm.y))

 #===
 text (6, 13, expression(y==a+b*x))
 #===

 ## I intended to add text like y=4.33+1.07x
 ## but the above code added y=a+bx



 Swiss Federal Institute for Environmental Science and Technology (EAWAG)
 Ueberlandstrasse 133
 P.O.Box 611
 CH-8600 Duebendorf
 Switzerland
 Phone: 0041-18235012
 Fax: 0041-18235375

 -


 [[alternative HTML version deleted]]

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


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



Swiss Federal Institute for Environmental Science and Technology (EAWAG)
Ueberlandstrasse 133
P.O.Box 611
CH-8600 Duebendorf
Switzerland
Phone: 0041-18235012
Fax: 0041-18235375

-

[[alternative HTML version deleted]]

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


Re: [R] plain shading (not residuals) in mosaic plot

2006-07-19 Thread Muhammad Subianto
Maybe like this:
mosaic(allmorph, direction = v, pop = FALSE,
gp=gpar(fill=c(grey(0.8),grey(0.4

Best, Muhammad Subianto

On 7/19/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 If you look at ?mosaic the ... argument says it gets passed to strucplot and
 looking at ?strucplot we see it accepts a gp= arg so try this (same
 as your plus gp= arg):

 cols - c(grey(0.8),grey(0.4))
 mosaic(allmorph, direction = v, pop = FALSE, gp = list(col = cols))

 On 7/19/06, Kie Zuraw [EMAIL PROTECTED] wrote:
  Hello. I've been using R for a couple of months and enjoying it a lot.
  This is my first post to R-help.
 
  I'm using the vcd package to make mosaic plots with labels on the tiles
  indicating the number of items in each cell.
 
  For example, I've made this plot:
 
 
   allmorph-structure(c(10, 26, 17, 100, 70, 97, 253, 430, 185, 177,
   25, 1), .Dim = as.integer(c(6, 2)), .Dimnames =
   structure(list(Stem.initial.obstruent = c(p, t,s,
   k,b,d,g),Subst.behavior=c(unsubstituted,substituted)),
   .Names = c(Stem-initial obstruent,Behavior according to
   dictionary)), class = table)
   mosaic(allmorph,direction=v,pop=FALSE)
   labeling_cells(text=allmorphs,margin=0)(allmorph)
 
 
  So far so good. What I can't figure out how to do--after searching
  through the vcd documentation
  (http://cran.r-project.org/doc/packages/vcd.pdf), Googling, and
  checking the r-help archive--is how to shade the tiles according to
  their values for the variables rather than to reflect residuals. That
  is, I want all the tiles at the bottom, whose value for the x-axis
  variable is substituted, to be dark grey, and those at the top, in
  the unsubstituted category, to be light grey.
 
  I know how to do it with mosaicplot():
 
   mosaicplot(morphs3,color=c(grey(0.8),grey(0.4)))
 
  ...but this doesn't work with mosaic(): the command
  mosaic(morphs3,color=c(grey(0.8),grey(0.4))) yields a plot with all
  tiles the same color. And conversely, I can't find a way to use
  mosaicplot() and add numeric labels to the tiles--without much hope of
  success, I tried combining mosaicplot() with labeling_cells(), but,
  unsurprisingly, it didn't work:
 
   mosaicplot(morphs3,color=c(grey(0.8),grey(0.4)),pop=FALSE)
  Warning message:
  extra argument(s) 'pop' will be disregarded in:
  mosaicplot.default(morphs3, color = c(grey(0.8), grey(0.4)),
   labeling_cells(text=morphs3,margin=0)(morphs3)
  Error in downViewport.vpPath(vpPathDirect(name), strict, recording =
  recording) :Viewport 'cell:Stem-initial obstruent=p,Behavior
  according to dictionary=unsubstituted' was not found
 
 
  Does anyone know how to get both the shading I want and the labels I
  want, whether with mosaic(), with mosaicplot(), or in some other way?
 
  Thanks for your attention.
 
  -Kie Zuraw
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 

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


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


Re: [R] Fitting a distribution to peaks in histogram

2006-07-19 Thread Berton Gunter
With this much data, I think it makes more sense to fit a nonparametric
density estimate. ?density does this via a kernel density procedure, but
RSiteSearch('nonparametric density') will find many alternatives. The ash
and mclust packages are two that come to mind, but there are certainly
others.

Of course, if you must have a parametric fit, then you'll have to fit a
mixture of some sort.  But when both the number of components and individual
distributions are to be estimated, this is a nontrivial problem, as one runs
into identifiability issues and corresponding convergence problems. VR's
discussion of density estimation in MASS has some useful things to say about
these issues, and Ripley's book, PATTERN RECOGNITION AND NEURAL NETWORKS
has even more. As both sources indicate, there's a large literature on this
issue and much software.

Cheers,
Bert Gunter
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of hadley wickham
 Sent: Wednesday, July 19, 2006 9:21 AM
 To: Ulrik Stervbo
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Fitting a distribution to peaks in histogram
 
  I would like to fit a distribution to each of the peaks in 
 a histogram, such
  as this: 
 http://photos1.blogger.com/blogger/7029/2724/1600/DU145-Bax3-B
 cl-xL.png
 
 As a first shot, I'd try fitting a mixture of gamma distributions (say
 3), plus a constant term for the highest bin.  You could do this using
 ML.  If the number of peaks is truly unknown, this will be a little
 trickier but still possible and you could use the LRT to chose between
 them.
 
  Integrate the area between each two peaks, using the means 
 and widths of the
  distributions fitted to the two peaks. I will be using the integrate
  function
 
 Why do you want to do this?
 
 
  The histogram is based on approximately 15000 events, which 
 makes Mclust and
  pam (which both delivers the information I need) less useful.
 
 If you have unbinned data, it would be better (more precise/powerful)
 to use that.
 
 Regards,
 
 Hadley
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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


Re: [R] plain shading (not residuals) in mosaic plot

2006-07-19 Thread Muhammad Subianto
Maybe like this:
mosaic(allmorph, direction = v, pop = FALSE,
gp=gpar(fill=c(grey(0.8),grey(0.4

Best, Muhammad Subianto


On 7/19/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 If you look at ?mosaic the ... argument says it gets passed to strucplot and
 looking at ?strucplot we see it accepts a gp= arg so try this (same
 as your plus gp= arg):

 cols - c(grey(0.8),grey(0.4))
 mosaic(allmorph, direction = v, pop = FALSE, gp = list(col = cols))

 On 7/19/06, Kie Zuraw [EMAIL PROTECTED] wrote:
  Hello. I've been using R for a couple of months and enjoying it a lot.
  This is my first post to R-help.
 
  I'm using the vcd package to make mosaic plots with labels on the tiles
  indicating the number of items in each cell.
 
  For example, I've made this plot:
 
 
   allmorph-structure(c(10, 26, 17, 100, 70, 97, 253, 430, 185, 177,
   25, 1), .Dim = as.integer(c(6, 2)), .Dimnames =
   structure(list(Stem.initial.obstruent = c(p, t,s,
   k,b,d,g),Subst.behavior=c(unsubstituted,substituted)),
   .Names = c(Stem-initial obstruent,Behavior according to
   dictionary)), class = table)
   mosaic(allmorph,direction=v,pop=FALSE)
   labeling_cells(text=allmorphs,margin=0)(allmorph)
 
 
  So far so good. What I can't figure out how to do--after searching
  through the vcd documentation
  (http://cran.r-project.org/doc/packages/vcd.pdf), Googling, and
  checking the r-help archive--is how to shade the tiles according to
  their values for the variables rather than to reflect residuals. That
  is, I want all the tiles at the bottom, whose value for the x-axis
  variable is substituted, to be dark grey, and those at the top, in
  the unsubstituted category, to be light grey.
 
  I know how to do it with mosaicplot():
 
   mosaicplot(morphs3,color=c(grey(0.8),grey(0.4)))
 
  ...but this doesn't work with mosaic(): the command
  mosaic(morphs3,color=c(grey(0.8),grey(0.4))) yields a plot with all
  tiles the same color. And conversely, I can't find a way to use
  mosaicplot() and add numeric labels to the tiles--without much hope of
  success, I tried combining mosaicplot() with labeling_cells(), but,
  unsurprisingly, it didn't work:
 
   mosaicplot(morphs3,color=c(grey(0.8),grey(0.4)),pop=FALSE)
  Warning message:
  extra argument(s) 'pop' will be disregarded in:
  mosaicplot.default(morphs3, color = c(grey(0.8), grey(0.4)),
   labeling_cells(text=morphs3,margin=0)(morphs3)
  Error in downViewport.vpPath(vpPathDirect(name), strict, recording =
  recording) :Viewport 'cell:Stem-initial obstruent=p,Behavior
  according to dictionary=unsubstituted' was not found
 
 
  Does anyone know how to get both the shading I want and the labels I
  want, whether with mosaic(), with mosaicplot(), or in some other way?
 
  Thanks for your attention.
 
  -Kie Zuraw
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 

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


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


Re: [R] Reproducible Research - Examples

2006-07-19 Thread Jean lobry
  Question: Reproducible research is clearly desirable and feasible. Could
  anyone provide examples (stand-alone URLs or supplementary material in
  journals) that you would recommend as a models for reproducible research in
  R?

Here are some attempts based on RWeb, contributed by Jeff Banfield, to allow
for the reproduction of research papers:

http://biomserv.univ-lyon1.fr/~necsulea/repro/
http://pbil.univ-lyon1.fr/members/lobry/repro/gene06/
http://biomserv.univ-lyon1.fr/~palmeira/repro/
http://pbil.univ-lyon1.fr/members/lobry/repro/toxo/
http://pbil.univ-lyon1.fr/datasets/SemonLobryDuret2005/
http://pbil.univ-lyon1.fr/members/lobry/repro/gene05/
http://pbil.univ-lyon1.fr/members/lobry/repro/bioinfo04/
http://pbil.univ-lyon1.fr/members/lobry/repro/lncs04/
http://pbil.univ-lyon1.fr/members/lobry/repro/jag03/
http://pbil.univ-lyon1.fr/members/lobry/repro/jme97/
http://pbil.univ-lyon1.fr/members/lobry/repro/jme95/
http://pbil.univ-lyon1.fr/members/lobry/repro/cabios95/
http://pbil.univ-lyon1.fr/members/lobry/repro/nar94/

I would not recommend these as a models, but I would like to point out that:

1) If you are already using Sweave (many thanks to Friedrich Leisch) there
is virtually no extra-cost for the authors of the paper to write the
corresponding web page.

2) There is no way to be more cristal clear with respect to your reviewers
during the submission process: data are available online, methods are
available online, the parameters of the methods are available and
editable online.

This is good science, but, problem: what would be the equivalent
of JSTOR for this? How people can, say 100 years in the future,
reproduce your results?

Best,

Jean Lobry


P.S. If you want to play with the data used by Student (aka William Sealy
Gosset) for the experimental validation of the famous t-test
(The probable error of a mean. Biometrika, 6:1-25,1908) they are at
your R prompt:
crim-read.table(file=http://pbil.univ-lyon1.fr/R/donnees/criminals1902.txt;)
Can you reproduce Student's results nowadays?

-- 
Jean R. Lobry([EMAIL PROTECTED])
Laboratoire BBE-CNRS-UMR-5558, Univ. C. Bernard - LYON I,
43 Bd 11/11/1918, F-69622 VILLEURBANNE CEDEX, FRANCE
allo  : +33 472 43 12 87 fax: +33 472 43 13 88
http://pbil.univ-lyon1.fr/members/lobry/

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


Re: [R] How to find S4 generics?

2006-07-19 Thread Spencer Graves
Dear Prof. Ripley:

Thanks very much.

  Am I correct then that the 'methods' function could, at least 
theoretically, be revised so methods(class=...) could identify both S3 
and S4 methods (ignoring inheritance, as it does now, I believe)?

  I ask, because it's not always obvious (at least to me) what helper 
functions are available.  Some but not all are mentioned in the 
documentation, and even if they are, they may not be featured 
prominently.  For the S3 standard, methods(class=...) reports what's 
available, and it's faster and more reliable than scanning the help 
files.  After I find something with methods(class=...), then I have 
better ideas for what to look for in the documentation.

  Best Wishes,
  Spencer Graves

Prof Brian Ripley wrote:
 On Tue, 18 Jul 2006, Spencer Graves wrote:
 
 *
 * methods *
 *
You have asked an excellent question.  I can provide a partial answer 
 below.  First, however, I wish to pose a question of my own, which could 
 help answer your question:

How can one obtain a simple list of the available generics for a 
 class?  For an S3 class, the 'methods' functions provide that.  What 
 about an S4 class?  That's entirely opaque to me, if I somehow can't 
 find the relevant information in other ways.  For example, ?lmer-class 
 lists many but not all of the methods available for objects of class 
 'lmer'.  I think I once found a way to get that, but I'm not able to 
 find documentation on it now.
 
 It doesn't work the same way.  S3 generics are defined on a single 
 argument and hence have methods for a class, and so it is relevant to ask 
 what generics there are which have methods for a given class - but even 
 then there can be other generics and other methods which dispatch on 
 object from that class by inheritance (e.g. on lm for glm objects).
 
 S4 generics dispatch on a signature which can involve two or more classes, 
 and I guess the simplest interpretation of your question is
 
 `what S4 generics are there which have methods with signatures mentioning 
 this class'.
 
 Given the decentralized way such information is stored, I think the only 
 way to do that is to find all the generics currently available (via 
 getGenerics or its synonym allGenerics) and then call showMethods on each 
 generic.  In particular, methods are stored in the S4 generic and not in 
 the package defining the method.
 
 However, I suspect inheritance is much more important here, and there is 
 no way to know if methods for class ANY actually work for a specific S4 
 class.
 
 [...]


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


Re: [R] How to find S4 generics?

2006-07-19 Thread Prof Brian Ripley
On Wed, 19 Jul 2006, Spencer Graves wrote:

 Dear Prof. Ripley:
 
 Thanks very much.
 
 Am I correct then that the 'methods' function could, at least
 theoretically, be revised so methods(class=...) could identify both S3 and S4
 methods (ignoring inheritance, as it does now, I believe)?

It is correct that in principle there could be such a function in the 
methods package, but not that methods() in utils could be revised to do 
so.  (For efficiency reasons on the stats4 package in the base 
distribution may depend on methods)

 I ask, because it's not always obvious (at least to me) what helper
 functions are available.  Some but not all are mentioned in the documentation,
 and even if they are, they may not be featured prominently.  For the S3
 standard, methods(class=...) reports what's available, and it's faster and
 more reliable than scanning the help files.  After I find something with
 methods(class=...), then I have better ideas for what to look for in the
 documentation.
 
 Best Wishes,
 Spencer Graves
 
 Prof Brian Ripley wrote:
  On Tue, 18 Jul 2006, Spencer Graves wrote:
  
   *
   * methods *
   *
   You have asked an excellent question.  I can provide a partial
   answer below.  First, however, I wish to pose a question of my own, which
   could help answer your question:
  
   How can one obtain a simple list of the available generics for a
   class?  For an S3 class, the 'methods' functions provide that.  What about
   an S4 class?  That's entirely opaque to me, if I somehow can't find the
   relevant information in other ways.  For example, ?lmer-class lists many
   but not all of the methods available for objects of class 'lmer'.  I think
   I once found a way to get that, but I'm not able to find documentation on
   it now.
  
  It doesn't work the same way.  S3 generics are defined on a single argument
  and hence have methods for a class, and so it is relevant to ask what
  generics there are which have methods for a given class - but even then
  there can be other generics and other methods which dispatch on object from
  that class by inheritance (e.g. on lm for glm objects).
  
  S4 generics dispatch on a signature which can involve two or more classes,
  and I guess the simplest interpretation of your question is
  
  `what S4 generics are there which have methods with signatures mentioning
  this class'.
  
  Given the decentralized way such information is stored, I think the only way
  to do that is to find all the generics currently available (via getGenerics
  or its synonym allGenerics) and then call showMethods on each generic.  In
  particular, methods are stored in the S4 generic and not in the package
  defining the method.
  
  However, I suspect inheritance is much more important here, and there is no
  way to know if methods for class ANY actually work for a specific S4
  class.
  
  [...]
  
 
 
   
 

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

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


Re: [R] gamm

2006-07-19 Thread Simon Wood
Sorry for the delay replying: I was on holiday, but have foolishly come 
back.

  I am a bit confused about gamm in mgcv. Consulting Wood (2006) or 
 Ruppert et al. (2003) hasn't taken away my confusion.

  In this code from the gamm help file:

 b2-gamm(y~s(x0)+s(x1)+s(x2)+s(x3),family=poisson,random=list(fac=~1))

  Am I correct in assuming that we have a random intercept herebut 
 that the amount of smoothing is also changing per level of the factor?? 
 Or is it only the intercept that is changing?

- the degree of smoothing is the same for each level of `fac' but there is 
a different intercept for each level of `fac': these intercepts are 
assumed Normally distributed. i.e. all `s()' terms apply to all data, 
they are not nested within groups.

  And where can I find some explanation on the magic output below?

mgcv::gamm is basically a wrapper that turns a GAMM into the sort of model 
that nlme::lme or MASS::glmmPQL expects to see `gamm' returns an 
object with two parts - the `lme' part is the object that was returned by 
glmmPQL or lme; the `gam' part is an object with most of the attributes of 
a `gam' object (all those that can be reconstructed from an lme/glmmPQL 
fitted model object).

So the `lme' object contains a bunch of opaque stuff that results from 
turning the original GAMM into something that lme/glmmPQL can work with... 
further detail below.


  summary(b2$lme)
  Random effects:

- The output starting here relates to the random components of the 4 
smooths in the model. Each smooth starts with 10 degrees of freedom, but 
one of these is lost to the GAM centering constraint that ensures additive 
identifiability, and one is treated as a fixed effect (see Wood, 2006, for 
details), so each smooth have 8 random coefficients. Each of these 
coefficients is treated as having the same variance (after some 
preparatory reparameterization), but this variance (which plays the role 
of a smoothing parameter) is unknown and is estimated as part of model 
estimation.

[Note that g.1 to g.4 below are dummy grouping factors, each having 
only one level - they force the smooths to apply to all the data, rather 
than being nested within, e.g. the levels of `fac'].

 Formula: ~Xr.1 - 1 | g.1
 Structure: pdIdnot
   Xr.11Xr.12Xr.13Xr.14Xr.15Xr.16Xr.17Xr.18
 StdDev: 1.680679 1.680679 1.680679 1.680679 1.680679 1.680679 1.680679 
 1.680679
   Formula: ~Xr.2 - 1 | g.2 %in% g.1
 Structure: pdIdnot
  Xr.21   Xr.22   Xr.23   Xr.24   Xr.25   Xr.26   Xr.27   Xr.28
 StdDev: 1.57598 1.57598 1.57598 1.57598 1.57598 1.57598 1.57598 1.57598
   Formula: ~Xr.3 - 1 | g.3 %in% g.2 %in% g.1
 Structure: pdIdnot
   Xr.31Xr.32Xr.33Xr.34Xr.35Xr.36Xr.37Xr.38
 StdDev: 20.06377 20.06377 20.06377 20.06377 20.06377 20.06377 20.06377 
 20.06377
   Formula: ~Xr.4 - 1 | g.4 %in% g.3 %in% g.2 %in% g.1
 Structure: pdIdnot
   Xr.41Xr.42Xr.43Xr.44Xr.45
 StdDev: 0.0001063304 0.0001063304 0.0001063304 0.0001063304 0.0001063304
   Xr.46Xr.47Xr.48
 StdDev: 0.0001063304 0.0001063304 0.0001063304

- that's the random component information relating to the smooths done 
with. What follows is the information realting to the random intercept. 
Note that the rather complicated Formula is really equivalent to
  ~1|fac
since the g.j are degenerate.

   Formula: ~1 | fac %in% g.4 %in% g.3 %in% g.2 %in% g.1
(Intercept) Residual
 StdDev:   0.6621173 1.007227
  Variance function:
 Structure: fixed weights
 Formula: ~invwt

- What follows is information about the fixed effects. In this case there 
is one fixed effect for each smooth, and an overall intercept: 
`X(Intercept)'.

 Fixed effects: y.0 ~ X - 1
  Value Std.Error  DF   t-value p-value
 X(Intercept)  2.0870364 0.3337787 392  6.252755  0.
 Xs(x0)Fx1-0.325 0.1028794 392 -0.000316  0.9997
 Xs(x1)Fx1 0.3831694 0.0957323 392  4.002509  0.0001
 Xs(x2)Fx1 1.4584330 0.3909237 392  3.730736  0.0002
 Xs(x3)Fx1-0.0123951 0.0143162 392 -0.865809  0.3871
 Correlation:


Hope that's some use.

Simon

- Simon Wood, Mathematical Sciences, University of Bath, Bath BA2 7AY 
- +44 (0)1225 386603 www.maths.bath.ac.uk/~sw283/

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


Re: [R] mgcv::gam error message

2006-07-19 Thread Simon Wood
 Could anyone please tell me what to do to resolve this error message?

- Any chance you could send me some code (and associated data) that I can 
cut and paste in order to chase this up? Whatever's wrong here, `gam' 
should probably pick it up before things get this far, but I can't tell 
what's happening without a reproducible example.

Thanks,
Simon


 I tried to run a gam with the mgcv package and got the following error:
 Error in qr.qty(qrc, sm$S[[1]]): NA/NaN/Inf in foreign function call (arg
 5)

 (I have 116 covariates, I'm using the cr basis to speed things up, the
 binomial family and, where necessary, have set the required k to lower than
 the number of distinct values for a given covarate when less than the
 default)

 Thank you,
 Savrina

 [EMAIL PROTECTED]
 School of Information Technologies
 Univeristy of Sydney

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


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


Re: [R] Fitting a distribution to peaks in histogram

2006-07-19 Thread hadley wickham
 Can you be a bit more excact? I a biologist and relatively new to R

In that case, I would _strongly_ advise that you get advice from a
local statistician.

 I am measureing the amount of DNA in cells, and I need to know the
 percentage of cells in a part of the cell cycle; that the percentage
 of cells in the first peak, in the second peak and so on. I want to
 integrate the area between to two cells, because that apparently is
 how its none (as far as I can tell from the literature)

That doesn't sound quite right to me, because you also need to take
into account the fact that some cells between peak 1 and 2 belong to
peak 1, and some to peak 2.  This is something that will come out
immediately from a mixture based approach. If you know that peaks
correspond to certain parts of the cell cycle, then this is important
information that should be included in the analysis.

 It very probably is better, but mclust had no result after running for
 at least 2 hours (I terminated the function after two hours), and as I
 generate 50-100 datasets, such as the one used for the histogram, as
 week, I would like to find a faster solution

I doubt that mclust is appropriate for this task, so letting it run
longer wouldn't help anyway.

Again I would suggest that you seek local statistical help.

Hadley

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


[R] fracdiff

2006-07-19 Thread Melissa Ann Haltuch
Hi, I'm using the function fracdiff and can not figure out how to get the 
estimated values for sigma2 or confidence intervals for the parameter 
estimates. Does anyone know how to obtain these values?
Thanks,
Melissa

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


Re: [R] how to use large data set ?

2006-07-19 Thread Greg Snow
You did not say what analysis you want to do, but many common analyses
can be done as special cases of regression models and you can use the
biglm package to do regression models.

Here is an example that worked for me to get the mean and standard
deviation by day from an oracle database with over 23 million rows (I
had previously set up 'edw' as an odbc connection to the database under
widows, any of the database connections packages should work for you
though):

library(RODBC)
library(biglm)

con - odbcConnect('edw',uid='glsnow',pwd=pass)

odbcQuery(con, select ADMSN_WEEKDAY_CD, LOS_DYS from CM.CASEMIX_SMRY)

t1 - Sys.time()

tmp - sqlGetResults(con, max=10)

names(tmp) - c(Day,LoS)
tmp$Day - factor(tmp$Day, levels=as.character(1:7))
tmp - na.omit(tmp)
tmp - subset(tmp, LoS  0)

ff - log(LoS) ~ Day

fit - biglm(ff, tmp)

i - nrow(tmp)
while( !is.null(nrow( tmp - sqlGetResults(con, max=10) ) ) ){
names(tmp) - c(Day,LoS)
tmp$Day - factor(tmp$Day, levels=as.character(1:7))
tmp - na.omit(tmp)
tmp - subset(tmp, LoS  0)

fit - update(fit,tmp)

i - i + nrow(tmp)
cat(format(i,big.mark=','), rows processed\n)
}

summary(fit)

t2 - Sys.time()

t2-t1
 
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 Yohan CHOUKROUN
Sent: Wednesday, July 19, 2006 9:42 AM
To: 'r-help@stat.math.ethz.ch'
Subject: [R] how to use large data set ?

Hello R users,

 

Sorry for my English, i'm French.

 

I want to use a large dataset (3 millions of rows and 70 var) but I
don't know how to do because my computer crash quickly (P4 2.8Ghz, 1Go
).

I have also a bi Xeon with 2Go so I want to do computation on this
computer and show the results on mine. Both of them are on Windows XP...

 

To do shortly I have: 

 

1 server with a MySQL database

1computer

and I want to use them with a large dataset. 

 

I'm trying to use RDCOM to connect the database and installing (but it's
hard for me..) Rpad.

 

Is there another solutions ?

 

Thanks in advance

 

 

Yohan C.



--
Ce message est confidentiel. Son contenu ne represente en aucun cas un
engagement de la part du Groupe Soft Computing sous reserve de tout
accord conclu par ecrit entre vous et le Groupe Soft Computing. Toute
publication, utilisation ou diffusion, meme partielle, doit etre
autorisee prealablement.
Si vous n'etes pas destinataire de ce message, merci d'en avertir
immediatement l'expediteur. 
This message is confidential. Its content does not constitute a
commitment by Soft Computing Group except where provided for in a
written agreement between you and Soft Computing Group. Any unauthorised
disclosure, use or dissemination, either whole or partial, is
prohibited. If you are not the intended recipient of this message,
please notify the sender immediately. 
-- 



[[alternative HTML version deleted]]

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

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


[R] Wrap a loop inside a function

2006-07-19 Thread Doran, Harold
I need to wrap a loop inside a function and am having a small bit of
difficulty getting the results I need. Below is a replicable example.


# define functions
pcm - function(theta,d,score){
 exp(rowSums(outer(theta,d[1:score],'-')))/
 apply(exp(apply(outer(theta,d, '-'), 1, cumsum)), 2, sum)
   }

foo - function(theta,items, score){ 
   like.mat - matrix(numeric(length(items) * length(theta)), ncol =
length(theta))   
   for(i in 1:length(items)) like.mat[i, ] - pcm(theta, items[[i]],
score[[i]]) 
   }

# begin example
theta - c(-1,-.5,0,.5,1)
items - list(item1 = c(0,1,2), item2 = c(0,1), item3 = c(0,1,2,3,4),
item4 = c(0,1))
score - c(2,1,3,1) 
(foo(theta, items, score))

# R output from function foo
[1] 0.8807971 0.8175745 0.7310586 0.6224593 0.500


However, what I am expecting from the function foo is

 like.mat
[,1]   [,2]   [,3]   [,4]  [,5]
[1,] 0.118499655 0.17973411 0.25949646 0.34820743 0.4223188
[2,] 0.880797078 0.81757448 0.73105858 0.62245933 0.500
[3,] 0.005899109 0.01474683 0.03505661 0.07718843 0.1520072
[4,] 0.880797078 0.81757448 0.73105858 0.62245933 0.500


I cannot seem to track down why the function foo is only keeping the
last row of the full matrix I need. Can anyone see where my error is?

Thanks,
Harold

platform   i386-pc-mingw32   
arch   i386  
os mingw32   
system i386, mingw32 
status   
major  2 
minor  3.0   
year   2006  
month  04
day24
svn rev37909 
language   R 
version.string Version 2.3.0 (2006-04-24)

[[alternative HTML version deleted]]

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


Re: [R] Wrap a loop inside a function

2006-07-19 Thread Sundar Dorai-Raj


Doran, Harold wrote:
 I need to wrap a loop inside a function and am having a small bit of
 difficulty getting the results I need. Below is a replicable example.
 
 
 # define functions
 pcm - function(theta,d,score){
  exp(rowSums(outer(theta,d[1:score],'-')))/
  apply(exp(apply(outer(theta,d, '-'), 1, cumsum)), 2, sum)
}
 
 foo - function(theta,items, score){ 
like.mat - matrix(numeric(length(items) * length(theta)), ncol =
 length(theta))   
for(i in 1:length(items)) like.mat[i, ] - pcm(theta, items[[i]],
 score[[i]]) 
}
 
 # begin example
 theta - c(-1,-.5,0,.5,1)
 items - list(item1 = c(0,1,2), item2 = c(0,1), item3 = c(0,1,2,3,4),
 item4 = c(0,1))
 score - c(2,1,3,1) 
 (foo(theta, items, score))
 
 # R output from function foo
 [1] 0.8807971 0.8175745 0.7310586 0.6224593 0.500
 
 
 However, what I am expecting from the function foo is
 
 
like.mat
 
 [,1]   [,2]   [,3]   [,4]  [,5]
 [1,] 0.118499655 0.17973411 0.25949646 0.34820743 0.4223188
 [2,] 0.880797078 0.81757448 0.73105858 0.62245933 0.500
 [3,] 0.005899109 0.01474683 0.03505661 0.07718843 0.1520072
 [4,] 0.880797078 0.81757448 0.73105858 0.62245933 0.500
 
 
 I cannot seem to track down why the function foo is only keeping the
 last row of the full matrix I need. Can anyone see where my error is?
 
 Thanks,
 Harold
 
 platform   i386-pc-mingw32   
 arch   i386  
 os mingw32   
 system i386, mingw32 
 status   
 major  2 
 minor  3.0   
 year   2006  
 month  04
 day24
 svn rev37909 
 language   R 
 version.string Version 2.3.0 (2006-04-24)
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


Hi, Harold,

Your function foo is only returning the last call from for. Try:

foo - function(theta,items, score){
   like.mat - matrix(numeric(length(items) * length(theta)),
  ncol = length(theta))
   for(i in 1:length(items))
 like.mat[i, ] - pcm(theta, items[[i]], score[[i]])
   ## return like.mat, not just the last line from for
   like.mat
}


HTH,

--sundar

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


Re: [R] voronoi tessellations

2006-07-19 Thread binabina
Okay, been working with tripack, seems the most mature package for this.  Got 
it to work well with their test data set - data(tritest).  When i tried random 
numbers to explore further, i am getting some results that don't reconcile.  

example run this:

library(tripack)
y - runif(100)
x - runif(100)
vm - voronoi.mosaic(x,y)
plot(vm)
par(new=T)
plot(x,y,col='blue')

when you look at the plot of the mosaic overlayed with the raw data, the mosaic 
should have each  data point in 1 cell, however that is not the case - any help 
would be appreciated.  

However if you run

data(tritest)
x - tritest$x
y - tritest$y
vm - voronoi.mosaic(x,y)
plot(vm)
par(new=T)
plot(x,y,col='blue')

it looks at it should.

-zubin


 
 From: Prof Brian Ripley [EMAIL PROTECTED]
 Date: 2006/07/19 Wed AM 03:15:51 EDT
 To: Don MacQueen [EMAIL PROTECTED]
 CC: zubin [EMAIL PROTECTED],  r-help@stat.math.ethz.ch
 Subject: Re: [R] voronoi tessellations
 
 On Tue, 18 Jul 2006, Don MacQueen wrote:
 
  I'll suggest going to the CRAN packages page and doing a search for 
  voronoi.
 
 The problem here is that `Voronoi tessellation' is a secondary name.  The 
 concept has many names, including Dirichlet tessellation and Thiessen 
 polygons, and Dirichlet has priority over Voronoi.
 
  Also, search for 'triangulation', since that is one of the uses of them.
 
 I know of packages deldir, tripack and perhaps geometry.
 
  -Don
  
  At 11:46 PM -0400 7/18/06, zubin wrote:
  Hello, looking to draw a voronoi tessellations in R - can anyone
  recommend a package that has tackled this?
  
  some background:
  
  i have a economic data set and created a sammons projection, like to now
  overlay a voronoi tessellation over the sammons 2-D solution for a slick
  visual, and potentially color each tessellation element based on a metric.
  
  home.u - unique(home1)
  home.dist - dist(home.u)
  home.sam - sammon(home.dist,k=2)
  plot(home.sam$points)
 
 Wait a minute.  If this is sammon() from MASS (uncredited), it is not a 
 projection, and there is no relevant concept of distance between points in 
 the mapped space apart from between the supplied points.
 
 I suggest Zubin reads carefully the reference whose support software he 
 appears to be using.  (It would also have answered his question.)
 
 -- 
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595


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


Re: [R] Wrap a loop inside a function

2006-07-19 Thread Douglas Bates
I'm sure when you read this there will be the sound of a palm slapping
a forehead.  :-)

The value of a function is the value of the last expression evaluated
in the function.  If you rewrite foo as

foo - function(theta,items, score){
  like.mat - matrix(numeric(length(items) * length(theta)),
 ncol = length(theta))
  for(i in 1:length(items))
  like.mat[i, ] - pcm(theta, items[[i]], score[[i]])
  like.mat
  }

you will get the result that you want.

On 7/19/06, Doran, Harold [EMAIL PROTECTED] wrote:
 I need to wrap a loop inside a function and am having a small bit of
 difficulty getting the results I need. Below is a replicable example.


 # define functions
 pcm - function(theta,d,score){
  exp(rowSums(outer(theta,d[1:score],'-')))/
  apply(exp(apply(outer(theta,d, '-'), 1, cumsum)), 2, sum)
}

 foo - function(theta,items, score){
like.mat - matrix(numeric(length(items) * length(theta)), ncol =
 length(theta))
for(i in 1:length(items)) like.mat[i, ] - pcm(theta, items[[i]],
 score[[i]])
}

 # begin example
 theta - c(-1,-.5,0,.5,1)
 items - list(item1 = c(0,1,2), item2 = c(0,1), item3 = c(0,1,2,3,4),
 item4 = c(0,1))
 score - c(2,1,3,1)
 (foo(theta, items, score))

 # R output from function foo
 [1] 0.8807971 0.8175745 0.7310586 0.6224593 0.500


 However, what I am expecting from the function foo is

  like.mat
 [,1]   [,2]   [,3]   [,4]  [,5]
 [1,] 0.118499655 0.17973411 0.25949646 0.34820743 0.4223188
 [2,] 0.880797078 0.81757448 0.73105858 0.62245933 0.500
 [3,] 0.005899109 0.01474683 0.03505661 0.07718843 0.1520072
 [4,] 0.880797078 0.81757448 0.73105858 0.62245933 0.500


 I cannot seem to track down why the function foo is only keeping the
 last row of the full matrix I need. Can anyone see where my error is?

 Thanks,
 Harold

 platform   i386-pc-mingw32
 arch   i386
 os mingw32
 system i386, mingw32
 status
 major  2
 minor  3.0
 year   2006
 month  04
 day24
 svn rev37909
 language   R
 version.string Version 2.3.0 (2006-04-24)

 [[alternative HTML version deleted]]

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


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


Re: [R] Correlation Mapping

2006-07-19 Thread justin rapp
Thank you for the advice.  This is what I was looking for.  If I would like
to label the axes, how can I do that?  Specifically I would like to label
the x axis (AAA, AA, A, BBB) and same with the y axis.

jdr


On 7/17/06, Jim Lemon [EMAIL PROTECTED] wrote:

 justin rapp wrote:

  On the cover of Zivot and Wang's Modeling Financial Time Series with S
  Plus, there is a correlation plot that seems to indicate the strength
  of correlation with color-coded squares, so that more highly
  correlated stocks appear darker red.  If anybody out there is familiar
  with the book or understands what I am talking about, I am curious as
  to whether or not there is a similar function in R and how I can call
  it up.

 Hi justin,

 I think that color2D.matplot in the plotrix package will do exactly what
 you want.

 Jim


[[alternative HTML version deleted]]

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


Re: [R] voronoi tessellations

2006-07-19 Thread Thomas Lumley
On Wed, 19 Jul 2006, [EMAIL PROTECTED] wrote:

 Okay, been working with tripack, seems the most mature package for this. 
 Got it to work well with their test data set - data(tritest).  When i 
 tried random numbers to explore further, i am getting some results that 
 don't reconcile.

 example run this:

 library(tripack)
 y - runif(100)
 x - runif(100)
 vm - voronoi.mosaic(x,y)
 plot(vm)
 par(new=T)
 plot(x,y,col='blue')

plot() changes the axis scales. Use points(x,y)

-thomas

 when you look at the plot of the mosaic overlayed with the raw data, the 
 mosaic should have each data point in 1 cell, however that is not the 
 case - any help would be appreciated.

 However if you run

 data(tritest)
 x - tritest$x
 y - tritest$y
 vm - voronoi.mosaic(x,y)
 plot(vm)
 par(new=T)
 plot(x,y,col='blue')

 it looks at it should.

 -zubin



 From: Prof Brian Ripley [EMAIL PROTECTED]
 Date: 2006/07/19 Wed AM 03:15:51 EDT
 To: Don MacQueen [EMAIL PROTECTED]
 CC: zubin [EMAIL PROTECTED],  r-help@stat.math.ethz.ch
 Subject: Re: [R] voronoi tessellations

 On Tue, 18 Jul 2006, Don MacQueen wrote:

 I'll suggest going to the CRAN packages page and doing a search for 
 voronoi.

 The problem here is that `Voronoi tessellation' is a secondary name.  The
 concept has many names, including Dirichlet tessellation and Thiessen
 polygons, and Dirichlet has priority over Voronoi.

 Also, search for 'triangulation', since that is one of the uses of them.

 I know of packages deldir, tripack and perhaps geometry.

 -Don

 At 11:46 PM -0400 7/18/06, zubin wrote:
 Hello, looking to draw a voronoi tessellations in R - can anyone
 recommend a package that has tackled this?

 some background:

 i have a economic data set and created a sammons projection, like to now
 overlay a voronoi tessellation over the sammons 2-D solution for a slick
 visual, and potentially color each tessellation element based on a metric.

 home.u - unique(home1)
 home.dist - dist(home.u)
 home.sam - sammon(home.dist,k=2)
 plot(home.sam$points)

 Wait a minute.  If this is sammon() from MASS (uncredited), it is not a
 projection, and there is no relevant concept of distance between points in
 the mapped space apart from between the supplied points.

 I suggest Zubin reads carefully the reference whose support software he
 appears to be using.  (It would also have answered his question.)

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


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


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

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


Re: [R] how to use large data set ?

2006-07-19 Thread mahesh r
Hi,
I would like to extend to the query posted earlier on using large data
bases. I am trying to use Rgdal to mine within the remote sensing imageries.
I dont have problems bring the images within the R environment. But when I
try to convert the images to a data.frame I receive an warning message from
R saying 1: Reached total allocation of 510Mb: see help(memory.size) and
the process terminates. Due to project constarints I am given a very
old 2.4Ghz computer with only 512 MB RAM. I think what R is currently
doing is
trying to store the results in the RAM and since the image size is very big
(some 9 million pixels), I think it gets out of memory.

My question is
1. Is there any possibility to dump the temporary variables in a temp folder
within the hard disk (as many softwares do) instead of leting R store them
in RAM
2. Could this be possible without creating a connection to a any back hand
database like Oracle.

Thanks,

Mahesh


On 7/19/06, Greg Snow [EMAIL PROTECTED] wrote:

 You did not say what analysis you want to do, but many common analyses
 can be done as special cases of regression models and you can use the
 biglm package to do regression models.

 Here is an example that worked for me to get the mean and standard
 deviation by day from an oracle database with over 23 million rows (I
 had previously set up 'edw' as an odbc connection to the database under
 widows, any of the database connections packages should work for you
 though):

 library(RODBC)
 library(biglm)

 con - odbcConnect('edw',uid='glsnow',pwd=pass)

 odbcQuery(con, select ADMSN_WEEKDAY_CD, LOS_DYS from CM.CASEMIX_SMRY)

 t1 - Sys.time()

 tmp - sqlGetResults(con, max=10)

 names(tmp) - c(Day,LoS)
 tmp$Day - factor(tmp$Day, levels=as.character(1:7))
 tmp - na.omit(tmp)
 tmp - subset(tmp, LoS  0)

 ff - log(LoS) ~ Day

 fit - biglm(ff, tmp)

 i - nrow(tmp)
 while( !is.null(nrow( tmp - sqlGetResults(con, max=10) ) ) ){
 names(tmp) - c(Day,LoS)
 tmp$Day - factor(tmp$Day, levels=as.character(1:7))
 tmp - na.omit(tmp)
 tmp - subset(tmp, LoS  0)

 fit - update(fit,tmp)

 i - i + nrow(tmp)
 cat(format(i,big.mark=','), rows processed\n)
 }

 summary(fit)

 t2 - Sys.time()

 t2-t1

 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 Yohan CHOUKROUN
 Sent: Wednesday, July 19, 2006 9:42 AM
 To: 'r-help@stat.math.ethz.ch'
 Subject: [R] how to use large data set ?

 Hello R users,



 Sorry for my English, i'm French.



 I want to use a large dataset (3 millions of rows and 70 var) but I
 don't know how to do because my computer crash quickly (P4 2.8Ghz, 1Go
 ).

 I have also a bi Xeon with 2Go so I want to do computation on this
 computer and show the results on mine. Both of them are on Windows XP...



 To do shortly I have:



 1 server with a MySQL database

 1computer

 and I want to use them with a large dataset.



 I'm trying to use RDCOM to connect the database and installing (but it's
 hard for me..) Rpad.



 Is there another solutions ?



 Thanks in advance





 Yohan C.



 --
 Ce message est confidentiel. Son contenu ne represente en aucun cas un
 engagement de la part du Groupe Soft Computing sous reserve de tout
 accord conclu par ecrit entre vous et le Groupe Soft Computing. Toute
 publication, utilisation ou diffusion, meme partielle, doit etre
 autorisee prealablement.
 Si vous n'etes pas destinataire de ce message, merci d'en avertir
 immediatement l'expediteur.
 This message is confidential. Its content does not constitute a
 commitment by Soft Computing Group except where provided for in a
 written agreement between you and Soft Computing Group. Any unauthorised
 disclosure, use or dissemination, either whole or partial, is
 prohibited. If you are not the intended recipient of this message,
 please notify the sender immediately.
 --



 [[alternative HTML version deleted]]

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

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


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide 

Re: [R] Wrap a loop inside a function

2006-07-19 Thread Doran, Harold
Very true, the resounding echo was large.

Thanks, Doug. 

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf 
 Of Douglas Bates
 Sent: Wednesday, July 19, 2006 4:20 PM
 To: Doran, Harold
 Cc: r-help@stat.math.ethz.ch
 Subject: Re: [R] Wrap a loop inside a function
 
 I'm sure when you read this there will be the sound of a palm 
 slapping a forehead.  :-)
 
 The value of a function is the value of the last expression 
 evaluated in the function.  If you rewrite foo as
 
 foo - function(theta,items, score){
   like.mat - matrix(numeric(length(items) * length(theta)),
  ncol = length(theta))
   for(i in 1:length(items))
   like.mat[i, ] - pcm(theta, items[[i]], score[[i]])
   like.mat
   }
 
 you will get the result that you want.
 
 On 7/19/06, Doran, Harold [EMAIL PROTECTED] wrote:
  I need to wrap a loop inside a function and am having a 
 small bit of 
  difficulty getting the results I need. Below is a 
 replicable example.
 
 
  # define functions
  pcm - function(theta,d,score){
   exp(rowSums(outer(theta,d[1:score],'-')))/
   apply(exp(apply(outer(theta,d, '-'), 1, cumsum)), 2, sum)
 }
 
  foo - function(theta,items, score){
 like.mat - matrix(numeric(length(items) * length(theta)), ncol =
  length(theta))
 for(i in 1:length(items)) like.mat[i, ] - pcm(theta, items[[i]],
  score[[i]])
 }
 
  # begin example
  theta - c(-1,-.5,0,.5,1)
  items - list(item1 = c(0,1,2), item2 = c(0,1), item3 = 
 c(0,1,2,3,4),
  item4 = c(0,1))
  score - c(2,1,3,1)
  (foo(theta, items, score))
 
  # R output from function foo
  [1] 0.8807971 0.8175745 0.7310586 0.6224593 0.500
 
 
  However, what I am expecting from the function foo is
 
   like.mat
  [,1]   [,2]   [,3]   [,4]  [,5]
  [1,] 0.118499655 0.17973411 0.25949646 0.34820743 0.4223188 [2,] 
  0.880797078 0.81757448 0.73105858 0.62245933 0.500 [3,] 
  0.005899109 0.01474683 0.03505661 0.07718843 0.1520072 [4,] 
  0.880797078 0.81757448 0.73105858 0.62245933 0.500
 
 
  I cannot seem to track down why the function foo is only 
 keeping the 
  last row of the full matrix I need. Can anyone see where my 
 error is?
 
  Thanks,
  Harold
 
  platform   i386-pc-mingw32
  arch   i386
  os mingw32
  system i386, mingw32
  status
  major  2
  minor  3.0
  year   2006
  month  04
  day24
  svn rev37909
  language   R
  version.string Version 2.3.0 (2006-04-24)
 
  [[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide 
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 


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


Re: [R] voronoi tessellations

2006-07-19 Thread Duncan Murdoch
On 7/19/2006 4:21 PM, [EMAIL PROTECTED] wrote:
 Okay, been working with tripack, seems the most mature package for this.  Got 
 it to work well with their test data set - data(tritest).  When i tried 
 random numbers to explore further, i am getting some results that don't 
 reconcile.  
 
 example run this:
 
 library(tripack)
 y - runif(100)
 x - runif(100)
 vm - voronoi.mosaic(x,y)
 plot(vm)
 par(new=T)

Don't do that!  That throws away the coordinate system that has already 
been established.  Do it this way:

library(tripack)
y - runif(100)
x - runif(100)
vm - voronoi.mosaic(x,y)
plot(vm)
points(x,y,col='blue')

and if you want the axes,

axis(1)
axis(2)
box()

Duncan Murdoch

 plot(x,y,col='blue')
 
 when you look at the plot of the mosaic overlayed with the raw data, the 
 mosaic should have each  data point in 1 cell, however that is not the case - 
 any help would be appreciated.  
 
 However if you run
 
 data(tritest)
 x - tritest$x
 y - tritest$y
 vm - voronoi.mosaic(x,y)
 plot(vm)
 par(new=T)
 plot(x,y,col='blue')
 
 it looks at it should.
 
 -zubin
 
 
 From: Prof Brian Ripley [EMAIL PROTECTED]
 Date: 2006/07/19 Wed AM 03:15:51 EDT
 To: Don MacQueen [EMAIL PROTECTED]
 CC: zubin [EMAIL PROTECTED],  r-help@stat.math.ethz.ch
 Subject: Re: [R] voronoi tessellations

 On Tue, 18 Jul 2006, Don MacQueen wrote:

 I'll suggest going to the CRAN packages page and doing a search for 
 voronoi.
 The problem here is that `Voronoi tessellation' is a secondary name.  The 
 concept has many names, including Dirichlet tessellation and Thiessen 
 polygons, and Dirichlet has priority over Voronoi.

 Also, search for 'triangulation', since that is one of the uses of them.
 I know of packages deldir, tripack and perhaps geometry.

 -Don

 At 11:46 PM -0400 7/18/06, zubin wrote:
 Hello, looking to draw a voronoi tessellations in R - can anyone
 recommend a package that has tackled this?

 some background:

 i have a economic data set and created a sammons projection, like to now
 overlay a voronoi tessellation over the sammons 2-D solution for a slick
 visual, and potentially color each tessellation element based on a metric.

 home.u - unique(home1)
 home.dist - dist(home.u)
 home.sam - sammon(home.dist,k=2)
 plot(home.sam$points)
 Wait a minute.  If this is sammon() from MASS (uncredited), it is not a 
 projection, and there is no relevant concept of distance between points in 
 the mapped space apart from between the supplied points.

 I suggest Zubin reads carefully the reference whose support software he 
 appears to be using.  (It would also have answered his question.)

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

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

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


Re: [R] how to use large data set ?

2006-07-19 Thread Dylan Beaudette
Hi,

While R is generally flexible enough for just about anything you can throw at 
it, detailed analysis of imagery might be better accomplished in a 
specialized piece of software. One option might be GRASS, which would allow 
you to do further processing on a subset of the original data in R.

Cheers,

Dylan

On Wednesday 19 July 2006 13:22, mahesh r wrote:
 Hi,
 I would like to extend to the query posted earlier on using large data
 bases. I am trying to use Rgdal to mine within the remote sensing
 imageries. I dont have problems bring the images within the R environment.
 But when I try to convert the images to a data.frame I receive an warning
 message from R saying 1: Reached total allocation of 510Mb: see
 help(memory.size) and the process terminates. Due to project constarints I
 am given a very old 2.4Ghz computer with only 512 MB RAM. I think what R is
 currently doing is
 trying to store the results in the RAM and since the image size is very big
 (some 9 million pixels), I think it gets out of memory.

 My question is
 1. Is there any possibility to dump the temporary variables in a temp
 folder within the hard disk (as many softwares do) instead of leting R
 store them in RAM
 2. Could this be possible without creating a connection to a any back hand
 database like Oracle.

 Thanks,

 Mahesh

 On 7/19/06, Greg Snow [EMAIL PROTECTED] wrote:
  You did not say what analysis you want to do, but many common analyses
  can be done as special cases of regression models and you can use the
  biglm package to do regression models.
 
  Here is an example that worked for me to get the mean and standard
  deviation by day from an oracle database with over 23 million rows (I
  had previously set up 'edw' as an odbc connection to the database under
  widows, any of the database connections packages should work for you
  though):
 
  library(RODBC)
  library(biglm)
 
  con - odbcConnect('edw',uid='glsnow',pwd=pass)
 
  odbcQuery(con, select ADMSN_WEEKDAY_CD, LOS_DYS from CM.CASEMIX_SMRY)
 
  t1 - Sys.time()
 
  tmp - sqlGetResults(con, max=10)
 
  names(tmp) - c(Day,LoS)
  tmp$Day - factor(tmp$Day, levels=as.character(1:7))
  tmp - na.omit(tmp)
  tmp - subset(tmp, LoS  0)
 
  ff - log(LoS) ~ Day
 
  fit - biglm(ff, tmp)
 
  i - nrow(tmp)
  while( !is.null(nrow( tmp - sqlGetResults(con, max=10) ) ) ){
  names(tmp) - c(Day,LoS)
  tmp$Day - factor(tmp$Day, levels=as.character(1:7))
  tmp - na.omit(tmp)
  tmp - subset(tmp, LoS  0)
 
  fit - update(fit,tmp)
 
  i - i + nrow(tmp)
  cat(format(i,big.mark=','), rows processed\n)
  }
 
  summary(fit)
 
  t2 - Sys.time()
 
  t2-t1
 
  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 Yohan CHOUKROUN
  Sent: Wednesday, July 19, 2006 9:42 AM
  To: 'r-help@stat.math.ethz.ch'
  Subject: [R] how to use large data set ?
 
  Hello R users,
 
 
 
  Sorry for my English, i'm French.
 
 
 
  I want to use a large dataset (3 millions of rows and 70 var) but I
  don't know how to do because my computer crash quickly (P4 2.8Ghz, 1Go
  ).
 
  I have also a bi Xeon with 2Go so I want to do computation on this
  computer and show the results on mine. Both of them are on Windows XP...
 
 
 
  To do shortly I have:
 
 
 
  1 server with a MySQL database
 
  1computer
 
  and I want to use them with a large dataset.
 
 
 
  I'm trying to use RDCOM to connect the database and installing (but it's
  hard for me..) Rpad.
 
 
 
  Is there another solutions ?
 
 
 
  Thanks in advance
 
 
 
 
 
  Yohan C.
 
 
 
  --
  Ce message est confidentiel. Son contenu ne represente en aucun cas un
  engagement de la part du Groupe Soft Computing sous reserve de tout
  accord conclu par ecrit entre vous et le Groupe Soft Computing. Toute
  publication, utilisation ou diffusion, meme partielle, doit etre
  autorisee prealablement.
  Si vous n'etes pas destinataire de ce message, merci d'en avertir
  immediatement l'expediteur.
  This message is confidential. Its content does not constitute a
  commitment by Soft Computing Group except where provided for in a
  written agreement between you and Soft Computing Group. Any unauthorised
  disclosure, use or dissemination, either whole or partial, is
  prohibited. If you are not the intended recipient of this message,
  please notify the sender immediately.
  --
 
 
 
  [[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, 

[R] error when compiling stats library in R-2.3.1 on Solaris x86

2006-07-19 Thread Dongseok Choi
Hello,
 
  I tried to compile v2.3.1 on Solaris x86 with SUN Pro compilers.
  I had an error while stats libarary was being compiled and I notice that  
-xtarget=generic64 was not passed to f95 while cc used it.
  Could you tell me how to fix this problem?
 
f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c sgram.f -o sgram.o
f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c sinerp.f -o sinerp.o
f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c sslvrg.f -o sslvrg.o
f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c stxwx.f -o stxwx.o
f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c hclust.f -o hclust.o
f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c kmns.f -o kmns.o
f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c eureka.f -o eureka.o
f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c stl.f -o stl.o
f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c portsrc.f -o portsrc.o
cc -xtarget=generic64 -G -L/mounts/devel/SUNWspro/lib/amd64 
-L/usr/sfw/lib/amd64 -L/mounts/devel/GNU/repoz/readline43/lib/amd64 -o stats.so 
init.o kmeans.o  ansari.o bandwidths.o chisqsim.o d2x2xk.o fexact.o kendall.o 
ks.o  line.o smooth.o  prho.o swilk.o  ksmooth.o loessc.o isoreg.o Srunmed.o 
Trunmed.o  dblcen.o distance.o hclust-utils.o  nls.o  HoltWinters.o PPsum.o 
arima.o burg.o filter.o  mAR.o pacf.o starma.o port.o family.o bsplvd.o 
bvalue.o bvalus.o loessf.o ppr.o qsbart.o sbart.o  sgram.o sinerp.o sslvrg.o 
stxwx.o  hclust.o kmns.o  eureka.o stl.o portsrc.o -xlic_lib=sunperf -lsunmath 
-Rreg -R/mounts/devel/SUNWspro/lib/amd64:/opt/SUNWspro/lib/amd64 
-L/mounts/devel/SUNWspro/prod/lib/amd64 -L/lib/amd64 -L/usr/lib/amd64 -lfui 
-lfai -lfsu -lsunmath -lmtsk -lm
ld: fatal: file bsplvd.o: wrong ELF class: ELFCLASS32
ld: fatal: File processing errors. No output written to stats.so
*** Error code 1
make: Fatal error: Command failed for target `stats.so'

  I did not have any problem when I compiled v2.2.1 as below:
 
cc -xtarget=generic64 -I../../../../include  
-I/mounts/devel/SUNWspro/prod/include 
-I/mounts/devel/GNU/repoz/readline43/include -D__NO_MATH_INLINES  -KPIC  -O 
-I/mounts/devel/SUNWspro/prod/include -c family.c -o family.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
bsplvd.f -o bsplvd.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
bvalue.f -o bvalue.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
bvalus.f -o bvalus.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
loessf.f -o loessf.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
ppr.f -o ppr.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
qsbart.f -o qsbart.o
cc -xtarget=generic64 -I../../../../include  
-I/mounts/devel/SUNWspro/prod/include 
-I/mounts/devel/GNU/repoz/readline43/include -D__NO_MATH_INLINES  -KPIC  -O 
-I/mounts/devel/SUNWspro/prod/include -c sbart.c -o sbart.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
sgram.f -o sgram.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
sinerp.f -o sinerp.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
sslvrg.f -o sslvrg.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
stxwx.f -o stxwx.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
hclust.f -o hclust.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
kmns.f -o kmns.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
eureka.f -o eureka.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
stl.f -o stl.o
f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
portsrc.f -o portsrc.o
cc -xtarget=generic64 -G -L/mounts/devel/SUNWspro/lib/amd64 
-L/usr/sfw/lib/amd64 -L/mounts/devel/GNU/repoz/readline43/lib/amd64 -o stats.so 
init.o kmeans.o  ansari.o bandwidths.o chisqsim.o d2x2xk.o fexact.o kendall.o 
ks.o  line.o smooth.o  prho.o swilk.o  ksmooth.o loessc.o isoreg.o Srunmed.o 
Trunmed.o  dblcen.o distance.o hclust-utils.o  nls.o  HoltWinters.o PPsum.o 
arima.o burg.o carray.o filter.o  mburg.o myw.o pacf.o qr.o starma.o port.o 
family.o bsplvd.o bvalue.o bvalus.o loessf.o ppr.o qsbart.o sbart.o  sgram.o 
sinerp.o sslvrg.o stxwx.o  hclust.o kmns.o  eureka.o stl.o portsrc.o 
-xlic_lib=sunperf -lsunmath  -Rreg 
-R/mounts/devel/SUNWspro/lib/amd64:/opt/SUNWspro/lib/amd64 
-L/mounts/devel/SUNWspro/prod/lib/amd64 -L/lib/amd64 -L/usr/lib/amd64 -lfui 
-lfai -lfsu -lsunmath -lmtsk -lm
mkdir ../../../../library/stats/libs

 
Thank you very much!!
 
 
 
 
Dongseok Choi, Ph.D.
Assistant Professor
Division of Biostatistics
Department of Public Health  Preventive Medicine
Oregon Health  Science University
3181 SW Sam Jackson Park Road, CB-669
Portland, OR 97239-3098
TEL) 503-494-5336
FAX) 503-494-4981
[EMAIL 

Re: [R] error when compiling stats library in R-2.3.1 on Solaris x86

2006-07-19 Thread Prof Brian Ripley
How did 'cc -xtarget=generic64' get there?  AFAIK R does not know about 
it, so presumably you specified it for CC.  You need to do the same thing 
for *all* the compilers, that is CC, CXX, F77 and FC.

The INSTALL file asked you to read the R-admin manual: there you will find 
a very similar example for 64-bit Sparc Solaris.  That uses -xarch, which 
seems preferred to -xtarget (or at least to generic targets).

On Wed, 19 Jul 2006, Dongseok Choi wrote:

 Hello,
  
   I tried to compile v2.3.1 on Solaris x86 with SUN Pro compilers.
   I had an error while stats libarary was being compiled and I notice that  
 -xtarget=generic64 was not passed to f95 while cc used it.
   Could you tell me how to fix this problem?
  
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c sgram.f -o sgram.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c sinerp.f -o sinerp.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c sslvrg.f -o sslvrg.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c stxwx.f -o stxwx.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c hclust.f -o hclust.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c kmns.f -o kmns.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c eureka.f -o eureka.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c stl.f -o stl.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c portsrc.f -o portsrc.o
 cc -xtarget=generic64 -G -L/mounts/devel/SUNWspro/lib/amd64 
 -L/usr/sfw/lib/amd64 -L/mounts/devel/GNU/repoz/readline43/lib/amd64 -o 
 stats.so init.o kmeans.o  ansari.o bandwidths.o chisqsim.o d2x2xk.o fexact.o 
 kendall.o ks.o  line.o smooth.o  prho.o swilk.o  ksmooth.o loessc.o isoreg.o 
 Srunmed.o Trunmed.o  dblcen.o distance.o hclust-utils.o  nls.o  HoltWinters.o 
 PPsum.o arima.o burg.o filter.o  mAR.o pacf.o starma.o port.o family.o 
 bsplvd.o bvalue.o bvalus.o loessf.o ppr.o qsbart.o sbart.o  sgram.o sinerp.o 
 sslvrg.o stxwx.o  hclust.o kmns.o  eureka.o stl.o portsrc.o -xlic_lib=sunperf 
 -lsunmath -Rreg -R/mounts/devel/SUNWspro/lib/amd64:/opt/SUNWspro/lib/amd64 
 -L/mounts/devel/SUNWspro/prod/lib/amd64 -L/lib/amd64 -L/usr/lib/amd64 -lfui 
 -lfai -lfsu -lsunmath -lmtsk -lm
 ld: fatal: file bsplvd.o: wrong ELF class: ELFCLASS32
 ld: fatal: File processing errors. No output written to stats.so
 *** Error code 1
 make: Fatal error: Command failed for target `stats.so'
 
   I did not have any problem when I compiled v2.2.1 as below:
  
 cc -xtarget=generic64 -I../../../../include  
 -I/mounts/devel/SUNWspro/prod/include 
 -I/mounts/devel/GNU/repoz/readline43/include -D__NO_MATH_INLINES  -KPIC  -O 
 -I/mounts/devel/SUNWspro/prod/include -c family.c -o family.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 bsplvd.f -o bsplvd.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 bvalue.f -o bvalue.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 bvalus.f -o bvalus.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 loessf.f -o loessf.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 ppr.f -o ppr.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 qsbart.f -o qsbart.o
 cc -xtarget=generic64 -I../../../../include  
 -I/mounts/devel/SUNWspro/prod/include 
 -I/mounts/devel/GNU/repoz/readline43/include -D__NO_MATH_INLINES  -KPIC  -O 
 -I/mounts/devel/SUNWspro/prod/include -c sbart.c -o sbart.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 sgram.f -o sgram.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 sinerp.f -o sinerp.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 sslvrg.f -o sslvrg.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 stxwx.f -o stxwx.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 hclust.f -o hclust.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 kmns.f -o kmns.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 eureka.f -o eureka.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 stl.f -o stl.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 portsrc.f -o portsrc.o
 cc -xtarget=generic64 -G -L/mounts/devel/SUNWspro/lib/amd64 
 -L/usr/sfw/lib/amd64 -L/mounts/devel/GNU/repoz/readline43/lib/amd64 -o 
 stats.so init.o kmeans.o  ansari.o bandwidths.o chisqsim.o d2x2xk.o fexact.o 
 kendall.o ks.o  line.o smooth.o  prho.o swilk.o  ksmooth.o loessc.o isoreg.o 
 Srunmed.o Trunmed.o  dblcen.o distance.o hclust-utils.o  nls.o  HoltWinters.o 
 PPsum.o arima.o burg.o carray.o filter.o  mburg.o myw.o pacf.o qr.o starma.o 
 port.o family.o bsplvd.o bvalue.o bvalus.o loessf.o ppr.o qsbart.o sbart.o  
 sgram.o sinerp.o sslvrg.o stxwx.o  hclust.o kmns.o  eureka.o stl.o 

Re: [R] error when compiling stats library in R-2.3.1 on Solaris x86

2006-07-19 Thread Dongseok Choi
It was given iin the config.site.
 
CC=cc -xtarget=generic64
CFLAGS=-O -I/mounts/devel/SUNWspro/prod/include
F77=f95 -xtarget=generic64
FFLAGS=-O -I/mounts/devel/SUNWspro/prod/include
CXX=CC -xtarget=generic64
CXXFLAGS=-O -I/mounts/devel/SUNWspro/prod/include
CPPFLAGS=-I/mounts/devel/SUNWspro/prod/include 
-I/mounts/devel/GNU/repoz/readline43/include

I am not sure why it was not passed to f95 while it was OK with cc.
I did not have any problem with R2.2.1.
Please let me know if you need any other info.
 
Thanks again,
Dongseok

 Prof Brian Ripley [EMAIL PROTECTED] 7/19/2006 2:39 PM 

How did 'cc -xtarget=generic64' get there?  AFAIK R does not know about 
it, so presumably you specified it for CC.  You need to do the same thing 
for *all* the compilers, that is CC, CXX, F77 and FC.

The INSTALL file asked you to read the R-admin manual: there you will find 
a very similar example for 64-bit Sparc Solaris.  That uses -xarch, which 
seems preferred to -xtarget (or at least to generic targets).

On Wed, 19 Jul 2006, Dongseok Choi wrote:

 Hello,
  
   I tried to compile v2.3.1 on Solaris x86 with SUN Pro compilers.
   I had an error while stats libarary was being compiled and I notice that  
 -xtarget=generic64 was not passed to f95 while cc used it.
   Could you tell me how to fix this problem?
  
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c sgram.f -o sgram.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c sinerp.f -o sinerp.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c sslvrg.f -o sslvrg.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c stxwx.f -o stxwx.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c hclust.f -o hclust.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c kmns.f -o kmns.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c eureka.f -o eureka.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c stl.f -o stl.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c portsrc.f -o portsrc.o
 cc -xtarget=generic64 -G -L/mounts/devel/SUNWspro/lib/amd64 
 -L/usr/sfw/lib/amd64 -L/mounts/devel/GNU/repoz/readline43/lib/amd64 -o 
 stats.so init.o kmeans.o  ansari.o bandwidths.o chisqsim.o d2x2xk.o fexact.o 
 kendall.o ks.o  line.o smooth.o  prho.o swilk.o  ksmooth.o loessc.o isoreg.o 
 Srunmed.o Trunmed.o  dblcen.o distance.o hclust-utils.o  nls.o  HoltWinters.o 
 PPsum.o arima.o burg.o filter.o  mAR.o pacf.o starma.o port.o family.o 
 bsplvd.o bvalue.o bvalus.o loessf.o ppr.o qsbart.o sbart.o  sgram.o sinerp.o 
 sslvrg.o stxwx.o  hclust.o kmns.o  eureka.o stl.o portsrc.o -xlic_lib=sunperf 
 -lsunmath -Rreg -R/mounts/devel/SUNWspro/lib/amd64:/opt/SUNWspro/lib/amd64 
 -L/mounts/devel/SUNWspro/prod/lib/amd64 -L/lib/amd64 -L/usr/lib/amd64 -lfui 
 -lfai -lfsu -lsunmath -lmtsk -lm
 ld: fatal: file bsplvd.o: wrong ELF class: ELFCLASS32
 ld: fatal: File processing errors. No output written to stats.so
 *** Error code 1
 make: Fatal error: Command failed for target `stats.so'
 
   I did not have any problem when I compiled v2.2.1 as below:
  
 cc -xtarget=generic64 -I../../../../include  
 -I/mounts/devel/SUNWspro/prod/include 
 -I/mounts/devel/GNU/repoz/readline43/include -D__NO_MATH_INLINES  -KPIC  -O 
 -I/mounts/devel/SUNWspro/prod/include -c family.c -o family.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 bsplvd.f -o bsplvd.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 bvalue.f -o bvalue.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 bvalus.f -o bvalus.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 loessf.f -o loessf.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 ppr.f -o ppr.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 qsbart.f -o qsbart.o
 cc -xtarget=generic64 -I../../../../include  
 -I/mounts/devel/SUNWspro/prod/include 
 -I/mounts/devel/GNU/repoz/readline43/include -D__NO_MATH_INLINES  -KPIC  -O 
 -I/mounts/devel/SUNWspro/prod/include -c sbart.c -o sbart.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 sgram.f -o sgram.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 sinerp.f -o sinerp.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 sslvrg.f -o sslvrg.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 stxwx.f -o stxwx.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 hclust.f -o hclust.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 kmns.f -o kmns.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 eureka.f -o eureka.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 stl.f -o stl.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 portsrc.f -o portsrc.o
 cc 

Re: [R] How to find S4 generics?

2006-07-19 Thread Thomas Lumley
On Wed, 19 Jul 2006, Spencer Graves wrote:
 Am I correct then that the 'methods' function could, at least
 theoretically, be revised so methods(class=...) could identify both S3
 and S4 methods (ignoring inheritance, as it does now, I believe)?


Here is a function to find methods for a formal class. It returns a list 
with elements corresponding to a generic, and each element is a list of 
strings showing all the signatures that contain any of the specified 
classes.

If super=TRUE it looks at all superclasses, if ANY=TRUE it also returns 
methods for ANY class.

If you have lme4 loaded, try
   methods4(lmer
   methods4(ddiMatrix)
   methods4(ddiMatrix,super=TRUE)

-thomas

methods4-function(classes, super=FALSE, ANY=FALSE){
   if (super) classes-unlist(sapply(classes, function(cl) 
getAllSuperClasses(getClass(cl
   if (ANY) classes-c(classes,ANY)
   gens-allGenerics()@.Data
   sigs-lapply(gens, function(g) linearizeMlist(getMethods(g))@classes)
   names(sigs)[EMAIL PROTECTED]
   sigs-lapply(sigs, function(gen){ gen[unlist(sapply(gen, function(sig) 
any(sig %in% classes)))]})
   sigs[sapply(sigs,length)0]
}


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

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


[R] Data from Ying, Jung and Wei (1995)

2006-07-19 Thread Mai Zhou
Dear all, 

I am looking for the Small Cell Lung Cancer
data from the paper

Ying, Z., Jung, S. H., and Wei, L. J. (1995), 
Survival Analysis with Median Regression Models,
Journal of the American Statistical Association} {\bf 90}, 178--184.

Do any one know if it exist in an R readable format somewhere?

Thanks!

Mai Zhou

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


Re: [R] How to find S4 generics?

2006-07-19 Thread Spencer Graves
Hi, Thomas:  Thanks very much.  I haven't tried it yet, but it looks 
very useful.  Best Wishes, Spencer Graves

Thomas Lumley wrote:
 On Wed, 19 Jul 2006, Spencer Graves wrote:
Am I correct then that the 'methods' function could, at least
 theoretically, be revised so methods(class=...) could identify both S3
 and S4 methods (ignoring inheritance, as it does now, I believe)?

 
 Here is a function to find methods for a formal class. It returns a list 
 with elements corresponding to a generic, and each element is a list of 
 strings showing all the signatures that contain any of the specified 
 classes.
 
 If super=TRUE it looks at all superclasses, if ANY=TRUE it also returns 
 methods for ANY class.
 
 If you have lme4 loaded, try
methods4(lmer
methods4(ddiMatrix)
methods4(ddiMatrix,super=TRUE)
 
   -thomas
 
 methods4-function(classes, super=FALSE, ANY=FALSE){
if (super) classes-unlist(sapply(classes, function(cl) 
 getAllSuperClasses(getClass(cl
if (ANY) classes-c(classes,ANY)
gens-allGenerics()@.Data
sigs-lapply(gens, function(g) linearizeMlist(getMethods(g))@classes)
names(sigs)[EMAIL PROTECTED]
sigs-lapply(sigs, function(gen){ gen[unlist(sapply(gen, function(sig) 
 any(sig %in% classes)))]})
sigs[sapply(sigs,length)0]
 }
 
 
 Thomas Lumley Assoc. Professor, Biostatistics
 [EMAIL PROTECTED] University of Washington, Seattle
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Wrap a loop inside a function

2006-07-19 Thread Gabor Grothendieck
foo can be written as a mapply:

t(mapply(pcm, items, score, MoreArgs = list(theta = theta)))


On 7/19/06, Doran, Harold [EMAIL PROTECTED] wrote:
 I need to wrap a loop inside a function and am having a small bit of
 difficulty getting the results I need. Below is a replicable example.


 # define functions
 pcm - function(theta,d,score){
 exp(rowSums(outer(theta,d[1:score],'-')))/
 apply(exp(apply(outer(theta,d, '-'), 1, cumsum)), 2, sum)
   }

 foo - function(theta,items, score){
   like.mat - matrix(numeric(length(items) * length(theta)), ncol =
 length(theta))
   for(i in 1:length(items)) like.mat[i, ] - pcm(theta, items[[i]],
 score[[i]])
   }

 # begin example
 theta - c(-1,-.5,0,.5,1)
 items - list(item1 = c(0,1,2), item2 = c(0,1), item3 = c(0,1,2,3,4),
 item4 = c(0,1))
 score - c(2,1,3,1)
 (foo(theta, items, score))

 # R output from function foo
 [1] 0.8807971 0.8175745 0.7310586 0.6224593 0.500


 However, what I am expecting from the function foo is

  like.mat
[,1]   [,2]   [,3]   [,4]  [,5]
 [1,] 0.118499655 0.17973411 0.25949646 0.34820743 0.4223188
 [2,] 0.880797078 0.81757448 0.73105858 0.62245933 0.500
 [3,] 0.005899109 0.01474683 0.03505661 0.07718843 0.1520072
 [4,] 0.880797078 0.81757448 0.73105858 0.62245933 0.500


 I cannot seem to track down why the function foo is only keeping the
 last row of the full matrix I need. Can anyone see where my error is?

 Thanks,
 Harold

 platform   i386-pc-mingw32
 arch   i386
 os mingw32
 system i386, mingw32
 status
 major  2
 minor  3.0
 year   2006
 month  04
 day24
 svn rev37909
 language   R
 version.string Version 2.3.0 (2006-04-24)

[[alternative HTML version deleted]]

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


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


Re: [R] error when compiling stats library in R-2.3.1 on Solaris x86

2006-07-19 Thread Dongseok Choi
Dear Prof. Ripley,
 
  Following your advice, I read the manual and I realized that I missed two 
lines in my config.site.
 
FC=f95 -xtarget=generic64
FCFLAGS=-O -I/mounts/devel/SUNWspro/prod/include

  This solved my problem.
  It seemed that these two lines are new since R-2.3.0.
  I am updating from R-2.2.1.
  I am very sorry about not reading the manual carefully. ;)
 
Thanks for your help!
Dongseok

 Prof Brian Ripley [EMAIL PROTECTED] 7/19/2006 2:39 PM 

How did 'cc -xtarget=generic64' get there?  AFAIK R does not know about 
it, so presumably you specified it for CC.  You need to do the same thing 
for *all* the compilers, that is CC, CXX, F77 and FC.

The INSTALL file asked you to read the R-admin manual: there you will find 
a very similar example for 64-bit Sparc Solaris.  That uses -xarch, which 
seems preferred to -xtarget (or at least to generic targets).

On Wed, 19 Jul 2006, Dongseok Choi wrote:

 Hello,
  
   I tried to compile v2.3.1 on Solaris x86 with SUN Pro compilers.
   I had an error while stats libarary was being compiled and I notice that  
 -xtarget=generic64 was not passed to f95 while cc used it.
   Could you tell me how to fix this problem?
  
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c sgram.f -o sgram.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c sinerp.f -o sinerp.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c sslvrg.f -o sslvrg.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c stxwx.f -o stxwx.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c hclust.f -o hclust.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c kmns.f -o kmns.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c eureka.f -o eureka.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c stl.f -o stl.o
 f95   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c portsrc.f -o portsrc.o
 cc -xtarget=generic64 -G -L/mounts/devel/SUNWspro/lib/amd64 
 -L/usr/sfw/lib/amd64 -L/mounts/devel/GNU/repoz/readline43/lib/amd64 -o 
 stats.so init.o kmeans.o  ansari.o bandwidths.o chisqsim.o d2x2xk.o fexact.o 
 kendall.o ks.o  line.o smooth.o  prho.o swilk.o  ksmooth.o loessc.o isoreg.o 
 Srunmed.o Trunmed.o  dblcen.o distance.o hclust-utils.o  nls.o  HoltWinters.o 
 PPsum.o arima.o burg.o filter.o  mAR.o pacf.o starma.o port.o family.o 
 bsplvd.o bvalue.o bvalus.o loessf.o ppr.o qsbart.o sbart.o  sgram.o sinerp.o 
 sslvrg.o stxwx.o  hclust.o kmns.o  eureka.o stl.o portsrc.o -xlic_lib=sunperf 
 -lsunmath -Rreg -R/mounts/devel/SUNWspro/lib/amd64:/opt/SUNWspro/lib/amd64 
 -L/mounts/devel/SUNWspro/prod/lib/amd64 -L/lib/amd64 -L/usr/lib/amd64 -lfui 
 -lfai -lfsu -lsunmath -lmtsk -lm
 ld: fatal: file bsplvd.o: wrong ELF class: ELFCLASS32
 ld: fatal: File processing errors. No output written to stats.so
 *** Error code 1
 make: Fatal error: Command failed for target `stats.so'
 
   I did not have any problem when I compiled v2.2.1 as below:
  
 cc -xtarget=generic64 -I../../../../include  
 -I/mounts/devel/SUNWspro/prod/include 
 -I/mounts/devel/GNU/repoz/readline43/include -D__NO_MATH_INLINES  -KPIC  -O 
 -I/mounts/devel/SUNWspro/prod/include -c family.c -o family.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 bsplvd.f -o bsplvd.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 bvalue.f -o bvalue.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 bvalus.f -o bvalus.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 loessf.f -o loessf.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 ppr.f -o ppr.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 qsbart.f -o qsbart.o
 cc -xtarget=generic64 -I../../../../include  
 -I/mounts/devel/SUNWspro/prod/include 
 -I/mounts/devel/GNU/repoz/readline43/include -D__NO_MATH_INLINES  -KPIC  -O 
 -I/mounts/devel/SUNWspro/prod/include -c sbart.c -o sbart.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 sgram.f -o sgram.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 sinerp.f -o sinerp.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 sslvrg.f -o sslvrg.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 stxwx.f -o stxwx.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 hclust.f -o hclust.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 kmns.f -o kmns.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 eureka.f -o eureka.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 stl.f -o stl.o
 f95 -xtarget=generic64   -PIC  -O -I/mounts/devel/SUNWspro/prod/include -c 
 portsrc.f -o portsrc.o
 cc -xtarget=generic64 -G -L/mounts/devel/SUNWspro/lib/amd64 
 -L/usr/sfw/lib/amd64 -L/mounts/devel/GNU/repoz/readline43/lib/amd64 -o 
 

[R] Automating package building packages and repository uploading

2006-07-19 Thread Carlos J. Gil Bellosta
Dear Rusers,

I have developed two packages for a client of mine. After new features
are added or bugs corrected, I upload them to my own web repository. I
create both source and binary versions.

In fact, I made an script that checks, builds, and uploads them via ftp.
However, I am facing two nuisances that do make it difficult to
automate:

1) Even if I build the binary version with the command

R CMD build --use-zip --binary $package

within my script, the output package still gets tarballed and gzipped
instead than simply zipped. I come around this automatically extracting
and compressing back the files but, am I missing something some other
option that would make all this simpler?

2) I expect my packages to be named something like
mypackage_1.3.12.tar.gz or mypackage_1.3.12.zip. However, sometimes
--I haven't looked at the code that decides the name to give to the
packages, so it looks quite random to me-- they get renamed into
something like mypackage_1.3.12_R_i486-pc-linux-gnu.tar.gz or
mypackage_1.3.12_R_i486-pc-linux-gnu.zip. The problem is that, then, the
update.packages() function cannot find them. Is there a way to prevent
this trailing string from appearing in the file name? Or else, is there
a way to have update.packages() find the package regardless of it?

I am running

platform   i486-pc-linux-gnu
arch   i486
os linux-gnu
system i486, linux-gnu
status
major  2
minor  3.1
year   2006
month  06
day01
svn rev38247
language   R
version.string Version 2.3.1 (2006-06-01)

on Debian Etch with kernel 2.6.15-1-k7.

Thank you very much.

Carlos J. Gil Bellosta
http://www.datanalytics.com
http://www.data-mining-blog.com

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


Re: [R] get rid of error in Factor Analysis

2006-07-19 Thread Andrew Robinson
Robert,

try try().

Andrew.

On Wed, Jul 19, 2006 at 10:27:07AM +0200, Robert Mcfadden wrote:
 Dear All,
 
 I wrote a program and there is a loop. At each iteration I use maximum
 likelihood factor analysis (?factanal). Output of factor analysis I use
 later (in this loop). Unfortunately from time to time I get an error message
 (I paste it below) and everything is stopped. Is it possible to write a
 condition that if error appears in factor analysis (FA), change input data
 for FA and do it again? Example
 
  
 
 for (i in 1:1000){
 
 FA-factanal(data,factor=3)
 
 If error appears change data to data2 and do factor analysis again
 
 #rest of the program  
 
 
 
 
 
 }
 
  
 
 Best,
 
 Robert 
 
 
 
 Error in optim(start, FAfn, FAgr, method = L-BFGS-B, lower = lower,  : 
 
 L-BFGS-B needs finite values of 'fn'
 
 In addition: Warning message:
 
 NaNs produced in: log(x)
 
  
 
  
 
  
 
  
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Andrew Robinson  
Department of Mathematics and StatisticsTel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
Email: [EMAIL PROTECTED] http://www.ms.unimelb.edu.au

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


Re: [R] Sweave and multipage lattice

2006-07-19 Thread Joel kincaid
On 7/18/06, Dieter Menne [EMAIL PROTECTED] wrote:
 Dear R-Listeners,

 as the Sweave faq says:

 http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html

 creating several figures from one figure chunk does not work, and for
 standard graphics, a workaround is given. Now I have a multipage trellis
 plot with an a-priori unknown number of pages, and I don't see an elegant
 way of dividing it up into multiple pdf-files.

try searching the listserv for the following message title (no quotes):
Sweave and Printing Lattice Figures From Loop
In that message I report code and give a snw file that you can try
out. Its very long and not well written, but it got the job done for
megood luck


-- 
Joel F. Kincaid
Associate Professor of Economics
School of Business and Economics
Winston Salem State University
Winston-Salem, NC 27110
Telephone: (336) 750-2348
Fax: (336) 750-2335

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


[R] Rearrange data.

2006-07-19 Thread Ritwik Sinha
Hi,

I am trying to rearrange the following data

d.f - data.frame(x=c(1,1,2,2), y=c(1,2,1,2), vals=c(a11, a12,
a21, a22))

to look like a table with x as the rows and y as the columns, something like

y  1 2
x
1a11 a12
2a21 a22

I tried doing this

funny - function(x,y){d.f[d.f$x==x  d.f$y==y,3]}

outer(1:2,1:2, FUN=funny)
But get the error

Error in outer(1:2, 1:2, FUN = funny) : dim- : dims [product 4] do
not match the length of object [2]

What am I doing wrong? I am sure there are a hundred different ways of
doing this.

version

platform i486-pc-linux-gnu
arch i486
os   linux-gnu
system   i486, linux-gnu
status
major2
minor2.1
year 2005
month12
day  20
svn rev  36812
language R

-- 
Ritwik Sinha
Graduate Student
Epidemiology and Biostatistics
Case Western Reserve University

http://darwin.cwru.edu/~rsinha

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


Re: [R] Rearrange data.

2006-07-19 Thread Gabor Grothendieck
This is FAQ 7.17:

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-does-outer_0028_0029-behave-strangely-with-my-function_003f

On 7/19/06, Ritwik Sinha [EMAIL PROTECTED] wrote:
 Hi,

 I am trying to rearrange the following data

 d.f - data.frame(x=c(1,1,2,2), y=c(1,2,1,2), vals=c(a11, a12,
 a21, a22))

 to look like a table with x as the rows and y as the columns, something like

y  1 2
 x
 1a11 a12
 2a21 a22

 I tried doing this

 funny - function(x,y){d.f[d.f$x==x  d.f$y==y,3]}

 outer(1:2,1:2, FUN=funny)
 But get the error

 Error in outer(1:2, 1:2, FUN = funny) : dim- : dims [product 4] do
 not match the length of object [2]

 What am I doing wrong? I am sure there are a hundred different ways of
 doing this.

 version

 platform i486-pc-linux-gnu
 arch i486
 os   linux-gnu
 system   i486, linux-gnu
 status
 major2
 minor2.1
 year 2005
 month12
 day  20
 svn rev  36812
 language R

 --
 Ritwik Sinha
 Graduate Student
 Epidemiology and Biostatistics
 Case Western Reserve University

 http://darwin.cwru.edu/~rsinha

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


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


Re: [R] Confirmação de pedido para entrar no grup o python-brasil

2006-07-19 Thread Savio Ramos
On 20 Jul 2006 02:05:32 -
Yahoo! Grupos [EMAIL PROTECTED] wrote:

 
 Olá [EMAIL PROTECTED],
 
 Recebemos sua solicitação para entrar no grupo python-brasil 
 do Yahoo! Grupos, um serviço de comunidades online gratuito e 
 super fácil de usar.
 
 Este pedido expirará em 7 dias.
 
 PARA ENTRAR NESTE GRUPO: 
 
 1) Vá para o site do Yahoo! Grupos clicando neste link:
 

 http://br.groups.yahoo.com/i?i=pywddWlXNxf-67g6yNq6a5yrLpQe=savio%2Eoutros%40oi%2Ecom%2Ebr
  
 
   (Se não funcionar, use os comandos para cortar e colar o link acima na
barra de endereço do seu navegador.)
 
 -OU-
 
 2) RESPONDA a este e-mail clicando em Responder e depois em Enviar,
no seu programa de e-mail.
 
 Se você não fez esta solicitação ou se não tem interesse em entrar no grupo
 python-brasil, por favor, ignore esta mensagem.
 
 Saudações,
 
 Atendimento ao usuário do Yahoo! Grupos 
 
 
 O uso que você faz do Yahoo! Grupos está sujeito aos
 http://br.yahoo.com/info/utos.html 
 
 
 
 
 
 
 
 


-- 
Sávio Martins Ramos -  Arquiteto
Rio de Janeiro  ICQ 174972645
Pirataria não! Seja livre: Linux
http://www.debian.org

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


Re: [R] Plot fit of a generic function

2006-07-19 Thread Gregor Gorjanc
Yes, that will do.

Thank you Gabor!

Gabor Grothendieck wrote:
 You could plot y vs. fitted(y.lm) where y.lm is the output of lm or
 plot both y and fitted(y.lm) against x on the same chart.
 
 
 On 7/18/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
 Hello!

 Say I have a function, which creates a design matrix i.e.

 myFunc - function(x)
 {
  ret - cbind(x, x*x, x*x*x)
  colnames(ret) - 1:ncol(ret)
  return(ret)
 }

 n - 200
 x - runif(n=n, min=0, max=100)
 y - myFunc(x) %*% c(1, 0.2, -0.0002) +  rnorm(n=n, sd=100)

 then I can use this in formulae as here

 (fit - lm(y ~ myFunc(x)))

 Now I would like to plot data and fitted function on the plot, but I do
 not want to access each parameter estimate from object fit i.e. I
 would like to use something similar to abline for linear regression but
 in a generic way. Is there anything similar to my case?

 plot(y=y, x=x)

 ???plotMyFunc???

 Thanks!

 -- 
 Lep pozdrav / With regards,
Gregor Gorjanc

 --
 University of Ljubljana PhD student
 Biotechnical Faculty
 Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
 Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

 SI-1230 Domzale tel: +386 (0)1 72 17 861
 Slovenia, Europefax: +386 (0)1 72 17 888

 --
 One must learn by doing the thing; for though you think you know it,
  you have no certainty until you try. Sophocles ~ 450 B.C.

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



-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

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


[R] R Visual Basic

2006-07-19 Thread Vito Ricci
Der R-UserRs,

I need a little help, I wish to know if exists a way
to use R in Visual Basic environment, in creation of
VB applications, embedding R in VB. Is it possible?
Can anyone help me? Is there something such as books,
articles, other available on the web?
Thanks in advance.
Regards.
Vito

Se non ora, quando?
Se non qui, dove?
Se non tu, chi?

Personal Web Space: http://vr71.spaces.msn.com/

Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com

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


Re: [R] How to find S4 generics? (was: inames() function and lmer())

2006-07-19 Thread Prof Brian Ripley
On Tue, 18 Jul 2006, Spencer Graves wrote:

 *
 * methods *
 *
 You have asked an excellent question.  I can provide a partial answer 
 below.  First, however, I wish to pose a question of my own, which could 
 help answer your question:
 
 How can one obtain a simple list of the available generics for a 
 class?  For an S3 class, the 'methods' functions provide that.  What 
 about an S4 class?  That's entirely opaque to me, if I somehow can't 
 find the relevant information in other ways.  For example, ?lmer-class 
 lists many but not all of the methods available for objects of class 
 'lmer'.  I think I once found a way to get that, but I'm not able to 
 find documentation on it now.

It doesn't work the same way.  S3 generics are defined on a single 
argument and hence have methods for a class, and so it is relevant to ask 
what generics there are which have methods for a given class - but even 
then there can be other generics and other methods which dispatch on 
object from that class by inheritance (e.g. on lm for glm objects).

S4 generics dispatch on a signature which can involve two or more classes, 
and I guess the simplest interpretation of your question is

`what S4 generics are there which have methods with signatures mentioning 
this class'.

Given the decentralized way such information is stored, I think the only 
way to do that is to find all the generics currently available (via 
getGenerics or its synonym allGenerics) and then call showMethods on each 
generic.  In particular, methods are stored in the S4 generic and not in 
the package defining the method.

However, I suspect inheritance is much more important here, and there is 
no way to know if methods for class ANY actually work for a specific S4 
class.

[...]


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

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


[R] how can I delete rows?

2006-07-19 Thread raul sanchez
Hello, I am very new in R so I am so sorry for this question.
  I have the Barro-Lee data set which contains 98 countries and I want to run 
the regressions only for the Latin America countries, so what do you recomend? 
How can I delete all the other countries or how can I select the countries of 
Lat. Am. thank you
   
  this is the list of countries
  SHCODE COUNTRY  NAME   WBCTRY   (1)   (2)
_

  1Algeria  DZA  + +
  2Angola   AGO  - -
  3BeninBEN  - +
  4Botswana BWA  + +
  5Burkina Faso HVO  - -
  6Burundi  BDI  + -
  7Cameroon CMR  + +
  8Cape verde   CPV  - -
  9Central African Rep. CAF  + +
 10Chad TCD  - -
 11Comoros  COM  - -
 12CongoCOG  - +
 13EgyptEGY  + +
 14Ethiopia ETH  + -
 15GabonGAB  + -
 16Gambia   GMB  - +
 17GhanaGHA  + +
 18Guinea   GIN  - -
 19Guinea-BissauGNB  - -
 20Cote d'IvoireCIV  + -
 21KenyaKEN  + +
 22Lesotho  LSO  - +
 23Liberia  LBR  + +
 24Madagascar   MDG  + -
 25Malawi   MWI  + +
 26Mali MLI  - +
 27Mauritania   MRT  - -
 28MauritiusMUS  + +
 29Morocco  MAR  + -
 30Mozambique   MOZ  - -
 31NigerNER  - +
 32Nigeria  NGA  + -
 33Rwanda   RWA  + +
 34Senegal  SEN  + +
 35Seychelles   SYC  - -
 36Sierra Leone SLE  + +
 37Somalia  SOM  - -
 38South africa ZAF  + +
 39SudanSDN  + +
 40SwazilandSWZ  + +
 41Tanzania TZA  + +
 42Togo TGO  + +
 43Tunisia  TUN  + +
 44Uganda   UGA  + +
 45ZaireZAR  + +
 46Zambia   ZMB  + +
 47Zimbabwe ZWE  + +
 48Bahamas, The BHS  - -
 49Barbados BRB  + +
 50Canada   CAN  + +
 51Costa Rica   CRI  + +
 52Dominica DMA  - -
 53Dominican Rep.   DOM  + +
 54El Salvador  SLV  + +
 55Grenada  GRD  - -
 56GuatemalaGTM  + +
 57HaitiHTI  + +
 58Honduras HND  + +
 59Jamaica  JAM  + +
 60Mexico   MEX  + +
 61NicaraguaNIC  + +
 62Panama   PAN  + +
 63St.Lucia LCA  - -
 64St.Vincent  Grens.  VCT  - -
 65Trinidad  TobagoTTO  + +
 66United StatesUSA  + +
 67ArgentinaARG  + +
 68Bolivia  BOL  + +
 69Brazil   BRA  + +
 70ChileCHL  + +
 71Colombia COL  + +
 72Ecuador  ECU  + +
 73Guyana   GUY  + +
 74Paraguay PRY  + +
 

[R] Classification error rate increased by bagging - any ideas?

2006-07-19 Thread Anthony Staines
Hi,

I'm analysing some anthropometric data on fifty odd skull bases. We know the

gender of each skull,  and we are trying to develop a predictor to identify
the
sex of unknown skulls.

Rpart with cross-validation produces two models - one of which predicts
gender
for Males well, and Females poorly, and the other does the opposite (Females

well, and Males poorly). In both cases the error rate for the worse
predicted
gender is close to 50%, and for the better predicted gender about 15%.

Bagging tree models produces a model which classifies both males and
females equally well (or equally poorly), but has an overall error rate
(just over 30%) higher than either of the rpart models (about 25%).

My instinct is to go for the bagging results, as they seem more reasonable,
but my colleagues really like the lower overall error rate. Any thoughts?

Ta,
Anthony Staines
-- 
Dr. Anthony Staines, Senior Lecturer in Epidemiology.
School  of Public Health and Population Sciences, UCD, Earlsfort Terrace,
Dublin 2, Ireland.
Tel:- +353 1 716 7345. Fax:- +353 1 716 7407 Mobile:- +353 86 606 9713
Web:- http://phm.ucd.ie

[[alternative HTML version deleted]]

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


Re: [R] R Visual Basic

2006-07-19 Thread Prof Brian Ripley
On Wed, 19 Jul 2006, Vito Ricci wrote:

 Der R-UserRs,
 
 I need a little help, I wish to know if exists a way
 to use R in Visual Basic environment, in creation of
 VB applications, embedding R in VB. Is it possible?
 Can anyone help me? Is there something such as books,
 articles, other available on the web?

See the rw-FAQ Q2.18 and the projects it points you to.

 Thanks in advance.
 Regards.
 Vito


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

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


Re: [R] voronoi tessellations

2006-07-19 Thread Prof Brian Ripley
On Tue, 18 Jul 2006, Don MacQueen wrote:

 I'll suggest going to the CRAN packages page and doing a search for voronoi.

The problem here is that `Voronoi tessellation' is a secondary name.  The 
concept has many names, including Dirichlet tessellation and Thiessen 
polygons, and Dirichlet has priority over Voronoi.

 Also, search for 'triangulation', since that is one of the uses of them.

I know of packages deldir, tripack and perhaps geometry.

 -Don
 
 At 11:46 PM -0400 7/18/06, zubin wrote:
 Hello, looking to draw a voronoi tessellations in R - can anyone
 recommend a package that has tackled this?
 
 some background:
 
 i have a economic data set and created a sammons projection, like to now
 overlay a voronoi tessellation over the sammons 2-D solution for a slick
 visual, and potentially color each tessellation element based on a metric.
 
 home.u - unique(home1)
 home.dist - dist(home.u)
 home.sam - sammon(home.dist,k=2)
 plot(home.sam$points)

Wait a minute.  If this is sammon() from MASS (uncredited), it is not a 
projection, and there is no relevant concept of distance between points in 
the mapped space apart from between the supplied points.

I suggest Zubin reads carefully the reference whose support software he 
appears to be using.  (It would also have answered his question.)

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

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


[R] [R-pkgs] odfWeave Package

2006-07-19 Thread Kuhn, Max
The odfWeave package is now available on CRAN at

http://lib.stat.cmu.edu/R/CRAN/src/contrib/Descriptions/odfWeave.html

and your local mirror.

The package extends Sweave to Open Document Format (ODF) text document 
files. Latex-style code chunks and in-line Sexpr commands can be used 
to embed R output into ODF file, which can then be exported to doc, 
rtf, html, pdf and other formats.

Other functions in the package facilitate ODF formatted tables, text 
and lists.

The current limitations of the package are:

 O tangling is not yet implement (but will be)

 O testing has been done on text documents generated by OpenOffice. 
   Other formats/editors may work, but are not (yet) supported.

Please send comments, suggestions and/or contributions.

Max Kuhn
Research Statistics
Pfizer Global RD
Max.Kuhn at pfizer.com


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

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

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


Re: [R] how can I delete rows?

2006-07-19 Thread Philipp Pagel
On Tue, Jul 18, 2006 at 12:25:47PM -0300, raul sanchez wrote:
   I have the Barro-Lee data set which contains 98 countries and I want
   to run the regressions only for the Latin America countries, so what
   do you recomend? How can I delete all the other countries or how can
   I select the countries of Lat. Am. thank you

   this is the list of countries
   SHCODE COUNTRY  NAME   WBCTRY   (1)   (2)
 _
 
   1Algeria  DZA  + +
   2Angola   AGO  - -
   3BeninBEN  - +
   4Botswana BWA  + +
   5Burkina Faso HVO  - -
   6Burundi  BDI  + -
   7Cameroon CMR  + +
[...]


Assuming the data is stored in a data frame called bl you could do
something like this:

First you generate a list of all countries you are interested in - e.g.

 set = c('Benin', 'Congo', 'Mali')


And then you subset the data frame with it

 bl[bl$COUNTRY %in% set, ]
   SHCODE COUNTRY NAME WBCTRY X.1. X.2.
3   3   Benin  BEN  -+   NA
12 12   Congo  COG  -+   NA
26 26Mali  MLI  -+   NA


cu
Philipp

-- 
Dr. Philipp PagelTel.  +49-8161-71 2131
Dept. of Genome Oriented Bioinformatics  Fax.  +49-8161-71 2186
Technical University of Munich
Science Center Weihenstephan
85350 Freising, Germany

 and

Institute for Bioinformatics / MIPS  Tel.  +49-89-3187 3675
GSF - National Research Center   Fax.  +49-89-3187 3585
  for Environment and Health
Ingolstädter Landstrasse 1
85764 Neuherberg, Germany
http://mips.gsf.de/staff/pagel

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


Re: [R] R and DDE (Dynamic Data Exchange)

2006-07-19 Thread Philippe Grosjean
Richard M. Heiberger wrote:
 I am thrilled to learn tcltk2 has DDE capability.
 It is the piece I have been needing to make ESS work directly
 with the RGUI on Windows.  GNU emacs on Windows has a ddeclient,
 but no access to COM.  So if R, or tcltk2 talking in both directions to R,
 has a ddeserver, all should be possible.  I will be reading the documentation
 closely in a few weeks to tie it together and then intend to make it happen.
 
 Do you, or any other list member, have a sense of the size, complexity, ease,
 magnitude of the task I just defined?  Any advice as I get started on it?
 
 Rich

Well, to be honest, DDE is an old exchange protocol (the first one 
proposed by M$ in Windows version 1 or 2). It is not that reliable. In 
practice, when the communication is working fine, you have no problems 
with it. But if something fails in either the server or the client, you 
got a very bad behaviour sometimes.

I think there is some interest to have DDE available for R (WinEdt uses 
DDE, I think... Uwe???), together with (D)COM, and socket server. 
Currently, I am improving the socket server build in svSocket (SciViews 
bundle) because it is the communication protocol we decided to push 
forward in Tinn-R, but there are other implementations out there. I 
think that using a socket server is more reliable and it is also a 
cross-platform solution. So, I would personnally prefer that solution.

Best,

Philippe Grosjean

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


Re: [R] R and DDE (Dynamic Data Exchange)

2006-07-19 Thread Philippe Grosjean
Gabor Grothendieck wrote:
 You can access DDE via COM as in this example
 which uses DDE to open an Excel file.  Note that
 Excel also supports COM directly and normally
 one would use COM with Excel, not DDE, so you
 might check if your application also supports COM.
 
 # opens an excel spreadsheet c:\test.xls using dde
 library(RDCOMClient)
 sh - COMCreate(Shell.Application)
 sh$Namespace(C:\\)$ParseName(test.xls)$InvokeVerb(Open)

Well, I think you are really using COM here, not DDE. M$ implemented the 
same DDE commands in Excel and Word in COM to ease upgrading from DDE to 
COM... but the internal is completelly different!
Best,

Philippe Grosjean

 Also if you are going to access DDE via COM or just COM also
 check out the rcom package which is similar to RDCOMClient.
 
 On 7/17/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 
R and DDE (Dynamic Data Exchange)

Dear Rusers,
I run an application (not mine) which acts as a DDE server.
I would like to use R to get data from this application,
say once per minute, and do some processing on it.
I didn't find much info on the R DDE abilities, apart the tcltk2
package in which I will try to go deeper.
I would be very thankful for any info, pointer or advice about the
good ways to make R program get online data from a DDE server.
Thanks
Vincent

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

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


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


Re: [R] A contingency table of counts by case

2006-07-19 Thread Jacques VESLOT
sorry, answered to quickly...
actually it's easier using paste():


df - df[order(df$case),]
apply(combinations(9,2), 1, function(y) table(factor(do.call(paste, 
c(with(df[df$id %in% y, ], 
split(x, id)), sep=)), levels=c(00,01,10,11

---
Jacques VESLOT

CNRS UMR 8090
I.B.L (2ème étage)
1 rue du Professeur Calmette
B.P. 245
59019 Lille Cedex

Tel : 33 (0)3.20.87.10.44
Fax : 33 (0)3.20.87.10.31

http://www-good.ibl.fr
---


Serguei Kaniovski a écrit :
 Here is an example of the data.frame that I have,
 
 df-data.frame(case=rep(1:5,each=9),id=rep(1:9,times=5),x=round(runif(length(rep(1:5,each=9)
 
 case represents the cases,
 id the persons, and
 x is the binary state.
 
 I would like to know in how many cases any two persons
 
 a. both have 1,
 b. the first has 0 - the second has 1,
 c. the first has 0 - the second has 0,
 d. both have 0.
 
 There will be choose(9,2) sums, denoted s_ij for 1=ij=9,
 where i and j are running indices for an id-pair.
 
 Please help, this is way beyond my knowledge of R!
 
 Thank you,
 Serguei Kaniovski

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


[R] get rid of error in Factor Analysis

2006-07-19 Thread Robert Mcfadden
Dear All,

I wrote a program and there is a loop. At each iteration I use maximum
likelihood factor analysis (?factanal). Output of factor analysis I use
later (in this loop). Unfortunately from time to time I get an error message
(I paste it below) and everything is stopped. Is it possible to write a
condition that if error appears in factor analysis (FA), change input data
for FA and do it again? Example

 

for (i in 1:1000){

FA-factanal(data,factor=3)

If error appears change data to data2 and do factor analysis again

#rest of the program  





}

 

Best,

Robert 



Error in optim(start, FAfn, FAgr, method = L-BFGS-B, lower = lower,  : 

L-BFGS-B needs finite values of 'fn'

In addition: Warning message:

NaNs produced in: log(x)

 

 

 

 


[[alternative HTML version deleted]]

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


Re: [R] get rid of error in Factor Analysis

2006-07-19 Thread Prof Brian Ripley
?try

On Wed, 19 Jul 2006, Robert Mcfadden wrote:

 Dear All,
 
 I wrote a program and there is a loop. At each iteration I use maximum
 likelihood factor analysis (?factanal). Output of factor analysis I use
 later (in this loop). Unfortunately from time to time I get an error message
 (I paste it below) and everything is stopped. Is it possible to write a
 condition that if error appears in factor analysis (FA), change input data
 for FA and do it again? Example
 
  
 
 for (i in 1:1000){
 
 FA-factanal(data,factor=3)
 
 If error appears change data to data2 and do factor analysis again
 
 #rest of the program  
 
 
 
 
 
 }
 
  
 
 Best,
 
 Robert 
 
 
 
 Error in optim(start, FAfn, FAgr, method = L-BFGS-B, lower = lower,  : 
 
 L-BFGS-B needs finite values of 'fn'
 
 In addition: Warning message:
 
 NaNs produced in: log(x)
 
  
 
  
 
  
 
  
 
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

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

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


Re: [R] Output and Word

2006-07-19 Thread David Hajage
thank you Greg Snow for this information !

But I have this message :

 odfWeave(c:/simple.odt, c:/essai.odt)
  Setting wd
  Copying  c:/simple.odt
  Decompressing ODF file using unzip -o
C:\DOCUME~1\Maud\LOCALS~1\Temp\RtmpF0hdqb/simple.odt
Erreur dans odfWeave(c:/simple.odt, c:/essai.odt) :
Error unzipping file
De plus : Warning message:
unzip introuvable

R says that it doesn't find unzip... What is this program ?

2006/7/18, Greg Snow [EMAIL PROTECTED]:

 Others have suggested using R2HTML (which is a good option).

 Another option is to use Sweave and specifically the new odfWeave
 package for R.  This works on OpenOffice files rather than word files
 (but OpenOffice  http://www.openoffice.org/ can inport and export word
 documents).

 The basic idea is to write your report in OpenOffice (or LaTeX or HTML),
 but anywhere that you want statisticial output (graphs, tables) you
 include instead the R code to produce the table, graph, or whatever.
 Run this file through R (using Sweave or odfWeave) and the resulting
 file has replaced all the code segments with their output.

 The documentation with odfWeave has examples.

 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 sharon snowdon
 Sent: Monday, July 17, 2006 2:36 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Output and Word

 Hi

 I have just started to have a look at R. I have used most stats software
 packages and can use perl, visual basic etc. I am interested in how well
 it handles lots of output e.g. tables or charts. How would you get lots
 of output most easily and quickly into a Word document?

 Sharon Snowdon



 
 -






 --





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

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




-- 
David

[[alternative HTML version deleted]]

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


[R] Aligning ragged text columns

2006-07-19 Thread hadley wickham
Can anyone please suggest how I can print:

a - matrix(c(
Heading 1,  This is some info\nabout heading 1,
Heading 2,  This is some info\nabout heading 2,
), byrow=T, nrow=2)

to look like:

Heading 1  This is some info
   about heading 1
Heading 2  This is some info
   about heading 2

(if you're not using a fixed width font, I want the text in the second
column to line up)

I've looked at encodeString and format, but neither seems to quite be
the right tool

Thanks!

Hadley

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


Re: [R] conditional plot

2006-07-19 Thread Chuck Cleland
Manoj wrote:
 Hi,
  Can anyone pls help me in plotting the following data?
 
  The data-set contains company name, specification-1, specification-2.
 
  The graph would basically plot company name with specification-1
 on x-axis,  specification-2 on y-axis.
 
  Simply put - company name should get classified into one of the
 four quardrants created by specification 1  specification2.

You could do something along these lines, replacing LETTERS with your 
company names:

df - data.frame(SPEC1 = runif(26), SPEC2 = runif(26), COMPANY = LETTERS)

par(lab=c(10,10,7), las=1)
plot(df$SPEC1, df$SPEC2, type=n, xlab=Specification 1, 
ylab=Specification 2, ylim=c(0,1), xlim=c(0,1))
text(df$SPEC1, df$SPEC2, df$COMPANY)
axis(side=1, at = .5, tck=1, col=grey, lty=2)
axis(side=2, at = .5, tck=1, col=grey, lty=2)

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

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

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


Re: [R] Aligning ragged text columns

2006-07-19 Thread John Wiedenhoeft
Am Mittwoch, den 19.07.2006, 10:03 +0100 schrieb hadley wickham:
 Can anyone please suggest how I can print:
 
 a - matrix(c(
   Heading 1,  This is some info\nabout heading 1,
   Heading 2,  This is some info\nabout heading 2,
 ), byrow=T, nrow=2)
 
 to look like:
 
 Heading 1  This is some info
about heading 1
 Heading 2  This is some info
about heading 2


Guess its

heading1 - Heading1
heading2 - Heading2

a - matrix(c(
Heading 1,  paste(This is some info\nabout, heading1, sep=),
Heading 2,  paste(This is some info\nabout, heading2, sep=),
), byrow=T, nrow=2)


Cheers,
John

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


Re: [R] Aligning ragged text columns

2006-07-19 Thread hadley wickham
 heading1 - Heading1
 heading2 - Heading2

 a - matrix(c(
 Heading 1,  paste(This is some info\nabout, heading1, sep=),
 Heading 2,  paste(This is some info\nabout, heading2, sep=),
 ), byrow=T, nrow=2)

I wasn't so concerned about the redundancy in my example, but how it looks - eg.

 somefunction(h)
Heading 1  This is some info
  about heading 1
Heading 2  This is some info
  about heading 2


Hadley

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


[R] Aligning ragged text columns

2006-07-19 Thread ken knoblauch
Hi Hadley,

I find that things line up better in data.frames

data.frame(c1  = c(Heading 1, , Heading 2, ),
+ c2 = c(This is some info, about heading 1, This is some info, 
about heading ))
  c1c2
1 Heading 1 This is some info
2 about heading 1
3 Heading 2 This is some info
4  about heading


although, this looks better in my console window than pasted here.
Then the question is what to so with the row and column names.

HTH,

ken


  heading1 - Heading1
  heading2 - Heading2
 
  a - matrix(c(
  Heading 1,  paste(This is some info\nabout, heading1, 
 sep=),
  Heading 2,  paste(This is some info\nabout, heading2, 
 sep=),
  ), byrow=T, nrow=2)

 I wasn't so concerned about the redundancy in my example, but how it 
 looks - eg.

  somefunction(h)
 Heading 1  This is some info
   about heading 1
 Heading 2  This is some info
   about heading 2


 Hadley
[[alternative text/enriched version deleted]]

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


[R] Aligning ragged text columns

2006-07-19 Thread ken knoblauch
Just a follow-up,

by giving names with variable amounts of white space, I could make the 
column and rownames
invisible (although this is probably abusing the mechanisms, however, 
this is only for
display purposes, I suppose).

dd - data.frame(c1  = c(Heading 1, , Heading 2, ),
c2 = c(This is some info, about heading 1, This is some info, 
about heading ))

names(dd) - c( , )
rownames(dd) - c( ,,  ,   )

dd

Heading 1 This is some info
about heading 1
Heading 2 This is some info
 about heading


On Jul 19, 2006, at 11:40 AM, ken knoblauch wrote:

 Hi Hadley,

 I find that things line up better in data.frames

 data.frame(c1  = c(Heading 1, , Heading 2, ),
 + c2 = c(This is some info, about heading 1, This is some info, 
 about heading ))
  c1c2
 1 Heading 1 This is some info
 2 about heading 1
 3 Heading 2 This is some info
 4  about heading


 although, this looks better in my console window than pasted here.
 Then the question is what to so with the row and column names.

 HTH,

 ken


  heading1 - Heading1
  heading2 - Heading2
 
  a - matrix(c(
  Heading 1,  paste(This is some info\nabout, heading1, 
 sep=),
  Heading 2,  paste(This is some info\nabout, heading2, 
 sep=),
  ), byrow=T, nrow=2)

 I wasn't so concerned about the redundancy in my example, but how it 
 looks - eg.

  somefunction(h)
 Heading 1  This is some info
   about heading 1
 Heading 2  This is some info
   about heading 2


 Hadley
[[alternative text/enriched version deleted]]

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


Re: [R] Output and Word

2006-07-19 Thread Prof Brian Ripley
On Wed, 19 Jul 2006, David Hajage wrote:

 thank you Greg Snow for this information !
 
 But I have this message :
 
  odfWeave(c:/simple.odt, c:/essai.odt)
   Setting wd
   Copying  c:/simple.odt
   Decompressing ODF file using unzip -o
 C:\DOCUME~1\Maud\LOCALS~1\Temp\RtmpF0hdqb/simple.odt
 Erreur dans odfWeave(c:/simple.odt, c:/essai.odt) :
 Error unzipping file
 De plus : Warning message:
 unzip introuvable
 
 R says that it doesn't find unzip... What is this program ?

It is in the Rtools.zip bundle used to build source packages for R under 
Windows (your unstated OS, it seems).

However, you should take this up with the package maintainer, as R has the 
capability to unzip files builtin (utils::zip.unpack) on Windows.

 
 2006/7/18, Greg Snow [EMAIL PROTECTED]:
 
  Others have suggested using R2HTML (which is a good option).
 
  Another option is to use Sweave and specifically the new odfWeave
  package for R.  This works on OpenOffice files rather than word files
  (but OpenOffice  http://www.openoffice.org/ can inport and export word
  documents).
 
  The basic idea is to write your report in OpenOffice (or LaTeX or HTML),
  but anywhere that you want statisticial output (graphs, tables) you
  include instead the R code to produce the table, graph, or whatever.
  Run this file through R (using Sweave or odfWeave) and the resulting
  file has replaced all the code segments with their output.
 
  The documentation with odfWeave has examples.
 
  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 sharon snowdon
  Sent: Monday, July 17, 2006 2:36 PM
  To: r-help@stat.math.ethz.ch
  Subject: [R] Output and Word
 
  Hi
 
  I have just started to have a look at R. I have used most stats software
  packages and can use perl, visual basic etc. I am interested in how well
  it handles lots of output e.g. tables or charts. How would you get lots
  of output most easily and quickly into a Word document?
 
  Sharon Snowdon
 
 
 
  
  -
 
 
 
 
 
 
  --
 
 
 
 
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 
 
 

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

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


[R] Fitting a distribution to peaks in histogram

2006-07-19 Thread Ulrik Stervbo
Hello list!

I would like to fit a distribution to each of the peaks in a histogram, such
as this: http://photos1.blogger.com/blogger/7029/2724/1600/DU145-Bax3-Bcl-xL.png
.

The peaks are identified using Petr Pikal peaks function (
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/33097.html), but after that
I am quite stuck.

Any idea as to how I can:
Fit a distribution to each peak
Integrate the area between each two peaks, using the means and widths of the
distributions fitted to the two peaks. I will be using the integrate
function

The histogram is based on approximately 15000 events, which makes Mclust and
pam (which both delivers the information I need) less useful.

The whole point of this exercise is to find the percentage of cells in peak
1, 2, 3, and so on, and between peak 1-2, peak 2-3, peak 3-4 and so on.
Having more that 6 peaks does not appears likely.

I am quite new to R and apologise if the solution is fairly basic.

Thank you in advance for any help and suggestions

Sincerely,
Ulrik

[[alternative HTML version deleted]]

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


Re: [R] Test for equality of coefficients in multivariate multiple regression

2006-07-19 Thread Ulrich Keller
Hello and thank you for your answers, Andrew and Berwin. If I'm not 
mistaken, the mixed-model version of Berwin's approach would be:

#My stuff:
DF-data.frame(x1=rep(c(0,1),each=50),x2=rep(c(0,1),50))
tmp-rnorm(100)
DF$y1-tmp+DF$x1*.5+DF$x2*.3+rnorm(100,0,.5)
DF$y2-tmp+DF$x1*.5+DF$x2*.7+rnorm(100,0,.5)
x.mlm-lm(cbind(y1,y2)~x1+x2,data=DF)

#1st part of Andrew's suggestion:
DF2 - with(DF, data.frame(y=c(y1,y2)))
DF2$x11 - with(DF, c(x1, rep(0,100)))
DF2$x21 - with(DF, c(x2, rep(0,100)))
DF2$x12 - with(DF, c(rep(0,100), x1))
DF2$x22 - with(DF, c(rep(0,100), x2))
DF2$x1 - with(DF, c(x1, x1))
DF2$wh - rep(c(0,1), each=100)

#Mixed version of models:
  DF2$unit - rep(c(1:100), 2)
  library(nlme)
  mm1 - lme(y~wh + x11 + x21 + x12 + x22, random= ~1 | unit, DF2, 
method=ML)
  fixef(mm1)
(Intercept)  wh x11 x21 x12 x22
 0.07800993  0.15234579  0.52936947  0.13853332  0.37285132  0.46048418
  coef(x.mlm)
y1y2
(Intercept) 0.07800993 0.2303557
x1  0.52936947 0.3728513
x2  0.13853332 0.4604842
  mm2 - update(mm1, y~wh + x1 + x12 + x22)
  anova(mm1, mm2)
Model df  AIC  BIClogLik   Test  L.Ratio p-value
mm1 1  8 523.6284 550.0149 -253.8142   
mm2 2  7 522.0173 545.1055 -254.0086 1 vs 2 0.388908  0.5329

This seems to be correct. What anova() tells me is that the effect of x1 
is the same for y1 and y2. What I don't understand then is why the 
coefficients for x12 and x22 differ so much between mm1 and mm2:

  fixef(mm2)
(Intercept)  wh  x1 x12 x22
  0.1472766   0.1384474   0.5293695  -0.1565182   0.3497476
  fixef(mm1)
(Intercept)  wh x11 x21 x12 x22
 0.07800993  0.15234579  0.52936947  0.13853332  0.37285132  0.46048418

Sorry for being a bit slow here, I'm (obviously) not a statistician.
Thanks again,

Uli

Andrew Robinson wrote:
 G'day Berwin,

 my major reason for preferring the mixed-effect approach is that, as
 you can see below, the residual df for your models are 195 and 194,
 respectively.  The 100 units are each contributing two degrees of
 freedom to your inference, and presumably to your estimate of the
 variance.  I feel a little sqeueamish about that, because it's not
 clear to me that they can be assumed to be independent.  I worry about
 the effects on the size of the test.  With a mixed-effects model each
 unit could be a cluster of two observations, and I would guess the
 size would be closer to nominal, if not nominal.

 Cheers

 Andrew

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


Re: [R] conditional plot

2006-07-19 Thread jim holtman
does this do what you want?

x - data.frame(company=LETTERS, spec1=runif(26), spec2=runif(26))
plot(range(x$spec1), range(x$spec2), type='n')
abline(v=.5, h=.5)
text(x$spec1, x$spec2, labels=x$company)



On 7/19/06, Manoj [EMAIL PROTECTED] wrote:

 Hi,
 Can anyone pls help me in plotting the following data?

 The data-set contains company name, specification-1, specification-2.

 The graph would basically plot company name with specification-1
 on x-axis,  specification-2 on y-axis.

 Simply put - company name should get classified into one of the
 four quardrants created by specification 1  specification2.

 Thanks.

 Manoj

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




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

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

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


Re: [R] Aligning ragged text columns

2006-07-19 Thread hadley wickham
 I find that things line up better in data.frames

That's a good idea, although I was hoping there would be something in
R to do it for me.

I have ended up with:

fwidth - max(nchar(x[,1]))
descs - strwrap(x[,2], width=width - fwidth - 5, simplify=FALSE)

output - do.call(rbind, mapply(function(name, desc) {
cbind(c(name, rep(, length=length(desc)-1)), desc)
}, x[,1], descs))

cat(paste(format(output[,1]), output[,2], collapse=\n), \n)

Thanks,

Hadley

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


[R] Plotting lines and points on the second plot when using gap.plot in plotrix

2006-07-19 Thread michael watson \(IAH-C\)
Hi

My question is simple - the gap.plot function in the plotrix package
allows users to draw graphs that have a broken axis.  However, I want to
then add a line to the second plot, but can't.

Eg:

twogrp-c(rnorm(10)+4,rnorm(10)+20)
gap.plot(twogrp,rnorm(20),gap.bounds=c(8,16),gap.axis=x,xlab=X
values,
   xtics=c(4,7,17,20),ylab=Y values,main=Plot gap on X axis) 

# this doesn't work
points(17,0,col=red)

# this does work
points(4,0,col=green)

I somehow need to set the focus to the second plot so that I can draw
lines and points on it.

Any help?

Mick

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


Re: [R] Plotting lines and points on the second plot when usinggap.plot in plotrix

2006-07-19 Thread michael watson \(IAH-C\)
I've answered my own question, the x-values of the line/points I want to
plot must be adjusted by the gap size

Thanks
Mick 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of michael watson
(IAH-C)
Sent: 19 July 2006 11:58
To: r-help@stat.math.ethz.ch
Subject: [R] Plotting lines and points on the second plot when
usinggap.plot in plotrix

Hi

My question is simple - the gap.plot function in the plotrix package
allows users to draw graphs that have a broken axis.  However, I want to
then add a line to the second plot, but can't.

Eg:

twogrp-c(rnorm(10)+4,rnorm(10)+20)
gap.plot(twogrp,rnorm(20),gap.bounds=c(8,16),gap.axis=x,xlab=X
values,
   xtics=c(4,7,17,20),ylab=Y values,main=Plot gap on X axis) 

# this doesn't work
points(17,0,col=red)

# this does work
points(4,0,col=green)

I somehow need to set the focus to the second plot so that I can draw
lines and points on it.

Any help?

Mick

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

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


[R] Random structure of nested design in lme

2006-07-19 Thread ESCHEN Rene
All,

I'm trying to analyze the results of a reciprocal transplant experiment using 
lme(). While I get the error-term right in aov(), in lme() it appears 
impossible to get as expected. I would be greatful for any help.

My experiment aimed to identify whether two fixed factors (habitat type and 
soil type) affect the development of plants. I took soil from six random sites 
each of two types (arable and grassland) and transplanted them back into the 
sites of origin in such way that in each of the sites there were six pots 
containing arable soil and six pots of grassland soil, each containing a 
seedling.

With aov(), I got the analysis as I expected, with habitat type tested against 
destination site, and soil type tested against origin site:

summary(aov(response~soiltype*habitat+Error(destination+origin)))
#
#Error: destination
#  Df  Sum Sq Mean Sq F value Pr(F)
#habitat1  1.  1.   0.699 0.4226
#Residuals 10 14.3056  1.4306   
#
#Error: origin
#  Df  Sum Sq Mean Sq F value   Pr(F)   
#soiltype   1 1.8 1.8  11.636 0.006645 **
#Residuals 10 1.52778 0.15278
#---
#Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
#
#Error: Within
#  Df  Sum Sq Mean Sq F value Pr(F)
#soiltype:habitat   1  0.2500  0.2500  2.1774 0.1427
#Residuals120 13.7778  0.1148 

However, when I try to replicate this analysis in lme, I am unable to get the 
structure of the random factors (origin and destination) correct. Does anyone 
have a suggestion how to resolve this problem?

Thanks in advance.

René Eschen

CABI Bioscience Centre Switzerland
Rue des Grillons 1
2800 Delémont
Switzerland

[[alternative HTML version deleted]]

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


Re: [R] Random structure of nested design in lme

2006-07-19 Thread Doran, Harold
Can you provide an example of what you have done with lme so we might be able 
to evaluate the issue? 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of ESCHEN Rene
 Sent: Wednesday, July 19, 2006 7:37 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Random structure of nested design in lme
 
 All,
 
 I'm trying to analyze the results of a reciprocal transplant 
 experiment using lme(). While I get the error-term right in 
 aov(), in lme() it appears impossible to get as expected. I 
 would be greatful for any help.
 
 My experiment aimed to identify whether two fixed factors 
 (habitat type and soil type) affect the development of 
 plants. I took soil from six random sites each of two types 
 (arable and grassland) and transplanted them back into the 
 sites of origin in such way that in each of the sites there 
 were six pots containing arable soil and six pots of 
 grassland soil, each containing a seedling.
 
 With aov(), I got the analysis as I expected, with habitat 
 type tested against destination site, and soil type tested 
 against origin site:
 
 summary(aov(response~soiltype*habitat+Error(destination+origin)))
 #
 #Error: destination
 #  Df  Sum Sq Mean Sq F value Pr(F)
 #habitat1  1.  1.   0.699 0.4226
 #Residuals 10 14.3056  1.4306   
 #
 #Error: origin
 #  Df  Sum Sq Mean Sq F value   Pr(F)   
 #soiltype   1 1.8 1.8  11.636 0.006645 **
 #Residuals 10 1.52778 0.15278
 #---
 #Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 #
 #Error: Within
 #  Df  Sum Sq Mean Sq F value Pr(F)
 #soiltype:habitat   1  0.2500  0.2500  2.1774 0.1427
 #Residuals120 13.7778  0.1148 
 
 However, when I try to replicate this analysis in lme, I am 
 unable to get the structure of the random factors (origin and 
 destination) correct. Does anyone have a suggestion how to 
 resolve this problem?
 
 Thanks in advance.
 
 René Eschen
 
 CABI Bioscience Centre Switzerland
 Rue des Grillons 1
 2800 Delémont
 Switzerland
 
   [[alternative HTML version deleted]]
 


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