Re: [R] R Error

2008-11-21 Thread Peter Dalgaard

Rolf Turner wrote:


On 21/11/2008, at 10:13 AM, Steffy, Elizabeth A. wrote:

I got this error for this equation and i'm not sure what it means or 
how to fix it:


Error in S[index] = S[index - 1] + (dSi - dSo - SC) * dt :
  nothing to replace with

Does anyone know how to fix this?


No.

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

and provide commented, minimal, self-contained, reproducible code.


Do you see the lines immediately above?

Many people on the R-help list are very clever.  ***None***
of them are telepathic.


No? I think she should ensure that index = 2, and that her R version is 
from before September 2008.


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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] matlab style of storing arrays compared to R

2008-11-21 Thread Rainer M Krug
Hi

I am trying to figure out, if the matlab style of linear indexing of
an array is the same as in R. i.e.

when

x - array( 1:24, dim=c(2,3,4) )
x[3]
 3

and if the same is true in matlab, assuming that
x[n1,n2,n3] in R returns the same as  y(n1,n2,n3) when  y is a matrix in matlab

I found the following reference
http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/matlab_prog/f1-86528.html#f1-86846

And it seems to be the same, but another source says it is different.
Could somebody confirm, if it is the same?

Thanks,

Rainer


-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Faculty of Science
Natural Sciences Building
Private Bag X1
University of Stellenbosch
Matieland 7602
South Africa

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] select specific listcomponents to calculate the means

2008-11-21 Thread Tom Cohen
 
  Dear list, 
  I have following list
  
[[1]]
 Pnr timeCA   CACen
1 62083014541 0.008   TRUE
2 62083014542 0.008   TRUE
3 62083014543 0.008  FALSE
4 62083014544 0.013   TRUE
5 62083014545 0.007  FALSE
  [[2]]
 Pnr timeCA  CACen
1 64031471161 0.020  FALSE
2 64031471162 0.089  FALSE
3 64031471163 0.020  FALSE
4 64031471164 0.025  FALSE
5 64031471165 0.012  FALSE
  [[3]]
 Pnr time   CACACen
1 49051274131 0.008   TRUE
2 49051274132 0.007   TRUE
3 49051274133 0.003   TRUE
4 49051274134 0.006   TRUE
  [[4]]
 Pin timeCA   CACen
1 50092771371 0.008   TRUE
2 50092771372 0.009   TRUE
3 50092771373 0.008  FALSE
4 50092771374 0.009  FALSE
5 50092771375 0.008  FALSE
  
How do I tell R to select the listelements containing both TRUE and FALSE to 
calculate the weighted means and
those with only TRUE or FALSE to calculate the aritmetic means and then put all 
the means together in a dataframe.
The result should look like
   
  Pnr  Mean
6208301454weighted mean
6403147116arith. mean
4905127413arith. mean
5009277137weighted mean
   
  Thanks for any help,
Tom

   
-
Låna pengar utan säkerhet.
Sök och jämför lån hos Kelkoo.
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 Error

2008-11-21 Thread Dieter Menne



 Error in S[index] = S[index - 1] + (dSi - dSo - SC) * dt :
   nothing to replace with


Peter Dalgaard wrote:
 ...that her R version is from before September 2008.

Just curious which item in NEWS this comment refers to. Something changed
in  [] ?

Dieter
-- 
View this message in context: 
http://www.nabble.com/R-Error-tp20613209p20618176.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] generate random number

2008-11-21 Thread Odette Gaston
Hi Dimitris,

Appreciate for your reply with detailed information, many thanks!

I realize that generating random number won't be so simple more than I
expected, but got some hints from the advice. I am actually hoping to do a
parametric bootstrap likelihood test, because this is the way of testing for
glmm result what I understood. Following is what I would like to do:

# settings
n - number of samples
y - c(2 2 1 0 0 2 0 2 1 2 2 1 2 2 2 2 2 2 2 2 2 2 2 0 2 0 2 2)
x - c(22 22 24 21 26 18 23 21 17 15 22 24 21 17 26 15 16 13 22 15 15 23 16
23 18 37 22 30) #dependent=y
#independent=x

 Then, I would like to generate random number on glmm = random.y - rbinom
(num,n,p) to do this test. However, this only hypothesized binomial
distribution, not include normal one. In this case, how would you be able to
do? Apologize if I didn't understand correctly what you wrote and make
confuse you. Greatly appreciated if you help me. Any advice would be
wonderful!

Best reagards,
Odette


On Thu, Nov 20, 2008 at 8:24 PM, Dimitris Rizopoulos 
[EMAIL PROTECTED] wrote:

 check the following code:

 # settings
 n - 100 # number of sample units
 p - 10 # number of repeated measurements
 N - n * p # total number of measurements
 t.max - 3

 # parameter values
 betas - c(0.5, 0.4, -0.5, -0.8) # fixed effects (check also 'X' below)
 sigma.b - 2 # random effects variance

 # id, treatment  time
 id - rep(1:n, each = p)
 treat - rep(0:1, each = n/2)
 time - seq(0, t.max, length.out = p)

 # simulate random effects
 b - rnorm(n, sd = sigma.b)

 # simulate longitudinal process conditionally on random effects
 time.rep - rep(time, n)
 treat.rep - rep(treat, each = p)
 X - cbind(1, treat.rep,
time.rep, treat.rep * time.rep) # fixed effects design matrix
 muY - plogis(c(X %*% betas) + b[id]) # conditional probabilities
 y - rbinom(N, 1, muY) # simulate binary responses

 # put the simulated data in a data.frame
 simulData - data.frame(
id = id,
y = y,
treat = treat.rep,
time = time.rep
 )

 # fit the model
 library(glmmML)
 fit - glmmML(y ~ treat * time, data = simulData, cluster = id)
 summary(fit)


 I hope it helps.

 Best,
 Dimitris


 Odette Gaston wrote:

  Hi everybody,

 I am currently working on glmmML() and wish to generate random number to
 do
 some tests, however, glmm was hypothesized the mixed distributions with
 normal  and binomial in terms of having a random effect. How would you be
 able to generate random number in this case? Is there a function in R to
 generate random number of  mixed distribution (normal+binomial)? Any
 comments would be appreciated.

 Many thanks,
 Odette

[[alternative HTML version deleted]]

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


 --
 Dimitris Rizopoulos
 Assistant Professor
 Department of Biostatistics
 Erasmus Medical Center

 Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
 Tel: +31/(0)10/7043478
 Fax: +31/(0)10/7043014



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] ggplot2 - Problem with geom_abline()

2008-11-21 Thread David Hajage
Hello,

Sorry to ask again something with ggplot2...

I detect something, perhaps a bug (but more probably a syntax error, I'm
learning...) :

# This is working : x = wt, y = mpg, abline with intercept = 20 and slope =
1
qplot(wt, mpg, data = mtcars) + geom_abline(intercept = 20, slope = 1)
# This is not working : x = mpg, y = wt, abline with intercept = 3 and slope
= 1
qplot(mpg, wt, data = mtcars) + geom_abline(intercept = 3, slope = 1)

There is only points, no line, on the second graph.

(R 2.8.0, ggplot2 0.7, windows 2000)

Many thanks.

david

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] summary statistics into table/data base, many factors to analyse

2008-11-21 Thread Gerit Offermann
Dear list,

thanks to your help I managed to find means of analysing my data.

However, the whole data set contains 264 variables. Of which some are
factors, others are not. The factors tend to be grouped, e.g. 
data$f1304 to data$f1484 and data$f3204 to data$5408. 

But there are other types of variables in the data set as well, 
e.g. data$f1504. 

Not every spot is taken, i.e data$f1345 to data$1399 might not exist
in the data set. 

The solution summaryBy works for cross analysis, of which there is
a handful. So I am not worried here.

The solution from Jorge is fine. 
However, I am trying to get my head around how to efficiently
reduce my data set to the dependet variable and the factors such that
the solution is applicable.

Having to type each variable into
my.reduced.data - cbind(my.data$f1001, my.data$1002, my.data$1003...
is an obvious option, but does not seem to be the most efficient one.

Are there better ways to go about?

Thanks,
Gerit
-- 
Sensationsangebot nur bis 30.11: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 Error

2008-11-21 Thread Peter Dalgaard
Dieter Menne wrote:
 
 
 Error in S[index] = S[index - 1] + (dSi - dSo - SC) * dt :
   nothing to replace with

 
 Peter Dalgaard wrote:
 ...that her R version is from before September 2008.
 
 Just curious which item in NEWS this comment refers to. Something changed
 in  [] ?

No, it was just the error message, which now says that the replacement
has length zero. We don't usually make a NEWS entry for changes to docs
and messages. (Actually, September is not quite right. I was looking at
one of the translation files. The actual message was changed on August
28...)

 
 Dieter


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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 course in Scotland

2008-11-21 Thread Heather Turner
Hello Peter,

If you want to use R for bioinformatics, you probably want a course
using Bioconductor (www.bioconductor.org). To combine with a
introduction to R, the following should be good:

http://www3.imperial.ac.uk/stathelp/courses/statisticalmicroarrayanalysisusingr

but some time to wait till the next course. The following may provide a
good alternative:

http://www.ebi.ac.uk/training/handson/course_090119_transcriptomics.html

Otherwise there are lots of materials from previous courses on

http://www.bioconductor.org/workshops

which you can use for self-teaching.

Hope that helps,

Heather

-- 
Dr H Turner
Senior Research Fellow
Dept. of Statistics
The University of Warwick
Coventry
CV4 7AL

Tel: 024 76575870
Fax: 024 76524532
Url: www.warwick.ac.uk/go/heatherturner


Gustavo Carvalho wrote:
 Hello,
 
 Take a look at this course:
 
 http://www.r4all.group.shef.ac.uk/index.html
 
 I don't think they teach tools for working with the genome, but it
 might be helpful anyway.
 
 On Thu, Nov 20, 2008 at 11:16 AM, Peter Saffrey [EMAIL PROTECTED] wrote:
 (apologies if this is the wrong list)

 I'm a bioinformatician looking for a course in using R, in particular the
 tools for working with the genome - I've heard they're lightning fast. I'm
 in Glasgow, but I've tried the Robertson centre for biostatistics and they
 use minitab.

 If anybody knows of a course, I would be grateful. Glasgow or Edinburgh
 would be preferable, but anywhere in the UK will do if it's a good course.

 Thanks,

 Peter

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 trous wavelet transform in R ?

2008-11-21 Thread mauede
There may be some chance that a proper wavelet transform may help me with 
signal features extraction.
I know R contains a number of packages implementing wavelett filters and/or 
transforms.
Is there an implementation of a trous wavelet transform ?

Thank you so much,
Maura

Alice Messenger ;-) chatti anche con gli amici di Windows Live Messenger e 
tutti i telefonini TIM!
Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer

[[alternative HTML version deleted]]

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


[R] Simulation Result display form

2008-11-21 Thread Abelian
after obtaining the result, the result is displayed below:

 individual  RS_number Phy_Posi LOH_intensity
1  1718890  rs1496555 2.2241110.8121
2  1668776  rs2376495 3.0849860.786  ---
3  1723597  rs4648462 3.1551270.784  ---
4  1728870 rs10492940 3.1876070.7831
5  1669946 rs10492939 3.2927310.7801
6  1708099 rs10492938 3.2941960.78   ---
7  1716798 rs10492937 3.3291990.7791
8  1701872  rs1128474 3.5354720.7733
9  1697748  rs2154068 3.7108250.7685
10-1699138  rs2887274 3.7111780.7685

my problem is  in the result of LOH_intesity.
i hope that 0.786 can be showed 0.7860, 0.78 can be 0.7800.
so, how can I manage my result to be those?
Thanks a lot...

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] timezone attribute lost during operations

2008-11-21 Thread Thomas Mang

Hi,

I was just *highly* surprised to find out that R 2.8.0 (Windows XP) 
changes the timezone-interpretation during operations on time data, as 
apparently the timezone attribute is lost and then, for the next 
interpretation of the timezone, the system settings are used.


Here is sample code (executed under a platform with the system timezone 
managed by Windows set to CET, but note that as the input data is GMT 
I also want all the calculations to occur in GMT):


# input data
Time = as.POSIXct(strptime(c(2007-12-12 14:30:15, 2008-04-14 
15:31:34, 2008-04-14 15:31:34), format = %Y-%m-%d %H:%M:%S, tz = 
GMT))

Time  # OK, time zone is GMT
attr(Time, tzone)  # OK, time zone is GMT



TApply = tapply(1:3, Time, max)
names(TApply) # wrong, names are converted to time zone of system

UTime = unique(Time)
UTime  # wrong, again time zone of system is used
attr(UTime, tzone)  # == NULL


Now the issue is not that I wouldn't know how to solve the problem (by 
setting TZ to GMT prior to executing the calculations), but I wonder 
why is R doing this mess at all? Why is it not able to maintain the 
timezone-information stored in my original vector Time ?

Is this behavior supposed to be a feature, or is it a plain bug ?

Thanks,
Thomas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Extracting diagonal matrix

2008-11-21 Thread A Ezhil
Dear All,

I have a correlation matrix of size 100 x 100 and would like to extract the 
diagonal matrix from it. I have used the for loop to store tha correlation 
values of the diagonal matrix. Is there a 'R way' of doing this?

Thanks in advance.

Kind regards,
Ezhil

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Extracting diagonal matrix

2008-11-21 Thread Rory.WINSTON
Try

?diag


Rory Winston
RBS Global Banking  Markets
Office: +44 20 7085 4476

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of A Ezhil
Sent: 21 November 2008 12:28
To: r-help@r-project.org
Subject: [R] Extracting diagonal matrix

Dear All,

I have a correlation matrix of size 100 x 100 and would like to extract the 
diagonal matrix from it. I have used the for loop to store tha correlation 
values of the diagonal matrix. Is there a 'R way' of doing this?

Thanks in advance.

Kind regards,
Ezhil

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

***
The Royal Bank of Scotland plc. Registered in Scotland No 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB. 
Authorised and regulated by the Financial Services Authority 

This e-mail message is confidential and for use by the=2...{{dropped:22}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Extracting diagonal matrix

2008-11-21 Thread Peter Dalgaard
[EMAIL PROTECTED] wrote:
 Try
 
 ?diag


Or, if he really means the diagonal of a 100x100 correlation matrix,

rep(1,100)

:-)


 
 Rory Winston
 RBS Global Banking  Markets
 Office: +44 20 7085 4476
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of A Ezhil
 Sent: 21 November 2008 12:28
 To: r-help@r-project.org
 Subject: [R] Extracting diagonal matrix
 
 Dear All,
 
 I have a correlation matrix of size 100 x 100 and would like to extract the 
 diagonal matrix from it. I have used the for loop to store tha correlation 
 values of the diagonal matrix. Is there a 'R way' of doing this?
 
 Thanks in advance.
 
 Kind regards,
 Ezhil


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

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


[R] [R-pkgs] ggplot2 - version 0.8

2008-11-21 Thread hadley wickham
ggplot2 

ggplot2 is a plotting system for R, based on the grammar of graphics,
which tries to take the good parts of base and lattice graphics and
avoid bad parts. It takes care of many of the fiddly details
that make plotting a hassle (like drawing legends) as well as
providing a powerful model of graphics that makes it easy to produce
complex multi-layered graphics.

Find out more at http://had.co.nz/ggplot2, and check out the nearly 500
examples of ggplot in use.  If you're interested, you can also sign up to
the ggplot2 mailing list at http://groups.google.com/group/ggplot2, or track
development at  http://github.com/hadley/ggplot2

ggplot2 0.8  (2008-11-18)


The two biggest new features in this release are the (long awaited)
ability to have scales that vary between facets, and a faceting system
that works like lattice (facet_wrap). From qplot, you can use
facet_wrap by specifying one sided formula (~ colour, as opposed to .
~ color). To see some potential uses for these new features, see the
Positioning chapter of the book or the documentation for facet_wrap
and facet_grid.  Implementing these changes has required a rewrite of
large parts of the coordinate systems code, so if anything seems
strange with non-Cartesian coordinate systems, please get in touch.

I've also made another round of tweaks to make the plots more
aesthetically pleasing.  This includes using a bright blue colour for
geoms used to add statistical summaries to plots (contour, smooth, and
quantiles), and tweaking the default colour scheme for the continuous
colour scale.  Please let me know what you think.  Remember that most
of these options are controllable with the theming system - see the
book chapter Polishing your plots for publication.

Accompanying this new release of the package is an updated and
expanded version of the book.  The content of the book is now largely
complete (~170 pages), and over the coming months I will be working on
make it polished and easy to understand.  See
http://had.co.nz/ggplot2/book.  I love to hear your feedback about the
book, but at this point please don't bother reporting minor typos, I
would much rather hear about what you want to do, but can't figure out
from the book.

Other new features:

* geom_bin2d/stat_bin2d  geom_hex/stat_binhex: for 2d square and
hexagon binning, particularly useful for alleviating overplotting in
scatterplots
* geom_freqpoly: draws frequency polygons (= stat_bin + geom_line)
* scale_position: both discrete and continuous gain a new formatter
argument to control the default formatting of the axis labels.  See
also the handy numeric formatters: dollar, comma and percent
* the xlim and ylim functions now produce discrete scales when
appropriate, and generate a reverse scale if the minimum is greater
than the maximum

Improvements

* coord_map gains experimental axis labels
* facet_grid: new support for varying scales in rows and columns
* facet_wrap: new faceter which wraps a 1d ribbon of panels into 2d,
in a similar way to lattice
* geom_bin: gains a drop argument to control whether or not 0 count
bins should be removed
* geom_path and geom_line gain arrows argument to match geom_segment
* ggsave now checks that you are using it with a ggplot plot
* ggsave now produces postscript files that are suitable for embedding
in another document
* ggsave now recognises the .svg extension and will produce svg files,
if possible
* ggsave: default dpi changed to 300, on the assumption that you are
saving the plot for printing
* qplot: uses facet_wrap if formula looks like ~ a + b (as opposed to a ~ b)

Aesthetic tweaks

* geom_bar, geom_polygon, geom_rect, ...: default fill colour is now
much closer to black to match the defaults in other geoms (point,
line, etc)
* geom_line, geom_path, geom_segment: lines have squared ends
* geom_point, geom_pointrange and geom_boxplot: now use shape = 16
instead of 19.  This shape does not have a border from R 2.8 on, and
so will look better when displayed transparently.
* geom_contour, geom_density2d, geom_quantile and geom_smooth use a
bright blue colour for lines, to make them stand out when used with
black points
* scale_gradient: tweaked default colours to make more aesthetically pleasing
* theme: new theme setting panel.margin (a unit) controls gap between
panels in facetted plots (for both grid and wrap)
* theme_gray: removed black border around strips
* theme_bw: tweaks to make black and white theme look a little nicer

Bug fixes

* coord_cartesian now correctly clips instead of dropping points
outside of its limits
* facet_grid: margins now grouped correctly in default case
(non-aesthetic variables ignored when generating default group value)
* facet_grid: fix long standing bug when combining datasets with
different levels of facetting variable
* geom_smooth calls stat::predict explicitly to avoid conflicts with
packages that override 

Re: [R] Math Expression in 3D Plots

2008-11-21 Thread Duncan Murdoch

Alan Lue wrote:

Is there anyway to label axes in 3D plots with mathematical expressions?

In the code below, I want to replace delta_yrsed with what \Delta
\widehat{yrsed} represents in TeX, but the [xyz]lab parameters of title3d
appear to only accept character strings.
  


Unfortunately, that's right:   rgl doesn't have any support for plotmath 
type text. 

The only way to get what you want would be to produce bitmaps of the 
labels, then place those in the plots as sprites or surface textures.


Duncan Murdoch

require(rgl)

fn.delta.yrsed - function(dist, delta.dist,
   beta.dist=-0.1376463, beta.dist2=0.0088698) {
  delta.yrsed - (beta.dist + 2*beta.dist2*dist)*delta.dist +
beta.dist2*delta.dist^2
  return(delta.yrsed)
}

plot.deeffect - function(scolor=blue) {
  delta.dist - dist - seq(0, 16, .5)
  delta.yrsed - outer(dist, delta.dist, fn.delta.yrsed)

  rgl.open()
  bbox3d(xat=seq(0, 16, 2), yat=0:5, zat=seq(0, 16, 2), color=black)
  title3d(main=Effect of Change in dist on yrsed,
  pos=c(NA, 8, 0), color=black)
  title3d(xlab=dist, pos=c(NA, 0, -3), color=black)
  title3d(ylab=delta_yrsed, pos=c(12, NA, -3), color=black)
  title3d(zlab=delta_dist, pos=c(-3, 0, NA), color=black)
  rgl.bg(color=rep(white, 2))
  rgl.surface(dist, delta.dist, delta.yrsed,
  color=scolor, front=lines, back=lines)
}

Alan

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] summary statistics into table/data base, many factors to analyse

2008-11-21 Thread Petr PIKAL
Hi

[EMAIL PROTECTED] napsal dne 21.11.2008 11:50:52:

 Dear list,
 
 thanks to your help I managed to find means of analysing my data.
 
 However, the whole data set contains 264 variables. Of which some are
 factors, others are not. The factors tend to be grouped, e.g. 
 data$f1304 to data$f1484 and data$f3204 to data$5408. 
 
 But there are other types of variables in the data set as well, 
 e.g. data$f1504. 
 
 Not every spot is taken, i.e data$f1345 to data$1399 might not exist
 in the data set. 
 
 The solution summaryBy works for cross analysis, of which there is
 a handful. So I am not worried here.
 
 The solution from Jorge is fine. 
 However, I am trying to get my head around how to efficiently
 reduce my data set to the dependet variable and the factors such that
 the solution is applicable.
 
 Having to type each variable into
 my.reduced.data - cbind(my.data$f1001, my.data$1002, my.data$1003...
 is an obvious option, but does not seem to be the most efficient one.

Maybe not so obvious. 
How did you get your data into R? By some read.* command? Then it shall be 
data frame with appropriate column type.

see str(mydata)

and you can choose only columns you really want by

mydata[, select.some.columns]

If your data is a list (see Intro manual for data types and its 
properties), then the transformation to data frame depends partly on how 
it looks like and if it has the same number of values.

do.call(cbind, mydata) shall combine all vectors in mydata however it 
will convert them to unique type as cbind produce matrix which has to have 
only one type of data.

If all variables have same length

do.call(data.frame, mydata)

will produce data frame and all variables shall be preserved in their 
respective type.

Regards
Petr


 
 Are there better ways to go about?
 
 Thanks,
 Gerit
 -- 
 Sensationsangebot nur bis 30.11: GMX FreeDSL - Telefonanschluss + DSL 
 für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] post - plotting lines in a divided graphic device

2008-11-21 Thread Prof Brian Ripley

On Fri, 21 Nov 2008, _ wrote:


Hi all,
I have a graphic device divided in 2 areas for a plot.
Is it possible to add lines or points in the first plot after the last one 
have been set, without plotting all the data again ?


See ?par, look at mfg.  However, you would probably find screen() easier 
to use, and the way you have done this you have lost the coordinate system 
for the first plot and would need plot(1, new=T) to reset it.




Example
par(mfrow(2,1))
plot(1)
plot(2)
lines(c(1,2)) # should be visible in the first plot


That's not a valid R command.


Thanks for help.
Greetings

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 course in Scotland

2008-11-21 Thread Peter Saffrey
Thanks to the many people on the list who provided helpful responses, 
including those who Emailed me directly.


Several people have suggested that I just pick up R and give it a try. 
My reluctance to do this is that I am already very familiar with my 
current working method (Python + Numpy) and I worry that without a 
course I will work in a Python-centric way, which won't be optimal.


I feel it would also be useful to spend some time with an R expert so 
that I can find out what R does well and what it does badly. This way 
I'll when I should use R and when I should use some other method (like 
Python). I may find out that I'm better off with Python for everything I 
do, but I won't be confident in this conclusion unless I talk to 
somebody who really knows what they're doing.


Anyway, I now have a few courses to choose from, so many thanks for the 
suggestions.


Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 every element of a variable into a separate text-file

2008-11-21 Thread zuber
Hello,

what I want to do, is, to write every element of a variable into a
separate text-file automatically:


My Variable:

 wull
[1] Hallo Leute, wie gehts denn euch seid ihr noch alle...
[2] Is their anyone how can help me with...   
[3] mann, mann, mann... das nervt aber..  
[4] how are you littele strange tiger...  
[5] )()()(UJKJKJIJIJJOO9989   
[6] bradortslow, eiwudoiude, kdkdkdk:::idjidji 

I was trying to do things like that:

 for (i in seq(along = wull))
+ write(wull[i], (C://Users//zuber//Documents//wull(1).txt),
+ append = F)

But what I get is just the last element [6] (bradortslow, eiwudoiude,
kdkdkdk:::idjidji) of my variable in just one text-file.

 - I do not know, how to say to R, that it should write:  

[1] Hallo Leute, wie gehts denn euch seid ihr noch alle... in
wull(1).txt 

[2] Is their anyone how can help me with... in wull(2).txt

[3] mann, mann, mann... das nervt aber.. in wull(3).txt 

... an so on till the last element.


I hope this is possible and someone can help me.


Martin

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Extracting diagonal matrix

2008-11-21 Thread A Ezhil
Thanks. I would like to extract all the matrix entries below or above the 
diagnol. diag(x) simply gives diagonal elements.

Thanks.

Kind regards,
Ezhil

--- On Fri, 11/21/08, Peter Dalgaard [EMAIL PROTECTED] wrote:

 From: Peter Dalgaard [EMAIL PROTECTED]
 Subject: Re: [R] Extracting diagonal matrix
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED], r-help@r-project.org
 Date: Friday, November 21, 2008, 6:23 PM
 [EMAIL PROTECTED] wrote:
  Try
  
  ?diag
 
 
 Or, if he really means the diagonal of a 100x100
 correlation matrix,
 
 rep(1,100)
 
 :-)
 
 
  
  Rory Winston
  RBS Global Banking  Markets
  Office: +44 20 7085 4476
  
  -Original Message-
  From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of A Ezhil
  Sent: 21 November 2008 12:28
  To: r-help@r-project.org
  Subject: [R] Extracting diagonal matrix
  
  Dear All,
  
  I have a correlation matrix of size 100 x 100 and
 would like to extract the diagonal matrix from it. I have
 used the for loop to store tha correlation values of the
 diagonal matrix. Is there a 'R way' of doing this?
  
  Thanks in advance.
  
  Kind regards,
  Ezhil
 
 
 -- 
O__   Peter Dalgaard Øster Farimagsgade
 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics PO Box 2099,
 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark 
 Ph:  (+45) 35327918
 ~~ - ([EMAIL PROTECTED])  FAX:
 (+45) 35327907




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] post - plotting lines in a divided graphic device

2008-11-21 Thread _

Hi all,
I have a graphic device divided in 2 areas for a plot.
Is it possible to add lines or points in the first plot after the last 
one  have been set, without plotting all the data again ?


Example
par(mfrow(2,1))
plot(1)
plot(2)
lines(c(1,2)) # should be visible in the first plot

Thanks for help.
Greetings

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Extracting diagonal matrix

2008-11-21 Thread Henrique Dallazuanna
See ?upper.tri and ?lower.tri.

On Fri, Nov 21, 2008 at 1:05 PM, A Ezhil [EMAIL PROTECTED] wrote:

 Thanks. I would like to extract all the matrix entries below or above the
 diagnol. diag(x) simply gives diagonal elements.

 Thanks.

 Kind regards,
 Ezhil

 --- On Fri, 11/21/08, Peter Dalgaard [EMAIL PROTECTED] wrote:

  From: Peter Dalgaard [EMAIL PROTECTED]
  Subject: Re: [R] Extracting diagonal matrix
  To: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED], r-help@r-project.org
  Date: Friday, November 21, 2008, 6:23 PM
  [EMAIL PROTECTED] wrote:
   Try
  
   ?diag
 
 
  Or, if he really means the diagonal of a 100x100
  correlation matrix,
 
  rep(1,100)
 
  :-)
 
 
  
   Rory Winston
   RBS Global Banking  Markets
   Office: +44 20 7085 4476
  
   -Original Message-
   From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf Of A Ezhil
   Sent: 21 November 2008 12:28
   To: r-help@r-project.org
   Subject: [R] Extracting diagonal matrix
  
   Dear All,
  
   I have a correlation matrix of size 100 x 100 and
  would like to extract the diagonal matrix from it. I have
  used the for loop to store tha correlation values of the
  diagonal matrix. Is there a 'R way' of doing this?
  
   Thanks in advance.
  
   Kind regards,
   Ezhil
 
 
  --
 O__   Peter Dalgaard Øster Farimagsgade
  5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099,
  1014 Cph. K
   (*) \(*) -- University of Copenhagen   Denmark
  Ph:  (+45) 35327918
  ~~ - ([EMAIL PROTECTED])  FAX:
  (+45) 35327907




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




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

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 every element of a variable into a separate text-file

2008-11-21 Thread Sarah Goslee
Well, you could read the R Data Import/Export manual.
Or you could reread the help for write and figure out what
the append argument does.
Or you could reread the help for write and notice that it
should write out your entire variable without requiring a loop.

Sarah

On Fri, Nov 21, 2008 at 8:39 AM,  [EMAIL PROTECTED] wrote:
 Hello,

 what I want to do, is, to write every element of a variable into a
 separate text-file automatically:



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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Extracting diagonal matrix

2008-11-21 Thread Stavros Macrakis
You can also do it from first principles:

outer(1:100,1:100,``) * m

which generalizes nicely to , =, =, !=, etc.

   -s

On 11/21/08, Henrique Dallazuanna [EMAIL PROTECTED] wrote:
 See ?upper.tri and ?lower.tri.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 course in Scotland

2008-11-21 Thread Richard Cotton


pzs wrote:
 
 Several people have suggested that I just pick up R and give it a try. 
 My reluctance to do this is that I am already very familiar with my 
 current working method (Python + Numpy) and I worry that without a 
 course I will work in a Python-centric way, which won't be optimal.
 

I know this isn't what you asked, but as a sidenote, if you are used to
working with Python and Numpy, then have you considered Sage (
http://sagemath.org/ http://sagemath.org/ )?  It's a Python environment that
you can run R commands from (amongst other things).  That way you can keep
your current working style but let R do the hard stats for you.

-
Regards,
Richie.

Mathematical Sciences Unit
HSL
-- 
View this message in context: 
http://www.nabble.com/R-course-in-Scotland-tp20601268p20623414.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 every element of a variable into a separate text-file

2008-11-21 Thread Jagat.K.Sheth
Your code isn't changing the filename

Try this

for(i in seq_along(wull)) write(wull[i],
paste(C://Users//zuber//Documents//wull(,i,),.txt,sep=)) 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of [EMAIL PROTECTED]
Sent: Friday, November 21, 2008 7:39 AM
To: r-help@r-project.org
Subject: [R] write every element of a variable into a separate text-file

Hello,

what I want to do, is, to write every element of a variable into a
separate text-file automatically:


My Variable:

 wull
[1] Hallo Leute, wie gehts denn euch seid ihr noch alle...
[2] Is their anyone how can help me with...   
[3] mann, mann, mann... das nervt aber..  
[4] how are you littele strange tiger...  
[5] )()()(UJKJKJIJIJJOO9989   
[6] bradortslow, eiwudoiude, kdkdkdk:::idjidji 

I was trying to do things like that:

 for (i in seq(along = wull))
+ write(wull[i], (C://Users//zuber//Documents//wull(1).txt),
+ append = F)

But what I get is just the last element [6] (bradortslow, eiwudoiude,
kdkdkdk:::idjidji) of my variable in just one text-file.

 - I do not know, how to say to R, that it should write:  

[1] Hallo Leute, wie gehts denn euch seid ihr noch alle... in
wull(1).txt 

[2] Is their anyone how can help me with... in wull(2).txt

[3] mann, mann, mann... das nervt aber.. in wull(3).txt 

... an so on till the last element.


I hope this is possible and someone can help me.


Martin

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Extracting diagonal matrix

2008-11-21 Thread Anup Menon
Hi Ezhil,

Maybe this will help. There might be an easier way to do this but here is
one solution.

tril - function(A)
{
 A - as.matrix(A)
 cmats - matrix(rep(1,length(A)),dim(A)[1],dim(A)[2])
 upper.tri(cmats,diag=T)
 cmats[upper.tri(cmats)] - 0
 out - A*cmats
 return(out)
}

tril(correlation.matrix)

will give you the output.

HTH

Best Regards

Anup

On Fri, Nov 21, 2008 at 7:28 AM, A Ezhil [EMAIL PROTECTED] wrote:

 Dear All,

 I have a correlation matrix of size 100 x 100 and would like to extract the
 diagonal matrix from it. I have used the for loop to store tha correlation
 values of the diagonal matrix. Is there a 'R way' of doing this?

 Thanks in advance.

 Kind regards,
 Ezhil

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Dataframe with single level column

2008-11-21 Thread Blanchette, Marco
Dear all,

I have a dataframe with multiple observations and the levels as the last 
column, as in:
d - 
data.frame(A=sample(1:100,12),B=sample(1:100,12),levels=c(rep('A',4),rep('B',4),rep('C',4)))
 d
A  B levels
1  77 40  A
2  14 18  A
3  56  7  A
4  46 27  A
5  63 35  B
6  80 21  B
7   3 54  B
8  93 76  B
9   5 46  C
10 16 53  C
11 40 17  C
12 25 31  C

I need to run anova analyis on the group in levels against the merge data in 
the first two columns. I can manually split and join the different columns as in

 d.t - 
 rbind(data.frame(value=d[,1],ind=d[,3]),data.frame(value=d[,2],ind=d[,3]))

but I was wondering if there would be a more elegant and easy way than that 
that would prevent me from hard coding the different vectors making the data 
frame.

Thanks

--
Marco Blanchette, Ph.D.
Assistant Investigator
Stowers Institute for Medical Research
1000 East 50th St.

Kansas City, MO 64110

Tel: 816-926-4071
Cell: 816-726-8419
Fax: 816-926-2018

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Breakdown of Vector

2008-11-21 Thread Rajasekaramya

Hi,

I have a vector of Size 7420. I wanna break down in such a way that every 20
elements of it should be as elements of an list.

Ex
EXAM1
ABC, SDF, LMN,ERF,EGC,EFG,WER,FRE,QWE,ERT,DGW,QWE,YUR,ERT,GHJ,FHH,7420

what i want is 
Breakdown.list
[[1]]
ABC,SDF,.20
[[2]]
21.40
[[3]]
4150

i thought of using a for loop but i am wondering how to incerment
test.breakdown.list-list()
for( i =0;i=length(EXAM1);i+20)
{
test.breakdown.list-Exam1[c(i:i+20)]
print (paste(i))
}

Ias this how we do...please correct me if am wrong.

Regards
Ramya


-- 
View this message in context: 
http://www.nabble.com/Breakdown-of-Vector-tp20623764p20623764.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] glmer for cauchit link function

2008-11-21 Thread Douglas Bates
On Thu, Nov 20, 2008 at 5:38 PM, Lizz Metcalfe
[EMAIL PROTECTED] wrote:

 I am trying to fit a generalized linear mixed effects model with a binomial
 link function, my response data is binary, using the lme4 R package, for the
 glmer model but with the cauchit link function (CDF of Cauchy distribution),
 under the package this has not yet been coded and was wondering if anyone
 knew a way in which I could incorporate this link function into the code.

The current version of lme4 uses C code for the inverse link function
so you would need to modify the function lme4_muEta in the file
lme4/src/lmer.c If you look at the other inverse link functions
defined in that C function you will see that it is not a matter of
simply writing down the inverse link.  You need to be very careful of
the edge conditions and most of the code is devoted to those kinds of
checks.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Dataframe with single level column

2008-11-21 Thread Stefan Große
 I need to run anova analyis on the group in levels against the merge data
 in the first two columns. I can manually split and join the different
 columns as in
 
  d.t -
 rbind(data.frame(value=d[,1],ind=d[,3]),data.frame(value=d[,2],ind=d[,3]))
 
 but I was wondering if there would be a more elegant and easy way than
 that that would prevent me from hard coding the different vectors making the
 data frame.

?reshape

hth Stefan
-- 
Sensationsangebot nur bis 30.11: GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 Euro/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] matlab style of storing arrays compared to R

2008-11-21 Thread Douglas Bates
R uses column-major ordering of multidimensional arrays, as in
Fortran, unlike the row-major ordering of C multidimensional arrays.
This is because the numerical linear algebra code used in R is from
the Eispack, Linpack, BLAS, Lapack family of Fortran subroutine
packages.  Even when implementation languages other than Fortran are
used, the Fortran storage conventions prevail because they affect the
design of algorithms.

Matlab is based on the same code (Matlab began as an interactive
wrapper around Eispack and Linpack) and uses the same representation
of arrays.

On Fri, Nov 21, 2008 at 2:41 AM, Rainer M Krug [EMAIL PROTECTED] wrote:
 Hi

 I am trying to figure out, if the matlab style of linear indexing of
 an array is the same as in R. i.e.

 when

 x - array( 1:24, dim=c(2,3,4) )
 x[3]
 3

 and if the same is true in matlab, assuming that
 x[n1,n2,n3] in R returns the same as  y(n1,n2,n3) when  y is a matrix in 
 matlab

 I found the following reference
 http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/matlab_prog/f1-86528.html#f1-86846

 And it seems to be the same, but another source says it is different.
 Could somebody confirm, if it is the same?

 Thanks,

 Rainer


 --
 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
 Biology, UCT), Dipl. Phys. (Germany)

 Centre of Excellence for Invasion Biology
 Faculty of Science
 Natural Sciences Building
 Private Bag X1
 University of Stellenbosch
 Matieland 7602
 South Africa

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] syntax and package for generalized linear mixed models

2008-11-21 Thread Douglas Bates
On Thu, Nov 20, 2008 at 2:54 PM, Jeff Evans [EMAIL PROTECTED] wrote:

 I am making the switch to R and uncertain which of the several packages for
 mixed models is appropriate for my analysis. I am waiting for Pinheiro and
 Bates' book to arrive via inter-library loan, but it will be a week or more
 before it arrives.

 I am trying to fit a generalized linear mixed model of survival data
 (successes/trials) as a function of several categorical fixed and nested
 random effects and a covariate. Additionally, the residual variance in the
 data is a negative function of the covariate, which I would like to model as
 well. Working in SAS, I was able to do this on transformed data in PROC
 MIXED, but ran into trouble trying to run it as a logistic regression in the
 original scale in GLIMMIX.

 Can glmer in lme4 do this? It seems that weights in lme4 refers to
 weighting of observations rather than modeling the variance-covariate, as it
 does in nlme. I tried running nlme, but I'm stuck on syntax, particularly
 with regards to how the fixed and random statements should be constructed
 separate from the model statement (not sure how this is supposed to work).
 Generally, I believe my model in lme4 should look like this:

 gm1 = glmer(cbind(#successes,#trials) ~ A*B + covariate + (1|B/C),
 family = binomial, link=logit, data=mydata,
 weights=varExp(form = ~covariate))

I'm sorry to say that this is not a valid model specification for
glmer.  As you have surmised, lme4 does not allow a general weights
specification like this.

Failure to accept a specification like this is not just an oversight
or an unimplemented feature.  This isn't a valid model specification
because this isn't a valid model. If the conditional distribution of
the response, given the value of the random effects, is Bernoulli (or
Poisson) then it is completely specified by the conditional mean.  You
can't separately specify the mean and the variance for a Bernoulli or
a Poisson distribution as you can for a Gaussian distribution.

As tempting as it may be to want to have several dials and knobs on
statistical models to tune their behavior we still need to be careful
to specify a mathematical model that is consistent.




 where #trials is the number of subjects at the beginning of the experiment
 in each experimental unit, #successes is the number of survivors, A and B
 are fully crossed fixed categorical factors, C is a categorical random
 factor nested within B (i.e. random site within year), and covariate is a
 continuous numerical variable ranging from 1- +inf.



 Can someone please suggest (a) which package to use for this analysis and
 (b) perhaps share some dummy code using my mock variables above?



 Many thanks,



 Jeff Evans



 PhD Candidate

 Department of Entomology

 EEBB Graduate Program

 Michigan State University




[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Breakdown of Vector

2008-11-21 Thread Jagat.K.Sheth
No need to use a for loop. Try something like this 

dim(EXAM1) - c(20,7420/20)
test.breakdown.list - as.list(data.frame(EXAM1)) 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Rajasekaramya
Sent: Friday, November 21, 2008 9:48 AM
To: r-help@r-project.org
Subject: [R] Breakdown of Vector


Hi,

I have a vector of Size 7420. I wanna break down in such a way that
every 20 elements of it should be as elements of an list.

Ex
EXAM1
ABC, SDF,
LMN,ERF,EGC,EFG,WER,FRE,QWE,ERT,DGW,QWE,YUR,ERT,GHJ,FHH,7420

what i want is
Breakdown.list
[[1]]
ABC,SDF,.20
[[2]]
21.40
[[3]]
4150

i thought of using a for loop but i am wondering how to incerment
test.breakdown.list-list()
for( i =0;i=length(EXAM1);i+20)
{
test.breakdown.list-Exam1[c(i:i+20)]
print (paste(i))
}

Ias this how we do...please correct me if am wrong.

Regards
Ramya


--
View this message in context:
http://www.nabble.com/Breakdown-of-Vector-tp20623764p20623764.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Breakdown of Vector

2008-11-21 Thread Giovanni Petris

Also something along the following lines:

 x - 1:100
 y - split(x, (seq(along = x) - 1) %/% 5)

HTH,
Giovanni Petris

 Date: Fri, 21 Nov 2008 07:48:09 -0800 (PST)
 From: Rajasekaramya [EMAIL PROTECTED]
 Sender: [EMAIL PROTECTED]
 Precedence: list
 
 
 Hi,
 
 I have a vector of Size 7420. I wanna break down in such a way that every 20
 elements of it should be as elements of an list.
 
 Ex
 EXAM1
 ABC, SDF, LMN,ERF,EGC,EFG,WER,FRE,QWE,ERT,DGW,QWE,YUR,ERT,GHJ,FHH,7420
 
 what i want is 
 Breakdown.list
 [[1]]
 ABC,SDF,.20
 [[2]]
 21.40
 [[3]]
 4150
 
 i thought of using a for loop but i am wondering how to incerment
 test.breakdown.list-list()
 for( i =0;i=length(EXAM1);i+20)
 {
 test.breakdown.list-Exam1[c(i:i+20)]
 print (paste(i))
 }
 
 Ias this how we do...please correct me if am wrong.
 
 Regards
 Ramya
 
 
 -- 
 View this message in context: 
 http://www.nabble.com/Breakdown-of-Vector-tp20623764p20623764.html
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 

Giovanni Petris  [EMAIL PROTECTED]
Associate Professor
Department of Mathematical Sciences
University of Arkansas - Fayetteville, AR 72701
Ph: (479) 575-6324, 575-8630 (fax)
http://definetti.uark.edu/~gpetris/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Breakdown of Vector

2008-11-21 Thread jim holtman
another way:

exam.list - split(EXAM, floor((seq_along(EXAM) - 1) / 20))

On Fri, Nov 21, 2008 at 10:48 AM, Rajasekaramya [EMAIL PROTECTED] wrote:

 Hi,

 I have a vector of Size 7420. I wanna break down in such a way that every 20
 elements of it should be as elements of an list.

 Ex
 EXAM1
 ABC, SDF, LMN,ERF,EGC,EFG,WER,FRE,QWE,ERT,DGW,QWE,YUR,ERT,GHJ,FHH,7420

 what i want is
 Breakdown.list
 [[1]]
 ABC,SDF,.20
 [[2]]
 21.40
 [[3]]
 4150

 i thought of using a for loop but i am wondering how to incerment
 test.breakdown.list-list()
 for( i =0;i=length(EXAM1);i+20)
 {
 test.breakdown.list-Exam1[c(i:i+20)]
 print (paste(i))
 }

 Ias this how we do...please correct me if am wrong.

 Regards
 Ramya


 --
 View this message in context: 
 http://www.nabble.com/Breakdown-of-Vector-tp20623764p20623764.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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 that you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] lsoda warning too much accuracy requested

2008-11-21 Thread Colleen Carlson
Dear list -

 

Does anyone have any ideas / comments about why I am receiving the following
warning when I run lsoda:

 

1:  lsoda--  at t (=r1), too much accuracy requested in: lsoda(start, times,
model, parms) 

2:   for precision of machine..  see tolsf (=r2) in: lsoda(start, times,
model, parms)

 

I have tried changing both rtol and atol but without success.  I saw the
thread in the R-archive of 11 June 2004 but this has not helped me.

 

I have built the model in stages and the problem only occurs when the
exponent beta in the third DE is anything other than 0 or 1.  If beta = 0 or
1 then the solver gives me perfectly justifiable results.  Just changing
beta to 0.9 or similar causes the problem.

 

I am still new to R so I am unsure if it is my programming or my
understanding of the way lsoda works.

 

Any comments or input would be welcome.

Many thanks

Colleen

___

 

My code is:

 

library(odesolve)

SI - 80

model - function(t, x, parms) {

H  - x[1]

BA - x[2]

N  - x[3]

with(as.list(parms), {

dHdt - (b/c)*(((a**c)*((H)**(1-c))-H))

dBAdt - -(BA*b)*(c0+(c1*SI)-log(BA))/(log(1-((H/a)**c)))

dNdt -  N*alpha*(((log(1-((H/a)**c)))/b)**beta) - (gamma*BA)

list(c(dHdt, dBAdt, dNdt))

})

}

times - seq(0, 40, 1)

 

parms - c(a=(SI*1.258621)-1.32759, b=0.1, c=0.4, c0=4.6012, c1=0.013597,
alpha=0.0005, beta=0.5,  gamma=0.01)

start - c(H=0.1, BA=0.1, N=600)

 

out - as.data.frame(lsoda(start, times, model, parms))


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] plots of ACF

2008-11-21 Thread Sara Mouro
Hello.

I have one Model (M3) fitted using the lme package, and I have  
checked the correlation structure of within-group errors using

plot(ACF (M3,maxLag=10),alpha=0.05)

But now I am not sure how to interpret this plot for the empirical  
autocorrelation function.

The problem is that I am used to see/interpret diagrams in which all  
the autocorrelation Lags, except lag-1, are inside the confidence  
envelopes, or those plots where only Lags 1 and 2 are outside those  
envelopes.

But how should I interpret my ACF plot, where Lags 1, 7, 8 and 9, are  
those outside those envelopes?

Is there any correlation structure?
Which one might that be? AR1()?


Also, I have used the plot of the empirical ACF of the normalized  
residuals, but it gives exactly the same results.

Could you please help me?

Best regards
Sara Mouro


Sara Maltez Mouro

Centro de Ecologia Funcional
Departamento de Botânica
Universidade de Coimbra

[EMAIL PROTECTED]
www.uc.pt/ecology/saramaltezmouro


Sara Maltez Mouro

Centro de Ecologia Funcional
Departamento de Botânica
Universidade de Coimbra

[EMAIL PROTECTED]
www.uc.pt/ecology/saramaltezmouro


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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

2008-11-21 Thread Van den Berge Joke



__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] lsoda warning too much accuracy requested

2008-11-21 Thread Thomas Petzoldt

Hi Colleen,

this error was not uncommon and is usually a sign of a numerically 
problematic or wrongly implemented model. Please use package deSolve, 
the successor of odesolve, that is more robust and has also a bunch 
alternative solvers for difficult cases.


I tested your code with deSolve (on R 2.8.0, Windows) and it runs 
without problems.


Thomas Petzoldt


BTW: your system worked also with odesolve, so my question: which 
versions (R, odesolve) and operating system are you using?


Colleen Carlson wrote:

Dear list -

 


Does anyone have any ideas / comments about why I am receiving the following
warning when I run lsoda:

 


1:  lsoda--  at t (=r1), too much accuracy requested in: lsoda(start, times,
model, parms) 


2:   for precision of machine..  see tolsf (=r2) in: lsoda(start, times,
model, parms)

 


I have tried changing both rtol and atol but without success.  I saw the
thread in the R-archive of 11 June 2004 but this has not helped me.

 


I have built the model in stages and the problem only occurs when the
exponent beta in the third DE is anything other than 0 or 1.  If beta = 0 or
1 then the solver gives me perfectly justifiable results.  Just changing
beta to 0.9 or similar causes the problem.

 


I am still new to R so I am unsure if it is my programming or my
understanding of the way lsoda works.

 


Any comments or input would be welcome.

Many thanks

Colleen

___

 


My code is:

 


library(odesolve)

SI - 80

model - function(t, x, parms) {

H  - x[1]

BA - x[2]

N  - x[3]

with(as.list(parms), {

dHdt - (b/c)*(((a**c)*((H)**(1-c))-H))

dBAdt - -(BA*b)*(c0+(c1*SI)-log(BA))/(log(1-((H/a)**c)))

dNdt -  N*alpha*(((log(1-((H/a)**c)))/b)**beta) - (gamma*BA)

list(c(dHdt, dBAdt, dNdt))

})

}

times - seq(0, 40, 1)

 


parms - c(a=(SI*1.258621)-1.32759, b=0.1, c=0.4, c0=4.6012, c1=0.013597,
alpha=0.0005, beta=0.5,  gamma=0.01)

start - c(H=0.1, BA=0.1, N=600)

 


out - as.data.frame(lsoda(start, times, model, parms))


[[alternative HTML version deleted]]

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



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

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


Re: [R] Simulation Result display form

2008-11-21 Thread jim holtman
Use something like sprintf if you want trailing zeros.

 x
[1] 0.78
 sprintf(%.4f, x)
[1] 0.7800




On Fri, Nov 21, 2008 at 5:31 AM, Abelian [EMAIL PROTECTED] wrote:
 after obtaining the result, the result is displayed below:

 individual  RS_number Phy_Posi LOH_intensity
 1  1718890  rs1496555 2.2241110.8121
 2  1668776  rs2376495 3.0849860.786  ---
 3  1723597  rs4648462 3.1551270.784  ---
 4  1728870 rs10492940 3.1876070.7831
 5  1669946 rs10492939 3.2927310.7801
 6  1708099 rs10492938 3.2941960.78   ---
 7  1716798 rs10492937 3.3291990.7791
 8  1701872  rs1128474 3.5354720.7733
 9  1697748  rs2154068 3.7108250.7685
 10-1699138  rs2887274 3.7111780.7685

 my problem is  in the result of LOH_intesity.
 i hope that 0.786 can be showed 0.7860, 0.78 can be 0.7800.
 so, how can I manage my result to be those?
 Thanks a lot...

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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 that you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Extracting diagonal matrix

2008-11-21 Thread A Ezhil
Hi,

Thank you very much for the help. c[lower.tri(c,diag=FALSE)] works fine for me. 

Thanks again.

Kind regards,
Ezhil

--- On Fri, 11/21/08, Anup Menon [EMAIL PROTECTED] wrote:

 From: Anup Menon [EMAIL PROTECTED]
 Subject: Re: [R] Extracting diagonal matrix
 To: [EMAIL PROTECTED]
 Cc: r-help@r-project.org
 Date: Friday, November 21, 2008, 9:16 PM
 Hi Ezhil,
 
 Maybe this will help. There might be an easier way to do
 this but here is
 one solution.
 
 tril - function(A)
 {
  A - as.matrix(A)
  cmats - matrix(rep(1,length(A)),dim(A)[1],dim(A)[2])
  upper.tri(cmats,diag=T)
  cmats[upper.tri(cmats)] - 0
  out - A*cmats
  return(out)
 }
 
 tril(correlation.matrix)
 
 will give you the output.
 
 HTH
 
 Best Regards
 
 Anup
 
 On Fri, Nov 21, 2008 at 7:28 AM, A Ezhil
 [EMAIL PROTECTED] wrote:
 
  Dear All,
 
  I have a correlation matrix of size 100 x 100 and
 would like to extract the
  diagonal matrix from it. I have used the for loop to
 store tha correlation
  values of the diagonal matrix. Is there a 'R
 way' of doing this?
 
  Thanks in advance.
 
  Kind regards,
  Ezhil
 
  __
  R-help@r-project.org mailing list
  https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] matlab style of storing arrays compared to R

2008-11-21 Thread Rainer M Krug
On Fri, Nov 21, 2008 at 6:12 PM, Douglas Bates [EMAIL PROTECTED] wrote:
 R uses column-major ordering of multidimensional arrays, as in
 Fortran, unlike the row-major ordering of C multidimensional arrays.
 This is because the numerical linear algebra code used in R is from
 the Eispack, Linpack, BLAS, Lapack family of Fortran subroutine
 packages.  Even when implementation languages other than Fortran are
 used, the Fortran storage conventions prevail because they affect the
 design of algorithms.

 Matlab is based on the same code (Matlab began as an interactive
 wrapper around Eispack and Linpack) and uses the same representation
 of arrays.

Thanks a lot for your detailed explanation. This will make my life much easier.

Rainer


 On Fri, Nov 21, 2008 at 2:41 AM, Rainer M Krug [EMAIL PROTECTED] wrote:
 Hi

 I am trying to figure out, if the matlab style of linear indexing of
 an array is the same as in R. i.e.

 when

 x - array( 1:24, dim=c(2,3,4) )
 x[3]
 3

 and if the same is true in matlab, assuming that
 x[n1,n2,n3] in R returns the same as  y(n1,n2,n3) when  y is a matrix in 
 matlab

 I found the following reference
 http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/matlab_prog/f1-86528.html#f1-86846

 And it seems to be the same, but another source says it is different.
 Could somebody confirm, if it is the same?

 Thanks,

 Rainer


 --
 Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
 Biology, UCT), Dipl. Phys. (Germany)

 Centre of Excellence for Invasion Biology
 Faculty of Science
 Natural Sciences Building
 Private Bag X1
 University of Stellenbosch
 Matieland 7602
 South Africa

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





-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation
Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Faculty of Science
Natural Sciences Building
Private Bag X1
University of Stellenbosch
Matieland 7602
South Africa

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] capturing stderr/stdout

2008-11-21 Thread Sundar Dorai-Raj

Hi, Prof. Ripley,

Thanks for the reply. Mostly I want to capture output as it is written 
to the stream. For example, I quite often do the following to view the 
progress of a log file from a computationally intensive script.


1. Open a console and type:

Rscript script.R  script.log

which directs both stdout and stderr to script.log

2. Open another console and type:

tail -f script.log

This way I get both the script's log file and its current progress.

I guess my question is: Is there a way to accomplish the tail -f 
command in R?


Thanks,

--sundar

Prof Brian Ripley said the following on 11/20/2008 11:43 PM:
I am not sure what the issue is here. Do you want to capture both stderr 
and stdout (use 21 in the command with an sh-like shell), or is the

problem that you don't get immediate output?

The latter is a Perl issue: you need to circumvent output buffering.
See e.g

http://perl.plover.com/FAQs/Buffering.html

Sundar Dorai-Raj wrote:

Hi,

I have an application in perl that prints some output to either stderr 
or stdout.


Here's an example:

# tmp.pl
print STDERR starting iterator\n;
for(my $i = 0; $i  100; $i++) {
  print $i . \n;
}

# tmp.R
con - pipe(perl tmp.pl)
r - readLines(con, n = -1)
close(con)

However, the second line stalls until the perl for-loop finishes. What 
I would like is to process each line as it comes. E.g. something like:


while(TRUE) {
  r - readLines(con, n = 1) # read one line
  if(r == 1) print(r)
  if(length(r) == 0) break
}

Of course, this won't work since I'm not calling readLines 
appropriately. Answers must work on Windows but may include cygwin 
utilities if necessary. Any advice would be appreciated. Version info 
at the end if it matters.


Thanks, --sundar


  version
   _
platform   i386-pc-mingw32
arch   i386
os mingw32
system i386, mingw32
status
major  2
minor  8.0
year   2008
month  10
day20
svn rev46754
language   R
version.string R version 2.8.0 (2008-10-20)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Basic question on concatenating factors

2008-11-21 Thread udi cohen
Hi all,

I hope it's not too trivial for the list - I'm trying to concatenate
two factor arrays, and obtain the following:

 f1-factor(c(a,a,b))
 f1
[1] a a b
Levels: a b
 f2-factor(c(b,b,a))
 f2
[1] b b a
Levels: a b
 c(f1,f2)
[1] 1 1 2 2 2 1

Instead of getting:

[1] a a b b b a
Levels: a b

a related question is: how do I add a level which does not exists yet
in a factored vector, so I'll be able to add later these values,
without getting:

In `[-.factor`(`*tmp*`, 2, value = c) :
  invalid factor level, NAs generated

Thanks,

EC

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Discrepancy in the regression coefficients for Cox regression - PBC data set

2008-11-21 Thread Ravi Varadhan
Hi,
 
When I run the following Cox proportional hazards model on the Mayo clinic's
PBC data set (given in the survival package), the regression coefficients
do not agree with the results presented in Table 4.6.3 (p. 195) of Fleming 
Harrington's book.
 
library(survival)
 
data(pbc)
 
ans.cox - coxph(Surv(time, status) ~ log(bili) + log(alb) + age +
log(protime) + edema)
 
ans.cox
 
 ans.cox - coxph(Surv(time, status) ~ log(bili) + log(alb) + age +
log(protime) + edema)
 ans.cox
Call:
coxph(formula = Surv(time, status) ~ log(bili) + log(alb) + age + 
log(protime) + edema)
 

coef exp(coef) se(coef) z   p
log(bili) 0.8975 2.453  0.08271 10.85 0.0e+00
log(alb) -2.4524 0.086  0.65707 -3.73 1.9e-04
age   0.0382 1.039  0.00768  4.97 6.5e-07
log(protime)  2.345810.442  0.77425  3.03 2.4e-03
edema 0.6613 1.937  0.20595  3.21 1.3e-03
 
Likelihood ratio test=234  on 5 df, p=0  n= 418 

 
These coefficients, however, are significantly different (i.e. the
differences can't be just attributed to round-off's) from that reported in
Table 4.6.3 (in the Final model column) of Fleming and Harrington (p.
195).  The coefficients reported are: 0.8707, -2.533, 0.0394, 2.380, 0.8592.
Note the big difference for the edema variable.
 
It seems like the data set considered in the book and that available in
survival package are the same (with n=418).
 
I also re-ran the Cox PH model with the 2 data-errors discussed in p.188
of FH, but still I could not match the results in Table 4.6.3.
 
Is it possible that the results could be explained due to difference in
convergence during maximization of partial likelihood?

Can anyone help me figure out why this diescrepancy exists?
 
Thanks very much,
Ravi.

---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 




 

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] plots of ACF

2008-11-21 Thread David Winsemius
There are a variety of reasons that a question might go unanswered for  
over a day on R-help. The question may be so technical or narrow that  
only one or two people may be equipped to answer it. Or it may look  
like homework. Or it may lack sufficient detail one which to base an  
answer. Or it may sound like a request for statistical consultation  
more than a request for help with the correct use of R (which is the  
specified purpose of the list.)


I am not a statistician or an r-expert and my experience with time  
series analysis is over 20 years ago, but my impression is that a  
mixture of some of those latter reasons may have been the reason for  
this identical question being unanswered yesterday. You have not  
specified any detail about the units of the serially correlated  
variable. You have not offered any output text. You have not described  
the research question. And there is no real R content.


I can tell you that that time series analysis is well described in  
Modern Applied Statistics in S which some people use as their  
beginning R text. If time series was not in your intorductory text  
then maybe you should get one that handles it.


As a complete guess I would speculate that seasonality might explain a  
series with significant correlations at lags of 1, 7, 8, and 9 but who  
knows? You have not given your audience much to work with. And you may  
be outside the boundaries of the list's purpose for existence.


http://www.r-project.org/posting-guide.html
http://www.catb.org/~esr/faqs/smart-questions.html

--
Regards;
David Winsemius, MD


On Nov 21, 2008, at 11:45 AM, Sara Mouro wrote:


Hello.

I have one Model (M3) fitted using the lme package, and I have
checked the correlation structure of within-group errors using

plot(ACF (M3,maxLag=10),alpha=0.05)

But now I am not sure how to interpret this plot for the empirical
autocorrelation function.

The problem is that I am used to see/interpret diagrams in which all
the autocorrelation Lags, except lag-1, are inside the confidence
envelopes, or those plots where only Lags 1 and 2 are outside those
envelopes.

But how should I interpret my ACF plot, where Lags 1, 7, 8 and 9, are
those outside those envelopes?

Is there any correlation structure?
Which one might that be? AR1()?


Also, I have used the plot of the empirical ACF of the normalized
residuals, but it gives exactly the same results.

Could you please help me?

Best regards
Sara Mouro


Sara Maltez Mouro

Centro de Ecologia Funcional
Departamento de Botânica
Universidade de Coimbra

[EMAIL PROTECTED]
www.uc.pt/ecology/saramaltezmouro


Sara Maltez Mouro

Centro de Ecologia Funcional
Departamento de Botânica
Universidade de Coimbra

[EMAIL PROTECTED]
www.uc.pt/ecology/saramaltezmouro


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Basic question on concatenating factors

2008-11-21 Thread Alain Guillet
Hi,

I have a solution to concatenate two factors in one but I don't believe 
it is the best one: factor(c(as.character(f1),as.character(f2)))
[1] a a b b b a
Levels: a b


You can always add a level by assigning a new vector at the level vector:
levels(f1) - c(a,b,c)
f1
[1] a a b
Levels: a b c



udi cohen wrote:
 Hi all,

 I hope it's not too trivial for the list - I'm trying to concatenate
 two factor arrays, and obtain the following:

   
 f1-factor(c(a,a,b))
 f1
 
 [1] a a b
 Levels: a b
   
 f2-factor(c(b,b,a))
 f2
 
 [1] b b a
 Levels: a b
   
 c(f1,f2)
 
 [1] 1 1 2 2 2 1

 Instead of getting:

 [1] a a b b b a
 Levels: a b

 a related question is: how do I add a level which does not exists yet
 in a factored vector, so I'll be able to add later these values,
 without getting:

 In `[-.factor`(`*tmp*`, 2, value = c) :
   invalid factor level, NAs generated

 Thanks,

 EC

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

   

-- 
Alain Guillet
Statistician and Computer Scientist

SMCS - Institut de statistique - Université catholique de Louvain
Bureau d.126
Voie du Roman Pays, 20
B-1348 Louvain-la-Neuve
Belgium

tel: +32 10 47 30 50


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Discrepancy in the regression coefficients for Cox regression - PBC data set

2008-11-21 Thread David Winsemius
There is a discussion in Appendix D.3 of Modeling Survival Data by  
Thereau and Grambsch regarding the differences in the datasets  
including the fact that there was significantly more follow-up for  
many patients at the time this dataset was assembled. I do not see a  
material difference in the estimates.


--
David Winsemius, MD
Heritage Labs

On Nov 21, 2008, at 12:16 PM, Ravi Varadhan wrote:


Hi,

When I run the following Cox proportional hazards model on the Mayo  
clinic's
PBC data set (given in the survival package), the regression  
coefficients
do not agree with the results presented in Table 4.6.3 (p. 195) of  
Fleming 

Harrington's book.

library(survival)

data(pbc)

ans.cox - coxph(Surv(time, status) ~ log(bili) + log(alb) + age +
log(protime) + edema)

ans.cox


ans.cox - coxph(Surv(time, status) ~ log(bili) + log(alb) + age +

log(protime) + edema)

ans.cox

Call:
coxph(formula = Surv(time, status) ~ log(bili) + log(alb) + age +
   log(protime) + edema)


   coef exp(coef) se(coef) z   p
log(bili) 0.8975 2.453  0.08271 10.85 0.0e+00
log(alb) -2.4524 0.086  0.65707 -3.73 1.9e-04
age   0.0382 1.039  0.00768  4.97 6.5e-07
log(protime)  2.345810.442  0.77425  3.03 2.4e-03
edema 0.6613 1.937  0.20595  3.21 1.3e-03

Likelihood ratio test=234  on 5 df, p=0  n= 418




These coefficients, however, are significantly different (i.e. the
differences can't be just attributed to round-off's) from that  
reported in
Table 4.6.3 (in the Final model column) of Fleming and Harrington  
(p.
195).  The coefficients reported are: 0.8707, -2.533, 0.0394, 2.380,  
0.8592.

Note the big difference for the edema variable.

It seems like the data set considered in the book and that available  
in

survival package are the same (with n=418).

I also re-ran the Cox PH model with the 2 data-errors discussed in  
p.188

of FH, but still I could not match the results in Table 4.6.3.

Is it possible that the results could be explained due to difference  
in

convergence during maximization of partial likelihood?

Can anyone help me figure out why this diescrepancy exists?

Thanks very much,
Ravi.

---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html








[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] capturing stderr/stdout

2008-11-21 Thread Prof Brian Ripley

Sundar Dorai-Raj wrote:

Hi, Prof. Ripley,

Thanks for the reply. Mostly I want to capture output as it is written 
to the stream. For example, I quite often do the following to view the 
progress of a log file from a computationally intensive script.


1. Open a console and type:

Rscript script.R  script.log

which directs both stdout and stderr to script.log

2. Open another console and type:

tail -f script.log

This way I get both the script's log file and its current progress.


The usual way to so this is via 'tee' .

I guess my question is: Is there a way to accomplish the tail -f 
command in R?


Yes, but why would you want to?  Note that sink() has a 'split' option, 
so you could in principle do all this in your script.R.


Otherwise you can write a simple R loop to do readLines(n=1); 
writeLines() to emulate tail -F.




Thanks,

--sundar

Prof Brian Ripley said the following on 11/20/2008 11:43 PM:
I am not sure what the issue is here. Do you want to capture both 
stderr and stdout (use 21 in the command with an sh-like shell), or 
is the

problem that you don't get immediate output?

The latter is a Perl issue: you need to circumvent output buffering.
See e.g

http://perl.plover.com/FAQs/Buffering.html

Sundar Dorai-Raj wrote:

Hi,

I have an application in perl that prints some output to either 
stderr or stdout.


Here's an example:

# tmp.pl
print STDERR starting iterator\n;
for(my $i = 0; $i  100; $i++) {
  print $i . \n;
}

# tmp.R
con - pipe(perl tmp.pl)
r - readLines(con, n = -1)
close(con)

However, the second line stalls until the perl for-loop finishes. 
What I would like is to process each line as it comes. E.g. something 
like:


while(TRUE) {
  r - readLines(con, n = 1) # read one line
  if(r == 1) print(r)
  if(length(r) == 0) break
}

Of course, this won't work since I'm not calling readLines 
appropriately. Answers must work on Windows but may include cygwin 
utilities if necessary. Any advice would be appreciated. Version info 
at the end if it matters.


Thanks, --sundar


  version
   _
platform   i386-pc-mingw32
arch   i386
os mingw32
system i386, mingw32
status
major  2
minor  8.0
year   2008
month  10
day20
svn rev46754
language   R
version.string R version 2.8.0 (2008-10-20)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Discrepancy in the regression coefficients for Cox regression - PBC data set

2008-11-21 Thread Ravi Varadhan
Hi David,

I did look at Appendix D.3 of TG, but am not sure if the data set analyzed
in FH and that attached with survival are different.  They both have
n=418 (312 from RCT and 106 observational).  

There is a major difference in the coefficient for edema 0.66 vs 0.86.  In
any case, the point is not whether the differences in coefficient affect
interpretation of the model, but to understand why there are differences in
the results.  

Best,
Ravi.



---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html

 





-Original Message-
From: David Winsemius [mailto:[EMAIL PROTECTED] 
Sent: Friday, November 21, 2008 12:34 PM
To: Ravi Varadhan
Cc: r-help@r-project.org
Subject: Re: [R] Discrepancy in the regression coefficients for Cox
regression - PBC data set

There is a discussion in Appendix D.3 of Modeling Survival Data by Thereau
and Grambsch regarding the differences in the datasets including the fact
that there was significantly more follow-up for many patients at the time
this dataset was assembled. I do not see a material difference in the
estimates.

--
David Winsemius, MD
Heritage Labs

On Nov 21, 2008, at 12:16 PM, Ravi Varadhan wrote:

 Hi,

 When I run the following Cox proportional hazards model on the Mayo 
 clinic's PBC data set (given in the survival package), the 
 regression coefficients do not agree with the results presented in 
 Table 4.6.3 (p. 195) of Fleming  Harrington's book.

 library(survival)

 data(pbc)

 ans.cox - coxph(Surv(time, status) ~ log(bili) + log(alb) + age +
 log(protime) + edema)

 ans.cox

 ans.cox - coxph(Surv(time, status) ~ log(bili) + log(alb) + age +
 log(protime) + edema)
 ans.cox
 Call:
 coxph(formula = Surv(time, status) ~ log(bili) + log(alb) + age +
log(protime) + edema)


coef exp(coef) se(coef) z   p
 log(bili) 0.8975 2.453  0.08271 10.85 0.0e+00
 log(alb) -2.4524 0.086  0.65707 -3.73 1.9e-04
 age   0.0382 1.039  0.00768  4.97 6.5e-07
 log(protime)  2.345810.442  0.77425  3.03 2.4e-03
 edema 0.6613 1.937  0.20595  3.21 1.3e-03

 Likelihood ratio test=234  on 5 df, p=0  n= 418


 These coefficients, however, are significantly different (i.e. the 
 differences can't be just attributed to round-off's) from that 
 reported in Table 4.6.3 (in the Final model column) of Fleming and 
 Harrington (p.
 195).  The coefficients reported are: 0.8707, -2.533, 0.0394, 2.380, 
 0.8592.
 Note the big difference for the edema variable.

 It seems like the data set considered in the book and that available 
 in survival package are the same (with n=418).

 I also re-ran the Cox PH model with the 2 data-errors discussed in
 p.188
 of FH, but still I could not match the results in Table 4.6.3.

 Is it possible that the results could be explained due to difference 
 in convergence during maximization of partial likelihood?

 Can anyone help me figure out why this diescrepancy exists?

 Thanks very much,
 Ravi.
 --
 --
 ---

 Ravi Varadhan, Ph.D.

 Assistant Professor, The Center on Aging and Health

 Division of Geriatric Medicine and Gerontology

 Johns Hopkins University

 Ph: (410) 502-2619

 Fax: (410) 614-9625

 Email: [EMAIL PROTECTED]

 Webpage:  
 http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html



 --
 --
 



   [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] question about shapiro.test()

2008-11-21 Thread Eugene A. Semenko
Hi all!
I tried to perform Shapiro-Wilk test for my sample of 243 values.
 Us
  [1] -10.4 -13.1 -12.2  38.1 -18.8 -13.3 -11.7  29.3  49.7   6.8  12.7  16.3
 [13]   5.8  -0.7 -29.4   4.1  38.8  -1.4   8.8  15.6  32.9  -5.3  19.1  35.8
 [25]   4.0  -1.5   0.6  -4.2 -10.0  -4.0   1.1  48.9 -21.0  -5.3   5.8 -10.8
 [37]  21.9   8.2  -3.2  -3.9  -2.3  12.6  -4.7  -8.0  11.8  27.4  -9.5 -20.8
 [49]  -8.1  -5.4   0.7 -13.2  -6.1  -5.7  -9.6   0.3  -2.1 -15.2   1.7 -15.2
 [61]   7.4 -16.0  13.1   8.7  -8.9 -21.2  29.8 -22.6  10.5   7.5   9.9 -13.0
 [73]  -8.3 -22.9  -9.7  -3.7   8.2  -9.0 -21.8  28.5 -10.2   8.8 -10.1  15.3
 [85]   5.5 -35.0 -14.5 -61.2  -8.3 -17.5 -16.3  -8.5   2.0 -17.5 -12.2 -10.8
 [97] -16.7   6.8 -12.4  -1.9 -13.3  -8.2 -22.6  20.7 -12.5 -21.9  -6.0   9.2
[109]  -1.1 -17.5 -13.5   6.1 -18.5  18.1   6.3 -13.1 -16.2 -30.5 -23.4   4.3
[121] -11.2 -18.5 -17.7  26.7   2.2  -9.4   1.8  -7.7  -5.1   6.3   7.1   7.4
[133]  -9.2  24.8  53.5  23.9   0.0 -25.7 -33.3   6.9  -9.7 -22.6  -1.5  18.0
[145] -20.5 -12.9 -14.3   3.9   5.5  -6.3   2.1 -11.2  -4.9   6.1   3.3   7.0
[157]   4.1   0.3  -0.7  -6.4  -5.1 -17.6  -3.3   6.7   1.5  -8.8  31.2 -30.5
[169] -16.3 -23.4 -30.7  -3.2   8.3  18.1 -17.0  12.1   0.6  -1.6  -1.4   6.3
[181]   3.6   5.3   1.6   1.8  23.7 -14.1   1.1  12.4  18.9 -11.5  -1.8 -21.1
[193]   2.4  23.4 -11.4  -5.9  -5.2  16.9 -19.8  19.5  -4.4   0.5  -1.4  -8.1
[205]   5.4  -2.7  -2.3  -2.9   4.4   8.0  -7.8  32.0   5.4   2.7   3.6  14.9
[217]  -7.0   3.6 -12.1   3.8  47.8  -5.8   3.0  12.6  -1.1   2.0   1.5  -0.1
[229]  11.2  -1.4  -3.1  22.0 -14.4 -10.5  -4.1 -37.5 -17.6  -3.3   3.0  -0.6
[241]  33.8   1.6  -3.9
Output is:
 shapiro.test(Us)
Shapiro-Wilk normality test
data:  Us
W = 0.9686, p-value = 3.417e-05

So, if I understand correctly, output inform me that H0 hypotesis of normality 
of my sample shoud be rejected because p-value  0.05 (at 5% level). Is'n 
it? But actually my data distributed very close to the normal distribution. 
Thanks in advance.
Eugene
-- 
---
e-mail: [EMAIL PROTECTED]  Special Astrophysical Observatory RAS,
WWW: http://tiger.sao.ru/   Nizhnij Arkhyz
phone: +7 87878 46 5 77 Karachai-Chercassian Republic,
fax: +7 87878 46 5 27   Russia, 369167

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Equivalent to apply(x[,2:5],1,sum) for dataframe

2008-11-21 Thread Agustin Lobo

What's the most correct way of doing the equivalent to
apply(x[,2:5],1,sum)

if x is dataframe in which the only numeric fields are
in columns 2:5 ?
(using apply returns a character vector)

Thanks

Agus

--
Dr. Agustin Lobo
Institut de Ciencies de la Terra Jaume Almera (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: [EMAIL PROTECTED]
http://www.ija.csic.es/gt/obster

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 data.frame()

2008-11-21 Thread Agustin Lobo

Given
 str(x)
'data.frame':   5284 obs. of  5 variables:
 $ COD  : chr  0800101001 0800101002 0800101003 0800101004 ...
 $ 0-4  : num  79 215 84 58 127 134 15 122 101 99 ...
 $ 5-9  : num  76 180 32 56 81 106 10 112 128 96 ...
 $ 10-14: num  68 145 39 46 78 81 8 92 142 107 ...
 $ 15-19: num  73 170 49 52 103 77 10 116 129 129 ...

I get

 str(data.matrix(x))
 num [1:5284, 1:5] 8e+08 8e+08 8e+08 8e+08 8e+08 ...
 - attr(*, dimnames)=List of 2
  ..$ : chr [1:5284] 3 6 9 12 ...
  ..$ : chr [1:5] COD 0-4 5-9 10-14 ...

Should not data.matrix() return a numeric matrix?

And I'm even more confused by this:
 x2 - censocatT[,2:5]
 str(x2)
'data.frame':   5284 obs. of  4 variables:
 $ 0-4  : num  79 215 84 58 127 134 15 122 101 99 ...
 $ 5-9  : num  76 180 32 56 81 106 10 112 128 96 ...
 $ 10-14: num  68 145 39 46 78 81 8 92 142 107 ...
 $ 15-19: num  73 170 49 52 103 77 10 116 129 129 ...
 str(data.matrix(x2))
 num [1:5284, 1:4] 79 215 84 58 127 134 15 122 101 99 ...
 - attr(*, dimnames)=List of 2
  ..$ : chr [1:5284] 3 6 9 12 ...
  ..$ : chr [1:4] 0-4 5-9 10-14 15-19


Thanks for any clarification

Agus
--
Dr. Agustin Lobo
Institut de Ciencies de la Terra Jaume Almera (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: [EMAIL PROTECTED]
http://www.ija.csic.es/gt/obster

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] list creation interpolation

2008-11-21 Thread H. Paul Benton
Hello all,

 

  I apologize if this is simple or has already been answered somewhere, but
I'm not sure what to search for although I have tried and didn't come up
with anything so.. Here's my question.

  How can I interpolate list names or do I have to do it post list creation.
Since that's not very clear here is some sample code of what I wanted to do:

 

 resultlist-list()

 a-c(Book, video, radio, mp3)

 foo-rnorm(10)

 resultlist$a[1]-foo

Warning message:

In resultlist$a[1] - foo :

  number of items to replace is not a multiple of replacement length

 

 

What I wanted here was a named list so that I would have 4 values the list
would be

resultlist$Book

resultlist$video

resultlist$radio

resultlist$mp3

 

  Any idea on how to do this other than doing it post creation ie

 

resultlist[[1]]-foo

resultlist[[2]]-rnorm(20) etc..

names(resultlist)-a

 

 

 

Cheers,

 

Paul 

 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Ryan's Q Post-Hoc for ANOVA

2008-11-21 Thread Jarrett Byrnes
I realize this is a little late, but I recently ended up rolling my  
own Ryan's Q in R.  If anyone is interested, or wishes to make  
improvements, you can find it here:


http://homes.msi.ucsb.edu/~byrnes/r_files/ryans_q.r

On Oct 25, 2005, at 10:15 AM, Jarrett Byrnes wrote:


I'm using lm to run an ANOVA, and would like to use Ryan's Q as my
post-hoc (as recommended by Day and Quinn, 1989, Ecological
Monographs).  I can't seem to find any methods in the base stats
package that implement this post-hoc.  Is there a good package of
post-hoc methods out there, or has someone written a method for Ryan's
Q previously?

Thanks!

-Jarrett

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



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


Re: [R] Fitting a sine wave using solver

2008-11-21 Thread Dieter Menne
Ben Zuckerberg bz73 at cornell.edu writes:

 I have several sets of oscillation data and would like to estimate the 
 parameters of a sine function to each set (and hopefully automate 
 this). 

There is an example using lme (yes, LINEAR) fit on page 239 of 
Pinheiro/Bates Mixed Effects Book (ovarian cycle). If you do not
have the book at hand, have a look at library/nlme/scripts/ch05.r.

Dieter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 data.frame()

2008-11-21 Thread Dieter Menne



Agustin Lobo-4 wrote:
 
 Given
   str(x)
 'data.frame': 5284 obs. of  5 variables:
   $ COD  : chr  0800101001 0800101002 0800101003 0800101004 ...
   $ 0-4  : num  79 215 84 58 127 134 15 122 101 99 ...
   $ 5-9  : num  76 180 32 56 81 106 10 112 128 96 ...
   $ 10-14: num  68 145 39 46 78 81 8 92 142 107 ...
   $ 15-19: num  73 170 49 52 103 77 10 116 129 129 ...
 
 I get
 
   str(data.matrix(x))
   num [1:5284, 1:5] 8e+08 8e+08 8e+08 8e+08 8e+08 ...
   - attr(*, dimnames)=List of 2
..$ : chr [1:5284] 3 6 9 12 ...
..$ : chr [1:5] COD 0-4 5-9 10-14 ...
 
 Should not data.matrix() return a numeric matrix?
 
 

It does, only the dimnames are non-numeric, and you first column is a little
ugly in floating point because the numbers are so big. Do you really want to
convert these to doubles?

Try
dm= data.matrix(x)
dm[,2]

which probably looks quite good.

Dieter



-- 
View this message in context: 
http://www.nabble.com/Problem-with-data.frame%28%29-tp20626551p20627068.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Equivalent to apply(x[,2:5],1,sum) for dataframe

2008-11-21 Thread Dieter Menne



Agustin Lobo-4 wrote:
 
 What's the most correct way of doing the equivalent to
 apply(x[,2:5],1,sum)
 
 if x is dataframe in which the only numeric fields are
 in columns 2:5 ?
 (using apply returns a character vector)
 

Could it be that you meant apply(x[,2:5],2,sum)? Not very easy to remember,
when
to use 2 or 1. Also check rowSums and colSums (note the plural forms!) that
can be MUCH faster.

Dieter

-- 
View this message in context: 
http://www.nabble.com/Equivalent-to-apply%28x-%2C2%3A5-%2C1%2Csum%29-for-dataframe-tp20626483p20627203.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help with avoiding For Loop

2008-11-21 Thread Anup Menon
Dear Jorge,

Thanks a lot.

Regards

Anup

On Thu, Nov 20, 2008 at 10:19 PM, Jorge Ivan Velez [EMAIL PROTECTED]
 wrote:


 Dear Anup,
 Try this:

 # Data
 A - c(1,2,3,4,5)
 B - rnorm(100)

 # Results
 t(apply(sapply(A,function(x) pnorm(x*B)),2,function(x)
 c(Mean=mean(x),Var=var(x


 HTH,

 Jorge



 On Thu, Nov 20, 2008 at 10:09 PM, Anup Menon [EMAIL PROTECTED]wrote:

 Dear Friends,

 I'm trying to see if there is some possibility that I can do the following
 computations without a loop. I have attached a toy example below.

 A - c(1,2,3,4,5)
 B - rnorm(100)
 store - matrix(0,5,2)

 for (i in 1:5)
 {
  store[i,1] - mean(pnorm(A[i]*B))
  store[i,2] - var(pnorm(A[i]*B))
 }
 store

 Thanks in advance for your help.

 Kind Regards

 Anup

[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Vector lty argrument for lines or plot

2008-11-21 Thread Brian Diggs
Thank you for the suggestion, baptiste.  segments() does do exactly what I was 
wanting and matplot()/matlines() is probably a better solution to what I was 
trying to do.

However, I am still concerned about the discrepancy between the documentation 
in ?par and the behavior of lines().  Should lines() be changed to cycle over a 
vector of lty (so that it agrees with the documentation in ?par)?  Should the 
documentation of par be changed to use a different example of a function that 
cycles over a vector of lty (segments() being a good candidate)?  Or are both 
lines() and ?par correct and there is a situation which lines() does cycle over 
a vector of lty that I (and at least baptiste as well) do not understand?  The 
middle option is certainly the easiest, and I think the correct one, but I 
wanted to rule out the last one before filing a bug report.

-- 
Brian Diggs, Ph.D.
Senior Research Associate, Department of Surgery, 
Oregon Health  Science University

baptiste auguie wrote:
 Hi,
 
 If you wish to connect each point to the next with a different linetype, 
 I think your best bet is to use segments()
 
 
 x - stats::runif(12); y - stats::rnorm(12)
 i - order(x,y); x - x[i]; y - y[i]
 plot(x, y)
 s - seq(length(x)-1)
 segments(x[s], y[s], x[s+1], y[s+1], lty=1:10)
 
 
 If, however, you wish to plot several groups of lines with different 
 linetypes, then matlines() should do the job. Both of these make actual 
 use of lty as a vector, while polygon(), abline(), plot(), lines() will 
 only use the first value (as far as i can see).
 
 
 Hope this helps,
 
 baptiste
 
 On 20 Nov 2008, at 20:24, Brian Diggs wrote:
 
 I am confused by the behavior of the lines function when the lty 
 argument is a vector.  ?lines indicates that lty is a valid parameter, 
 but says nothing else about it.  ?plot.xy (which I think is what gets 
 called) refers back to ?lines.  ?plot.default says to see ?par.  In 
 ?par, about lty it says Some functions such as lines accept a vector 
 of values which are recycled. Other uses will take just the first 
 value if a vector of length greater than one is supplied.  However, I 
 cannot get lines to use more than one type of line.  Some example code:

 pt - runif(10)
 plot(pt)
 lines(pt, type=c, lty=1:10)

 I expected each subsequent line segment to be in a different style.  
 Only the first seems to be used.  The same is true for plot:

 plot(pt, type=b, lty=1:10)

 uses only one style of line segment (although no documentation says 
 explicitly that the others would be used).  It doesn't matter the 
 order or manner of specification, only the first is used.

 plot(pt)
 lines(pt, type=c, lty=c(dashed,solid))

 plot(pt)
 lines(pt, type=c, lty=c(FF, 11))

 I have used a vector of lty before (in legend) and it cycled through 
 all the values.  Am I misunderstanding what a vector lty to lines 
 means, or is this a bug?

 I'm running on Windows XP Pro, if that might matter.

 sessionInfo()
 R version 2.8.0 (2008-10-20)
 i386-pc-mingw32

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

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

 -- 
 Brian Diggs, Ph.D.
 Senior Research Associate, Department of Surgery, Oregon Health  
 Science University



 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide 
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 _
 
 Baptiste Auguié
 
 School of Physics
 University of Exeter
 Stocker Road,
 Exeter, Devon,
 EX4 4QL, UK
 
 Phone: +44 1392 264187
 
 http://newton.ex.ac.uk/research/emag
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Conditionally Removing data from a vector

2008-11-21 Thread PDXRugger

I am having trouble removing entries from a vector based on the value of the
vector and another object value.  It works in my pseudo test run:

DEV=400 
#Y
CANDS=c(100:105)
#Z
DEVS=c(120,220,320,420,520)
if(DEVDEVS)
 (CANDS=CANDS[which(DEVDEVS)]) 
 CANDS DEVS
[1,]   100  120
[2,]   101  220
[3,]   102  320
[4,]   103  420
[5,]   104  520
[6,]   105  620

So the result  CANDS is 103, 104 and 105 b/c the corresponding DEVS are
larger than the DEV(400 in this case).
Now i am trying to implement this into my working code but it doenst seem to
work.  

#Loads TAZ and corresponding vacant acres data
TAZ_VAC_ACRES= read.csv(file=I:/Research.csv,header=TRUE);

#Converts vacant acres by TAZ to vacant square footage by TAZ
TAZ_VAC_FEET=cbind(TAZ_VAC_ACRES[1],TAZ_VAC_ACRES[2]*43560)

#Creates test Candidates Vector
Candidates=c(100,101,102,103,104,105)

#Creates object equaling the number of candidate TAZs from the main script
Location Choice Model
NumCands1=length(Candidates)

Dev..At=999

for(i in 1:NumCands1){  

#Renames each candidate TAZ to function variable
Loc_Mod_TAZ=Candidates[i]

#Converts Development size from main script to Development density 
function
format
Dev_Size=Dev..At

#Determines vacant square feet by TAZ 
TAZDetermine_FEET=TAZ_VAC_FEET[TAZ_VAC_FEET$TAZ==Loc_Mod_TAZ,2]

#Determines if the Candidate TAZs have sufficient 
vacancy and creates
vector with TAZs that can accomadate development
if(Dev_SizeTAZDetermine_FEET)

(Candidates=Candidates[which(Dev_SizeTAZDetermine_FEET)])

}

So basically i am starting out with a list of CAndidate TAZs and i want to
remove the TAZS that are not big enough to accomadate the
Development(Dev..At).  My test code works but again i cant get it to run in
my workiong code.  Anything stupid im missing or maybe a better approach
than the which function.  Remove only seem useful for entire objects so
not sure what else would work. Thanks guys and gals

Cheers, 
JR

-- 
View this message in context: 
http://www.nabble.com/Conditionally-Removing-data-from-a-vector-tp20627244p20627244.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Saving color2D.matplot plots to a file

2008-11-21 Thread Garcia Carreras, Bernardo
Hi,

I am trying to figure out how to save plots produced with
color2D.matplot to a file, any format. I have tried:

jpeg() / png()
color2D.matplot(x,c(1,0),c(1,0),c(1,0))
dev.off()

as well as 

dev.new()
dev.print(device=png,file=myfreakinplot2.png) #(and jpeg, ps, pdf,
eps, together with dev.copy() as well...)
color2D.matplot(x,c(1,0),c(1,0),c(1,0),show.legend=TRUE)
dev.off()

to no avail. Does anyone have any suggestions?

Thanks!

Bernardo

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Suppression anova message

2008-11-21 Thread Blanchette, Marco
Dear all,

I am running anova(lm()) on a series of different data frame and I am getting 
the following message

Using dataFrame$levels as id variables


 1.  Why am I getting that message
 2.  How do I suppress it (or correct it).

Thanks

Marco

--
Marco Blanchette, Ph.D.
Assistant Investigator
Stowers Institute for Medical Research
1000 East 50th St.

Kansas City, MO 64110

Tel: 816-926-4071
Cell: 816-726-8419
Fax: 816-926-2018

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Suppression anova message

2008-11-21 Thread Blanchette, Marco
Dear all,

I am running anova(lm()) on a series of different data frame and I am getting 
the following message

Using dataFrame$levels as id variables


 1.  Why am I getting that message
 2.  How do I suppress it (or correct it).

Thanks

Marco

--
Marco Blanchette, Ph.D.
Assistant Investigator
Stowers Institute for Medical Research
1000 East 50th St.

Kansas City, MO 64110

Tel: 816-926-4071
Cell: 816-726-8419
Fax: 816-926-2018

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 likelihood

2008-11-21 Thread Joseph Magagnoli
Hi all,
I ran a Weibull model, and I am wondering if  there is any way to extract
the log likelihood.  I tried loglik(model)  but it does not seem to work
any help would be greatly appreciated
joe

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 likelihood

2008-11-21 Thread Joseph Magagnoli
Hi all,
I ran a Weibull model, and I am wondering if  there is any way to extract
the log likelihood.  I tried loglik(model)  but it does not seem to work
any help would be greatly appreciated
joe

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Discrepancy in the regression coefficients for Cox regression - PBC data set

2008-11-21 Thread Peter Dalgaard
Ravi Varadhan wrote:
 Hi David,
 
 I did look at Appendix D.3 of TG, but am not sure if the data set analyzed
 in FH and that attached with survival are different.  They both have
 n=418 (312 from RCT and 106 observational).  

Well, as David implies, if the observation times are longer and a few
more people died, that could easily explain the differences.

Someone borrowed our copy of FH so I can't check, but presumably you
have one (and it is your problem anyway...).

 
 There is a major difference in the coefficient for edema 0.66 vs 0.86.  In
 any case, the point is not whether the differences in coefficient affect
 interpretation of the model, but to understand why there are differences in
 the results.  
 
 Best,
 Ravi.
 
 
 
 ---
 
 Ravi Varadhan, Ph.D.
 
 Assistant Professor, The Center on Aging and Health
 
 Division of Geriatric Medicine and Gerontology 
 
 Johns Hopkins University
 
 Ph: (410) 502-2619
 
 Fax: (410) 614-9625
 
 Email: [EMAIL PROTECTED]
 
 Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html
 
  
 
 
 
 
 
 -Original Message-
 From: David Winsemius [mailto:[EMAIL PROTECTED] 
 Sent: Friday, November 21, 2008 12:34 PM
 To: Ravi Varadhan
 Cc: r-help@r-project.org
 Subject: Re: [R] Discrepancy in the regression coefficients for Cox
 regression - PBC data set
 
 There is a discussion in Appendix D.3 of Modeling Survival Data by Thereau
 and Grambsch regarding the differences in the datasets including the fact
 that there was significantly more follow-up for many patients at the time
 this dataset was assembled. I do not see a material difference in the
 estimates.
 
 --
 David Winsemius, MD
 Heritage Labs
 
 On Nov 21, 2008, at 12:16 PM, Ravi Varadhan wrote:
 
 Hi,

 When I run the following Cox proportional hazards model on the Mayo 
 clinic's PBC data set (given in the survival package), the 
 regression coefficients do not agree with the results presented in 
 Table 4.6.3 (p. 195) of Fleming  Harrington's book.

 library(survival)

 data(pbc)

 ans.cox - coxph(Surv(time, status) ~ log(bili) + log(alb) + age +
 log(protime) + edema)

 ans.cox

 ans.cox - coxph(Surv(time, status) ~ log(bili) + log(alb) + age +
 log(protime) + edema)
 ans.cox
 Call:
 coxph(formula = Surv(time, status) ~ log(bili) + log(alb) + age +
log(protime) + edema)


coef exp(coef) se(coef) z   p
 log(bili) 0.8975 2.453  0.08271 10.85 0.0e+00
 log(alb) -2.4524 0.086  0.65707 -3.73 1.9e-04
 age   0.0382 1.039  0.00768  4.97 6.5e-07
 log(protime)  2.345810.442  0.77425  3.03 2.4e-03
 edema 0.6613 1.937  0.20595  3.21 1.3e-03

 Likelihood ratio test=234  on 5 df, p=0  n= 418
 These coefficients, however, are significantly different (i.e. the 
 differences can't be just attributed to round-off's) from that 
 reported in Table 4.6.3 (in the Final model column) of Fleming and 
 Harrington (p.
 195).  The coefficients reported are: 0.8707, -2.533, 0.0394, 2.380, 
 0.8592.
 Note the big difference for the edema variable.

 It seems like the data set considered in the book and that available 
 in survival package are the same (with n=418).

 I also re-ran the Cox PH model with the 2 data-errors discussed in
 p.188
 of FH, but still I could not match the results in Table 4.6.3.

 Is it possible that the results could be explained due to difference 
 in convergence during maximization of partial likelihood?

 Can anyone help me figure out why this diescrepancy exists?

 Thanks very much,
 Ravi.
 --
 --
 ---

 Ravi Varadhan, Ph.D.

 Assistant Professor, The Center on Aging and Health

 Division of Geriatric Medicine and Gerontology

 Johns Hopkins University

 Ph: (410) 502-2619

 Fax: (410) 614-9625

 Email: [EMAIL PROTECTED]

 Webpage:  
 http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html



 --
 --
 



  [[alternative HTML version deleted]]

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


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

Re: [R] Vector lty argrument for lines or plot

2008-11-21 Thread Peter Dalgaard
Brian Diggs wrote:
Thank you for the suggestion, baptiste. segments() does do exactly what
I was wanting and matplot()/matlines() is probably a better solution to
what I was trying to do.
 
 However, I am still concerned about the discrepancy between the
documentation in ?par and the behavior of lines(). Should lines() be
changed to cycle over a vector of lty (so that it agrees with the
documentation in ?par)? Should the documentation of par be changed to
use a different example of a function that cycles over a vector of lty
(segments() being a good candidate)? Or are both lines() and ?par
correct and there is a situation which lines() does cycle over a vector
of lty that I (and at least baptiste as well) do not understand? The
middle option is certainly the easiest, and I think the correct one, but
I wanted to rule out the last one before filing a bug report.
 

The documentation for lines has

 'lwd' can be a vector: its first element will apply to lines but
 the whole vector to symbols (recycled as necessary).

which really is true, and you might expect something similar for lty,
but lty does not apply to symbols.  So the text in ?par is most likely a
copy-paste blunder. In any case, this usage is somewhat far-fetched and
a reference matplot() or segments() would, in both cases, express more
clearly what ?par is trying to say.



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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Dendrogram labels

2008-11-21 Thread Richardson, Patrick
Is there any way to change the orientation of the labels on the end of the 
dendrograms to horizontal rather than vertical?  If so, how can I do that.


_
Patrick Richardson
Biostatistician - Program of Translational Medicine
Van Andel Research Institute - Webb Lab
333 Bostwick Avenue NE
Grand Rapids, MI  49503
ph. 616.234.5787


This email message, including any attachments, is for th...{{dropped:9}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Dendrogram labels

2008-11-21 Thread Richardson, Patrick
Is there any way to change the orientation of the labels on the end of the 
dendrograms to horizontal rather than vertical?  If so, how can I do that.  
Below is my code, but I'm not sure which argument(s) I can use to change the 
label(s) (if it is possible to do).

a - hclust(z, method = complete)

# Plots hclust dendrogram #
plot(a, frame.plot=TRUE, lwd=2)

Many thanks,

_
Patrick Richardson
Biostatistician - Program of Translational Medicine
Van Andel Research Institute - Webb Lab
333 Bostwick Avenue NE
Grand Rapids, MI  49503
ph. 616.234.5787


This email message, including any attachments, is for th...{{dropped:9}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Conditionally Removing data from a vector

2008-11-21 Thread Philipp Pagel

 I am having trouble removing entries from a vector based on the value of the
 vector and another object value.  It works in my pseudo test run:
 
 DEV=400   
 #Y
 CANDS=c(100:105)
 #Z
 DEVS=c(120,220,320,420,520)
   if(DEVDEVS)
(CANDS=CANDS[which(DEVDEVS)]) 
  CANDS DEVS
 [1,]   100  120
 [2,]   101  220
 [3,]   102  320
 [4,]   103  420
 [5,]   104  520
 [6,]   105  620


The above code does not produce the output you show when I
paste it into R. It would be highly desirable to have a short,
documented, working example...

 So the result  CANDS is 103, 104 and 105 b/c the corresponding DEVS are
 larger than the DEV(400 in this case).

How do they correspond? Do you mean they are both columns of a
data.frame as your example output suggests? But CANDS and DEVS
are of differnt length, so this is probably not what you meant.
Finally, your code seems to indicate that you want all elements
of CANDS for which the corresponding (?) value of DEVS is less
than threshold DEV, but only if DEVDEVS. The latter produces a
warning, as you are comparing a single value to a vector of 5,
which is most likely not what you want. At this point my
confusion is perfect and I give up. 

I think you need to give us a better explanantion of what data
you have and what exactly you want to accomplish.

cu
Philipp


-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] rgl lighting question

2008-11-21 Thread Rajarshi Guha
Hi, I'm using rgl to generate a 3D surface plot and I'm struggling to  
get the lighting correct. Currently the surface gets plotted, but is  
very 'shiny'. On rotating the view, I get to see parts of the surface  
- but overall I don't see much detail because of the spotlight like  
lighting.


I've played around with the specular, ambient and diffuse but I can't  
bring out the details of the surface. Could anybody point me to some  
examples of how to make a plain matte surface, which isn't obscured  
by specular reflections?


Thanks,

---
Rajarshi Guha  [EMAIL PROTECTED]
GPG Fingerprint: D070 5427 CC5B 7938 929C  DD13 66A1 922C 51E7 9E84
---
If you don't get a good night kiss, you get Kafka dreams.
-Hobbes

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Discrepancy in the regression coefficients for Cox regression - PBC data set

2008-11-21 Thread Ravi Varadhan
Peter,

I did check the data in the Appendix of FH with the data in survival
package.  I couldn't find any differences in the time and status
variables.

May be Terry Therneau knows the answer?!

Ravi.

---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html







-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Peter Dalgaard
Sent: Friday, November 21, 2008 1:58 PM
To: Ravi Varadhan
Cc: r-help@r-project.org
Subject: Re: [R] Discrepancy in the regression coefficients for Cox
regression - PBC data set

Ravi Varadhan wrote:
 Hi David,
 
 I did look at Appendix D.3 of TG, but am not sure if the data set 
 analyzed in FH and that attached with survival are different.  They 
 both have
 n=418 (312 from RCT and 106 observational).  

Well, as David implies, if the observation times are longer and a few more
people died, that could easily explain the differences.

Someone borrowed our copy of FH so I can't check, but presumably you have
one (and it is your problem anyway...).

 
 There is a major difference in the coefficient for edema 0.66 vs 
 0.86.  In any case, the point is not whether the differences in 
 coefficient affect interpretation of the model, but to understand why 
 there are differences in the results.
 
 Best,
 Ravi.
 
 
 --
 --
 ---
 
 Ravi Varadhan, Ph.D.
 
 Assistant Professor, The Center on Aging and Health
 
 Division of Geriatric Medicine and Gerontology
 
 Johns Hopkins University
 
 Ph: (410) 502-2619
 
 Fax: (410) 614-9625
 
 Email: [EMAIL PROTECTED]
 
 Webpage:  
 http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html
 
  
 
 --
 --
 
 
 
 -Original Message-
 From: David Winsemius [mailto:[EMAIL PROTECTED]
 Sent: Friday, November 21, 2008 12:34 PM
 To: Ravi Varadhan
 Cc: r-help@r-project.org
 Subject: Re: [R] Discrepancy in the regression coefficients for Cox 
 regression - PBC data set
 
 There is a discussion in Appendix D.3 of Modeling Survival Data by 
 Thereau and Grambsch regarding the differences in the datasets 
 including the fact that there was significantly more follow-up for 
 many patients at the time this dataset was assembled. I do not see a 
 material difference in the estimates.
 
 --
 David Winsemius, MD
 Heritage Labs
 
 On Nov 21, 2008, at 12:16 PM, Ravi Varadhan wrote:
 
 Hi,

 When I run the following Cox proportional hazards model on the Mayo 
 clinic's PBC data set (given in the survival package), the 
 regression coefficients do not agree with the results presented in 
 Table 4.6.3 (p. 195) of Fleming  Harrington's book.

 library(survival)

 data(pbc)

 ans.cox - coxph(Surv(time, status) ~ log(bili) + log(alb) + age +
 log(protime) + edema)

 ans.cox

 ans.cox - coxph(Surv(time, status) ~ log(bili) + log(alb) + age +
 log(protime) + edema)
 ans.cox
 Call:
 coxph(formula = Surv(time, status) ~ log(bili) + log(alb) + age +
log(protime) + edema)


coef exp(coef) se(coef) z   p
 log(bili) 0.8975 2.453  0.08271 10.85 0.0e+00
 log(alb) -2.4524 0.086  0.65707 -3.73 1.9e-04
 age   0.0382 1.039  0.00768  4.97 6.5e-07
 log(protime)  2.345810.442  0.77425  3.03 2.4e-03
 edema 0.6613 1.937  0.20595  3.21 1.3e-03

 Likelihood ratio test=234  on 5 df, p=0  n= 418 These coefficients, 
 however, are significantly different (i.e. the differences can't be 
 just attributed to round-off's) from that reported in Table 4.6.3 (in 
 the Final model column) of Fleming and Harrington (p.
 195).  The coefficients reported are: 0.8707, -2.533, 0.0394, 2.380, 
 0.8592.
 Note the big difference for the edema variable.

 It seems like the data set considered in the book and that available 
 in survival package are the same (with n=418).

 I also re-ran the Cox PH model with the 2 data-errors discussed in
 p.188
 of FH, but still I could not match the results in Table 4.6.3.

 Is it possible that the results could be explained due to difference 
 in convergence during maximization of partial likelihood?

 Can anyone help me figure out why this diescrepancy exists?

 Thanks very much,
 Ravi.
 -
 -
 --
 ---

 Ravi Varadhan, Ph.D.

 Assistant Professor, The Center on Aging and Health

 Division of Geriatric Medicine and Gerontology

 Johns Hopkins University

 Ph: (410) 502-2619

 Fax: (410) 614-9625

 Email: [EMAIL PROTECTED]

 Webpage:  

Re: [R] Dendrogram labels

2008-11-21 Thread Richardson, Patrick
This does work, but also orients the entire dendrogram as horizontal.  If I 
could, I'd like the dendrogram to stay vertical and just orient the labels as 
horizontal.

Many thanks,

_
Patrick Richardson
Biostatistician - Program of Translational Medicine
Van Andel Research Institute - Webb Lab
333 Bostwick Avenue NE
Grand Rapids, MI  49503
ph. 616.234.5787


-Original Message-
From: Fan Yang [mailto:[EMAIL PROTECTED]
Sent: Friday, November 21, 2008 2:28 PM
To: Richardson, Patrick
Cc: 'r-help@r-project.org'
Subject: Re: [R] Dendrogram labels

Try:

b-as.dendrogram(a); plot(b, horiz=TRUE).

that should help.

fan


On Nov 21, 2008, at 2:14 PM, Richardson, Patrick wrote:

 Is there any way to change the orientation of the labels on the end
 of the dendrograms to horizontal rather than vertical?  If so, how
 can I do that.  Below is my code, but I'm not sure which argument(s)
 I can use to change the label(s) (if it is possible to do).

 a - hclust(z, method = complete)

 # Plots hclust dendrogram #
 plot(a, frame.plot=TRUE, lwd=2)

 Many thanks,

 _
 Patrick Richardson
 Biostatistician - Program of Translational Medicine
 Van Andel Research Institute - Webb Lab
 333 Bostwick Avenue NE
 Grand Rapids, MI  49503
 ph. 616.234.5787


 This email message, including any attachments, is for th...{{dropped:
 9}}

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

This email message, including any attachments, is for th...{{dropped:6}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] question about shapiro.test()

2008-11-21 Thread Greg Snow
Why are you doing the test for normality?

The 2 most common reasons are:

1. want to test if data comes from an exact normal distribution.
2. want to know if tests based on normal assumptions are reasonable to use with 
this data.

Technically, the Shapiro-Wilk test does not do either of the above, but further 
suggestions depend on what you are trying to accomplish, or what question you 
want answered.

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


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 project.org] On Behalf Of Eugene A. Semenko
 Sent: Friday, November 21, 2008 8:19 AM
 To: [EMAIL PROTECTED]
 Subject: [R] question about shapiro.test()

 Hi all!
 I tried to perform Shapiro-Wilk test for my sample of 243 values.
  Us
   [1] -10.4 -13.1 -12.2  38.1 -18.8 -13.3 -11.7  29.3  49.7   6.8  12.7
 16.3
  [13]   5.8  -0.7 -29.4   4.1  38.8  -1.4   8.8  15.6  32.9  -5.3  19.1
 35.8
  [25]   4.0  -1.5   0.6  -4.2 -10.0  -4.0   1.1  48.9 -21.0  -5.3   5.8
 -10.8
  [37]  21.9   8.2  -3.2  -3.9  -2.3  12.6  -4.7  -8.0  11.8  27.4  -9.5
 -20.8
  [49]  -8.1  -5.4   0.7 -13.2  -6.1  -5.7  -9.6   0.3  -2.1 -15.2   1.7
 -15.2
  [61]   7.4 -16.0  13.1   8.7  -8.9 -21.2  29.8 -22.6  10.5   7.5   9.9
 -13.0
  [73]  -8.3 -22.9  -9.7  -3.7   8.2  -9.0 -21.8  28.5 -10.2   8.8 -10.1
 15.3
  [85]   5.5 -35.0 -14.5 -61.2  -8.3 -17.5 -16.3  -8.5   2.0 -17.5 -12.2
 -10.8
  [97] -16.7   6.8 -12.4  -1.9 -13.3  -8.2 -22.6  20.7 -12.5 -21.9  -6.0
 9.2
 [109]  -1.1 -17.5 -13.5   6.1 -18.5  18.1   6.3 -13.1 -16.2 -30.5 -23.4
 4.3
 [121] -11.2 -18.5 -17.7  26.7   2.2  -9.4   1.8  -7.7  -5.1   6.3   7.1
 7.4
 [133]  -9.2  24.8  53.5  23.9   0.0 -25.7 -33.3   6.9  -9.7 -22.6  -1.5
 18.0
 [145] -20.5 -12.9 -14.3   3.9   5.5  -6.3   2.1 -11.2  -4.9   6.1   3.3
 7.0
 [157]   4.1   0.3  -0.7  -6.4  -5.1 -17.6  -3.3   6.7   1.5  -8.8  31.2
 -30.5
 [169] -16.3 -23.4 -30.7  -3.2   8.3  18.1 -17.0  12.1   0.6  -1.6  -1.4
 6.3
 [181]   3.6   5.3   1.6   1.8  23.7 -14.1   1.1  12.4  18.9 -11.5  -1.8
 -21.1
 [193]   2.4  23.4 -11.4  -5.9  -5.2  16.9 -19.8  19.5  -4.4   0.5  -1.4
 -8.1
 [205]   5.4  -2.7  -2.3  -2.9   4.4   8.0  -7.8  32.0   5.4   2.7   3.6
 14.9
 [217]  -7.0   3.6 -12.1   3.8  47.8  -5.8   3.0  12.6  -1.1   2.0   1.5
 -0.1
 [229]  11.2  -1.4  -3.1  22.0 -14.4 -10.5  -4.1 -37.5 -17.6  -3.3   3.0
 -0.6
 [241]  33.8   1.6  -3.9
 Output is:
  shapiro.test(Us)
 Shapiro-Wilk normality test
 data:  Us
 W = 0.9686, p-value = 3.417e-05

 So, if I understand correctly, output inform me that H0 hypotesis of
 normality
 of my sample shoud be rejected because p-value  0.05 (at 5% level).
 Is'n
 it? But actually my data distributed very close to the normal
 distribution.
 Thanks in advance.
 Eugene
 --
 ---
 
 e-mail: [EMAIL PROTECTED]  Special Astrophysical Observatory RAS,
 WWW: http://tiger.sao.ru/   Nizhnij Arkhyz
 phone: +7 87878 46 5 77 Karachai-Chercassian Republic,
 fax: +7 87878 46 5 27   Russia, 369167

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] list creation interpolation

2008-11-21 Thread Greg Snow
The $ syntax for working with elements of a list is a magical shortcut for 
[[]].  It is a great shortcut when used as intended, but trying to force 
magical shortcuts to do things that they were not intended for usually results 
in the programming equivalent of turning yourself into a toad.

The correct approach is to not use the shortcut, but the thing that it is a 
shortcut for.

Did you try:

 resultlist[[ a[1] ] - foo
 resultlist[[ a[2] ] - rnorm(20)

Hope this helps,

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


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 project.org] On Behalf Of H. Paul Benton
 Sent: Friday, November 21, 2008 10:58 AM
 To: r-help@r-project.org
 Subject: [R] list creation interpolation

 Hello all,



   I apologize if this is simple or has already been answered somewhere,
 but
 I'm not sure what to search for although I have tried and didn't come
 up
 with anything so.. Here's my question.

   How can I interpolate list names or do I have to do it post list
 creation.
 Since that's not very clear here is some sample code of what I wanted
 to do:



  resultlist-list()

  a-c(Book, video, radio, mp3)

  foo-rnorm(10)

  resultlist$a[1]-foo

 Warning message:

 In resultlist$a[1] - foo :

   number of items to replace is not a multiple of replacement length

 



 What I wanted here was a named list so that I would have 4 values the
 list
 would be

 resultlist$Book

 resultlist$video

 resultlist$radio

 resultlist$mp3



   Any idea on how to do this other than doing it post creation ie



 resultlist[[1]]-foo

 resultlist[[2]]-rnorm(20) etc..

 names(resultlist)-a







 Cheers,



 Paul




 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 Kendall for n4?

2008-11-21 Thread Stavros Macrakis
 library(Kendall)
 Kendall(1:3,1:3)
WARNING: Error exit, tauk2. IFAULT =  12  
tau = 1, 2-sided pvalue =1

I believe Kendall tau is well-defined for this case and the reported
value is correct; isn't it a bug to give a warning?  (And if, e.g.,
the pvalue is not well-defined in this case, wouldn't it be better to
return NA or NaN or something?) Also, shouldn't the error code be
given in plain English -- or at least the meaning of IFAULT = 12
documented on the help page?

A somewhat less clear case is Kendall(1:2,1:2), which gives the same
error.  Though the usual formula for Kendall tau has a zero in the
denominator in this case, I'd think the correct generalization is 1 if
the two elements are in the same order, and -1 if they are not (the
only possibilities). But perhaps I don't fully understand the
interpretation of this statistic.

  -s

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Dendrogram labels

2008-11-21 Thread Fan Yang

hah, I see what you mean. try:
plot(a, leaflab=c(textlike)).

fan

On Nov 21, 2008, at 2:30 PM, Richardson, Patrick wrote:

This does work, but also orients the entire dendrogram as  
horizontal.  If I could, I'd like the dendrogram to stay vertical  
and just orient the labels as horizontal.


Many thanks,

_
Patrick Richardson
Biostatistician - Program of Translational Medicine
Van Andel Research Institute - Webb Lab
333 Bostwick Avenue NE
Grand Rapids, MI  49503
ph. 616.234.5787


-Original Message-
From: Fan Yang [mailto:[EMAIL PROTECTED]
Sent: Friday, November 21, 2008 2:28 PM
To: Richardson, Patrick
Cc: 'r-help@r-project.org'
Subject: Re: [R] Dendrogram labels

Try:

b-as.dendrogram(a); plot(b, horiz=TRUE).

that should help.

fan


On Nov 21, 2008, at 2:14 PM, Richardson, Patrick wrote:


Is there any way to change the orientation of the labels on the end
of the dendrograms to horizontal rather than vertical?  If so, how
can I do that.  Below is my code, but I'm not sure which argument(s)
I can use to change the label(s) (if it is possible to do).

a - hclust(z, method = complete)

# Plots hclust dendrogram #
plot(a, frame.plot=TRUE, lwd=2)

Many thanks,

_
Patrick Richardson
Biostatistician - Program of Translational Medicine
Van Andel Research Institute - Webb Lab
333 Bostwick Avenue NE
Grand Rapids, MI  49503
ph. 616.234.5787


This email message, including any attachments, is for th...{{dropped:
9}}

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


This email message, including any attachments, is for ...{{dropped:22}}


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] rgl lighting question

2008-11-21 Thread Barry Rowlingson
2008/11/21 Rajarshi Guha [EMAIL PROTECTED]:
 Hi, I'm using rgl to generate a 3D surface plot and I'm struggling to get
 the lighting correct. Currently the surface gets plotted, but is very
 'shiny'. On rotating the view, I get to see parts of the surface - but
 overall I don't see much detail because of the spotlight like lighting.

 I've played around with the specular, ambient and diffuse but I can't bring
 out the details of the surface. Could anybody point me to some examples of
 how to make a plain matte surface, which isn't obscured by specular
 reflections?

 Have you tried lit=FALSE? This sphere is so unspecular it appears flat:

  spheres3d(0,0,0,color=red,lit=FALSE)

Barry

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] list of list objects

2008-11-21 Thread Rajasekaramya

hi there,

I have a list of list objects i need to remove the top layer

[[1]]
[1].0
ABC DEFLMN
[1].1
WER ERT TRY

[[2]]
[2].0
ASD,werqwe
[2].1
wdvghjggj

I wanna avoid the top layer...that is [[1]] [[2]] shouldnt be there
just a simple list is wat i need.
[1].0
ABC DEFLMN
[1].1
WER ERT TRY
[2].0
ASD,werqwe
[2].1
wdvghjggj
kindly let me know hoe to go abt it

regards
ramya


-- 
View this message in context: 
http://www.nabble.com/list-of-list-objects-tp20628759p20628759.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] equation of a line or curve

2008-11-21 Thread CE.KA

Hi R users
I used the function line(x,y) and line(lowess(x,y)) to see the correlation
between 2 variables (x,y).
Here is my question:
is there a way to ask R to tell me the equation of
-this line : line(x,y)
-this curve: line(lowess(x,y))
Best regards 
-- 
View this message in context: 
http://www.nabble.com/equation-of-a-line-or-curve-tp20628845p20628845.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] list of list objects

2008-11-21 Thread jim holtman
Will one of these two solutions work for you:

 x - list(list(1,2), list(3,4), list(5,6))
 x
[[1]]
[[1]][[1]]
[1] 1

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


[[2]]
[[2]][[1]]
[1] 3

[[2]][[2]]
[1] 4


[[3]]
[[3]][[1]]
[1] 5

[[3]][[2]]
[1] 6



 lapply(x, [[, 1)
[[1]]
[1] 1

[[2]]
[1] 3

[[3]]
[1] 5

 lapply(x, '[', 1)
[[1]]
[[1]][[1]]
[1] 1


[[2]]
[[2]][[1]]
[1] 3


[[3]]
[[3]][[1]]
[1] 5



On Fri, Nov 21, 2008 at 3:14 PM, Rajasekaramya [EMAIL PROTECTED] wrote:

 hi there,

 I have a list of list objects i need to remove the top layer

 [[1]]
 [1].0
 ABC DEFLMN
 [1].1
 WER ERT TRY

 [[2]]
 [2].0
 ASD,werqwe
 [2].1
 wdvghjggj

 I wanna avoid the top layer...that is [[1]] [[2]] shouldnt be there
 just a simple list is wat i need.
 [1].0
 ABC DEFLMN
 [1].1
 WER ERT TRY
 [2].0
 ASD,werqwe
 [2].1
 wdvghjggj
 kindly let me know hoe to go abt it

 regards
 ramya


 --
 View this message in context: 
 http://www.nabble.com/list-of-list-objects-tp20628759p20628759.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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 that you are trying to solve?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] list of list objects

2008-11-21 Thread Jagat.K.Sheth
?unlist 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Rajasekaramya
Sent: Friday, November 21, 2008 2:14 PM
To: r-help@r-project.org
Subject: [R] list of list objects


hi there,

I have a list of list objects i need to remove the top layer

[[1]]
[1].0
ABC DEFLMN
[1].1
WER ERT TRY

[[2]]
[2].0
ASD,werqwe
[2].1
wdvghjggj

I wanna avoid the top layer...that is [[1]] [[2]] shouldnt be there just
a simple list is wat i need.
[1].0
ABC DEFLMN
[1].1
WER ERT TRY
[2].0
ASD,werqwe
[2].1
wdvghjggj
kindly let me know hoe to go abt it

regards
ramya


--
View this message in context:
http://www.nabble.com/list-of-list-objects-tp20628759p20628759.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] list of list objects

2008-11-21 Thread Jagat.K.Sheth
?unlist 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Rajasekaramya
Sent: Friday, November 21, 2008 2:14 PM
To: r-help@r-project.org
Subject: [R] list of list objects


hi there,

I have a list of list objects i need to remove the top layer

[[1]]
[1].0
ABC DEFLMN
[1].1
WER ERT TRY

[[2]]
[2].0
ASD,werqwe
[2].1
wdvghjggj

I wanna avoid the top layer...that is [[1]] [[2]] shouldnt be there just
a simple list is wat i need.
[1].0
ABC DEFLMN
[1].1
WER ERT TRY
[2].0
ASD,werqwe
[2].1
wdvghjggj
kindly let me know hoe to go abt it

regards
ramya


--
View this message in context:
http://www.nabble.com/list-of-list-objects-tp20628759p20628759.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 convert S4 class slots into data.frame or how to assign variables of type 'Date'

2008-11-21 Thread Ronny Wölbing




Hi,

I created a class (S4) with some slots like value, date, description  
(it's actually a financial transaction class). Now  I need a method  
to convert this class forth and back into a single row data.frame,  
where every slots represents a column. This method looks at the  
moment like this:


 setMethod(as.data.frame, Transaction,
   function(x, row.names = NULL,  optional = FALSE, ...){
   slotnames - slotNames(x)
   slotlist -  
data.frame(rbind(1:length(slotnames)))

   names(slotlist) - slotnames
   for(i in slotnames) {
   slotlist[1, i] - slot(x,  i)
   }
   return(slotlist)
   }
)

This method doesn't require predetermined slotnames or types, which  
is important to me. The method works quite good but the problem is  
that I have slots of type 'Date' and this method doesn't preserve  
the type but converts it to numeric.


A couple of tests showed that this is actually a problem of  
assigning values to data.frame column. Something like this:


 slotlist$DayOfTransaction - slot(Transaction, DateOfTransaction)

would preserve the type of DateOfTransaction as 'Date'.

But I don't see a way to use this assigning scheme in my method  
without using the actual slotnames and giving up a lot of flexibility.


Do you have any suggestions? Is there maybe even a simple way to  
convert S4 slots into data.frames?


Thanks in advance
Ronny

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


Does nobody has an idea?

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Growth rate determination using ANCOVA

2008-11-21 Thread dschruth
I'm a programmer in a biology lab who is starting to use R to automate
some of our statistical analysis of growth rate determination. But I'm
running into some problems as I re-code.

1) Hypotheses concerning Slope similarity/difference:
   I'm using R's anova(lm()) methods to analyse a model which looks
like this:
  growth.metric ~ time * test.tube
   I understand that testing the the interaction between time and tube
(time:test.tube) will tell us if the growth rates (for the last three
test tubes) are significantly different from one another (Ho=slopes
are the same).  The purpose of doing this test is so that we can be
certain our cultures have fully acclimated to the treatment and aren't
going to change much if we stop measuring. This is an important cost
saving practice too as measurements can go on for years.   Yet I'm
worried that our null and alternative hypotheses should be swapped so
that our test is more conservative (Ho=slopes are different ... ie
still acclimating.)

Is there a way to specify my model that flips these hypotheses?
Should I be using a different method?  Is this even appropriate?


2) Growth Rate is confounded with Variance of Growth Rate
   I'm also worried about the fact that rates for cultures with faster
growth are calculated using fewer data points (assuming similar
sampling times between treatments) .  The result is that growth ~ var
(growth).   Not only does this put a wrinkle in my analysis between
treatments, but it also biases the growth acclimation determining
ANCOVA test above.  Faster growing cultures will usually pass the no
significant difference between slopes test more easily because there
are fewer points from which to be certain about rejecting Ho.

Is there a way to control for this?
Perhaps I could include the number of points in my model?


3) Statistical validity of using subsets of growth.metric measurements
within a test tube
   There are some lab members who insist that we can throw out the
beginning and end of our log transformed growth.metric measurements
because they are outliers in determining maximum growth.I've
proposed looping through all possible combinations of 3 or more points
within the growth curve and using the highest or best fitting (best R-
squared) slope.  But this idea has been rejected by our PI as not be a
valid thing to do.

Ideas here?

Thank you.

Dave

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Conditionally Removing data from a vector

2008-11-21 Thread PDXRugger

I greatly apoligize, clear in my own mind, just didnt explain well enough. 
DEVS should equal 6 values the last being 620, like the data frame:
   CANDS DEVS
 [1,]   100  120
 [2,]   101  220
 [3,]   102  320
 [4,]   103  420
 [5,]   104  520
 [6,]   105  620

And yes, my first question is do i need a if statement at all as the which
command seems to do the same thing.  IN my working code i start with a
vector of Candidates, a process occurs that looks up a value associated with
each of those Candidates.  If the corresponding value is equal to or larger
than the starting value, in the test case the DEV value, then that Candidate
is kept and the next Candidate is analyzed.  The final product is a new
vector of Candidates, those that are equal to or larger than the DEV value. 
Hope i didnt further the perfection of your confucion.  Thanks for your
time, let me know if i need to ask a better question

Cheers, 
JR 


Philipp Pagel-5 wrote:
 
 
 I am having trouble removing entries from a vector based on the value of
 the
 vector and another object value.  It works in my pseudo test run:
 
 DEV=400  
 #Y
 CANDS=c(100:105)
 #Z
 DEVS=c(120,220,320,420,520)
  if(DEVDEVS)
   (CANDS=CANDS[which(DEVDEVS)]) 
  CANDS DEVS
 [1,]   100  120
 [2,]   101  220
 [3,]   102  320
 [4,]   103  420
 [5,]   104  520
 [6,]   105  620
 
 
 The above code does not produce the output you show when I
 paste it into R. It would be highly desirable to have a short,
 documented, working example...
 
 So the result  CANDS is 103, 104 and 105 b/c the corresponding DEVS are
 larger than the DEV(400 in this case).
 
 How do they correspond? Do you mean they are both columns of a
 data.frame as your example output suggests? But CANDS and DEVS
 are of differnt length, so this is probably not what you meant.
 Finally, your code seems to indicate that you want all elements
 of CANDS for which the corresponding (?) value of DEVS is less
 than threshold DEV, but only if DEVDEVS. The latter produces a
 warning, as you are comparing a single value to a vector of 5,
 which is most likely not what you want. At this point my
 confusion is perfect and I give up. 
 
 I think you need to give us a better explanantion of what data
 you have and what exactly you want to accomplish.
 
 cu
   Philipp
 
 
 -- 
 Dr. Philipp Pagel
 Lehrstuhl für Genomorientierte Bioinformatik
 Technische Universität München
 Wissenschaftszentrum Weihenstephan
 85350 Freising, Germany
 http://mips.gsf.de/staff/pagel
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/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/Conditionally-Removing-data-from-a-vector-tp20627244p20628349.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] How can I access the list argument within a for function call

2008-11-21 Thread Mike Rowe
Greetings,

I have been playing around with the R/Parallel package, which can farm out the 
computation of a for-loop among multiple worker processes.  Each worker gets a 
chunk of the for-loop iterations; for example, if you have two workers and 
for(x in 1:1000){...}, one worker would typically get iterations 1:500, while 
the second does 501:1000.

I would like to be able to preallocate matrices to capture the results within 
the for loop, on the first iteration.  Is there a way to access the list 
argument of the for function programmatically from within the loop?  I am 
referring to the for arguments shown on page 51 of the R Language Definition 
manual:

   for(var,list,expr)

I think I have a work-around, but was curious whether this was possible...

Thanks,
Mike


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Generalized Outer

2008-11-21 Thread Stavros Macrakis
Outer's arguments are restricted to atomic vectors or arrays built on
atomic vectors (though the documentation is not explicit on this
point).  What is the equivalent for lists or arrays built on lists? My
particular application was testing the Kendall tau function.  I tried
this

 outer( permn(3), permn(3), function(a,b)as.double(Kendall(a,b)$tau) )

I'd have hoped for something like

 matrix(  c(  Kendall(permn(3)[[1]], permn(3)[[1]] )$tau,
   Kendall(permn(3)[[1]], permn(3)[[2]] ) $tau,
...),
length(permn(3)),
length(permn(3))  )

but of course permn(3) is a list of vectors, not an atomic list.

If I want to define a version of outer for lists myself, I suppose the
clean way is to overload outer for the list class.  But I'm not sure
how to do that since outer is not generic.  Does this mean I need to
do something like
 outer.vector - outer;
 outer -  define generic outer
etc.?  Should I be redefining a built-in this way?  Can someone point
me to documentation on this?

Thanks,

   -s

PS Should Kendall really be returning CSingles?  The documentation
seems to say that they are to be used only in interfaces to outside
code.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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 convert S4 class slots into data.frame or how to assign variables of type 'Date'

2008-11-21 Thread Mark Lyman
  Hi,
 
  I created a class (S4) with some slots like value, date, description  
  (it's actually a financial transaction class). Now  I need a method  
  to convert this class forth and back into a single row data.frame,  
  where every slots represents a column. This method looks at the  
  moment like this:
 
   setMethod(as.data.frame, Transaction,
 function(x, row.names = NULL,  optional = FALSE, ...){
 slotnames - slotNames(x)
 slotlist -  
  data.frame(rbind(1:length(slotnames)))
 names(slotlist) - slotnames
 for(i in slotnames) {
 slotlist[1, i] - slot(x,  i)
 }
 return(slotlist)
 }
  )
 
  This method doesn't require predetermined slotnames or types, which  
  is important to me. The method works quite good but the problem is  
  that I have slots of type 'Date' and this method doesn't preserve  
  the type but converts it to numeric.
 


You would probably have gotten a quicker response if you had made a 
reproducible example as requested in the posting guide. However, the following 
example should give you a solution.

tmp - new(numWithId, 1, id = Sys.Date())
slotnames - slotNames(tmp)
slotlist - vector(list, length(slotnames))
names(slotlist) - slotnames
for(i in slotnames) slotlist[[i]] - slot(tmp, i)
as.data.frame(slotlist)

Take a look at the coercion section of ?[.data.frame. I belive your Date is 
being converted to numeric to match the class of what it is replacing.

Mark Lyman
Statistician, ATK

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] OT statistics question on TukeyHSD

2008-11-21 Thread Dylan Beaudette
Hi,

I have a dataset that is stratified by 3 levels, with an unequal number of 
observations per strata:

AB C
182   18291

The data are approximately normally distrubuted. 

Is there any reason why I can NOT use TukeyHSD to do pair-wise comparison of 
means?

Any thoughts or references would be greatly appreciated.

Thanks,
Dylan

-- 
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341

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


[R] Help with CCLUS

2008-11-21 Thread Erik Porfeli
Hi,

I am using the following syntax to enter data and perform a cluster analysis:

x - read.table (clstrdbt.csv, header=TRUE, sep = ,,fill = TRUE)
cl-cclust(x,4,20,verbose=TRUE,method=kmeans)

This is the result I receive:

Error in cclust(x, 4, 20, verbose = TRUE, method = kmeans) :
  (list) object cannot be coerced to type 'double'

Please help.

Regards,
Erik

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Conditionally Removing data from a vector

2008-11-21 Thread Philipp Pagel

 DEVS should equal 6 values the last being 620, like the data frame:
CANDS DEVS
  [1,]   100  120
  [2,]   101  220
  [3,]   102  320
  [4,]   103  420
  [5,]   104  520
  [6,]   105  620
 
 And yes, my first question is do i need a if statement at all as the which
 command seems to do the same thing.

You don't - and you don't need which() either. R is pretty good
at indexing things in very conveniant ways. I'll assume we have
the data you gave as an example in a data.frame - I'll call 'df':

# create example data
df - data.frame(cands=100:105, devs=c(120, 220, 320, 420, 520, 620))
threshold - 400

# get all rows with devs above threshold
df[df$devsthreshold, ]

# alternative way giving the same result
subset(df, devsthreshold)


The above methods will work if devs and cands are separate
vectors, too:

# get two vectors of equal length
cands - df$cands
devs - df$devs

cands[devsthreshold]
# alternative
subset(cands, devsthreshold)


For details and more examples have a look at the Introduction to
R - especially section 2.7 Index vectors; selecting and
modifying subsets of a data set.

cu
Philipp

-- 
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
85350 Freising, Germany
http://mips.gsf.de/staff/pagel

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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

2008-11-21 Thread Erik Iverson

Cannot reproduce.

Van den Berge Joke wrote:






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


[R] [R-pkgs] Update of X2R (with FishGraph) at CRAN, 20 Nov 2008

2008-11-21 Thread Michael H. Prager
X2R is a bundle of three software libraries for passing complicated data 
structures from Fortran, C/C++, or AD Model Builder to R.  An update has 
been sent to CRAN and should be available from mirrors shortly. From the 
menu at the left of the CRAN home page, look under Software / Other. 

We also have updated FishGraph, a compatible set of R functions for 
examining output from fish population models.  


* * *

Changes in this Update

The update adds minor bug fixes only.  In For2R, nested lists are now 
handled correctly.  In FishGraph, correct axis units are now used in the 
CLD.plots (catch, landings, discards) routine.


* * *

More detail, for those interested:

X2R is three independent but related software libraries:  C2R, ADMB2R, 
and For2R (together, X2R). Each contains output routines to  simplify 
transfer of complicated data structures from models written in a 
compiled language to R (note 1). Through calls to X2R routines, the 
user's data is written as a structured ASCII file. That file can be read 
by R with a single dget() function call to create an R data object of 
type list. The list may contain components such as vectors, data frames, 
matrices, and other lists.


These are NOT R packages; rather they are subroutine libraries to be 
used with programmers' own modeling codes. Limited testing indicates 
compatibility with S-PLUS, as well (note 2).


Languages supported are Fortran 95 (with For2R), C and C++ (with C2R) 
and AD Model Builder (with ADMB2R) (note 3).  Source code and detailed 
users' manuals are supplied.


ADMB2R has been tested with ADMB versions 6.03 and 7.71 and recent 
versions of the gcc and Borland C++ compilers.


The compatible software FishGraph is a set of R functions providing 
exploratory and presentation graphics of fishery catch-at-age or 
catch-at-length models. By taking its data from an R list assumed to 
have a certain structure (diagram provided), FishGraph determines which 
graphs should be generated. The required data structure may be generated 
with X2R or within R itself and may contain any amount of additional 
data. Most FishGraph routines have options to control titles, colors, 
and reference lines. The combination of X2R and FishGraph allows 
automating graphics from routine fish stock assessments. The FishGraph 
functions can be modified or supplemented to reflect the needs of the 
analysis at hand.


X2R is supplied as files X2R.zip and X2R.tar.gz, which are equivalent.  
Version and release date are found in file  VersionInfo.txt in the 
root of each archive. The new version is dated November 19, 2008.


FishGraph (same CRAN directory) is supplied as a Windows installer.  We 
will gladly collaborate with anyone interested in adapting FishGraph to 
other operating systems.


This work has been tested and is regularly used by the authors. However, 
any software may contain bugs, and these works are classified by NOAA as 
Experimental Products.  THIS SOFTWARE IS SUPPLIED WITH NO WARRANTY OF 
ANY KIND. The authors will endeavor to fix bugs promptly and to add 
requested features.  Send bug reports, suggestions, and extensions to


Michael H. Prager - [EMAIL PROTECTED]
Southeast Fisheries Science Center
National Marine Fisheries Service, NOAA
101 Pivers Island Road
Beaufort, North Carolina 28516 USA


* Note 1. Use of product names (commercial or otherwise) does not imply 
endorsement or recommendation by any U.S. government agency, nor by the 
authors in their government capacities.
* Note 2. S-PLUS is a commercial product that requires licensing by the 
user.
* Note 3. AD Model Builder, formerly a commercial product, is now an 
open-source free-software project. See http://admb-project.org/.


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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Dendrogram labels

2008-11-21 Thread Rodrigo Aluizio
Take a look at the las() function o ?par. It permits you to choice  
labels directions.


__
Rodrigo Aluizio

Em 21/11/2008, às 17:14, Richardson, Patrick [EMAIL PROTECTED] 
g escreveu:

!#x000a
Is there any way to change the orientation of the labels on the end  
of the dendrograms to horizontal rather than vertical?  If so, how  
can I do that.  Below is my code, but I'm not sure which argument(s)  
I can use to change the label(s) (if it is possible to do).


a - hclust(z, method = complete)

# Plots hclust dendrogram #
plot(a, frame.plot=TRUE, lwd=2)

Many thanks,

_
Patrick Richardson
Biostatistician - Program of Translational Medicine
Van Andel Research Institute - Webb Lab
333 Bostwick Avenue NE
Grand Rapids, MI  49503
ph. 616.234.5787


This email message, including any attachments, is for th...{{dropped: 
9}}


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Overlay two plots on the same device with axes having the same scale.

2008-11-21 Thread John Sorkin
R 2.6.0 
Windows XP

I have crated a file containing data with x and y values and have plotted the 
data using the output of gam. I would like to overlay an x,y plot of the data 
on top of the line returned by gam. I have succeeded in doing this using 
par(new=TRUE), unfortunately the y axis of the overlayed plots are of slightly 
different scale. How can I set the axes of the overlay plots so the scales are 
exactly the same?

y-matrix(nrow=200,ncol=2)

# Create data
y[1:200,2]-sin((0:99)/(0.5*10*pi))+rnorm(100,0,.2)
y[,1]-1:200

# Plot of raw data.
plot(y[,1],y[,2])
oldpar-par(new=TRUE)
fit1-gam(y[,2]~s(y[,1]))
#Plot of fit - overlays plot of raw data. 
#Note scale of overaly is not the same as the original raw data plot.
summary(fit1)
plot(fit1)

Thanks,
John


John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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   >