Re: [R] cointegration analysis

2007-08-08 Thread gyadav

regrets
typo error - please read 'date' as 'data'


---
  Regards,
Gaurav Yadav (mobile: +919821286118)
Assistant Manager, CCIL, Mumbai (India)
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
Profile: http://www.linkedin.com/in/gydec25
  Keep in touch and keep mailing :-)
slow or fast, little or too much




[EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED]
08/09/2007 11:49 AM

To
Dorina LAZAR <[EMAIL PROTECTED]>
cc
r-help@stat.math.ethz.ch, [EMAIL PROTECTED]
Subject
Re: [R] cointegration analysis







i got this error, i dont remember what was the cause, but what i did work 
around was that see the example in the manual pages of the ca.po... etc 
and try to make your date in the same format. also just see whether the 
functions will take so many columns as a parameter. I have not checked it. 

Lastly see whether the data what you are using is not having any missing 
values or number in 'text' format


HTH



Dorina LAZAR <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
08/08/2007 10:15 PM

To
r-help@stat.math.ethz.ch
cc

Subject
[R] cointegration analysis







Hello,

I tried to use urca package (R) for cointegration analysis. The data
matrix to be investigated for cointegration contains 8 columns
(variables). Both procedures, Phillips & Ouliaris test and Johansen's
procedures give errors ("error in evaluating the argument 'object' in
selecting a method for function 'summary'" respectiv "too many
variables, critical values cannot be computed”). What can I do?

With regards,

Dorina LAZAR
Department of Statistics, Forecasting, Mathematics
Babes Bolyai University, Faculty of Economic Science
Teodor Mihali 58-60, 400591 Cluj-Napoca, Romania

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 AND CONFIDENTIALITY CAUTION:

This message and any attachments with it (the "message") are confidential 
and intended
solely for the addressees. Unauthorized reading, copying, dissemination, 
distribution or
disclosure either whole or partial, is prohibited. If you receive this 
message in error,
please delete it and immediately notify the sender. Communicating through 
email is not
secure and capable of interception, corruption and delays. Anyone 
communicating with The
Clearing Corporation of India Limited (CCIL) by email accepts the risks 
involved and their
consequences. The internet can not guarantee the integrity of this 
message. CCIL shall
(will) not therefore be liable for the message if modified. The recipient 
should check this
email and any attachments for the presence of viruses. CCIL accepts no 
liability for any
damage caused by any virus transmitted by this email.

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




DISCLAIMER AND CONFIDENTIALITY CAUTION:

This message and any attachments with it (the "message") are confidential and 
intended
solely for the addressees. Unauthorized reading, copying, dissemination, 
distribution or
disclosure either whole or partial, is prohibited. If you receive this message 
in error,
please delete it and immediately notify the sender. Communicating through email 
is not
secure and capable of interception, corruption and delays. Anyone communicating 
with The
Clearing Corporation of India Limited (CCIL) by email accepts the risks 
involved and their
consequences. The internet can not guarantee the integrity of this message. 
CCIL shall
(will) not therefore be liable for the message if modified. The recipient 
should check this
email and any attachments for the presence of viruses. CCIL accepts no 
liability for any
damage caused by any virus transmitted by this email.

[[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] cointegration analysis

2007-08-08 Thread gyadav

i got this error, i dont remember what was the cause, but what i did work 
around was that see the example in the manual pages of the ca.po... etc 
and try to make your date in the same format. also just see whether the 
functions will take so many columns as a parameter. I have not checked it. 
Lastly see whether the data what you are using is not having any missing 
values or number in 'text' format


HTH



Dorina LAZAR <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
08/08/2007 10:15 PM

To
r-help@stat.math.ethz.ch
cc

Subject
[R] cointegration analysis







Hello,

I tried to use urca package (R) for cointegration analysis. The data
matrix to be investigated for cointegration contains 8 columns
(variables). Both procedures, Phillips & Ouliaris test and Johansen's
procedures give errors ("error in evaluating the argument 'object' in
selecting a method for function 'summary'" respectiv "too many
variables, critical values cannot be computed”). What can I do?

With regards,

Dorina LAZAR
Department of Statistics, Forecasting, Mathematics
Babes Bolyai University, Faculty of Economic Science
Teodor Mihali 58-60, 400591 Cluj-Napoca, Romania

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 AND CONFIDENTIALITY CAUTION:

This message and any attachments with it (the "message") are confidential and 
intended
solely for the addressees. Unauthorized reading, copying, dissemination, 
distribution or
disclosure either whole or partial, is prohibited. If you receive this message 
in error,
please delete it and immediately notify the sender. Communicating through email 
is not
secure and capable of interception, corruption and delays. Anyone communicating 
with The
Clearing Corporation of India Limited (CCIL) by email accepts the risks 
involved and their
consequences. The internet can not guarantee the integrity of this message. 
CCIL shall
(will) not therefore be liable for the message if modified. The recipient 
should check this
email and any attachments for the presence of viruses. CCIL accepts no 
liability for any
damage caused by any virus transmitted by this email.

[[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] R2WinBUGS results not different with different runs

2007-08-08 Thread Gregor Gorjanc
  gmail.com> writes:
> 
> Gregor Gorjanc wrote:
> >   gmail.com> writes:
> > 
> >>Is this a specialty with R2WinBUGS? Does it have something to do with the 
> >>seed value? Isnt the seed value reset everytime I restart winbugs?
> > 
> > I always have the same seed if I start WinBUGS multiple times.
> 
> So you get exactly the same chain, numerically, when rerunning the same 
>  model, with the same number of iterations, everything the same.?

I just tried now with Gelman's schools example from bugs() help page. I runned
the same job twice, with exactly the same initial values. Notes that WinBUGS
uses always the same starting seed. I got this

> schools.sim$last.values
[[1]]
[[1]]$theta
[1] 23.700 10.060 12.760 13.090  1.693 14.390  7.599  3.961

[[1]]$mu.theta
[1] 25.03

[[1]]$sigma.theta
[1] 20.08



> schools.sim2$last.values
[[1]]
[[1]]$theta
[1] 23.700 10.060 12.760 13.090  1.693 14.390  7.599  3.961

[[1]]$mu.theta
[1] 25.03

[[1]]$sigma.theta
[1] 20.08

> Wouldnt that be problematic if every researcher in the world who uses winbugs 
> uses the same sequence of random numbers?
> 
> R's random numbers are different each time, because the seed is linked to the 
> clock in your PC.

You can reset the seed if you want. Having the same seed is also nice for 
repeatability.

Gregor

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Reading time/date string

2007-08-08 Thread Mark W Kimpel
Look at some of these functions...

DateTimeClasses(base)   Date-Time Classes
as.POSIXct(base)Date-time Conversion Functions
cut.POSIXt(base)Convert a Date or Date-Time Object to a Factor
format.Date(base)   Date Conversion Functions to and from Character

Mark
---

Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
Indiana University School of Medicine

15032 Hunter Court, Westfield, IN  46074

(317) 490-5129 Work, & Mobile & VoiceMail
(317) 663-0513 Home (no voice mail please)

**

Matthew Walker wrote:
> Hello everyone,
> 
> Can anyone tell me what function I should use to read time/date strings 
> and turn them into a form such that I can easily calculate the 
> difference of two?  The strings I've got look like "10:17:07 02 Aug 
> 2007".  If I could calculate the number of seconds between them I'd be 
> very happy!
> 
> Cheers,
> 
> Matthew
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] plot table with sapply - labeling problems

2007-08-08 Thread Alexander.Herr
Hi List,

I am trying to label a barplot group with variable names when using
sapply unsucessfully.
I can't seem to extract the names for the indiviual plots:

test<-as.data.frame(cbind(round(runif(50,0,5)),round(runif(50,0,3)),roun
d(runif(50,0,4
sapply(test, table)->vardist
sapply(test, function(x) round(table(x)/sum(table(x))*100,1) )->vardist1
   par(mfrow=c(1,3))
 sapply(vardist1, function(x) barplot(x,
ylim=c(0,100),main="Varset1",xlab=names(x)))
   par(mfrow=c(1,1))
  
Names don't show up although names(vardist) works.

Also I would like to put a single Title on this plot instead of
repeating "Varset" three times.

Any hints appreciated.

Thanx
Herry

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] tcltk error on Linux

2007-08-08 Thread Mark W Kimpel
I am having trouble getting tcltk package to load on openSuse 10.2 
running R-devel. I have specifically put my /usr/share/tcl directory in 
my PATH, but R doesn't seem to see it. I also have installed tk on my 
system. Any ideas on what the problem is?

Also, note that I have some warning messages on starting up R, not sure 
what they mean or if they are pertinent.

Thanks, Mark

Warning messages:
1: In .updateMethodsInTable(fdef, where, attach) :
   Couldn't find methods table for "conditional", package "Category" may 
be out of date
2: In .updateMethodsInTable(fdef, where, attach) :
   Methods list for generic "conditional" not found
 > require(tcltk)
Loading required package: tcltk
Error in firstlib(which.lib.loc, package) :
   Tcl/Tk support is not available on this system
 > sessionInfo()
R version 2.6.0 Under development (unstable) (2007-08-01 r42387)
i686-pc-linux-gnu

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

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

other attached packages:
  [1] affycoretools_1.9.3annaffy_1.9.1  xtable_1.5-0
  [4] gcrma_2.9.1matchprobes_1.9.10 biomaRt_1.11.4
  [7] RCurl_0.8-1XML_1.9-0  GOstats_2.3.8
[10] Category_2.3.19genefilter_1.15.9  survival_2.32
[13] KEGG_1.17.0RBGL_1.13.3annotate_1.15.3
[16] AnnotationDbi_0.0.88   RSQLite_0.6-0  DBI_0.2-3
[19] GO_1.17.0  limma_2.11.9   affy_1.15.7
[22] preprocessCore_0.99.12 affyio_1.5.6   Biobase_1.15.23
[25] graph_1.15.10

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

-- 

---

Mark W. Kimpel MD  ** Neuroinformatics ** Dept. of Psychiatry
Indiana University School of Medicine

15032 Hunter Court, Westfield, IN  46074

(317) 490-5129 Work, & Mobile & VoiceMail
(317) 663-0513 Home (no voice mail please)

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Reading time/date string

2007-08-08 Thread Matthew Walker
Hello everyone,

Can anyone tell me what function I should use to read time/date strings 
and turn them into a form such that I can easily calculate the 
difference of two?  The strings I've got look like "10:17:07 02 Aug 
2007".  If I could calculate the number of seconds between them I'd be 
very happy!

Cheers,

Matthew

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] passing variables

2007-08-08 Thread sijaynanda6
Hi am new to jmeter... hear am explaining what my problem is? i have recorded 
the fallowing operations in my application by using proxy server...i login to 
the application by using username and password...after getting the home page i 
have created a new brand by giving brandname and description for that 
brand...after recording these operations what i want to do is " iwant to create 
5 user and all those 5 users need to login to the application and create new 
brands for each user..." for this what i need to do...how to send 
variablesplease tell me how to get this 

--
This message was sent on behalf of [EMAIL PROTECTED] at openSubscriber.com
http://www.opensubscriber.com/messages/r-help@stat.math.ethz.ch/topic.html

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


Re: [R] small sample techniques

2007-08-08 Thread Moshe Olshansky
Well, this an explanation of what is done in the
paired t-test (and why the number of df is as it is).
I was too lazy to write all this.
It is nice that some list members are less lazy!

--- Rolf Turner <[EMAIL PROTECTED]> wrote:

> 
> On 9/08/2007, at 2:57 PM, Moshe Olshansky wrote:
> 
> > As Thomas Lumley noted, there exist several
> versions
> > of t-test.
> 
>   
> 
> > If you use t3 <- t.test(x,y,paired=TRUE) then
> equal
> > sample sizes are assumed and the number of degrees
> of
> > freedom is 4 (5-1).
> 
>   This is seriously misleading.  The assumption is
> not that the sample  
> sizes
>   are equal, but rather that there is ***just one
> sample***, namely  
> the sample of differences.
> 
>   More explicitly the assumptions are that
> 
>   x_i - y_i
> 
>   are i.i.d. Gaussian with mean mu and variance
> sigma^2.
> 
>   One is trying to conduct inference about mu, of
> course.
> 
>   It should also be noted that it is a crucial
> assumption for the  
> ``non-paired''
>   t-test that the two samples be ***independent*** of
> each other, as  
> well as
>   being Gaussian.
> 
>   None of this is however germane to Nair's original
> question; it is  
> clear
>   that he is interested in a two-independent-sample
> t-test.
> 
>   cheers,
> 
>   Rolf Turner
> 
>
##
> Attention: 
> This e-mail message is privileged and confidential.
> If you are not the 
> intended recipient please delete the message and
> notify the sender. 
> Any views or opinions presented are solely those of
> the author.
> 
> This e-mail has been scanned and cleared by
> MailMarshal 
> www.marshalsoftware.com
>
##
>

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


Re: [R] small sample techniques

2007-08-08 Thread Rolf Turner

On 9/08/2007, at 2:57 PM, Moshe Olshansky wrote:

> As Thomas Lumley noted, there exist several versions
> of t-test.



> If you use t3 <- t.test(x,y,paired=TRUE) then equal
> sample sizes are assumed and the number of degrees of
> freedom is 4 (5-1).

This is seriously misleading.  The assumption is not that the sample  
sizes
are equal, but rather that there is ***just one sample***, namely  
the sample of differences.

More explicitly the assumptions are that

x_i - y_i

are i.i.d. Gaussian with mean mu and variance sigma^2.

One is trying to conduct inference about mu, of course.

It should also be noted that it is a crucial assumption for the  
``non-paired''
t-test that the two samples be ***independent*** of each other, as  
well as
being Gaussian.

None of this is however germane to Nair's original question; it is  
clear
that he is interested in a two-independent-sample t-test.

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confidenti...{{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] small sample techniques

2007-08-08 Thread Moshe Olshansky
As Thomas Lumley noted, there exist several versions
of t-test.
If you use t1 <- t.test(x,y) then no assumption is
made of x and y having equal variance and of the two
sample sizes being equal and then an approximate
t-test is used with an approximate number of degrees
of freedom (and this is what you got).
If you use t2 <- t.test(x,y,var.equal=TRUE) then equal
variance is assumed and you get 8 degrees of freedom.
If you use t3 <- t.test(x,y,paired=TRUE) then equal
sample sizes are assumed and the number of degrees of
freedom is 4 (5-1).

--- "Nair, Murlidharan T" <[EMAIL PROTECTED]> wrote:

> Indeed, I understand what you say. The df of freedom
> for the dummy example is n1+n2-2 = 8. But when I run
> the t.test I get it as 5.08, am I missing something?
> 
> 
> -Original Message-
> From: Moshe Olshansky [mailto:[EMAIL PROTECTED]
> 
> Sent: Tuesday, August 07, 2007 9:05 PM
> To: Nair, Murlidharan T; r-help@stat.math.ethz.ch
> Subject: Re: [R] small sample techniques
> 
> Hi Nair,
> 
> If the two populations are normal the t-test gives
> you
> the exact result for whatever the sample size is
> (the
> sample size will affect the number of degrees of
> freedom).
> When the populations are not normal and the sample
> size is large it is still OK to use t-test (because
> of
> the Central Limit Theorem) but this is not
> necessarily
> true for the small sample size.
> You could use simulation to find the relevant
> probabilities.
> 
> --- "Nair, Murlidharan T" <[EMAIL PROTECTED]> wrote:
> 
> > If my sample size is small is there a particular
> > switch option that I need to use with t.test so
> that
> > it calculates the t ratio correctly? 
> > 
> > Here is a dummy example?
> > 
> > á =0.05
> > 
> > Mean pain reduction for A =27; B =31 and SD are
> > SDA=9 SDB=12
> > 
> > drgA.p<-rnorm(5,27,9); 
> > 
> > drgB.p<-rnorm(5,31,12)
> > 
> > t.test(drgA.p,drgB.p) # what do I need to give as
> > additional parameter here?
> > 
> >  
> > 
> > I can do it manually but was looking for a switch
> > option that I need to specify for  t.test. 
> > 
> >  
> > 
> > Thanks ../Murli
> > 
> >  
> > 
> > 
> > [[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] Relocating Axis Label/Title --2 (Second try.)

2007-08-08 Thread Charles Annis, P.E.
I hate it when the line feeds get lost and the message becomes
unintelligible.  I'm sorry.  

You don't need to move anything.   Just allocate more room for what you have
already.  Try this:

rm(list=ls())
D_mean<-seq(-5,5,length=100)
y<-exp(-D_mean^2/5)
pdf("my.pdf")

###

par(mar = c(4.5, 4.5, 1, 1) + 0.1)

### 

plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black",
ylab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]"))),
xlab = expression(paste(D[agg]," [nm]")),
cex.lab=1.2
)
axis(2, mgp=c(0, 0.2, -2))
dev.off()




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 Lorenzo Isella
Sent: Wednesday, August 08, 2007 12:53 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Relocating Axis Label/Title --2

Apologies for the previous mail (I sent it off too early by mistake).
This is the correct example:

rm(list=ls())
D_mean<-seq(-5,5,length=100)
y<-exp(-D_mean^2/5)
pdf("my.pdf")
plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black",
ylab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]"))),
xlab = expression(paste(D[agg]," [nm]")),
cex.lab=1.2
)
axis(2, mgp=c(0, 0.2, -2))
dev.off()


With mgp() I can tune the distance between the ticks and the tick
labels, but how can I move the axis label? I would like to move the
one along y to visualize correctly the exponent "3".

Kind Regards

Lorenzo



On 08/08/07, Lorenzo Isella <[EMAIL PROTECTED]> wrote:
> Dear All,
> I am experiencing some problems with relocating an axis title.
> I visited the following link before posting:
>
> http://tolstoy.newcastle.edu.au/R/help/05/05/5283.html
>
> But this is not entirely what I would like to do
> Consider the example below:
>
> rm(list=ls())
> D_mean<-seq(-5,5,length=100)
> y<-exp(-D_mean^2/5)
> pdf("my.pdf")
> plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black",
> ylab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]"))),
> xlab = expression(paste(D[agg]," [nm]")),
> cex.lab=1.2
> )
> title(2, mgp=c(0, .3, 0))
> dev.off()
>
> I have the problem that the "3" in cubic centimeters (on the y axis)
> is somehow "cut" in the pdf file I generate. Everything would be fine
> if I could shift a bit the title of the y axis.
> It must be trivial, but so far I have not managed to do it.
> Any suggestions?
> Many thanks
>
> Lorenzo
> I tried playing with the mgp parameter, but I managed to move the
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Relocating Axis Label/Title --2

2007-08-08 Thread Charles Annis, P.E.
You don't need to move anything.   Just allocate more room for what you have
already.  Try this:

rm(list=ls())
D_mean<-seq(-5,5,length=100)
y<-exp(-D_mean^2/5)
pdf("my.pdf")
###
par(mar = c(4.5, 4.5, 1, 1) + 0.1)#
###
plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black",
ylab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]"))), xlab =
expression(paste(D[agg]," [nm]")),
cex.lab=1.2
)
axis(2, mgp=c(0, 0.2, -2))
dev.off()



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 Lorenzo Isella
Sent: Wednesday, August 08, 2007 12:53 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Relocating Axis Label/Title --2

Apologies for the previous mail (I sent it off too early by mistake).
This is the correct example:

rm(list=ls())
D_mean<-seq(-5,5,length=100)
y<-exp(-D_mean^2/5)
pdf("my.pdf")
plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black",
ylab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]"))),
xlab = expression(paste(D[agg]," [nm]")),
cex.lab=1.2
)
axis(2, mgp=c(0, 0.2, -2))
dev.off()


With mgp() I can tune the distance between the ticks and the tick
labels, but how can I move the axis label? I would like to move the
one along y to visualize correctly the exponent "3".

Kind Regards

Lorenzo



On 08/08/07, Lorenzo Isella <[EMAIL PROTECTED]> wrote:
> Dear All,
> I am experiencing some problems with relocating an axis title.
> I visited the following link before posting:
>
> http://tolstoy.newcastle.edu.au/R/help/05/05/5283.html
>
> But this is not entirely what I would like to do
> Consider the example below:
>
> rm(list=ls())
> D_mean<-seq(-5,5,length=100)
> y<-exp(-D_mean^2/5)
> pdf("my.pdf")
> plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black",
> ylab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]"))),
> xlab = expression(paste(D[agg]," [nm]")),
> cex.lab=1.2
> )
> title(2, mgp=c(0, .3, 0))
> dev.off()
>
> I have the problem that the "3" in cubic centimeters (on the y axis)
> is somehow "cut" in the pdf file I generate. Everything would be fine
> if I could shift a bit the title of the y axis.
> It must be trivial, but so far I have not managed to do it.
> Any suggestions?
> Many thanks
>
> Lorenzo
> I tried playing with the mgp parameter, but I managed to move the
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] R memory usage

2007-08-08 Thread Jun Ding
Hi All, 

I have two questions in terms of the memory usage in R
(sorry if the questions are naive, I am not familiar
with this at all). 

1) I am running R in a linux cluster. By reading the R
helps, it seems there are no default upper limits for
vsize or nsize. Is this right? Is there an upper limit
for whole memory usage? How can I know the default in
my specific linux environment? And can I increase the
default?

2) I use R to read in several big files (~200Mb each),
and then I run:

gc()

I get:

used  (Mb) gc trigger   (Mb)  max used   
Ncells  23083130 616.4   51411332 1372.9  51411332 
Vcells 106644603 813.7  240815267 1837.3 227550003 

(Mb)
1372.9
1736.1

What do columns of "used", "gc trigger" and "max used"
mean? It seems to me I have used 616Mb of Ncells and
813.7Mb of Vcells. Comparing with the numbers of "max
used", I still should have enough memory. But when I
try 

object.size(area.results)   ## area.results is a big
data.frame 

I get an error message:

Error: cannot allocate vector of size 32768 Kb

Why is that? Looks like I am running out of memory. Is
there a way to solve this problem?

Thank you very much!

Jun



  


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Systematically biased count data regression model

2007-08-08 Thread Matthew and Kim Bowser
Dear all,

I am attempting to explain patterns of arthropod family richness
(count data) using a regression model.  It seems to be able to do a
pretty good job as an explanatory model (i.e. demonstrating
relationships between dependent and independent variables), but it has
systematic problems as a predictive model:  It is biased high at low
observed values of family richness and biased low at high observed
values of family richness (see attached pdf).  I have tried diverse
kinds of reasonable regression models mostly as in Zeileis, et al.
(2007), as well as transforming my variables, both with only small
improvements.

Do you have suggestions for making a model that would perform better
as a predictive model?

Thank you for your time.

Sincerely,

Matthew Bowser

STEP student
USFWS Kenai National Wildlife Refuge
Soldotna, Alaska, USA

M.Sc. student
University of Alaska Fairbanks
Fairbankse, Alaska, USA

Reference

Zeileis, A., C. Kleiber, and S. Jackman, 2007. Regression models for
count data in R. Technical Report 53, Department of Statistics and
Mathematics, Wirtschaftsuniversität Wien, Wien, Austria. URL
http://cran.r-project.org/doc/vignettes/pscl/countreg.pdf.

Code

`data` <-
structure(list(D = c(4, 5, 12, 4, 9, 15, 4, 8, 3, 9, 6, 17, 4,
9, 6, 9, 3, 9, 7, 11, 17, 3, 10, 8, 9, 6, 7, 9, 7, 5, 15, 15,
12, 9, 10, 4, 4, 15, 7, 7, 12, 7, 12, 7, 7, 7, 5, 14, 7, 13,
1, 9, 2, 13, 6, 8, 2, 10, 5, 14, 4, 13, 5, 17, 12, 13, 7, 12,
5, 6, 10, 6, 6, 10, 4, 4, 12, 10, 3, 4, 4, 6, 7, 15, 1, 8, 8,
5, 12, 0, 5, 7, 4, 9, 6, 10, 5, 7, 7, 14, 3, 8, 15, 14, 7, 8,
7, 8, 8, 10, 9, 2, 7, 8, 2, 6, 7, 9, 3, 20, 10, 10, 4, 2, 8,
10, 10, 8, 8, 12, 8, 6, 16, 10, 5, 1, 1, 5, 3, 11, 4, 9, 16,
3, 1, 6, 5, 5, 7, 11, 11, 5, 7, 5, 3, 2, 3, 0, 3, 0, 4, 1, 12,
16, 9, 0, 7, 0, 11, 7, 9, 4, 16, 9, 10, 0, 1, 9, 15, 6, 8, 6,
4, 6, 7, 5, 7, 14, 16, 5, 8, 1, 8, 2, 10, 9, 6, 11, 3, 16, 3,
6, 8, 12, 5, 1, 1, 3, 3, 1, 5, 15, 4, 2, 2, 6, 5, 0, 0, 0, 3,
0, 16, 0, 9, 0, 0, 8, 1, 2, 2, 3, 4, 17, 4, 1, 4, 6, 4, 3, 15,
2, 2, 13, 1, 9, 7, 7, 13, 10, 11, 2, 15, 7), Day = c(159, 159,
159, 159, 166, 175, 161, 168, 161, 166, 161, 166, 161, 161, 161,
175, 161, 175, 161, 165, 176, 161, 163, 161, 168, 161, 161, 161,
161, 161, 165, 176, 175, 176, 163, 175, 163, 168, 163, 176, 176,
165, 176, 175, 161, 163, 163, 168, 163, 175, 167, 176, 167, 165,
165, 169, 165, 169, 165, 161, 165, 175, 165, 176, 175, 167, 167,
175, 167, 164, 167, 164, 181, 164, 167, 164, 176, 164, 167, 164,
167, 164, 167, 175, 167, 173, 176, 173, 178, 167, 173, 172, 173,
178, 178, 172, 181, 182, 173, 162, 162, 173, 178, 173, 172, 162,
173, 162, 173, 162, 173, 170, 178, 166, 166, 162, 166, 177, 166,
170, 166, 172, 172, 166, 172, 166, 174, 162, 164, 162, 170, 164,
170, 164, 170, 164, 177, 164, 164, 174, 174, 162, 170, 162, 172,
162, 165, 162, 165, 177, 172, 162, 170, 162, 170, 174, 165, 174,
166, 172, 174, 172, 174, 170, 170, 165, 170, 174, 174, 172, 174,
172, 174, 165, 170, 165, 170, 174, 172, 174, 172, 175, 175, 170,
171, 174, 174, 174, 172, 175, 171, 175, 174, 174, 174, 175, 172,
171, 171, 174, 160, 175, 160, 171, 170, 175, 170, 170, 160, 160,
160, 171, 171, 171, 171, 160, 160, 160, 171, 171, 176, 171, 176,
176, 171, 176, 171, 176, 176, 176, 176, 159, 166, 159, 159, 166,
168, 169, 159, 168, 169, 166, 163, 180, 163, 165, 164, 180, 166,
166, 164, 164, 177, 166), NDVI = c(0.187, 0.2, 0.379, 0.253,
0.356, 0.341, 0.268, 0.431, 0.282, 0.181, 0.243, 0.327, 0.26,
0.232, 0.438, 0.275, 0.169, 0.288, 0.138, 0.404, 0.386, 0.194,
0.266, 0.23, 0.333, 0.234, 0.258, 0.333, 0.234, 0.096, 0.354,
0.394, 0.304, 0.162, 0.565, 0.348, 0.345, 0.226, 0.316, 0.312,
0.333, 0.28, 0.325, 0.243, 0.194, 0.29, 0.221, 0.217, 0.122,
0.289, 0.475, 0.048, 0.416, 0.481, 0.159, 0.238, 0.183, 0.28,
0.32, 0.288, 0.24, 0.287, 0.363, 0.367, 0.24, 0.55, 0.441, 0.34,
0.295, 0.23, 0.32, 0.184, 0.306, 0.232, 0.289, 0.341, 0.221,
0.333, 0.17, 0.139, 0.2, 0.204, 0.301, 0.253, -0.08, 0.309, 0.232,
0.23, 0.239, -0.12, 0.26, 0.285, 0.45, 0.348, 0.396, 0.311, 0.318,
0.31, 0.261, 0.441, 0.147, 0.283, 0.339, 0.224, 0.5, 0.265, 0.2,
0.287, 0.398, 0.116, 0.292, 0.045, 0.137, 0.542, 0.171, 0.38,
0.469, 0.325, 0.139, 0.166, 0.247, 0.253, 0.466, 0.26, 0.288,
0.34, 0.288, 0.26, 0.178, 0.274, 0.358, 0.285, 0.225, 0.162,
0.223, 0.301, -0.398, -0.2, 0.239, 0.228, 0.255, 0.166, 0.306,
0.28, 0.279, 0.208, 0.377, 0.413, 0.489, 0.417, 0.333, 0.208,
0.232, 0.431, 0.283, 0.241, 0.105, 0.18, -0.172, -0.374, 0.25,
0.043, 0.215, 0.204, 0.19, 0.177, -0.106, -0.143, 0.062, 0.462,
0.256, 0.229, 0.314, 0.415, 0.307, 0.238, -0.35, 0.34, 0.275,
0.097, 0.353, 0.214, 0.435, 0.055, -0.289, 0.239, 0.186, 0.135,
0.259, 0.268, 0.258, 0.032, 0.489, 0.389, 0.298, 0.164, 0.325,
0.254, -0.059, 0.524, 0.539, 0.25, 0.175, 0.326, 0.302, -0.047,
-0.301, -0.149, 0.358, 0.495, 0.311, 0.235, 0.558, -0.156, 0,
0.146, 0.329, -0.069, -0.352, -0.356, -0.206, -0.179, 0.467,
-0.325, 0.39, -0.399, -0.165, 0.267, -0.334, -0.17, 0.58, 0.228,
0.234, 0.351, 0.3, -0.018, 0.125, 0.176, 0.322, 0.246, 0

[R] ksvm-kernel

2007-08-08 Thread Nelson Hernandez Gonzalez
HI

I am new to R.

I have one problem in the predict function of the kernlab.
I want to use ksvm and predict with  kernelmatrix (S4 method for signature 
'kernelMatrix')

#executing the following sentences 

library(kernlab)
# identity kernel

k <- function(x,y) {
 n<-length(x)
 cont<-0
  for(i in 1:n){
   
if(x[i]==y[i]){
  cont<-cont+1
}
  }
cont
}
class(k) <- "kernel"

data(promotergene) 
ind <- sample(1:dim(promotergene)[1],20) 
genetrain <- promotergene[-ind, -1]
genetest <- promotergene[ind,-1 ]

kx <- kernelMatrix(k, as.matrix(genetrain))
y<-as.vector(promotergene[-ind,1 ])
#y<-as.factor(promotergene[-ind,1 ])
y
gene1 <- ksvm(kx, y, type="C-svc")
gene1
genetype <- predict(gene1,genetest)
Error en as.matrix(Z) : objeto "Z" no encontrado

#genetest1<-as.matrix(genetest)
#genetype <- predict(gene1,genetest1)
genetype

thank you,
nelsonhernandez
[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] converting character string to an expression

2007-08-08 Thread Stephen Tucker

I think you're looking for

parse(text=paste(letters[1:3], collapse="+"))

--- Jarrod Hadfield <[EMAIL PROTECTED]> wrote:

> Hi Everyone,
> 
> I would simply like to coerce a character string into an expression:  
> something like:
> 
> as.expression(paste(letters[1:3], collapse="+"))
> 
> but I can't seem to get rid of the quotes.  The only way I can get it  
> to work is using as.formula:
> 
> as.expression(as.formula(paste("~", paste(letters[1:3], collapse="+"
> 
> but this requires the expression to have a tilde, which it will not  
> always have.
> 
> Thanks,
> 
> Jarrod
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Test (please ignore)

2007-08-08 Thread Ted . Harding
Please excuse this -- I need to test whether I can get through to R-help!
(Have failed repeatedly today).
Ted.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Namespace problem

2007-08-08 Thread Duncan Murdoch
Dimitri Mahieux wrote:
> Hi All,
>
> I have some questions about making a R-package. I would like to use a 
> namespace. The package contains analysis functions and also
> a graphical user interface. I would like to allow user to use only the 
> analysis function and not the GUI functions which are mainly
> bindings to graphical elements. I have exported analysis functions using 
> export directives in a namespace file but when I want to use
> the GUI, it seems that all the GUI functions are unknown.
>
> Is there a way to solve this problem ?
>   
If you don't export the functions, they won't normally be visible 
outside your package, but you can still use the ":::" notation to get 
them, e.g.

mypackage:::myfunction

gets myfunction even if it was not exported.

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.


Re: [R] simulation-binomial

2007-08-08 Thread sigalit mangut-leiba
i will use that, thank you.
sigalit.


On 8/8/07, Greg Snow <[EMAIL PROTECTED]> wrote:
>
> Does this do what you want?
>
> > x2 <- rbinom( 200, 1, ifelse(x, .95, p1/.6) )
> > y2 <- rbinom( 300, 1, ifelse(y, .8, p1/.6) )
>
> 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
> > sigalit mangut-leiba
> > Sent: Wednesday, August 08, 2007 11:18 AM
> > To: r-help
> > Subject: Re: [R] simulation-binomial
> >
> > I have the probability: P(T+ / D+)
> > i want to find P(T+,D+) which is: P(T+ / D+)*P(D+) and i have
> > those probabilities. i dont know how to write this in R.
> > something like this: (say p2 is the conditional prob. and p1
> > is the joint
> > prob.)
> >
> > p2 <- p1/.6
> > x <- rbinom(200, 1, .6)
> > y <- rbinom(300, 1, .6)
> > if (x) p2==0.95
> > if (y) p2==0.80
> >
> > i don't know how to write the "if "condition.
> > thank you for your reply,
> > sigalit.
> >
> >
> > On 8/8/07, Kyle Henderson <[EMAIL PROTECTED]> wrote:
> > >
> > > That depends on what you meant by writing the conditional
> > probability.
> > > Bayes rule says that the probability of testing positive
> > when one has
> > > the disease is calculated as follows:
> > >
> > >  Pr(T+ | D+)=(Pr(D+ | T+)*Pr(T+))/Pr(D+)
> > >
> > > is that what you mean?
> > >
> > >
> > > Kyle H. Ambert
> > > Department of Behavioral Neuroscience
> > > Oregon Health & Science University
> > >
> > >
> > >
> > >  On 8/8/07, sigalit mangut-leiba <[EMAIL PROTECTED]> wrote:
> > >
> > > > hello,
> > > > i want to do a binomial simulation, by taking 200 var. from one
> > > > group
> > > > (x)
> > > > and 300 from another (y).
> > > > the prob. for disease=.6 in both groups.
> > > >
> > > > x <- rbinom(200, 1, .6)
> > > >
> > > > y <- rbinom(300, 1, .6)
> > > > if the person is from group x - the probability to find
> > the disease,
> > > > assuming the person is sick, is .95, if he is from group
> > Y its .80.
> > > > i want to know the joint probability: p(the person has
> > the disease
> > > > and tested sick)=P(D+,T+).
> > > > my problem is how to write the conditional prob.
> > > > Thanks for your help, also reference on this subject (binomial
> > > > simulation)
> > > > would be great.
> > > > Sigalit.
> > > >
> > > > [[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 > > > /posting-guide.html> and provide commented, minimal,
> > self-contained,
> > > > reproducible code.
> > > >
> > >
> > >
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>

[[alternative HTML version deleted]]

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


Re: [R] S4 methods: unable to find an inherited method

2007-08-08 Thread Seth Falcon
Hi Paul,

"H. Paul Benton" <[EMAIL PROTECTED]> writes:
> I consider myself pretty new to the whole OO based programming so
> I'm sorry if I'm doing something stupid.

These sorts of questions might be better sent to the R-devel list...

>> xml<-read.metlin(url)
> Error in function (classes, fdef, mtable)  :
> unable to find an inherited method for function "read.metlin",
> for signature "url"

So the error message is telling you that it can't find a method for
the read.metlin generic that matches the class of the xml argument you
passed in.

You defined:

> setMethod("read.metlin", "xcmsRaw", function(xml) {
> #Parsing the METLIN XML File
> reading<-readLines(xml)
> #do rest of script
>
> })

So there is a method for read.metlin when the xml argument is an
xcmsRaw object.  As you show, you passed in an object with class
"url".

>> url
>description
> "http://metlin.scripps.edu/download/MSMS_test.XML";
>  class
>  "url"

> Any help as to why I'm getting the inherited method error would be
> great.

You either need to add a method specialized on the url class (warning,
url is not an S4 class, there will be tricks required).  Or you need
to pass in an xcmsRaw object.

Cheers,

+ seth

-- 
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
BioC: http://bioconductor.org/
Blog: http://userprimary.net/user/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] simulation-binomial

2007-08-08 Thread Greg Snow
Does this do what you want?

> x2 <- rbinom( 200, 1, ifelse(x, .95, p1/.6) )
> y2 <- rbinom( 300, 1, ifelse(y, .8, p1/.6) )

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 
> sigalit mangut-leiba
> Sent: Wednesday, August 08, 2007 11:18 AM
> To: r-help
> Subject: Re: [R] simulation-binomial
> 
> I have the probability: P(T+ / D+)
> i want to find P(T+,D+) which is: P(T+ / D+)*P(D+) and i have 
> those probabilities. i dont know how to write this in R.
> something like this: (say p2 is the conditional prob. and p1 
> is the joint
> prob.)
> 
> p2 <- p1/.6
> x <- rbinom(200, 1, .6)
> y <- rbinom(300, 1, .6)
> if (x) p2==0.95
> if (y) p2==0.80
> 
> i don't know how to write the "if "condition.
> thank you for your reply,
> sigalit.
> 
> 
> On 8/8/07, Kyle Henderson <[EMAIL PROTECTED]> wrote:
> >
> > That depends on what you meant by writing the conditional 
> probability.
> > Bayes rule says that the probability of testing positive 
> when one has 
> > the disease is calculated as follows:
> >
> >  Pr(T+ | D+)=(Pr(D+ | T+)*Pr(T+))/Pr(D+)
> >
> > is that what you mean?
> >
> >
> > Kyle H. Ambert
> > Department of Behavioral Neuroscience
> > Oregon Health & Science University
> >
> >
> >
> >  On 8/8/07, sigalit mangut-leiba <[EMAIL PROTECTED]> wrote:
> >
> > > hello,
> > > i want to do a binomial simulation, by taking 200 var. from one 
> > > group
> > > (x)
> > > and 300 from another (y).
> > > the prob. for disease=.6 in both groups.
> > >
> > > x <- rbinom(200, 1, .6)
> > >
> > > y <- rbinom(300, 1, .6)
> > > if the person is from group x - the probability to find 
> the disease, 
> > > assuming the person is sick, is .95, if he is from group 
> Y its .80.
> > > i want to know the joint probability: p(the person has 
> the disease 
> > > and tested sick)=P(D+,T+).
> > > my problem is how to write the conditional prob.
> > > Thanks for your help, also reference on this subject (binomial
> > > simulation)
> > > would be great.
> > > Sigalit.
> > >
> > > [[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 > > /posting-guide.html> and provide commented, minimal, 
> self-contained, 
> > > reproducible code.
> > >
> >
> >
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> 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] mice package

2007-08-08 Thread Nathan Paxton
Hi all,

I am trying to run the mice package (for multiple imputation) on a  
data frame that is 5174 x 100. When I run mice(frame), I get the  
following response:
Error in solve.default(t(xobs) %*% xobs) :
Lapack routine dgesv: system is exactly singular

and execution stops.

I'm no expert at matrix algebra, so if someone could explain this to  
me and what I can do to get around it, I'd be very appreciative.

Thanks.

Best,
-N.
--
Nathan A. Paxton
Ph.D. Candidate
Dept. of Government, Harvard University

Resident Tutor
John Winthrop House, Harvard University

napaxton AT fas DOT harvard DOT edu
http://www.fas.harvard.edu/~napaxton
 
===
When you have to stay eight years away from California, you live in a  
perpetual state of homesickness.
 - Ronald Reagan

The most courageous act is still to think for yourself.  Aloud.
 -Coco Chanel

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] converting character string to an expression

2007-08-08 Thread Jarrod Hadfield
Hi Everyone,

I would simply like to coerce a character string into an expression:  
something like:

as.expression(paste(letters[1:3], collapse="+"))

but I can't seem to get rid of the quotes.  The only way I can get it  
to work is using as.formula:

as.expression(as.formula(paste("~", paste(letters[1:3], collapse="+"

but this requires the expression to have a tilde, which it will not  
always have.

Thanks,

Jarrod

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] small sample techniques

2007-08-08 Thread Tim Hesterberg
About using t tests and confidence intervals for "large" samples -
"large" may need to be very large.
The old pre-computer-age rule of n >= 30 is inadequate.

For example, for an exponential distribution, the actual size
of a nominal 2.5% one-sided t-test is not accurate to within 10%
(i.e. between 2.25% & 2.75%) until n is around 5000.
The error (actual - nominal size) decreases very slowly, at the rate 1/sqrt(n).

In practice, real distributions may be even more skewed than
the exponential distribution, even though they appear less skewed,
if they have long tails.  In this case the sample size would need
to be even larger for t procedures to be reasonably accurate.

An alternative is to use bootstrapping.  Bootstrap procedures that
decrease at the rate 1/n include bootstrap t, BCa, and bootstrap
tilting.

Moshe Olshansky <[EMAIL PROTECTED]> wrote:
>If the two populations are normal the t-test gives you
>the exact result for whatever the sample size is (the
>sample size will affect the number of degrees of
>freedom).
>When the populations are not normal and the sample
>size is large it is still OK to use t-test (because of
>the Central Limit Theorem) but this is not necessarily
>true for the small sample size.
>You could use simulation to find the relevant
>probabilities.
>...


| Tim Hesterberg   Senior Research Scientist   |
| [EMAIL PROTECTED]  Insightful Corp.|
| (206)802-23191700 Westlake Ave. N, Suite 500 |
| (206)283-8691 (fax)  Seattle, WA 98109-3044, U.S.A.  |
|  www.insightful.com/Hesterberg   |

Short course - Bootstrap Methods and Permutation Tests
Oct 10-11 San Francisco, 3-4 Oct UK.
http://www.insightful.com/services/training.asp

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Regsubsets statistics

2007-08-08 Thread Markus Brugger

Dear R-help,

I have used the regsubsets function from the leaps package to do subset 
selection of a logistic regression model with 6 independent variables and 
all possible ^2 interactions. As I want to get information about the 
statistics behind the selection output, I´ve intensively searched the 
mailing list to find answers to following questions:

1. What should I do to get the statistics behind the selection (e.g. BIC)? 
summary.regsubsets(object) just returns "*" meaning "in" or " " meaning out.
For the plot function generates BICs, it is obviously that these values must 
be computed and available somewhere, but where? Is it possible to directly 
get AIC values instead of BIC?
2. As to the plot function, I´ve encountered a problem with setting the ylim 
argument. I fear that this (nice!) particular plot function ignores many of 
these additional arguments. How can I nevertheless change this setting?
3. For it is not explicitly mentioned in the manual, can I really use 
regsubsets for logistic regression?

Thanks a lot for your help, I hope these questions aren´t too general.

Best wishes

Markus Brugger

_
Sie suchen E-Mails, Dokumente oder Fotos? Die neue MSN Suche Toolbar mit 
[[trailing spam removed]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 include bar values in a barplot?

2007-08-08 Thread John Kane
Do you mean like this?

my.values=10:15
 x <- barplot(my.values, ylim=c(0,11))
  text(x, my.values, labels=my.values, pos=3)


It is very bad practice and OOo should have its
fingers slapped for perpetuating such a form.

--- "Donatas G." <[EMAIL PROTECTED]> wrote:

> How do I include bar values in a barplot (or other R
> graphics, where this 
> could be applicable)? 
> 
> To make sure I am clear I am attaching a barplot
> created with OpenOffice.org 
> which has barplot values written on top of each
> barplot. 
> 
> -- 
> Donatas Glodenis
> http://dg.lapas.info
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Relocating Axis Label/Title

2007-08-08 Thread John Kane
Have a look at "mar" in ?par.  You might want to
try something like mar=c(5, 5, 4, 2) + 0.1 rather than
the default of c(5, 4, 4, 2) + 0.1 .
--- Lorenzo Isella <[EMAIL PROTECTED]> wrote:

> Dear All,
> I am experiencing some problems with relocating an
> axis title.
> I visited the following link before posting:
> 
>
http://tolstoy.newcastle.edu.au/R/help/05/05/5283.html
> 
> But this is not entirely what I would like to do
> Consider the example below:
> 
> rm(list=ls())
> D_mean<-seq(-5,5,length=100)
> y<-exp(-D_mean^2/5)
> pdf("my.pdf")
>
plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black",
> ylab = list(expression(paste(dN/dlogD[agg],"
> ["*cm^-3*"]"))),
> xlab = expression(paste(D[agg]," [nm]")),
> cex.lab=1.2
> )
> title(2, mgp=c(0, .3, 0))
> dev.off()
> 
> I have the problem that the "3" in cubic centimeters
> (on the y axis)
> is somehow "cut" in the pdf file I generate.
> Everything would be fine
> if I could shift a bit the title of the y axis.
> It must be trivial, but so far I have not managed to
> do it.
> Any suggestions?
> Many thanks
> 
> Lorenzo
> I tried playing with the mgp parameter, but I
> managed to move the
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] simulation-binomial

2007-08-08 Thread sigalit mangut-leiba
I have the probability: P(T+ / D+)
i want to find P(T+,D+) which is: P(T+ / D+)*P(D+) and i have those
probabilities. i dont know how to write this in R.
something like this: (say p2 is the conditional prob. and p1 is the joint
prob.)

p2 <- p1/.6
x <- rbinom(200, 1, .6)
y <- rbinom(300, 1, .6)
if (x) p2==0.95
if (y) p2==0.80

i don't know how to write the "if "condition.
thank you for your reply,
sigalit.


On 8/8/07, Kyle Henderson <[EMAIL PROTECTED]> wrote:
>
> That depends on what you meant by writing the conditional probability.
> Bayes rule says that the probability of testing positive when one has the
> disease is calculated as follows:
>
>  Pr(T+ | D+)=(Pr(D+ | T+)*Pr(T+))/Pr(D+)
>
> is that what you mean?
>
>
> Kyle H. Ambert
> Department of Behavioral Neuroscience
> Oregon Health & Science University
>
>
>
>  On 8/8/07, sigalit mangut-leiba <[EMAIL PROTECTED]> wrote:
>
> > hello,
> > i want to do a binomial simulation, by taking 200 var. from one group
> > (x)
> > and 300 from another (y).
> > the prob. for disease=.6 in both groups.
> >
> > x <- rbinom(200, 1, .6)
> >
> > y <- rbinom(300, 1, .6)
> > if the person is from group x - the probability to find the disease,
> > assuming the person is sick, is .95,
> > if he is from group Y its .80.
> > i want to know the joint probability: p(the person has the disease and
> > tested sick)=P(D+,T+).
> > my problem is how to write the conditional prob.
> > Thanks for your help, also reference on this subject (binomial
> > simulation)
> > would be great.
> > Sigalit.
> >
> > [[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.
> >
>
>

[[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] Relocating Axis Label/Title --2

2007-08-08 Thread Lorenzo Isella
Apologies for the previous mail (I sent it off too early by mistake).
This is the correct example:

rm(list=ls())
D_mean<-seq(-5,5,length=100)
y<-exp(-D_mean^2/5)
pdf("my.pdf")
plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black",
ylab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]"))),
xlab = expression(paste(D[agg]," [nm]")),
cex.lab=1.2
)
axis(2, mgp=c(0, 0.2, -2))
dev.off()


With mgp() I can tune the distance between the ticks and the tick
labels, but how can I move the axis label? I would like to move the
one along y to visualize correctly the exponent "3".

Kind Regards

Lorenzo



On 08/08/07, Lorenzo Isella <[EMAIL PROTECTED]> wrote:
> Dear All,
> I am experiencing some problems with relocating an axis title.
> I visited the following link before posting:
>
> http://tolstoy.newcastle.edu.au/R/help/05/05/5283.html
>
> But this is not entirely what I would like to do
> Consider the example below:
>
> rm(list=ls())
> D_mean<-seq(-5,5,length=100)
> y<-exp(-D_mean^2/5)
> pdf("my.pdf")
> plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black",
> ylab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]"))),
> xlab = expression(paste(D[agg]," [nm]")),
> cex.lab=1.2
> )
> title(2, mgp=c(0, .3, 0))
> dev.off()
>
> I have the problem that the "3" in cubic centimeters (on the y axis)
> is somehow "cut" in the pdf file I generate. Everything would be fine
> if I could shift a bit the title of the y axis.
> It must be trivial, but so far I have not managed to do it.
> Any suggestions?
> Many thanks
>
> Lorenzo
> I tried playing with the mgp parameter, but I managed to move the
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] cointegration analysis

2007-08-08 Thread Dorina LAZAR

Hello,

I tried to use urca package (R) for cointegration analysis. The data
matrix to be investigated for cointegration contains 8 columns
(variables). Both procedures, Phillips & Ouliaris test and Johansen's
procedures give errors ("error in evaluating the argument 'object' in
selecting a method for function 'summary'" respectiv "too many
variables, critical values cannot be computed”). What can I do?

With regards,

Dorina LAZAR
Department of Statistics, Forecasting, Mathematics
Babes Bolyai University, Faculty of Economic Science
Teodor Mihali 58-60, 400591 Cluj-Napoca, Romania

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] prediction using gam

2007-08-08 Thread Simon Wood
Without seeing the data and results it's hard to say. mgcv::predict.gam is 
already `safe' so that's not the issue. It's also pretty heavily tested, so a 
problem with that function wouldn't be the first place I'd look. How `large 
positive' are the predictions relative to the observed response? How well do 
the x1,x2 cover the unit square? Smoothers often do not extrapolate well even 
over quite modest distances...

Slight negative predictions are not really surprising, given that the model 
you have fitted allows -ve fitted values. You could fix this by using a log 
link (with gaussian or Gamma family). 

If you think the results are not right, I can take a look at what's happening 
if you send me the data, R and mgcv version numbers and exact commands 
generating the problem (`off line'). I would not use the data for any other 
purpose of course. It may take a little while to get to however, as I've one 
or two local difficulties here at the moment. 

best,
Simon

On Wednesday 08 August 2007 16:58, Johnson, Elizabeth wrote:
> I am fitting a two dimensional smoother in gam, say junk =
> gam(y~s(x1,x2)), to a response variable y that is always positive and
> pretty well behaved, both x1 and x2 are contained within [0,1].
>
>
>
> I then create a new dataset for prediction with values of (x1,x2) within
> the range of the original data.
>
>
>
> predict(junk,newdata,type="response")
>
>
>
> My predicted values are a bit strange (some negative and some large
> positive values).
>
>
>
> When I plot the predicted surface, it looks well behaved with no strange
> dips/etc.
>
>
>
> Could it be a problem with the predict command?
>
> Is there a "safe" version of predict for higher-dimensional smoothers in
> gam?
>
>
>
> Elizabeth Johnson
>
> Research Associate
>
> Johns Hopkins Unviersity
>
> Department of Biostatistics
>
>
>
>
>
>
>   [[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 Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
> +44 1225 386603  www.maths.bath.ac.uk/~sw283

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


Re: [R] test for contingency table when there are many zeros

2007-08-08 Thread Francisco J. Zagmutt
fisher.test(tt)

Francisco

gallon li wrote:
> Here is my table
> 
>> tt
> A   B
> 1 297 398
> 2 470 376
> 3  30  23
> 4   3   3
> 5   0   0
> 
> b/c two cells are zero, I can't use chisq.test() in R which gives the
> following output;
> 
> 
>> chisq.test(tt)
> 
> Pearson's Chi-squared test
> 
> data:  tt
> X-squared = NaN, df = 4, p-value = NA
> 
> Warning message:
> Chi-squared approximation may be incorrect in: chisq.test(tt)
> 
> What function should I use then? Any suggestion?
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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


[R] Rcmdr window border lost

2007-08-08 Thread Andy Weller
Dear all,

I have recently lost my Rcmdr window borders (all my other programs have 
borders)! I am unsure of what I have done, although I have recently 
update.packages() in R... How can I reclaim them?

I am using:
Ubuntu Linux (Feisty)
R version 2.5.1
R Commander Version 1.3-5

I have deleted the folder: /usr/local/lib/R/site-library/Rcmdr and 
reinstalled Rcmdr with: install.packages("Rcmdr", dep=TRUE)

This has not solved my problem though.

Maybe I need to reinstall something else as well?

Thanks in advance, Andy

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Change in R**2 for block entry regression

2007-08-08 Thread David Kaplan
Hi all,

I'm demonstrating a block entry regression using R for my regression 
class.  For each block, I get the R**2 and the associated F.  I do this 
with separate regressions adding the next block in and then get the 
results by writing separate summary() statements for each regression. 
Is there a more convenient way to do this and also to get the change in 
R**2 and associated F test for the change?

Thanks in advance.

David


-- 
===
David Kaplan, Ph.D.
Professor
Department of Educational Psychology
University of Wisconsin - Madison
Educational Sciences, Room, 1061
1025 W. Johnson Street
Madison, WI 53706

email: [EMAIL PROTECTED]
homepage: http://www.education.wisc.edu/edpsych/facstaff/kaplan/kaplan.htm
Phone: 608-262-0836

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Relocating Axis Label/Title

2007-08-08 Thread Lorenzo Isella
Dear All,
I am experiencing some problems with relocating an axis title.
I visited the following link before posting:

http://tolstoy.newcastle.edu.au/R/help/05/05/5283.html

But this is not entirely what I would like to do
Consider the example below:

rm(list=ls())
D_mean<-seq(-5,5,length=100)
y<-exp(-D_mean^2/5)
pdf("my.pdf")
plot(D_mean,y,type="l",yaxt="n",lty=2,lwd=2,col="black",
ylab = list(expression(paste(dN/dlogD[agg]," ["*cm^-3*"]"))),
xlab = expression(paste(D[agg]," [nm]")),
cex.lab=1.2
)
title(2, mgp=c(0, .3, 0))
dev.off()

I have the problem that the "3" in cubic centimeters (on the y axis)
is somehow "cut" in the pdf file I generate. Everything would be fine
if I could shift a bit the title of the y axis.
It must be trivial, but so far I have not managed to do it.
Any suggestions?
Many thanks

Lorenzo
I tried playing with the mgp parameter, but I managed to move the

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] rational or float?

2007-08-08 Thread Federico Calboli
Hi All,

I am using the function fractions() and cognates from MASS. I would  
like to be able to tell if some calculations I am doing on some  
rationals are transformed into floats and then retransformed into  
rationals.

For instance I suspect that

as.fractions(1/8) + as.fractions(1/4)

does transform into floats and back, while I know

1/as.fractions(8) + 1/as.fractions(4)

does not. Since I am using sum() and doing a number of  
multiplications I would like to know so I can intervene.

For instance, what's happening here?

 > pun
  [,1] [,2]
[1,]11
[2,]44
 > library(MASS)
 > pun[1,]/as.fractions(pun[2,])
[1] 1/4 1/4
 > sum(pun[1,]/as.fractions(pun[2,]))
[1] 1/2

Best,

Federico

--
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

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


[R] Logistic Models, Cross Validation, error tables , Monte Carlo Simulation?

2007-08-08 Thread Tom Willems
Thanks Mr. Ellison,

Your remark helped solve my error table problem.

However, I found a new one.

Now that I have my error tables, i realised that it is no good statistical 
practise to validate a model, based one one error table.

So i should use a tool like K-fold CV.


ex: binary_model <- glm (y_binary~ x_value, family = 
binomial,data=dataset)

cv.binary(binary_model,rand=NULL, nfolds=1000, print.details=TRUE)


This is no problem for the binary model, for the odds model this is not 
the case.

Do you know a tool that can do this, or perhapes a way to implement it in 
a monte carlo simulation?

(i added the way i solved the error table problem below)


Kind regards,

Tom.



>ERROR TABLE DILEMMA

>For a binary model there is no problem (here y has an outcome of 0 or 1)

>

>ex:pred_binary_model=(expit(predict(binary_model,tsample))>P)

>   table_binary_model=table(pred_binary_model,tsample[,2])

> 
TER_binary_model=sum(diag(table_binary_model[,]))/sum(table_binary_model)

>

>   (error table1)

>   pred_binary_model   0   1

>   FALSE   28 95

>   TRUE4 114

>   [1] 0.5892116 --> of correct classified cases

>

>Here there are 28 + 114 correctly predicted test cases, this results in 
58.9% correct classified cases.

>A few more misclassified cases does not result in big departures from 
this 58.9%.

>

>When i preform this on categorical data, i have to use frequency tables.

>This predicts the number of successes and the number of failures, per 
interval.(odds per interval)

>So the error table does contain an outcome of odds for every given 
interval.

>

>ex: (error table2)

>   oddsPt

>   pred_percent_model  0.00 0.16 0.37 0.84

>   0.051   0   0   0

>   0.160   1   0   0

>   0.340   0   1   0
 
>   0.780   0   0   1

>   [1] 1 --> of correct classified cases

>

>As you can see, one misclassification will take disastrous proportions. 
(~25% difference)

>The output of error table2 is interpretable, but it is not ideal, and 
oversensitive to misclassification.

>

>I was able to solve this later problem by extracting the model 
coefficients, and then using them in a function.

>Based on this function, i was able to write an error table equal to table 
1.

 


Disclaimer: click here
[[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] R2WinBUGS results not different with different runs

2007-08-08 Thread toby909
Gregor Gorjanc wrote:
>   gmail.com> writes:
> 
>>Is this a specialty with R2WinBUGS? Does it have something to do with the 
>>seed 
>>value? Isnt the seed value reset everytime I restart winbugs?
> 
> 
> I always have the same seed if I start WinBUGS multiple times.

So you get exactly the same chain, numerically, when rerunning the same model, 
with the same number of iterations, everything the same.?

Wouldnt that be problematic if every researcher in the world who uses winbugs 
uses the same sequence of random numbers?

R's random numbers are different each time, because the seed is linked to the 
clock in your PC.

T

> 
> Gregor
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Problems with nls-function

2007-08-08 Thread Gabor Grothendieck
On 8/8/07, Michael Petram <[EMAIL PROTECTED]> wrote:
> Dear all
>
> I have got some problems with a least-squares regression using the function 
> nls.
>
> I want to estimate h, k and X of the following formula by using nls :
>
> exp(2*200*(q^2-4*h/k-0.25+(2/k-0.5+4*h^2/k^2)*log(abs((k*q^2+2*h*q-1)/(0.25*k-h-1)/((-k*q^2-2*h*q+1)*X)
>
> y as defined by c(0.009747 0.001949 0.00 0.003899 0.00 0.00 
> 0.005848 0.001949)
> q as defined by c(-0.7500 -0.6875 -0.5625 -0.4875 -0.4625 -0.4375 -0.4125 
> -0.3875)
>
> (length of  the real q and y is 46; too long to post them here)
>
> i tought the correct using of nls would be:
>
> Mic<-nls(y~"function", start = list(k=1.0,h=0.1,X=exp(10))
>
> But it doesn`t work. i tryed an easier formula like :
>
> Mic<-nls(y~h*exp(2*k*200*(q^2)), start=list(h=0.1,k=1,X=10))
>
> The result was the same.
>
>
> Isn`t  "nls"  the function i should use to solve this regression problem? 
> Which things did i make wrong?

X is not in the model so by including it in your starting values you
make it non-idenfiable.  Get rid of it.

Also use better starting values.  Here we use grid search to get them:

> g <- expand.grid(h = 1:100/100, k = 1:100/100)
> st <- g[which.min(apply(g, 1, function(x) x[1] * exp(2*x[2]*200*q^2))),]
> nls(y~h*exp(2*k*200*(q^2)), start = st)
Nonlinear regression model
  model:  y ~ h * exp(2 * k * 200 * (q^2))
   data:  parent.frame()
h k
0.0003533 0.0139700
 residual sum-of-squares: 5.039e-05

Number of iterations to convergence: 16
Achieved convergence tolerance: 8.883e-06

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 using gPath

2007-08-08 Thread Emilio Gagliardi
Hi everyone,I'm trying to figure out how to use gPath and the documentation
is not very helpful :(

I have the following plot object:
plot-surrounds::
 background
 plot.gTree.378::
  background
  guide.gTree.355:: (background.rect.345, minor-horizontal.segments.347,
minor-vertical.segments.349, major-horizontal.segments.351,
major-vertical.segments.353)
  guide.gTree.356:: (background.rect.345, minor-horizontal.segments.347,
minor-vertical.segments.349, major-horizontal.segments.351,
major-vertical.segments.353)
  yaxis.gTree.338::
   ticks.segments.321
   labels.gTree.335:: (label.text.324, label.text.326, label.text.328,
label.text.330, label.text.332, label.text.334)
  xaxis.gTree.339::
   ticks.segments.309
   labels.gTree.315:: (label.text.312, label.text.314)
  xaxis.gTree.340::
   ticks.segments.309
   labels.gTree.315:: (label.text.312, label.text.314)
  strip.gTree.364:: (background.rect.361, label.text.363)
  strip.gTree.370:: (background.rect.367, label.text.369)
  guide.rect.357
  guide.rect.358
  boxplots.gTree.283::
   geom_boxplot.gTree.273:: (GRID.segments.267, GRID.segments.268,
geom_bar.rect.270, geom_bar.rect.272)
   geom_boxplot.gTree.281:: (GRID.segments.275, GRID.segments.276,
geom_bar.rect.278, geom_bar.rect.280)
  boxplots.gTree.301::
   geom_boxplot.gTree.291:: (GRID.segments.285, GRID.segments.286,
geom_bar.rect.288, geom_bar.rect.290)
   geom_boxplot.gTree.299:: (GRID.segments.293, GRID.segments.294,
geom_bar.rect.296, geom_bar.rect.298)
  geom_jitter.points.303
  geom_jitter.points.305
  guide.rect.357
  guide.rect.358
 ylabel.text.382
 xlabel.text.380
 title

Could someone be so kind and create the proper call to grid.gedit() to
access a couple of different aspects of this graph?
I tried:
grid.gedit(gPath("ylabel.text.382","labels"), gp=gpar(fontsize=16)) # error

I'd like to change the margins on the label for the yaxis (not the tick
marks) to put more space between the label and the tick marks.  I'd also
like to remove the left border on the first panel.  I'd like to adjust the
size of the font for the axis labels independently of the tick marks. I'd
like to change the color of the lines that make up the boxplots.  Plus, I'd
like to change the margins of the strip labels. If you could show me a
couple of examples I'm sure I cold get the rest working.

Thanks so much,
emilio

[[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] prediction using gam

2007-08-08 Thread Johnson, Elizabeth
I am fitting a two dimensional smoother in gam, say junk =
gam(y~s(x1,x2)), to a response variable y that is always positive and
pretty well behaved, both x1 and x2 are contained within [0,1].

 

I then create a new dataset for prediction with values of (x1,x2) within
the range of the original data.

 

predict(junk,newdata,type="response")

 

My predicted values are a bit strange (some negative and some large
positive values).

 

When I plot the predicted surface, it looks well behaved with no strange
dips/etc.

 

Could it be a problem with the predict command? 

Is there a "safe" version of predict for higher-dimensional smoothers in
gam?

 

Elizabeth Johnson

Research Associate

Johns Hopkins Unviersity

Department of Biostatistics

 

 


[[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] simulation-binomial

2007-08-08 Thread Kyle Henderson
That depends on what you meant by writing the conditional probability.
Bayes rule says that the probability of testing positive when one has the
disease is calculated as follows:

 Pr(T+ | D+)=(Pr(D+ | T+)*Pr(T+))/Pr(D+)

is that what you mean?


Kyle H. Ambert
Department of Behavioral Neuroscience
Oregon Health & Science University



On 8/8/07, sigalit mangut-leiba <[EMAIL PROTECTED]> wrote:
>
> hello,
> i want to do a binomial simulation, by taking 200 var. from one group (x)
> and 300 from another (y).
> the prob. for disease=.6 in both groups.
>
> x <- rbinom(200, 1, .6)
>
> y <- rbinom(300, 1, .6)
> if the person is from group x - the probability to find the disease,
> assuming the person is sick, is .95,
> if he is from group Y its .80.
> i want to know the joint probability: p(the person has the disease and
> tested sick)=P(D+,T+).
> my problem is how to write the conditional prob.
> Thanks for your help, also reference on this subject (binomial simulation)
> would be great.
> Sigalit.
>
> [[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.
>

[[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] small sample techniques

2007-08-08 Thread Thomas Lumley
On Wed, 8 Aug 2007, Nair, Murlidharan T wrote:

> Indeed, I understand what you say. The df of freedom for the dummy example is 
> n1+n2-2 = 8. But when I run the t.test I get it as 5.08, am I missing 
> something?
>

Yes. You are probably looking for the version of the t.test that assumes equal 
variances (the original one), so you need var.equal=TRUE.

  -thomas


> -Original Message-
> From: Moshe Olshansky [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, August 07, 2007 9:05 PM
> To: Nair, Murlidharan T; r-help@stat.math.ethz.ch
> Subject: Re: [R] small sample techniques
>
> Hi Nair,
>
> If the two populations are normal the t-test gives you
> the exact result for whatever the sample size is (the
> sample size will affect the number of degrees of
> freedom).
> When the populations are not normal and the sample
> size is large it is still OK to use t-test (because of
> the Central Limit Theorem) but this is not necessarily
> true for the small sample size.
> You could use simulation to find the relevant
> probabilities.
>
> --- "Nair, Murlidharan T" <[EMAIL PROTECTED]> wrote:
>
>> If my sample size is small is there a particular
>> switch option that I need to use with t.test so that
>> it calculates the t ratio correctly?
>>
>> Here is a dummy example?
>>
>> á =0.05
>>
>> Mean pain reduction for A =27; B =31 and SD are
>> SDA=9 SDB=12
>>
>> drgA.p<-rnorm(5,27,9);
>>
>> drgB.p<-rnorm(5,31,12)
>>
>> t.test(drgA.p,drgB.p) # what do I need to give as
>> additional parameter here?
>>
>>
>>
>> I can do it manually but was looking for a switch
>> option that I need to specify for  t.test.
>>
>>
>>
>> Thanks ../Murli
>>
>>
>>
>>
>>  [[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.
>

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

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


Re: [R] Mixture of Normals with Large Data

2007-08-08 Thread Thomas Lumley
On Wed, 8 Aug 2007, Martin Maechler wrote:

>> "BertG" == Bert Gunter <[EMAIL PROTECTED]>
>> on Tue, 7 Aug 2007 16:18:18 -0700 writes:
>
>  TV> Have you considered the situation of wanting to
>  TV> characterize probability densities of prevalence
>  TV> estimates based on a complex random sample of some
>  TV> large population.
>
>BertG> No -- and I stand by my statement. The empirical
>BertG> distribution of the data themselves are the best
>BertG> "characterization" of the density. You and others are
>BertG> free to disagree.
>
> I do agree with you Bert.
>> From a practical point of view however, you'd still want to use an
> approximation to the data ECDF, since the full ecdf is just too
> large an object to handle conveniently.
>
> One simple quite small and probably sufficient such
> approximation maybe
> using the equivalent of quantile(x, probs = (0:1000)/1000)
> which is pretty related to just working with a binned version of
> the original data; something others have proposed as well.
>

I have done Normal (actually logNormal) mixture fitting to pretty large data 
(particle counts by size) for summary purposes.  In that case it would not have 
done just as well to use quantiles as I had many sets of data (every three 
hours for several months) and the locations of the mixture components drift 
around  over time.  The location, scale, and mass of the four mixture 
components really were the best summaries. This was the application that 
constrOptim() was written for.

  -thomas

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

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


[R] fit.contrast - contrast testing with lme

2007-08-08 Thread Gang Chen
I need some help on contrast testing with lme. It seems fit.contrast  
in 'gmodels' package works fine for simple contrasting among levels  
of a factor such as

 > fit.contrast(fit.lme, "Trust", c(1,-1))
  Estimate   Std. Error   t-value   Pr(>|t|)
Trust c=( 1 -1 ) -0.001442638 0.0005836959 -2.471557 0.01566063

However if I want to compare some interaction terms, it does not work  
as I wanted:

 > fit.contrast(fit.lme, "Trust:Sex", c(1,-1,0,0))
Error in `contrasts<-`(`*tmp*`, value = c(0.5, -0.5, 0, 0,  
-0.353553390593274,  :
 contrasts apply only to factors

or,

 > fit.contrast(fit.lme, "TrustU:Sex", c(1,-1))
Error in `contrasts<-`(`*tmp*`, value = c(0.5, -0.5)) :
 contrasts apply only to factors

Is there a way I can run such tests? Also how can run an F test for a  
hypothesis like the following with either fit.contrast or lme?

H0: FreqHi - FreqLo = 0, and FreqNo - FreqLo = 0

I also tried to run contrasting directly in lme,  but could not get  
it work:

> anova(fit.lme, L=c("TrustT:Sex:Freq"=1, "TrustU:Sex:Freq"=-1))
Error in anova.lme(fit.lme, L = c("TrustT:Sex:Freq" = 1,  
"TrustU:Sex:Freq" = -1)) :
 Effects TrustT:Sex:Freq, TrustU:Sex:Freq not matched

I'm confused with the error message, and could not figure out what it  
means.

Here is more information:

>> fit.lme <- lme(Beta ~ Trust*Sex*Freq, random = ~1|Subj, Model)
>> summary(fit.lme)

Linear mixed-effects model fit by REML
Data: Model
  AIC   BIC   logLik
-825.4663 -791.4348 426.7331

Random effects:
Formula: ~1 | Subj
  (Intercept)Residual
StdDev: 0.001144573 0.001167392

Fixed effects: Beta ~ Trust * Sex * Freq
 ValueStd.Error DFt-value p-value
(Intercept) 0.0001090007 0.0005780194 77  0.1885762  0.8509
TrustU  0.0014426378 0.0005836959 77  2.4715572  0.0157
SexM0.0008230359 0.0005836959 77  1.4100423  0.1626
FreqLo  0.0001998191 0.0005836959 77  0.3423343  0.7330
FreqNo  0.0004900107 0.0005836959 77  0.8394965  0.4038
TrustU:SexM-0.0012598266 0.0008254707 77 -1.5261918  0.1311
TrustU:FreqLo  -0.0012383346 0.0008254707 77 -1.5001558  0.1377
TrustU:FreqNo  -0.0009141543 0.0008254707 77 -1.1074341  0.2716
SexM:FreqLo-0.0008469211 0.0008254707 77 -1.0259857  0.3081
SexM:FreqNo 0.0006361012 0.0008254707 77  0.7705922  0.4433
TrustU:SexM:FreqLo  0.0013272173 0.0011673918 77  1.1369082  0.2591
TrustU:SexM:FreqNo  0.0006241524 0.0011673918 77  0.5346555  0.5944
...


> anova(lme(Beta ~ Trust*Sex*Freq, random = ~1|Subj, Model))
>
 numDF denDF  F-value p-value
(Intercept)177 4.813938  0.0312
Trust  177 3.113293  0.0816
Sex177 3.535774  0.0638
Freq   277 6.083832  0.0035
Trust:Sex  177 1.634858  0.2049
Trust:Freq 277 0.678558  0.5104
Sex:Freq   277 2.165059  0.1217
Trust:Sex:Freq 277 0.647042  0.5264

Your help is highly appreciated.

Thanks,
Gang

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 nls-function

2007-08-08 Thread Michael Petram
Dear all

I have got some problems with a least-squares regression using the function nls.

I want to estimate h, k and X of the following formula by using nls :

exp(2*200*(q^2-4*h/k-0.25+(2/k-0.5+4*h^2/k^2)*log(abs((k*q^2+2*h*q-1)/(0.25*k-h-1)/((-k*q^2-2*h*q+1)*X)

y as defined by c(0.009747 0.001949 0.00 0.003899 0.00 0.00 
0.005848 0.001949)
q as defined by c(-0.7500 -0.6875 -0.5625 -0.4875 -0.4625 -0.4375 -0.4125 
-0.3875)

(length of  the real q and y is 46; too long to post them here)

i tought the correct using of nls would be:

Mic<-nls(y~"function", start = list(k=1.0,h=0.1,X=exp(10))

But it doesn`t work. i tryed an easier formula like :

Mic<-nls(y~h*exp(2*k*200*(q^2)), start=list(h=0.1,k=1,X=10))

The result was the same.


Isn`t  "nls"  the function i should use to solve this regression problem? Which 
things did i make wrong?



Thank you very much in advance

Michael

_
In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten!

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] small sample techniques

2007-08-08 Thread Nair, Murlidharan T
Indeed, I understand what you say. The df of freedom for the dummy example is 
n1+n2-2 = 8. But when I run the t.test I get it as 5.08, am I missing 
something? 

-Original Message-
From: Moshe Olshansky [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 07, 2007 9:05 PM
To: Nair, Murlidharan T; r-help@stat.math.ethz.ch
Subject: Re: [R] small sample techniques

Hi Nair,

If the two populations are normal the t-test gives you
the exact result for whatever the sample size is (the
sample size will affect the number of degrees of
freedom).
When the populations are not normal and the sample
size is large it is still OK to use t-test (because of
the Central Limit Theorem) but this is not necessarily
true for the small sample size.
You could use simulation to find the relevant
probabilities.

--- "Nair, Murlidharan T" <[EMAIL PROTECTED]> wrote:

> If my sample size is small is there a particular
> switch option that I need to use with t.test so that
> it calculates the t ratio correctly? 
> 
> Here is a dummy example?
> 
> á =0.05
> 
> Mean pain reduction for A =27; B =31 and SD are
> SDA=9 SDB=12
> 
> drgA.p<-rnorm(5,27,9); 
> 
> drgB.p<-rnorm(5,31,12)
> 
> t.test(drgA.p,drgB.p) # what do I need to give as
> additional parameter here?
> 
>  
> 
> I can do it manually but was looking for a switch
> option that I need to specify for  t.test. 
> 
>  
> 
> Thanks ../Murli
> 
>  
> 
> 
>   [[alternative HTML version deleted]]
> 
> > __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
>

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


Re: [R] Error: Cannot Coerce POSIXt to POSIXct when building package

2007-08-08 Thread Praveen Kanakamedala
Thank you very much for your response. I think I found the offending code.
It's somewhere in here.

setClass("timeSeries",

representation( Data = "matrix", positions = "character",

format = "character", FinCenter = "character",

units = "character", recordIDs = "data.frame",

title = "character", documentation = "character"),

prototype = list(

Data = matrix(NA, dimnames = list("31-Dec-2006", "timeSeries")),

positions = "31-Dec-2006",

format = "%d-%b-%Y",

FinCenter = myFinCenter(),

units = "Series",

recordIDs = data.frame(),

title = "Time Series Object",

documentation = paste("Created at",

myFinCenter(),

now()@Data)

)

)

myFinCenter <- function() return("London")

Funny enough...this worked in R-2.2.1 but doesn't work in R>2.2.1


On 8/8/07, Prof Brian Ripley <[EMAIL PROTECTED]> wrote:
>
> On Wed, 8 Aug 2007, Praveen Kanakamedala wrote:
>
> > A newbie here - please forgive me if this is a basic question.  We have
> an
> > in house package built in R 2.2.1 (yes we're a little behind the times
> at
> > our firm)and would like to rebuild it using R 2.5.1.  However, when I
> try
> > and build the package from source, I keep getting this error:
> >
> > Error in as(slotVal, slotClass, strict = FALSE) :
> >no method or default for coercing "POSIXt" to "POSIXct"
> > Error : unable to load R code in package 'Mango'
> > Error: package/namespace load failed for 'Mango'
> >
> >
> > I tried defining a new method "as.POSIXct" in the package to coerce
> POSIXt
> > to POSIXct and then added the as.POSIXct method to the "NAMSPACE"
> file.  The
> > build still doesn't work (I get the same error message). Any idea what I
> am
> > doing wrong? The coercion statement looks like this and works in R GUI:
>
> How did you get this?  There should be no objects of class 'POSIXt' alone,
> and I get e.g.
>
> > now <- Sys.time()
> > as(now, "POSIXct")
> Error in asMethod(object) : explicit coercion of old-style class (POSIXt,
> POSIXct) is not defined
>
> That can be fixed (see ?as), but you seem to have a malformed object in
> one of your slots.
>
> As often applies,
>
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>
>
> > #from is a vector of dates in the format "%d-%b-%Y")
> > from <- as.POSIXct(strptime(from, format = "%d%b%Y"), tz = "GMT")
> >
> > Here is my environment info:
> >
> > R version 2.5.1 (2007-06-27)
> > i386-pc-mingw32
> >
> > locale:
> > LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
> > Kingdom.1252;LC_MONETARY=English_United
> > Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
> >
> > attached base packages:
> > [1] "tcltk" "stats" "graphics"  "grDevices" "utils"
> "datasets"
> > "methods"   "base"
> >
> > other attached packages:
> >  fSeries  nnet  mgcv   fBasics fCalendar   fEcofin   spatial
> > MASS
> > "251.70"  "7.2-34"  "1.3-25"  "251.70"  "251.70"  "251.70"  "7.2-34"  "
> > 7.2-34"
> > I would sincerely appreciate any help.
> >
> >   [[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
>

[[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] Error: Cannot Coerce POSIXt to POSIXct when building package

2007-08-08 Thread Prof Brian Ripley
On Wed, 8 Aug 2007, Praveen Kanakamedala wrote:

> A newbie here - please forgive me if this is a basic question.  We have an
> in house package built in R 2.2.1 (yes we're a little behind the times at
> our firm)and would like to rebuild it using R 2.5.1.  However, when I try
> and build the package from source, I keep getting this error:
>
> Error in as(slotVal, slotClass, strict = FALSE) :
>no method or default for coercing "POSIXt" to "POSIXct"
> Error : unable to load R code in package 'Mango'
> Error: package/namespace load failed for 'Mango'
>
>
> I tried defining a new method "as.POSIXct" in the package to coerce POSIXt
> to POSIXct and then added the as.POSIXct method to the "NAMSPACE" file.  The
> build still doesn't work (I get the same error message). Any idea what I am
> doing wrong? The coercion statement looks like this and works in R GUI:

How did you get this?  There should be no objects of class 'POSIXt' alone, 
and I get e.g.

> now <- Sys.time()
> as(now, "POSIXct")
Error in asMethod(object) : explicit coercion of old-style class (POSIXt, 
POSIXct) is not defined

That can be fixed (see ?as), but you seem to have a malformed object in 
one of your slots.

As often applies,

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



> #from is a vector of dates in the format "%d-%b-%Y")
> from <- as.POSIXct(strptime(from, format = "%d%b%Y"), tz = "GMT")
>
> Here is my environment info:
>
> R version 2.5.1 (2007-06-27)
> i386-pc-mingw32
>
> locale:
> LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
> Kingdom.1252;LC_MONETARY=English_United
> Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] "tcltk" "stats" "graphics"  "grDevices" "utils" "datasets"
> "methods"   "base"
>
> other attached packages:
>  fSeries  nnet  mgcv   fBasics fCalendar   fEcofin   spatial
> MASS
> "251.70"  "7.2-34"  "1.3-25"  "251.70"  "251.70"  "251.70"  "7.2-34"  "
> 7.2-34"
> I would sincerely appreciate any help.
>
>   [[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] Changing font in boxplots

2007-08-08 Thread John Kane

--- Prof Brian Ripley <[EMAIL PROTECTED]> wrote:

> On Wed, 8 Aug 2007, G Iossa, School Biological
> Sciences wrote:
> 
> > Hi John,
> >
> > Thanks so much for such a quick reply.
> > I have tried to set all to Times font running
> >
> > par(font.lab=6) (not 4, maybe this is a local
> setting on my machine?)
> 
> '6' is a setting specific to certain devices on
> Windows.  You should 
> really be using font families (which are quite new
> and so not used in 
> many of the introductions).
> 
>   par(family="serif")
> 
> will change the default for all the text on
> subsequent plots to be in 
> a serif font, which on the windows() device is (by
> default) Times.
> 

Thanks, that works beautifully.  I had seen the
'family=" once but never needed it and forgot about
it.

> The R posting guide does ask you to tell us your OS,
> so that points like 
> this do not have to be guessed at.
> 
> > but now the boxplot shown has the x and y labels
> in Times New Roman and the
> > x and y axis still in Arial. Any idea why R is not
> setting those in Times?
> 
> Because you did not ask it to.  The font of axis
> annotation is set by 
> font.axis, not font.lab (which is controls title()'s
> xlab and ylab and 
> nothing in axis()).  See ?axis and ?par, both of
> which make this clear.
> 
> John Kane has claimed that what inline pars are used
> by boxplot() is 'not 
> clear from ?boxplot', but the lack of clarity is
> his, not in the 
> documentation. ?boxplot refers you to ?bxp, and that
> spells out exactly 
> which inline pars are used.
> 
> >
> > Thanks a lot for your advice,
> > Graziella
> >
> > --On 08 August 2007 09:16 -0400 John Kane
> <[EMAIL PROTECTED]> wrote:
> >
> >> I don't know if boxplot will accept a font
> argument.m
> >> From ?boxplot it is not clear.
> >> You may need to set the par() command before the
> >> boxplot
> >>
> >> Example:
> >> par(font.lab=4)
> >> boxplot(mass ~ family, data=mydata, ylab="mass
> %",
> >> xlab="family",las=1, cex.axis=1)
> >>
> >> --- "G Iossa, School Biological Sciences"
> >> <[EMAIL PROTECTED]> wrote:
> >>
> >>> Hi all,
> >>>
> >>> I am very new to R and this might be a simple
> >>> question but I have looked
> >>> everywhere you suggest before writing to you.
> >>>
> >>> I am trying to change font type from san-serif
> to a
> >>> serif (Times New
> >>> Romans) on all labels and axis of my boxplot. I
> have
> >>> used this function in
> >>> other plots before, e.g.:
> >>>
> >>> plot(residuals~lnlifespan, data=mydata,
> pch=psymb,
> >>> font=6, xlab="ln
> >>> reproductive lifespan", ylab="residuals ln
> mass",
> >>> font.lab=6, cex=1.5,
> >>> cex.axis=1.5, cex.lab=1.5)
> >>>
> >>> and found that font.lab or font.axis=6 gives
> Times
> >>> font. However, when I
> >>> try for boxplot:
> >>>
> >>> boxplot(mass ~ family, data=mydata, ylab="mass
> %",
> >>> xlab="family",
> >>> font.axis=6,  font=6, par(las=1), cex.axis=1)
> >>>
> >>> it does not work (R does not give any warning
> >>> messages). I have also tried
> >>> family="Times" but without success. Any idea of
> why
> >>> is not doing it and
> >>> what I can do to get Times font on my boxplot?
> >>> I run R on Windows.
> >>>
> >>> Thanks a lot,
> >>> Graziella
> >>>
> >>>
> >>
>
*
> >>> Dr. Graziella Iossa
> >>>
> >>> Mammal Research Unit
> >>> School Biological Sciences
> >>> University of Bristol
> >>> Woodland Road
> >>> Bristol BS8 1UG, UK
> >>>
> >>> E-mail: [EMAIL PROTECTED]
> >>> Tel 0044 (0)117 9288918
> >>> Fax 0044 (0)117 3317985
> >>>
> http://www.bio.bris.ac.uk/research/mammal/index.html
> >>> http://www.bio.bris.ac.uk/people/Iossa.htm
> 
> -- 
> 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] Error: Cannot Coerce POSIXt to POSIXct when building package

2007-08-08 Thread Praveen Kanakamedala
A newbie here - please forgive me if this is a basic question.  We have an
in house package built in R 2.2.1 (yes we're a little behind the times at
our firm)and would like to rebuild it using R 2.5.1.  However, when I try
and build the package from source, I keep getting this error:

Error in as(slotVal, slotClass, strict = FALSE) :
no method or default for coercing "POSIXt" to "POSIXct"
Error : unable to load R code in package 'Mango'
Error: package/namespace load failed for 'Mango'


I tried defining a new method "as.POSIXct" in the package to coerce POSIXt
to POSIXct and then added the as.POSIXct method to the "NAMSPACE" file.  The
build still doesn't work (I get the same error message). Any idea what I am
doing wrong? The coercion statement looks like this and works in R GUI:

#from is a vector of dates in the format "%d-%b-%Y")
from <- as.POSIXct(strptime(from, format = "%d%b%Y"), tz = "GMT")

Here is my environment info:

R version 2.5.1 (2007-06-27)
i386-pc-mingw32

locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
Kingdom.1252;LC_MONETARY=English_United
Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252

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

other attached packages:
  fSeries  nnet  mgcv   fBasics fCalendar   fEcofin   spatial
MASS
 "251.70"  "7.2-34"  "1.3-25"  "251.70"  "251.70"  "251.70"  "7.2-34"  "
7.2-34"
I would sincerely appreciate any help.

[[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] Changing font in boxplots

2007-08-08 Thread G Iossa, School Biological Sciences
Thanks everyone for your replies.

And sorry if I have not been clear enough in my query (although I did say 
that I run R on Windows).

Typing either par(family="serif")
or
par(font.axis=6)

solved the problem.

Much obliged,
Graziella

--On 08 August 2007 14:58 +0100 Prof Brian Ripley <[EMAIL PROTECTED]> 
wrote:

> On Wed, 8 Aug 2007, G Iossa, School Biological Sciences wrote:
>
>> Hi John,
>>
>> Thanks so much for such a quick reply.
>> I have tried to set all to Times font running
>>
>> par(font.lab=6) (not 4, maybe this is a local setting on my machine?)
>
> '6' is a setting specific to certain devices on Windows.  You should
> really be using font families (which are quite new and so not used in
> many of the introductions).
>
>   par(family="serif")
>
> will change the default for all the text on subsequent plots to be in a
> serif font, which on the windows() device is (by default) Times.
>
> The R posting guide does ask you to tell us your OS, so that points like
> this do not have to be guessed at.
>
>> but now the boxplot shown has the x and y labels in Times New Roman and
>> the x and y axis still in Arial. Any idea why R is not setting those in
>> Times?
>
> Because you did not ask it to.  The font of axis annotation is set by
> font.axis, not font.lab (which is controls title()'s xlab and ylab and
> nothing in axis()).  See ?axis and ?par, both of which make this clear.
>
> John Kane has claimed that what inline pars are used by boxplot() is 'not
> clear from ?boxplot', but the lack of clarity is his, not in the
> documentation. ?boxplot refers you to ?bxp, and that spells out exactly
> which inline pars are used.
>
>>
>> Thanks a lot for your advice,
>> Graziella
>>
>> --On 08 August 2007 09:16 -0400 John Kane <[EMAIL PROTECTED]> wrote:
>>
>>> I don't know if boxplot will accept a font argument.m
>>> From ?boxplot it is not clear.
>>> You may need to set the par() command before the
>>> boxplot
>>>
>>> Example:
>>> par(font.lab=4)
>>> boxplot(mass ~ family, data=mydata, ylab="mass %",
>>> xlab="family",las=1, cex.axis=1)
>>>
>>> --- "G Iossa, School Biological Sciences"
>>> <[EMAIL PROTECTED]> wrote:
>>>
 Hi all,

 I am very new to R and this might be a simple
 question but I have looked
 everywhere you suggest before writing to you.

 I am trying to change font type from san-serif to a
 serif (Times New
 Romans) on all labels and axis of my boxplot. I have
 used this function in
 other plots before, e.g.:

 plot(residuals~lnlifespan, data=mydata, pch=psymb,
 font=6, xlab="ln
 reproductive lifespan", ylab="residuals ln mass",
 font.lab=6, cex=1.5,
 cex.axis=1.5, cex.lab=1.5)

 and found that font.lab or font.axis=6 gives Times
 font. However, when I
 try for boxplot:

 boxplot(mass ~ family, data=mydata, ylab="mass %",
 xlab="family",
 font.axis=6,  font=6, par(las=1), cex.axis=1)

 it does not work (R does not give any warning
 messages). I have also tried
 family="Times" but without success. Any idea of why
 is not doing it and
 what I can do to get Times font on my boxplot?
 I run R on Windows.

 Thanks a lot,
 Graziella


>>> *
 Dr. Graziella Iossa

 Mammal Research Unit
 School Biological Sciences
 University of Bristol
 Woodland Road
 Bristol BS8 1UG, UK

 E-mail: [EMAIL PROTECTED]
 Tel 0044 (0)117 9288918
 Fax 0044 (0)117 3317985
 http://www.bio.bris.ac.uk/research/mammal/index.html
 http://www.bio.bris.ac.uk/people/Iossa.htm
>
> --
> 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



*
Dr. Graziella Iossa

Mammal Research Unit
School Biological Sciences
University of Bristol
Woodland Road
Bristol BS8 1UG, UK

E-mail: [EMAIL PROTECTED]
Tel 0044 (0)117 9288918
Fax 0044 (0)117 3317985
http://www.bio.bris.ac.uk/research/mammal/index.html
http://www.bio.bris.ac.uk/people/Iossa.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] Error: Cannot Coerce POSIXt to POSIXct when building package

2007-08-08 Thread Praveen Kanakamedala
A newbie here - please forgive me if this is a basic question.  We have an
in house package built in R 2.2.1 (yes we're a little behind the times at
our firm)and would like to rebuild it using R 2.5.1.  However, when I try
and build the package from source, I keep getting this error:

Error in as(slotVal, slotClass, strict = FALSE) :
no method or default for coercing "POSIXt" to "POSIXct"
Error : unable to load R code in package 'Mango'
Error: package/namespace load failed for 'Mango'


I tried defining a new method "as.POSIXct" in the package to coerce POSIXt
to POSIXct and then added the as.POSIXct method to the "NAMSPACE" file.  The
build still doesn't work (I get the same error message). Any idea what I am
doing wrong? The coercion statement looks like this and works in R GUI:

#from is a vector of dates in the format "%d-%b-%Y")
from <- as.POSIXct(strptime(from, format = "%d%b%Y"), tz = "GMT")

Here is my environment info:

R version 2.5.1 (2007-06-27)
i386-pc-mingw32

locale:
LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United
Kingdom.1252;LC_MONETARY=English_United
Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252

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

other attached packages:
  fSeries  nnet  mgcv   fBasics fCalendar   fEcofin   spatial
MASS
 "251.70"  "7.2-34"  "1.3-25"  "251.70"  "251.70"  "251.70"  "7.2-34"  "
7.2-34"
I would sincerely appreciate any help.

[[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] Changing font in boxplots

2007-08-08 Thread Robert Baer
> Hi John,
>
> Thanks so much for such a quick reply.
> I have tried to set all to Times font running
>
> par(font.lab=6) (not 4, maybe this is a local setting on my machine?)
>
> but now the boxplot shown has the x and y labels in Times New Roman and 
> the
> x and y axis still in Arial. Any idea why R is not setting those in Times?

Try
par(font.axis=6)

>
> Thanks a lot for your advice,
> Graziella
>
> --On 08 August 2007 09:16 -0400 John Kane <[EMAIL PROTECTED]> wrote:
>
>> I don't know if boxplot will accept a font argument.m
>> From ?boxplot it is not clear.
>> You may need to set the par() command before the
>> boxplot
>>
>> Example:
>> par(font.lab=4)
>> boxplot(mass ~ family, data=mydata, ylab="mass %",
>> xlab="family",las=1, cex.axis=1)
>>
>> --- "G Iossa, School Biological Sciences"
>> <[EMAIL PROTECTED]> wrote:
>>
>>> Hi all,
>>>
>>> I am very new to R and this might be a simple
>>> question but I have looked
>>> everywhere you suggest before writing to you.
>>>
>>> I am trying to change font type from san-serif to a
>>> serif (Times New
>>> Romans) on all labels and axis of my boxplot. I have
>>> used this function in
>>> other plots before, e.g.:
>>>
>>> plot(residuals~lnlifespan, data=mydata, pch=psymb,
>>> font=6, xlab="ln
>>> reproductive lifespan", ylab="residuals ln mass",
>>> font.lab=6, cex=1.5,
>>> cex.axis=1.5, cex.lab=1.5)
>>>
>>> and found that font.lab or font.axis=6 gives Times
>>> font. However, when I
>>> try for boxplot:
>>>
>>> boxplot(mass ~ family, data=mydata, ylab="mass %",
>>> xlab="family",
>>> font.axis=6,  font=6, par(las=1), cex.axis=1)
>>>
>>> it does not work (R does not give any warning
>>> messages). I have also tried
>>> family="Times" but without success. Any idea of why
>>> is not doing it and
>>> what I can do to get Times font on my boxplot?
>>> I run R on Windows.
>>>
>>> Thanks a lot,
>>> Graziella
>>>
>>>
>> *
>>> Dr. Graziella Iossa
>>>
>>> Mammal Research Unit
>>> School Biological Sciences
>>> University of Bristol
>>> Woodland Road
>>> Bristol BS8 1UG, UK
>>>
>>> E-mail: [EMAIL PROTECTED]
>>> Tel 0044 (0)117 9288918
>>> Fax 0044 (0)117 3317985
>>> http://www.bio.bris.ac.uk/research/mammal/index.html
>>> http://www.bio.bris.ac.uk/people/Iossa.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.
>>>
>>
>>
>>
>>   Ask a question on any topic and get answers from real people. Go to
>> Yahoo! Answers and share what you know at http://ca.answers.yahoo.com
>
>
>
> *
> Dr. Graziella Iossa
>
> Mammal Research Unit
> School Biological Sciences
> University of Bristol
> Woodland Road
> Bristol BS8 1UG, UK
>
> E-mail: [EMAIL PROTECTED]
> Tel 0044 (0)117 9288918
> Fax 0044 (0)117 3317985
> http://www.bio.bris.ac.uk/research/mammal/index.html
> http://www.bio.bris.ac.uk/people/Iossa.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.
>
> --- Scanned by M+ Guardian Messaging Firewall ---
>
HTH
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] Changing font in boxplots

2007-08-08 Thread Prof Brian Ripley
On Wed, 8 Aug 2007, G Iossa, School Biological Sciences wrote:

> Hi John,
>
> Thanks so much for such a quick reply.
> I have tried to set all to Times font running
>
> par(font.lab=6) (not 4, maybe this is a local setting on my machine?)

'6' is a setting specific to certain devices on Windows.  You should 
really be using font families (which are quite new and so not used in 
many of the introductions).

par(family="serif")

will change the default for all the text on subsequent plots to be in 
a serif font, which on the windows() device is (by default) Times.

The R posting guide does ask you to tell us your OS, so that points like 
this do not have to be guessed at.

> but now the boxplot shown has the x and y labels in Times New Roman and the
> x and y axis still in Arial. Any idea why R is not setting those in Times?

Because you did not ask it to.  The font of axis annotation is set by 
font.axis, not font.lab (which is controls title()'s xlab and ylab and 
nothing in axis()).  See ?axis and ?par, both of which make this clear.

John Kane has claimed that what inline pars are used by boxplot() is 'not 
clear from ?boxplot', but the lack of clarity is his, not in the 
documentation. ?boxplot refers you to ?bxp, and that spells out exactly 
which inline pars are used.

>
> Thanks a lot for your advice,
> Graziella
>
> --On 08 August 2007 09:16 -0400 John Kane <[EMAIL PROTECTED]> wrote:
>
>> I don't know if boxplot will accept a font argument.m
>> From ?boxplot it is not clear.
>> You may need to set the par() command before the
>> boxplot
>>
>> Example:
>> par(font.lab=4)
>> boxplot(mass ~ family, data=mydata, ylab="mass %",
>> xlab="family",las=1, cex.axis=1)
>>
>> --- "G Iossa, School Biological Sciences"
>> <[EMAIL PROTECTED]> wrote:
>>
>>> Hi all,
>>>
>>> I am very new to R and this might be a simple
>>> question but I have looked
>>> everywhere you suggest before writing to you.
>>>
>>> I am trying to change font type from san-serif to a
>>> serif (Times New
>>> Romans) on all labels and axis of my boxplot. I have
>>> used this function in
>>> other plots before, e.g.:
>>>
>>> plot(residuals~lnlifespan, data=mydata, pch=psymb,
>>> font=6, xlab="ln
>>> reproductive lifespan", ylab="residuals ln mass",
>>> font.lab=6, cex=1.5,
>>> cex.axis=1.5, cex.lab=1.5)
>>>
>>> and found that font.lab or font.axis=6 gives Times
>>> font. However, when I
>>> try for boxplot:
>>>
>>> boxplot(mass ~ family, data=mydata, ylab="mass %",
>>> xlab="family",
>>> font.axis=6,  font=6, par(las=1), cex.axis=1)
>>>
>>> it does not work (R does not give any warning
>>> messages). I have also tried
>>> family="Times" but without success. Any idea of why
>>> is not doing it and
>>> what I can do to get Times font on my boxplot?
>>> I run R on Windows.
>>>
>>> Thanks a lot,
>>> Graziella
>>>
>>>
>> *
>>> Dr. Graziella Iossa
>>>
>>> Mammal Research Unit
>>> School Biological Sciences
>>> University of Bristol
>>> Woodland Road
>>> Bristol BS8 1UG, UK
>>>
>>> E-mail: [EMAIL PROTECTED]
>>> Tel 0044 (0)117 9288918
>>> Fax 0044 (0)117 3317985
>>> http://www.bio.bris.ac.uk/research/mammal/index.html
>>> http://www.bio.bris.ac.uk/people/Iossa.htm

-- 
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] Successively eliminating most frequent elemets

2007-08-08 Thread Balazs Torma
Dear experts,

   I have a 10x2 matrix T containing random integers. I would like to delete 
pairs (rows) iteratively, which contain the most frequent element either in the 
first or second column:


T <- matrix(trunc(runif(20)*10), nrow=10, ncol=2)

G <- matrix(0, nrow=6, ncol=2)

for (i  in (1:6)){
  print("** Start iteration " ~i~ " ***")
  print("Current matrix:")
  print(T)

  m <- append(T[,1], T[,2])

  print("Concatenated columns:")
  print(m)
  

  # build frequency table
  F <- data.matrix(as.data.frame(table(m)))
  
  dimnames(F)<-NULL

  # pick up the most frequent element: sort decreasing and take is from the top
  F <- F[order(F[,2], decreasing=TRUE),]

  print("Freq. table:")
  print(F[1:5,])

  todel <- F[1,1] #rows containing the most frequent element will be deleted
  G[i,1] <- todel
  G[i,2] <- F[1,2]
  
  print("todel="~todel)

  # eliminate rows containing the most frequent element
  # either the first or the second column contains this element
  id <- which(T[,1]==todel)
  print("Indexes of rows to be deleted:")
  print(id)
  if (length(id)>0){
T <- T[-1*id, ]
  }
 
  id <- which(T[,2]==todel)
  print("Indexes of rows to be deleted:")
  print(id)
  if (length(id)>0){
T <- T[-1*id, ]
  }
  
  print("nrow(T)="~nrow(T))
  
}

print("Result matrix:")
print(G)

The output of the first two iterations looks like as follows. As one can see, 
the frequency table in the second iteration still contains the element deleted 
in the first iteration! Is this a bug or what am I doing here wrong?
Any help greatly appreciated!

[1] "** Start iteration 1 ***"
[1] "Current matrix:"
  [,1] [,2]
 [1,]22
 [2,]67
 [3,]99
 [4,]35
 [5,]40
 [6,]79
 [7,]57
 [8,]17
 [9,]96
[10,]33
[1] "Concatenated columns:"
 [1] 2 6 9 3 4 7 5 1 9 3 2 7 9 5 0 9 7 7 6 3
[1] "Freq. table:"
 [,1] [,2]
[1,]84
[2,]94
[3,]43
[4,]32
[5,]62
[1] "todel=8"
[1] "Indexes of rows to be deleted:"
integer(0)
[1] "Indexes of rows to be deleted:"
integer(0)
[1] "nrow(T)=10"
[1] "** Start iteration 2 ***"
[1] "Current matrix:"
  [,1] [,2]
 [1,]22
 [2,]67
 [3,]99
 [4,]35
 [5,]40
 [6,]79
 [7,]57
 [8,]17
 [9,]96
[10,]33
[1] "Concatenated columns:"
 [1] 2 6 9 3 4 7 5 1 9 3 2 7 9 5 0 9 7 7 6 3
[1] "Freq. table:"
 [,1] [,2]
[1,]84
[2,]94
[3,]43
[4,]32
[5,]62
[1] "todel=8"
[1] "Indexes of rows to be deleted:"
integer(0)
[1] "Indexes of rows to be deleted:"
integer(0)
[1] "nrow(T)=10"
[1] "** Start iteration 3 ***"
[1] "Current matrix:"
...

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Changing font in boxplots

2007-08-08 Thread G Iossa, School Biological Sciences
Hi John,

Thanks so much for such a quick reply.
I have tried to set all to Times font running

par(font.lab=6) (not 4, maybe this is a local setting on my machine?)

but now the boxplot shown has the x and y labels in Times New Roman and the 
x and y axis still in Arial. Any idea why R is not setting those in Times?

Thanks a lot for your advice,
Graziella

--On 08 August 2007 09:16 -0400 John Kane <[EMAIL PROTECTED]> wrote:

> I don't know if boxplot will accept a font argument.m
> From ?boxplot it is not clear.
> You may need to set the par() command before the
> boxplot
>
> Example:
> par(font.lab=4)
> boxplot(mass ~ family, data=mydata, ylab="mass %",
> xlab="family",las=1, cex.axis=1)
>
> --- "G Iossa, School Biological Sciences"
> <[EMAIL PROTECTED]> wrote:
>
>> Hi all,
>>
>> I am very new to R and this might be a simple
>> question but I have looked
>> everywhere you suggest before writing to you.
>>
>> I am trying to change font type from san-serif to a
>> serif (Times New
>> Romans) on all labels and axis of my boxplot. I have
>> used this function in
>> other plots before, e.g.:
>>
>> plot(residuals~lnlifespan, data=mydata, pch=psymb,
>> font=6, xlab="ln
>> reproductive lifespan", ylab="residuals ln mass",
>> font.lab=6, cex=1.5,
>> cex.axis=1.5, cex.lab=1.5)
>>
>> and found that font.lab or font.axis=6 gives Times
>> font. However, when I
>> try for boxplot:
>>
>> boxplot(mass ~ family, data=mydata, ylab="mass %",
>> xlab="family",
>> font.axis=6,  font=6, par(las=1), cex.axis=1)
>>
>> it does not work (R does not give any warning
>> messages). I have also tried
>> family="Times" but without success. Any idea of why
>> is not doing it and
>> what I can do to get Times font on my boxplot?
>> I run R on Windows.
>>
>> Thanks a lot,
>> Graziella
>>
>>
> *
>> Dr. Graziella Iossa
>>
>> Mammal Research Unit
>> School Biological Sciences
>> University of Bristol
>> Woodland Road
>> Bristol BS8 1UG, UK
>>
>> E-mail: [EMAIL PROTECTED]
>> Tel 0044 (0)117 9288918
>> Fax 0044 (0)117 3317985
>> http://www.bio.bris.ac.uk/research/mammal/index.html
>> http://www.bio.bris.ac.uk/people/Iossa.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.
>>
>
>
>
>   Ask a question on any topic and get answers from real people. Go to
> Yahoo! Answers and share what you know at http://ca.answers.yahoo.com



*
Dr. Graziella Iossa

Mammal Research Unit
School Biological Sciences
University of Bristol
Woodland Road
Bristol BS8 1UG, UK

E-mail: [EMAIL PROTECTED]
Tel 0044 (0)117 9288918
Fax 0044 (0)117 3317985
http://www.bio.bris.ac.uk/research/mammal/index.html
http://www.bio.bris.ac.uk/people/Iossa.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] Changing font in boxplots

2007-08-08 Thread John Kane
I don't know if boxplot will accept a font argument.m
>From ?boxplot it is not clear.
You may need to set the par() command before the
boxplot

Example: 
par(font.lab=4)
boxplot(mass ~ family, data=mydata, ylab="mass %",
xlab="family",las=1, cex.axis=1)

--- "G Iossa, School Biological Sciences"
<[EMAIL PROTECTED]> wrote:

> Hi all,
> 
> I am very new to R and this might be a simple
> question but I have looked 
> everywhere you suggest before writing to you.
> 
> I am trying to change font type from san-serif to a
> serif (Times New 
> Romans) on all labels and axis of my boxplot. I have
> used this function in 
> other plots before, e.g.:
> 
> plot(residuals~lnlifespan, data=mydata, pch=psymb,
> font=6, xlab="ln 
> reproductive lifespan", ylab="residuals ln mass",
> font.lab=6, cex=1.5, 
> cex.axis=1.5, cex.lab=1.5)
> 
> and found that font.lab or font.axis=6 gives Times
> font. However, when I 
> try for boxplot:
> 
> boxplot(mass ~ family, data=mydata, ylab="mass %",
> xlab="family", 
> font.axis=6,  font=6, par(las=1), cex.axis=1)
> 
> it does not work (R does not give any warning
> messages). I have also tried 
> family="Times" but without success. Any idea of why
> is not doing it and 
> what I can do to get Times font on my boxplot?
> I run R on Windows.
> 
> Thanks a lot,
> Graziella
> 
>
*
> Dr. Graziella Iossa
> 
> Mammal Research Unit
> School Biological Sciences
> University of Bristol
> Woodland Road
> Bristol BS8 1UG, UK
> 
> E-mail: [EMAIL PROTECTED]
> Tel 0044 (0)117 9288918
> Fax 0044 (0)117 3317985
> http://www.bio.bris.ac.uk/research/mammal/index.html
> http://www.bio.bris.ac.uk/people/Iossa.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-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] tapply grand mean

2007-08-08 Thread Chuck Cleland
Lauri Nikkinen wrote:
> Thanks Chuck but I would fancy the output made by tapply because the
> idea is to make a barplot based on those values.
>  
> -Lauri

sum1 <- summary(y ~ x + f, data = d, fun=mean,
method="cross", overall=TRUE)

df <- data.frame(x = sum1$x, f = sum1$f, y = sum1$S)

df
 xf y
11 lev1  6.452326
22 lev1  7.403041
33 lev1  6.117648
44 lev1  7.831390
55 lev1  6.746213
6  ALL lev1  6.910124
71 lev2 15.861256
82 lev2 17.296270
93 lev2 17.976864
10   4 lev2 19.696998
11   5 lev2 21.101952
12 ALL lev2 18.386668
13   1 lev3 61.393455
14   2 lev3 68.208299
15   3 lev3 73.479837
16   4 lev3 80.323382
17   5 lev3 87.430087
18 ALL lev3 74.167012
19   1  ALL 27.902346
20   2  ALL 30.969203
21   3  ALL 32.524783
22   4  ALL 35.950590
23   5  ALL 38.426084
24 ALL  ALL 33.154601

library(lattice)

barchart(y ~ x | f, data = df, layout=c(4,1,1))

OR

barchart(S ~ x | f, data = sum1, layout=c(4,1,1))

> 2007/8/8, Chuck Cleland <[EMAIL PROTECTED]
> >:
> 
> Lauri Nikkinen wrote:
> > Hi R-users,
> >
> > I have a data.frame like this (modificated from
> > https://stat.ethz.ch/pipermail/r-help/2007-August/138124.html).
> >
> > y1 <- rnorm(20) + 6.8
> > y2 <- rnorm(20) + (1:20* 1.7 + 1)
> > y3 <- rnorm(20) + (1:20*6.7 + 3.7)
> > y <- c(y1,y2,y3)
> > x <- rep(1:5,12)
> > f <- gl(3,20, labels=paste("lev", 1:3, sep=""))
> > d <- data.frame(x=x,y=y, f=f)
> >
> > and this is how I can calculate mean of these levels.
> >
> > tapply(d$y, list(d$x, d$f), mean)
> >
> > But how can I calculate the mean of d$x 1 and 2 and the grand mean
> of d$x 1,
> > 2, 3, 4, 5 (within d$f) into a table?
> 
> You might like the tables produced by summary.formula() in the Hmisc
> package:
> 
> library(Hmisc)
> 
> summary(y ~ x + f, data = d, fun=mean, method="cross", overall=TRUE)
> 
> UseMethod by x, f
> 
> +-+
> |N|
> |y|
> +-+
> +---+-+-+-+-+
> | x |   lev1  |   lev2  |   lev3  |   ALL   |
> +---+-+-+-+-+
> |1  | 4   | 4   | 4   |12   |
> |   | 6.452326|15.861256|61.393455|27.902346|
> +---+-+-+-+-+
> |2  | 4   | 4   | 4   |12   |
> |   | 7.403041|17.296270|68.208299|30.969203|
> +---+-+-+-+-+
> |3  | 4   | 4   | 4   |12   |
> |   | 6.117648|17.976864|73.479837|32.524783|
> +---+-+-+-+-+
> |4  | 4   | 4   | 4   |12   |
> |   | 7.831390|19.696998|80.323382|35.950590|
> +---+-+-+-+-+
> |5  | 4   | 4   | 4   |12   |
> |   | 6.746213|21.101952|87.430087|38.426084|
> +---+-+-+-+-+
> |ALL|20   |20   |20   |60   |
> |   | 6.910124|18.386668|74.167012|33.154601|
> +---+-+-+-+-+
> 
> summary(y ~ I(x %in% c(1,2)) + f, data = d, fun=mean, method="cross",
> overall=TRUE)
> 
> UseMethod by I(x %in% c(1, 2)), f
> 
> +-+
> |N|
> |y|
> +-+
> +-+-+-+-+-+
> |I(x %in% c(1, 2))|   lev1  |   lev2  |   lev3  |   ALL   |
> +-+-+-+-+-+
> |  FALSE  |12   |12   |12   |36   |
> | | 6.898417|19.591938|80.411102|35.633819|
> +-+-+-+-+-+
> |  TRUE   | 8   | 8   | 8   |24   |
> | | 6.927684|16.578763|64.800877|29.435774|
> +-+-+-+-+-+
> |  ALL|20   |20   |20   |60   |
> | | 6.910124|18.386668|74.167012|33.154601|
> +-+-+-+-+-+
> 
> > Regards,
> > Lauri
> >
> >   [[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 

-- 
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] Changing font in boxplots

2007-08-08 Thread G Iossa, School Biological Sciences
Hi all,

I am very new to R and this might be a simple question but I have looked 
everywhere you suggest before writing to you.

I am trying to change font type from san-serif to a serif (Times New 
Romans) on all labels and axis of my boxplot. I have used this function in 
other plots before, e.g.:

plot(residuals~lnlifespan, data=mydata, pch=psymb, font=6, xlab="ln 
reproductive lifespan", ylab="residuals ln mass", font.lab=6, cex=1.5, 
cex.axis=1.5, cex.lab=1.5)

and found that font.lab or font.axis=6 gives Times font. However, when I 
try for boxplot:

boxplot(mass ~ family, data=mydata, ylab="mass %", xlab="family", 
font.axis=6,  font=6, par(las=1), cex.axis=1)

it does not work (R does not give any warning messages). I have also tried 
family="Times" but without success. Any idea of why is not doing it and 
what I can do to get Times font on my boxplot?
I run R on Windows.

Thanks a lot,
Graziella

*
Dr. Graziella Iossa

Mammal Research Unit
School Biological Sciences
University of Bristol
Woodland Road
Bristol BS8 1UG, UK

E-mail: [EMAIL PROTECTED]
Tel 0044 (0)117 9288918
Fax 0044 (0)117 3317985
http://www.bio.bris.ac.uk/research/mammal/index.html
http://www.bio.bris.ac.uk/people/Iossa.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] Mixture of Normals with Large Data

2007-08-08 Thread Martin Maechler
> "BertG" == Bert Gunter <[EMAIL PROTECTED]>
> on Tue, 7 Aug 2007 16:18:18 -0700 writes:

  TV> Have you considered the situation of wanting to
  TV> characterize probability densities of prevalence
  TV> estimates based on a complex random sample of some
  TV> large population.

BertG> No -- and I stand by my statement. The empirical
BertG> distribution of the data themselves are the best
BertG> "characterization" of the density. You and others are
BertG> free to disagree.

I do agree with you Bert.
>From a practical point of view however, you'd still want to use an
approximation to the data ECDF, since the full ecdf is just too
large an object to handle conveniently.

One simple quite small and probably sufficient such
approximation maybe
using the equivalent of quantile(x, probs = (0:1000)/1000)
which is pretty related to just working with a binned version of
the original data; something others have proposed as well.

Martin 

BertG> On 8/7/07, Bert Gunter <[EMAIL PROTECTED]>
BertG> wrote:
>> Why would anyone want to fit a mixture of normals with
>> 110 million observations?? Any questions about the
>> distribution that you would care to ask can be answered
>> directly from the data. Of course, any test of
BertG> normality
>> (or anything else) would be rejected.
>> 
>> More to the point, the data are certainly not a random
>> sample of anything.  There will be all kinds of
>> systematic nonrandom structure in them. This is clearly a
>> situation where the researcher needs to think more
>> carefully
BertG> about
>> the substantive questions of interest and how the data
>> may shed light on them, instead of arbitrarily and
>> perhaps reflexively throwing some silly statistical
>> methodology at them.
>> 
>> Bert Gunter Genentech Nonclinical Statistics
>> 
>> -Original Message- From:
>> [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] On Behalf Of
>> Tim Victor Sent: Tuesday, August 07, 2007 3:02 PM To:
>> r-help@stat.math.ethz.ch Subject: Re: [R] Mixture of
>> Normals with Large Data
>> 
>> I wasn't aware of this literature, thanks for the
>> references.
>> 
>> On 8/5/07, RAVI VARADHAN <[EMAIL PROTECTED]> wrote: >
>> Another possibility is to use "data squashing" methods.
>> Relevant papers are: (1) DuMouchel et al. (1999), (2)
>> Madigan et al. (2002), and (3) Owen (1999).
>> >
>> > Ravi.  >
>> 
>> >
>> > Ravi Varadhan, Ph.D.  > Assistant Professor, > Division
>> of Geriatric Medicine and Gerontology > School of
>> Medicine > Johns Hopkins University
>> >
>> > Ph. (410) 502-2619 > email: [EMAIL PROTECTED]
>> >
>> >
>> > - Original Message - > From: "Charles C. Berry"
>> <[EMAIL PROTECTED]> > Date: Saturday, August 4, 2007
>> 8:01 pm > Subject: Re: [R] Mixture of Normals with Large
>> Data > To: [EMAIL PROTECTED] > Cc:
>> r-help@stat.math.ethz.ch
>> >
>> >
>> > > On Sat, 4 Aug 2007, Tim Victor wrote:
>> > >
>> > > > All:
>> > >  >
>> > > > I am trying to fit a mixture of 2 normals with >
>> 110 million > > observations. I > > > am running R 2.5.1
>> on a box with 1gb RAM running 32-bit windows and > > I >
>> > > continue to run out of memory. Does anyone have any
>> suggestions.
>> > >
>> > >
>> > > If the first few million observations can be regarded
>> as a SRS of the
>> > >
>> > > rest, then just use them. Or read in blocks of a
>> convenient size and
>> > >
>> > > sample some observations from each block. You can
>> repeat this process > > a > > few times to see if the
>> results are sufficiently accurate.
>> > >
>> > > Otherwise, read in blocks of a convenient size
>> (perhaps 1 million > > observations at a time), quantize
>> the data to a manageable number of
>> > >
>> > > intervals - maybe a few thousand - and tabulate
>> it. Add the counts > > over > > all the blocks.
>> > >
>> > > Then use mle() to fit a multinomial likelihood whose
>> probabilities > > are the > > masses associated with each
>> bin under a mixture of normals law.
>> > >
>> > > Chuck
>> > >
>> > >  >
>> > > > Thanks so much,
>> > >  >
>> > > > Tim
>> > >  >
>> > > > [[alternative HTML version deleted]]
>> > >  >
>> > > > __ > >
>> > R-help@stat.math.ethz.ch mailing list
>> > >  >
>> > > > PLEASE do read the posting guide > > > and provide
>> commented, minimal, self-contained, reproducible code.
>> > >  >
>> > >
>> > > Charles C. Berry (858) 534-2098 > > Dept of > >
>> Family/Preventive Medicine > > E UC San Diego > > La
>> Jolla, San Diego 92093-0

Re: [R] tapply grand mean

2007-08-08 Thread Lauri Nikkinen
Thanks Chuck but I would fancy the output made by tapply because the idea is
to make a barplot based on those values.

-Lauri


2007/8/8, Chuck Cleland <[EMAIL PROTECTED]>:
>
> Lauri Nikkinen wrote:
> > Hi R-users,
> >
> > I have a data.frame like this (modificated from
> > https://stat.ethz.ch/pipermail/r-help/2007-August/138124.html).
> >
> > y1 <- rnorm(20) + 6.8
> > y2 <- rnorm(20) + (1:20*1.7 + 1)
> > y3 <- rnorm(20) + (1:20*6.7 + 3.7)
> > y <- c(y1,y2,y3)
> > x <- rep(1:5,12)
> > f <- gl(3,20, labels=paste("lev", 1:3, sep=""))
> > d <- data.frame(x=x,y=y, f=f)
> >
> > and this is how I can calculate mean of these levels.
> >
> > tapply(d$y, list(d$x, d$f), mean)
> >
> > But how can I calculate the mean of d$x 1 and 2 and the grand mean of
> d$x 1,
> > 2, 3, 4, 5 (within d$f) into a table?
>
> You might like the tables produced by summary.formula() in the Hmisc
> package:
>
> library(Hmisc)
>
> summary(y ~ x + f, data = d, fun=mean, method="cross", overall=TRUE)
>
> UseMethod by x, f
>
> +-+
> |N|
> |y|
> +-+
> +---+-+-+-+-+
> | x |   lev1  |   lev2  |   lev3  |   ALL   |
> +---+-+-+-+-+
> |1  | 4   | 4   | 4   |12   |
> |   | 6.452326|15.861256|61.393455|27.902346|
> +---+-+-+-+-+
> |2  | 4   | 4   | 4   |12   |
> |   | 7.403041|17.296270|68.208299|30.969203|
> +---+-+-+-+-+
> |3  | 4   | 4   | 4   |12   |
> |   | 6.117648|17.976864|73.479837|32.524783|
> +---+-+-+-+-+
> |4  | 4   | 4   | 4   |12   |
> |   | 7.831390|19.696998|80.323382|35.950590|
> +---+-+-+-+-+
> |5  | 4   | 4   | 4   |12   |
> |   | 6.746213|21.101952|87.430087|38.426084|
> +---+-+-+-+-+
> |ALL|20   |20   |20   |60   |
> |   | 6.910124|18.386668|74.167012|33.154601|
> +---+-+-+-+-+
>
> summary(y ~ I(x %in% c(1,2)) + f, data = d, fun=mean, method="cross",
> overall=TRUE)
>
> UseMethod by I(x %in% c(1, 2)), f
>
> +-+
> |N|
> |y|
> +-+
> +-+-+-+-+-+
> |I(x %in% c(1, 2))|   lev1  |   lev2  |   lev3  |   ALL   |
> +-+-+-+-+-+
> |  FALSE  |12   |12   |12   |36   |
> | | 6.898417|19.591938|80.411102|35.633819|
> +-+-+-+-+-+
> |  TRUE   | 8   | 8   | 8   |24   |
> | | 6.927684|16.578763|64.800877|29.435774|
> +-+-+-+-+-+
> |  ALL|20   |20   |20   |60   |
> | | 6.910124|18.386668|74.167012|33.154601|
> +-+-+-+-+-+
>
> > Regards,
> > Lauri
> >
> >   [[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
>

[[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] tapply grand mean

2007-08-08 Thread Chuck Cleland
Lauri Nikkinen wrote:
> Hi R-users,
> 
> I have a data.frame like this (modificated from
> https://stat.ethz.ch/pipermail/r-help/2007-August/138124.html).
> 
> y1 <- rnorm(20) + 6.8
> y2 <- rnorm(20) + (1:20*1.7 + 1)
> y3 <- rnorm(20) + (1:20*6.7 + 3.7)
> y <- c(y1,y2,y3)
> x <- rep(1:5,12)
> f <- gl(3,20, labels=paste("lev", 1:3, sep=""))
> d <- data.frame(x=x,y=y, f=f)
> 
> and this is how I can calculate mean of these levels.
> 
> tapply(d$y, list(d$x, d$f), mean)
> 
> But how can I calculate the mean of d$x 1 and 2 and the grand mean of d$x 1,
> 2, 3, 4, 5 (within d$f) into a table?

  You might like the tables produced by summary.formula() in the Hmisc
package:

library(Hmisc)

summary(y ~ x + f, data = d, fun=mean, method="cross", overall=TRUE)

 UseMethod by x, f

+-+
|N|
|y|
+-+
+---+-+-+-+-+
| x |   lev1  |   lev2  |   lev3  |   ALL   |
+---+-+-+-+-+
|1  | 4   | 4   | 4   |12   |
|   | 6.452326|15.861256|61.393455|27.902346|
+---+-+-+-+-+
|2  | 4   | 4   | 4   |12   |
|   | 7.403041|17.296270|68.208299|30.969203|
+---+-+-+-+-+
|3  | 4   | 4   | 4   |12   |
|   | 6.117648|17.976864|73.479837|32.524783|
+---+-+-+-+-+
|4  | 4   | 4   | 4   |12   |
|   | 7.831390|19.696998|80.323382|35.950590|
+---+-+-+-+-+
|5  | 4   | 4   | 4   |12   |
|   | 6.746213|21.101952|87.430087|38.426084|
+---+-+-+-+-+
|ALL|20   |20   |20   |60   |
|   | 6.910124|18.386668|74.167012|33.154601|
+---+-+-+-+-+

summary(y ~ I(x %in% c(1,2)) + f, data = d, fun=mean, method="cross",
overall=TRUE)

 UseMethod by I(x %in% c(1, 2)), f

+-+
|N|
|y|
+-+
+-+-+-+-+-+
|I(x %in% c(1, 2))|   lev1  |   lev2  |   lev3  |   ALL   |
+-+-+-+-+-+
|  FALSE  |12   |12   |12   |36   |
| | 6.898417|19.591938|80.411102|35.633819|
+-+-+-+-+-+
|  TRUE   | 8   | 8   | 8   |24   |
| | 6.927684|16.578763|64.800877|29.435774|
+-+-+-+-+-+
|  ALL|20   |20   |20   |60   |
| | 6.910124|18.386668|74.167012|33.154601|
+-+-+-+-+-+

> Regards,
> Lauri
> 
>   [[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.


[R] tapply grand mean

2007-08-08 Thread Lauri Nikkinen
Hi R-users,

I have a data.frame like this (modificated from
https://stat.ethz.ch/pipermail/r-help/2007-August/138124.html).

y1 <- rnorm(20) + 6.8
y2 <- rnorm(20) + (1:20*1.7 + 1)
y3 <- rnorm(20) + (1:20*6.7 + 3.7)
y <- c(y1,y2,y3)
x <- rep(1:5,12)
f <- gl(3,20, labels=paste("lev", 1:3, sep=""))
d <- data.frame(x=x,y=y, f=f)

and this is how I can calculate mean of these levels.

tapply(d$y, list(d$x, d$f), mean)

But how can I calculate the mean of d$x 1 and 2 and the grand mean of d$x 1,
2, 3, 4, 5 (within d$f) into a table?

Regards,
Lauri

[[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] Interaction factor and numeric variable versus separate

2007-08-08 Thread Sven Garbade
Thanks to all for the very helpful replies & the reference to a chapter
in MASS!

Sven

On Tue, 2007-08-07 at 12:07 -0400, Gabor Grothendieck wrote:
> Also check this post
> 
> https://stat.ethz.ch/pipermail/r-help/2007-May/132866.html
> 
> for a number of formulations.
> 
> On 8/7/07, Ted Harding <[EMAIL PROTECTED]> wrote:
> > On 07-Aug-07 15:34:13, Gabor Grothendieck wrote:
> > > In the single model all three levels share the same intercept which
> > > means that the slope must change to accomodate it
> > > whereas in the three separate models they each have their own
> > > intercept.
> >
> > I think this arose because of the formulation of the "model with
> > interaction" as:
> >
> >  summary(lm(y~x:f, data=d))
> >
> > If it has been formulated as
> >
> >  summary(lm(y~x*f, data=d))
> >
> > there would be three separate intercepts, and three different slopes
> > (and the differences would be the same as the differences for the
> > separate models).
> >
> > Ted.
> >
> > > Try looking at it graphically and note how the black dotted lines
> > > are all forced to go through the same intercept, i.e. the same point
> > > on the y axis, whereas the red dashed lines are each able to
> > > fit their portion of the data using both the intercept and the slope.
> > >
> > > y.lm <- lm(y~x:f, data=d)
> > > plot(y ~ x, d, col = as.numeric(d$f), xlim = c(-5, 20))
> > > for(i in 1:3) {
> > >   abline(a = coef(y.lm)[1], b = coef(y.lm)[1+i], lty = "dotted")
> > >   abline(lm(y ~ x, d[as.numeric(d$f) == i,]), col = "red", lty =
> > > "dashed")
> > > }
> > > grid()
> > >
> > >
> > > On 8/7/07, Sven Garbade <[EMAIL PROTECTED]> wrote:
> > >> Dear list members,
> > >>
> > >> I have problems to interpret the coefficients from a lm model
> > >> involving
> > >> the interaction of a numeric and factor variable compared to separate
> > >> lm
> > >> models for each level of the factor variable.
> > >>
> > >> ## data:
> > >> y1 <- rnorm(20) + 6.8
> > >> y2 <- rnorm(20) + (1:20*1.7 + 1)
> > >> y3 <- rnorm(20) + (1:20*6.7 + 3.7)
> > >> y <- c(y1,y2,y3)
> > >> x <- rep(1:20,3)
> > >> f <- gl(3,20, labels=paste("lev", 1:3, sep=""))
> > >> d <- data.frame(x=x,y=y, f=f)
> > >>
> > >> ## plot
> > >> # xyplot(y~x|f)
> > >>
> > >> ## lm model with interaction
> > >> summary(lm(y~x:f, data=d))
> > >>
> > >> Call:
> > >> lm(formula = y ~ x:f, data = d)
> > >>
> > >> Residuals:
> > >>Min  1Q  Median  3Q Max
> > >> -2.8109 -0.8302  0.2542  0.6737  3.5383
> > >>
> > >> Coefficients:
> > >>Estimate Std. Error t value Pr(>|t|)
> > >> (Intercept)  3.687990.41045   8.985 1.91e-12 ***
> > >> x:flev1  0.208850.04145   5.039 5.21e-06 ***
> > >> x:flev2  1.496700.04145  36.109  < 2e-16 ***
> > >> x:flev3  6.708150.04145 161.838  < 2e-16 ***
> > >> ---
> > >> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> > >>
> > >> Residual standard error: 1.53 on 56 degrees of freedom
> > >> Multiple R-Squared: 0.9984, Adjusted R-squared: 0.9984
> > >> F-statistic: 1.191e+04 on 3 and 56 DF,  p-value: < 2.2e-16
> > >>
> > >> ## separate lm fits
> > >> lapply(by(d, d$f, function(x) lm(y ~ x, data=x)), coef)
> > >> $lev1
> > >> (Intercept)   x
> > >>  6.77022860 -0.01667528
> > >>
> > >> $lev2
> > >> (Intercept)   x
> > >>   1.0190781.691982
> > >>
> > >> $lev3
> > >> (Intercept)   x
> > >>   3.2746566.738396
> > >>
> > >>
> > >> Can anybody give me a hint why the coefficients for the slopes
> > >> (especially for lev1) are so different and how the coefficients from
> > >> the
> > >> lm model with interaction are related to the separate fits?
> > >>
> > >> Thanks, Sven

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] saving output

2007-08-08 Thread Jim Lemon
Lynn Disney wrote:
> I have a question about how to save the output of a logistic regression
> model in some format (delimited, preferably) so that I can manipulate it
> to make nice tables in excel. I have tried print, save, write, none seem
> to do what I want them to. Does anyone have any ideas?
> 
Hi Lynn,
This is an interesting idea that might be useful in the prettyR package. 
You have just volunteered to be a test pilot.

delim.table<-function(x,con="",delim="\t") {
  if(nchar(con)) {
   con<-file(con,"w")
   open.con<-TRUE
  }
  else open.con<-FALSE
  column.names<-names(x)
  if(is.null(column.names)) column.names<-colnames(x)
  have.col.names<-!is.null(column.names)
  row.names<-rownames(x)
  have.row.names<-!is.null(row.names)
  xdim<-dim(x)
  if(have.col.names) {
   cat(delim,file=con)
   for(col in 1:xdim[2])
cat(column.names[col],delim,sep="",file=con)
   cat("\n",file=con)
  }
  for(row in 1:xdim[1]) {
   if(have.row.names) cat(row.names[row],file=con)
   cat(delim,file=con)
   for(col in 1:xdim[2]) cat(x[row,col],delim,sep="",file=con)
   cat("\n",file=con)
  }
  if(open.con) close(con)
}

test.df<-data.frame(a=sample(0:1,100,TRUE),b=rnorm(100),c=rnorm(100))
delim.table(
  summary(glm(a~b*c,test.df,family="binomial"))$coefficients,
  con="test.csv")

This output should import into Excel with no trouble (it does in 
OpenOffice Calc). Either use sink() or specify a filename as in the example.

Jim

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Namespace problem

2007-08-08 Thread Dimitri Mahieux
Hi All,

I have some questions about making a R-package. I would like to use a 
namespace. The package contains analysis functions and also
a graphical user interface. I would like to allow user to use only the 
analysis function and not the GUI functions which are mainly
bindings to graphical elements. I have exported analysis functions using 
export directives in a namespace file but when I want to use
the GUI, it seems that all the GUI functions are unknown.

Is there a way to solve this problem ?

thx a lot

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Find out the workspace name

2007-08-08 Thread Prof Brian Ripley
On Wed, 8 Aug 2007, ONKELINX, Thierry wrote:

> ?getwd()

and ?setWindowTitle, which even has this as the first example.

help.search("window title") gets you there.


>> [mailto:[EMAIL PROTECTED] Namens Luis Ridao Cruz
>>
>> Sometimes there might be several R sessions open at the same
>> time. In Windows no name appears in the R main bar (just R
>> Console)
>>
>> Is it possible to know the name of the workspace.
>> I ussually write it on the script I am working on but I wish
>> to know without having to search in a text file.

-- 
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] Find out the workspace name

2007-08-08 Thread ONKELINX, Thierry
?getwd()



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
[EMAIL PROTECTED]
www.inbo.be 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

 

> -Oorspronkelijk bericht-
> Van: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] Namens Luis Ridao Cruz
> Verzonden: woensdag 8 augustus 2007 11:39
> Aan: r-help@stat.math.ethz.ch
> Onderwerp: [R] Find out the workspace name
> 
> R-help,
> 
> Sometimes there might be several R sessions open at the same 
> time. In Windows no name appears in the R main bar (just R
> Console)
> 
> Is it possible to know the name of the workspace.
> I ussually write it on the script I am working on but I wish 
> to know without having to search in a text file.
> 
> Thanks in advance
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] test for contingency table when there are many zeros

2007-08-08 Thread gallon li
Here is my table

> tt
A   B
1 297 398
2 470 376
3  30  23
4   3   3
5   0   0

b/c two cells are zero, I can't use chisq.test() in R which gives the
following output;


> chisq.test(tt)

Pearson's Chi-squared test

data:  tt
X-squared = NaN, df = 4, p-value = NA

Warning message:
Chi-squared approximation may be incorrect in: chisq.test(tt)

What function should I use then? Any suggestion?

[[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] simulation-binomial

2007-08-08 Thread sigalit mangut-leiba
hello,
i want to do a binomial simulation, by taking 200 var. from one group (x)
and 300 from another (y).
the prob. for disease=.6 in both groups.

x <- rbinom(200, 1, .6)

y <- rbinom(300, 1, .6)
if the person is from group x - the probability to find the disease,
assuming the person is sick, is .95,
if he is from group Y its .80.
i want to know the joint probability: p(the person has the disease and
tested sick)=P(D+,T+).
my problem is how to write the conditional prob.
Thanks for your help, also reference on this subject (binomial simulation)
would be great.
Sigalit.

[[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] Odp: Error in as.double.default(x) : (list) object cannot be coerced to 'double'

2007-08-08 Thread Petr PIKAL
Hi

Far from beeing an expert I can decide from your post that you probably 
mix R objects matrix x data frame x list. All of them have specific 
features and you sometimes cannot convert one to another easily. See what 
your objects are and how they look like by e.g.

str(X1)
or mode or typeof

I suspect that your X are lists and using c(some lists) result again into 
list.

Plot expect x and y values usually as vectors but there are plot methods 
for other objects (data.frames, functions, ...) 

Best starting point would be help page for plot.

Regards
Petr


[EMAIL PROTECTED] napsal dne 07.08.2007 15:33:41:

> Dear experts,
> 
> I have in all 14 matrices which stands for gene expression divergence 
and 14 
> matrices which stands for gene sequence divergence. I have tried joining 
them 
> by using the concatanation function giving
> 
> SequenceDivergence <- c(X1,X2,X3,X4,X5,X6,X7,X8,X9,X10,X11,X12,X13,X14)
> ExpressionDivergence <- 
c(Y1,Y2,Y3,Y4,Y5,Y6,Y7,Y8,Y9,Y10,Y11,Y12,Y13,Y14) 
> 
> where X1,X2..X14 are the expression matrices containing r-values and 
> Y1,Y2..Y14 are the ones with patristic distances
> 
> Now, I want to plot SequenceDivergence vs. Expression Divergence
> 
> Tried doing that using plot (Sequence Divergence vs. Expression 
Divergence)
> 
> But then getting the error 
> 
>  Error in as.double.default(x) : (list) object cannot be coerced to 
'double'
> 
> Note: The diagonal values for X1 was neglected as its seems to give some 
bias 
> in my results. Code to derive X1,X2,X3..and Y1,Y2,Y3 is given as:
> 
> > EDant <- read.table("C:/ant.txt",sep="\t")
> > ED1 <- as.matrix(EDant)
> > X1 <- lapply(1:ncol(ED15), function(a) ED15[-a, a]) # to neglect 
diagonal values 
> 
> I am attaching couple of matrices for your reference. ANT.txt is X1 
after 
> deleting the diagnol values, similarly,ANTEXP.TXT is Y1,  apetella.txt 
is X2 and 
> apetellaexp.txt is Y2
> 
> I tried reading R-manual and other sources but have'nt cracked it yet. 
Can 
> anyone please help me regarding that?
> 
>  Thanks very much
> 
>  Yours sincerely,
> 
>  Urmi Trivedi. 
> 
> 
> 
> -
>  Once upon a time there was 1 GB storage in your inbox. Click here for 
happy 
> ending.0   1.21133   1.420221   1.499358   1.475149   1.513886 1.608816  
1.
> 675916   1.859038   1.992958   2.420123   2.309414   2.413222
> 1.21133   0   1.463585   1.542722   1.518513   1.55725   1.65218 1.71928 
 
> 1.902402   2.036322   2.463487   2.352778   2.456586
> 1.420221   1.463585   0   1.418619   1.39441   1.433147   1.528077 
1.595177 
> 1.778299   1.912219   2.339384   2.228675   2.332483
> 1.499358   1.542722   1.418619   0   0.931235   0.969972   1.354498 
1.421598
> 1.60472   1.73864   2.165805   2.055096   2.158904
> 1.475149   1.518513   1.39441   0.931235   0   0.206013   1.330289 
1.397389 
> 1.580511   1.714431   2.141596   2.030887   2.134695
> 1.513886   1.55725   1.433147   0.969972   0.206013   0   1.369026 
1.436126 
> 1.619248   1.753168   2.180333   2.069624   2.173432
> 1.608816   1.65218   1.528077   1.354498   1.330289   1.369026   0 
0.604972 
> 1.537696   1.671616   2.098781   1.988072   2.09188
> 1.675916   1.71928   1.595177   1.421598   1.397389   1.436126 0.604972  
0 
> 1.604796   1.738716   2.165881   2.055172   2.15898
> 1.859038   1.902402   1.778299   1.60472   1.580511   1.619248 1.537696  
1.
> 604796   0   1.09121   1.968427   1.857718   1.961526
> 1.992958   2.036322   1.912219   1.73864   1.714431   1.753168 1.671616  
1.
> 738716   1.09121   0   2.102347   1.991638   2.095446
> 2.420123   2.463487   2.339384   2.165805   2.141596   2.180333 2.098781 
 
> 2.165881   1.968427   2.102347   0   1.128701   1.232509
> 2.309414   2.352778   2.228675   2.055096   2.030887   2.069624 1.988072 
 
> 2.055172   1.857718   1.991638   1.128701   0   0.91546
> 2.413222   2.456586   2.332483   2.158904   2.134695   2.173432 2.09188  
2.
> 15898   1.961526   2.095446   1.232509   0.91546   0
> 1   -0.046373   -0.033044   0.003902   0.466827   0.389327   0.131989 
-0.
> 063346   -0.118093   0.016386   -0.140215   0.34511   0.233074
> -0.046373   1   0.000717   0.832227   0.077053   -0.106815   -0.050838 
0.
> 936431   0.297387   0.031358   -0.127265   0.31245   -0.053169
> -0.033044   0.000717   1   0.011265   -0.018602   -0.023669   -0.028744  
-0.
> 007588   0.148827   -0.007067   0.005362   -0.029172   -0.017367
> 0.003902   0.832227   0.011265   1   0.071247   -0.101225   0.097117 0.
> 829167   0.294396   0.017809   -0.129199   0.278831   -0.106427
> 0.466827   0.077053   -0.018602   0.071247   1   0.078241   0.140679 0.
> 070069   0.055744   0.013194   -0.196092   -0.027692   0.028857
> 0.389327   -0.106815   -0.023669   -0.101225   0.078241   1   0.140146 
-0.
> 086806   0.079   0.194904   0.068378   0.213288   0.194006
> 0.131989   -0.050838   -0.028744   0.097117   0.140679   0.140146   1 
-0.
> 075079   0.137652   0.065127   -0.072768   -0.120751   -0.101777
> -0.063346   0.936431   -0.0

[R] Find out the workspace name

2007-08-08 Thread Luis Ridao Cruz
R-help,

Sometimes there might be several R sessions open at the
same time. In Windows no name appears in the R main bar (just R
Console)

Is it possible to know the name of the workspace.
I ussually write it on the script I am working on but I wish
to know without having to search in a text file.

Thanks in advance

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Reading data from a string

2007-08-08 Thread Sigbert Klinke
Hi,

I'am looking for ways in R to read in data from a character string in my 
wiki. Currently I see two possibilities:

1.) write my own routine
2.) using read.table(textConnection(mydata))

Of course, I want to avoid writing my own routine and textConnection is 
a forbidden command by the R-PHP people (and I think they had good 
reasons for this). Does anybody know other possibilities?

Thanks in advance

  Sigbert Klinke

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 include bar values in a barplot?

2007-08-08 Thread Prof Brian Ripley
Please see

?format
?round

Note that text() is said to expect a character vector, so why did you 
supply a numeric vector?

   labels: a character vector or expression specifying the _text_ to be
   written.  An attempt is made to coerce other language objects
   (names and calls) to expressions, and vectors and other
   classed objects to character vectors by 'as.character'. If
   'labels' is longer than 'x' and 'y', the coordinates are
   recycled to the length of 'labels'.

and try as.character(vals) for yourself.

> Is there any way to round up those numbers?

See library(fortunes); fortune("Yoda")


On Wed, 8 Aug 2007, Donatas G. wrote:

> On Wednesday 08 August 2007 00:40:56 Donatas G. wrote:
>> On Tuesday 07 August 2007 22:09:52 Donatas G. wrote:
>>> How do I include bar values in a barplot (or other R graphics, where this
>>> could be applicable)?
>>>
>>> To make sure I am clear I am attaching a barplot created with
>>> OpenOffice.org which has barplot values written on top of each barplot.
>>
>> After more than two hours search I finally found a solution:
>> http://tolstoy.newcastle.edu.au/R/help/06/05/27286.html
>
> Hey, the solution happens to be only partiall... If the values are not real
> numbers, and have a lot of digits after the dot, the graph might become
> unreadable...
>
> see this
>
> vals <-
> c(1,1.1236886,4.77554676,5.3345245,1,1.1236886,4.77554676,5.3345245,5.5345245,5.4345245,1.1236886,4.77554676,5.3345245,1.1236886,4.77554676,5.3345245)
> names(vals) <- LETTERS[1:16]
> mp <- barplot(vals, ylim = c(0, 6))
> text(mp, vals, labels = vals, pos = 3)
>
> Is there any way to round up those numbers?
>
> I tried using
> options(digits=2)
> , and it does change the display of a table, but it does not influence the
> barplot...

Well, it does not affect as.character, nor should it.


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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Creating netcdf from table

2007-08-08 Thread Thomas Szegvary
Hi!

I have a table with 3 columns, 2 for long/lat coordinates and 1 for values
(radon concentration). I have Tables for every week of the year 2006, always
same coordinates but other values, i.e. time series. Now I want to create a
NetCDF file for, which is much easier to handle than 52 tables. I tried the
following for the first dataset (i.e first week):

W01<-read.table("RN_weekly/KW01_RN.dat")
long<-W01$V1
lat<-W01$V2
RN01<-W01$V3

dim1 <- dim.def.ncdf( "EW","degrees", as.double(long))
dim2 <- dim.def.ncdf( "SN","degrees", as.double(lat))

varz <- var.def.ncdf("Radon","Bq/m2/h1", list(dim1,dim2), -1, 
  longname="Radon flux rate")

nc.rn <- create.ncdf("rn_weekly.nc",varz)
put.var.ncdf(nc.rn,varz,RN01)
close.ncdf(nc.rn)


The problem now is that the last step (put.var.ncdf) doesn't work, because
it says I am trying to "error: you asked to write 111788329 values, but the
passed data array only has 10573 entries!". So I think the problem is I need
an array with two dimensions (coordinates...) for my values. But do I get
this from my tables??


Thanks for any help!
Thomas

My problem now is that 



__

Thomas Szegvary
Institute of Environmental Geosciences
Department of Geosciences
University of Basel
Bernoullistrasse 30
CH - 4056 Basel

Tel.  41-61-267 04 82
Fax. 41-61-267 04 79
Email: [EMAIL PROTECTED]
www.radon.unibas.ch
www.unibas.ch/environment

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 include bar values in a barplot?

2007-08-08 Thread Donatas G.
On Wednesday 08 August 2007 00:40:56 Donatas G. wrote:
> On Tuesday 07 August 2007 22:09:52 Donatas G. wrote:
> > How do I include bar values in a barplot (or other R graphics, where this
> > could be applicable)?
> >
> > To make sure I am clear I am attaching a barplot created with
> > OpenOffice.org which has barplot values written on top of each barplot.
>
> After more than two hours search I finally found a solution:
> http://tolstoy.newcastle.edu.au/R/help/06/05/27286.html

Hey, the solution happens to be only partiall... If the values are not real 
numbers, and have a lot of digits after the dot, the graph might become 
unreadable... 

see this

vals <- 
c(1,1.1236886,4.77554676,5.3345245,1,1.1236886,4.77554676,5.3345245,5.5345245,5.4345245,1.1236886,4.77554676,5.3345245,1.1236886,4.77554676,5.3345245)
 
names(vals) <- LETTERS[1:16] 
mp <- barplot(vals, ylim = c(0, 6)) 
text(mp, vals, labels = vals, pos = 3) 

Is there any way to round up those numbers?

I tried using 
options(digits=2)
, and it does change the display of a table, but it does not influence the 
barplot...
-- 
Donatas Glodenis
http://dg.lapas.info

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] XL files

2007-08-08 Thread Moshe Olshansky
Hi Animesh,

Can you send an example of an Excel file you need to
process (and the result you wish to get)?

Regards,

Moshe.

--- "Acharjee, Animesh" <[EMAIL PROTECTED]>
wrote:

> Dear All,
> I am new to R. I need to read XLs
> files, parse the data
> and convert them into txt format for further
> calculation . If any one
> have code for that , please send me code or
> suggestions for the
> same.Waiting for reply.
>  
> Thanking you 
>  
> Animesh 
> 
>   [[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] Binary Search

2007-08-08 Thread Felix Andrews
?findInterval


On 8/8/07, Matthew Walker <[EMAIL PROTECTED]> wrote:
> Hi!
>
> R is an amazing piece of software and with so many libraries it can do
> almost anything... but I was very surprised that a standard "binary
> search" function seems not to exist.  I can find other much more
> highly-complex search routines (optimize, uniroot, nlm) in the standard
> no-extra-packages-loaded version of R, but not this simple alternative.
> I searched and found an implementation inside the package "genetics",
> but that requires the loading of an awful lot of other code to get to
> this simple function.
>
> Have I missed something?  Perhaps I just didn't find what is already in
> there.  Can anyone point me to what I'm after?
>
> If not, perhaps the developers might consider making it more readily
> available?
>
> Cheers,
>
> Matthew
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


-- 
Felix Andrews / 安福立
PhD candidate
Integrated Catchment Assessment and Management Centre
The Fenner School of Environment and Society
The Australian National University (Building 48A), ACT 0200
Beijing Bag, Locked Bag 40, Kingston ACT 2604
http://www.neurofractal.org/felix/
voice:+86_1051404394 (in China)
mobile:+86_13522529265 (in China)
mobile:+61_410400963 (in Australia)
xmpp:[EMAIL PROTECTED]
3358 543D AAC6 22C2 D336  80D9 360B 72DD 3E4C F5D8

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