[R] Re : labels outliers in boxplot

2007-01-16 Thread justin bem
I use to do this (It may help you)
>boxplot(x)
>bx<-boxplot(x,plot=F)

In bx object, you and object names out with yaxis cordinates. For the i-th 
boxplot in the figure,
use
>text(rep(i,length(bx$out)),bx$out,...)
 
Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.

- Message d'origine 
De : Greg Snow <[EMAIL PROTECTED]>
À : [EMAIL PROTECTED]; r-help@stat.math.ethz.ch
Envoyé le : Mardi, 16 Janvier 2007, 21h35mn 43s
Objet : Re: [R] labels outliers in boxplot

Some information on the outliers is returned from the boxplot function.  Try 
something like:

set.seed(123)
tmp <- data.frame( group=gl(3,10), 
  y=rcauchy(30), sex=gl(2,5,30,c('M','F')) )

tmp2 <- boxplot( split(tmp$y,tmp$group) )
identify( tmp2$group, tmp2$out, tmp2$group )

Or if your grouping variable works out to the same values as the x axis (used 
integers) and you want to specify a 3rd variable to be the labels you can do:

Identify( tmp$group, tmp$y, tmp$sex )

Hope this helps,

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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> [EMAIL PROTECTED]
> Sent: Wednesday, January 10, 2007 2:08 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] labels outliers in boxplot
> 
> Dear R-users,
> 
> Following is part of my data, where slide has 36 levels and 
> block 48 levels. I have done boxplot for each slide on the 
> same graph. There are outliers for each slide and I tried to 
> use indentify functtion to identify outliers in such a way 
> that when I click on an outlier or point, the points will be 
> labelled by either their block or ID or by both but without 
> success. How can I make it work or are there other ways to do 
> it than using identify function?
> 
> 
> Thanks in advance, 
> 
> Jenny,
> 
> dat1[1:10,]
>  y Slide Block  ID Control
> 1   0.03147823 1 1   IgG-human   5
> 2  -0.23815974 1 1 LPPAANDVSVLTAAR   0
> 3  -0.71926359 1 1 HTKHYRVVSKPAALV   0
> 4  -0.14607826 1 1 FVALPAATADAYATT   0
> 5   0.89553073 1 1 NYPAMMAHAGDMAGY   0
> 6  -0.67587100 1 1 RRALRQIGVLERPVG   0
> 7   0.32636034 1 1 DCGTIRVGSFRGRWL   0
> 8  -1.44057259 1 1 MAKLSTDELLDAFKE   0
> 9  -0.37064338 1 1 LELSDFVKKFEETFE   0
> 10 -0.20387233 1 1 VSRRAKVDVLIVHTT   0
> 
> 
>  tb_ncs<-subset(dat1,dat1$Control==1) ### this
> data contains only negative controls
> 
>par(las=2,mar=c(10.1,4.1,4.1,2.1)) 
>   
> boxplot(split(tb_ncs$y,tb_ncs$Slide),col="orange",
> cex=.65,
>outline=TRUE,main="Negative control 
> response of each patient", cex.main=1, font.main=1,
> col.main="blue",
> names=c(1:35,"B"))
>grid(nx=NA, ny=NULL)   
>   ### grid over boxplot 
>legend("bottomright", "B = Buffer +
> sec",text.col="blue")
>
> 
> out.block<-
> identify(tb_ncs$y,tb_ncs$Slide) 
> 
> 
> 
> 
> 
> 
> _
> Flyger tiden iväg? Fånga dagen med Yahoo! Mails inbyggda
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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











___ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internaut

[[alternative HTML version deleted]]

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


Re: [R] Help on variable ranking

2007-01-16 Thread Simon Blomberg
Before you do that, you might try reading this paper:

Bring, J. 1995. Variable importance by partitioning R^2. Quality and 
Quantity 29:173-189.

Cheers,

Simon.

Andrew Robinson wrote:
> Rupendra,
> 
> depending on the nature of your data (which you haven't mentioned),
> you might try hierarchical partitioning, as found in the hier.part
> package on CRAN.
> 
> Cheers
> 
> Andrew
> 
> On Wed, Jan 17, 2007 at 11:07:18AM +0545, Rupendra Chulyadyo wrote:
>> Hello all,
>>
>> I want to assign relative score to the predictor variables on the basis of
>> its influence on the dependent variable. But I could not find any standard
>> statistical approach appropriate for this purpose.
>> Please suggest the possible approaches.
>>
>> Thanks in advance,
>>
>> Rupendra Chulyadyo
>> Institute of Engineering,
>> Tribhuvan University,
>> Nepal
>>
>>  [[alternative HTML version deleted]]
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
> 


-- 
Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat.
Centre for Resource and Environmental Studies
The Australian National University
Canberra ACT 0200
Australia
T: +61 2 6125 7800 email: Simon.Blomberg_at_anu.edu.au
F: +61 2 6125 0757
CRICOS Provider # 00120C

The combination of some data and an aching desire for
an answer does not ensure that a reasonable answer
can be extracted from a given body of data.
- John Tukey.

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


Re: [R] Help on variable ranking

2007-01-16 Thread Andrew Robinson
Rupendra,

depending on the nature of your data (which you haven't mentioned),
you might try hierarchical partitioning, as found in the hier.part
package on CRAN.

Cheers

Andrew

On Wed, Jan 17, 2007 at 11:07:18AM +0545, Rupendra Chulyadyo wrote:
> Hello all,
> 
> I want to assign relative score to the predictor variables on the basis of
> its influence on the dependent variable. But I could not find any standard
> statistical approach appropriate for this purpose.
> Please suggest the possible approaches.
> 
> Thanks in advance,
> 
> Rupendra Chulyadyo
> Institute of Engineering,
> Tribhuvan University,
> Nepal
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Andrew Robinson  
Department of Mathematics and StatisticsTel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
http://www.ms.unimelb.edu.au/~andrewpr
http://blogs.mbs.edu/fishing-in-the-bay/

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


[R] Help on variable ranking

2007-01-16 Thread Rupendra Chulyadyo
Hello all,

I want to assign relative score to the predictor variables on the basis of
its influence on the dependent variable. But I could not find any standard
statistical approach appropriate for this purpose.
Please suggest the possible approaches.

Thanks in advance,

Rupendra Chulyadyo
Institute of Engineering,
Tribhuvan University,
Nepal

[[alternative HTML version deleted]]

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


Re: [R] curious about dimension of 'apply' output when MARGIN=1

2007-01-16 Thread Gabor Grothendieck
The reshape package has an idempotent apply, iapply:

> library(reshape)
> iapply(M,1,function(row) row+c(1,2))
 [,1] [,2]
[1,]26
[2,]37
[3,]48

On 1/16/07, Benjamin Tyner <[EMAIL PROTECTED]> wrote:
> Reading the documentation for 'apply', I understand the following is
> working exactly as documented:
>
>  > M<-matrix(1:6,ncol=2)
>  > M
> [,1] [,2]
> [1,]14
> [2,]25
> [3,]36
>  > apply(M,2,function(column) column+c(1,2,3))
> [,1] [,2]
> [1,]25
> [2,]47
> [3,]69
>  > apply(M,1,function(row) row+c(1,2))
> [,1] [,2] [,3]
> [1,]234
> [2,]678
>
> I'm not proposing any changes or extra arguments to 'apply'. Rather, I'm
> wondering what is the benefit for (or rationale behind) this somewhat
> unintuitive behavior in the case that MARGIN=1.
>
> Thanks,
> Ben
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] plot portion of a line

2007-01-16 Thread Greg Snow
Try the clipplot function from the TeachingDemos package:

> x <- rnorm(50)
> y <- rnorm(50)
> plot(x,y)
> clipplot( abline(lm(y~x), col='red'), xlim=c(1,3))
> clipplot( abline(lm(y~x), col='blue'), xlim=c(-2,1))


Hope this helps,

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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of BBands
> Sent: Tuesday, January 16, 2007 9:16 AM
> To: R-Help
> Subject: [R] plot portion of a line
> 
> Dear HelpeRs,
> 
> Given:
> x <- rnorm(50)
> y <- rnorm(50)
> plot(x,y)
> abline(lm(x ~ y))
> 
> Is there a way to plot just a portion of the line? Say for values of x
> > 2.0 or x > -2.0 and x < 4.0. (Still fitting all the points.)
> 
> Thank you,
> 
> jab
> --
> John Bollinger, CFA, CMT
> www.BollingerBands.com
> 
> If you advance far enough, you arrive at the beginning.
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


[R] curious about dimension of 'apply' output when MARGIN=1

2007-01-16 Thread Benjamin Tyner
Reading the documentation for 'apply', I understand the following is 
working exactly as documented:

 > M<-matrix(1:6,ncol=2)
 > M
 [,1] [,2]
[1,]14
[2,]25
[3,]36
 > apply(M,2,function(column) column+c(1,2,3))
 [,1] [,2]
[1,]25
[2,]47
[3,]69
 > apply(M,1,function(row) row+c(1,2))
 [,1] [,2] [,3]
[1,]234
[2,]678

I'm not proposing any changes or extra arguments to 'apply'. Rather, I'm 
wondering what is the benefit for (or rationale behind) this somewhat 
unintuitive behavior in the case that MARGIN=1.

Thanks,
Ben

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


Re: [R] Controlling size of boxplot when it is added in a plot

2007-01-16 Thread Greg Snow
One approach is to use the subplot function from the TeachingDemos
package.  I could only get everything to line up properly if I specified
the xlim argument to hist directly and the same value as the ylim
argument to boxplot.

Try this:

> x <- rnorm(100)
> library(TeachingDemos)
> hist(x, breaks = 20, main = NULL, ylim = c(-2,
max(hs$counts)),xlim=c(-3,3))
> subplot( boxplot(x, horizontal=T, ylim=c(-3,3),axes=F ),
par('usr')[1:2], c(par('usr')[3],0))
> box()

I have seen things like this in teaching situations, but not much in the
non-academic world.

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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Charilaos Skiadas
> Sent: Saturday, January 13, 2007 9:12 PM
> To: R-Mailingliste
> Subject: [R] Controlling size of boxplot when it is added in a plot
> 
> Greetings,
> 
>   I am trying to add a boxplot to the bottom of a 
> histogram, right between the histogram bars and the x axis. 
> Here is the code I am using at the moment (the par line is 
> probably not relevant for our
> discussion):
> 
> hs <- hist(x, breaks = 20, plot = F)
> par(mar = c(3,3,2,1))
> hist(x, breaks = 20, main = NULL, ylim = c(-2, 
> max(hs$counts))) boxplot(x, horizontal = T, axes = T, add = 
> T, at = -1)
> 
> The problem is the following. As it is, the boxplot restricts 
> itself to the -1 line. I would like it to occupy both the -1 
> and the -2 lines ( I guess more generally I would like to 
> control how much vertical space the "embedded boxplot" 
> occupies). I tried to set the width parameter in the boxplot, 
> but that seemed to have no effect at all.
> 
> On an OT note, I haven't seen this way of combining a 
> histogram with a boxplot (perhaps I haven't looked really 
> hard). I thought it would be useful for my students to see 
> them next to each other, to develop a feeling for what 
> histograms might correspond to what boxplots. Is there 
> perhaps some reason why I should avoid showing those graphs 
> to them like that, that I am not aware of? Or just a reason 
> why I haven't seen them combined like this much?
> 
> TIA
> 
> Charilaos Skiadas
> Department of Mathematics
> Hanover College
> P.O.Box 108
> Hanover, IN 47243
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


[R] Reminder: JSS Special volume R in ecology

2007-01-16 Thread Thomas Petzoldt
Dear UseRs,

one of the outcomes of the useR! 2006 conference held in Vienna was that 
JSS, the Journal of Statistical Software, is planning to publish a 
series of special volumes. They will be guest edited and each volume 
will have 5-10 issues (articles) of the usual JSS format.

One of the volumes is related to the use of the R software in ecology.

The submission deadline will end in one month on 2007-02-15. Please 
consult the call for papers in the R Wiki for details:

http://wiki.r-project.org/rwiki/doku.php?id=misc:r_in_ecology_and_ecological_modelling


Thomas Kneib & Thomas Petzoldt, guest editors


The original CFP was posted on Fri, 6 Oct 2006:
   https://listserv.umd.edu/cgi-bin/wa?A2=ind0610a&L=ecolog-l&P=11582


-- 
Thomas Petzoldt
Technische Universitaet Dresden
Institut fuer Hydrobiologie[EMAIL PROTECTED]
01062 Dresden  http://tu-dresden.de/hydrobiologie/
GERMANY

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


Re: [R] labels outliers in boxplot

2007-01-16 Thread Greg Snow
Some information on the outliers is returned from the boxplot function.  Try 
something like:

set.seed(123)
tmp <- data.frame( group=gl(3,10), 
  y=rcauchy(30), sex=gl(2,5,30,c('M','F')) )

tmp2 <- boxplot( split(tmp$y,tmp$group) )
identify( tmp2$group, tmp2$out, tmp2$group )

Or if your grouping variable works out to the same values as the x axis (used 
integers) and you want to specify a 3rd variable to be the labels you can do:

Identify( tmp$group, tmp$y, tmp$sex )

Hope this helps,

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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> [EMAIL PROTECTED]
> Sent: Wednesday, January 10, 2007 2:08 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] labels outliers in boxplot
> 
> Dear R-users,
> 
> Following is part of my data, where slide has 36 levels and 
> block 48 levels. I have done boxplot for each slide on the 
> same graph. There are outliers for each slide and I tried to 
> use indentify functtion to identify outliers in such a way 
> that when I click on an outlier or point, the points will be 
> labelled by either their block or ID or by both but without 
> success. How can I make it work or are there other ways to do 
> it than using identify function?
> 
> 
> Thanks in advance, 
> 
> Jenny,
> 
> dat1[1:10,]
>  y Slide Block  ID Control
> 1   0.03147823 1 1   IgG-human   5
> 2  -0.23815974 1 1 LPPAANDVSVLTAAR   0
> 3  -0.71926359 1 1 HTKHYRVVSKPAALV   0
> 4  -0.14607826 1 1 FVALPAATADAYATT   0
> 5   0.89553073 1 1 NYPAMMAHAGDMAGY   0
> 6  -0.67587100 1 1 RRALRQIGVLERPVG   0
> 7   0.32636034 1 1 DCGTIRVGSFRGRWL   0
> 8  -1.44057259 1 1 MAKLSTDELLDAFKE   0
> 9  -0.37064338 1 1 LELSDFVKKFEETFE   0
> 10 -0.20387233 1 1 VSRRAKVDVLIVHTT   0
> 
> 
>  tb_ncs<-subset(dat1,dat1$Control==1) ### this
> data contains only negative controls
> 
>par(las=2,mar=c(10.1,4.1,4.1,2.1)) 
>   
> boxplot(split(tb_ncs$y,tb_ncs$Slide),col="orange",
> cex=.65,
>outline=TRUE,main="Negative control 
> response of each patient", cex.main=1, font.main=1,
> col.main="blue",
> names=c(1:35,"B"))
>grid(nx=NA, ny=NULL)   
>   ### grid over boxplot 
>legend("bottomright", "B = Buffer +
> sec",text.col="blue")
>
> 
> out.block<-
> identify(tb_ncs$y,tb_ncs$Slide) 
> 
> 
> 
>   
>   
>   
> _
> Flyger tiden iväg? Fånga dagen med Yahoo! Mails inbyggda
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] image() and nonsquare matrices

2007-01-16 Thread Greg Snow
Look at the "squishplot" function in the TeachingDemos package.  Does
this set of commands work for you?

> library(TeachingDemos)
> squishplot(c(0.5,20.5),c(0.5,5.5),1)
> image(1:20,1:5,a,asp=1,xlab="label here")
> box()

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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Robin Hankin
> Sent: Friday, January 12, 2007 3:13 AM
> To: RHelp help
> Subject: [R] image() and nonsquare matrices
> 
> How do I draw non-square matrices with image() and get the axes right?
> 
> 
> Try 1:
> 
>   a <- matrix(rnorm(100),20,5)
> image(1:20,1:5,a,asp=1,xlab="label here") # No good because 
> the axes don't touch the image
> 
> 
> 
> Try 2:
> 
> image(1:20,1:5,a,asp=1,axes=F,xlab="label here")
> axis(side=1,pos=0)
> # No good because the x axis label is floating far from the x axis.
> 
> 
> 
> Try 3:
>   image(1:20,1:5,a,asp=1,axes=F,xlab="",ylab="")
>   axis(side=1,pos=0)
> # No good because the x axis label is absent.
> 
> 
> How to use image() with a non-square matrix and make axes and 
> labels appear correctly?
> 
> 
> 
> 
> 
> --
> Robin Hankin
> Uncertainty Analyst
> National Oceanography Centre, Southampton European Way, 
> Southampton SO14 3ZH, UK
>   tel  023-8059-7743
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


[R] Rgui crashes when calling odbcClose()

2007-01-16 Thread Robert Sams
Hi,

I'm running Rgui v2.4.0, RODBC v1.1-8, and psqlODBC v8.2.0002. Whenever
I do the following

chan <- odbcConnect("mydatabase", uid="admin") # connection to a
postgresql db on a linux box
tmp <- sqlQuery(chan, "select * from sometable;") # this is successfull
odbcClose(chan)  # this crashes Rgui and raises an error window
containing the following MS error signature:

AppName: rgui.exe AppVer 2.4.39566.0ModName: psqlodbc35w.dll
ModVer: 8.2.0.2Offset: 3248

I didn't find anything relevant in the R Windows FAQ or a few queries of
the help archives; appologies if this has been addressed before.

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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] feedback on "writing r extensions"

2007-01-16 Thread David Forrest
On Tue, 16 Jan 2007, Gabor Grothendieck wrote:

> It would also be nice if there were links in the .Rd files back
> to the source of the commands, not just the source of the
> documentation.   That would facilitate
> and encourage readers to paruse the source to clarify
> the meaning of the help files.

Perhaps it would be feasible to make an RSourceSearch() function (like 
RSiteSearch()) that could recognize things like documentation, functions, 
and internals and direct users to the source code.

Dave

> On 1/16/07, David Forrest <[EMAIL PROTECTED]> wrote:
>> On Tue, 16 Jan 2007, Martin Maechler wrote:
>>
 "Scott" == Scott Harrison <[EMAIL PROTECTED]>
 on Mon, 15 Jan 2007 13:15:09 -0500 writes:
>> ...
>>> For "edits", we'd mostly like to receive feedback on the
>>> *source* of the above automatically produced document
>>> (which is also the source of the PDF version, same URL as above,
>>> just replace ".html" by ".pdf")
>>>
>>> The development source is always available at
>>>  https://svn.r-project.org/R/trunk/doc/manual/R-exts.texi
>>
>> Would it be horrid to include the reference to the sources in the derived
>> documents?  It might help with self-documenting the process and help
>> demonstrate the benefits of R's open source philosophy.
>>
>>> Thanking you for offering feedback,
>>
>> Thank you.
>>
>> Dave
>> --
>>  Dr. David Forrest
>>  [EMAIL PROTECTED](804)684-7900w
>>  [EMAIL PROTECTED] (804)642-0662h
>>http://maplepark.com/~drf5n/
>>
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
  Dr. David Forrest
  [EMAIL PROTECTED](804)684-7900w
  [EMAIL PROTECTED] (804)642-0662h
http://maplepark.com/~drf5n/

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


Re: [R] Is it the PPS samples i needed in R?

2007-01-16 Thread Thomas Lumley
On Fri, 12 Jan 2007, zhijie zhang wrote:

> Dear friends,
>  I want to do a unequal probability sampling, that is, Probability
> Proportionate to size, Is it right for the following programs?
> Say my original dataset is:
>
> ID  Population
> 1 100
> 2 200
> 3 300
> IF the population is large ,then the corresponding ID has the large
> Probability to be selected.
>
> sample(A$ID, size=2, replace = FALSE, prob = A$population)
> #suppose the dataset name is A.
> Is it the PPS samples  i needed ?

No, this does not give PPS samples for size>1.  The "pps" and "sampling" 
packages have code for PPS samples.

-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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] LSD multiple comparison test

2007-01-16 Thread Richard M. Heiberger
Look at the glht function in the multcomp package and the
MMC functions in the HH package.

Rich

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


[R] LSD multiple comparison test

2007-01-16 Thread Jorge Lampurlanes Castel
Hello,

There is any way of performing a LSD (Least Significant Diference)
multiple comparison test to separate the levels of the significant factors
of a model? I am migrating from SAS.

Thanks a lot.

-- 
**
Jorge Lampurlanés Castel
Departament d'Enginyeria Agroforestal
Escola Tècnica Superior d'Enginyeria Agrària
Universitat de Lleida
Avinguda Rovira Roure, 191
25198-LLEIDA
SPAIN

Tl.: +34 973 70 25 37
Fax.:+34 073 70 26 73
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] number of Nodes in Random Forest

2007-01-16 Thread Weiwei Shi
Hi, Goncalo:

did u use compounds as features when building rf? If so, some
compounds are NOT randomly selected in splitting nodes, which might
explain what you observed. But you need to provide more info for us to
help you, like those parameters you used to build rf.

You can use varImpPlot to see what exactly compounds were used by
setting n.var (see ?varImpPlot) or you can use
nrow(YourTrainingX$importance) to get that number too.

HTH,

w.

On 1/16/07, Gonçalo Carrera <[EMAIL PROTECTED]> wrote:
> I'm calculating nodes using Random Forest in R but i only get nodes for a
> fraction of the compounds i want to calculate, the rest is ommited and is not
> printed in the output file, (i'm working with 3012 compounds). What can i do 
> to
> have nodes printed for all the compounds. Thanks
>
> Gonçalo
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Weiwei Shi, Ph.D
Research Scientist
GeneGO, Inc.

"Did you always know?"
"No, I did not. But I believed..."
---Matrix III

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


Re: [R] RODBC: sqlQuery is successful, but a similar sqlFetch returns error

2007-01-16 Thread Prof Brian Ripley
'.' is invalid in an SQL table name.  I don't know what driver you are 
using (you seem very reluctant to tell us anything useful about your 
DBMS), but dbo.vwC1198_2006_RawData_With_CMPL_EXCL probably means table 
vwC1198_2006_RawData_With_CMPL_EXCL in database dbo, and that is valid as 
part of SQL, but not in your usage in sqlFetch.

On Tue, 16 Jan 2007, Ben Fairbank wrote:

> Greetings guRus --
>
>
>
> I have successfully queried a large (24,445 rows by 281 cols.) in-house
> database using the following RODBC query (without the line breaks)
>
>
>
> testout <- sqlQuery(channel, "select idSchedule,EXCL_Total from
> dbo.vwC1198_2006_RawData_With_CMPL_EXCL")
>
>
>
> This returns a dataframe of 24445 rows and two columns (as intended),
> but the following command
>
>
>
> testout <-
> sqlFetch(channel,"dbo.vwC1198_2006_RawData_With_CMPL_EXCL",colnames =
> TRUE,rownames = "idSchedule")
>
>
>
> returns the error message
>
>
>
> in odbcTableExists(channel, sqtable) :
>
>'dbo.vwC1198_2006_RawData_With_CMPL_EXCL': table not found on
> channel
>
>
>
> The value of channel did not change between the two commands.
>
>
>
> Based on the help files for sqlFetch and sqlQuery, it is not clear to me
> why one command would find the table and the other would not.  I am
> running R 2.4.1 on a Windows XP pro machine with 2 gig of memory.
>
>
>
> Thanks for any suggestions or hints,
>
>
>
> Ben Fairbank
>
>
>
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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

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


Re: [R] plot portion of a line

2007-01-16 Thread Gabor Grothendieck
As in Dmitris' post lines is a somewhat more succint so here it is
again replacing segments with lines:


set.seed(1)

x <- rnorm(50)
y <- rnorm(50)


plot(y ~ x)

y.lm <- lm(y ~ x)

abline(y.lm) # omit this line if black abline not wanted

x0 <- c(-2, 4)
y0 <- predict(y.lm, list(x = x0))
lines(y0 ~ x0, col = "red", lwd = 2)


On 1/16/07, Gabor Grothendieck <[EMAIL PROTECTED]> wrote:
> Use segments. In the following we overlay the black abline with
> a wider red segments line segment:
>
>
> set.seed(1)
> x <- rnorm(50)
> y <- rnorm(50)
>
> plot(y ~ x)
>
> y.lm <- lm(y ~ x)
>
> abline(y.lm) # omit this line if black abline not wanted
>
> x0 <- c(-2, 4)
> y0 <- predict(y.lm, list(x = x0))
> segments(x0[1], y0[1], x0[2], y0[2], col = "red", lwd = 2)
>
>
>
> On 1/16/07, BBands <[EMAIL PROTECTED]> wrote:
> > Dear HelpeRs,
> >
> > Given:
> > x <- rnorm(50)
> > y <- rnorm(50)
> > plot(x,y)
> > abline(lm(x ~ y))
> >
> > Is there a way to plot just a portion of the line? Say for values of x
> > > 2.0 or x > -2.0 and x < 4.0. (Still fitting all the points.)
> >
> > Thank you,
> >
> >jab
> > --
> > John Bollinger, CFA, CMT
> > www.BollingerBands.com
> >
> > If you advance far enough, you arrive at the beginning.
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>

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


Re: [R] R on Windows Vista

2007-01-16 Thread Uwe Ligges


Charles Annis, P.E. wrote:
> I've run R on the 32 bit version of Vista.  Because of Vista's extra
> security controls you can't install a library 

You mean you can't install a *package* into a library.
Are you sure that you cannot install into some other library that is in 
some directory where you have got write access to?

Uwe Ligges




easily, however, even though I
> had not trouble installing R.  You must first set the security level to
> allow it (I can't recall the details but it's not to difficult to figure
> out), then install the libraries, then re-set the security levels.  
> 
> Charles Annis, P.E.
> 
> [EMAIL PROTECTED]
> phone: 561-352-9699
> eFax:  614-455-3265
> http://www.StatisticalEngineering.com
>  
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Sicotte, Hugues Ph.D.
> Sent: Tuesday, January 16, 2007 9:36 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] R on Windows Vista
> 
> Did anyone try to run R under Window Vista, especially Windows Vista
> 64bit?
> 
> Thanks.
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


[R] RODBC: sqlQuery is successful, but a similar sqlFetch returns error

2007-01-16 Thread Ben Fairbank
Greetings guRus -- 

 

I have successfully queried a large (24,445 rows by 281 cols.) in-house
database using the following RODBC query (without the line breaks)

 

testout <- sqlQuery(channel, "select idSchedule,EXCL_Total from
dbo.vwC1198_2006_RawData_With_CMPL_EXCL")

 

This returns a dataframe of 24445 rows and two columns (as intended),
but the following command

 

testout <-
sqlFetch(channel,"dbo.vwC1198_2006_RawData_With_CMPL_EXCL",colnames =
TRUE,rownames = "idSchedule")

 

returns the error message 

 

in odbcTableExists(channel, sqtable) : 

'dbo.vwC1198_2006_RawData_With_CMPL_EXCL': table not found on
channel

 

The value of channel did not change between the two commands.

 

Based on the help files for sqlFetch and sqlQuery, it is not clear to me
why one command would find the table and the other would not.  I am
running R 2.4.1 on a Windows XP pro machine with 2 gig of memory.

 

Thanks for any suggestions or hints,

 

Ben Fairbank

 


[[alternative HTML version deleted]]

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


[R] (no subject)

2007-01-16 Thread Gonçalo Carrera
I'm calculating nodes using Random Forest in R but i only get nodes for a
fraction of the compounds i want to calculate, the rest is ommited and is not
printed in the output file, (i'm working with 3012 compounds). What can i do to
have nodes printed for all the compounds. Thanks

Gonçalo

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


[R] nested hierarchical design

2007-01-16 Thread Jelmer Elzinga
Dear R-Helpers,

I would like to know what syntax I need to use to do a nested anova for 
1. a continuous variable and 2. count data (x out of y)
1. The first I used to do in SPSS and I would like to be able to do it 
in R as well.
This is the hierarchical model I would like to use: a continuous 
variable explained by factor A(fixed) + factor B(random) nested in A + 
factor C (random) nested in factor B (which is nested in A).
The data is unbalanced at all levels, meaning different nrs of B per A, 
different nrs of C for B, different nrs of values per C
In SPSS this seems to be quite simple with a small writing in the syntax 
(see below). But how do I get the same results in R with lme?

SPSS syntax:
UNIANOVA
  var  BY A B C
  /RANDOM = B C
  /METHOD = SSTYPE(3)
  /INTERCEPT = INCLUDE
  /CRITERIA = ALPHA(.05)
  /DESIGN = A B(A) C(B(A))).

2. the same model but than for count data (like 15 out of 30, 23 out of 
60) instead of the continous variable(I know the basics of glm in R)

Thanks a lot for your help
Jelmer

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


Re: [R] R on Windows Vista

2007-01-16 Thread Charles Annis, P.E.
I've run R on the 32 bit version of Vista.  Because of Vista's extra
security controls you can't install a library easily, however, even though I
had not trouble installing R.  You must first set the security level to
allow it (I can't recall the details but it's not to difficult to figure
out), then install the libraries, then re-set the security levels.  

Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sicotte, Hugues Ph.D.
Sent: Tuesday, January 16, 2007 9:36 AM
To: r-help@stat.math.ethz.ch
Subject: [R] R on Windows Vista

Did anyone try to run R under Window Vista, especially Windows Vista
64bit?

Thanks.

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

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


Re: [R] How to format R code in LaTex documents

2007-01-16 Thread Michael Dewey
At 14:12 15/01/2007, Frank E Harrell Jr wrote:
>Benjamin Dickgiesser wrote:
>>Hi,
>>I am planning on putting some R script in an appendix of a LaTex
>>document. Can anyone recommend me a way of how to format it? Is there
>>a way to keep all line breaks without having to insert \\ in every
>>single line?
>>Thank you!
>>Benjamin
>
>Here's one way and I would appreciate anyone's 
>improvements.  I've also included solutions from 
>two others.  Please let me know what you decide to use.  -Frank

Some interesting ideas below so just to add that 
I find I often have to use the linewidth 
parameter to avoid lines wrapping. This is 
valuable if you are also going to include bits of 
R output as well (you can control the width of 
your own code fragments of course).


>\usepackage{listings,relsize}
>\lstloadlanguages{R}
>\lstset{language=R,basicstyle=\smaller[2],commentstyle=\rmfamily\smaller,
>  showstringspaces=false,%
>  xleftmargin=4ex,literate={<-}{{$\leftarrow$}}1 {~}{{$\sim$}}1}
>\lstset{escapeinside={(*}{*)}}   % for (*\ref{ }*) inside lstlistings (S code)
>
>. . .
>\begin{lstlisting}
>. . . S code . . .
>\end{lstlisting}
>
>The following code was provided by Vincent Goulet:
>
>
>listings is a great package to highlight R keywords and comments and --- that
>was my main use of the package --- index those keywords. I found that I had
>to slightly redefine the list of keywords included in listings. I still did
>not take the time to submit a patch to the author, though...
>
>In any case, here's what I use, if it can be of any help to anyone:
>
>\lstloadlanguages{R}
>\lstdefinelanguage{Renhanced}[]{R}{%
>   morekeywords={acf,ar,arima,arima.sim,colMeans,colSums,is.na,is.null,%
> mapply,ms,na.rm,nlmin,replicate,row.names,rowMeans,rowSums,seasonal,%
> sys.time,system.time,ts.plot,which.max,which.min},
>   deletekeywords={c},
>   alsoletter={.\%},%
>   alsoother={:_\$}}
>\lstset{language=Renhanced,extendedchars=true,
>   basicstyle=\small\ttfamily,
>   commentstyle=\textsl,
>   keywordstyle=\mdseries,
>   showstringspaces=false,
>   index=[1][keywords],
>   indexstyle=\indexfonction}
>
>with
>
>   [EMAIL PROTECTED]
>
>-- Vincent Goulet, Associate Professor École 
>d'actuariat Université Laval, Québec 
>[EMAIL PROTECTED] http://vgoulet.act.ulaval.ca
>
>Anupam Tyagi provided the following:
>
>\documentclass{report}
>\usepackage{listings}
>\begin{document}
>
>Somethings .
>
>\lstset{% general command to set parameter(s)
>basicstyle=\small, % print whole in small
>stringstyle=\ttfamily, % typewriter type for strings
>numbers=left, % numbers on the left
>numberstyle=\tiny, % Tiny numbers
>stepnumber=2, % number every second line of code
>numbersep=5pt, % 5pt seperation between numbering and code listing
>language=R }
>
>\lstinputlisting{text1.R}
>
>\end{document}
>
>

Michael Dewey
http://www.aghmed.fsnet.co.uk

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


Re: [R] system(mysql... Does not recognize < as passing an attribute (No HTML)

2007-01-16 Thread Henrique Dallazuanna
You can try this:

system(paste('mysql -u hsdlife -p -D life <', file('c:/teste.txt')),
show.output.on.console = TRUE)


On 16/01/07, Lapointe, Pierre <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> This is my command line request: mysql -u root -ppassword -D quant
>  This line works from the command line in windows.
>
> In R, when I try to use the system function, it does not work,
>
> > system(paste('mysql -u root -ppassword -D quant
>  ERROR 1102 (42000): Incorrect database name '
> It seems that the "<" character is not recognized as an attribute.
>
> Thanks,
>
> Pierre
>
> > version
>_
> platform   i386-pc-mingw32
> arch   i386
> os mingw32
> system i386, mingw32
> status
> major  2
> minor  4.1
> year   2006
> month  12
> day18
> svn rev40228
> language   R
> version.string R version 2.4.1 (2006-12-18)
>
> **
> AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}}
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna

[[alternative HTML version deleted]]

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


Re: [R] system(mysql... Does not recognize < as passing an attribute

2007-01-16 Thread Prof Brian Ripley
You are on Windows, and that is how system() works on Windows (not 
just in R, but in C, Perl ...).  The help says

command: the system command to be invoked, as a string.

A command line is not a 'system command', and the < is interpreted by the 
shell you are running as your 'command line in WIndows'.

Try shell() instead.

On Tue, 16 Jan 2007, Lapointe, Pierre wrote:

> Hi,
>
> This is my command line request: mysql -u root -ppassword -D quant
>  This line works from the command line in windows.
>
> In R, when I try to use the system function, it does not work,
>
>> system(paste('mysql -u root -ppassword -D quant
>  ERROR 1102 (42000): Incorrect database name '
> It seems that the "<" caracter is not recognized as an attribute.
>
> Thanks,
>
> Pierre
>
>> version
>   _
> platform   i386-pc-mingw32
> arch   i386
> os mingw32
> system i386, mingw32
> status
> major  2
> minor  4.1
> year   2006
> month  12
> day18
> svn rev40228
> language   R
> version.string R version 2.4.1 (2006-12-18)
>
>
> **
> AVIS DE NON-RESPONSABILITE: Ce document transmis par courrie...{{dropped}}
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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

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


[R] system(mysql... Does not recognize < as passing an attribute (No HTML)

2007-01-16 Thread Lapointe, Pierre
Hi, 

This is my command line request: mysql -u root -ppassword -D quant
 system(paste('mysql -u root -ppassword -D quant
 version
   _   
platform   i386-pc-mingw32 
arch   i386
os mingw32 
system i386, mingw32   
status 
major  2   
minor  4.1 
year   2006
month  12  
day18  
svn rev40228   
language   R   
version.string R version 2.4.1 (2006-12-18)

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

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


[R] system(mysql... Does not recognize < as passing an attribute

2007-01-16 Thread Lapointe, Pierre
Hi, 

This is my command line request: mysql -u root -ppassword -D quant
 system(paste('mysql -u root -ppassword -D quant
 version
   _   
platform   i386-pc-mingw32 
arch   i386
os mingw32 
system i386, mingw32   
status 
major  2   
minor  4.1 
year   2006
month  12  
day18  
svn rev40228   
language   R   
version.string R version 2.4.1 (2006-12-18)


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

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


Re: [R] plot portion of a line

2007-01-16 Thread Gabor Grothendieck
Use segments. In the following we overlay the black abline with
a wider red segments line segment:


set.seed(1)
x <- rnorm(50)
y <- rnorm(50)

plot(y ~ x)

y.lm <- lm(y ~ x)

abline(y.lm) # omit this line if black abline not wanted

x0 <- c(-2, 4)
y0 <- predict(y.lm, list(x = x0))
segments(x0[1], y0[1], x0[2], y0[2], col = "red", lwd = 2)



On 1/16/07, BBands <[EMAIL PROTECTED]> wrote:
> Dear HelpeRs,
>
> Given:
> x <- rnorm(50)
> y <- rnorm(50)
> plot(x,y)
> abline(lm(x ~ y))
>
> Is there a way to plot just a portion of the line? Say for values of x
> > 2.0 or x > -2.0 and x < 4.0. (Still fitting all the points.)
>
> Thank you,
>
>jab
> --
> John Bollinger, CFA, CMT
> www.BollingerBands.com
>
> If you advance far enough, you arrive at the beginning.
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] plot portion of a line

2007-01-16 Thread Dimitris Rizopoulos
you could try something like the following:

x <- rnorm(50)
y <- rnorm(50)
obj <- lm(y ~ x)

par(mfrow = c(2, 2))
plot(x, y, main = "x < -1")
x. <- c(min(x), -1)
y. <- predict(obj, data.frame(x = x.))
lines(x., y.)

plot(x, y, main = "x > 1")
x. <- c(1, max(x))
y. <- predict(obj, data.frame(x = x.))
lines(x., y.)

plot(x, y, main = "x > -1 & x < 1")
x. <- c(-1, 1)
y. <- predict(obj, data.frame(x = x.))
lines(x., y.)


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://med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


- Original Message - 
From: "BBands" <[EMAIL PROTECTED]>
To: "R-Help" 
Sent: Tuesday, January 16, 2007 5:16 PM
Subject: [R] plot portion of a line


> Dear HelpeRs,
>
> Given:
> x <- rnorm(50)
> y <- rnorm(50)
> plot(x,y)
> abline(lm(x ~ y))
>
> Is there a way to plot just a portion of the line? Say for values of 
> x
>> 2.0 or x > -2.0 and x < 4.0. (Still fitting all the points.)
>
> Thank you,
>
>jab
> -- 
> John Bollinger, CFA, CMT
> www.BollingerBands.com
>
> If you advance far enough, you arrive at the beginning.
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 


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
and provide commented, minimal, self-contained, reproducible code.


[R] plot portion of a line

2007-01-16 Thread BBands
Dear HelpeRs,

Given:
x <- rnorm(50)
y <- rnorm(50)
plot(x,y)
abline(lm(x ~ y))

Is there a way to plot just a portion of the line? Say for values of x
> 2.0 or x > -2.0 and x < 4.0. (Still fitting all the points.)

Thank you,

jab
-- 
John Bollinger, CFA, CMT
www.BollingerBands.com

If you advance far enough, you arrive at the beginning.

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


[R] parallel coordinates plot

2007-01-16 Thread Marco Helbich
Dear List,

I want to make a parallel coordinates plot with the specific variables on
the abscissa and the cases on the ordinate should be dyed dependent on
another nominal variable from the data frame. I use the parcoord function.

Thanks for your help!

Best regards,
Marco

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


Re: [R] feedback on "writing r extensions"

2007-01-16 Thread Gabor Grothendieck
It would also be nice if there were links in the .Rd files back
to the source of the commands, not just the source of the
documentation.   That would facilitate
and encourage readers to paruse the source to clarify
the meaning of the help files.

On 1/16/07, David Forrest <[EMAIL PROTECTED]> wrote:
> On Tue, 16 Jan 2007, Martin Maechler wrote:
>
> >> "Scott" == Scott Harrison <[EMAIL PROTECTED]>
> >> on Mon, 15 Jan 2007 13:15:09 -0500 writes:
> ...
> > For "edits", we'd mostly like to receive feedback on the
> > *source* of the above automatically produced document
> > (which is also the source of the PDF version, same URL as above,
> > just replace ".html" by ".pdf")
> >
> > The development source is always available at
> >  https://svn.r-project.org/R/trunk/doc/manual/R-exts.texi
>
> Would it be horrid to include the reference to the sources in the derived
> documents?  It might help with self-documenting the process and help
> demonstrate the benefits of R's open source philosophy.
>
> > Thanking you for offering feedback,
>
> Thank you.
>
> Dave
> --
>  Dr. David Forrest
>  [EMAIL PROTECTED](804)684-7900w
>  [EMAIL PROTECTED] (804)642-0662h
>http://maplepark.com/~drf5n/
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] feedback on "writing r extensions"

2007-01-16 Thread David Forrest
On Tue, 16 Jan 2007, Martin Maechler wrote:

>> "Scott" == Scott Harrison <[EMAIL PROTECTED]>
>> on Mon, 15 Jan 2007 13:15:09 -0500 writes:
...
> For "edits", we'd mostly like to receive feedback on the
> *source* of the above automatically produced document
> (which is also the source of the PDF version, same URL as above,
> just replace ".html" by ".pdf")
>
> The development source is always available at
>  https://svn.r-project.org/R/trunk/doc/manual/R-exts.texi

Would it be horrid to include the reference to the sources in the derived 
documents?  It might help with self-documenting the process and help 
demonstrate the benefits of R's open source philosophy.

> Thanking you for offering feedback,

Thank you.

Dave
-- 
  Dr. David Forrest
  [EMAIL PROTECTED](804)684-7900w
  [EMAIL PROTECTED] (804)642-0662h
http://maplepark.com/~drf5n/

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


Re: [R] problems with for loop

2007-01-16 Thread Chuck Cleland
Jorge Lampurlanes Castel wrote:
> Hello,
> 
> With this program I try to repeat analysis for different years. The
> results of the analysis are not printed when in the loop, except for the
> year sequence. What is wrong?
> 
> Thanks a lot.
> 
> for (i in 92:99){
>   cat("\n",
>   "=\n",
>   "YEAR =",i,"\n",
>   "=\n"
>   )
>   canos1 <- subset (canos, canos$YEAR==i)
>   LinearModel.1 <- lm(MM_P  ~ BLOC  + TIL, data=canos1)
>   summary(LinearModel.1)
>   Anova(LinearModel.1, type="II")
>   Anova(LinearModel.1, type="III")
> 
> }

  You might consider using by() rather than a loop as follows:

library(car)

by(canos, canos$YEAR,
   function(x){fm <- lm(MM_P ~ BLOC + TIL, data=x)
   ans <- list(summary(fm), Anova(fm, type="II"), Anova(fm, type="III"))
   }
)

  The result can be conveniently stored as a list of lists.

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

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


Re: [R] R on Windows Vista

2007-01-16 Thread Duncan Murdoch
On 1/16/2007 9:35 AM, Sicotte, Hugues Ph.D. wrote:
> Did anyone try to run R under Window Vista, especially Windows Vista
> 64bit?

I know someone who has (but I don't know if it was 32 bit or 64 bit). 
He had a little trouble installing, because Vista tightens security 
slightly:  you need to run the installer with higher than default 
permissions.

Whichever version of Vista you run, R will be 32 bit for some time to 
come:  we don't have a 64 bit toolchain available yet, or a volunteer to 
do the builds.  (I'm unlikely to be upgrading to 64 bit Windows in the 
foreseeable future.)

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
and provide commented, minimal, self-contained, reproducible code.


[R] Re : problems with for loop

2007-01-16 Thread justin bem
Hi, 

Use print function print(Anova(...))

How about use of lappy functions ? It can be much easier

foo<-function(data,formula){
 LM <- lm(formula,data=data)
Result<-list(LmSum<-summary(LM), Type2<-Anova(LM, 
type="II")),Type3<-Anova(LM, type="III"))
}

and print(lappy(split(data,year),foo,formula=...))
 
Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.

- Message d'origine 
De : Jorge Lampurlanes Castel <[EMAIL PROTECTED]>
À : r-help@stat.math.ethz.ch
Envoyé le : Mardi, 16 Janvier 2007, 13h10mn 10s
Objet : [R]  problems with for loop

Hello,

With this program I try to repeat analysis for different years. The
results of the analysis are not printed when in the loop, except for the
year sequence. What is wrong?

Thanks a lot.

for (i in 92:99){
cat("\n",
"=\n",
"YEAR =",i,"\n",
"=\n"
)
canos1 <- subset (canos, canos$YEAR==i)
LinearModel.1 <- lm(MM_P  ~ BLOC  + TIL, data=canos1)
summary(LinearModel.1)
Anova(LinearModel.1, type="II")
Anova(LinearModel.1, type="III")

}


-- 
**
Jorge Lampurlanés Castel
Departament d'Enginyeria Agroforestal
Escola Tècnica Superior d'Enginyeria Agrària
Universitat de Lleida
Avinguda Rovira Roure, 191
25198-LLEIDA
SPAIN

Tl.: +34 973 70 25 37
Fax.:+34 073 70 26 73
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
and provide commented, minimal, self-contained, reproducible code.











___ 
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internaut

[[alternative HTML version deleted]]

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


[R] R on Windows Vista

2007-01-16 Thread Sicotte, Hugues Ph.D.
Did anyone try to run R under Window Vista, especially Windows Vista
64bit?

Thanks.

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


Re: [R] problems with for loop

2007-01-16 Thread Michael T. Mader
If you really want the summary() etc to print to STDOUT use cat() or 
print(). However other ways to post-process results may be preferrable, 
I think about Sweave, xtable, etc.

Regards

Michael

Jorge Lampurlanes Castel wrote:
> Hello,
> 
> With this program I try to repeat analysis for different years. The
> results of the analysis are not printed when in the loop, except for the
> year sequence. What is wrong?
> 
> Thanks a lot.
> 
> for (i in 92:99){
>   cat("\n",
>   "=\n",
>   "YEAR =",i,"\n",
>   "=\n"
>   )
>   canos1 <- subset (canos, canos$YEAR==i)
>   LinearModel.1 <- lm(MM_P  ~ BLOC  + TIL, data=canos1)
>   summary(LinearModel.1)
>   Anova(LinearModel.1, type="II")
>   Anova(LinearModel.1, type="III")
> 
> }
> 
> 

-- 
Michael T. Mader
Institute of Stem Cell Research
GSF - National Research Center for Environment and Health
Ingolstaedter Landstrasse 1
D-85764 Neuherberg
0049-89-3187-3683

The limits of my language are the limits of my world.
Ludwig Wittgenstein Tractatus Logico-Philosophicus 5.6, 1918

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


[R] problems with for loop

2007-01-16 Thread Jorge Lampurlanes Castel
Hello,

With this program I try to repeat analysis for different years. The
results of the analysis are not printed when in the loop, except for the
year sequence. What is wrong?

Thanks a lot.

for (i in 92:99){
cat("\n",
"=\n",
"YEAR =",i,"\n",
"=\n"
)
canos1 <- subset (canos, canos$YEAR==i)
LinearModel.1 <- lm(MM_P  ~ BLOC  + TIL, data=canos1)
summary(LinearModel.1)
Anova(LinearModel.1, type="II")
Anova(LinearModel.1, type="III")

}


-- 
**
Jorge Lampurlanés Castel
Departament d'Enginyeria Agroforestal
Escola Tècnica Superior d'Enginyeria Agrària
Universitat de Lleida
Avinguda Rovira Roure, 191
25198-LLEIDA
SPAIN

Tl.: +34 973 70 25 37
Fax.:+34 073 70 26 73
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
and provide commented, minimal, self-contained, reproducible code.


[R] number of Nodes in Random Forest

2007-01-16 Thread Gonçalo Carrera
I'm calculating nodes using Random Forest in R but i only get nodes for a
fraction of the compounds i want to calculate, the rest is ommited and is not
printed in the output file, (i'm working with 3012 compounds). What can i do to
have nodes printed for all the compounds. Thanks

Gonçalo

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


[R] nlme : convergence problem and other errors

2007-01-16 Thread Thomas BRUNEL
Dear R-user,

I am trying to use the R "nlme" function to fit a non linear mixed 
effects model. The model I wand to fit is an individual somatic growth 
model with 4 parameters. For all parameters both fixed and random 
effects have to be estimated, as well as their covariance matrix (see 
the formula bellow).
The data are simulated with the same growth model as in the nlme, with 
know parameters, and covariance matrix.

I tried to fit the model with several simulated data sets, but most of 
the time, R returns an error message.
there are three main types of errors :
- there is a singular matrix
- a factor is reduced bellow the PNLS level.
- max number of iteration is reached but there is no convergence.


Do you know how to resolve these problems. Is there a way to modify the 
parameters of the maximization algorithm to avoid these error messages?

Furthermore, do you know if it is possible to fix the values of the 
fixed effects so that the model only has to estimate the random effects?

Thank you for your help and answers.

Regards,

Thomas Brunel



pds.fit<-nlme(pds~(exp (lna)/(exp (lnb) + 1/(1 + exp(1000 * (exp 
(lntmat) - t + 0.5))) * exp (lnc)))^4 * (1 - (1 - (  0.051 * (1 - 1/(1 + 
exp(1000 * (exp (lntmat) - t + 0.5 + (exp (lna)/exp (lnb))^4 * (1 - 
(1 - (0.051)^0.25 * (exp (lnb)/exp (lna))) * exp( - ((exp (lnb) * exp 
(lntmat))/4)))^4 * 1/(1 + exp(1000 * (exp (lntmat) - t + 0.5^0.25 * 
((exp (lnb) + 1/(1 + exp(1000 * (exp (lntmat) - t + 0.5))) * exp 
(lnc))/exp (lna))) * exp( - (((exp (lnb) + 1/(1 + exp(1000 * (exp 
(lntmat) - t + 0.5))) * exp (lnc)) *(t - (1/(1 + exp(1000 * (exp 
(lntmat) - t + 0.5))) * exp 
(lntmat/4)))^4,data=pdsdata,fixed=lna+lnb+lnc+lntmat~1,random= 
lna+lnb+lnc+lntmat~1|indi ,start=c(lna=log(a2),lnb=log(b2) ,lnc = 
log(c2), lntmat=log(1200)))




-- 




Laboratoire Halieutique de Port-en-Bessin


avenue du Général de Gaulle
14520 Port-en-Bessin
tél : 02 31 51 56 00 (standard)
fax : 02 31 51 56 01


page personnelle (CV online):
http://www.ifremer.fr/drvrhbr/personnel/brunel/index.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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] SARIMA problem

2007-01-16 Thread Prof Brian Ripley
On Tue, 16 Jan 2007, yannig goude wrote:

> Hi,

>  I have a problem with the ARIMA function, occuring when I set the 
> parameter per (the period of SARIMA model) to a high value (see the 
> exemple bellow). It seems that when per is high it takes a too large 
> amount of memory to calculate the model and I have a memory storage 
> error. But I don't really understand why it takes more memory when per 
> is high, as there is the same number of parameter to estimate.

Try arima0.

>  Does anyone know what to do?
>
>  exemple:
>  x = arima.sim(list(order=c(1,0,0), ar=.9), n=1000)
> per<-200
> arima(x, order = c(1, 0, 0),seasonal = list(order =c(1, 0, 0), period =per),
 method='CSS')
>  fails whereas for per=175 it works well.
>
>
>
>
>
>
>
> -
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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

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


[R] SARIMA problem

2007-01-16 Thread yannig goude
Hi, 
  I have a problem with the ARIMA function, occuring when I set the parameter 
per (the period of SARIMA model) to a high value (see the exemple bellow). It 
seems that when per is high it takes a too large amount of memory to calculate 
the model and I have a memory storage error. But I don't really understand why 
it takes more memory when per is high, as there is the same number of parameter 
to estimate.
  Does anyone know what to do?
   
  exemple:
  x = arima.sim(list(order=c(1,0,0), ar=.9), n=1000)
per<-200
arima(x, order = c(1, 0, 0),seasonal = list(order =c(1, 0, 0), period 
=per),method='CSS')
  fails whereas for per=175 it works well.
   
  
 
   
   


-

[[alternative HTML version deleted]]

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


Re: [R] Gaussian glm for grouped data with unequal variances

2007-01-16 Thread Thilo Kellermann
Hi,
I would suggest to use lme for doing that:
library(nlme)
vf1Ident <- varIdent( c(m = 0.5), form = ~ 1 | group )
fm.lme <- lme(data ~ group, weights = vf1Ident. data = DATA)
anova(fm.lme)

Hope this helps,
Thilo


On Tuesday 16 January 2007 10:30, Dawn Ashcourt wrote:
> Hello - I am fairly new to R, (i.e., ability to create functions/write
> programs insignificant) and was wondering if there might be a convenient
> way to model the following: I want to fit a gaussian glm to grouped data,
> while allowing for unequal variances in each of the groups.
> More specifically, my data set looks something like this:
> 
>data group
> 176 1
> 282 1
> 383 1
> 454 1
> 535 1
> 646 1
> 787 1
> 868 1
> 987 2
> 10   95 2
> 11   98 2
> 12  100 2
> 13  109 2
> 14  109 2
> 15  100 2
> 16   81 2
> 17   75 2
> 18   68 2
> 19   67 2
> 20  105 3
>  et cetera.
> ---
> There are seven groups in all, each with a different number of
> observations. The idea is to compare a model in which all the data points
> can be modeled with a single mean (i.e., if all the group means are equal),
> or if the  data suggests that each of the groups has a different mean. In
> other words, I want to do a Likelihood ratio test on whether or not the
> group means are significantly different from each other: the full model
> would be glm(data ~ as.factor(group)-1, family = gaussian), to be compared
> against a restricted model that only includes an intercept. However, I also
> need to allow for the fact that each group has a different variance. And
> this I have no idea how to do. I would really appreciate some help in this
> matter.
> Thank you in advance,
> Dawn.
>
>   [[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html and provide commented, minimal,
> self-contained, reproducible code.

-- 

Thilo Kellermann
Department of Psychiatry und Psychotherapy
RWTH Aachen University
Pauwelstr. 30
52074 Aachen
Tel.: +49 (0)241 / 8089977
Fax.: +49 (0)241 / 8082401
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Gaussian glm for grouped data with unequal variances

2007-01-16 Thread Chuck Cleland
Dawn Ashcourt wrote:
> Hello - I am fairly new to R, (i.e., ability to create functions/write
> programs insignificant) and was wondering if there might be a convenient way
> to model the following: I want to fit a gaussian glm to grouped data, while
> allowing for unequal variances in each of the groups.
> More specifically, my data set looks something like this:
> 
>data group
> 176 1
> 282 1
> 383 1
> 454 1
> 535 1
> 646 1
> 787 1
> 868 1
> 987 2
> 10   95 2
> 11   98 2
> 12  100 2
> 13  109 2
> 14  109 2
> 15  100 2
> 16   81 2
> 17   75 2
> 18   68 2
> 19   67 2
> 20  105 3
>  et cetera.
> ---
> There are seven groups in all, each with a different number of observations.
> The idea is to compare a model in which all the data points can be modeled
> with a single mean (i.e., if all the group means are equal), or if the  data
> suggests that each of the groups has a different mean. In other words, I
> want to do a Likelihood ratio test on whether or not the group means are
> significantly different from each other: the full model would be glm(data ~
> as.factor(group)-1, family = gaussian), to be compared against a restricted
> model that only includes an intercept. However, I also need to allow for the
> fact that each group has a different variance. And this I have no idea how
> to do. I would really appreciate some help in this matter.

  Have you considered oneway.test()?  For example:

## Not assuming equal variances
oneway.test(breaks ~ tension, data = warpbreaks)

One-way analysis of means (not assuming equal variances)

data:  breaks and tension
F = 5.8018, num df = 2.00, denom df = 32.32, p-value = 0.007032

> Thank you in advance,
> Dawn.
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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

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


Re: [R] Request regarding cluster package

2007-01-16 Thread Uwe Ligges


Bhanu Kalyan.K wrote:
> Dear Mr. Bengtsson,
> 
> I see that there is a package exclusively for clustering data, named as 
> "Cluster Package" in R library. It has some clustering algorithms 
> implemented. 
> Can you tell me how to implement the CLARA and PAM functions from that 
> package for my data?


What about typing

library("cluster")
?pam
?clara

Uwe Ligges


> 
> Bhanu Kalyan K
> B.Tech Final Year, CSE
> 
> Tel: +91-9885238228
> 
> Alternate E-Mail: 
> [EMAIL PROTECTED]
> 
>  
> -
> 8:00? 8:25? 8:40?  Find a flick in no time
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] "[[" gotcha

2007-01-16 Thread Prof Brian Ripley
On Tue, 16 Jan 2007, Robin Hankin wrote:

> The following gotcha caught me off-guard just now.

Checking the relevant help page is always a good idea (and that is why the 
posting guide asks that you do so before posting).

> I have two matrices, a and b:
>
>
> a <- matrix(1,3,3)
> b <- matrix(1,1,1)
>
> (note that both "a" and "b" are matrices).
>
> I want them in a list:
>
> > B <- NULL

So why did you not create a list, e.g. by list() or vector("list", 2)?

> > B[[1]] <- a
> > B[[2]] <- b
> > B
> [[1]]
>  [,1] [,2] [,3]
> [1,]111
> [2,]111
> [3,]111
>
> [[2]]
>  [,1]
> [1,]1
>
> >
>
> This is fine.
>
> But swapping "a" and "b" over does not behave as desired:
>
>
> > B <- NULL
> > B[[1]] <- b
> > B[[2]] <- a
> Error in B[[2]] <- a : more elements supplied than there are to replace
> >
>
>
>
> The error is given because after B[[1]] <- a,   the variable B is
> just a scalar and
> not a matrix (why is this?)

You said wanted a list, and got a numeric vector (R has no scalars).
In your first example you got a length-one list, not a matrix.

The type-promotion rules for [<- and [[<- are complex, and you should not 
rely on knowing what they currently are (they do change from time to 
time).  But this one is right there on the help page (?"[["):

  When '$<-' is applied to a 'NULL' 'x', it first coerces 'x' to
  'list()'.  This is what also happens with '[[<-' if the
  replacement value 'value' is of length greater than one: if
  'value' has length 1 or 0, 'x' is first coerced to a zero-length
  vector of the type of 'value'.

> What's the bulletproof method for assigning matrices to a list (whose 
> length is not known at runtime)?

Start with a list.

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

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


Re: [R] "[[" gotcha

2007-01-16 Thread Joerg van den Hoff
Robin Hankin wrote:
> The following gotcha caught me off-guard just now.
> 
> I have two matrices, a and b:
> 
> 
> a <- matrix(1,3,3)
> b <- matrix(1,1,1)
> 
> (note that both "a" and "b" are matrices).
> 
> I want them in a list:
> 
>  > B <- NULL
>  > B[[1]] <- a
>  > B[[2]] <- b
>  > B
> [[1]]
>   [,1] [,2] [,3]
> [1,]111
> [2,]111
> [3,]111
> 
> [[2]]
>   [,1]
> [1,]1
> 
>  >
> 
> This is fine.
> 
> But swapping "a" and "b" over does not behave as desired:
> 
> 
>  > B <- NULL
>  > B[[1]] <- b
>  > B[[2]] <- a
> Error in B[[2]] <- a : more elements supplied than there are to replace
>  >
> 
> 
> 
> The error is given because after B[[1]] <- a,   the variable B is  
> just a scalar and
> not a matrix (why is this?)
> 
> What's the bulletproof method for assigning matrices to a list (whose  
> length is
> not known at runtime)?
> 
> 
not sure about "bulletproof", but:

you should tell R that B is really intended to be a list in the first place:

B <- list()

the rest then works as you intended. whether the 'simplification' of your 1x1 
matrix to
a scalar in your example is canonical (and desirable) behaviour seems a 
question for some 
of the experts (it's a bit reminiscent of the `drop = TRUE' vs. `drop = FALSE' 
problem)

joerg
> 
> 
> 
> 
> 
> 
> --
> Robin Hankin
> Uncertainty Analyst
> National Oceanography Centre, Southampton
> European Way, Southampton SO14 3ZH, UK
>   tel  023-8059-7743
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] "[[" gotcha

2007-01-16 Thread Henrik Bengtsson
To create a empty list do:

   B <- list()

/H


On 1/16/07, Robin Hankin <[EMAIL PROTECTED]> wrote:
> The following gotcha caught me off-guard just now.
>
> I have two matrices, a and b:
>
>
> a <- matrix(1,3,3)
> b <- matrix(1,1,1)
>
> (note that both "a" and "b" are matrices).
>
> I want them in a list:
>
>  > B <- NULL
>  > B[[1]] <- a
>  > B[[2]] <- b
>  > B
> [[1]]
>   [,1] [,2] [,3]
> [1,]111
> [2,]111
> [3,]111
>
> [[2]]
>   [,1]
> [1,]1
>
>  >
>
> This is fine.
>
> But swapping "a" and "b" over does not behave as desired:
>
>
>  > B <- NULL
>  > B[[1]] <- b
>  > B[[2]] <- a
> Error in B[[2]] <- a : more elements supplied than there are to replace
>  >
>
>
>
> The error is given because after B[[1]] <- a,   the variable B is
> just a scalar and
> not a matrix (why is this?)
>
> What's the bulletproof method for assigning matrices to a list (whose
> length is
> not known at runtime)?
>
>
>
>
>
>
>
>
> --
> Robin Hankin
> Uncertainty Analyst
> National Oceanography Centre, Southampton
> European Way, Southampton SO14 3ZH, UK
>   tel  023-8059-7743
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


Re: [R] "[[" gotcha

2007-01-16 Thread Petr Pikal
Hi

try different way of list definition, see below.

On 16 Jan 2007 at 10:10, Robin Hankin wrote:

From:   Robin Hankin <[EMAIL PROTECTED]>
Date sent:  Tue, 16 Jan 2007 10:10:42 +
To: RHelp help 
Subject:[R] "[[" gotcha

> The following gotcha caught me off-guard just now.
> 
> I have two matrices, a and b:
> 
> 
> a <- matrix(1,3,3)
> b <- matrix(1,1,1)
> 
> (note that both "a" and "b" are matrices).
> 
> I want them in a list:
> 

B<-vector("list", 2)
B[[1]]<-a
B[[1]]<-b

here is no complain.
HTH
Petr

>  > B <- NULL
>  > B[[1]] <- a
>  > B[[2]] <- b
>  > B
> [[1]]
>   [,1] [,2] [,3]
> [1,]111
> [2,]111
> [3,]111
> 
> [[2]]
>   [,1]
> [1,]1
> 
>  >
> 
> This is fine.
> 
> But swapping "a" and "b" over does not behave as desired:
> 
> 
>  > B <- NULL
>  > B[[1]] <- b
>  > B[[2]] <- a
> Error in B[[2]] <- a : more elements supplied than there are to
> replace
>  >
> 
> 
> 
> The error is given because after B[[1]] <- a,   the variable B is 
> just a scalar and not a matrix (why is this?)
> 
> What's the bulletproof method for assigning matrices to a list (whose 
> length is not known at runtime)?
> 
> 
> 
> 
> 
> 
> 
> 
> --
> Robin Hankin
> Uncertainty Analyst
> National Oceanography Centre, Southampton
> European Way, Southampton SO14 3ZH, UK
>   tel  023-8059-7743
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html and provide commented,
> minimal, self-contained, reproducible code.

Petr Pikal
[EMAIL PROTECTED]

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


Re: [R] "[[" gotcha

2007-01-16 Thread Barry Rowlingson
Robin Hankin wrote:

> The error is given because after B[[1]] <- a,   the variable B is  
> just a scalar and
> not a matrix (why is this?)
> 

  Because [[i]] indexes more general vectors, and if you do B[[1]] when 
B is NULL, R doesnt know if you want B to be a list or a simple vector.

  If you initialise B as an empty list then R knows:

  > B=list()
  > B
  list()
  > B[[1]]=b
  > B
  [[1]]
   [,1]
  [1,]1

Barry

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


Re: [R] Fast Removing Duplicates from Every Column

2007-01-16 Thread Petr Pikal
Hi

I have no idea how Test data look like. However help pages of 
functions

data.frame()
as.data.frame()
str()

and maybe few others can help you find how to change objects to data 
frames.

HTH
Petr


On 16 Jan 2007 at 10:36, Bert Jacobs wrote:

From:   "Bert Jacobs" <[EMAIL PROTECTED]>
To: "'Petr Pikal'" <[EMAIL PROTECTED]>
Subject:RE: [R] Fast Removing Duplicates from Every Column
Date sent:  Tue, 16 Jan 2007 10:36:42 +0100

> Hi Petr,
> 
> Thx for answeringen me on the question below.
> Actually I could use this line of code to get my problem solved.
> 
> Test = apply(X=my_data, MARGIN=2, FUN=unique)
> 
> Now I was wondering how to transform 'Test' into a dataframe, while
> there are different rows implied.
> 
> Thx,
> Bert
> 
> _
> 
> Bert Jacobs
> Marketing Intelligence Engineer
> Plasveldlaan 5
> 9400 Ninove
> Tel: 0477/68.74.07
> Fax: 054/25.00.35
> E-mail: [EMAIL PROTECTED]
> 
> -Original Message-
> From: Petr Pikal [mailto:[EMAIL PROTECTED] 
> Sent: 05 January 2007 11:51
> To: Bert Jacobs; 'R help list'
> Subject: Re: [R] Fast Removing Duplicates from Every Column
> 
> Hi
> 
> I am not sure if I understand how do you want to select unique items.
> 
> with
>  sapply(DF, function(x) !duplicated(x))
> you can get data frame with TRUE when an item in particular column is
> unique and FALSE in opposite. However then you need to choose which
> rows to keep or discard
> 
> e.g.
> 
> DF[rowSums(sapply(comp, function(x) !duplicated(x)))>1,]
> 
> selects all rows in which are 2 or more unique values.
> 
> HTH
> Petr
> 
> 
> On 5 Jan 2007 at 9:54, Bert Jacobs wrote:
> 
> From: "Bert Jacobs" <[EMAIL PROTECTED]>
> To:   "'R help list'" 
> Date sent:Fri, 5 Jan 2007 09:54:17 +0100
> Subject:  Re: [R] Fast Removing Duplicates from Every Column
> 
> > Hi,
> > 
> > I'm looking for some lines of code that does the following:
> > I have a dataframe with 160 Columns and a number of rows (max 30):
> > 
> >   Col1 Col2 Col3 ... Col 159 Col 160 
> > Row 1   0   0   LD ... 0   VD 
> > Row 2   HD  0   00 MD 
> > Row 3   0   HD  HD   0   LD 
> > Row 4   LD  HD  HD   0 LD 
> > ... ...
> > LastRow HDHDLD 0   MD
> > 
> > 
> > Now I want a dataframe that looks like this. As you see all
> > duplicates are removed. Can this dataframe be constructed in a fast
> > way?
> > 
> >   Col1 Col2 Col3 ... Col 159 Col 160 
> > Row 1   00LD   0VD
> > Row 2   HD   HD   00MD
> > Row 3   LD   0HD   0LD
> > 
> > Thx for helping me out.
> > Bert
> > 
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html and provide commented,
> > minimal, self-contained, reproducible code.
> 
> Petr Pikal
> [EMAIL PROTECTED]
> 
> 

Petr Pikal
[EMAIL PROTECTED]

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


[R] Request regarding cluster package

2007-01-16 Thread Bhanu Kalyan.K
Dear Mr. Bengtsson,

I see that there is a package exclusively for clustering data, named as 
"Cluster Package" in R library. It has some clustering algorithms implemented. 
Can you tell me how to implement the CLARA and PAM functions from that package 
for my data?


Bhanu Kalyan K
B.Tech Final Year, CSE

Tel: +91-9885238228

Alternate E-Mail: 
[EMAIL PROTECTED]

 
-
8:00? 8:25? 8:40?  Find a flick in no time

[[alternative HTML version deleted]]

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


[R] "[[" gotcha

2007-01-16 Thread Robin Hankin
The following gotcha caught me off-guard just now.

I have two matrices, a and b:


a <- matrix(1,3,3)
b <- matrix(1,1,1)

(note that both "a" and "b" are matrices).

I want them in a list:

 > B <- NULL
 > B[[1]] <- a
 > B[[2]] <- b
 > B
[[1]]
  [,1] [,2] [,3]
[1,]111
[2,]111
[3,]111

[[2]]
  [,1]
[1,]1

 >

This is fine.

But swapping "a" and "b" over does not behave as desired:


 > B <- NULL
 > B[[1]] <- b
 > B[[2]] <- a
Error in B[[2]] <- a : more elements supplied than there are to replace
 >



The error is given because after B[[1]] <- a,   the variable B is  
just a scalar and
not a matrix (why is this?)

What's the bulletproof method for assigning matrices to a list (whose  
length is
not known at runtime)?








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

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


Re: [R] Help with labeling a page with multiple graphs.

2007-01-16 Thread Chuck Cleland
Rob Keller wrote:
> Hi,
> 
> I am trying to output pdf files with 8 graphs per page. My current study 
> has 8 evaluation criteria, and 38 study conditions. This would result in 
> 38 pages of 8 graphs. I have figured out how to get the graphs looking 
> like I would like them, and I am using the layout() function to put them 
> on the page, as that allows me the control I would like over the 
> appearance of the individual plots. What I can't figure out is how to 
> put a page title on each page. Something simple like, "Condition X" at 
> the top of each page. A second line of title would also be nice. Any 
> help is truely appreciated.

  RSiteSearch("title multiple figure") shows the following possibilities:

http://finzi.psych.upenn.edu/R/library/sfsmisc/html/mult.fig.html

http://finzi.psych.upenn.edu/R/library/Hmisc/html/mtitle.html

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

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

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


Re: [R] nonlinear regression: nls, gnls, gnm, other?

2007-01-16 Thread Prof Brian Ripley
On Tue, 16 Jan 2007, Turner, Heather wrote:

> Hi Johann,
>
> The current version of gnm is unable to fit this type of model, though a
> new version with more flexibility is soon to be released.
>
> In any case, you probably want to use nls or gnls, depending on the
> assumptions that can be made about the model errors. For nls it is usual
> to assume that the errors are normally distributed with mean zero and
> constant variance, though the normal assumption is not strictly
> necessary. If you have reason to think the errors are correlated and/or
> have unequal variances, then gnls would be appropriate.

nls is able to handle unequal variances since 2.3.0: from the help

  weights: an optional numeric vector of (fixed) weights.  When present,
   the objective function is weighted least squares.


>
> The examples on ?nls may be enough to get you started,
>
> Heather
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Johann Hibschman
> Sent: 16 January 2007 04:05
> To: Turner, Heather; r-help
> Subject: [R] nonlinear regression: nls, gnls, gnm, other?
>
> Hi all,
>
> I'm trying to fit a nonlinear (logistic-like) regression, and I'd like
> to get some recommendations for which package to use.
>
> The expression I want to fit is something like:
>
> y ~ A * exp(X * Beta1) / (1 + exp(-(x + X * Beta2 - xmid)/scal))
>
> Basically, it's a logistic function, but I want to be able to modify
> the saturation amplitude by a few parameters (Beta1) and shift the
> inflection point around with a few other parameters (Beta2).  I have a
> ton of data, but I often have trouble getting the routine to fit.
> (I've been using nlin in SAS, which seems sloppier in terms of
> accepted convergence.)
>
> Now, from what I can tell, I can use nls, gnls, or gnm to fit
> something like this, but I can't tell which would be better, or if
> there's something else I should be trying.  To do this right, though,
> I have to do a lot more reading, but I'd like to know where to start.
>
> (I have more of a physics/computer background, so I immediately jump
> to thinking of regression as minimizing some cost function across a
> multidimensional space and then start mumbling about simulated
> annealing or some such, but this isn't helping me much in interpreting
> the available literature.)
>
> So, does anyone have any suggestions?  I imagine I'm going to have to
> pick up a book, but should it be Pinheiro & Bates on nlme, Bates &
> Watts, the pdf manual to gnm, or what?
>
> Thanks for any suggestions,
>
> Johann
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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

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


Re: [R] How to format R code in LaTex documents

2007-01-16 Thread John C Frain
I often produce program listings  in my  LaTeX documents.  I use the
verbatim environment but use commands such as

\addtolength{\oddsidemargin}{-0.95in}
\addtolength{\evensidemargin}{-0.95in}

to widen the printed page so that I do not have to resort to line
continuation characters.  This method is simple and you can experiment with
values other than 0.95in  to find the value most appropriate to you

John

On 15/01/07, Benjamin Dickgiesser <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I am planning on putting some R script in an appendix of a LaTex
> document. Can anyone recommend me a way of how to format it? Is there
> a way to keep all line breaks without having to insert \\ in every
> single line?
>
> Thank you!
> Benjamin
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
John C Frain
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]

[[alternative HTML version deleted]]

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


[R] Gaussian glm for grouped data with unequal variances

2007-01-16 Thread Dawn Ashcourt
Hello - I am fairly new to R, (i.e., ability to create functions/write
programs insignificant) and was wondering if there might be a convenient way
to model the following: I want to fit a gaussian glm to grouped data, while
allowing for unequal variances in each of the groups.
More specifically, my data set looks something like this:

   data group
176 1
282 1
383 1
454 1
535 1
646 1
787 1
868 1
987 2
10   95 2
11   98 2
12  100 2
13  109 2
14  109 2
15  100 2
16   81 2
17   75 2
18   68 2
19   67 2
20  105 3
 et cetera.
---
There are seven groups in all, each with a different number of observations.
The idea is to compare a model in which all the data points can be modeled
with a single mean (i.e., if all the group means are equal), or if the  data
suggests that each of the groups has a different mean. In other words, I
want to do a Likelihood ratio test on whether or not the group means are
significantly different from each other: the full model would be glm(data ~
as.factor(group)-1, family = gaussian), to be compared against a restricted
model that only includes an intercept. However, I also need to allow for the
fact that each group has a different variance. And this I have no idea how
to do. I would really appreciate some help in this matter.
Thank you in advance,
Dawn.

[[alternative HTML version deleted]]

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


[R] Help with labeling a page with multiple graphs.

2007-01-16 Thread Rob Keller
Hi,

I am trying to output pdf files with 8 graphs per page. My current study 
has 8 evaluation criteria, and 38 study conditions. This would result in 
38 pages of 8 graphs. I have figured out how to get the graphs looking 
like I would like them, and I am using the layout() function to put them 
on the page, as that allows me the control I would like over the 
appearance of the individual plots. What I can't figure out is how to 
put a page title on each page. Something simple like, "Condition X" at 
the top of each page. A second line of title would also be nice. Any 
help is truely appreciated.

rob

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


Re: [R] nonlinear regression: nls, gnls, gnm, other?

2007-01-16 Thread Turner, Heather
Hi Johann,

The current version of gnm is unable to fit this type of model, though a
new version with more flexibility is soon to be released.

In any case, you probably want to use nls or gnls, depending on the
assumptions that can be made about the model errors. For nls it is usual
to assume that the errors are normally distributed with mean zero and
constant variance, though the normal assumption is not strictly
necessary. If you have reason to think the errors are correlated and/or
have unequal variances, then gnls would be appropriate.

The examples on ?nls may be enough to get you started,

Heather

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Johann Hibschman
Sent: 16 January 2007 04:05
To: Turner, Heather; r-help
Subject: [R] nonlinear regression: nls, gnls, gnm, other?

Hi all,

I'm trying to fit a nonlinear (logistic-like) regression, and I'd like
to get some recommendations for which package to use.

The expression I want to fit is something like:

y ~ A * exp(X * Beta1) / (1 + exp(-(x + X * Beta2 - xmid)/scal))

Basically, it's a logistic function, but I want to be able to modify
the saturation amplitude by a few parameters (Beta1) and shift the
inflection point around with a few other parameters (Beta2).  I have a
ton of data, but I often have trouble getting the routine to fit.
(I've been using nlin in SAS, which seems sloppier in terms of
accepted convergence.)

Now, from what I can tell, I can use nls, gnls, or gnm to fit
something like this, but I can't tell which would be better, or if
there's something else I should be trying.  To do this right, though,
I have to do a lot more reading, but I'd like to know where to start.

(I have more of a physics/computer background, so I immediately jump
to thinking of regression as minimizing some cost function across a
multidimensional space and then start mumbling about simulated
annealing or some such, but this isn't helping me much in interpreting
the available literature.)

So, does anyone have any suggestions?  I imagine I'm going to have to
pick up a book, but should it be Pinheiro & Bates on nlme, Bates &
Watts, the pdf manual to gnm, or what?

Thanks for any suggestions,

Johann

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

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


Re: [R] feedback on "writing r extensions"

2007-01-16 Thread Martin Maechler
> "Scott" == Scott Harrison <[EMAIL PROTECTED]>
> on Mon, 15 Jan 2007 13:15:09 -0500 writes:

Scott> Hi, To whom should I send feedback/edits concerning
Scott> the "Writing R Extensions" web page?

Scott> http://cran.r-project.org/doc/manuals/R-exts.html

To R-devel (the mailing list), usually;
If it's just simple typos, maybe just to R-core directly.

For "edits", we'd mostly like to receive feedback on the
*source* of the above automatically produced document
(which is also the source of the PDF version, same URL as above,
 just replace ".html" by ".pdf")

The development source is always available at
  https://svn.r-project.org/R/trunk/doc/manual/R-exts.texi

Thanking you for offering feedback,
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
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R graphics with Linux (libpng)

2007-01-16 Thread Rebecca Tagett
Prof Brian Ripley  stats.ox.ac.uk> writes:

> 
> On Thu, 11 Jan 2007, Rebecca Tagett wrote:
> 
> > Hello,
> >
> > I'm trying to adapt some R code that works on Windows so that it will work
> > on a Linux machine.
> >
> > The command :
> >
> > png("myFile.png", width=600, height=600)
> >
> > fails claiming that it is impossible to establish a connection with X11.
> > (Error messages are in French, so I'm not pasting them here!)
> >
> >
> >
> > I have libpng installed:
> >
> >> rpm -qa libpng*
> >
> > libpng-1.0.12-2
> >
> > libpng-devel-1.0.12-2
> >
> >
> >
> > So I don't understand why R thinks I'm trying to connect to X11. I haven't
> > been able to find many examples of R graphics code specifically for Linux,
> > but I have the impression that if libpng is installed, the graphics 
commands
> > are identical. The libpng manual is not useful, because it does not mention
> > use of libpng commands in an R environment.
> 
> ?png says
> 
>   R can be compiled without support for either or both of these
>   devices: this will be reported if you attempt to use them on a
>   system where they are not supported.  They may not be usable
>   unless the X11 display is available to the owner of the R process.
> 
> Note:
> 
>   These are based on the 'X11' device, so the additional arguments
>   to that device work, but are rarely appropriate.  The colour
>   handling will be that of the 'X11' device in use.
> 
>   'bitmap' provides an alternative way to generate PNG and JPEG
>   plots that does not depend on accessing the X11 display but does
>   depend on having GhostScript installed.  (Device 'GDD' in CRAN
>   package 'GDD' is another alternative using several other
>   additional pieces of software.)
> 
> so the help page seems quite specific about the connection to X11.


I was referring to the libpng manual (see above), and not the R help page.

The 'Devices' help page is the one that threw me off course. It states that
X11 is the graphics driver for the X11 Window system, which I took to mean "MS 
Windows" as opposed to "X window", thus I was surprised that Linux should go 
looking for such a thing. I'm now wading through "R installation and 
administration", which is very useful. Our systems manager is away, so your 
patience is appreciated.

> 
> > I'm using R 2.4.1, which I recently installed. Do I have to install a more
> > recent libpng ? If so, do I have to reconfigure and remake R ?
> 
> The libpng is very old, but even more likely is that libz is too old.
> There were messages when you configured: did you read them at all?  If 
> not, plese do rebuild R and read them this time.  Without the exact 
> error message I cannot be sure, but I don't think this is the problem.

There were no errors on installation. However, I see that libz came with the R 
package (it is in .../R-2.4.1/src/extra/zlib/libz.a), so it would have been 
correctly installed along with the rest. Evidently libpng does not come with 
the package. I'll download the recent version, install it, rebuild R, and try 
to find out why my Linux doesn't recognize X11. Or perhaps I'll use bitmap() 
with ghostscript, as Benilton Carvalho suggested.

> 
> > I've also read that no graphics devices are available under R CMD BATCH.
> > Does that really mean that I can't create graphics from some R code that I
> > launch in noninteractive mode?
> 
> Your source is incorrect: please advise the author(s) to correct it.

The source is the 'Devices' help page :
QUOTE 
 The following devices will be available if R was compiled to use
 them and started with the appropriate '--gui' argument:

*  'X11' The graphics driver for the X11 Window system

*  'png' PNG bitmap device

*  'jpeg' JPEG bitmap device

 None of these are available under 'R CMD BATCH'.
UNQUOTE
(no authors listed)


> 
> Did you also read that you are asked not to send HTML mail? (That is from 
> a reliable source.)

I knew that. I didn't do it on purpose... so very sorry. 

Thanks.

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


[R] Mailing list attachments

2007-01-16 Thread Martin Maechler
> "PhGr" == Philippe Grosjean <[EMAIL PROTECTED]>
> on Mon, 15 Jan 2007 18:56:00 +0100 writes:

PhGr> 
PhGr> I will attach it to a second email send privately to
PhGr> you, since the mailing list do not accept attachments.

That's not correct.
http://www.r-project.org/mail.html  (search for "attachment")
explains that most ** binary ** attachments are not accepted,
lists the exceptions and further says that  
text/plain is well accepted
(BTW,  text/html is accepted too, but translated to text/plain
 by the filters)

One problem is that many e-mail client programs do not seem to
let you attach "text/plain" easily.

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
and provide commented, minimal, self-contained, reproducible code.