Re: [R] nls and na/Nan/Inf error

2005-09-26 Thread Gabor Grothendieck
Use a grid search to get the starting values in which case you
will likely be close enough that you won't run into problems
even without derivatives:

attach(fldgd)
grid - expand.grid(Vr = seq(0,.3,.1), Vm = seq(.45, 1, .05),
alpha = seq(1,2,.25), lamda = seq(1,2,.25))
ss - function(p) sum((Moisture - vanGen(Suction, p[1], p[2], p[3], p[4]))^2)
idx  - which.min(apply(grid, 1, ss))
startval - grid[idx,]
nls(Moisture ~ vanGen(Suction, Vr, Vm, alpha, lamda), start = startval)


On 9/26/05, Tony Meissner [EMAIL PROTECTED] wrote:
 I am trying to it a particular nonlinear model common in Soil Science to
 moisture release data from soil.  I have written the function as shown
 below according to the logist example in Ch8 of Pinheiro  Bates.  I am
 getting the following error (R version 2.1.1)

 *Error in qr(attr(rhs, gradient)) : NA/NaN/Inf in foreign function
 call (arg 1)*

 Below is the function and data.

 /# the van genuchten moisture release function
 vanGen - function(x, Vr, Vm, alpha, lamda) {
  if (Vr  0) Vr - 0
  Vr + (Vm - Vr)/((1+(alpha*x)^lamda)^(1-1/lamda))
  }
 vanGen - deriv(~Vr + (Vm - Vr)/((1+(alpha*x)^lamda)^(1-1/lamda)),
  c(Vr, Vm, alpha, lamda), function(x, Vr, Vm, alpha, lamda) {} )/


 the call in R

 / fm1fld.nls - nls(Moisture ~ vanGen(Suction, Vr,Vm,alpha,lamda),
 + data=fldgd, start=c(Vr=0.229, Vm=0.433, alpha=0.2, lamda=1.5))

 /and the data:/

 /*   Suction Moisture
 100.433
 210.421
 340.400
 4   100.379
 5   200.366
 6   300.362
 7   400.358
 8   500.353
 9   600.351
 10  700.349
 */
 /can anyone offer any suggestions.  The parameters Vr, Vm = 0,  alpha 
 0, and
 lamda  1

 __
 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


Re: [R] Indentation in R code

2005-09-26 Thread Martin Maechler
I'm crossposting to the ESS-help mailing list which is slightly
more appropriate here.  [This may be a rare case where
crossposting seems to make much sense.]

 PD == Peter Dalgaard [EMAIL PROTECTED]
 on 25 Sep 2005 19:40:45 +0200 writes:

PD Seth Falcon [EMAIL PROTECTED] writes:

 On 24 Sep 2005, [EMAIL PROTECTED] wrote:
 
  I am using emacs-21.3 when writing R functions on Linux debian, and
  I am trying to follow the advice i R-exts.pdf (2.1.1) regarding
  indentation. That is, I set 'c-default-style' to bsd and
  'c-basic-offset' to 4. However, while this gives me the intended
  indentation in C code, it doesn't change the behavior in R code; I
  still get an indentation of size 2. This is my .emacs file after
  customization:
 
  (require 'ess-site)
  (custom-set-variables
   ;; custom-set-variables was added by Custom -- don't edit or
   ;; cut/paste it!  Your init file should contain only one such
   ;; instance.
   '(c-basic-offset 4)
   '(c-default-style bsd))
   (custom-set-faces
   ;; custom-set-faces was added by Custom -- don't edit or cut/paste it!
   ;; Your init file should contain only one such instance.
  )
 
 Not sure if this is the best way, but I have the following after
 loading ess-site:
 
 (setq ess-indent-level 4)



PD I have (I believe it stems from Martin M. originally):

yes, most probably  {IIRC, Kurt Hornik was involved too}.

PD  (add-hook 'c-mode-hook '(lambda()
PD(c-set-style stroustrup)))

the above is not quite what I have or did recommend, 
which is rather  bsd + offset 4  as Göran has above

In fact, Göran mentions the R-exts manual and that has
the following  *before* giving the emacs-lisp statements:

 (For GNU Emacs 20: for GNU Emacs 21 use
 customization to set the `c-default-style' to `bsd' and
 `c-basic-offset' to `4'.)

and indeed, that's what Göran did and you should do with a
current emacs, either customize via GUI or,
in your ~/.emacs file, find the section '(custom-set-variables ...)' and add 
 '(c-basic-offset 4)
 '(c-default-style bsd)

to the lines already there, or if there's no such section, add

(custom-set-variables
  ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
  ;; Your init file should contain only one such instance.
 '(c-basic-offset 4)
 '(c-default-style bsd)
)
to the end of your ~/.emacs file

PD  (add-hook 'ess-mode-hook
PD'(lambda()
PD   (if (or (string ess-version 5.0)
PD   (string= ess-version 5.0))
PD   (ess-set-style 'C++)
PD (ess-set-style 'C++ 'quiet))
PD 
PD   (add-hook 'local-write-file-hooks
PD '(lambda()
PD(delete-trailing-whitespace)
PD))
PD   ))

yes; using  (add-hook ...) is really more clean than first
requiring ess-site.
Also, since nowadays I assume everyone has an ess-version = 5, 
the above becomes simply

(add-hook 'ess-mode-hook
  '(lambda()
  (ess-set-style 'C++ 'quiet)
  (add-hook 'local-write-file-hooks
'(lambda()
   (delete-trailing-whitespace)

Note that this has the standard e-lisp function
'delete-trailing-whitespace' which is simpler but also less
flexible than the 'ess-nuke-trailing-whitespace' which we've had
there.

Martin Maechler, ETH Zurich

__
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


Re: [R] nls and na/Nan/Inf error

2005-09-26 Thread Prof Brian Ripley
This works if you omit the deriv() step.

Use R's options(error=dump.frames) and debugger().  This gives

Browse[1] rhs
 [1] 0.433 0.4272571 0.3994105 0.3594037 0.3270730 0.3104752 0.3000927
 [8] 0.2928445 0.2874249 0.2831787
attr(,gradient)
  VrVm   alphalamda
 [1,] 0. 1.000  0.  NaN
 [2,] 0.02815158 0.9718484 -0.04069202  0.001183749
 [3,] 0.16465431 0.8353457 -0.17769291 -0.035591190
 [4,] 0.36076599 0.6392340 -0.24085444 -0.100064577
 [5,] 0.51925014 0.4807499 -0.21793994 -0.136056450
 [6,] 0.60061200 0.3993880 -0.19071160 -0.145267481
 [7,] 0.65150658 0.3484934 -0.17020938 -0.147113828
 [8,] 0.68703698 0.3129630 -0.15471851 -0.146388612
 [9,] 0.71360324 0.2863968 -0.14263118 -0.144660967
[10,] 0.73441811 0.2655819 -0.13290951 -0.142543261

and note the NaN.  Now think about your formula for x = 0: it does not
actually depend on lamda.  The analytical derivative ends up with a
calculation as 0/0.

On Mon, 26 Sep 2005, Tony Meissner wrote:

 I am trying to it a particular nonlinear model common in Soil Science to
 moisture release data from soil.  I have written the function as shown
 below according to the logist example in Ch8 of Pinheiro  Bates.  I am
 getting the following error (R version 2.1.1)

 *Error in qr(attr(rhs, gradient)) : NA/NaN/Inf in foreign function
 call (arg 1)*

 Below is the function and data.

 /# the van genuchten moisture release function
 vanGen - function(x, Vr, Vm, alpha, lamda) {
   if (Vr  0) Vr - 0
   Vr + (Vm - Vr)/((1+(alpha*x)^lamda)^(1-1/lamda))
   }
 vanGen - deriv(~Vr + (Vm - Vr)/((1+(alpha*x)^lamda)^(1-1/lamda)),
   c(Vr, Vm, alpha, lamda), function(x, Vr, Vm, alpha, lamda) {} )/


 the call in R

 / fm1fld.nls - nls(Moisture ~ vanGen(Suction, Vr,Vm,alpha,lamda),
 + data=fldgd, start=c(Vr=0.229, Vm=0.433, alpha=0.2, lamda=1.5))

 /and the data:/

 /*   Suction Moisture
 100.433
 210.421
 340.400
 4   100.379
 5   200.366
 6   300.362
 7   400.358
 8   500.353
 9   600.351
 10  700.349
 */
 /can anyone offer any suggestions.  The parameters Vr, Vm = 0,  alpha 
 0, and
 lamda  1

-- 
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 272860 (secr)
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


Re: [R] SAX Parser best practise

2005-09-26 Thread Jan Hummel
Hi Duncan,

thanks again for your comments.

 I dug around in the libxml code and the Web to verify that 
 validation is indeed only possible in libxml when one uses 
 DOM (i.e. xmlTreeParse()).
Using DOM is not an option for me, so I need to validate the xml parts
I'm interested in within my creation mechanism. It's OK, but not the
best solution in questions of design.

 BTW, there is a new version of the XML package on the 
 Omegahat web site.
I'll use it extensive in this days and unfortunately I have already a
question/problem pending:

Taking the following R function:

test-function(){
sep=
xmlText -
xmlText -paste(xmlText,spectrum id=\3257\,sep=sep)
xmlText -paste(xmlText,mzArrayBinary,sep=sep)
xmlText -paste(xmlText,dataMonday/data,sep=sep)
xmlText -paste(xmlText,/mzArrayBinary,sep=sep)
xmlText -paste(xmlText,intenArrayBinary,sep=sep)
xmlText -paste(xmlText,dataTuesday/data,sep=sep)
xmlText -paste(xmlText,/intenArrayBinary,sep=sep)
#   xmlText -paste(xmlText,/spectrum,sep=sep)
#   xmlText -paste(xmlText,spectrum id=\3259\,sep=sep)
xmlText -paste(xmlText,mzArrayBinary,sep=sep)
xmlText -paste(xmlText,dataWednesday/data,sep=sep)
xmlText -paste(xmlText,/mzArrayBinary,sep=sep)
xmlText -paste(xmlText,intenArrayBinary,sep=sep)
xmlText -paste(xmlText,dataThursday/data,sep=sep)
xmlText -paste(xmlText,/intenArrayBinary,sep=sep)
xmlText -paste(xmlText,/spectrum,sep=sep)

xmlEventParse(xmlText, asText=TRUE, handlers = list(text =
function(x, ...) {cat(nchar(x),x, \n)}))
return(invisible(NULL))
}

Using this function in the given form works fine. xmlEventParse() with
the simplest handler I can imagine finds all 4 text-nodes within the
spectrum tag and prints them out. But if one uncomment both lines in
the middle, introducing 2 spectrum tags with different id's
xmlEventParse() returns with an exception. Of course the weekdays within
data are arbitrary values used here. Further, using an other input
file I could see, that for one and the same data node the handler for
text-nodes was invoked two times, one time for a first part of the
content and one time for the rest of the content. Both invocations
together gave me exactly the content from the data node. 

So, am I on the wrong way? Or is this some buggy behaviour? 

I appreciat any help and assistance!

Jan

__
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] How to get the rowindices without using which?

2005-09-26 Thread Martin Lam
Hi,

I was wondering if it is possible to get the
rowindices without using the function which because
I don't have a restriction criteria. Here's an example
of what I mean:
# take 10 randomly selected instances
iris[sample(1:nrow(iris), 10),]

# output
Sepal.Length Sepal.Width Petal.Length Petal.Width 
  Species
76   6.6 3.0  4.4 1.4
versicolor
105  6.5 3.0  5.8 2.2 
virginica
131  7.4 2.8  6.1 1.9 
virginica
79   6.0 2.9  4.5 1.5
versicolor
69   6.2 2.2  4.5 1.5
versicolor
42   4.5 2.3  1.3 0.3 
   setosa
25   4.8 3.4  1.9 0.2 
   setosa
129  6.4 2.8  5.6 2.1 
virginica
60   5.2 2.7  3.9 1.4
versicolor
80   5.7 2.6  3.5 1.0
versicolor

What I want to get are their rownumbers: 76, 105, 131,
79, 69, 42, 25, 129, 60, 80.

Thanks in advance,

Martin

__
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


Re: [R] How to get the rowindices without using which?

2005-09-26 Thread Dimitris Rizopoulos
try this:

dat - iris[sample(1:nrow(iris), 10), ]
dat
match(rownames(dat), rownames(iris))


I hope it helps.

Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://www.med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm



- Original Message - 
From: Martin Lam [EMAIL PROTECTED]
To: R r-help@stat.math.ethz.ch
Sent: Monday, September 26, 2005 10:37 AM
Subject: [R] How to get the rowindices without using which?


 Hi,

 I was wondering if it is possible to get the
 rowindices without using the function which because
 I don't have a restriction criteria. Here's an example
 of what I mean:
 # take 10 randomly selected instances
 iris[sample(1:nrow(iris), 10),]

 # output
Sepal.Length Sepal.Width Petal.Length Petal.Width
  Species
 76   6.6 3.0  4.4 1.4
 versicolor
 105  6.5 3.0  5.8 2.2
 virginica
 131  7.4 2.8  6.1 1.9
 virginica
 79   6.0 2.9  4.5 1.5
 versicolor
 69   6.2 2.2  4.5 1.5
 versicolor
 42   4.5 2.3  1.3 0.3
   setosa
 25   4.8 3.4  1.9 0.2
   setosa
 129  6.4 2.8  5.6 2.1
 virginica
 60   5.2 2.7  3.9 1.4
 versicolor
 80   5.7 2.6  3.5 1.0
 versicolor

 What I want to get are their rownumbers: 76, 105, 131,
 79, 69, 42, 25, 129, 60, 80.

 Thanks in advance,

 Martin

 __
 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
 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

__
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


Re: [R] getting variable length numerical gradient

2005-09-26 Thread Antonio, Fabio Di Narzo
Tnx very much Dimitris,
your code does what I need. I've just adapted it to my needs (e.g., I
don't deal with scalar functions), and so solved my problem.

Given this, is there a way to use the deriv function in the base
package, within this context (variable length vector of indipendent
variables)?

Best,
Antonio, Fabio Di Narzo.

On 9/25/05, Dimitris Rizopoulos [EMAIL PROTECTED] wrote:
 maybe you can find the following function useful (any comments are
 greatly appreciated):

 fd - function(x, f, scalar = TRUE, ..., eps =
 sqrt(.Machine$double.neg.eps)){
 f - match.fun(f)
 out - if(scalar){
 if(length(f0 - f(x, ...)) != length(x))
 stop('f' must be vectorized)
 x. - x + eps * pmax(abs(x), 1)
 c(f(x., ...) - f0) / (x. - x)
 } else{
 n - length(x)
 res - array(0, c(n, n))
 f0 - f(x, ...)
 ex - pmax(abs(x), 1)
 for(i in 1:n){
 x. - x
 x.[i] - x[i] + eps * ex[i]
 res[, i] - c(f(x., ...) - f0) / (x.[i] - x[i])
 }
 res
 }
 out
 }


 ## Examples

 x - seq(-3.3, 3.3, 0.1)
 all.equal(fd(x, pnorm, mean = 0.5), dnorm(x, mean = 0.5))


 # Approximate the Hessian matrix for a logistic regression

 # the score vector function
 gn - function(b, y, X){
 p - as.vector(plogis(X %*% b))
 -colSums(X * (y - p))
 }

 # We simulate some data and fit the logistic regression
 n - 800
 x1 - runif(n,-3, 3); x2 - runif(n, -3, 3)
 pr - plogis(0.8 + 0.4 * x1 - 0.3 * x2)
 y - rbinom(n, 1, pr)
 fm - glm(y ~ x1 + x2, binomial)

 ## The Hessian using forward difference approximation
 fd(fm$coef, gn, scalar = FALSE, y = y, X = cbind(1, x1, x2))

 ## The true Hessian
 solve(summary(fm)$cov.unscaled)


 I hope it helps.

 Best,
 Dimitris

 
 Dimitris Rizopoulos
 Ph.D. Student
 Biostatistical Centre
 School of Public Health
 Catholic University of Leuven

 Address: Kapucijnenvoer 35, Leuven, Belgium
 Tel: +32/(0)16/336899
 Fax: +32/(0)16/337015
 Web: http://www.med.kuleuven.be/biostat/
  http://www.student.kuleuven.be/~m0390867/dimitris.htm


 - Original Message -
 From: Antonio, Fabio Di Narzo [EMAIL PROTECTED]
 To: R-help@stat.math.ethz.ch
 Sent: Sunday, September 25, 2005 11:37 AM
 Subject: [R] getting variable length numerical gradient


  Hi all.
  I have a numerical function f(x), with x being a vector of generic
  size (say k=4), and I wanna take the numerically computed gradient,
  using deriv or numericDeriv (or something else).
 
  My difficulties here are that in deriv and numericDeric the function
  is passed as an expression, and one have to pass the list of
  variables
  involved as a char vector... So, it's a pure R programming question.
 
 
  Have a nice sunday,
  Antonio, Fabio Di Narzo.
 
  __
  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
 


 Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm



__
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] hist(x, ...) with normal distribution curve

2005-09-26 Thread Knut Krueger
.
I am looking for a histogram or box plot with the adding  normal 
distribution  curve
I think that must be possible, but I am not able to find out how to do.



Regards Knut

__
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] figure widths in sweave

2005-09-26 Thread John Charles Considine
gRoovers,

Can the size of figures be controlled from within a noweb document
without resorting to editing the \includegraphics sections in the .tex
file?

Can the figure widths be set in the environmental declarations at the
start?

Can they be set within the \begin{figure} environment?

JC

__
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


Re: [R] hist(x, ...) with normal distribution curve

2005-09-26 Thread Petr Pikal
Hi

answered hundered times.

 Dear R people: 
 
 I would like to superimpose a normal curve on a histogram. 
x-rnorm(150) 
h-hist(x,breaks=15) 
xhist-c(min(h$breaks),h$breaks) 
yhist-c(0,h$density,0) 
xfit-seq(min(x),max(x),length=40) 
yfit-dnorm(xfit,mean=mean(x),sd=sd(x)) 
plot(xhist,yhist,type=s,ylim=c(0,max(yhist,yfit))) 
lines(xfit,yfit) 


Bill 

above is e.g. Bill Simpson's answer from 2001. Found from R-site 
search  ***histogram density normal***.

HTH
Petr


On 25 Sep 2005 at 14:34, Knut Krueger wrote:

 .
 I am looking for a histogram or box plot with the adding  normal
 distribution  curve I think that must be possible, but I am not able
 to find out how to do.
 
 
 
 Regards Knut
 
 __
 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

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


Re: [R] hist(x, ...) with normal distribution curve

2005-09-26 Thread Romain Francois
Le 25.09.2005 14:34, Knut Krueger a écrit :

.
I am looking for a histogram or box plot with the adding  normal 
distribution  curve
I think that must be possible, but I am not able to find out how to do.



Regards Knut
  

Hi Knut,

There are a lot of ways to do that, let x be your data (assume x ~ 
N(mu=2,sd=.4))
R x - rnorm(200, mean=2, sd=.4)

** With the traditionnal graphics system, do :
R hist(x, prob=T)
R curve(dnorm, col=2, mean=mean(x), sd=sd(x))

** With lattice :
R histogram(~x,
  panel = function(x,...){
panel.histogram(x,...)
panel.mathdensity(dmath = dnorm, col = red,
args = list(mean=mean(x),sd=sd(x)))
   },
  type=density)

Then, have a look at :
http://addictedtor.free.fr/graphiques/search.php?q=hist

And also have a nice day

Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.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


Re: [R] anova on binomial LMER objects

2005-09-26 Thread Douglas Bates
On 9/25/05, Horacio Montenegro [EMAIL PROTECTED] wrote:

 Hi Spencer and Robert,

 I have found the same behaviour, but only for lme4
 and Matrix after the 0.96 release. lme4 0.95-10 and
 Matrix 0.95-13 releases gave sensible results. This
 could be an introduced bug, or a solved bug - you
 should ask Prof. Bates.

 hope this helps, cheers,

 Horacio Montenegro

I have run into a couple of other things that the improvements from
the 0.95 series to the 0.96 series has made worse.  This may take a
while to sort out.  Thanks to Robert Bagchi for the very thorough
error report.



 --- Spencer Graves [EMAIL PROTECTED] wrote:
  I agree:  Something looks strange to me in this
  example also;  I have
  therefore copied Douglas Bates and  Deepayan Sarkar.
   You've provided a
  nice simulation.  If either of them have time to
  look at this, I think
  they could tell us what is happening here.
 
  If you need an answer to your particular problem,
  you could run that
  simulation 1000 or 1,000 times.  That would tell you
  whether to believe
  the summary or the anova, or neither.  If you want
  to understand the
  algorithm, you could walk through the code.
  However, lmer is a
  generic, and I don't have time now to figure out how
  to find the source.
A response from Brian Ripley to a question from me
  a couple of days
  ago provides a nice summary of how to do that, but I
  don't have time to
  check that now.
 
  Sorry I couldn't help more.
  spencer graves
 
  Robert Bagchi wrote:
 
   Dear R users,
  
   I have been having problems getting believable
  estimates from anova on a
   model fit from lmer. I get the impression that F
  is being greatly
   underestimated, as can be seen by running the
  example I have given below.
  
   First an explanation of what I'm trying to do. I
  am trying to fit a glmm
   with binomial errors to some data. The experiment
  involves 10
   shadehouses, divided between 2 light treatments
  (high, low). Within each
   shadehouse there are 12 seedlings of each of 2
  species (hn  sl). 3
   damage treatments (0, 0.1, 0.25 leaf area removal)
  were applied to the
   seedlings (at random) so that there are 4
  seedlings of each
   species*damage treatment in each shadehouse.
  There maybe a shadehouse
   effect, so I need to include it as a random
  effect. Light is applied to
   a shadehouse, so it is outer to shadehouse. The
  other 2 factors are
   inner to shadehouse.
  
   We want to assess if light, damage and species
  affect survival of
   seedlings. To test this I fitted a binomial mixed
  effects model with
   lmer (actually with quasibinomial errors). THe
  summary function suggests
   a large effect of both light and species (which
  agrees with graphical
   analysis). However, anova produces F values close
  to 0 and p values
   close to 1 (see example below).
  
   Is this a bug, or am I doing something
  fundamentally wrong? If anova
   doesn't work with lmer is there a way to perform
  hypothesis tests on
   fixed effects in an lmer model? I was going to
  just delete terms and
   then do liklihood ratio tests, but according to
  Pinheiro  Bates (p. 87)
   that's very untrustworthy. Any suggestions?
  
   I'm using R 2.1.1 on windows XP and lme4 0.98-1
  
   Any help will be much appreciated.
  
   many thanks
   Robert
  
  

 __
 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


Re: [R] merge maps from shapefile to lattice

2005-09-26 Thread Roger Bivand
On Mon, 26 Sep 2005, Toni Viúdez wrote:

 Hi everybody:
 Could anybody help how I solve the next problem?.
 I'm doing interpolation maps of tropospheric ozone of my region, and after 
 create it using IDW, and kriging methods, I want from shapefiles (*.shx, 
 *.shp, *.dbf, *.sbx  *.sbn ) create contour over the interpolation maps.
 Could anybody tell me how do it?.

In replies off-list, I've suggested that using base graphics is simpler 
because you can build things up bit by bit with add=TRUE. However, using 
the maptools and sp packages, you can look at the example in ?meuse.riv:

 spplot(meuse.grid, col.regions=bpy.colors(), main = meuse.grid,
   sp.layout=list(
 list(sp.polygons, meuse.sr),
 list(sp.points, meuse, pch=+, col=black)
   )
 )

which plots a grid of data (your interpolations would need to be converted
to this format) over polygons but under points, where meuse.sr  is a
SpatialPolygons object. You would then do:

my_polys - readShapePoly(my_polys.shp)
spplot(meuse.grid, sp.layout=list(sp.polygons, my_polys))

to get something similar. Note that the polygons seem to be plotted under 
the image in the example.


 Thanks in advance.
 
 ##
 Antonio Viudez Mora
 Departamento de Dinámica
  de Contaminantes
 Fundación CEAM
 Paterna (Valencia)
 tel: 961318190. ext: 216
 e-mail:[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
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [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


[R] regression methods for circular(?) data.

2005-09-26 Thread nwew
Dear R-users,

I have the following data

x - runif(300,min=1,max=230)

y - x*0.005 + 0.2
y - y+rnorm(100,mean=0,sd=0.1)
y - y%%1 #  --- modulo operation
plot(x,y)

and would like to recapture the slope (0.005) and intercept(0.2). I wonder if 
there are any clever algorithms to do this. I was looking at the function 
lm.cirucalar. Is this the method to use? If, which of the references is best 
too look at?

Eryk

__
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] Error Message - Error: symbol print-name too long

2005-09-26 Thread Carl Anderson
Dear All,

I write to ask for information regarding the error message:

Error: symbol print-name too long.

I am afraid that I can't include any code to help with any further diagnosis 
of the problem as the code is far too long to be of any use, and I have not 
been able to re-create the problem in shorter example codes.

I have searched the R manual and help pages and found no mention of this 
error message.

All help appreciated,

Carl A Anderson.

__
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


Re: [R] getting variable length numerical gradient

2005-09-26 Thread Randall R Schulz
Dimitris,

I'm new to R programming, and I'm trying to learn the proper way to do 
certain things. E.g., I had a piece of code with explicit iteration to 
apply some computations to a vector. It was pretty slow. I found a way 
to utilize R's built-in vectorization and it was sped up considerably.

So I want to ask about the code you supplied. Please see below.

(By the way, this message is best viewed using a mono-spaced font.)


On Sunday 25 September 2005 04:07, Dimitris Rizopoulos wrote:
 maybe you can find the following function useful (any comments are
 greatly appreciated):

 fd - function(x, f, scalar = TRUE, ..., eps =
 sqrt(.Machine$double.neg.eps)){
 f - match.fun(f)
 out - if(scalar){
 ...
 } else{
 n - length(x)
 res - array(0, c(n, n))
 f0 - f(x, ...)
 ex - pmax(abs(x), 1)
 for(i in 1:n){

This (following) statement will create a copy of the entire x vector 
on each iteration. It doesn't look like that's what you would want to 
do:

 x. - x

The computation described by this statement could be vectorized outside 
the loop:

 x.[i] - x[i] + eps * ex[i]

 res[, i] - c(f(x., ...) - f0) / (x.[i] - x[i])
 }
 res
 }
 out
 }

Offhand, I cannot tell for sure if the last line of that loop is 
vectorizable, but I have a hunch it is.

So at a minimum, it seems this fragment of your code:

        for(i in 1:n){
            x. - x
            x.[i] - x[i] + eps * ex[i]
            res[, i] - c(f(x., ...) - f0) / (x.[i] - x[i])
        }

Could be more efficiently and succinctly replaced with this:

x. - x + eps * ex
for (in in 1:n)
res[, i] - c(f(x., ...) - f0) / (x.[i] - x[i])


Could your someone else with R programming experience comment?


Thanks.


Randall Schulz

__
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] create trend variable in a regression using R

2005-09-26 Thread giacomo moro
Hi,
my name is Giacomo. 
I would like to know how to create a Trend variable in a regression using R.
Thank you for your help.
My best regards,   
  Giacomo


-

[[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


[R] histogram - one bin for all values larger than a certain value

2005-09-26 Thread Florian Defregger
Dear all,
I wonder if I can put together a histogram where one bin contains all the 
values that are larger than a certain specified value.

Example:
I have values ranging from 0 to 40 and I want 10 bins from 0 to 10, i.e. for 
the intervals [0,1), [1,2) , ..., [9,10). And then I want one last bin which 
contains all the values larger than 10, i.e. for the interval [10, 40).

Thanks,
Florian

__
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


Re: [R] SAX Parser best practise

2005-09-26 Thread Duncan Temple Lang
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


When you uncomment the two lines, your document
becomes two nodes
 spectrum
...
 spectrum
 spectrum
   ...
 /spectrum

XML requires that there be a single top-level node.
And so the parser throws an error saying
  Extra content at the end of the document

And it is the second spectrum .. /spectrum
node that it is complaining about.
You can wrap the entire thing in a top node, e.g.
spectra spectrum.../spectrumspectrum.../spectrum/spectra

How did I find this?  I looked at the error message from
libxml. Now that we have exceptions in R and we are using
libxml2, etc. I can make this material available at the
R level. So I'll do that.


Jan Hummel wrote:
 Hi Duncan,
 
 
BTW, there is a new version of the XML package on the 
Omegahat web site.
 
 I'll use it extensive in this days and unfortunately I have already a
 question/problem pending:
 
 Taking the following R function:
 
 test-function(){
   sep=
   xmlText -
   xmlText -paste(xmlText,spectrum id=\3257\,sep=sep)
   xmlText -paste(xmlText,mzArrayBinary,sep=sep)
   xmlText -paste(xmlText,dataMonday/data,sep=sep)
   xmlText -paste(xmlText,/mzArrayBinary,sep=sep)
   xmlText -paste(xmlText,intenArrayBinary,sep=sep)
   xmlText -paste(xmlText,dataTuesday/data,sep=sep)
   xmlText -paste(xmlText,/intenArrayBinary,sep=sep)
 # xmlText -paste(xmlText,/spectrum,sep=sep)
 # xmlText -paste(xmlText,spectrum id=\3259\,sep=sep)
   xmlText -paste(xmlText,mzArrayBinary,sep=sep)
   xmlText -paste(xmlText,dataWednesday/data,sep=sep)
   xmlText -paste(xmlText,/mzArrayBinary,sep=sep)
   xmlText -paste(xmlText,intenArrayBinary,sep=sep)
   xmlText -paste(xmlText,dataThursday/data,sep=sep)
   xmlText -paste(xmlText,/intenArrayBinary,sep=sep)
   xmlText -paste(xmlText,/spectrum,sep=sep)
 
   xmlEventParse(xmlText, asText=TRUE, handlers = list(text =
 function(x, ...) {cat(nchar(x),x, \n)}))
   return(invisible(NULL))
 }
 
 Using this function in the given form works fine. xmlEventParse() with
 the simplest handler I can imagine finds all 4 text-nodes within the
 spectrum tag and prints them out. But if one uncomment both lines in
 the middle, introducing 2 spectrum tags with different id's
 xmlEventParse() returns with an exception. Of course the weekdays within
 data are arbitrary values used here. Further, using an other input
 file I could see, that for one and the same data node the handler for
 text-nodes was invoked two times, one time for a first part of the
 content and one time for the rest of the content. Both invocations
 together gave me exactly the content from the data node. 
 
 So, am I on the wrong way? Or is this some buggy behaviour? 
 
 I appreciat any help and assistance!
 
 Jan
 
 __
 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

- --
Duncan Temple Lang[EMAIL PROTECTED]
Department of Statistics  work:  (530) 752-4782
371 Kerr Hall fax:   (530) 752-7099
One Shields Ave.
University of California at Davis
Davis, CA 95616, USA
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD4DBQFDOAII9p/Jzwa2QP4RAg+9AKCCkYAwTjlMQ9R9dsLbeWQxuf63uQCYkR3g
nEZl4wFXtkYSmsQ8/JyMDA==
=wXfS
-END PGP SIGNATURE-

__
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


Re: [R] getting variable length numerical gradient

2005-09-26 Thread Dimitris Rizopoulos
Randall,

thanks for your comments; however, you have to take into account what 
is the purpose of the function here! The goal is to approximate 
*partial* derivatives numerically, using in fact the definition of the 
partial derivatives. If you recall this definition I hope that you can 
see why I change the ith element of the x vector and not the whole 
one. You could also test your approach with the original one in the 
logistic regression example and see the difference.

I hope it is more clear now.

Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://www.med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


- Original Message - 
From: Randall R Schulz [EMAIL PROTECTED]
To: R Help R-Help@stat.math.ethz.ch
Sent: Monday, September 26, 2005 3:53 PM
Subject: Re: [R] getting variable length numerical gradient


Dimitris,

I'm new to R programming, and I'm trying to learn the proper way to do
certain things. E.g., I had a piece of code with explicit iteration to
apply some computations to a vector. It was pretty slow. I found a way
to utilize R's built-in vectorization and it was sped up considerably.

So I want to ask about the code you supplied. Please see below.

(By the way, this message is best viewed using a mono-spaced font.)


On Sunday 25 September 2005 04:07, Dimitris Rizopoulos wrote:
 maybe you can find the following function useful (any comments are
 greatly appreciated):

 fd - function(x, f, scalar = TRUE, ..., eps =
 sqrt(.Machine$double.neg.eps)){
 f - match.fun(f)
 out - if(scalar){
 ...
 } else{
 n - length(x)
 res - array(0, c(n, n))
 f0 - f(x, ...)
 ex - pmax(abs(x), 1)
 for(i in 1:n){

This (following) statement will create a copy of the entire x vector
on each iteration. It doesn't look like that's what you would want to
do:

 x. - x

The computation described by this statement could be vectorized 
outside
the loop:

 x.[i] - x[i] + eps * ex[i]

 res[, i] - c(f(x., ...) - f0) / (x.[i] - x[i])
 }
 res
 }
 out
 }

Offhand, I cannot tell for sure if the last line of that loop is
vectorizable, but I have a hunch it is.

So at a minimum, it seems this fragment of your code:

for(i in 1:n){
x. - x
x.[i] - x[i] + eps * ex[i]
res[, i] - c(f(x., ...) - f0) / (x.[i] - x[i])
}

Could be more efficiently and succinctly replaced with this:

x. - x + eps * ex
for (in in 1:n)
res[, i] - c(f(x., ...) - f0) / (x.[i] - x[i])


Could your someone else with R programming experience comment?


Thanks.


Randall Schulz

__
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


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

__
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


Re: [R] histogram - one bin for all values larger than a certain value

2005-09-26 Thread Sundar Dorai-Raj


Florian Defregger wrote:
 Dear all,
 I wonder if I can put together a histogram where one bin contains all the 
 values that are larger than a certain specified value.
 
 Example:
 I have values ranging from 0 to 40 and I want 10 bins from 0 to 10, i.e. for 
 the intervals [0,1), [1,2) , ..., [9,10). And then I want one last bin which 
 contains all the values larger than 10, i.e. for the interval [10, 40).
 
 Thanks,
 Florian
 

Hi, Florian,

See the breaks argument in ?hist.

x - sample(1:40, 1000, replace = TRUE)
hist(x, breaks = c(0:10, 40))

Is this what you intended?

--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


[R] k-d tree for loess

2005-09-26 Thread Carlisle Thacker
I am exploring the use of loess for oceanographic applications and would
like to plot the locations (longitude and latitude) points where the models
(salinity~temperature*longitude*latitude,parametric=temperature) are
fitted.  Chambers and Hastie(1993) explains the locations are nodes of a
k-d tree. but I cannot find anything about accessing this information.  It
would be useful to superimpose on such plots contours of the weights for at
least one point.  Sample code of drawing such plots would be greatly
appreciated.

Thanks,

Carlisle Thacker

__
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


Re: [R] getting variable length numerical gradient

2005-09-26 Thread Randall R Schulz
Dimitris,

On Monday 26 September 2005 07:16, Dimitris Rizopoulos wrote:
 Randall,

 thanks for your comments; however, you have to take into account what
 is the purpose of the function here! The goal is to approximate
 *partial* derivatives numerically, ...

 I hope it is more clear now.

Yes. Thanks for clearing up my misunderstanding.


 Best,
 Dimitris


Randall Schulz

__
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


Re: [R] Error Message - Error: symbol print-name too long

2005-09-26 Thread Duncan Temple Lang
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1



You aren't giving us much to go on, so I can only
make a very wild guess.  Check that your file
doesn't have a stray ` character in it.
R will start reading from that point on and try
to make this an internal symbol.  If it doesn't
find the closing ` for too many characters,
it gives the error message you see.

I have seen this once before and that is what the cause
was - a stray ` put in by hitting the ` key rather than Esc.



Carl Anderson wrote:
 Dear All,
 
 I write to ask for information regarding the error message:
 
 Error: symbol print-name too long.
 
 I am afraid that I can't include any code to help with any further diagnosis 
 of the problem as the code is far too long to be of any use, and I have not 
 been able to re-create the problem in shorter example codes.
 
 I have searched the R manual and help pages and found no mention of this 
 error message.
 
 All help appreciated,
 
 Carl A Anderson.
 
 __
 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

- --
Duncan Temple Lang[EMAIL PROTECTED]
Department of Statistics  work:  (530) 752-4782
371 Kerr Hall fax:   (530) 752-7099
One Shields Ave.
University of California at Davis
Davis, CA 95616, USA
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.2 (Darwin)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFDOAYs9p/Jzwa2QP4RAhtAAJ97sqWdUTOPjtZ2RMJR0qcfyjIAZgCfZLF1
IXTk0bY5RQUD2e+8VlzLpw4=
=+pim
-END PGP SIGNATURE-

__
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


Re: [R] histogram - one bin for all values larger than a certain value

2005-09-26 Thread Romain Francois
Le 26.09.2005 16:15, Sundar Dorai-Raj a écrit :

Florian Defregger wrote:
  

Dear all,
I wonder if I can put together a histogram where one bin contains all the 
values that are larger than a certain specified value.

Example:
I have values ranging from 0 to 40 and I want 10 bins from 0 to 10, i.e. for 
the intervals [0,1), [1,2) , ..., [9,10). And then I want one last bin which 
contains all the values larger than 10, i.e. for the interval [10, 40).

Thanks,
Florian




Hi, Florian,

See the breaks argument in ?hist.

x - sample(1:40, 1000, replace = TRUE)
hist(x, breaks = c(0:10, 40))

Is this what you intended?

--sundar
  

Maybe also take a look at the right argument.
I think this is closer to what Florian wanted in the first place :

R hist(x, breaks = c(0:10, 40), right=FALSE)


Romain

-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.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


[R] quasi-random vector according to an independent graph

2005-09-26 Thread Jinfang Wang
Dear R-users,

Is anyone aware of any function/package for generating a random vector from 
a joint distribution defined by an independent graph? Or I have to work it 
out myself?

Thanks.

Jinfang

--
Jinfang Wang, Associate Professor
Chiba University, Japan

__
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


Re: [R] k-d tree for loess

2005-09-26 Thread Prof Brian Ripley
First a warning: loess in R is only loosely related to loess in S, being 
derived from a C implementation (by the same authors).

In R I don't think you can do this.  Those details are never exposed, and 
are hidden in an undocumented C/Fortran workspace.

On Mon, 26 Sep 2005, Carlisle Thacker wrote:

 I am exploring the use of loess for oceanographic applications and would
 like to plot the locations (longitude and latitude) points where the models
 (salinity~temperature*longitude*latitude,parametric=temperature) are
 fitted.  Chambers and Hastie(1993) explains the locations are nodes of a
 k-d tree. but I cannot find anything about accessing this information.  It
 would be useful to superimpose on such plots contours of the weights for at
 least one point.  Sample code of drawing such plots would be greatly
 appreciated.

 Thanks,

 Carlisle Thacker

-- 
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


[R] ASA Stat. Computing and Stat. Graphics 2006 Student Paper competition

2005-09-26 Thread jose . pinheiro
The Statistical Computing and Statistical Graphics Sections of the ASA
are co-sponsoring a student paper competition on the topics of
Statistical Computing and Statistical Graphics.  Students are
encouraged to submit a paper in one of these areas, which might be
original methodological research, some novel computing or graphical
application in statistics, or any other suitable contribution (for
example, a software-related project).  The selected winners will
present their papers in a topic-contributed session at the 2006 Joint
Statistical Meetings.  The Sections will pay registration fees for the
winners as well as a substantial allowance for transportation to the
meetings and lodging. Enclosed below is the full text of the award 
announcement.
More details can be found at the Stat. Computing Section website at
http://www.statcomputing.org. 



Best Regards,

--José Pinheiro

Awards Chair
ASA Statistical Computing Section   Statistical Computing and Statistical Graphics Sections
   American Statistical Association
Student Paper Competition 2006

The Statistical Computing and Statistical Graphics Sections of the ASA
are co-sponsoring a student paper competition on the topics of
Statistical Computing and Statistical Graphics.  Students are
encouraged to submit a paper in one of these areas, which might be
original methodological research, some novel computing or graphical
application in statistics, or any other suitable contribution (for
example, a software-related project).  The selected winners will
present their papers in a topic-contributed session at the 2006 Joint
Statistical Meetings.  The Sections will pay registration fees for the
winners as well as a substantial allowance for transportation to the
meetings and lodging (which in most cases covers these expenses
completely).

Anyone who is a student (graduate or undergraduate) on or after
September 1, 2005 is eligible to participate.  An entry must include
an abstract, a six page manuscript (including figures, tables and
references), a C.V., and a letter from a faculty member familiar with
the student's work.  The applicant must be the first author of the
paper.  The faculty letter must include a verification of the
applicant's student status and, in the case of joint authorship,
should indicate what fraction of the contribution is attributable to
the applicant.  We prefer that electronic submissions of papers be in
Postscript or PDF.  All materials must be in English.

All application materials MUST BE RECEIVED by 5:00 PM EST, Monday,
December 19, 2005 at the address below.  They will be reviewed by the
Student Paper Competition Award committee of the Statistical Computing
and Graphics Sections.  The selection criteria used by the committee
will include innovation and significance of the contribution.  Award
announcements will be made in late January, 2006.

Additional important information on the competition can be accessed on
the website of the Statistical Computing Section,
www.statcomputing.org.  A current pointer to the website is available
from the ASA website at www.amstat.org. Inquiries and application
materials should be emailed or mailed to:

Student Paper Competition
c/o Dr. José Pinheiro 
Biostatistics, Novartis Pharmaceuticals 
One Health Plaza, Room 419/2115 
East Hanover, NJ 07936
[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

Re: [R] hist(x, ...) with normal distribution curve

2005-09-26 Thread Knut Krueger


Petr Pikal schrieb:

Hi

answered hundered times.

  

Dear R people: 

I would like to superimpose a normal curve on a histogram. 


x-rnorm(150) 
h-hist(x,breaks=15) 
xhist-c(min(h$breaks),h$breaks) 
yhist-c(0,h$density,0) 
xfit-seq(min(x),max(x),length=40) 
yfit-dnorm(xfit,mean=mean(x),sd=sd(x)) 
plot(xhist,yhist,type=s,ylim=c(0,max(yhist,yfit))) 
lines(xfit,yfit) 


Bill 

above is e.g. Bill Simpson's answer from 2001. Found from R-site 
search  ***histogram density normal***.
  

Ok If I merge both of your answers I get the graph like in SPSS but the ylab is 
density instead frequency:
and I do not have the clicks in SPSS to redo the same graph :-(
I hav only the Data file and the SPSS plot.


x-5+rnorm(150) 

h-hist(x,breaks=10,freq = TRUE) 
#I need this histogramm  with...

xfit-seq(min(x),max(x),length=40) 
yfit-dnorm(xfit,mean=mean(x),sd=sd(x)) 

lines(xfit,yfit) 



h-hist(x,breaks=10,prob=T) 

xfit-seq(min(x),max(x),length=40) 
yfit-dnorm(xfit,mean=mean(x),sd=sd(x)) 
# ... this line 
lines(xfit,yfit)


Thanks Knut


[[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


[R] Help: x11 position in the Unix environment

2005-09-26 Thread Shengzhe Wu
Hello,

In the Unix environment, I open a window by x11(). May I specify the
position of this window by specifying the position of the top left of
the window as in Windows environment? Or some other parameters can be
used to do that?

Thank you,
Shengzhe

__
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


Re: [R] regression methods for circular(?) data.

2005-09-26 Thread Ted Harding
On 26-Sep-05 nwew wrote:
 Dear R-users,
 
 I have the following data
 
 x - runif(300,min=1,max=230)
 
 y - x*0.005 + 0.2
 y - y+rnorm(100,mean=0,sd=0.1)
 y - y%%1 #  --- modulo operation
 plot(x,y)
 
 and would like to recapture the slope (0.005) and intercept(0.2).
 I wonder if there are any clever algorithms to do this. I was
 looking at the function lm.cirucalar. Is this the method to use?
 If, which of the references is best too look at?
 
 Eryk

Hi Eryk,

If you know the modulus (in your case 1.0) and you get data that
look like the result of your plot(x,y), then I wouldn't mess
about.

I would simply do something like

y1-y
ix - ix-(y  0.9*(x-50)/200)
y1[ix] - y1[ix]+1.0
lm(y1~x)

(the constants 0.9/200, -50 being chosen to give a good separation
on the graph).

On the other hand, if there are good reasons why this very simple
approach is not suitable, then if we knew what they were a more
helpful reply would be easier to formulate!

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 26-Sep-05   Time: 15:56:48
-- XFMail --

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


Re: [R] hist(x, ...) with normal distribution curve

2005-09-26 Thread Peter Dalgaard
Knut Krueger [EMAIL PROTECTED] writes:

 Petr Pikal schrieb:
 
 Hi
 
 answered hundered times.
 
   
 
 Dear R people: 
 
 I would like to superimpose a normal curve on a histogram. 
 
 
 x-rnorm(150) 
 h-hist(x,breaks=15) 
 xhist-c(min(h$breaks),h$breaks) 
 yhist-c(0,h$density,0) 
 xfit-seq(min(x),max(x),length=40) 
 yfit-dnorm(xfit,mean=mean(x),sd=sd(x)) 
 plot(xhist,yhist,type=s,ylim=c(0,max(yhist,yfit))) 
 lines(xfit,yfit) 
 
 
 Bill 
 
 above is e.g. Bill Simpson's answer from 2001. Found from R-site 
 search  ***histogram density normal***.
   
 
 Ok If I merge both of your answers I get the graph like in SPSS but
 the ylab is density instead frequency:

Many people consider that a feature, since histograms are supposed to
be density estimates

 and I do not have the clicks in SPSS to redo the same graph :-(
 I hav only the Data file and the SPSS plot.
 
 
 x-5+rnorm(150) 
 
 h-hist(x,breaks=10,freq = TRUE) 
 #I need this histogramm  with...
 
 xfit-seq(min(x),max(x),length=40) 
 yfit-dnorm(xfit,mean=mean(x),sd=sd(x)) 
 
 lines(xfit,yfit) 
 
 
 
 h-hist(x,breaks=10,prob=T) 
 
 xfit-seq(min(x),max(x),length=40) 
 yfit-dnorm(xfit,mean=mean(x),sd=sd(x)) 
 # ... this line 
 lines(xfit,yfit)


Er, something got duplicated in there? 

Anyways, if you want the normal curve blown up to the scale of
counts/bin, just multiply yfit by the number of observations times the
bin width.

To find the bin width take, e.g. diff(h$mids[1:2]). If they're not all
equal, then you're in deeper trouble.


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

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


Re: [R] hist(x, ...) with normal distribution curve

2005-09-26 Thread Romain Francois
Le 25.09.2005 17:30, Knut Krueger a écrit :

Petr Pikal schrieb:

  

Hi

answered hundered times.

 



Dear R people: 

I would like to superimpose a normal curve on a histogram. 
   

  

x-rnorm(150) 
h-hist(x,breaks=15) 
xhist-c(min(h$breaks),h$breaks) 
yhist-c(0,h$density,0) 
xfit-seq(min(x),max(x),length=40) 
yfit-dnorm(xfit,mean=mean(x),sd=sd(x)) 
plot(xhist,yhist,type=s,ylim=c(0,max(yhist,yfit))) 
lines(xfit,yfit) 


Bill 

above is e.g. Bill Simpson's answer from 2001. Found from R-site 
search  ***histogram density normal***.
 



Ok If I merge both of your answers I get the graph like in SPSS but the ylab 
is density instead frequency:
and I do not have the clicks in SPSS to redo the same graph :-(
I hav only the Data file and the SPSS plot.


x-5+rnorm(150) 

h-hist(x,breaks=10,freq = TRUE) 
#I need this histogramm  with...

xfit-seq(min(x),max(x),length=40) 
yfit-dnorm(xfit,mean=mean(x),sd=sd(x)) 

lines(xfit,yfit) 



h-hist(x,breaks=10,prob=T) 

xfit-seq(min(x),max(x),length=40) 
yfit-dnorm(xfit,mean=mean(x),sd=sd(x)) 
# ... this line 
lines(xfit,yfit)


Thanks Knut
  

Ok then.
what you are trying to do doesn't make any sense to me.
(( That does not make much sense (for me) to have the density curve on 
the same scale than frequencies ))
Do you want that :

x-5+rnorm(150) 
h-hist(x,breaks=10,freq = TRUE) 
xfit-seq(min(x),max(x),length=40) 
yfit-dnorm(xfit,mean=mean(x),sd=sd(x)) 

lines(xfit,yfit * 150 * (h$breaks[2]-h$breaks[1]))


?


-- 
visit the R Graph Gallery : http://addictedtor.free.fr/graphiques
 ~ 
~~  Romain FRANCOIS - http://addictedtor.free.fr ~~
Etudiant  ISUP - CS3 - Industrie et Services   
~~http://www.isup.cicrp.jussieu.fr/  ~~
   Stagiaire INRIA Futurs - Equipe SELECT  
~~   http://www.inria.fr/recherche/equipes/select.fr.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


Re: [R] regression methods for circular(?) data.

2005-09-26 Thread Witold Eryk Wolski

Hi,

I do not know the intercept and slope.
And you have to know them in order to do something like:
ix-(y  0.9*(x-50)/200

I am right?

cheers


(Ted Harding) wrote:

On 26-Sep-05 nwew wrote:


Dear R-users,

I have the following data

x - runif(300,min=1,max=230)

y - x*0.005 + 0.2
y - y+rnorm(100,mean=0,sd=0.1)
y - y%%1 #  --- modulo operation
plot(x,y)

and would like to recapture the slope (0.005) and intercept(0.2).
I wonder if there are any clever algorithms to do this. I was
looking at the function lm.cirucalar. Is this the method to use?
If, which of the references is best too look at?

Eryk



Hi Eryk,

If you know the modulus (in your case 1.0) and you get data that
look like the result of your plot(x,y), then I wouldn't mess
about.

I would simply do something like

y1-y
ix - ix-(y  0.9*(x-50)/200)
y1[ix] - y1[ix]+1.0
lm(y1~x)

(the constants 0.9/200, -50 being chosen to give a good separation
on the graph).

On the other hand, if there are good reasons why this very simple
approach is not suitable, then if we knew what they were a more
helpful reply would be easier to formulate!

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 26-Sep-05   Time: 15:56:48
-- XFMail --

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


__
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

Re: [R] Help: x11 position in the Unix environment

2005-09-26 Thread Marc Schwartz (via MN)
On Mon, 2005-09-26 at 17:45 +0200, Shengzhe Wu wrote:
 Hello,
 
 In the Unix environment, I open a window by x11(). May I specify the
 position of this window by specifying the position of the top left of
 the window as in Windows environment? Or some other parameters can be
 used to do that?
 
 Thank you,
 Shengzhe


I don't believe so. In general, under Unix/Linux, the Window Manager
determines window positioning upon startup unless the application
overrides this behavior. Some applications let you specify application
window positioning via command line 'geometry' arguments or via the use
of an .Xresources file. 

Some WM's provide more or less functionality for this behavior relative
to user customization. For example, Sawfish provides quite a bit,
whereas Metacity hides much of it.

You may want to check the documentation for the WM that you are using.

There is also an application called Devil's Pie:

  http://www.burtonini.com/blog/computers/devilspie

which provides additional Sawfish-like customization for window
positioning, etc. However, this is global for a given window, not on a
per instance basis.

HTH,

Marc Schwartz

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


[R] p-level in packages mgcv and gam

2005-09-26 Thread Denis Chabot
Hi,

I am fairly new to GAM and started using package mgcv. I like the  
fact that optimal smoothing is automatically used (i.e. df are not  
determined a priori but calculated by the gam procedure).

But the mgcv manual warns that p-level for the smooth can be  
underestimated when df are estimated by the model. Most of the time  
my p-levels are so small that even doubling them would not result in  
a value close to the P=0.05 threshold, but I have one case with P=0.033.

I thought, probably naively, that running a second model with fixed  
df, using the value of df found in the first model. I could not  
achieve this with mgcv: its gam function does not seem to accept  
fractional values of df (in my case 8.377).

So I used the gam package and fixed df to 8.377. The P-value I  
obtained was slightly larger than with mgcv (0.03655 instead of  
0.03328), but it is still  0.05.

Was this a correct way to get around the underestimated P-level?

Furthermore, although the gam.check function of the mgcv package  
suggests to me that the gaussian family (and identity link) are  
adequate for my data, I must say the instructions in R help for  
family and in Hastie, T. and Tibshirani, R. (1990) Generalized  
Additive Models are too technical for me. If someone knows a  
reference that explains how to choose model and link, i.e. what tests  
to run on your data before choosing, I would really appreciate it.

Thanks in advance,

Denis Chabot

__
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] hidden markov models

2005-09-26 Thread Dr. Emilio A. Laca
Dear R community,

I am looking for an R package or other software to study hidden  
Markov models. I need to be able to incorporate multivariate  
emissions and covariates for the transition probabilities. The msm  
package seems almost perfect for my purpose, but I do not think it  
allows multivariate emissions.

I will be grateful for your suggestions.

All the best,

-- 
Emilio A. Laca
One Shields Avenue, 2306 PES Bldg.
Plant Sciences   
[EMAIL PROTECTED]
University of Californiafax: (530)  
752-4361
Davis, California  95616 voice: (530) 754-4083

__
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


Re: [R] p-level in packages mgcv and gam

2005-09-26 Thread Thomas Lumley
On Mon, 26 Sep 2005, Denis Chabot wrote:

 But the mgcv manual warns that p-level for the smooth can be
 underestimated when df are estimated by the model. Most of the time
 my p-levels are so small that even doubling them would not result in
 a value close to the P=0.05 threshold, but I have one case with P=0.033.

 I thought, probably naively, that running a second model with fixed
 df, using the value of df found in the first model. I could not
 achieve this with mgcv: its gam function does not seem to accept
 fractional values of df (in my case 8.377).

No, this won't work.  The problem is the usual one with model selection: 
the p-value is calculated as if the df had been fixed, when really it was 
estimated.

It is likely to be quite hard to get an honest p-value out of something 
that does adaptive smoothing.

-thomas

__
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] reading SAS data files

2005-09-26 Thread Dean Sonneborn
I am attempting to read in a SAS 9.1 data file. After starting R I 
change to the directory containing the sas data file and use the dir 
command to confirm that it is there. Then I run the following R-code:

library(foreign)

sashome - /Program Files/SAS/SAS 9.1

test-read.ssd(file.path(sashome), pcb,

 sascmd = file.path(sashome, sas.exe))


but R responds with:

SAS failed.  SAS program at 
C:\DOCUME~1\DSONNE~1\LOCALS~1\Temp\Rtmp3540\file16169.sas 
The log file will be file16169.log in the current directory
Warning message:
SAS return code was 2 in: read.ssd(file.path(sashome), pcb, sascmd = 
file.path(sashome, 

 
the SAS log file contain this:

NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA. 
NOTE: SAS (r) 9.1 (TS1M3)
  Licensed to UNIV OF CA/DAVIS, Site 0029107010.
NOTE: This session is executing on the XP_PRO  platform.



NOTE: SAS initialization used:
  real time   0.13 seconds
  cpu time0.18 seconds
  
1  libname src2rd '/Program Files/SAS/SAS 9.1';
NOTE: Libref SRC2RD was successfully assigned as follows: 
  Engine:V9 
  Physical Name: C:\Program Files\SAS\SAS 9.1
2  libname rd xport 
'C:\DOCUME~1\DSONNE~1\LOCALS~1\Temp\Rtmp3540\file26090';
NOTE: Libref RD was successfully assigned as follows: 
  Engine:XPORT 
  Physical Name: C:\DOCUME~1\DSONNE~1\LOCALS~1\Temp\Rtmp3540\file26090
3  proc copy in=src2rd out=rd;
4  select pcb ;
ERROR: The file SRC2RD.PCB (memtype=ALL) was not found, but appears on a SELECT 
statement.
ERROR: The file SRC2RD.PCB (memtype=ALL) was not found, but appears on a SELECT 
statement.
ERROR: The file SRC2RD.PCB (memtype=ALL) was not found, but appears on a SELECT 
statement.
WARNING: Input library SRC2RD is empty.
NOTE: Statements not processed because of errors noted above.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE COPY used (Total process time):
  real time   0.00 seconds
  cpu time0.01 seconds
  

ERROR: Errors printed on page 1.
ERROR: Errors printed on page 1.
ERROR: Errors printed on page 1.

NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
NOTE: The SAS System used:
  real time   0.16 seconds
  cpu time0.20 seconds
  
Does anyone see what I am doing incorrectly and can they offer any suggestions 
about getting this to run correctly?
 I'm not sure where SAS is expecting to find the data file. I have it in the 
default R directory. Is this where
SAS is looking for it or does it need to be somewhere else?

Thanks,


-- 
Dean Sonneborn
Programmer Analyst
Department of Public Health Sciences
University of California, Davis
(916) 734-6656


[[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


Re: [R] Help: x11 position in the Unix environment

2005-09-26 Thread Barry Rowlingson
Marc Schwartz (via MN) wrote:

 
 I don't believe so. In general, under Unix/Linux, the Window Manager
 determines window positioning upon startup unless the application
 overrides this behavior. Some applications let you specify application
 window positioning via command line 'geometry' arguments or via the use
 of an .Xresources file. 
 

  Splus used to have extensive control of the graphics window via X 
resources - here's a chunk from an old Xresources file of mine:

splus*background:   blue
splus*Canvas.height:632
splus*Canvas.width: 800
splus*Command*background:   red
splus*Command*foreground:   cyan
splus*Label*background: cyan
splus*Label*foreground: red
splus*Text*background:  #a0f
splus*Text*foreground:  yellow
splus*colors:   white black white 54 black

  - and so on and so forth. Sadly I dont think such customisation is 
coded into R's X11 graphics window. Looking at the code there is no sign 
of it playing with X11's resource database. Shame.

Baz

__
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


Re: [R] [ESS] Indentation in R code

2005-09-26 Thread Göran Broström
On Mon, Sep 26, 2005 at 09:27:56AM +0200, Martin Maechler wrote:
 I'm crossposting to the ESS-help mailing list which is slightly
 more appropriate here.  [This may be a rare case where
 crossposting seems to make much sense.]
 
  PD == Peter Dalgaard [EMAIL PROTECTED]
  on 25 Sep 2005 19:40:45 +0200 writes:
 
 PD Seth Falcon [EMAIL PROTECTED] writes:
 
  On 24 Sep 2005, [EMAIL PROTECTED] wrote:
  
   I am using emacs-21.3 when writing R functions on Linux debian, and
   I am trying to follow the advice i R-exts.pdf (2.1.1) regarding
   indentation. That is, I set 'c-default-style' to bsd and
   'c-basic-offset' to 4. However, while this gives me the intended
   indentation in C code, it doesn't change the behavior in R code; I
   still get an indentation of size 2. This is my .emacs file after
   customization:
  
   (require 'ess-site)
   (custom-set-variables
;; custom-set-variables was added by Custom -- don't edit or
;; cut/paste it!  Your init file should contain only one such
;; instance.
'(c-basic-offset 4)
'(c-default-style bsd))
(custom-set-faces
;; custom-set-faces was added by Custom -- don't edit or cut/paste 
 it!
;; Your init file should contain only one such instance.
   )
  
  Not sure if this is the best way, but I have the following after
  loading ess-site:
  
  (setq ess-indent-level 4)
 
 
 
 PD I have (I believe it stems from Martin M. originally):
 
 yes, most probably  {IIRC, Kurt Hornik was involved too}.
 
 PD  (add-hook 'c-mode-hook '(lambda()
 PD  (c-set-style stroustrup)))
 
 the above is not quite what I have or did recommend, 
 which is rather  bsd + offset 4  as Göran has above
 
 In fact, Göran mentions the R-exts manual and that has
 the following  *before* giving the emacs-lisp statements:
 
  (For GNU Emacs 20: for GNU Emacs 21 use
  customization to set the `c-default-style' to `bsd' and
  `c-basic-offset' to `4'.)
 
 and indeed, that's what Göran did and you should do with a
 current emacs, either customize via GUI or,
 in your ~/.emacs file, find the section '(custom-set-variables ...)' and add 
  '(c-basic-offset 4)
  '(c-default-style bsd)
 
 to the lines already there, or if there's no such section, add
 
 (custom-set-variables
   ;; custom-set-variables was added by Custom -- don't edit or cut/paste it!
   ;; Your init file should contain only one such instance.
  '(c-basic-offset 4)
  '(c-default-style bsd)
 )
 to the end of your ~/.emacs file
[...]

but this is not sufficient to get correct (4) indentation (ess) in R 
functions. We need some reference to ess as well, right? Maybe another
reference to the ESS manual is in order in 'R-exts'?

Thanks for all the help. I got it working now.

Göran

__
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


Re: [R] anova on binomial LMER objects

2005-09-26 Thread Martin Henry H. Stevens
Hello all,
1. Does Matrix 0.98-7 fix any of this?
2. Assuming no, how does one acquire Matrix 0.95-13?
Cheers, and thank you kindly in advance,
Hank

On Sep 26, 2005, at 9:05 AM, Douglas Bates wrote:

 On 9/25/05, Horacio Montenegro [EMAIL PROTECTED] wrote:


 Hi Spencer and Robert,

 I have found the same behaviour, but only for lme4
 and Matrix after the 0.96 release. lme4 0.95-10 and
 Matrix 0.95-13 releases gave sensible results. This
 could be an introduced bug, or a solved bug - you
 should ask Prof. Bates.

 hope this helps, cheers,

 Horacio Montenegro


 I have run into a couple of other things that the improvements from
 the 0.95 series to the 0.96 series has made worse.  This may take a
 while to sort out.  Thanks to Robert Bagchi for the very thorough
 error report.




 --- Spencer Graves [EMAIL PROTECTED] wrote:

 I agree:  Something looks strange to me in this
 example also;  I have
 therefore copied Douglas Bates and  Deepayan Sarkar.
  You've provided a
 nice simulation.  If either of them have time to
 look at this, I think
 they could tell us what is happening here.

 If you need an answer to your particular problem,
 you could run that
 simulation 1000 or 1,000 times.  That would tell you
 whether to believe
 the summary or the anova, or neither.  If you want
 to understand the
 algorithm, you could walk through the code.
 However, lmer is a
 generic, and I don't have time now to figure out how
 to find the source.
   A response from Brian Ripley to a question from me
 a couple of days
 ago provides a nice summary of how to do that, but I
 don't have time to
 check that now.

 Sorry I couldn't help more.
 spencer graves

 Robert Bagchi wrote:


 Dear R users,

 I have been having problems getting believable

 estimates from anova on a

 model fit from lmer. I get the impression that F

 is being greatly

 underestimated, as can be seen by running the

 example I have given below.


 First an explanation of what I'm trying to do. I

 am trying to fit a glmm

 with binomial errors to some data. The experiment

 involves 10

 shadehouses, divided between 2 light treatments

 (high, low). Within each

 shadehouse there are 12 seedlings of each of 2

 species (hn  sl). 3

 damage treatments (0, 0.1, 0.25 leaf area removal)

 were applied to the

 seedlings (at random) so that there are 4

 seedlings of each

 species*damage treatment in each shadehouse.

 There maybe a shadehouse

 effect, so I need to include it as a random

 effect. Light is applied to

 a shadehouse, so it is outer to shadehouse. The

 other 2 factors are

 inner to shadehouse.

 We want to assess if light, damage and species

 affect survival of

 seedlings. To test this I fitted a binomial mixed

 effects model with

 lmer (actually with quasibinomial errors). THe

 summary function suggests

 a large effect of both light and species (which

 agrees with graphical

 analysis). However, anova produces F values close

 to 0 and p values

 close to 1 (see example below).

 Is this a bug, or am I doing something

 fundamentally wrong? If anova

 doesn't work with lmer is there a way to perform

 hypothesis tests on

 fixed effects in an lmer model? I was going to

 just delete terms and

 then do liklihood ratio tests, but according to

 Pinheiro  Bates (p. 87)

 that's very untrustworthy. Any suggestions?

 I'm using R 2.1.1 on windows XP and lme4 0.98-1

 Any help will be much appreciated.

 many thanks
 Robert




 __
 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


__
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


Re: [R] hist(x, ...) with normal distribution curve

2005-09-26 Thread Knut Krueger


Romain Francois schrieb:

Do you want that :

h-hist(x,breaks=10,freq = TRUE) 
xfit-seq(min(x),max(x),length=40) 
yfit-dnorm(xfit,mean=mean(x),sd=sd(x)) 

lines(xfit,yfit * 150 * (h$breaks[2]-h$breaks[1]))


  

Right thats what I want ... but does it make sense to fit the line with 
a try and error multipier (150)

Is there no way to compute the frequency and the distribution line with 
standardised function?
I used SPSS with the data from x-5+rnorm(150)
Hit the graph-histogramm menue choosed: display normal curve and got the 
result:
http://biostatistic.de/temp/spss1.jpg - just as easy as possible

So, they have any standardised function.
maybe it does not make sence, but i am not able to see why there is such 
a esay to use function in SPSS but not in R
Maybe anybody is able to explane whiy


and my intention:
As a previous computer scientist I am trying to find a way to eleminate 
SPSS an use R
Sure there is a big lack of my statistic knowledge - but the often the 
SPSS user have similar lack  but it is easy to click and view instead to 
try the similar steps in R
But if I am not able to find the steps in R for the common .. 
SPSS-clicks , I will never be able to suggest R in the institute to 
the people with mor statistical knowledge but no knowledge about 
computer science ... and command line interpreter

Regards Knut




-- 
Viele Grüße
Knut Krüger
-- 

  Reitpark Einthal

Leitung: 1 Tierarzt, 1 Berufsreiter 
 Homepage http://www.einthal.de

Eine fachgerechte Betreuung rund um die Uhr.

__
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


Re: [R] regression methods for circular(?) data.

2005-09-26 Thread Ted Harding
On 26-Sep-05 Witold Eryk Wolski wrote:
 Hi,
 
 I do not know the intercept and slope.
 And you have to know them in order to do something like:
 ix-(y  0.9*(x-50)/200
 
 I am right?
 
 cheers

Although I really knew them from the way you generated the data,
I pretended I did not know them.

Read below: If you know the modulus (in your case 1.0) -- I did
assume that this was known, i.e. that the data wrap round to 0
above 1.0. Also: the constants 0.9/200, -50 being chosen to give
a good separation on the graph -- I plotted the data, and saw that
the wrapped data were well separated, and that 0.9*(x-50)/200
was an adequate discriminant function. This was estimated purely by
eye, by looking at the graph, to find some line that went between
the two groups of data; no attempt was made to calculate anything
precisely. Apart from assuming that the modulus was 1.0, and that
the well-separated data at the bottom right of the graph were
wrapped round data, no other information was used by me!

So the question remains: If you can assume that the modulus is 1.0,
and that the wrapped-round data will be well separated, then all
is simple. All you need to do is to unwrap the wrapped data
by adding 1.0, having first identified them by virtue of their
obvious separation. Then you can estimate the slope by using 'lm'.

But:-- if you, Witold, can not assume these two things for your
real data, what can we assume in considering your question?
Is the modulus unknown, for instance? Is the scatter so large that
the groups are not well separated? Might we have twice-wrapped
data (i.e. original y  2)? 

In short, do your real data look like the data you sent us, and
are they wrapped at 1.0? or what?

With thanks, and best wishes,
Ted.

 (Ted Harding) wrote:
 On 26-Sep-05 nwew wrote:
 
Dear R-users,

I have the following data

x - runif(300,min=1,max=230)

y - x*0.005 + 0.2
y - y+rnorm(100,mean=0,sd=0.1)
y - y%%1 #  --- modulo operation
plot(x,y)

and would like to recapture the slope (0.005) and intercept(0.2).
I wonder if there are any clever algorithms to do this. I was
looking at the function lm.cirucalar. Is this the method to use?
If, which of the references is best too look at?

Eryk
 
 
 Hi Eryk,
 
 If you know the modulus (in your case 1.0) and you get data that
 look like the result of your plot(x,y), then I wouldn't mess
 about.
 
 I would simply do something like
 
 y1-y
 ix - ix-(y  0.9*(x-50)/200)
 y1[ix] - y1[ix]+1.0
 lm(y1~x)
 
 (the constants 0.9/200, -50 being chosen to give a good separation
 on the graph).
 
 On the other hand, if there are good reasons why this very simple
 approach is not suitable, then if we knew what they were a more
 helpful reply would be easier to formulate!
 
 Best wishes,
 Ted.
 
 
 
 E-Mail: (Ted Harding) [EMAIL PROTECTED]
 Fax-to-email: +44 (0)870 094 0861
 Date: 26-Sep-05   Time: 15:56:48
 -- XFMail --
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 
 


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 26-Sep-05   Time: 18:08:28
-- XFMail --

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


Re: [R] anova on binomial LMER objects

2005-09-26 Thread Prof Brian Ripley
On Mon, 26 Sep 2005, Martin Henry H. Stevens wrote:

 Hello all,
 1. Does Matrix 0.98-7 fix any of this?
 2. Assuming no, how does one acquire Matrix 0.95-13?

It is in the Archive on CRAN, e.g.

http://cran.r-project.org/src/contrib/Archive/M/Matrix_0.95-13.tar.gz

 Cheers, and thank you kindly in advance,
 Hank

 On Sep 26, 2005, at 9:05 AM, Douglas Bates wrote:

 On 9/25/05, Horacio Montenegro [EMAIL PROTECTED] wrote:


 Hi Spencer and Robert,

 I have found the same behaviour, but only for lme4
 and Matrix after the 0.96 release. lme4 0.95-10 and
 Matrix 0.95-13 releases gave sensible results. This
 could be an introduced bug, or a solved bug - you
 should ask Prof. Bates.

 hope this helps, cheers,

 Horacio Montenegro


 I have run into a couple of other things that the improvements from
 the 0.95 series to the 0.96 series has made worse.  This may take a
 while to sort out.  Thanks to Robert Bagchi for the very thorough
 error report.




 --- Spencer Graves [EMAIL PROTECTED] wrote:

 I agree:  Something looks strange to me in this
 example also;  I have
 therefore copied Douglas Bates and  Deepayan Sarkar.
  You've provided a
 nice simulation.  If either of them have time to
 look at this, I think
 they could tell us what is happening here.

 If you need an answer to your particular problem,
 you could run that
 simulation 1000 or 1,000 times.  That would tell you
 whether to believe
 the summary or the anova, or neither.  If you want
 to understand the
 algorithm, you could walk through the code.
 However, lmer is a
 generic, and I don't have time now to figure out how
 to find the source.
   A response from Brian Ripley to a question from me
 a couple of days
 ago provides a nice summary of how to do that, but I
 don't have time to
 check that now.

 Sorry I couldn't help more.
 spencer graves

 Robert Bagchi wrote:


 Dear R users,

 I have been having problems getting believable

 estimates from anova on a

 model fit from lmer. I get the impression that F

 is being greatly

 underestimated, as can be seen by running the

 example I have given below.


 First an explanation of what I'm trying to do. I

 am trying to fit a glmm

 with binomial errors to some data. The experiment

 involves 10

 shadehouses, divided between 2 light treatments

 (high, low). Within each

 shadehouse there are 12 seedlings of each of 2

 species (hn  sl). 3

 damage treatments (0, 0.1, 0.25 leaf area removal)

 were applied to the

 seedlings (at random) so that there are 4

 seedlings of each

 species*damage treatment in each shadehouse.

 There maybe a shadehouse

 effect, so I need to include it as a random

 effect. Light is applied to

 a shadehouse, so it is outer to shadehouse. The

 other 2 factors are

 inner to shadehouse.

 We want to assess if light, damage and species

 affect survival of

 seedlings. To test this I fitted a binomial mixed

 effects model with

 lmer (actually with quasibinomial errors). THe

 summary function suggests

 a large effect of both light and species (which

 agrees with graphical

 analysis). However, anova produces F values close

 to 0 and p values

 close to 1 (see example below).

 Is this a bug, or am I doing something

 fundamentally wrong? If anova

 doesn't work with lmer is there a way to perform

 hypothesis tests on

 fixed effects in an lmer model? I was going to

 just delete terms and

 then do liklihood ratio tests, but according to

 Pinheiro  Bates (p. 87)

 that's very untrustworthy. Any suggestions?

 I'm using R 2.1.1 on windows XP and lme4 0.98-1

 Any help will be much appreciated.

 many thanks
 Robert




 __
 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


 __
 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


-- 
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


Re: [R] regression methods for circular(?) data.

2005-09-26 Thread Witold Eryk Wolski

Ted,

I agree with you that if you unwrap the data you can use lm.
And you can separate the data in the way you describe. However, if you 
have thousands of such datasets I do not want to do it by looking at 
the graph.


Yes the scatter may be larger as in the example and range(y) may be 
larger than 2.


And as you said in order to unwrap the data you have to separate them 
first. It would be easy to do it using for example single linkage 
clustering if they were no overlaps (but they do sometimes). So I were 
just wondering if there are no more fancy methods to do this.


Thanks,

cheers



(Ted Harding) wrote:

On 26-Sep-05 Witold Eryk Wolski wrote:


Hi,

I do not know the intercept and slope.
And you have to know them in order to do something like:
ix-(y  0.9*(x-50)/200

I am right?

cheers



Although I really knew them from the way you generated the data,
I pretended I did not know them.

Read below: If you know the modulus (in your case 1.0) -- I did
assume that this was known, i.e. that the data wrap round to 0
above 1.0. Also: the constants 0.9/200, -50 being chosen to give
a good separation on the graph -- I plotted the data, and saw that
the wrapped data were well separated, and that 0.9*(x-50)/200
was an adequate discriminant function. This was estimated purely by
eye, by looking at the graph, to find some line that went between
the two groups of data; no attempt was made to calculate anything
precisely. Apart from assuming that the modulus was 1.0, and that
the well-separated data at the bottom right of the graph were
wrapped round data, no other information was used by me!

So the question remains: If you can assume that the modulus is 1.0,
and that the wrapped-round data will be well separated, then all
is simple. All you need to do is to unwrap the wrapped data
by adding 1.0, having first identified them by virtue of their
obvious separation. Then you can estimate the slope by using 'lm'.

But:-- if you, Witold, can not assume these two things for your
real data, what can we assume in considering your question?
Is the modulus unknown, for instance? Is the scatter so large that
the groups are not well separated? Might we have twice-wrapped
data (i.e. original y  2)? 


In short, do your real data look like the data you sent us, and
are they wrapped at 1.0? or what?

With thanks, and best wishes,
Ted.



(Ted Harding) wrote:


On 26-Sep-05 nwew wrote:



Dear R-users,

I have the following data

x - runif(300,min=1,max=230)

y - x*0.005 + 0.2
y - y+rnorm(100,mean=0,sd=0.1)
y - y%%1 #  --- modulo operation
plot(x,y)

and would like to recapture the slope (0.005) and intercept(0.2).
I wonder if there are any clever algorithms to do this. I was
looking at the function lm.cirucalar. Is this the method to use?
If, which of the references is best too look at?

Eryk



Hi Eryk,

If you know the modulus (in your case 1.0) and you get data that
look like the result of your plot(x,y), then I wouldn't mess
about.

I would simply do something like

y1-y
ix - ix-(y  0.9*(x-50)/200)
y1[ix] - y1[ix]+1.0
lm(y1~x)

(the constants 0.9/200, -50 being chosen to give a good separation
on the graph).

On the other hand, if there are good reasons why this very simple
approach is not suitable, then if we knew what they were a more
helpful reply would be easier to formulate!

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 26-Sep-05   Time: 15:56:48
-- XFMail --

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






E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 26-Sep-05   Time: 18:08:28
-- XFMail --


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

Re: [R] reading SAS data files

2005-09-26 Thread Prof Brian Ripley
On Mon, 26 Sep 2005, Dean Sonneborn wrote:

 I am attempting to read in a SAS 9.1 data file. After starting R I
 change to the directory containing the sas data file and use the dir
 command to confirm that it is there. Then I run the following R-code:

 library(foreign)

 sashome - /Program Files/SAS/SAS 9.1

 test-read.ssd(file.path(sashome), pcb,

 sascmd = file.path(sashome, sas.exe))


   but R responds with:

 SAS failed.  SAS program at 
 C:\DOCUME~1\DSONNE~1\LOCALS~1\Temp\Rtmp3540\file16169.sas
 The log file will be file16169.log in the current directory
 Warning message:
 SAS return code was 2 in: read.ssd(file.path(sashome), pcb, sascmd = 
 file.path(sashome,


   the SAS log file contain this:

 NOTE: Copyright (c) 2002-2003 by SAS Institute Inc., Cary, NC, USA.
 NOTE: SAS (r) 9.1 (TS1M3)
  Licensed to UNIV OF CA/DAVIS, Site 0029107010.
 NOTE: This session is executing on the XP_PRO  platform.



 NOTE: SAS initialization used:
  real time   0.13 seconds
  cpu time0.18 seconds

 1  libname src2rd '/Program Files/SAS/SAS 9.1';
 NOTE: Libref SRC2RD was successfully assigned as follows:
  Engine:V9
  Physical Name: C:\Program Files\SAS\SAS 9.1
 2  libname rd xport 
 'C:\DOCUME~1\DSONNE~1\LOCALS~1\Temp\Rtmp3540\file26090';
 NOTE: Libref RD was successfully assigned as follows:
  Engine:XPORT
  Physical Name: C:\DOCUME~1\DSONNE~1\LOCALS~1\Temp\Rtmp3540\file26090
 3  proc copy in=src2rd out=rd;
 4  select pcb ;
 ERROR: The file SRC2RD.PCB (memtype=ALL) was not found, but appears on a 
 SELECT statement.
 ERROR: The file SRC2RD.PCB (memtype=ALL) was not found, but appears on a 
 SELECT statement.
 ERROR: The file SRC2RD.PCB (memtype=ALL) was not found, but appears on a 
 SELECT statement.
 WARNING: Input library SRC2RD is empty.
 NOTE: Statements not processed because of errors noted above.
 NOTE: The SAS System stopped processing this step because of errors.
 NOTE: PROCEDURE COPY used (Total process time):
  real time   0.00 seconds
  cpu time0.01 seconds


 ERROR: Errors printed on page 1.
 ERROR: Errors printed on page 1.
 ERROR: Errors printed on page 1.

 NOTE: SAS Institute Inc., SAS Campus Drive, Cary, NC USA 27513-2414
 NOTE: The SAS System used:
  real time   0.16 seconds
  cpu time0.20 seconds

 Does anyone see what I am doing incorrectly and can they offer any 
 suggestions about getting this to run correctly? I'm not sure where SAS 
 is expecting to find the data file. I have it in the default R 
 directory. Is this where SAS is looking for it or does it need to be 
 somewhere else?

I suggest you read the help file for read.ssd.  You are not telling it 
where the SAS files are correctly.  See the extracts below and the 
examples.

Usage:

  read.ssd(libname, sectionnames,
 tmpXport=tempfile(), tmpProgLoc=tempfile(), sascmd=sas)

Arguments:

  libname: character string defining the SAS library (usually a
   directory reference)

sectionnames: character vector giving member names. These are files in
   the 'libname' directory. They will usually have a '.ssd0x' or
   '.sas7bdat' extension, which should be omitted.

The files are not in the SAS homne directory, but the `default R 
directory' (perhaps you mean the working directory?).


 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

PLEASE do!

-- 
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


Re: [R] regression methods for circular(?) data.

2005-09-26 Thread Ted Harding
On 26-Sep-05 Witold Eryk Wolski wrote:
 Ted,
 
 I agree with you that if you unwrap the data you can use lm.
 And you can separate the data in the way you describe. However, if you 
 have thousands of such datasets I do not want to do it by looking at 
 the graph.
 
 Yes the scatter may be larger as in the example and range(y) may be 
 larger than 2.
 
 And as you said in order to unwrap the data you have to separate them 
 first. It would be easy to do it using for example single linkage 
 clustering if they were no overlaps (but they do sometimes). So I were 
 just wondering if there are no more fancy methods to do this.

OK, the problems are now clearer! So we cannot rely on separation
(though there would be ways to detect this automatically if it could
be relied on).

This is where real experts on unwrapping circular data should step in,
but my immediate suggestion would be that developing something out
of the following should be useful.

First, generate the data so that we have something to work with:

  x - runif(300,min=1,max=230)
  y - x*0.005 + 0.2
  y - y+rnorm(100,mean=0,sd=0.1)
  y0 - y%%1 #  --- modulo operation

(I've called the wrapped data y0).

Now, assume

A. That we know the modulus is 1.0

B. That we are looking for a model y0 = (a*x + b)%%1.0

C. The we do have some idea about a range of values for a and b,
   say 0  a  0.01 and 0  b  1.0

Now try the following and inspect what you get:

  M-numeric(101)

  for(i in (0:100)){v-(i*0.01/100);
M[i+1]-max(Mod(fft((y0-v*x-0.0)%%1)*2*pi))
  }
  plot(0.01*(0:100)/100,M,ylim=c(0,1000))

  for(j in 0.5*(0:10)/10){
for(i in (0:100)){
  v-(i*0.01/100);
  M[i+1]-max(Mod(fft((y0-v*x-j)%%1)*2*pi))
}
points(0.01*(0:100)/100,M)
  }

This gives an indication that a good value for 'a' ('i' in the
plots) is about 0.5 (or slightly larger) for some value of 'b'
('j' in the plots), from which, conditioning on this, a value
for b could be obtained similarly. The plots from the above do
not distinguish between the curves for different values of 'b';
a method of indicating this would be useful.

Just a suggestion. There may be, in some R package, a function
which implements this approach in a better way.

Over to the gurus at this point!

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 26-Sep-05   Time: 20:54:50
-- XFMail --

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


Re: [R] hidden markov models

2005-09-26 Thread Ingmar Visser
Emilio,
The depmix package on cran has multivariate distributions and the
possibility of (linear) covariates on the parameters.
If you have questions about its use feel free to contact me,
best, ingmar visser


On 9/26/05 6:29 PM, Dr. Emilio A. Laca [EMAIL PROTECTED] wrote:

 Dear R community,
 
 I am looking for an R package or other software to study hidden
 Markov models. I need to be able to incorporate multivariate
 emissions and covariates for the transition probabilities. The msm
 package seems almost perfect for my purpose, but I do not think it
 allows multivariate emissions.
 
 I will be grateful for your suggestions.
 
 All the best,

-- 
Ingmar Visser
Department of Psychology, University of Amsterdam
Roetersstraat 15, 1018 WB Amsterdam
The Netherlands
http://users.fmg.uva.nl/ivisser/
tel: +31-20-5256735

__
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


Re: [R] histogram - one bin for all values larger than a certain value

2005-09-26 Thread Francisco J. Zagmutt
x=runif(100,0,40)
hist(x, breaks=c(0,1,2,3,4,5,6,7,8,9,10,40))

Is this what you had in mind?

Francisco

From: Florian Defregger [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject: [R] histogram - one bin for all values larger than a certain value
Date: Mon, 26 Sep 2005 15:36:21 +0200

Dear all,
I wonder if I can put together a histogram where one bin contains all the
values that are larger than a certain specified value.

Example:
I have values ranging from 0 to 40 and I want 10 bins from 0 to 10, i.e. 
for
the intervals [0,1), [1,2) , ..., [9,10). And then I want one last bin 
which
contains all the values larger than 10, i.e. for the interval [10, 40).

Thanks,
Florian

__
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


[R] Make check fails on d-p-q-r-tests.R...

2005-09-26 Thread Jeff Ross
Hi,

R-2.1.1
OS:  OpenBSD-current (3.8) on i386
Compiler:gcc version 3.3.5 (propolice)
Thread model: single

configure \
  --with-readline \
  --with-tcltk \
  --with-tcl-config=/usr/local/lib/tcl8.4/tclConfig.sh \
  --with-tk-config=/usr/local/lib/tk8.4/tkConfig.sh \
  --with-libpng \
  --with-jpeglib \
  --with-zlib \
  --with-bzlib \
  --with-pcre \
  --with-libiconv-prefix=/usr/local/


I'm brand new to R so I don't know how critical this error is.

Here's the last bit what make check FORCE=FORCE outputs:

running code in 'grDevices-Ex.R' ... OK
comparing 'grDevices-Ex.Rout' to 'grDevices-Ex.Rout.prev' ... OK
running code in 'graphics-Ex.R' ... OK
comparing 'graphics-Ex.Rout' to 'graphics-Ex.Rout.prev' ... OK
running code in 'stats-Ex.R' ... OK
comparing 'stats-Ex.Rout' to 'stats-Ex.Rout.prev' ... OK
running code in 'datasets-Ex.R' ... OK
comparing 'datasets-Ex.Rout' to 'datasets-Ex.Rout.prev' ... OK
running code in 'methods-Ex.R' ... OK
comparing 'methods-Ex.Rout' to 'methods-Ex.Rout.prev' ... OK
running code in 'grid-Ex.R' ... OK
comparing 'grid-Ex.Rout' to 'grid-Ex.Rout.prev' ... OK
running code in 'splines-Ex.R' ... OK
comparing 'splines-Ex.Rout' to 'splines-Ex.Rout.prev' ... OK
running code in 'stats4-Ex.R' ... OK
comparing 'stats4-Ex.Rout' to 'stats4-Ex.Rout.prev' ... OK
running code in 'tcltk-Ex.R' ... OK
comparing 'tcltk-Ex.Rout' to 'tcltk-Ex.Rout.prev' ... OK
updating test dependencies
`Makedeps' is up to date.
running strict specific tests
running code in 'eval-etc.R' ... OK
comparing 'eval-etc.Rout' to './eval-etc.Rout.save' ... OK
running code in 'simple-true.R' ... OK
comparing 'simple-true.Rout' to './simple-true.Rout.save' ... OK
running code in 'arith-true.R' ... OK
comparing 'arith-true.Rout' to './arith-true.Rout.save' ... OK
running code in 'arith.R' ... OK
comparing 'arith.Rout' to './arith.Rout.save' ... OK
running code in 'lm-tests.R' ... OK
comparing 'lm-tests.Rout' to './lm-tests.Rout.save' ... OK
running code in 'primitive-funs.R' ... OK
comparing 'primitive-funs.Rout' to './primitive-funs.Rout.save' ... OK
running code in 'ok-errors.R' ... OK
comparing 'ok-errors.Rout' to './ok-errors.Rout.save' ... OK
running code in 'method-dispatch.R' ... OK
comparing 'method-dispatch.Rout' to './method-dispatch.Rout.save' ... OK
running code in 'd-p-q-r-tests.R' ...*** Error code 1
Stop in /usr/local/src/R-2.1.1/tests.
*** Error code 1

Stop in /usr/local/src/R-2.1.1/tests (line 206 of Makefile).
*** Error code 1

Stop in /usr/local/src/R-2.1.1/tests (line 191 of Makefile).


Tried finding this error in the archives to no avail.  If it is okay to
ignore this error, how can I skip this test?

Thanks for any input!

Jeff Ross

__
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] plotting multiple plots on a single graph

2005-09-26 Thread C Tate

__
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


Re: [R] less precision, please!

2005-09-26 Thread Paul MacManus
 
 Duncan On 9/9/2005 7:41 PM, Paul MacManus wrote:
  I need to run qbeta on a set of 500K different parameter
  pairs (with a fixed quantile). For most pairs qbeta finds
  the solution very quickly but for a substantial minority
  of the cases qbeta is very slow. This occurs when the
  solution is very close to zero. qbeta is getting answers
  to a precision of about 16 decimal places. I don't need
  that accuracy. Is there any way to set the precision of
  R's calculations to, say, 9 decimal places and so speed
  up the whole process?
  
  I could, of course, avoid this problem by not running
  qbeta when I know the solution is going to be
  sufficiently small but I'm more interested in ways to
  adjust the precision of calculations in R.
 
 Duncan There's no general way to do this.  The function
 Duncan that implements qbeta may have some tuning
 Duncan parameters (I haven't looked), but they aren't
 Duncan usually needed, and aren't exposed in R.
 
 Yes.
 
 However, I've had thoughts in the past on possibly providing such
 a possibility from both R and C level.  One problem is that
 ``for symmetry reasons'' you would want to have this ``for all functions'' 
 which would need a lot of work, for something that's really not
 of too high a need.   
 I agree that qbeta() can be particularly nasty.  I'm open to
 more in-depth discussion on this -- after R 2.2.0 is out
 
 Duncan If you want a quick approximation, I'd suggest doing
 Duncan your calculation on a grid of values and using
 Duncan approx() to interpolate.
 
 yes, or approxfun() {which prefer for its UI},
 or even more smoothly  using  spline() or splinefun() {again
 preferably the latter}.
 
 One problem may be that these are only for 1-D interpolation and
 qbeta() depends on three principal arguments.
 Package 'akima' provides somewhat smooth 2-D interpolation.
 


Hi again,

  Thank you both for your feedback and my apologies for not replying 
sooner. 

Tunable parameters would be nice to have but they are probably not really 
necessary. Workarounds of one type or another, such as the ones you suggested, 
always seem to be available. 

The qbeta issue, specifically, is more interesting. The surfaces associated 
with beta and inverse beta functions are notoriously badly behaved and 
developing functions that deal in a good way with the full range of parameters 
is very tricky. qbeta() does a very good job in general but it is not 
surprising that it has trouble at times. The underlying algorithms that qbeta() 
uses seems to be good. I would be interested in talking more about the qbeta 
issue  when you have more time.

  Best, Paul

__
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] questions about boxplots

2005-09-26 Thread Yulei He
Hi, there.

I have two questions about using R to create boxplots.

1. The function boxplot() plots the outliers. How can I label the exact 
values arount these outlier points? Does R have an option allow me to 
do that?

2. How can I put two boxplots in one x-y axis?

Thanks.

Yulei


$$$
Yulei He
276 Grove St. Apt 3
Newton, MA 02466
617-796-7834(H)
617-432-3428(O)
617-432-3435(fax)
$$

__
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] dates are shown as X15.Feb.03

2005-09-26 Thread Chris Buddenhagen
Why is R recognizing dates like this?

 

Chris Buddenhagen, Botany Department, Charles Darwin Research Station, Santa
Cruz,Galapagos. Mail: Charles Darwin Foundation, Casilla 17-01-3891 Avenida
6 de Diciembre N36-109 y Pasaje California Quito, ECUADOR

 





__
EL CONTENIDO DE ESTE MENSAJE ES DE ABSOLUTA RESPONSABILIDAD DEL AUTOR.
FUNDACION CHARLES DARWIN
WWW.DARWINFOUNDATION.ORG
[[alternative HTML version deleted]]

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


Re: [R] Error Message - Error: symbol print-name too long

2005-09-26 Thread Carl Anderson
Duncan,

Thank you for your help. I am pleased to say your 'very wild guess' was 
exactly correct. Can't believe I missed it!

Carl
- Original Message - 
From: Duncan Temple Lang [EMAIL PROTECTED]
To: Carl Anderson [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch; [EMAIL PROTECTED]
Sent: Tuesday, September 27, 2005 12:31 AM
Subject: Re: [R] Error Message - Error: symbol print-name too long


 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1



 You aren't giving us much to go on, so I can only
 make a very wild guess.  Check that your file
 doesn't have a stray ` character in it.
 R will start reading from that point on and try
 to make this an internal symbol.  If it doesn't
 find the closing ` for too many characters,
 it gives the error message you see.

 I have seen this once before and that is what the cause
 was - a stray ` put in by hitting the ` key rather than Esc.



 Carl Anderson wrote:
 Dear All,

 I write to ask for information regarding the error message:

 Error: symbol print-name too long.

 I am afraid that I can't include any code to help with any further 
 diagnosis
 of the problem as the code is far too long to be of any use, and I have 
 not
 been able to re-create the problem in shorter example codes.

 I have searched the R manual and help pages and found no mention of this
 error message.

 All help appreciated,

 Carl A Anderson.

 __
 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

 - --
 Duncan Temple Lang[EMAIL PROTECTED]
 Department of Statistics  work:  (530) 752-4782
 371 Kerr Hall fax:   (530) 752-7099
 One Shields Ave.
 University of California at Davis
 Davis, CA 95616, USA
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.2 (Darwin)
 Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

 iD8DBQFDOAYs9p/Jzwa2QP4RAhtAAJ97sqWdUTOPjtZ2RMJR0qcfyjIAZgCfZLF1
 IXTk0bY5RQUD2e+8VlzLpw4=
 =+pim
 -END PGP SIGNATURE-


__
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


Re: [R] dates are shown as X15.Feb.03

2005-09-26 Thread Duncan Murdoch
Chris Buddenhagen wrote:
 Why is R recognizing dates like this?

Recognizing and showing are different things.  Which are you complaining 
about?  What are you doing to cause these to be recognized/shown?

Duncan Murdoch

__
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


Re: [R] questions about boxplots

2005-09-26 Thread Stephen D. Weigand
Dear Yulei,

On Sep 26, 2005, at 6:56 PM, Yulei He wrote:

 Hi, there.

 I have two questions about using R to create boxplots.

 1. The function boxplot() plots the outliers. How can I label the exact
 values arount these outlier points? Does R have an option allow me to
 do that?

You can use identify(). Here's a toy example

set.seed(1)
y - rt(30, 3)
boxplot(y)
identify(x = rep(1,30), y = y, label = format(y, digits = 2))
### now click on the outlier in the plot and you should see -7.398
### beside the outlier

 2. How can I put two boxplots in one x-y axis?

x - rnorm(10)
y - rnorm(20, 3, 5)
z - runif(30)

boxplot(x, y, z, labels = c(x, y, z))
### - or -
boxplot(list(x = x, y = y, z = z))


 Thanks.

 Yulei


Stephen Weigand
Rochester, Minnesota, USA

__
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


Re: [R] figure widths in sweave

2005-09-26 Thread John Charles Considine
On Mon, 2005-09-26 at 20:34 +0800, John Charles Considine wrote:
 gRoovers,
 
 Can the size of figures be controlled from within a noweb document
 without resorting to editing the \includegraphics sections in the .tex
 file?
 
yes,
Sweave sets graphics widths to 0.8\textwidth by default.  To change it
for a document, to say 1.0\textwidth, include the line 

\setkeys{Gin}{width=1\textwidth}

after \begin{document} in the noweb file.

see p.12 of Sweave manual at...
http://www.ci.tuwien.ac.at/~leisch/Sweave/Sweave-manual-20050914.pdf
 

 Can the figure widths be set in the environmental declarations at the
 start?
 
 Can they be set within the \begin{figure} environment?
 
 JC
 
 __
 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