[R] sorting data help

2007-04-24 Thread Chris Linton
I am trying to create a 2x2xk contingency table.  The variables are GDP and
an income inequality statistic with year being the k levels.  I want to
eventually run a loglinear model with the data.  Currently the data is
organized by either year or country.  example

CountryYear   log(GDP)sqrt(INEQ)
1  1980   24 5.3
1  1981   25 5.45
1  1982   24.5  5.4
1  1983   255.3
1  1984   25.5  5.5

or

CountryYearlog(GDP)   sqrt(INEQ)
1  1980   25 5.5
2  1980   22 6.5
3  1980   23.8  6.8
4  1980   26.7  5.2
5  1980   24 6
6  1980   26 5.5


I want to reorganize the data so it's like:

YearGDP>median(for the ith year) INEQ>sqrt(40)  count
19801
1  3
19801
0  6
19800
1  8
19800
0  9
19811
1  2
19811
0  7
19810
1  7
19810
0  9



So far, I've been using the "sort()" function to order the data.  Then,

f63<-sort(data1963$Gdp)
data1963$INEQ[data1963$Gdp>median(f63)]
data1963$INEQ[data1963$Gdphttps://stat.ethz.ch/mailman/listinfo/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] prelim.norm() function not working

2007-04-24 Thread Prof Brian Ripley
Looks like you have a data frame where you need a matrix.  (The same 
issue occurs in most of Joe Schafer's packages, e.g. mix.)

Try as.matrix(usnews).

On Tue, 24 Apr 2007, Brant Inman wrote:

> R-experts:
> I am trying to reproduce some of Paul Allison's results in his little
> green book on missing data (Sage 2002).  The dataset for which I am
> having problems, "usnews", can be found at:
> http://www.ats.ucla.edu/stat/books/md/default.htm.  I am working on a
> Windows machine with R 2.5 installed, all packages up-to-date.
> The problem has to do with the prelim.norm() function of the package
> "norm".   Specifically, I need to use this pre-processing function to
> later use the EM algorithm and DA procedures in the norm package.  I
> am getting an error with the following code.
> --
>> pre <- prelim.norm(usnews)
>
> Error in as.double.default(list(csat = c(972L, 961L, NA, 881L, NA, NA,  :
>(list) object cannot be coerced to 'double'
>
> -
> I have read the previous postings and I am wondering if the problem
> with prelim.norm is the size of the usnews dataset or the amount of
> missing data.
>
> 
>
>> dim(usnews)
> [1] 13027
>
> 
>
>
> Does anyone have any ideas?  If not, are there alternatives to norm
> for implementing the MLE and EM methods of dealing with missing data?
>
> Thanks,
>
> Brant Inman
> Mayo Clinic
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

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

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


[R] DIC help

2007-04-24 Thread stepman

Hey All,

I am a newer for Bayesian analysis. I have used MCMCoprobit model to run a
MCMC, but I don't know how to compute the DIC from the output. Is there
anyone who knows how to compute DIC by using R?


Stephen Fan
-- 
View this message in context: 
http://www.nabble.com/DIC-help-tf3643206.html#a10174425
Sent from the R help mailing list archive at Nabble.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] Keeping data after upgrading R to a new version [was: A very simple question]

2007-04-24 Thread Petr Klasterecky
2 simple ways:
1) When launching R, set the working directory to that of previous R 
installation - how to do this is system specific.

or
2) Copy the .Rdata file from the previous working directory to the new 
one. You can check your current working directory by typing getwd()

Petr

David Kaplan napsal(a):
> Hi all,
> 
> I just loaded R 2.50.  I want this version to bring the objects from the 
> previous version.  How do I do that?
> 
> Thanks
> 
> David
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 

-- 
Petr Klasterecky
Dept. of Probability and Statistics
Charles University in Prague
Czech Republic

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] regarding 3d Bar Plot

2007-04-24 Thread gyadav

Hi Rolf,

i could not get what to be done with that kind of plot. If possible then i 
would also like to contribute in its development. Thanks for discussion, 
If you have any pointers please let me know in R.

Thanks  in adv.
with warm regards,
-gaurav





[EMAIL PROTECTED] 
24-04-07 07:08 PM

To
[EMAIL PROTECTED], r-help@stat.math.ethz.ch
cc

Subject
Re: [R] regarding 3d Bar Plot







[EMAIL PROTECTED] wrote:

> I have data in a two dimensional table. each row of the data adds
> upto 100 ( hence they are percentages ).  it can be interpreted as
> like this A - I are the matches and  P - X are the players. Thus
> Player P scored 20% of the runs during this season in Match C, 60% in
> Match D and remaining 20% in Match G.
> 
> I want to plot 3-d bar plot, where X axis have players, Y axis have
> Matches and Z axis as the percentage(0 - 100%) Please help me in this
> regards.
 
 

 Many years ago I picked up from the snews mailing list a
 suite of functions for plotting 2D barplots (barplots 
with 2D
 bases) written by a chap named Colin Goodall, from (at 
that
 time) the University of Bristol and/or from Penn State.

 I never actually did anything with this suite until
 recently.  Seeing no replies to the enquiry about 3D
 histograms,  I thought I'd try to get Goodal's code 
running
 in R to see if it might solve guarav's problem.

 The trouble is, all the guts of the procedure, 
*including*
 the plotting are done from within Fortran.  The actual
 plotting seems to be done through a call to a subroutine
 ``segmtz'' which is a piece of Splus software that does 
not
 exist in R.

 Is there an equivalent subroutine in R that could be 
called?
 I dug around a bit but couldn't figure out what was going
 on.  The function segments() simply calls
 .Internal(segments(

 I looked around a bit for corresponding C or Fortran code 
but
 obviously didn't know how to look properly.

 I think that the Fortran code could be translated into 
raw R
 and the call to segmtz changed to a call to segments() 
---
 but this would seem to be a lot of work.

 Can anyone suggest a reasonably simple way of replacing 
the
 call to segmtz in the Fortran?

cheers,

Rolf Turner
[EMAIL PROTECTED]




DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message and ...{{dropped}}

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


[R] Use of Lexis function to convert survival data to counting format

2007-04-24 Thread Robert A. LaBudde
I'm trying to convert a dataset from the time-independent analysis form

 > head(addicts)
   id clinic status survtime prison meth clinic01
1  1  1  1  428  0   501
2  2  1  1  275  1   551
3  3  1  1  262  0   551

into the "counting data format" necessary to perform extended Cox regression.

I got survSplit() to work, but it appears to have a problem with end 
times on the boundaries of the intervals. (My intervals are [0,183], 
[184,365], [366,548], [549,730], [730,Inf]). I looked in the 
searchable archives and found that others had also discovered 
problems with survSplit() and suggested Lexis() in the Epi package.

When I try to get Lexis to work, I get an error message that I cannot 
interpret:

 > 
addictscdf<-Lexis(entry=start,exit=stop,fail='status',breaks=c(184,366,549,730),
+   include=c('id','clinic','prison','meth','clinic01'),data=addicts)

 The following object(s) are masked from addicts :

  clinic id meth prison status survtime

Error: object is not subsettable


I'm sure I'm making some type of trivial error here, but I don't know 
how to find it. I would guess that it has something to do with 
'start' and 'stop', of which arguments I am apparently clueless as to 
the meaning.

Robert A. LaBudde, PhD, PAS, Dpl. ACAFS  e-mail: [EMAIL PROTECTED]
Least Cost Formulations, Ltd.URL: http://lcfltd.com/
824 Timberlake Drive Tel: 757-467-0954
Virginia Beach, VA 23464-3239Fax: 757-467-2947

"Vere scire est per causas scire"

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

2007-04-24 Thread David Kaplan
Hi all,

I just loaded R 2.50.  I want this version to bring the objects from the 
previous version.  How do I do that?

Thanks

David

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Coercing data types for use in model.frame

2007-04-24 Thread Frank E Harrell Jr
In the Hmisc package there is a new data class 'mChoice' for multiple 
choice variables.  There are format and as.numeric methods (the latter 
creates a matrix of dummy variables).  mChoice variables are not allowed 
by model.frame.  Is there a way to specify a conversion function that 
model.frame will use automatically?  I would use as.factor here. 
model.frame does not seem to use as.data.frame.foo for individual variables.

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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Using R to create pdf's from each file in a directory

2007-04-24 Thread gecko951

Did some reading and tried the following to exclude certain data columns but
my syntax must be slightly off...

> workdir <- '/tmp/data'
> for (x in dir(workdir,pattern='.csv$')){
+d <- read.table(paste(workdir,'/',x,sep=''), sep=",", header=TRUE,
colClasses=list(#, BlockType, ThreadName, BytesSoFar, BlockSize,
BlockOffset, BlockStart, BlockEnd, Duration, BytesPerSecond, MBBlockSize,
Path=NULL))
+pdf(paste(workdir,'/',sub('.csv$','.pdf',x),sep=''))
+plot(d$BlockSeqNum, d$MBs,
Error: syntax error in:
"   pdf(paste(workdir,'/',sub('.csv$','.pdf',x),sep=''))
   plot"
Execution halted




gecko951 wrote:
> 
> Jeff's code works beautifully with a couple changes to my dataset. I must
> change my data column MB/s to MBs.  R seems to think that the "s" is
> another column if I try to use MB/s.  Is there a way that I can make R
> allow special characters in the column names?
> 
> The second step to getting this to work was to remove the dozen or so
> additional columns that are part of my csv but have no relevance to the
> graph. Does R want me to pass code telling it to filter out unneeded
> columns?
> 
> Regards,
> 
> Ben
> 
> 
> Patrick Connolly-2 wrote:
>> 
>> On Fri, 20-Apr-2007 at 11:10PM -0500, Jeffrey Horner wrote:
>> 
>> 
>> |> workdir <- '/tmp/data'
>> |> for (x in dir(workdir,pattern='.csv$')){
>> |>d <- read.table(paste(workdir,'/',x,sep=''), sep="\t", header=TRUE)
>> 
>> If they're CSV files, I don't think sep = "\t" will be correct. Try ","
>> 
>> best
>> 
>> -- 
>> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
>>___Patrick Connolly   
>>  {~._.~}  Great minds discuss ideas
>>  _( Y )_ Middle minds discuss events 
>> (:_~*~_:) Small minds discuss people  
>>  (_)-(_). Anon
>>
>> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
>> 
>> __
>> R-help@stat.math.ethz.ch mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Using-R-to-create-pdf%27s-from-each-file-in-a-directory-tf3621434.html#a10172857
Sent from the R help mailing list archive at Nabble.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] Random Number Generator of Park and Miller

2007-04-24 Thread gracezhang

Hi,

I failed to search for R package providing random number generator of "Park
and Miller". 
Anyone know any R package supporting this kind of function?

Thanks,
Grace
-- 
View this message in context: 
http://www.nabble.com/Random-Number-Generator-of-Park-and-Miller-tf3642535.html#a10172789
Sent from the R help mailing list archive at Nabble.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] heatmap and phylogram / dendogram ploting problem, ape package

2007-04-24 Thread jamesrh
I am having trouble displaying a dendrogram of evolutionary
relationships (a phylogram imported from the ape package) as the
vertical component of a heatmap, but keeping the hierarchical
clustering of the horizontal component.  The relationships of the
vertical component in the generated heatmap are not that of the
dendrogram, although the ordering is.

In more detail, I am attempting to generate a heatmap from a table
that contains the abundance of different bacteria at different
locations, with a dendrogram that groups the
environments by the pattern of bacterial abundance.  This is easy, thanks to
a nice code snippet at the R Graph Gallery
(http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=66):

env <- read.table("env.dat")
x  <- as.matrix(env)
hv <- heatmap(x, col = cm.colors(256), scale="none",
  xlab = "Environments", ylab= "Species",
  main = "heatmap of species present in environments")

However, instead of a dendrogram that groups the rows (vertical axis)
by the abundance pattern (as above), I would like to force it to order
and display a dendrogram
indicating their evolutionary relatedness.  I am using the excellent ape
package (http://cran.r-project.org/src/contrib/Descriptions/ape.html) to
import the evolutionary dendrograms.  I have already manipulated the
dendrogram to be ultrameric, with branches all the same length, to
prevent an error, although I would prefer not to have to do so:

library(ape)
mytree <- read.tree(file = "ultra.newick", text = NULL, tree.names =
NULL, skip = 0, comment.char = "#")
#I then change them into a hclust:
tree <- as.hclust(mytree)
#and make this into a dendrogram
dend <- as.dendrogram(tree)

However, when I use this dendrogram as part of the heatmap, the relationships
in the dendrogram that I'm loading are not preserved, although the order of
bacteria in the heatmap changes:

hv <- heatmap(x, col = cm.colors(256), scale="none",
Rowv=dend, keep.dendro=TRUE,
xlab = "Environments", ylab= "Species",
main = "heatmap of species present in environments")

Is there something obvious I am missing?  When I plot the hclust and
dendrogram, they seem to preserve the relationships that I am attempting to
show, but not when the dendrogram is used in the heatmap.  I'm not sure I
really understand the datatype of R dendrogram objects, and this may
be the source of my
problems.  The heatmap documentation
(http://addictedtor.free.fr/graphiques/help/index.html?pack=stats&alias=heatmap&fun=heatmap.html)
is somewhat opaque to someone with my programing skills.  Would it be
better to reorder the heatmap and then somehow add in the dendrogram
with add.expr command?

If anyone could suggest something, or point me in the right direction I would
greatly appreciate it.


   jamesh

Here are the contents of the two files used as examples above:

env.dat:
soil1 soil2 soil3 marine1 marine2 marine3
One 23 24 26 0 0 0
Two 43 43 43 3 6 8
Three 56 78 45 23 45 56
Four 6 6 3 34 56 34
Five 2 17 12 76 45 65




ultra.newick:
(((One:1,Four:1):1,(Three:1,Two:1):1):1,Five:3):0.0;

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] prelim.norm() function not working

2007-04-24 Thread Brant Inman
R-experts:
I am trying to reproduce some of Paul Allison's results in his little
green book on missing data (Sage 2002).  The dataset for which I am
having problems, "usnews", can be found at:
http://www.ats.ucla.edu/stat/books/md/default.htm.  I am working on a
Windows machine with R 2.5 installed, all packages up-to-date.
The problem has to do with the prelim.norm() function of the package
"norm".   Specifically, I need to use this pre-processing function to
later use the EM algorithm and DA procedures in the norm package.  I
am getting an error with the following code.
--
> pre <- prelim.norm(usnews)

Error in as.double.default(list(csat = c(972L, 961L, NA, 881L, NA, NA,  :
(list) object cannot be coerced to 'double'

-
I have read the previous postings and I am wondering if the problem
with prelim.norm is the size of the usnews dataset or the amount of
missing data.



> dim(usnews)
[1] 13027




Does anyone have any ideas?  If not, are there alternatives to norm
for implementing the MLE and EM methods of dealing with missing data?

Thanks,

Brant Inman
Mayo Clinic

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

2007-04-24 Thread H. Paul Benton

   Thanks
Research Technician
Mass Spectrometry
   o The
  /
o Scripps
  \
   o Research
  /
o Institute 

   Rajarshi Guha wrote:

On Tue, 2007-04-24 at 16:46 -0700, H. Paul Benton wrote:
  

Hello all,

I know this is a pretty easy question but I can't find it in S poetry or
R help.

How can I make a negative number positive. Such as
-5 to be +5
I tried +(-5), but that didn't work.

So no, I don't mean taking a -5^2 just to get a positive number.
This is in a function so it's not just -5 it's x. :)


abs(x)

---
Rajarshi Guha [1]<[EMAIL PROTECTED]>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
---
C Code.
C Code Run.
Run, Code, RUN!
PLEASE

References

   1. mailto:[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] exclude the unfit data from the iteration

2007-04-24 Thread Bert Gunter
?try 
Wrap each iteration in a try() call

Also ?tryCatch if you want to get fancy -- and can understand the rather
arcane docs.

Bert Gunter
Genentech Nonclinical Statistics


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Mohammad Ehsanul
Karim
Sent: Tuesday, April 24, 2007 3:33 PM
To: r-help@stat.math.ethz.ch
Subject: [R] exclude the unfit data from the iteration

Dear List, 

Trying to explain my situation as simply as possible
for me:

I am running a series of iteration on coxph model on
simulated data (newly generated data on each iteration
to run under coxph; in my example below- sim.fr is the
generated data). However, sometimes i get warning
messages like 
"Ran out of iterations and did not converge" or 
"Error in var(x, na.rm = na.rm) : missing observations
in cov/cor" 
because in some cases one of my covariate (say, var5
or var6 or both who are binary variables) becomes all
0's!

How do I exclude the unfit data (that does not
fit/converge: that produces warning messages) that may
be generated in any iteration, and still continue by
replacing it by the next iteration data (untill it
generates acceptable data that does not give any
trouble like not converging)? Is there any provision
in R?

"sim.result" <- function(...){
...
fit.gm.em <- coxph(Surv(times,censored) ~
var1+var2+var3+var4+var5+var6 +
frailty(id,dist='gamma', method='em'), data= sim.fr)
...
}

I know
options(warn=-1)
can hide warning messages, but I need not hide the
problem, all i need to do is to tell the program to
continue untill fixed number of times (say, 100) it
iterates with good data.


Thank you for your time.

Mohammad Ehsanul Karim (R - 2.3.1 on windows)
Institute of Statistical Research and Training
University of Dhaka

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

2007-04-24 Thread Rajarshi Guha
On Tue, 2007-04-24 at 16:46 -0700, H. Paul Benton wrote:
> Hello all,
> 
> I know this is a pretty easy question but I can't find it in S poetry or
> R help.
> 
> How can I make a negative number positive. Such as
> -5 to be +5
> I tried +(-5), but that didn't work.
> 
> So no, I don't mean taking a -5^2 just to get a positive number.
> This is in a function so it's not just -5 it's x. :)

abs(x)

---
Rajarshi Guha <[EMAIL PROTECTED]>
GPG Fingerprint: 0CCA 8EE2 2EEB 25E2 AB04 06F7 1BB9 E634 9B87 56EE
---
C Code.
C Code Run.
Run, Code, RUN!
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] negative number to positive number

2007-04-24 Thread H. Paul Benton
Hello all,

I know this is a pretty easy question but I can't find it in S poetry or
R help.

How can I make a negative number positive. Such as
-5 to be +5
I tried +(-5), but that didn't work.

So no, I don't mean taking a -5^2 just to get a positive number.
This is in a function so it's not just -5 it's x. :)

Thanks,

Paul

-- 
Research Technician
Mass Spectrometry
   o The
  /
o Scripps
  \
   o Research
  /
o Institute

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] exclude the unfit data from the iteration

2007-04-24 Thread Mohammad Ehsanul Karim
Dear List, 

Trying to explain my situation as simply as possible
for me:

I am running a series of iteration on coxph model on
simulated data (newly generated data on each iteration
to run under coxph; in my example below- sim.fr is the
generated data). However, sometimes i get warning
messages like 
"Ran out of iterations and did not converge" or 
"Error in var(x, na.rm = na.rm) : missing observations
in cov/cor" 
because in some cases one of my covariate (say, var5
or var6 or both who are binary variables) becomes all
0's!

How do I exclude the unfit data (that does not
fit/converge: that produces warning messages) that may
be generated in any iteration, and still continue by
replacing it by the next iteration data (untill it
generates acceptable data that does not give any
trouble like not converging)? Is there any provision
in R?

"sim.result" <- function(...){
...
fit.gm.em <- coxph(Surv(times,censored) ~
var1+var2+var3+var4+var5+var6 +
frailty(id,dist='gamma', method='em'), data= sim.fr)
...
}

I know
options(warn=-1)
can hide warning messages, but I need not hide the
problem, all i need to do is to tell the program to
continue untill fixed number of times (say, 100) it
iterates with good data.


Thank you for your time.

Mohammad Ehsanul Karim (R - 2.3.1 on windows)
Institute of Statistical Research and Training
University of Dhaka

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

2007-04-24 Thread CrazyJoe

Hello

Blind  toy_Car toy_truck   toy_boat
1 6.3 7.5 5.4
2 3.4 8.1 6.1
3 2.2 4.4 5.1

How do we calculate the F-statistic in R.

Any help is really appreciated.
-- 
View this message in context: 
http://www.nabble.com/Analysis-of-Variance-tf3641852.html#a10170830
Sent from the R help mailing list archive at Nabble.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] simulate values

2007-04-24 Thread Soare Marcian-Alin
Hello,

I want to simulate 100 values of the ARMA Process with this function:

x[i] = 0.5 * x[i-1] + 0.2 * x[i-2] + x[i] + 0.9 * x[i-1] + 0.2 * x[i-2] +
0.3 * x[i-3]

which possibilities do I have?

Alin Soare

[[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] How to write a function?

2007-04-24 Thread Robert Duval
Hi Keti

Before reinventing the wheel from scratch you might want to take a
look at the survey package

http://faculty.washington.edu/tlumley/survey/

best
robert

On 4/24/07, Keti Cuko <[EMAIL PROTECTED]> wrote:
> Hi,
> My name is Katie and I was wondering if you could help me with my problem. I
> am trying to write a function in R that computes the statistics (mean,
> standard error, confidence intervals) for stratified samples. I am not that
> familiar with R and I am having dificulties setting this function up. Any
> help or tips on where/how to do this?
>
> Best,
> Katie
>
> [[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] R Anova

2007-04-24 Thread Keizer_61

I am really struggling with this question.

Three students take part of an experiment.

student  smoking  non-smokingcancer
110.5   7.5 6.5
2  9.5   6.5 8.4
3  8.5   7.2 5.5

the proper inferences is .05

we need to conduct Anova and have a inference of .05.

How do you enter this in R?

How do you calculate the F-test using R for this if we have smoking,
non-smoking and cancer all equal.

any suggestions? 

thanks
-- 
View this message in context: 
http://www.nabble.com/R-Anova-tf3641767.html#a10170587
Sent from the R help mailing list archive at Nabble.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] Log-Returns

2007-04-24 Thread AA
see
?getReturns in fMultivar package (part of Rmetrics).
the function has an option between continuous(log returns) or discrete 
calculation.
I used it with timeSeries objects. works well.
good luck.
A.
- Original Message - 
From: "Soare Marcian-Alin" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, April 24, 2007 5:17 PM
Subject: [R] Log-Returns


> Hello,
>
> I have a Problem to make Log-Returns of the dataset EuStockMarkets.
> Is there any function which could calculate it for me?
>
> data(EuStockMarkets)
>
> Thanks!
>
> Alin Soare
>
> [[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] time series problem

2007-04-24 Thread Achim Zeileis
On Tue, 24 Apr 2007, Tomas Mikoviny wrote:

> Hi everybody,
>
> I work with data with following pattern
>
>  > comm
>
>   "Date"  "Value"
> 1 4/10/2007   361.2
> 2 4/11/2007   370.1
> 3 4/12/2007   357.2
> 4 4/13/2007   362.3
> 5 4/16/2007   363.5
> 6 4/17/2007   368.7
> 7 4/18/2007   354.7
> 8 4/19/2007   368.8
> 9 4/20/2007   367.1
> 10... ...
>
> and trying to convert it to time series using:
>
>  > t=strptime(comm[1,1],"%m/%d/%Y")
>  > x=ts(comm, start=as.POSIXct(t))
>
> Error in Math.difftime((end - start) * frequency + 1.01) :
>   floornot defined for "difftime" objects
>
> Definitely I do something wrong but I can't find what is it!

At least things:
  - ts() can only work with numeric time stamps (not POSIXct)
  - you try to create a regular series (although your data is
not: there is not an observation on each day)

I would recommend to create a "zoo" series with "Date" index:
  R> library("zoo")
  R> z <- zoo(comm[,2], as.Date(strptime(comm[,1], "%m/%d/%Y")))
  R> z
  2007-04-10 2007-04-11 2007-04-12 2007-04-13 2007-04-16 2007-04-17
   361.2  370.1  357.2  362.3  363.5  368.7
  2007-04-18 2007-04-19 2007-04-20
   354.7  368.8  367.1

hth,
Z

> Can anyone help me with this?
>
> Thanks.
>
> Tomas
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] understanding round() behavior

2007-04-24 Thread jim holtman
'print' by default only prints 7 digits.  See below:

> round(a, digits=10)
[1] 123456.4
> print(round(a, digits=10), digits=10)
[1] 123456.3678
>


On 4/24/07, Robert Duval <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> I am a little bit puzzled by the way round() works.
> Consider the following code
>
> >a<-123456.3678
> > round(a,digits=10)
> [1] 123456.4
>
>
> I would expect the outcome to be something like 123456.3678 or
> 123456.368, instead the computer gives me 123456.4 no matter how large
> the digits are.
>
> Can anybody help me understand what I'm missing here?
>
> Thanks again for your help.
> Robert
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


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

What is the problem you are trying to solve?

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] intersect more than two sets

2007-04-24 Thread John Fox
Dear Peter, Hadley, et al.,

Just to bring it back around, here's a recursive Fold():

> a <- letters[1:4]
> b <- letters[2:5]
> c <- letters[3:6]
> d <- letters[4:7]
> e <- letters[5:8]

> Fold <- function(f, x, y, ...){
+ if (missing(...)) f(x, y)
+ else f(x, Fold(f, y, ...))
+ }

> Fold(intersect, a, b)
[1] "b" "c" "d"
> Fold(intersect, a, b, c)
[1] "c" "d"
> Fold(intersect, a, b, c, d)
[1] "d"
> Fold(intersect, a, b, c, d, e)
character(0)
> 
> do.call(Fold, list(intersect, a, b, c, d))
[1] "d"

Regards,
 John


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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Peter Dalgaard
> Sent: Tuesday, April 24, 2007 4:03 PM
> To: hadley wickham
> Cc: R Help; Weiwei Shi
> Subject: Re: [R] intersect more than two sets
> 
> hadley wickham wrote:
> > On 4/24/07, Weiwei Shi <[EMAIL PROTECTED]> wrote:
> >   
> >> assume t2 is a list of size 11 and each element is a 
> vector of characters.
> >>
> >> the following codes can get what I wanted but I assume 
> there might be 
> >> a one-line code for that:
> >>
> >> t3 <- t2[[1]]
> >> for ( i in 2:11){
> >> t3 <- intersect(t2[[i]], t3)
> >> }
> >>
> >> or there is no such "apply"?
> >> 
> >
> > The operation you want is called a fold 
> > 
> (http://en.wikipedia.org/wiki/Fold_%28higher-order_function%29), and 
> > if it was available in R, you'd be able to do:
> >
> > fold(t2, intersect)
> >
> > Unfortunately, it's not, but you could implement it as follows:
> >
> > fold <- function(x, fun) {
> > if (length(x) == 1) return(fun(x))
> > 
> > accumulator <- fun(x[[1]], x[[2]])
> > if (length(x) == 2) return(accumulator)
> >
> > for(i in 3:length(x)) {
> > accumulator <- fun(accumulator, x[[i]])
> > }
> > accumulator
> > }
> >
> > a <- list(c(1,3,5), c(1,3), c(1, 2, 5, 6)) fold(a, intersect)
> >
> >   
> 
> It's come up before. Gabor G posted this rather more succinct version:
> 
>  > Fold <- function(f, x, L) (for(e in L) x <- f(x, e))  > 
> Fold(intersect,a[[1]],a[-1]) [1] 1
> 
> or maybe prettier:
> 
>  > (E <- Fold(union, NULL, a))
> [1] 1 3 5 2 6
>  > Fold(intersect, E, a)
> [1] 1
> 
> 
> > Which is just a trivial generalisation of your code above
> >
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Log-Returns

2007-04-24 Thread Horace Tso
diff(log(x))

And this should be made into a function.

H.




>>> "Soare Marcian-Alin" <[EMAIL PROTECTED]> 4/24/2007 2:17 PM >>>
Hello,

I have a Problem to make Log-Returns of the dataset EuStockMarkets.
Is there any function which could calculate it for me?

data(EuStockMarkets)

Thanks!

Alin Soare

[[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] Log-Returns

2007-04-24 Thread Soare Marcian-Alin
Hello,

I have a Problem to make Log-Returns of the dataset EuStockMarkets.
Is there any function which could calculate it for me?

data(EuStockMarkets)

Thanks!

Alin Soare

[[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] Size of an object in workspace

2007-04-24 Thread Weiwei Shi
library(gdata)
ll()


On 4/24/07, Horace Tso <[EMAIL PROTECTED]> wrote:
> Hi folks,
>
> Is there a function to show the size of an R object? eg. in Kbytes?
>
> Couple months ago Bendix Carstensen posted this marvelous little function 
> lls(), which shows all objects in the current workspace by mode, class and 
> 'size'. This is a wonderful enhancement to the build-in ls() already and I 
> now have it sourced in my Rprofile.site at startup.
>
> The only drawback is, 'size' is just the length/dim of an object. For 
> matrices and data frames this is good enough. But for a list, knowing how 
> many elements in there doesn't help much. I need to know the totality of the 
> content in a common unit, eg. byte.
>
> Thanks in advance.
>
> Horace
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


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

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

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


[R] understanding round() behavior

2007-04-24 Thread Robert Duval
Dear all,

I am a little bit puzzled by the way round() works.
Consider the following code

>a<-123456.3678
> round(a,digits=10)
[1] 123456.4


I would expect the outcome to be something like 123456.3678 or
123456.368, instead the computer gives me 123456.4 no matter how large
the digits are.

Can anybody help me understand what I'm missing here?

Thanks again for your help.
Robert

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


[R] time series problem

2007-04-24 Thread Tomas Mikoviny
Hi everybody,

I work with data with following pattern

 > comm

"Date"  "Value"
1   4/10/2007   361.2
2   4/11/2007   370.1
3   4/12/2007   357.2
4   4/13/2007   362.3
5   4/16/2007   363.5
6   4/17/2007   368.7
7   4/18/2007   354.7
8   4/19/2007   368.8
9   4/20/2007   367.1
10  ... ...

and trying to convert it to time series using:

 > t=strptime(comm[1,1],"%m/%d/%Y")
 > x=ts(comm, start=as.POSIXct(t))

Error in Math.difftime((end - start) * frequency + 1.01) :
floornot defined for "difftime" objects

Definitely I do something wrong but I can't find what is it!
Can anyone help me with this?

Thanks.

Tomas

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] intersect more than two sets

2007-04-24 Thread Ron Michael
have u seen ?merge  ?

- Original Message 
From: Weiwei Shi <[EMAIL PROTECTED]>
To: R Help 
Sent: Tuesday, April 24, 2007 10:55:51 PM
Subject: [R] intersect more than two sets

Hi,
I searched the archives and did not find a good solution to that.

assume I have 10 sets and I want to have the common character elements of them.

how could i do that?

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

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

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







[[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] Matrix: how to re-use the symbolic Cholesky factorization?

2007-04-24 Thread Douglas Bates
On 4/24/07, Gardar Johannesson <[EMAIL PROTECTED]> wrote:
> I have been playing around with sparse matrices in the Matrix
> package, in particularly with the Cholesky factorization of matrices
> of class dsCMatrix. And BTW, what a fantastic package.
>
> My problem is that I have to carry out repeated Cholesky
> factorization of a spares symmetric matrices, say Q_1, Q_2, ...,Q_n,
> where the Q's have the same non-zero pattern. I know in this case one
> does only need to carry out the symbolic factorization _once_ and
> then follow that up with a numerical factorization for each of the
> Q_i's (re-using the general symbolic factorization each time). Does
> anybody know if this is possible using the Matrix package?

At present that is not possible without writing your own C code that
calls functions in the CHOLMOD library of C functions directly.  We'll
add that to the "ToDo" list.  The easiest interface I can picture is
to pass a Cholesky factorization object along with the dsCMatrix
object that contains the new values with the old pattern.

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

2007-04-24 Thread Martin Henry H. Stevens
Have you seen Pinheiro and Bates (2000) that lays out the nlme  
package? It is very helpful.
Hank
On Apr 14, 2007, at 8:02 PM, Kyle. wrote:

> You probably can do this with lme function, but I don't know that for
> sure.  "aov" (included in the "stats" package), with a call to the
> "Error" function how I generally analyze data obtained from a
> repeated measure design.  For a very good description of how Error
> and aov work together, you should read Baron's “Notes on the use of R
> for psychology experiments and questionnaires” (follow the link
> below)  The section beginning on page 36 addresses your question.
> Generally speaking, the aov function expects you to describe your
> model formula similarly to how you would with a call to the "lm"
> function.  For example, Y~X1*X2 describes a two way ANOVA--your
> dependent variable Y modeled as explanatory variables X1 and X2,
> including the interaction term:
>   model.aov<-aov(Y~X1*X2, data=DataFile)
>
> If X1 and X2 are within-subject variables, then the above formula
> would be written as follows:
>
>   model.aov<-aov(Y~X1*X2+Error(Subject/X1*X2),data=DataFile)
>
> The call "summary(model.aov)" will display a summary of the model.
> Depending on your experience working with model formulae in R, there
> are several steps in the repeated-measure ANOVA procedure that can
> come back to haunt you, if you're not careful (e.g., checking the
> assumption of sphericity, normally distributed errors, homogeneity of
> variance, etc., etc.), so make sure you're covered on these before
> you believe your results.
>
> Here's a link to the document I referred to: http://cran.r-
> project.org/doc/contrib/Baron-rpsych.pdf
>
>
>
>
> Kyle H. Ambert
> Graduate Student, Dept. Behavioral Neuroscience
> Oregon Health & Science University
> [EMAIL PROTECTED]
>
>
>
>
>
>
> On Apr 8, 2007, at 7:55 PM, Scott Norton wrote:
>
>> Hi,
>> I have what I believe is a repeated-measures dataset that I'm
>> trying to analyze using lme().  This is *not* homework, but an
>> exercise in my trying to self-teach myself repeated-measure ANOVA
>> for other *real* datasets that I have and that are extremely
>> similar to the following design.
>>
>> I'm fairly sure the dataset described below would work with lme()
>> -- but it'd be great if anybody can confirm that after I describe  
>> the dataset below)
>>
>> The study involves measuring the effect of a drug on blood
>> pressure. There were 16 patients in all and 6 replicate measures
>> per patient of their blood pressure on one week (one measure per
>> day). Two weeks later, a drug was introduced to 8 randomly selected
>> patients in such a way that I had equal representation of the 4 age
>> groups among the two treatment groups. Then, another two weeks
>> later, 6 replicate measures per patient (per day) of blood pressure
>> was retaken.  So each patient had 12 total measures whether they
>> were in the treatment group or in the control group (6 reads (R1-
>> R6) in the baseline-week and another 6 reads (R1-R6) in the post-
>> treatment week).
>>
>> So,
>> Background: 16 patients
>> Response measure: Blood pressure
>> Fixed Factor: 4 Age groups
>> Fixed Factor: Drug vs. NoDrug
>> Random factor: Day of the read (i.e. 6 replicate reads (R1-R6) at
>> the baseline time, and 6 replicate reads (R1-R6) after the drug has
>> had time to take effect)
>> Random Factor: Subjects 1-16
>>
>> PatientAgeGroupBP(Blood Pressure)Read (replicate
>> reads)Pre/PostTreatmentWeekGroup
>> 120-2983
>> R1
>> preTreat
>> 220-2981
>> R1
>> preControl
>> 320-2974
>> R1
>> preTreat
>> 420-2985
>> R1
>> preControl
>> 530-3982
>> R1
>> preTreat
>>
>
>
>
>
>
>
>> 320-2974
>> R2
>> preTreat
>>
>
>
>
>
>
>
>> 120-2983
>> R1
>> post   Treat
>> 220-2982
>> R1
>> post   Control
>> 320-2986
>> R1
>> post   Treat
>> 420-2984
>> R1
>> post   Control
>>
>
>
>
>
>
>
>>
>> I'm trying to do an analysis of variance to decide whether there is
>> a measurable change in blood pressure between the Treat and Control
>> groups.
>>
>> Another issue is that some of the 16 patients didn't get all 6
>> replicate reads in their pre/post treatment weeks, so I need to
>> include the na.omit function.
>>
>> What I think I'm having the most trouble with is the repeated reads
>> (R1 through R6) in the pre/post treatment weeks.  I'm fairly sure
>> th

[R] How to write a function?

2007-04-24 Thread Keti Cuko
Hi,
My name is Katie and I was wondering if you could help me with my problem. I
am trying to write a function in R that computes the statistics (mean,
standard error, confidence intervals) for stratified samples. I am not that
familiar with R and I am having dificulties setting this function up. Any
help or tips on where/how to do this?

Best,
Katie

[[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] intersect more than two sets

2007-04-24 Thread Peter Dalgaard
hadley wickham wrote:
> On 4/24/07, Weiwei Shi <[EMAIL PROTECTED]> wrote:
>   
>> assume t2 is a list of size 11 and each element is a vector of characters.
>>
>> the following codes can get what I wanted but I assume there might be
>> a one-line code for that:
>>
>> t3 <- t2[[1]]
>> for ( i in 2:11){
>> t3 <- intersect(t2[[i]], t3)
>> }
>>
>> or there is no such "apply"?
>> 
>
> The operation you want is called a fold
> (http://en.wikipedia.org/wiki/Fold_%28higher-order_function%29), and
> if it was available in R, you'd be able to do:
>
> fold(t2, intersect)
>
> Unfortunately, it's not, but you could implement it as follows:
>
> fold <- function(x, fun) {
>   if (length(x) == 1) return(fun(x))
>   
>   accumulator <- fun(x[[1]], x[[2]])
>   if (length(x) == 2) return(accumulator)
>
>   for(i in 3:length(x)) {
>   accumulator <- fun(accumulator, x[[i]])
>   }
>   accumulator
> }
>
> a <- list(c(1,3,5), c(1,3), c(1, 2, 5, 6))
> fold(a, intersect)
>
>   

It's come up before. Gabor G posted this rather more succinct version:

 > Fold <- function(f, x, L) (for(e in L) x <- f(x, e))
 > Fold(intersect,a[[1]],a[-1])
[1] 1

or maybe prettier:

 > (E <- Fold(union, NULL, a))
[1] 1 3 5 2 6
 > Fold(intersect, E, a)
[1] 1


> Which is just a trivial generalisation of your code above
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] intersect more than two sets

2007-04-24 Thread Dimitris Rizopoulos
you could try something like the following:

t2 <- lapply(1:11, function(i) c("a", sample(letters[1:5],
sample(10, 1), TRUE), "b"))

unq.vals <- unique(unlist(t2))
ind <- rowSums(sapply(t2, "%in%", x = unq.vals)) == length(t2)
unq.vals[ind]


I hope it helps.

Best,
Dimitris


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

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


Quoting Weiwei Shi <[EMAIL PROTECTED]>:

> assume t2 is a list of size 11 and each element is a vector of characters.
>
> the following codes can get what I wanted but I assume there might be
> a one-line code for that:
>
> t3 <- t2[[1]]
> for ( i in 2:11){
>   t3 <- intersect(t2[[i]], t3)
> }
>
> or there is no such "apply"?
>
> On 4/24/07, Weiwei Shi <[EMAIL PROTECTED]> wrote:
>> Hi,
>> I searched the archives and did not find a good solution to that.
>>
>> assume I have 10 sets and I want to have the common character   
>> elements of them.
>>
>> how could i do that?
>>
>> --
>> Weiwei Shi, Ph.D
>> Research Scientist
>> GeneGO, Inc.
>>
>> "Did you always know?"
>> "No, I did not. But I believed..."
>> ---Matrix III
>>
>
>
> --
> Weiwei Shi, Ph.D
> Research Scientist
> GeneGO, Inc.
>
> "Did you always know?"
> "No, I did not. But I believed..."
> ---Matrix III
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>



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

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


[R] Problem opening connections to removable hard drive

2007-04-24 Thread Elizabeth Purdom
Hi,

I have my files and R session on a portable hard drive to be able to 
work across computers since I have some extremely large files. I have 
just started doing this and generally it works as I expect. But after a 
while of using my R session, certain types of calls to open connections 
on the hard drive don't work. But I experience no problems 
opening/saving files on the portable hard drive using other programs.

In particular, if I explicitly call the entire folder path to the hard 
drive, I can save an object to file, for example. But if I just want to 
save it in the current working directory, without explicitly naming the 
entire path, then I have problems (I show an example below). I am using 
a package that assumes a certain file structure from the current working 
directory in order to find/write output, which is why I want to be able 
to rely on not explicitly calling the whole path. Furthermore, I was 
experimenting just now, and when I changed the current directory to 
another one, and then back to the removable hard drive, everything gets 
'reset' somehow and opening connections works again, just like when I 
first started up my session.

I am on Windows XP, R 2.4.0.

Thanks,
Elizabeth Purdom

example:
 > getwd()
[1] "I:/ICBP/Exon Array/Data"
#explicit call to hard drive works...
 > save(x,file="I:/ICBP/Exon Array/Data/tmp.rdata")
#unexplicit call relying on knowing working directory doesn't...
 > save(x,file="tmp.rdata")
Error in gzfile(file, "wb") : unable to open connection
In addition: Warning message:
cannot open compressed file 'tmp.rdata'

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] intersect more than two sets

2007-04-24 Thread hadley wickham
On 4/24/07, Tony Plate <[EMAIL PROTECTED]> wrote:
> I don't think there's that sort of "apply-reduce" function in R, but for
> this problem, the last line below happens to be a "one-liner":

Only if you have character data though:

> x <- lapply(1:10, function(i) sample(20, 15))
> names(which(table(unlist(x))==10))
[1] "14"

(not that it's hard to turn that back into a number)

Hadley

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


Re: [R] intersect more than two sets

2007-04-24 Thread Weiwei Shi
I had a similar solution by using frequency but having more codes :(

I also like the "recursive" idea : I initially tried to use rapply,
however, which can only take one-arg function.

thanks, everyone.

-w

On 4/24/07, hadley wickham <[EMAIL PROTECTED]> wrote:
> On 4/24/07, Tony Plate <[EMAIL PROTECTED]> wrote:
> > I don't think there's that sort of "apply-reduce" function in R, but for
> > this problem, the last line below happens to be a "one-liner":
>
> Only if you have character data though:
>
> > x <- lapply(1:10, function(i) sample(20, 15))
> > names(which(table(unlist(x))==10))
> [1] "14"
>
> (not that it's hard to turn that back into a number)
>
> Hadley
>


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

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

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


Re: [R] intersect more than two sets

2007-04-24 Thread hadley wickham
On 4/24/07, Weiwei Shi <[EMAIL PROTECTED]> wrote:
> assume t2 is a list of size 11 and each element is a vector of characters.
>
> the following codes can get what I wanted but I assume there might be
> a one-line code for that:
>
> t3 <- t2[[1]]
> for ( i in 2:11){
> t3 <- intersect(t2[[i]], t3)
> }
>
> or there is no such "apply"?

The operation you want is called a fold
(http://en.wikipedia.org/wiki/Fold_%28higher-order_function%29), and
if it was available in R, you'd be able to do:

fold(t2, intersect)

Unfortunately, it's not, but you could implement it as follows:

fold <- function(x, fun) {
if (length(x) == 1) return(fun(x))

accumulator <- fun(x[[1]], x[[2]])
if (length(x) == 2) return(accumulator)

for(i in 3:length(x)) {
accumulator <- fun(accumulator, x[[i]])
}
accumulator
}

a <- list(c(1,3,5), c(1,3), c(1, 2, 5, 6))
fold(a, intersect)

Which is just a trivial generalisation of your code above

Hadley

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


Re: [R] specify xlim for each panel

2007-04-24 Thread Deepayan Sarkar
On 4/24/07, Aimin Yan <[EMAIL PROTECTED]> wrote:
> I draw dotplot using the following code:
>
> sd.dotplot<-dotplot(data.47.nmr$om_sd ~ as.factor(data.47.nmr$position)
> |as.factor(data.47.nmr$pr), data = data.47.nmr,layout=c(1,1),
> xlab="Position", xlim=range(data.47.nmr$position),ylab="Sd", main="Changes
> of omega angle in different positions",
> scales = list(x = list(rot = 45)))
>
> However I get same xlim for each panel,
> Actually xlim is different for each panel, it is based on 
> data.47.nmr$position.
>
> How can I modify this code so I can deal with the different xlim for each 
> panel

The simplest answer to that depends on your data, so please give a
reproducible example. Hints: try scales = list(x = list(relation =
"free", rot = 45)), and if that doesn't work as intended, consider
reordering the levels of your factor (see ?reorder.factor). Something
like

dotplot(om_sd ~ reorder(as.factor(position), pr) | as.factor(pr),
data = <...>

should work.

By the way, you are missing the whole point of having a formula
interface; you can simply do:

sd.dotplot <-
dotplot(om_sd ~ as.factor(position) | as.factor(pr),
data = data.47.nmr,
<...>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] intersect more than two sets

2007-04-24 Thread Tony Plate
I don't think there's that sort of "apply-reduce" function in R, but for 
this problem, the last line below happens to be a "one-liner":

 > set.seed(1)
 > x <- lapply(1:10, function(i) sample(letters, 20))
 > table(unlist(x))

  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x 
  y  z
  6  8  7  8  9  9 10  9  8 10  6  7  9  7  6  8  8  6  9  6  9  6  9  7 
  6  7
 > which(table(unlist(x))==10)
  g  j
  7 10
 > names(which(table(unlist(x))==10))
[1] "g" "j"
 >


Weiwei Shi wrote:
> assume t2 is a list of size 11 and each element is a vector of characters.
> 
> the following codes can get what I wanted but I assume there might be
> a one-line code for that:
> 
> t3 <- t2[[1]]
> for ( i in 2:11){
>   t3 <- intersect(t2[[i]], t3)
> }
> 
> or there is no such "apply"?
> 
> On 4/24/07, Weiwei Shi <[EMAIL PROTECTED]> wrote:
>> Hi,
>> I searched the archives and did not find a good solution to that.
>>
>> assume I have 10 sets and I want to have the common character elements of 
>> them.
>>
>> how could i do that?
>>
>> --
>> Weiwei Shi, Ph.D
>> Research Scientist
>> GeneGO, Inc.
>>
>> "Did you always know?"
>> "No, I did not. But I believed..."
>> ---Matrix III
>>
> 
>

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


Re: [R] intersect more than two sets

2007-04-24 Thread John Fox
Dear Weiwei Shi,

How about using recursion?

> intersection <- function(x, y, ...){
+ if (missing(...)) intersect(x, y)
+ else intersect(x, intersection(y, ...))
+ }
 
> a <- letters[1:4]
> b <- letters[2:5]
> c <- letters[3:6]
> d <- letters[4:7]
> e <- letters[5:8]
 
> intersection(a, b)
[1] "b" "c" "d"
> intersection(a, b, c)
[1] "c" "d"
> intersection(a, b, c, d)
[1] "d"
> intersection(a, b, c, d, e)
character(0)
 
> do.call(intersection, list(a, b, c))
[1] "c" "d"

I hope this helps,
 John


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

> -Original Message-
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Weiwei Shi
> Sent: Tuesday, April 24, 2007 2:59 PM
> To: R Help
> Subject: Re: [R] intersect more than two sets
> 
> assume t2 is a list of size 11 and each element is a vector 
> of characters.
> 
> the following codes can get what I wanted but I assume there 
> might be a one-line code for that:
> 
> t3 <- t2[[1]]
> for ( i in 2:11){
>   t3 <- intersect(t2[[i]], t3)
> }
> 
> or there is no such "apply"?
> 
> On 4/24/07, Weiwei Shi <[EMAIL PROTECTED]> wrote:
> > Hi,
> > I searched the archives and did not find a good solution to that.
> >
> > assume I have 10 sets and I want to have the common 
> character elements of them.
> >
> > how could i do that?
> >
> > --
> > Weiwei Shi, Ph.D
> > Research Scientist
> > GeneGO, Inc.
> >
> > "Did you always know?"
> > "No, I did not. But I believed..."
> > ---Matrix III
> >
> 
> 
> --
> Weiwei Shi, Ph.D
> Research Scientist
> GeneGO, Inc.
> 
> "Did you always know?"
> "No, I did not. But I believed..."
> ---Matrix III
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide 
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] intersect more than two sets

2007-04-24 Thread Charles C. Berry
On Tue, 24 Apr 2007, Weiwei Shi wrote:

> Hi,
> I searched the archives and did not find a good solution to that.
>
> assume I have 10 sets and I want to have the common character elements of 
> them.
>
> how could i do that?

  list.of.sets <- lapply(1:10,function(x) sample(letters,20)) # for example

  names( which( table( unlist( lapply( list.of.sets, unique ) ) ) ==10 ) )

or

  int.rec <- function(x) {
if (length(x) == 1 )
  {
x
   } else {
x <-
c(list(intersect(x[[1]],x[[2]])),x[-(1:2)]);Recall(x)}
}

   int.rec(list.of.sets)

>
> -- 
> Weiwei Shi, Ph.D
> Research Scientist
> GeneGO, Inc.
>
> "Did you always know?"
> "No, I did not. But I believed..."
> ---Matrix III
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

Charles C. Berry(858) 534-2098
  Dept of Family/Preventive Medicine
E mailto:[EMAIL PROTECTED]   UC San Diego
http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0901

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


Re: [R] R as a server on Linux

2007-04-24 Thread Martin Morgan
RWebServices

http://wiki.fhcrc.org/caBioc/

offers a more structured approach to this -- map R functions and data
classes to their Java representation, expose Java as a web service,
service requests using persistent R workers.

Martin

Markus Loecher <[EMAIL PROTECTED]> writes:

> Hi,
> I am trying to avid the somewhat costly startup overhead of launching 
> a separate R executable for each "client" request on Linux.
> My current architecture is such that My Java client explicitly calls 
> R in batch mode and passes it certain parameters. The initital 
> startup takes almost 10 seconds because R has to load a bunch of 
> libraries as well as a moderately large, previously created workspace.
> I am thinking that it would be so much more eficient to instead have 
> R act as a server and fork off a thread for each client query. Is 
> that possible at all ?
>
> Thanks!
> Markus
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Martin Morgan
Bioconductor / Computational Biology
http://bioconductor.org

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


Re: [R] intersect more than two sets

2007-04-24 Thread Weiwei Shi
assume t2 is a list of size 11 and each element is a vector of characters.

the following codes can get what I wanted but I assume there might be
a one-line code for that:

t3 <- t2[[1]]
for ( i in 2:11){
t3 <- intersect(t2[[i]], t3)
}

or there is no such "apply"?

On 4/24/07, Weiwei Shi <[EMAIL PROTECTED]> wrote:
> Hi,
> I searched the archives and did not find a good solution to that.
>
> assume I have 10 sets and I want to have the common character elements of 
> them.
>
> how could i do that?
>
> --
> Weiwei Shi, Ph.D
> Research Scientist
> GeneGO, Inc.
>
> "Did you always know?"
> "No, I did not. But I believed..."
> ---Matrix III
>


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

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

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


Re: [R] R as a server on Linux

2007-04-24 Thread Gregory Warnes

Hi Markus,

Take a look at RSOAP (http://rsoap.sf.net).  It was designed for  
handling concurrent client connections to R, and minimizes the per- 
connection startup time by pre-starting R and forking of processes as  
requests come in.  Each client can maintain a stateful connection, if  
desired.

-G



On Apr 24, 2007, at 2:15PM , Markus Loecher wrote:

> Hi,
> I am trying to avid the somewhat costly startup overhead of launching
> a separate R executable for each "client" request on Linux.
> My current architecture is such that My Java client explicitly calls
> R in batch mode and passes it certain parameters. The initital
> startup takes almost 10 seconds because R has to load a bunch of
> libraries as well as a moderately large, previously created workspace.
> I am thinking that it would be so much more eficient to instead have
> R act as a server and fork off a thread for each client query. Is
> that possible at all ?
>
> Thanks!
> Markus
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting- 
> guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] R as a server on Linux

2007-04-24 Thread Dirk Eddelbuettel
On Tue, Apr 24, 2007 at 02:15:43PM -0400, Markus Loecher wrote:
> Hi,
> I am trying to avid the somewhat costly startup overhead of launching 
> a separate R executable for each "client" request on Linux.
> My current architecture is such that My Java client explicitly calls 
> R in batch mode and passes it certain parameters. The initital 
> startup takes almost 10 seconds because R has to load a bunch of 
> libraries as well as a moderately large, previously created workspace.
> I am thinking that it would be so much more eficient to instead have 
> R act as a server and fork off a thread for each client query. Is 
> that possible at all ?

Yes. Google for 

   RServe   -- headless R server, has Java interface
   RApache  -- R added to Apache
   
Hth, Dirk   
   
-- 
Hell, there are no rules here - we're trying to accomplish something. 
  -- Thomas A. Edison

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

2007-04-24 Thread clayton . springer
Dear R-help,

This is about randomForest's handling of NA and NaNs in test set data.
Currently, if the test set data contains an NA or NaN then 
predict.randomForest will skip that row in the output.

I would like to change that behavior to outputting an NA.

Can this be done with flags to randomForest?
If not can some sort of wrapper be built to put the NAs back in?

thanks,

Clayton
_

CONFIDENTIALITY NOTICE\ \ The information contained in this ...{{dropped}}

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


[R] R as a server on Linux

2007-04-24 Thread Markus Loecher
Hi,
I am trying to avid the somewhat costly startup overhead of launching 
a separate R executable for each "client" request on Linux.
My current architecture is such that My Java client explicitly calls 
R in batch mode and passes it certain parameters. The initital 
startup takes almost 10 seconds because R has to load a bunch of 
libraries as well as a moderately large, previously created workspace.
I am thinking that it would be so much more eficient to instead have 
R act as a server and fork off a thread for each client query. Is 
that possible at all ?

Thanks!
Markus

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


Re: [R] help interpreting the output of functions - any sources of information

2007-04-24 Thread Y G
On 24/04/07, Sarah Goslee <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> If you look at the documentation for the function you are interested
> in, in this case ?cor.test, it will generally give you an explanation
> of the return values (often brief, and not too helpful if you aren't
> already familiar with the test), but also one or more references
> that you can turn to for further information.
>
> Most likely, though, you'll want to absorb a general
> introductory stats book before you delve into the
> gory details of many of those references.
>
> Sarah


Thanks for the hint, that will do...

On 4/24/07, Y G <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > I am looking for documentation, reference guides, etc. that explain the
> > output of functions... For example using cor.test(,
> method="pearson")
> > with Pearson's corr coeff the output is:
> >
> >
> > Pearson's product-moment correlation
> >
> > data:  a and b
> > t = 0.2878, df = 14, p-value = 0.
> > alternative hypothesis: true correlation is not equal to 0
> > 95 percent confidence interval:
> >  -0.4355690  0.5514366
> > sample estimates:
> >cor
> > 0.07669612
> >
> >
> > What are all these? Apologies but I am new in R and statistics in
> > general but a textbook I was looking at, regarding SPSS, explains
> only
> > the r coeff and the conf interval Any help with sources I can refer
> to?
> > Particularly in a broader context as it would not be nice to post all
> the
> > time such questions...
> >
> > Thanks in advance,
> > GM
> >
>
> --
> Sarah Goslee
> http://www.functionaldiversity.org
>

[[alternative HTML version deleted]]

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


Re: [R] help interpreting the output of functions - any sources of information

2007-04-24 Thread Sarah Goslee
Hi,

If you look at the documentation for the function you are interested
in, in this case ?cor.test, it will generally give you an explanation
of the return values (often brief, and not too helpful if you aren't
already familiar with the test), but also one or more references
that you can turn to for further information.

Most likely, though, you'll want to absorb a general
introductory stats book before you delve into the
gory details of many of those references.

Sarah

On 4/24/07, Y G <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am looking for documentation, reference guides, etc. that explain the
> output of functions... For example using cor.test(, method="pearson")
> with Pearson's corr coeff the output is:
>
>
> Pearson's product-moment correlation
>
> data:  a and b
> t = 0.2878, df = 14, p-value = 0.
> alternative hypothesis: true correlation is not equal to 0
> 95 percent confidence interval:
>  -0.4355690  0.5514366
> sample estimates:
>cor
> 0.07669612
>
>
> What are all these? Apologies but I am new in R and statistics in
> general but a textbook I was looking at, regarding SPSS, explains only
> the r coeff and the conf interval Any help with sources I can refer to?
> Particularly in a broader context as it would not be nice to post all the
> time such questions...
>
> Thanks in advance,
> GM
>

-- 
Sarah Goslee
http://www.functionaldiversity.org

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


[R] intersect more than two sets

2007-04-24 Thread Weiwei Shi
Hi,
I searched the archives and did not find a good solution to that.

assume I have 10 sets and I want to have the common character elements of them.

how could i do that?

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

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

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


[R] Matrix: how to re-use the symbolic Cholesky factorization?

2007-04-24 Thread Gardar Johannesson
I have been playing around with sparse matrices in the Matrix 
package, in particularly with the Cholesky factorization of matrices 
of class dsCMatrix. And BTW, what a fantastic package.

My problem is that I have to carry out repeated Cholesky 
factorization of a spares symmetric matrices, say Q_1, Q_2, ...,Q_n, 
where the Q's have the same non-zero pattern. I know in this case one 
does only need to carry out the symbolic factorization _once_ and 
then follow that up with a numerical factorization for each of the 
Q_i's (re-using the general symbolic factorization each time). Does 
anybody know if this is possible using the Matrix package?

Thanks,
Gardar Johannesson
Lawrence Livermore National Laboratory

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Size of an object in workspace

2007-04-24 Thread Henrik Bengtsson
See ll() in R.oo (that is two L:s), e.g.

> ll()
  member data.class dimension objectSize
1 author  character 1120
2 myfunc   function  NULL512
3  x matrix   c(3,11)248
4  y  array  c(5,7,1)264

ll() is quite flexible so you can create your on functions to query
objects for whatever properties you want.  It can also be passed to
subset():

> subset(ll(), objectSize > 250)
  member data.class dimension objectSize
2 myfunc   function  NULL512
4  y  array  c(5,7,1)264

Hope this help

Henrik


On 4/24/07, Horace Tso <[EMAIL PROTECTED]> wrote:
> Hi folks,
>
> Is there a function to show the size of an R object? eg. in Kbytes?
>
> Couple months ago Bendix Carstensen posted this marvelous little function 
> lls(), which shows all objects in the current workspace by mode, class and 
> 'size'. This is a wonderful enhancement to the build-in ls() already and I 
> now have it sourced in my Rprofile.site at startup.
>
> The only drawback is, 'size' is just the length/dim of an object. For 
> matrices and data frames this is good enough. But for a list, knowing how 
> many elements in there doesn't help much. I need to know the totality of the 
> content in a common unit, eg. byte.
>
> Thanks in advance.
>
> Horace
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] specify xlim for each panel

2007-04-24 Thread Aimin Yan
I draw dotplot using the following code:

sd.dotplot<-dotplot(data.47.nmr$om_sd ~ as.factor(data.47.nmr$position) 
|as.factor(data.47.nmr$pr), data = data.47.nmr,layout=c(1,1),
xlab="Position", xlim=range(data.47.nmr$position),ylab="Sd", main="Changes 
of omega angle in different positions",
scales = list(x = list(rot = 45)))

However I get same xlim for each panel,
Actually xlim is different for each panel, it is based on data.47.nmr$position.

How can I modify this code so I can deal with the different xlim for each panel

thanks,

Aimin

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 interpreting the output of functions - any sources of information

2007-04-24 Thread Y G
Hi,

I am looking for documentation, reference guides, etc. that explain the
output of functions... For example using cor.test(, method="pearson")
with Pearson's corr coeff the output is:


Pearson's product-moment correlation

data:  a and b
t = 0.2878, df = 14, p-value = 0.
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
 -0.4355690  0.5514366
sample estimates:
   cor
0.07669612


What are all these? Apologies but I am new in R and statistics in
general but a textbook I was looking at, regarding SPSS, explains only
the r coeff and the conf interval Any help with sources I can refer to?
Particularly in a broader context as it would not be nice to post all the
time such questions...

Thanks in advance,
GM

[[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] Handling of arrays

2007-04-24 Thread Tony Plate
Try the following and look at what they return:

str(ca)
dimnames(ca)

-- Tony Plate

[EMAIL PROTECTED] wrote:
> Dear R-Experts,
> 
> I just imported a workspace from Matlab. I know that I can get the names of 
> the imported variables with names(). It works. The variable "ca" consists of 
> several elements. I want to get the names of the elements to handle my output 
> better. But names(ca) doesn't work. Why? I did the following commands:
> 
>> class(ca)
> [1] "array"
>> mode(ca)
> [1] "list"
>> dim(ca)
> [1] 66  1  1
>> length(ca)
> [1] 66
> 
> How can I now get the names which are stored in ca? When I use the command 
> "ca[18]" I receive the content which stands there but not the name collables 
> which I wanted to extract. 
> 
> Any ideas?
> 
> Thanks, Corinna

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Size of an object in workspace

2007-04-24 Thread MORNEAU François
Hi,

Is 'object.size()' the function your are looking for ?

Best,

François

-Message d'origine-
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la part de Horace Tso
Envoyé : mardi 24 avril 2007 17:59
À : r-help@stat.math.ethz.ch
Objet : [R] Size of an object in workspace

Hi folks,

Is there a function to show the size of an R object? eg. in Kbytes?

Couple months ago Bendix Carstensen posted this marvelous little function 
lls(), which shows all objects in the current workspace by mode, class and 
'size'. This is a wonderful enhancement to the build-in ls() already and I now 
have it sourced in my Rprofile.site at startup. 

The only drawback is, 'size' is just the length/dim of an object. For matrices 
and data frames this is good enough. But for a list, knowing how many elements 
in there doesn't help much. I need to know the totality of the content in a 
common unit, eg. byte. 

Thanks in advance. 

Horace

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Size of an object in workspace

2007-04-24 Thread Horace Tso
Aaaah, wonderful. Thanks Ben. lls appears below. Should these functions be a 
permanent part of R? Just a thought.

H.

> lls
function (pos = 1, pat = "") {
dimx <- function(dd) if (is.null(dim(dd)))
length(dd)
else dim(dd)
lll <- ls(pos = pos, pat = pat)
cat(formatC("mode", 1, 15), formatC("class", 1, 18), formatC("name",
1, max(nchar(lll)) + 1), 
"size\n-\n")
if (length(lll) > 0) {
for (i in 1:length(lll)) {
cat(formatC(eval(parse(t = paste("mode(", lll[i],
")"))), 1, 15), formatC(paste(eval(parse(t = paste("class(",
lll[i], ")"))), collapse = " "), 1, 18), formatC(lll[i],
1, max(nchar(lll)) + 1), " ", eval(parse(t = paste("dimx(",
lll[i], ")"))), "\n")
}
}
}


>>> "Ben Fairbank" <[EMAIL PROTECTED]> 4/24/2007 9:10:20 AM >>>
Here is a copy of a correspondence I had with Jim Holtman -- his
function, which I now use almost daily, does exactly what I think you
need.  Could you send me a copy of Bendix Carstensen's function>

Thanks,

Ben Fairbank

From: jim holtman <[EMAIL PROTECTED]> 
To: Ben Fairbank <[EMAIL PROTECTED]> 
Date: Sep 27 2006 - 4:42pm 

 

Thanks for the suggestion. I did.

On 9/27/06, Ben Fairbank <[EMAIL PROTECTED]> wrote:
> Nicely done. May I suggest you post it to the list? Others probably
> would benefit also. Or maybe I am the only user dense enough not to
see
> how to write it.
>
> Ben
>
> -Original Message-
> From: jim holtman [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, September 27, 2006 4:36 PM
> To: Ben Fairbank
> Subject: Re: [R] Space required by object?
>
> That was a function I wrote when I needed a similar thing.
>
> On 9/27/06, Ben Fairbank <[EMAIL PROTECTED]> wrote:
> > Thank you! Exactly what I needed!
> >
> > Is that something you wrote?
> >
> > Ben Fairbank
> >
> > -Original Message-
> > From: jim holtman [mailto:[EMAIL PROTECTED] 
> > Sent: Wednesday, September 27, 2006 4:23 PM
> > To: Ben Fairbank
> > Subject: Re: [R] Space required by object?
> >
> > try this one:
> >

Note --  Horace, the function starts here -- 

my.ls <- function(pos=1, sorted=F){
.result <- sapply(ls(pos=pos, all.names=TRUE),
function(..x)object.size(eval(as.symbol(..x
if (sorted){
.result <- rev(sort(.result))
}
.ls <-
as.data.frame(rbind(as.matrix(.result),"**Total"=sum(.result)))
names(.ls) <- "Size"
.ls$Size <- formatC(.ls$Size, big.mark=',', digits=0, format='f')
.ls$Mode <- c(unlist(lapply(rownames(.ls)[-nrow(.ls)],
 function(x)mode(eval(as.symbol(x), '---')
.ls
}

And ends there

> >
> >
> > On 9/27/06, Ben Fairbank <[EMAIL PROTECTED]> wrote:
> > > Does R provide a function analogous to LS() or str() that reports
> the
> > > storage space, on disk or in memory, required by objects?
> > >
> > > Ben Fairbank
> > >
> > > __
> > > R-help@stat.math.ethz.ch mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help 
> > > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html 
> > > and provide commented, minimal, self-contained, reproducible code.
> > >
> >
> >
> > --
> > Jim Holtman
> > Cincinnati, OH
> > +1 513 646 9390
> >
> > What is the problem you are trying to solve?
> >


-Original Message-
From: [EMAIL PROTECTED] 
[mailto:[EMAIL PROTECTED] On Behalf Of Horace Tso
Sent: Tuesday, April 24, 2007 10:59 AM
To: r-help@stat.math.ethz.ch 
Subject: [R] Size of an object in workspace

Hi folks,

Is there a function to show the size of an R object? eg. in Kbytes?

Couple months ago Bendix Carstensen posted this marvelous little
function lls(), which shows all objects in the current workspace by
mode, class and 'size'. This is a wonderful enhancement to the build-in
ls() already and I now have it sourced in my Rprofile.site at startup. 

The only drawback is, 'size' is just the length/dim of an object. For
matrices and data frames this is good enough. But for a list, knowing
how many elements in there doesn't help much. I need to know the
totality of the content in a common unit, eg. byte. 

Thanks in advance. 

Horace

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 in clusterApply(): recursive default argument reference

2007-04-24 Thread Martin Morgan
Hi Nicolas --

I think your code is assuming that all nodes have access to the same
set of variables. One solution is to write in a more completely
'functional' style

parNullDistribIntersection <- function(g1, g2, perm=1000, cl=cl) {
n1 = nodes(g1)  
parSapply(cl, 1:perm,
  function(i, g1, g2, n1) {
  nodes(g1) <- sample(n1)
  numEdges(intersection(g1,g2))
  },
  g1, g2, n1)
}  

Another possibility is to ensure that the relevant variables are
exported to the cluster before parSapply. With both of these you'll
want to pay some attention to the costs of communicating the data to
the nodes, which could easily be overwhelming (Rmpi's version of
parSapply is smarter at doing the data transfer -- log n time rather
than linear time, where n is the number of nodes -- and more flexible
in distributing the work).

Hope that helps,

Martin


nicolas bertin <[EMAIL PROTECTED]> writes:

> Hi,
>
> I want to compute a distribution of the intersection of a graph and
> 'randomized' graphs induced by the permutations of node labels (to
> preserve the graph topology).
> Since I ll have many permutations to perform, I was thinking of using
> the snow package and in particular "parSapply" to divide the work
> between my 4 CPUs.
> But I get the following error message :
>
> Error in clusterApply(cl, splitList(x, length(cl)), lapply, fun, ...) : 
> recursive default argument reference
>
> What am i doing wrong ?
>
> Some details about my platform and R version :
> ---
> $platform
> [1] "x86_64-redhat-linux-gnu"
> $version.string
> [1] "R version 2.4.1 (2006-12-18)"
>
>
> Below is the snippet of code generating the error message :
> ---
> ### libraries ###
> library(graph)
> library(snow)
>
> ### functions ###
> nullDistribIntersection <- function(g1, g2, perm=1000)
> {
>   n1 <- nodes(g1)
>   sapply(1:perm,
> function(i)
> {
> nodes(g1) <- sample(n1)
>   numEdges(intersection(g1,g2))
> }
>)
> }
>
>
> parNullDistribIntersection <- function(g1, g2, perm=1000, cl=cl)
> {
>   n1 <- nodes(g1)
>   parSapply(cl, 1:perm,
> function(i)
> {
> nodes(g1) <- sample(n1)
>   numEdges(intersection(g1,g2))
> }
>)
> }
>
>
> ## initialize the graph and the rand seed
> set.seed(123)
> g <- randomEGraph(LETTERS[1:15], edges = 100)
>
> ## compute a distribution of the intersection of the graph 
> ## and a 'randomized' graph induced by the permutations of
> ## node labels (to preserve the graph topology)
> cat("1CPU sys time:",
> system.time(
>  dist <- nullDistribIntersection(g,g)
>),
> "\n"
> )
>
> cl <- makeCluster(c("localhost", "localhost"), type = "SOCK")
> cat("Cluster sys time:",
> system.time(
>  dist <- parNullDistribIntersection(g,g)
>),
> "\n"
> )
> 
>
> Thanks in advance.
>
> Nicolas Bertin 
> GSC / RIKEN Yokohama
>
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Martin Morgan
Bioconductor / Computational Biology
http://bioconductor.org

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


[R] aovlmer.fnc, lmer and binomial response

2007-04-24 Thread Daniel E. Bunker
Dear R-users,

I have recently discovered the languageR package and its aovlmer.fnc 
which offers a very slick way to test fixed effects hypotheses in lmer 
models using mcmc.

However, the R help page for aovlmer.fnc states that the lmer object 
must be based a continuous response variable. I take it this means that 
it will not work with family="binomial"? If so, how can I modify it to 
assess binomial response data?

Any advice or guidance would be greatly appreciated!

-Dan




-- 
Daniel E. Bunker
BioMERGE Associate Director
Post-Doctoral Research Scientist
Columbia University
Department of Ecology, Evolution and Environmental Biology
1200 Amsterdam Avenue
New York, NY 10027-5557

deb37ATcolumbiaDOTedu
917-843-5076 phone
212-854-8188 fax

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


[R] Size of an object in workspace

2007-04-24 Thread Horace Tso
Hi folks,

Is there a function to show the size of an R object? eg. in Kbytes?

Couple months ago Bendix Carstensen posted this marvelous little function 
lls(), which shows all objects in the current workspace by mode, class and 
'size'. This is a wonderful enhancement to the build-in ls() already and I now 
have it sourced in my Rprofile.site at startup. 

The only drawback is, 'size' is just the length/dim of an object. For matrices 
and data frames this is good enough. But for a list, knowing how many elements 
in there doesn't help much. I need to know the totality of the content in a 
common unit, eg. byte. 

Thanks in advance. 

Horace

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


Re: [R] Problem installing Rmpi with lam on SGI SLES9

2007-04-24 Thread Prof Brian Ripley

On Tue, 24 Apr 2007, Hendrik Fuß wrote:


Hi,

I've been trying here to install Rmpi on an SGI IA-64 machine with 64
processors, running SuSE Linux Enterprise Server 9, R 2.4.0 and
lam-mpi 7.1.3. While I've read of similar problems on this list, I
think I've got an entirely new set of error messages to contribute
(see below). I'm not sure what the actual error is and what the @gprel
relocation message is about. Any help greatly appreciated.


I don't know for sure, but on many 64-bit OSes you cannot link code from 
static libraries into dynamic shared libraries, and that seems to be the 
case with ia64 Linux.  Almost certainly you need to re-compile LAM with 
-fPIC flags.





thanks
Hendrik


behemoth:~/Rmpi # R CMD INSTALL /home/hfuss/build/Rmpi_0.5-3.tar.gz
--configure-args=--with-mpi=/usr/local/lam-mpi
* Installing *source* package 'Rmpi' ...
Try to find mpi.h ...
Found in /usr/local/lam-mpi/include
Try to find libmpi or libmpich ...
Found libmpi in /usr/local/lam-mpi/lib
Try to find liblam ...
Found liblam in /usr/local/lam-mpi/lib
checking for openpty in -lutil... no
checking for main in -lpthread... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\"
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c RegQuery.c -o RegQuery.o
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\"
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c Rmpi.c -o Rmpi.o
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\"
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c conversion.c -o conversion.o
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\"
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c internal.c -o internal.o
gcc -shared -L/usr/local/lib -o Rmpi.so RegQuery.o Rmpi.o conversion.o
internal.o -L/usr/local/lam-mpi/lib -lmpi -llam
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_comms
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_argv0
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_mpi_ao
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_ger
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_c2c
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_appnum
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_universe_size
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_jobid
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_jobid
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_mpi_ao
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_ger
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_c2c
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_appnum
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_universe_size
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dy

Re: [R] Values greater than 1 or lower than -1 in ARMAacf

2007-04-24 Thread Prof Brian Ripley
You do need to specify a stationary ARMA process for it to have an acf: 
your example is not valid since

> Mod(polyroot(c(1, -w)))
[1]  0.6726057  1.6256859  1.6256859  1.7448484  1.7448484 18.4778223

Have you actually looked at the reference on the help page?  It is there 
to be help-ful.

Like quite a few such things in R, we could 'nanny' you and tell you that 
this is not valid, but quite often invalid primary uses do have secondary 
uses.

On Tue, 24 Apr 2007, Cyril wrote:

>
> Dear all,
>
> I need to compute the ACF (autocorrel) of an AR6 process, given the values
> of its parameters (w1,w2,w3,w4,w5,w6).
> First, I notice that there is an error as soon as the sum of the wi equals 1
> :
>
> "Error in drop(.Call("La_dgesv", a, as.matrix(b), tol, PACKAGE = "base")) :
>system is computationally singular: reciprocal condition number =
> 1.00757e-18"
>
> Secondly, when the sum is greater than 1, some elements in the returned ACF
> vector do not belong to interval [-1,1], which looks a bit weird for
> autocorrelation (!)
> E.g. :
>> w<-c(0.9,0.7,0.1,0.1,0.19,0.01)
>> ARMAacf(w, lag.max = 6)
>0 1 2 3 4 5 6
> 1.00 -1.624285 -1.735076 -3.121879 -4.412638 -6.318869 -9.560138
>
> Does someone have a clue about it ?
>
> It would be very helpful.
>
> Thanks a lot
>
> Regards
> Cyril
>
>
>

-- 
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] Problem installing Rmpi with lam on SGI SLES9

2007-04-24 Thread Hendrik Fuß
Hi,

I've been trying here to install Rmpi on an SGI IA-64 machine with 64
processors, running SuSE Linux Enterprise Server 9, R 2.4.0 and
lam-mpi 7.1.3. While I've read of similar problems on this list, I
think I've got an entirely new set of error messages to contribute
(see below). I'm not sure what the actual error is and what the @gprel
relocation message is about. Any help greatly appreciated.

thanks
Hendrik


behemoth:~/Rmpi # R CMD INSTALL /home/hfuss/build/Rmpi_0.5-3.tar.gz
--configure-args=--with-mpi=/usr/local/lam-mpi
* Installing *source* package 'Rmpi' ...
Try to find mpi.h ...
Found in /usr/local/lam-mpi/include
Try to find libmpi or libmpich ...
Found libmpi in /usr/local/lam-mpi/lib
Try to find liblam ...
Found liblam in /usr/local/lam-mpi/lib
checking for openpty in -lutil... no
checking for main in -lpthread... no
configure: creating ./config.status
config.status: creating src/Makevars
** libs
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\"
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c RegQuery.c -o RegQuery.o
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\"
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c Rmpi.c -o Rmpi.o
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\"
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c conversion.c -o conversion.o
gcc -I/usr/local/lib/R/include -I/usr/local/lib/R/include
-DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\"
-I/usr/local/lam-mpi/include -DMPI2 -I/usr/local/include-fpic  -g
-O2 -std=gnu99 -c internal.c -o internal.o
gcc -shared -L/usr/local/lib -o Rmpi.so RegQuery.o Rmpi.o conversion.o
internal.o -L/usr/local/lam-mpi/lib -lmpi -llam
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_comms
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_argv0
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_mpi_ao
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_ger
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_c2c
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_appnum
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_universe_size
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_jobid
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_jobid
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_mpi_ao
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_ger
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_c2c
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_appnum
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_universe_size
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_mpi_ao
/usr/lib/gcc-lib/ia64-suse-linux/3.3.3/../../../../ia64-suse-linux/bin/ld:
/usr/local/lam-mpi/lib/libmpi.a(laminit.o): @gprel relocation against
dynamic symbol lam_clockskew
collect2: ld returned 1 exit status
make: *** [Rmpi.so] Error 1
chmod: cannot access 

[R] Values greater than 1 or lower than -1 in ARMAacf

2007-04-24 Thread Cyril

Dear all,

I need to compute the ACF (autocorrel) of an AR6 process, given the values
of its parameters (w1,w2,w3,w4,w5,w6).
First, I notice that there is an error as soon as the sum of the wi equals 1
:

"Error in drop(.Call("La_dgesv", a, as.matrix(b), tol, PACKAGE = "base")) : 
system is computationally singular: reciprocal condition number =
1.00757e-18"

Secondly, when the sum is greater than 1, some elements in the returned ACF
vector do not belong to interval [-1,1], which looks a bit weird for
autocorrelation (!)
E.g. :
> w<-c(0.9,0.7,0.1,0.1,0.19,0.01)
> ARMAacf(w, lag.max = 6)
0 1 2 3 4 5 6 
 1.00 -1.624285 -1.735076 -3.121879 -4.412638 -6.318869 -9.560138 

Does someone have a clue about it ?

It would be very helpful.

Thanks a lot

Regards
Cyril


-- 
View this message in context: 
http://www.nabble.com/Values-greater-than-1-or-lower-than--1-in-ARMAacf-tf3638973.html#a10161936
Sent from the R help mailing list archive at Nabble.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] Bug in xYplot() with method = 'filled bands'

2007-04-24 Thread Michael Kubovy
Dear r-helpers,

I have been bitten by a cryptic comment in the help page for xYplot().

Here is some code from Madeline Bauer, one of the authors, which is  
essentailly the code on the help page for xYplot():

# This example uses the summarize function in Hmisc to
# compute the median and outer quartiles.  The outer quartiles are
# displayed using "filled bands"

set.seed(111)
dfr <- expand.grid(month=1:12, year=c(1997,1998), reps=1:100)
month <- dfr$month; year <- dfr$year
y <- abs(month-6.5) + 2*runif(length(month)) + year-1997
s <- summarize(y, llist(month,year), smedian.hilow, conf.int=.5)

# filled bands: default fill = pastel colors matching solid colors
# in superpose.line (this works differently in R)
xYplot ( Cbind ( y, Lower, Upper ) ~ month, groups=year,
  method="filled bands" , data=s, type="l")

The comment "this works differently in R" should be ammended to a  
more explicit danger sign (otherwise users like myself might find  
themselves wasting a great deal of time). There appear to be two  
differences between S+ and R here: (1) the default colors of the  
bands are not as expected (but they can be changed at will, so that's  
not a serious problem); (2) I have not been able get rid of the  
outline around the filled bands or change their colors to match the  
fill.

I would have thought that ...

xYplot ( Cbind ( y, Lower, Upper ) ~ month, groups=year,
  method="filled bands" , data=s, type="l", lwd.bands = 0,
  lty.bands = 0, col.bands = 'white')

... would do the trick.

I even tried to fix the problem in the code of xYplot:

 > panel.XYplot

function (x, y, subscripts, groups = NULL, type = if (is.function 
(method) ||
...
if (method == "filled bands") {
if (.R.)
grid.polygon(x = c(x, rev(x)), y = c(lower, rev(upper)),
gp = gpar(fill = col.fill, col = col.bands,
lty = lty.bands, lwd = lwd.bands),
default.units = "native")
else polygon(x = c(x, rev(x)), y = c(lower, rev(upper)),
col = col.fill)
}
...
}

Obviously I don't know grid well enough to fix the problem. Help  
would be much appreciated, as well as a more explicit warning on the  
xYplot() help page.

There is, of course, the possibility that there's something wrong  
with my version of R or my OS or my machine. In that case a  
replication or non-replication of this problem on a different OS  
might alert me to this.

R version 2.5.0 RC (2007-04-21 r41269)
i386-apple-darwin8.9.1

locale:
C

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

other attached packages:
 coda lme4   Matrix  car   
cacheSweave   stashR
 "0.10-7"  "0.9975-13"  "0.9975-11"  "1.2-1" 
"0.3"  "0.2-1"
 filehash   digest circular boot  gmodels  
multcompView
  "0.9-4"  "0.2.3"  "0.3-6" "1.2-27"  
"2.13.2"  "0.1-0"
  reshape  vcd   colorspace  effects 
Hmisc  acepack
  "0.7.2"  "1.0-3"   "0.95" "1.0-10"  "3.3-1" 
"1.3-2.2"
   HH multcomp  mvtnorm  JGR
iplots   JavaGD
 "1.18-3""0.991-9"  "0.7-5" "1.4-15"   
"1.0-7"  "0.3-6"
 MASS gridBase  lattice latticeExtra 
rJava   xtable
 "7.2-33"  "0.4-3" "0.15-4"  "0.1-6"  
"0.4-15"  "1.4-3"

Thanks,
Michael Kubovy

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

2007-04-24 Thread J . delasHeras
Quoting [EMAIL PROTECTED]:

> Hi everyone,
>
> I have a question about limmaGUI.I've just started to use the program
> for microarray analysis.My problem is after loading data into Limma
> (with GAl file and RNA targets file),I'm not able to create an M box
> plot and everytime I'm trying to do that, some error appear:
> Error in .find.package(pkg): there is no package called 'tkrplot'
> Error in try(expr,TRUE): could not find function "tkrplot"
> Error in .Tcl.args.objv(...):object "img" not found
> I would also like to know if it's necessary to have a spot type file.
> I'm using R in windows xp,version 2.3.1 and limmaGUI version 1.8.1
> using limma version 2.7.10.
> Could the problem be the version of LimmaGUI I'm using?
> I appreciate your help.

The spots file is not necessary. It is used, however, to define  
individual spots or classes of spots of interests, either to remove  
from normalisation, as control spots, or just to highlight in  
different colours on your plots.

In windows I recommend you install limmaGUI from:

http://bioinf.wehi.edu.au/limmaGUI/

go to section 2.3.1, for a binary that will install R 2.1.1 and  
limmaGUI with all dependent packages.

I hope this helps

Jose

PS: remember the BioConductor forum, you're more likely to get useful  
answers about limmaGUI over there.
http://www.bioconductor.org/docs/mailList.html

-- 
Dr. Jose I. de las Heras  Email: [EMAIL PROTECTED]
The Wellcome Trust Centre for Cell BiologyPhone: +44 (0)131 6513374
Institute for Cell & Molecular BiologyFax:   +44 (0)131 6507360
Swann Building, Mayfield Road
University of Edinburgh
Edinburgh EH9 3JR
UK

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


Re: [R] xyplot source file only work with echo=TRUE

2007-04-24 Thread Dieter Menne
Ronaldo Reis Junior  gmail.com> writes:

> I write several xyplot graphics on a source file. When I try to use 
> source("graphics.R") the source don't work, but if I use 
> source("graphics.R",echo=T) it work. Generally some commands work without 
> echo=T, but xyplot dont work. Why it dont work without echo=T? It is possible 
> to write a source that dont need echo=T on source command?
> 

Most likely another variant of 



See: Why do lattice/trellis graphics not work?

Dieter Menne

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] xyplot source file only work with echo=TRUE

2007-04-24 Thread Sundar Dorai-Raj
Read FAQ 7.22

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-do-lattice_002ftrellis-graphics-not-work_003f

--sundar

Ronaldo Reis Junior said the following on 4/24/2007 6:38 AM:
> Hi,
> 
> I write several xyplot graphics on a source file. When I try to use 
> source("graphics.R") the source don't work, but if I use 
> source("graphics.R",echo=T) it work. Generally some commands work without 
> echo=T, but xyplot dont work. Why it dont work without echo=T? It is possible 
> to write a source that dont need echo=T on source command?
> 
> Thanks
> Ronaldo

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] regarding 3d Bar Plot --- correction.

2007-04-24 Thread rolf

I mis-spoke.  It seems I had two collections of functions in the same
directory.  One by Colin Goodall, and one by David Scott (I have no
record of where he is/was located).  It is the *latter* collection
that does all its work from within Fortran.

I'll have another look at what Colin Goodall actually wrote to see if
it could be useful to guarav.

cheers,

Rolf Turner
[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] write

2007-04-24 Thread Petr PIKAL
Hi

had you consider to look at help page? How do you expect your written file 
to be named? 

>From help page

write is a wrapper for cat, which gives further details on the format used
cat is useful for producing output in user-defined functions. It converts 
its arguments to character strings, concatenates them, separating them by 
the given sep= string, and then outputs them
save for writing any R objects, write.table for data frames, and scan for 
reading data
 ^^
write.table(F, "some.file.name", sep= "\t")

can maybe do what you want.

Help provided with your installation is probably the quickiest way how to 
evaluate things about commands without waiting for usually delayed and 
sometimes ironical answer.

Regards
Petr

BTW, F can state for FALSE so if you stick with such names you can be 
somtimes quite confused however smart is R in evaluating functions and 
objects.



[EMAIL PROTECTED] napsal dne 24.04.2007 15:21:05:

> ok,
> I have problems with write function
> 
> > F
>Id_TrT1 Id_Geno Id_Rep Val_O
> 30   55094  185
> 90   55096  187
> 15   0   55098  192
> 21   0   55079  176
> 27   0   55095  192
> 33   0   55099  198
> 39   0   55092  192
> 45   0   55090  172
> 51   0   55101  193
> 57   0   55106  190
> 
> and  to write F I obtain like this:
> 
> > write(F, "", sep="  ")
> Erreur dans cat(list(...), file, sep, fill, labels, append) : 
> argument 1 (type 'list') pas encore traité par cat
> 
> 
> I know that the problem it's that f is a list but when I change it in 
matrix 
> or something else the consol display it but badly
> I obtain just one column
> 
> 
> 
> 
___
> 
> 
> 
> 
> 
>[[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] write

2007-04-24 Thread Conny Schmitt
Hallo,

it might be a problem with the underscore in the names. Look up the syntax 
conventions. Here is a example for the write function in my programs perhaps it 
might help you:

helpLetters=""
cat("\nThe workspace is now imported!", helpLetters ,"\n\n")
cat("The names of the variables are the same as they were in Matlab.", 
helpLetters ,"\n")


CU, Corinna



 Original-Nachricht 
Datum: Tue, 24 Apr 2007 15:29:47 +0200
Von: "Conny Schmitt" <[EMAIL PROTECTED]>
An: elyakhlifi mustapha <[EMAIL PROTECTED]>
CC: R-help@stat.math.ethz.ch
Betreff: Re: [R] write

> Hallo,
> 
> just try it like a data frame, as I mailed you last time. Here an example:
> 
> dat <- data.frame(Class=I("Id_TrT1"), Levels=I("1"), Values=I("2")) 
> new.info <- c(Class="Id_Geno", Levels="7" , Values="64208   64209  64210 
> 64211  64212  64213  64214")
> dat <- rbind(dat, new.info)
> dat
> new.info <- c(Class=" Id_Rep ", Levels="2" , Values="12") dat <-
> rbind(dat, new.info) dat
> 
> Just hack it in the console and look at the output. you can change it for
> your now needs.
> 
> CU, Corinna
> 
> 
> 
> 
>  Original-Nachricht 
> Datum: Tue, 24 Apr 2007 13:21:05 + (GMT)
> Von: elyakhlifi mustapha <[EMAIL PROTECTED]>
> An: R-help@stat.math.ethz.ch
> Betreff: [R] write
> 
> > ok,
> > I have problems with write function
> > 
> > > F
> >Id_TrT1 Id_Geno Id_Rep Val_O
> > 30   55094  185
> > 90   55096  187
> > 15   0   55098  192
> > 21   0   55079  176
> > 27   0   55095  192
> > 33   0   55099  198
> > 39   0   55092  192
> > 45   0   55090  172
> > 51   0   55101  193
> > 57   0   55106  190
> > 
> > and  to write F I obtain like this:
> > 
> > > write(F, "", sep="  ")
> > Erreur dans cat(list(...), file, sep, fill, labels, append) : 
> > argument 1 (type 'list') pas encore traité par cat
> > 
> > 
> > I know that the problem it's that f is a list but when I change it in
> > matrix or something else the consol display it but badly
> > I obtain just one column
> > 
> > 
> >   
> >
> ___
> > 
> > 
> > 
> > 
> > 
> > [[alternative HTML version deleted]]
> > 
> 
> -- 
> "Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] regarding 3d Bar Plot

2007-04-24 Thread rolf

[EMAIL PROTECTED] wrote:

> I have data in a two dimensional table. each row of the data adds
> upto 100 ( hence they are percentages ).  it can be interpreted as
> like this A - I are the matches and  P - X are the players. Thus
> Player P scored 20% of the runs during this season in Match C, 60% in
> Match D and remaining 20% in Match G.
> 
> I want to plot 3-d bar plot, where X axis have players, Y axis have
> Matches and Z axis as the percentage(0 - 100%) Please help me in this
> regards.
 
 

Many years ago I picked up from the snews mailing list a
suite of functions for plotting 2D barplots (barplots with 2D
bases) written by a chap named Colin Goodall, from (at that
time) the University of Bristol and/or from Penn State.

I never actually did anything with this suite until
recently.  Seeing no replies to the enquiry about 3D
histograms,  I thought I'd try to get Goodal's code running
in R to see if it might solve guarav's problem.

The trouble is, all the guts of the procedure, *including*
the plotting are done from within Fortran.  The actual
plotting seems to be done through a call to a subroutine
``segmtz'' which is a piece of Splus software that does not
exist in R.

Is there an equivalent subroutine in R that could be called?
I dug around a bit but couldn't figure out what was going
on.  The function segments() simply calls
.Internal(segments(

I looked around a bit for corresponding C or Fortran code but
obviously didn't know how to look properly.

I think that the Fortran code could be translated into raw R
and the call to segmtz changed to a call to segments() ---
but this would seem to be a lot of work.

Can anyone suggest a reasonably simple way of replacing the
call to segmtz in the Fortran?

cheers,

Rolf Turner
[EMAIL PROTECTED]

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


[R] xyplot source file only work with echo=TRUE

2007-04-24 Thread Ronaldo Reis Junior
Hi,

I write several xyplot graphics on a source file. When I try to use 
source("graphics.R") the source don't work, but if I use 
source("graphics.R",echo=T) it work. Generally some commands work without 
echo=T, but xyplot dont work. Why it dont work without echo=T? It is possible 
to write a source that dont need echo=T on source command?

Thanks
Ronaldo
-- 
Aluno de Informática não cola, faz transferência de dados.
--
> Prof. Ronaldo Reis Júnior
|  .''`. UNIMONTES/Depto. Biologia Geral/Lab. Ecologia Evolutiva
| : :'  : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia
| `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
|   `- Fone: (38) 3229-8190 | [EMAIL PROTECTED] | [EMAIL PROTECTED]
| ICQ#: 5692561 | LinuxUser#: 205366

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

2007-04-24 Thread Conny Schmitt
Hallo,

just try it like a data frame, as I mailed you last time. Here an example:

dat <- data.frame(Class=I("Id_TrT1"), Levels=I("1"), Values=I("2")) 
new.info <- c(Class="Id_Geno", Levels="7" , Values="64208   64209  64210  64211 
 64212  64213  64214")
dat <- rbind(dat, new.info)
dat
new.info <- c(Class=" Id_Rep ", Levels="2" , Values="12") dat <- rbind(dat, 
new.info) dat

Just hack it in the console and look at the output. you can change it for your 
now needs.

CU, Corinna




 Original-Nachricht 
Datum: Tue, 24 Apr 2007 13:21:05 + (GMT)
Von: elyakhlifi mustapha <[EMAIL PROTECTED]>
An: R-help@stat.math.ethz.ch
Betreff: [R] write

> ok,
> I have problems with write function
> 
> > F
>Id_TrT1 Id_Geno Id_Rep Val_O
> 30   55094  185
> 90   55096  187
> 15   0   55098  192
> 21   0   55079  176
> 27   0   55095  192
> 33   0   55099  198
> 39   0   55092  192
> 45   0   55090  172
> 51   0   55101  193
> 57   0   55106  190
> 
> and  to write F I obtain like this:
> 
> > write(F, "", sep="  ")
> Erreur dans cat(list(...), file, sep, fill, labels, append) : 
> argument 1 (type 'list') pas encore traité par cat
> 
> 
> I know that the problem it's that f is a list but when I change it in
> matrix or something else the consol display it but badly
> I obtain just one column
> 
> 
>   
> ___
> 
> 
> 
> 
> 
>   [[alternative HTML version deleted]]
> 

-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...

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


Re: [R] Problem with length of array while calling C from R

2007-04-24 Thread Martin Maechler
> "Sven" == Sven Knüppel <[EMAIL PROTECTED]>
> on Tue, 24 Apr 2007 13:53:09 +0200 writes:

Sven> Hello,
Sven> my problem is that I don't know how long must be an array of double 
while calling C from R.

Sven> R-Code:
>> array <- c(1,1,1)
>> save <- .C ( "Ctest" , a = array )

Sven> C-Code: void Ctest ( double *array ) { ...  array =
Sven> (double*) realloc ( array , new_number *
Sven> sizeof(double) ) ; ...  }

Sven> The length of "array" will be compute in C.

Sven> At the end save$a has a length of 3 and not the length of the 
allocated array in C.

Sven> What can I do?

Either you learn to use  .Call()  where you pass whole R
objects, and can use  length(.) on them in your C code,

or, simpler in this case, but much less powerful in general,
you change your R code to

   ss <- .C("Ctest", a = myarray, n = length(myarray))

and the C code to

void Ctest (double *array, int *n) { 
 .
}

and then make use of  *n  inside the C code.

Martin Maechler, ETH Zurich

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


[R] write

2007-04-24 Thread elyakhlifi mustapha
ok,
I have problems with write function

> F
   Id_TrT1 Id_Geno Id_Rep Val_O
30   55094  185
90   55096  187
15   0   55098  192
21   0   55079  176
27   0   55095  192
33   0   55099  198
39   0   55092  192
45   0   55090  172
51   0   55101  193
57   0   55106  190

and  to write F I obtain like this:

> write(F, "", sep="  ")
Erreur dans cat(list(...), file, sep, fill, labels, append) : 
argument 1 (type 'list') pas encore traité par cat


I know that the problem it's that f is a list but when I change it in matrix or 
something else the consol display it but badly
I obtain just one column


  
___





[[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] Datasets' data license ?

2007-04-24 Thread David Cournapeau
Hi,

I would like to know if someone could clarify a question regarding 
license for redistribution of raw data in the datasets package. If 
possible, I would like to reuse those data in a package for scipy 
(http://www.scipy.org), which is under a BSD license. The package 
datasets itself is under GPL, but I don't know if this covers the actual 
data too ?

cheers,

David

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

2007-04-24 Thread Stefan Grosse
Is it so much effort to use the search on r-project.org?

elyakhlifi mustapha wrote:
> hello,
> If I wanna export data.frame from R to html have you got some ideas to do 
> this?
>
>
>   
> ___
>
>
>
>
>
>   [[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] from R to html

2007-04-24 Thread Jeffrey Horner
Henrique Dallazuanna wrote:
> Use the package R2HTML.

Or xtable.

Jeff
-- 
http://biostat.mc.vanderbilt.edu/JeffreyHorner

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Problem with length of array while calling C from R

2007-04-24 Thread Sven Knüppel
Hello,

my problem is that I don't know how long must be an array of double while 
calling C from R.

R-Code:
> array <- c(1,1,1)
> save <- .C ( "Ctest" , a = array )

C-Code:
void Ctest ( double *array )
{ ...
  array = (double*) realloc ( array , new_number * sizeof(double) ) ;
  ...
}

The length of "array" will be compute in C.

At the end save$a has a length of 3 and not the length of the allocated array 
in C.

What can I do?

Thank you in advance.

Sven Knüppel

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Calculating means in a new table

2007-04-24 Thread Petr PIKAL
Hi

look at aggregate

something like 

mymean<-aggregate(mydata[,4:5], list( location, Spezies), mean)
mysd<-aggregate(mydata[,4:5], list( location, Spezies), sd)

and then cbind(appropriate columns of resulting data frames)

Petr Pikal
[EMAIL PROTECTED]

[EMAIL PROTECTED] napsal dne 24.04.2007 14:04:30:

> Dear all -
> I imported (on a Mac) a big table with >2000 lines:
> > mydata <- read.table(file("/Users/didiw/Desktop/R/all.txt"), header = 
TRUE) 
> > mydata[1:15,]
>location Spezies Spec E.MPa.   Phi No Trial 
> 1LC   PJ  13.27  7.51  1 1 
> 2LC   PJ  14.24  6.68  1 1 
> 3LC   PJ  14.28  7.01  2 1 
> 4LC   PJ  16.65  6.30  1 2 
> 
> 
> Now i want to crate a new table "mymeans" where all means and Stdev 
> of E.MPa and Phi when location, Spezies, No, and Trial are the same, 
> something like this:
> 
>location Spezies Spec No Trial mean.E   stddev.E   mean.Phi   std.Phi
> 1LC   PJ 1 1  xx  xx  xx  xx
> 2LC   PJ 2 1  xx  xx  xx  xx 
> 3LC   PJ 1 2  xx  xx  xx  xx 
> 
> 
> Because I we did ca 8 repetition of each measurement, the new table 
should
> have only 2000/8 lines.
> 
> Thanks for any help!
> 
> -didi
> 
> __
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Kernel

2007-04-24 Thread Oriana Caldera
I'm a new user of R-packages.
  I'm in need of information with regard to Stochastic Kernel.
  I would like to know if I can use R to compute stochastic Kernels according 
to Quah methodology.
  Best wishes,
  Oriana

   
-

-

[[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] Handling of arrays

2007-04-24 Thread laptopcss
Dear R-Experts,

I just imported a workspace from Matlab. I know that I can get the names of the 
imported variables with names(). It works. The variable "ca" consists of 
several elements. I want to get the names of the elements to handle my output 
better. But names(ca) doesn't work. Why? I did the following commands:

> class(ca)
[1] "array"
> mode(ca)
[1] "list"
> dim(ca)
[1] 66  1  1
> length(ca)
[1] 66

How can I now get the names which are stored in ca? When I use the command 
"ca[18]" I receive the content which stands there but not the name collables 
which I wanted to extract. 

Any ideas?

Thanks, Corinna 
-- 
"Feel free" - 10 GB Mailbox, 100 FreeSMS/Monat ...

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Calculating means in a new table

2007-04-24 Thread Dieter Wirz
Dear all -
I imported (on a Mac) a big table with >2000 lines:
> mydata <- read.table(file("/Users/didiw/Desktop/R/all.txt"), header = TRUE) 
> mydata[1:15,]
   location Spezies Spec E.MPa.   Phi No Trial  
1LC   PJ  13.27  7.51  1 1  
2LC   PJ  14.24  6.68  1 1  
3LC   PJ  14.28  7.01  2 1  
4LC   PJ  16.65  6.30  1 2  


Now i want to crate a new table "mymeans" where all means and Stdev 
of E.MPa and Phi when location, Spezies, No, and Trial are the same, 
something like this:

   location Spezies Spec No Trial mean.Estddev.Emean.Phi
std.Phi
1LC   PJ 1 1  xxxx  xx  
xx
2LC   PJ 2 1  xxxx  xx  
xx  
3LC   PJ 1 2  xxxx  xx  
xx 


Because I we did ca 8 repetition of each measurement, the new table should
have only 2000/8 lines.

Thanks for any help!

-didi

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

2007-04-24 Thread Henrique Dallazuanna
Use the package R2HTML.

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

On 4/24/07, elyakhlifi mustapha <[EMAIL PROTECTED]> wrote:
>
> hello,
> If I wanna export data.frame from R to html have you got some ideas to do
> this?
>
>
>
>
> ___
>
>
>
>
>
> [[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] from R to html

2007-04-24 Thread elyakhlifi mustapha
hello,
If I wanna export data.frame from R to html have you got some ideas to do this?


  
___





[[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] Re : (no subject)

2007-04-24 Thread justin bem
Mustapha,

donC is not a function if it is a list write donC[[i]] or donC[i] for indexing
 
Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.



- Message d'origine 
De : elyakhlifi mustapha <[EMAIL PROTECTED]>
À : R-help@stat.math.ethz.ch
Envoyé le : Mardi, 24 Avril 2007, 10h48mn 48s
Objet : [R] (no subject)


I wanna display some data which there are subsets of a dataframe called "don" 
but there are errors like this

> L=as.numeric(levels(factor(don$Id_Cara)))
> for(i in L){
+ donC(i)=subset(don, Id_Cara == i, select = c( Id_TrT1, Id_Geno, Id_Rep, 
Val_O))
+ donC(i)
+ }
Erreur dans donC(i) = subset(don, Id_Cara == i, select = c(Id_TrT1, Id_Geno,  : 
impossible de trouver la fonction "donC<-"

I understand that the problem comes from the third line 

it doesn't reconize "donC(i)" but  it's very important to make one "boucle" (in 
french) on the L's elements.

to tell more about L :

> L
[1] 103 137 138 177 193 308


  
___





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


  


ls.. et vos réactions !

[[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] Re : statistical modelling skill

2007-04-24 Thread justin bem
Thank, Jim to look to my post . I dont explain pass/fail by the exam score but 
I want to explain both of them by a set of explanotory variables. 
y_{i}=a_{0}+\sum_{i}a_{i}x_{i}
   or P(z_{i}=k)=F(a_{0}+\sum_{i}a_{i}x_{i}) z_{i}=1(c_{k}
À : justin bem <[EMAIL PROTECTED]>
Envoyé le : Mardi, 24 Avril 2007, 11h10mn 01s
Objet : Re: [R] statistical modelling skill


justin bem wrote:
> Dears helpers,
> 
> I have a question not specially about R, but about statistical modelling. 
> This is the problem, I want to conduct a regression analysis to explain the 
> causes of students fail in an exam. I have two variables the score obtain at 
> the exam and the categorical variable coding 0 in case of fail and 1 in case 
> of success, on a panel data. I am interest to know what made a student who 
> usually succeed start to fail. So I have two possibilty : linear regression 
> analysis with the score or a probit model with the fail indicator. 
> 
> In my view, the result will be similary. but is there any difference? what 
> the advantage off choosing one the two approaches ? 

Hi Justin,
I'm probably missing something, but I can't see how predicting pass/fail 
with the exam score will reveal anything other than the minimum passing 
grade. There is an awful lot of work in this field, typically measuring 
everything from the student's birth weight to the number of bars they 
visit while at college. However, the generalized linear model is your 
tool, using the binomial link function.

Jim


  
___





[[alternative HTML version deleted]]

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


Re: [R] How to get LSMEANS from linear mixed model?

2007-04-24 Thread Chuck Cleland
Yannan Jiang wrote:
> Hi there,
> 
>  
> 
> I am trying to run simulations using R with linear mixed model (lme). There
> are two factors in my fixed effect model, educ (treatment and control) and
> mth (visit 1, 2, and 3). What I want to obtain is the estimated treatment
> difference (treatment - control) at visit 3, plus the standard error and
> p-value. This can be easily obtained in SAS using lsmeans or estimate
> statements, but I am not sure how to do this in R. 
> 
>  
> 
> The fixed effects I obtained are as follows:
> 
>  
> 
> Fixed effects: ymth ~ educ * mth - 1 
> 
> Value   Std.Error
> DFt-value   p-value
> 
> educcont   0.14814308   0.006232419  93
> 23.769758 0.
> 
> eductreat   0.13696952   0.006255672  93
> 21.895254 0.
> 
> mthymth2  0.3759   0.006333043  165
> 0.005936   0.9953
> 
> mthymth3  0.01075489   0.006251328  165
> 1.720416   0.0872
> 
> eductreat:mthymth2   0.00323847   0.008947291  165
> 0.361950   0.7179
> 
> eductreat:mthymth3   -0.01246565  0.008941306  165
> -1.394164  0.1651
> 
>  
> 
>  
> 
> The estimated treatment difference I am interested are:
> 
>  
> 
>  a<-0.14814308+0.01075489 
> 
>  b<-0.13696952+0.01075489-0.01246565
> 
>> b-a
> 
> [1] -0.02363921   (treatment effect at visit 3, same as SAS lsmean output)
> 
>  
> 
> But I don't know how to get the standard error and corresponding p-value for
> this estimate. Any of your helps on that would be greatly appreciated! 

  How about fitting the model this way?

df$mth <- relevel(df$mth, ref = "ymth3")
lme(ymth ~ educ * mth, random = ~ 1 | id, data = df)

  The coefficient for educ will contain the simple effect of educ at
mth=ymth3, along with a standard error and p-value.

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

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

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


Re: [R] problem in tapply command

2007-04-24 Thread Dimitris Rizopoulos
probably you're looking for

tapply(slp_jeo2$slp, slp_jeo2$jeo, mean, na.rm = TRUE)


Best,
Dimitris


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

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


- Original Message - 
From: "temiz" <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, April 24, 2007 7:21 PM
Subject: [R] problem in tapply command


> hello
>
> when I entered following command, I got NA values for some 
> catagories.
>
> > tapply(slp_jeo2$slp,slp_jeo2$jeo,mean )
>  999   Ca  Cka  DCy   Jh  JKi 
> Kk
> 14.06665   NA 14.60445   NA   NA   NA   NA 
> NA
> KTa KTac   Ku  Kua  Kus   Ky  Kyk 
> ODe
>  NA   NA   NA   NA   NA   NA   NA 
> 17.87489
>PTRc   Qa   TcTkisd
>  NA   NA   NA 19.64067
>
>
> how can I correct this problem ?
>
> regards
>
> -- 
> Ahmet Temiz
>
>
> -- 
> This message has been scanned for viruses and\ dangerous 
> con...{{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.
> 


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

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


Re: [R] problem in tapply command

2007-04-24 Thread Riley, Steve
Ahmet,

Try the following syntax: tapply(slp_jeo2$slp,slp_jeo2$jeo,mean, na.rm =
T)

Steve

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of temiz
Sent: Tuesday, April 24, 2007 1:22 PM
To: r-help@stat.math.ethz.ch
Subject: [R] problem in tapply command

hello

when I entered following command, I got NA values for some catagories.

 > tapply(slp_jeo2$slp,slp_jeo2$jeo,mean )
  999   Ca  Cka  DCy   Jh  JKi   Kk
14.06665   NA 14.60445   NA   NA   NA   NA   NA
 KTa KTac   Ku  Kua  Kus   Ky  Kyk  ODe
  NA   NA   NA   NA   NA   NA   NA 17.87489
PTRc   Qa   TcTkisd
  NA   NA   NA 19.64067


how can I correct this problem ?

regards

-- 
Ahmet Temiz


-- 
This message has been scanned for viruses and\ dangerous\ co...{{dropped}}

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


[R] R 2.5.0 is released

2007-04-24 Thread Peter Dalgaard
I've rolled up R-2.5.0.tar.gz a short while ago. This is a development 
release which contains a number of new features. In particular:

  - Object name completion by integration of package 'rcompletion' by 
Deepayan Sarkar
  - New recommended package 'codetools' by Luke Tierney
  - New Rscript front-end, which enables shell-like R scripting

also, a number of mostly minor bugs have been fixed. See the full list
of changes below.

You can get it (some time this evening) from

http://cran.r-project.org/src/base/R-2/R-2.5.0.tar.gz

or wait for it to be mirrored at a CRAN site nearer to you. In case of 
impatience, try http://www.biostat.ku.dk/~pd/R-release

Binaries for various platforms will appear in due course.
 
For the R Core Team

Peter Dalgaard

These are the md5sums for the freshly created files, in case you wish
to check that they are uncorrupted:
a8efde35b940278de19730d326f58449  AUTHORS
eb723b61539feef013de476e68b5c50a  COPYING
a6f89e2100d9b6cdffcea4f398e37343  COPYING.LIB
aa6d06dd154bbde39b4d35f26068675d  FAQ
70447ae7f2c35233d3065b004aa4f331  INSTALL
b12ff4c900a49f0d7786d80e249934c9  NEWS
88bbd6781faedc788a1cbd434194480c  ONEWS
4f004de59e24a52d0f500063b4603bcb  OONEWS
b9088663fc539c059acfaf19d6d90a69  R-2.5.0.tar.gz
b9088663fc539c059acfaf19d6d90a69  R-latest.tar.gz
433182754c05c2cf7a04ad0da474a1d0  README
020479f381d5f9038dcb18708997f5da  RESOURCES
4eaf8a3e428694523edc16feb0140206  THANKS

This is the relevant part of the NEWS file:


CHANGES IN R VERSION 2.5.0


USER-VISIBLE CHANGES

o   apropos(x) and find(x) now both only work for character 'x',
and hence drop all non-standard evaluation behaviour.

o   Data frames can have 'automatic' row names which are not
converted to dimnames by as.matrix().  (Consequently, e.g.,
t(.)  for such data frames has NULL column names.)  This
change leads to memory reductions in several places, but can
break code which assumes character dimnames for data frames
derived from matrices.

No existing R object is regarded as having 'automatic' row
names, and it may be beneficial to recreate such objects via
read.table() or data.frame().

o   Using $ on an atomic vector now raises a warning, as does use
on an S4 class for which a method has not been defined.

o   The Unix-alike readline terminal interface now does
command-completion for R objects, incorporating the
functionality formerly in package 'rcompletion' by Deepayan
Sarkar.  This can be disabled by setting the environment
variable R_COMPLETION=FALSE when starting R (e.g. in
~/.Renviron).  (Note that when this is enabled, filename
completion no longer works for file paths containing R
operators such as '+' and '-'.)


NEW FEATURES

o   abbreviate() no longer has an 8191 byte limit on the size of
strings it can handle.

o   abs(x) now returns integer for integer or logical arguments.

o   apropos() has a new argument 'ignore.case' which defaults to
TRUE, potentially matching more than previously, thanks to a
suggestion by Seth Falcon.

o   args(), str() and print() now give the argument lists of primitive
functions.

o   as.matrix() gains the '...' argument that several packages have
assumed it always had (and S-PLUS has).

o   Manipulation of integers as roman numerals via as.roman() in
package utils.

o   attr() no longer treats name = NA_character_ as meaning
name = "NA".

o   binom.test() now allows a 'fuzz' for calculated integer values
in its x and n arguments.

o   boxplot(*, notch = TRUE) now warns when notches are outside
hinges; related to PR#7690.

o   New function callCC() providing a downward-only version of
Scheme's call with current continuation.

o   capabilities() now has a "profmem" entry indicating whether
R has been compiled with memory profiling.

o   colnames<-() and rownames<-() now handle data frames explicitly,
so calling colnames<- on a data frame no longer alters the
representation of the row names.

o   commandArgs() has a new 'trailingOnly' argument to be used in
conjunction with --args.

o   contour() now passes graphical parameters in '...' to axis()
and box().

o   New data set 'crimtab' on Student(1908)'s 3000 criminals.

o   cut.default() has a new argument 'ordered_result'.

o   .deparseOpts() has two new options: "keepNA" to ensure that
different types (logical, integer, double, character and
complex) of NAs are distinguished, and "S_compatible" to
suppress the use of R-specific features such as 123L and to
deparse integer values of a double vector with a trailing
decimal point.

The 'keepInteger' option now uses the suffix 'L' rather than
as.integer() 

[R] problem in tapply command

2007-04-24 Thread temiz
hello

when I entered following command, I got NA values for some catagories.

 > tapply(slp_jeo2$slp,slp_jeo2$jeo,mean )
  999   Ca  Cka  DCy   Jh  JKi   Kk
14.06665   NA 14.60445   NA   NA   NA   NA   NA
 KTa KTac   Ku  Kua  Kus   Ky  Kyk  ODe
  NA   NA   NA   NA   NA   NA   NA 17.87489
PTRc   Qa   TcTkisd
  NA   NA   NA 19.64067


how can I correct this problem ?

regards

-- 
Ahmet Temiz


-- 
This message has been scanned for viruses and\ dangerous con...{{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] (no subject)

2007-04-24 Thread jim holtman
Are you trying to create a 'list' of the subsets?  If so, try:

L=as.numeric(levels(factor(don$Id_Cara)))
donC <- list()
for(i in L){
   donC[[i]] <- subset(don, Id_Cara == i, select = c( Id_TrT1,
Id_Geno, Id_Rep, Val_O))
   print(donC[[i]])
}


Or better using the 'names' of the factors

L <- levels(factor(don$Id_Cara))
donC <- list()
for(i in L){
   donC[[i]] <- subset(don, Id_Cara == i, select = c( Id_TrT1,
Id_Geno, Id_Rep, Val_O))
   print(donC[[i]])
}



On 4/24/07, elyakhlifi mustapha <[EMAIL PROTECTED]> wrote:
> I wanna display some data which there are subsets of a dataframe called "don" 
> but there are errors like this
>
> > L=as.numeric(levels(factor(don$Id_Cara)))
> > for(i in L){
> + donC(i)=subset(don, Id_Cara == i, select = c( Id_TrT1, Id_Geno, Id_Rep, 
> Val_O))
> + donC(i)
> + }
> Erreur dans donC(i) = subset(don, Id_Cara == i, select = c(Id_TrT1, Id_Geno,  
> :
>impossible de trouver la fonction "donC<-"
>
> I understand that the problem comes from the third line
>
> it doesn't reconize "donC(i)" but  it's very important to make one "boucle" 
> (in french) on the L's elements.
>
> to tell more about L :
>
> > L
> [1] 103 137 138 177 193 308
>
>
>
> ___
>
>
>
>
>
>[[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.
>


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

What is the problem you are trying to solve?

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

2007-04-24 Thread Petr PIKAL
Hi

you shall:

use appropriate subject e.g. how to subset data
use [ ] brackets
initialize object donC before using it for assignment

and maybe try to look to some docummentation how to manipulate R objects 
(Paul Johnsons R tips are easily found by Google and they help me a lot 
during my first steps)

BTW split(don[, some.columns], don$Id_Cara) could maybe do what you want 
without using for cycle

Regards

Petr Pikal
[EMAIL PROTECTED]

[EMAIL PROTECTED] napsal dne 24.04.2007 11:48:48:

> I wanna display some data which there are subsets of a dataframe called 
"don" 
> but there are errors like this
> 
> > L=as.numeric(levels(factor(don$Id_Cara)))
> > for(i in L){
> + donC(i)=subset(don, Id_Cara == i, select = c( Id_TrT1, Id_Geno, 
Id_Rep, Val_O))
> + donC(i)
> + }
> Erreur dans donC(i) = subset(don, Id_Cara == i, select = c(Id_TrT1, 
Id_Geno,  : 
> impossible de trouver la fonction "donC<-"
> 
> I understand that the problem comes from the third line 
> 
> it doesn't reconize "donC(i)" but  it's very important to make one 
"boucle" 
> (in french) on the L's elements.
> 
> to tell more about L :
> 
> > L
> [1] 103 137 138 177 193 308
> 
> 
> 
> 
___
> 
> 
> 
> 
> 
>[[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] (no subject)

2007-04-24 Thread elyakhlifi mustapha
I wanna display some data which there are subsets of a dataframe called "don" 
but there are errors like this

> L=as.numeric(levels(factor(don$Id_Cara)))
> for(i in L){
+ donC(i)=subset(don, Id_Cara == i, select = c( Id_TrT1, Id_Geno, Id_Rep, 
Val_O))
+ donC(i)
+ }
Erreur dans donC(i) = subset(don, Id_Cara == i, select = c(Id_TrT1, Id_Geno,  : 
impossible de trouver la fonction "donC<-"

I understand that the problem comes from the third line 

it doesn't reconize "donC(i)" but  it's very important to make one "boucle" (in 
french) on the L's elements.

to tell more about L :

> L
[1] 103 137 138 177 193 308


  
___





[[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] statistical modelling skill

2007-04-24 Thread justin bem
Dears helpers,

I have a question not specially about R, but about statistical modelling. This 
is the problem, I want to conduct a regression analysis to explain the causes 
of students fail in an exam. I have two variables the score obtain at the exam 
and the categorical variable coding 0 in case of fail and 1 in case of success, 
on a panel data. I am interest to know what made a student who usually succeed 
start to fail. So I have two possibilty : linear regression analysis with the 
score or a probit model with the fail indicator. 

In my view, the result will be similary. but is there any difference? what the 
advantage off choosing one the two approaches ? 

Sincerly

 
Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.


  
___





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


  1   2   >