Re: [R] Understanding classes in R

2013-09-30 Thread Barry Rowlingson
On Sun, Sep 29, 2013 at 10:48 PM, john doe anon.r.u...@gmail.com wrote:
 I am having trouble understanding how classes in R work.  Here is a small
 reproducable example:

 x=1
 class(x)
 [1] numeric

 OK.  When a variable is a number, its class is numeric.  Does R have
 multiple types for numbers, like C++ (eg integer, float, double).  If so,
 where can I see a list, and how does numeric fit into this system?

 x=1:100
 class(x)
 [1] integer

 Wait - I thought that I assigned x to be an array/vector of 100 integers
 (numerics).  Why is the class not array or vector.  How is integer
 different than numeric?  Is there a vector or array class in R?  If
 so, why is this not that?

In most programming languages scalars and vectors (aka 1-d arrays) are
completely different things. However in R a scalar is the same thing
as a length-1 vector. Don't think of x=1 and x=1:100 as the first
creating a scalar and the second creating a vector containing 100
scalar values. The first creates a vector containing 1 scalar value,
and the second creates a vector conatining 100 scalar values. You
can't really get scalar values, they'll always effectively be in a
vector of length 1.

So the return value of class here is actually short for 'vector of
numeric' or 'vector of integer' - even when the length is 1 - and you
can think of those as the basic numeric classes. There is no 'scalar
numeric' class, all is vectors. is.vector(1) is TRUE. There isn't even
an is.scalar function.

None of that is true for 2-d arrays, aka matrices, where class(m) is
always matrix whether its a matrix of characters or numbers. You
have to look at the mode(m) or typeof(m) (or storage.mode(m)) to
figure out what kind of thing a matrix 'm' contains.

A 'list' is a bit more like some of the generic container classes that
you find in other programming langages. Its elements can be anything
but its class is always 'list'. Use it when you want a vector (in the
general sense of 'vector') of non-scalar values, eg L =
list(c(1,2,3),1,c(99,120),c(foo,bar,baz))

Confused? Well, just forget everything you learned about classes in
your Comp Sci lessons and get ready to learn R's two incompatible
OO-programming systems (S3 and S4 classes), or four if you want to
look at even more OO systems people have implemented as add-on
packages

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] barplot to the right side

2013-09-30 Thread Juan Andres Hernandez
Hi, does anybody know how to get a barplot with the x axis starting in the
right side and the y axis in the right side too?
An example:

dat=c(2,4,0,6,5)
names(dat)=paste('dpt.',1:5,sep='')
barplot(dat, horiz=T)
box()

I need this barplot in mirror, with the zero value to 6 starting in the
right side of x axes and the horizontal bars starting in the right side too.

Thank's in advance

Juan A. Hernandez-Cabrera

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

2013-09-30 Thread Jenny Williams
I have been trying to download the climstats package:
https://r-forge.r-project.org/R/?group_id=861

but it doesn't seem to run on R 3.0.2 or 3.0.1 and the zipfile is empty.

Does anyone know the status of this package or where I can download it.

Thanks

**
Jenny Williams
Spatial Information Scientist, GIS Unit
Herbarium, Library, Art  Archives Directorate
Royal Botanic Gardens, Kew
Richmond, TW9 3AB, UK

Tel: +44 (0)208 332 5277
email: jenny.willi...@kew.orgmailto:jenny.willi...@kew.org
**

Film: The Forgotten Home of Coffee - Beyond the 
Gardenshttp://www.youtube.com/watch?v=-uDtytKMKpAsns=tw
Stories: Coffee Expedition - 
Ethiopiahttp://storify.com/KewGIS/coffee-expedition-ethiopia
 Blog: Discovering Coffee in Ethiopia
http://www.kew.org/news/kew-blogs/incrEdibles-food-blog/discovering-coffee.htm
 Kew in Harapan Rainforest 
Sumatrahttp://storify.com/KewGIS/kew-in-harapan-rainforest
Articles: Seeing the wood for the 
treeshttp://www.kew.org/ucm/groups/public/documents/document/kppcont_060602.pdf
How Kew's GIS team and South East Asia botanists are working to help conserve 
and restore a rainforest in Sumatra. Download a pdf of this article 
here.http://www.kew.org/ucm/groups/public/documents/document/kppcont_060602.pdf



The Royal Botanic Gardens, Kew is a non-departmental public body with exempt 
charitable status, whose principal place of business is at Royal Botanic 
Gardens, Kew, Richmond, Surrey TW9 3AB, United Kingdom.

The information contained in this email and any attachments is intended solely 
for the addressee(s) and may contain confidential or legally privileged 
information. If you have received this message in error, please return it 
immediately and permanently delete it. Do not use, copy or disclose the 
information contained in this email or in any attachment.

Any views expressed in this email do not necessarily reflect the opinions of 
RBG Kew.

Any files attached to this email have been inspected with virus detection 
software by RBG Kew before transmission, however you should carry out your own 
virus checks before opening any attachments. RBG Kew accepts no liability for 
any loss or damage which may be caused by software viruses.

[[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] barplot to the right side

2013-09-30 Thread Jim Lemon

On 09/30/2013 07:47 PM, Juan Andres Hernandez wrote:

Hi, does anybody know how to get a barplot with the x axis starting in the
right side and the y axis in the right side too?
An example:

dat=c(2,4,0,6,5)
names(dat)=paste('dpt.',1:5,sep='')
barplot(dat, horiz=T)
box()

I need this barplot in mirror, with the zero value to 6 starting in the
right side of x axes and the horizontal bars starting in the right side too.


Hi Juan,
Try this:

par(mar=c(5,2,4,4))
barpos-barplot(-dat,names.arg=rep(,5),axes=FALSE,horiz=TRUE)
axis(1,at=(-6):0,labels=6:0)
mtext(names(dat),side=4,at=barpos,line=1)

Jim

__
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] Interperting results of glmnet and coxph plot, Brier score and Harrel's C-Index - am I doing something wrong ???

2013-09-30 Thread Terry Therneau

To elaborate on Frank's response, the analysis plan of
  1. Look at the data and select important variables
  2. Put that truncated list into your favorite statistic procedure
  3. Ask - are the p-values (c-statistic, coefficients, .) reliable?

is a very old plan.  The answer to the last question is always NO.
The traditional step 1 involved graphs and t-tests, but replacing it by something modern 
does not change the overall outcome.


Terry T

__
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] Apply function to do pairwise calculation

2013-09-30 Thread Amanda Li
Hello,

I want to do pairwise calculation, but I am not sure how to do so.

i.e. I have a correlation matrix M 200*200. Namely colnames(M)=rownames(M).
In addition, colnames(M) is one of A, B, C, D. I want to first sort the
matrix M into 16 modules according to colnames and rownames, and then apply:
avecor - function(x,y) {
z - (sum(cor(x,y)*cor(x,y))/length(cor(x,y)))^0.5
return(z)
}

So as to calculate the average correlation between A,B; A,C; A,D; B,C; B,D;
C,D.

Thanks in advance for your help!

Best,
Amanda

[[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] Residuals in garch (tseries)

2013-09-30 Thread ZuckerRahmen
Hello,

i'm currently working with the 'garch' function provided by the 'tseries'
package in R.

If you want to fit a time series you can call the function this way
fit = garch(data, order=c(1,1)).

A GARCH model delivers you a vector of sd's sigma and therefore confidence
intervals for your data. You can get them from the function output by
calling fit$fitted.values. 

You can also get some kind of residuals with fit$residuals and here is my
question: does anybody know how they are computed?

Normally some would say residuals = data - model, but for GARCH modelling
there is no exact model for the data but the confidence interval mentioned
above.

To compare the residuals I got here from the GARCH modelling to other models
I really need to know how they are computed, but the R documentary doesn't
provide an answer.

Anyone got a clue?

Thanks for any help in advance.



--
View this message in context: 
http://r.789695.n4.nabble.com/Residuals-in-garch-tseries-tp4677241.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] change specific factor level values to NA in data frame

2013-09-30 Thread Daniel Caro
Dear R-users

I am trying to replace specific factor level values in a data frame
with NAs. The data frame includes different kind of variables (e.g,
characters, numbers, and factors). I'd like to replace all 'Not
applicable', 'Invalid', 'and Missing' for NA.

For example:

f.level - c('Yes', 'No', 'Not applicable', 'Invalid', 'Missing')
df - data.frame(x1=runif(100), x2=sample(f.level, 100, replace=T),
x3=sample(f.level, 100, replace=T))

I try changing the values by
df[df %in% c('Not applicable', 'Invalid', 'Missing'), ] - NA

but nothing seems to change
summary(df)

My data frame has many more factors. Any advice?

Thank you,
Daniel

__
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] barplot - easy for experienced, difficult for me

2013-09-30 Thread happyR
hey guys,

I wanna make a simple barplot, looking like this excel graph: 
http://r.789695.n4.nabble.com/file/n4677251/barplot_invertebrates.jpg 

my data set includes 9 groups of invertebrates (x-axes) and total number
(y-axes) from two different parks (1 and 2).

my data-set looks like that:

http://r.789695.n4.nabble.com/file/n4677251/barplot_invertebrates.jpg 

I'm a bloody beginner and happy for your help.

ps: if you know what other graph could be interesting to make out of this
very simple data, go ahead and let me know!









--
View this message in context: 
http://r.789695.n4.nabble.com/barplot-easy-for-experienced-difficult-for-me-tp4677251.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] get mouse position without waiting for a click

2013-09-30 Thread Stanislav Aggerwal
Consider the following:

par(mar=c(0,0,0,0),xaxs = 'i',yaxs='i')
plot.new()
for(i in 1:20)
  {
  z - matrix(runif(256*256), ncol=256)
  dev.hold()
  image(z, col=grey(0:255/255),zlim=c(0,1),useRaster=TRUE)
  dev.flush()
  Sys.sleep(.1)
  }

I would like to continuously display the animation until a mouse click
happens. Obviously, locator() can't be used for this, because it will halt
the animation while waiting for the mouse click. So something like this
won't work:

while((r-locator(n=1)) == NULL)
  {
  z - matrix(runif(256*256), ncol=256)
  dev.hold()
  image(z, col=grey(0:255/255),zlim=c(0,1),useRaster=TRUE)
  dev.flush()
  Sys.sleep(.1)
  }

Can somebody suggest a way to get user input while displaying the
animation? I am willing to use a keypress if not the mouse. Essentially, I
need an input routine that does not wait for a response but just checks at
one instant (like kbhit in C).

Thanks very much for any help.

Stan

[[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] Split type in the RandomForest package

2013-09-30 Thread Cheng, Chuan
Hi guys,

I'm new to Random Forest package and I'd like to know what type of split is 
used in the package for classification? Or can I configure the package to use 
different split type (like simple split alongside single attribute axis or 
linear split based on several attributes etc..)

Thanks a lot!

[[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] how to compare two different models with different dependent variables

2013-09-30 Thread saira khalid
i want to compare two exchange rate models namely balassa samuelson model n
monetary model of exchange rate.but i don't know how??because both models
are different n dependent variables are also different from each
other...plz help me in my research work n tell me which econometric
technique is usefull in this context?

[[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] get mouse position without waiting for a click

2013-09-30 Thread Bert Gunter
On Windows or X11, (others ???)

?getGraphicsEvent

Cheers,
Bert

On Mon, Sep 30, 2013 at 7:46 AM, Stanislav Aggerwal
stan.agger...@gmail.com wrote:
 Consider the following:

 par(mar=c(0,0,0,0),xaxs = 'i',yaxs='i')
 plot.new()
 for(i in 1:20)
   {
   z - matrix(runif(256*256), ncol=256)
   dev.hold()
   image(z, col=grey(0:255/255),zlim=c(0,1),useRaster=TRUE)
   dev.flush()
   Sys.sleep(.1)
   }

 I would like to continuously display the animation until a mouse click
 happens. Obviously, locator() can't be used for this, because it will halt
 the animation while waiting for the mouse click. So something like this
 won't work:

 while((r-locator(n=1)) == NULL)
   {
   z - matrix(runif(256*256), ncol=256)
   dev.hold()
   image(z, col=grey(0:255/255),zlim=c(0,1),useRaster=TRUE)
   dev.flush()
   Sys.sleep(.1)
   }

 Can somebody suggest a way to get user input while displaying the
 animation? I am willing to use a keypress if not the mouse. Essentially, I
 need an input routine that does not wait for a response but just checks at
 one instant (like kbhit in C).

 Thanks very much for any help.

 Stan

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



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
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 compare two different models with different dependent variables

2013-09-30 Thread Bert Gunter
1. This is an r-help list, not a statistics or econometrics list. So
you need to post elsewhere.

2. However, having said that, you might find that the CRAN
Econometrics task view may be useful.
http://cran.r-project.org/web/views/Econometrics.html

Cheers,
Bert

On Mon, Sep 30, 2013 at 4:13 AM, saira khalid saira8...@gmail.com wrote:
 i want to compare two exchange rate models namely balassa samuelson model n
 monetary model of exchange rate.but i don't know how??because both models
 are different n dependent variables are also different from each
 other...plz help me in my research work n tell me which econometric
 technique is usefull in this context?

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



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
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] DEoptim inconsistent output

2013-09-30 Thread Suzen, Mehmet
On 29 September 2013 19:17, Aya Anas aa...@feps.edu.eg wrote:
 doesn't make sense at all. I got parameters that don't satisfy the
 constraint. In addition, when i substituted with the resulting parameters


Maybe you have issues with your interpretation of the usage of the package and
expected output. So, Can you provide reproducible code? Verbal descriptions may
not be efficient to explain issues with mathematical software...

__
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] change specific factor level values to NA in data frame

2013-09-30 Thread Rui Barradas

Hello,

A possibility is the following.



icol - sapply(df, is.factor)
df[icol] - lapply(df[icol], function(x){
x[as.character(x)  %in% c('Not applicable', 'Invalid', 'Missing')] - NA
x})


Hope this helps,

Rui Barradas

Em 30-09-2013 10:42, Daniel Caro escreveu:

Dear R-users

I am trying to replace specific factor level values in a data frame
with NAs. The data frame includes different kind of variables (e.g,
characters, numbers, and factors). I'd like to replace all 'Not
applicable', 'Invalid', 'and Missing' for NA.

For example:

f.level - c('Yes', 'No', 'Not applicable', 'Invalid', 'Missing')
df - data.frame(x1=runif(100), x2=sample(f.level, 100, replace=T),
x3=sample(f.level, 100, replace=T))

I try changing the values by
df[df %in% c('Not applicable', 'Invalid', 'Missing'), ] - NA

but nothing seems to change
summary(df)

My data frame has many more factors. Any advice?

Thank you,
Daniel

__
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] Residuals in garch (tseries)

2013-09-30 Thread Rui Barradas

Hello,

To know how something in R is computed, download the sources and read 
the respective function code.
That's one of the benefits of open source software, you can know exactly 
what is going on.



Hope this helps,

Rui Barradas

Em 30-09-2013 10:31, ZuckerRahmen escreveu:

Hello,

i'm currently working with the 'garch' function provided by the 'tseries'
package in R.

If you want to fit a time series you can call the function this way
fit = garch(data, order=c(1,1)).

A GARCH model delivers you a vector of sd's sigma and therefore confidence
intervals for your data. You can get them from the function output by
calling fit$fitted.values.

You can also get some kind of residuals with fit$residuals and here is my
question: does anybody know how they are computed?

Normally some would say residuals = data - model, but for GARCH modelling
there is no exact model for the data but the confidence interval mentioned
above.

To compare the residuals I got here from the GARCH modelling to other models
I really need to know how they are computed, but the R documentary doesn't
provide an answer.

Anyone got a clue?

Thanks for any help in advance.



--
View this message in context: 
http://r.789695.n4.nabble.com/Residuals-in-garch-tseries-tp4677241.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] change specific factor level values to NA in data frame

2013-09-30 Thread Bert Gunter
Well, maybe or maybe not. The problem is that the old factor levels
remain. Here's a tiny example that illustrates the issue:

 z - factor(c(a,b,c))
 z[as.character(z)==c] - NA
 z
[1] abNA
Levels: a b c

Whether or  how you wish to change this depends on what you are doing
with the data.

Cheers,
Bert


On Mon, Sep 30, 2013 at 9:52 AM, Rui Barradas ruipbarra...@sapo.pt wrote:
 Hello,

 A possibility is the following.



 icol - sapply(df, is.factor)
 df[icol] - lapply(df[icol], function(x){
 x[as.character(x)  %in% c('Not applicable', 'Invalid', 'Missing')]
 - NA
 x})


 Hope this helps,

 Rui Barradas

 Em 30-09-2013 10:42, Daniel Caro escreveu:

 Dear R-users

 I am trying to replace specific factor level values in a data frame
 with NAs. The data frame includes different kind of variables (e.g,
 characters, numbers, and factors). I'd like to replace all 'Not
 applicable', 'Invalid', 'and Missing' for NA.

 For example:

 f.level - c('Yes', 'No', 'Not applicable', 'Invalid', 'Missing')
 df - data.frame(x1=runif(100), x2=sample(f.level, 100, replace=T),
 x3=sample(f.level, 100, replace=T))

 I try changing the values by
 df[df %in% c('Not applicable', 'Invalid', 'Missing'), ] - NA

 but nothing seems to change
 summary(df)

 My data frame has many more factors. Any advice?

 Thank you,
 Daniel

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



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
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] climstats

2013-09-30 Thread David Winsemius

On Sep 30, 2013, at 3:25 AM, Jenny Williams wrote:

 I have been trying to download the climstats package:
 https://r-forge.r-project.org/R/?group_id=861
 
 but it doesn't seem to run on R 3.0.2 or 3.0.1

What makes you say this? What errors are reprorted? (Doesn't seems to run is 
a bit vague.)

 and the zipfile is empty.

I was able to install version 1.0 from sources with:

install.packages(climstats, repos=http://R-Forge.R-project.org;, 
type=source)

(I agree that the zipfile for Windows was not found.)

R version 3.0.1 Patched (2013-07-23 r63392) Running Mac OS 10.7.5. It appears 
to require a fair number of external package, so you would need to check the 
Depends in the description file. 

Depends: R (= 2.13), raster, rgdal, chron, zoo, sp, ncdf, R.utils

It did not appear to do any C or Fortran compiling, so I think that means you 
do not need to have RTools installed on Windows.

But since it requires rgdal, you would need to have GDAL installed if you were 
to get it to load.


 
 Does anyone know the status of this package or where I can download it.
 
 Thanks
 
 **
 Jenny Williams
 Spatial Information Scientist, GIS Unit
 Herbarium, Library, Art  Archives Directorate
 Royal Botanic Gardens, Kew
 Richmond, TW9 3AB, UK
 
 Tel: +44 (0)208 332 5277
 email: jenny.willi...@kew.orgmailto:jenny.willi...@kew.org
 **
 
 Film: The Forgotten Home of Coffee - Beyond the 
 Gardenshttp://www.youtube.com/watch?v=-uDtytKMKpAsns=tw
 Stories: Coffee Expedition - 
 Ethiopiahttp://storify.com/KewGIS/coffee-expedition-ethiopia
 Blog: Discovering Coffee in Ethiopia
 http://www.kew.org/news/kew-blogs/incrEdibles-food-blog/discovering-coffee.htm
 Kew in Harapan Rainforest 
 Sumatrahttp://storify.com/KewGIS/kew-in-harapan-rainforest
 Articles: Seeing the wood for the 
 treeshttp://www.kew.org/ucm/groups/public/documents/document/kppcont_060602.pdf
 How Kew's GIS team and South East Asia botanists are working to help conserve 
 and restore a rainforest in Sumatra. Download a pdf of this article 
 here.http://www.kew.org/ucm/groups/public/documents/document/kppcont_060602.pdf
 
 
 
 The Royal Botanic Gardens, Kew is a non-departmental public body with exempt 
 charitable status, whose principal place of business is at Royal Botanic 
 Gardens, Kew, Richmond, Surrey TW9 3AB, United Kingdom.
 
 The information contained in this email and any attachments is intended 
 solely for the addressee(s) and may contain confidential or legally 
 privileged information. If you have received this message in error, please 
 return it immediately and permanently delete it. Do not use, copy or disclose 
 the information contained in this email or in any attachment.
 
 Any views expressed in this email do not necessarily reflect the opinions of 
 RBG Kew.
 
 Any files attached to this email have been inspected with virus detection 
 software by RBG Kew before transmission, however you should carry out your 
 own virus checks before opening any attachments. RBG Kew accepts no liability 
 for any loss or damage which may be caused by software viruses.
 
   [[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.

David Winsemius
Alameda, CA, USA

__
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] Interperting results of glmnet and coxph plot, Brier score and Harrel's C-Index - am I doing something wrong ???

2013-09-30 Thread David Winsemius

On Sep 29, 2013, at 2:16 PM, E Joffe wrote:

 HI,
 
 Thank you for your answer.
 There were 301 events out of 394 observations.
 
 Study goals: Identify proteins with prognostic power in patients with AML.
 There were 232 proteins studied.
 Traditional models won't converge.
 I wanted to do a multivariate survival analysis that would allow me to
 identify prognostic proteins and get an estimation of their hazard ratio.
 LASSO allowed me to model the data but in order to get the HRs I needed to
 run it a second time throw coxph - this was done based on a discussion on
 stackexchange

http://r.789695.n4.nabble.com/estimating-survival-times-with-glmnet-and-coxph-td4614225.html

  which I tweaked a bit.
 
 
 The features selected by LASSO are not necessarily all significant when
 constructing a coxph model in particular due to the lack of penalization.
 This was commented on by Dr. Hastie in one of his papers (or in the video
 lecture he gave - I need to find the exact source).
 I understand that by doing this procedure I might be reducing the accuracy
 of the model which is why I used a bootstrap evaluation.
 Interestingly, the coxph models following stepwise feature selection had
 marginally better performance in the evaluation compared with the LASSO
 models (maybe the LASSO over-fit the data a bit ? - don't know)
 
 What I still don't understand is why with a C-Index of 0.76 and a Brier
 score of 0.07 when I look at the plot of the coxph object the confidence
 intervals are so far ?

The item you referenced was not on stackexchange but rather on Nabble. The 
archived copy in R-help is here:

[R] Estimating survival times with glmnet and coxph 

https://stat.ethz.ch/pipermail/r-help/2012-May/312029.html
https://stat.ethz.ch/pipermail/r-help/2012-May/312038.html

The response from Terry Therneau at that time explained why the CI's were wide. 
I think this implies that even without the additional (faulty) step of stepwise 
reduction in covariates you still would not be able to use the CI's coxphfrom 
such a fit.


-- 
David.
 Further, I am wondering whether there is a sanity check I could perform to
 make sure there is no error in the Brier/C-Index evaluation.
 
 Thanks again for all you advice on this project,
 Erel
 
 
 
 -Original Message-
 From: David Winsemius [mailto:dwinsem...@comcast.net] 
 Sent: Saturday, September 28, 2013 4:41 PM
 To: E Joffe
 Cc: r-help@r-project.org
 Subject: Re: [R] Interperting results of glmnet and coxph plot, Brier score
 and Harrel's C-Index - am I doing something wrong ???
 
 
 On Sep 28, 2013, at 2:39 AM, E Joffe wrote:
 
 Hi all,
 
 I am using COX LASSO (glmnet / coxnet) regression to analyze a dataset 
 of
 394 obs. / 268 vars.
 I use the following procedure:
 1.   Construct a coxnet on the entire dataset (by cv.glmnet)
 2.   Pick the significant features by selecting the non-zero coefficient
 under the best lambda selected by the model
 3.   Build a coxph model with bi-directional stepwise feature selection
 limited to the coxnet selected features.
 
 I was a bit puzzled by the third step. Once you had a reduced model from
 glmnet, what was the statistical basis for further elimination of variables?
 
 (Quite apart from the statistical issues, I was rather surprised that this
 procedure even produced results since the 'step' function is not described
 in the 'stats' package as applying to 'coxph' model objects.)
 
  
 To validate the model I use both Brier score (library=peperr) and  
 Harrel's [Harrell]
 C-Index (library=Hmisc) with a bootstrap of 50 iterations.
 
 
 MY QUESTION :  I am getting fairly good C-Index (0.76) and Brier  
 (0.07)
 values for the models however per the coxnet the %Dev explained by  
 the model
 is at best 0.27 and when I plot the survfit of the coxph the plotted
 confidence interval is very large.
 
 How many events did you have?  (The width of CI's is most importantly  
 dependent on event counts and not particularly improved by a high case  
 count. The power considerations are very similar to those of a  
 binomial test.)
 
 
 What am I missing here ?
 
 Perhaps sufficient events? (You also seem to be missing a description  
 of the study goals.)
 
 
 -- 
 David.
 
 
 %DEV=27%
 
 
 
 Brier score - 0.07  ($ipec.coxglmnet - [1] 7.24)
 C-Index - 0.76 ($cIndex - [1] 0.763)
 
 
 
 DATA: [Private Health Information - can't publish] 394 obs./268 vars.
 
 CODE (need to define a dataset with 'time' and 'status' variables):
 
 library(survival)
 library (glmnet)
 library (c060)
 library (peperr)
 library (Hmisc)
 
   #creat Y (survival matrix) for glmnet
   surv_obj - Surv(dataset$time,dataset$status)
 
 
   ## tranform categorical variables into binary variables with  
 dummy for
 dataset
   predict_matrix - model.matrix(~ ., data=dataset,
  contrasts.arg = lapply
 (dataset[,sapply(dataset, is.factor)], contrasts))
 
   ## remove the statu/time variables from the predictor matrix (x)  
 for
 glmnet
   

[R] FW: Library update from version

2013-09-30 Thread Cem Girit
Hello,

 

I recently installed version 3.0.1 of R on to a computer. I
have a working installation for a Statconn application using R version
2.15.0 on another computer. I have many libraries under this old
installation. Can I just copy them into the new library from the old, or do
I install each one of them under the new R? Also how can I get a list of
differences in two libraries so that I can use this list to update the new
one? 

 

Thank you.

 

Cem

 

 

__
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] get mouse position without waiting for a click

2013-09-30 Thread Greg Snow
Some code that you can look at for examples of capturing the mouse position
without clicking include the playSudoku function in the sudoku package and
several functions in the TeachingDemos package including HWidentify,
HTKidentify, dynIdentify, and TkIdentify.


On Mon, Sep 30, 2013 at 8:46 AM, Stanislav Aggerwal stan.agger...@gmail.com
 wrote:

 Consider the following:

 par(mar=c(0,0,0,0),xaxs = 'i',yaxs='i')
 plot.new()
 for(i in 1:20)
   {
   z - matrix(runif(256*256), ncol=256)
   dev.hold()
   image(z, col=grey(0:255/255),zlim=c(0,1),useRaster=TRUE)
   dev.flush()
   Sys.sleep(.1)
   }

 I would like to continuously display the animation until a mouse click
 happens. Obviously, locator() can't be used for this, because it will halt
 the animation while waiting for the mouse click. So something like this
 won't work:

 while((r-locator(n=1)) == NULL)
   {
   z - matrix(runif(256*256), ncol=256)
   dev.hold()
   image(z, col=grey(0:255/255),zlim=c(0,1),useRaster=TRUE)
   dev.flush()
   Sys.sleep(.1)
   }

 Can somebody suggest a way to get user input while displaying the
 animation? I am willing to use a keypress if not the mouse. Essentially, I
 need an input routine that does not wait for a response but just checks at
 one instant (like kbhit in C).

 Thanks very much for any help.

 Stan

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




-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

[[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] FW: Library update from version

2013-09-30 Thread Steve Lianoglou
Hi,

On Mon, Sep 30, 2013 at 11:12 AM, Cem Girit gi...@comcast.net wrote:
 Hello,



 I recently installed version 3.0.1 of R on to a computer. I
 have a working installation for a Statconn application using R version
 2.15.0 on another computer. I have many libraries under this old
 installation. Can I just copy them into the new library from the old, or do
 I install each one of them under the new R?

No, you shouldn't do that.

 Also how can I get a list of
 differences in two libraries so that I can use this list to update the new
 one?

A bit of googling could have provided several answers.

This post in particular has a few answers from some people who know
what they're doing w/ R, so probably a good place to start:

http://stackoverflow.com/questions/1401904/painless-way-to-install-a-new-version-of-r-on-windows

HTH,
-steve

-- 
Steve Lianoglou
Computational Biologist
Bioinformatics and Computational Biology
Genentech

__
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] ks.test or other Kolmogorov-Smirnov code

2013-09-30 Thread sitterlyb
Can any of the tools available provide where the supremum happens?

So classically D = sup|F1 - F2| or something to that affect, and then we use
D to figure out significance.  

If the ecdf is to be read as y=Pr(xx_i), for each x_i , well at which x_i
does D occur?

Sorry for the repetition just trying to give all the context of what I'm
asking.

Thanks in advance.



--
View this message in context: 
http://r.789695.n4.nabble.com/ks-test-or-other-Kolmogorov-Smirnov-code-tp4677290.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] get mouse position without waiting for a click

2013-09-30 Thread Stanislav Aggerwal
Very good question -- sorry to have left that info out of my posting.

windows()

Thanks for any help.

Bill


On Mon, Sep 30, 2013 at 4:46 PM, Bert Gunter gunter.ber...@gene.com wrote:

 On Windows or X11, (others ???)

 ?getGraphicsEvent

 Cheers,
 Bert

 On Mon, Sep 30, 2013 at 7:46 AM, Stanislav Aggerwal
 stan.agger...@gmail.com wrote:
  Consider the following:
 
  par(mar=c(0,0,0,0),xaxs = 'i',yaxs='i')
  plot.new()
  for(i in 1:20)
{
z - matrix(runif(256*256), ncol=256)
dev.hold()
image(z, col=grey(0:255/255),zlim=c(0,1),useRaster=TRUE)
dev.flush()
Sys.sleep(.1)
}
 
  I would like to continuously display the animation until a mouse click
  happens. Obviously, locator() can't be used for this, because it will
 halt
  the animation while waiting for the mouse click. So something like this
  won't work:
 
  while((r-locator(n=1)) == NULL)
{
z - matrix(runif(256*256), ncol=256)
dev.hold()
image(z, col=grey(0:255/255),zlim=c(0,1),useRaster=TRUE)
dev.flush()
Sys.sleep(.1)
}
 
  Can somebody suggest a way to get user input while displaying the
  animation? I am willing to use a keypress if not the mouse. Essentially,
 I
  need an input routine that does not wait for a response but just checks
 at
  one instant (like kbhit in C).
 
  Thanks very much for any help.
 
  Stan
 
  [[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.



 --

 Bert Gunter
 Genentech Nonclinical Biostatistics

 Internal Contact Info:
 Phone: 467-7374
 Website:

 http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm


[[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] ks.test or other Kolmogorov-Smirnov code

2013-09-30 Thread William Dunlap
 If the ecdf is to be read as y=Pr(xx_i), for each x_i , well at which x_i
 does D occur?

The definition is Pr(x = x_i), but that doesn't matter much here.

You know the maximum occurs at one of the points in union(x, y) so
you can find it by comparing the ecdf's at each of those points:
 f - function(x, y) {
 xy - union(x, y)
 d - abs(ecdf(x)(xy) - ecdf(y)(xy))
 xy[ d == max(d) ]
}

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf
 Of sitterlyb
 Sent: Monday, September 30, 2013 10:39 AM
 To: r-help@r-project.org
 Subject: [R] ks.test or other Kolmogorov-Smirnov code
 
 Can any of the tools available provide where the supremum happens?
 
 So classically D = sup|F1 - F2| or something to that affect, and then we use
 D to figure out significance.
 
 If the ecdf is to be read as y=Pr(xx_i), for each x_i , well at which x_i
 does D occur?
 
 Sorry for the repetition just trying to give all the context of what I'm
 asking.
 
 Thanks in advance.
 
 
 
 --
 View this message in context: http://r.789695.n4.nabble.com/ks-test-or-other-
 Kolmogorov-Smirnov-code-tp4677290.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] get mouse position without waiting for a click

2013-09-30 Thread Stanislav Aggerwal
thanks Greg
Bill

On Monday, September 30, 2013, Greg Snow 538...@gmail.com wrote:

 Some code that you can look at for examples of capturing the mouse
 position without clicking include the playSudoku function in the sudoku
 package and several functions in the TeachingDemos package including
 HWidentify, HTKidentify, dynIdentify, and TkIdentify.


 On Mon, Sep 30, 2013 at 8:46 AM, Stanislav Aggerwal 
 stan.agger...@gmail.com javascript:_e({}, 'cvml',
 'stan.agger...@gmail.com'); wrote:

 Consider the following:

 par(mar=c(0,0,0,0),xaxs = 'i',yaxs='i')
 plot.new()
 for(i in 1:20)
   {
   z - matrix(runif(256*256), ncol=256)
   dev.hold()
   image(z, col=grey(0:255/255),zlim=c(0,1),useRaster=TRUE)
   dev.flush()
   Sys.sleep(.1)
   }

 I would like to continuously display the animation until a mouse click
 happens. Obviously, locator() can't be used for this, because it will halt
 the animation while waiting for the mouse click. So something like this
 won't work:

 while((r-locator(n=1)) == NULL)
   {
   z - matrix(runif(256*256), ncol=256)
   dev.hold()
   image(z, col=grey(0:255/255),zlim=c(0,1),useRaster=TRUE)
   dev.flush()
   Sys.sleep(.1)
   }

 Can somebody suggest a way to get user input while displaying the
 animation? I am willing to use a keypress if not the mouse. Essentially, I
 need an input routine that does not wait for a response but just checks at
 one instant (like kbhit in C).

 Thanks very much for any help.

 Stan

 [[alternative HTML version deleted]]

 __
 R-help@r-project.org javascript:_e({}, 'cvml', 
 '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.




 --
 Gregory (Greg) L. Snow Ph.D.
 538...@gmail.com javascript:_e({}, 'cvml', '538...@gmail.com');


[[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] FW: Library update from version

2013-09-30 Thread Dennis Murphy
In this case the OP probably does need to reinstall contributed
packages since going from 2.15.x to 3.0.y entails a major version
change in R.

Dennis

On Mon, Sep 30, 2013 at 11:49 AM, Steve Lianoglou
lianoglou.st...@gene.com wrote:
 Hi,

 On Mon, Sep 30, 2013 at 11:12 AM, Cem Girit gi...@comcast.net wrote:
 Hello,



 I recently installed version 3.0.1 of R on to a computer. I
 have a working installation for a Statconn application using R version
 2.15.0 on another computer. I have many libraries under this old
 installation. Can I just copy them into the new library from the old, or do
 I install each one of them under the new R?

 No, you shouldn't do that.

 Also how can I get a list of
 differences in two libraries so that I can use this list to update the new
 one?

 A bit of googling could have provided several answers.

 This post in particular has a few answers from some people who know
 what they're doing w/ R, so probably a good place to start:

 http://stackoverflow.com/questions/1401904/painless-way-to-install-a-new-version-of-r-on-windows

 HTH,
 -steve

 --
 Steve Lianoglou
 Computational Biologist
 Bioinformatics and Computational Biology
 Genentech

 __
 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] FW: Library update from version

2013-09-30 Thread Ista Zahn
On Mon, Sep 30, 2013 at 2:49 PM, Steve Lianoglou
lianoglou.st...@gene.com wrote:
 Hi,

 On Mon, Sep 30, 2013 at 11:12 AM, Cem Girit gi...@comcast.net wrote:
 Hello,



 I recently installed version 3.0.1 of R on to a computer. I
 have a working installation for a Statconn application using R version
 2.15.0 on another computer. I have many libraries under this old
 installation. Can I just copy them into the new library from the old, or do
 I install each one of them under the new R?

 No, you shouldn't do that.

Really? Why not? Note that the Windows upgrade FAQ
(http://cran.r-project.org/bin/windows/base/rw-FAQ.html#What_0027s-the-best-way-to-upgrade_003f)
says to do exactly that.

Best,
Ista

 Also how can I get a list of
 differences in two libraries so that I can use this list to update the new
 one?

 A bit of googling could have provided several answers.

 This post in particular has a few answers from some people who know
 what they're doing w/ R, so probably a good place to start:

 http://stackoverflow.com/questions/1401904/painless-way-to-install-a-new-version-of-r-on-windows

 HTH,
 -steve

 --
 Steve Lianoglou
 Computational Biologist
 Bioinformatics and Computational Biology
 Genentech

 __
 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] ks.test or other Kolmogorov-Smirnov code

2013-09-30 Thread sitterlyb
sweet, I didn't know ecdf could be use like that!

Thanks!



--
View this message in context: 
http://r.789695.n4.nabble.com/ks-test-or-other-Kolmogorov-Smirnov-code-tp4677290p4677306.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] barplot - easy for experienced, difficult for me

2013-09-30 Thread Adams, Jean
Look at the example for grouped bar plots here,
http://www.statmethods.net/graphs/bar.html

Jean


On Mon, Sep 30, 2013 at 8:05 AM, happyR tobi_gebetsber...@gmx.at wrote:

 hey guys,

 I wanna make a simple barplot, looking like this excel graph:
 http://r.789695.n4.nabble.com/file/n4677251/barplot_invertebrates.jpg

 my data set includes 9 groups of invertebrates (x-axes) and total number
 (y-axes) from two different parks (1 and 2).

 my data-set looks like that:

 http://r.789695.n4.nabble.com/file/n4677251/barplot_invertebrates.jpg

 I'm a bloody beginner and happy for your help.

 ps: if you know what other graph could be interesting to make out of this
 very simple data, go ahead and let me know!









 --
 View this message in context:
 http://r.789695.n4.nabble.com/barplot-easy-for-experienced-difficult-for-me-tp4677251.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.


[[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] Apply function to do pairwise calculation

2013-09-30 Thread Adams, Jean
Amanda,

If I understand what you're trying to do, this example might help you.

M - structure(c(0.66, 0.05, -0.93, -0.61, 0.65, -0.25, 0.23, -0.89,
 0.37, 0.38, -0.91, 0.91, -0.05, -0.65, -0.94, 0.73, -0.88, 0.25,
0.04, -0.89, -0.47, -0.46, 0.86, -0.29, 0.92, 0.22, 0.77, -0.98,
 -0.56, 0.11, 0.35, -0.49, 0.48, 0.42, -0.28, 0.16, 0.2, 0.61,
0.7, 0.94, 0.89, 0.46, 0.93, 0.36, -0.95, -0.01, 0.27, 0.73,
 -0.17, -0.93, 0.36, 0.78, 0.02, -0.8, -0.57, -0.03, -0.81, -0.74,
0.16, 0.52, 0.65, -0.45, 0.46, -0.68, -0.85, 0.74, 0.77, -0.39,
 0.03, 0.93, -0.23, -0.91, -0.14, 0.77, -0.36, 0.43, -0.5, 0.5,
-0.68, -0.6, 0.12, -0.18, 0.16, -0.38, -0.18, -0.59, -0.3, -0.14,
 0.53, -0.53, -0.56, 0.14, -0.54, 0.93, 0.54, 0.03, 0.06, 0.14,
0.97, -0.09), .Dim = c(10L, 10L), .Dimnames = list(c(D, C,
 D, C, B, A, C, A, C, B), c(D, C, D, C,
 B, A, C, A, C, B)))

meanM - data.frame(row=NA, col=NA, mean=NA)

count - 0
for(i in 1:(ng-1)) {
for(j in (i+1):ng) {
count - count + 1
meanM[count, row] - groups[i]
 meanM[count, col] - groups[j]
meanM[count, mean] - mean(M[dimnames(M)[[1]]==groups[i],
dimnames(M)[[2]]==groups[j]])
 }}

Jean




On Mon, Sep 30, 2013 at 9:55 AM, Amanda Li amand...@uchicago.edu wrote:

 Hello,

 I want to do pairwise calculation, but I am not sure how to do so.

 i.e. I have a correlation matrix M 200*200. Namely colnames(M)=rownames(M).
 In addition, colnames(M) is one of A, B, C, D. I want to first sort the
 matrix M into 16 modules according to colnames and rownames, and then
 apply:
 avecor - function(x,y) {
 z - (sum(cor(x,y)*cor(x,y))/length(cor(x,y)))^0.5
 return(z)
 }

 So as to calculate the average correlation between A,B; A,C; A,D; B,C; B,D;
 C,D.

 Thanks in advance for your help!

 Best,
 Amanda

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


[R] multilevel analysis

2013-09-30 Thread srecko joksimovic
I have an example of multilevel analysis with 3 levels, but data are
non-normally distributed. In case of normal distribution, I would perform
multilevel linear analysis using lme function, but what should I do in case
of non-normal distribution?

thanks,
Srecko

[[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] FW: Library update from version

2013-09-30 Thread Steve Lianoglou
Hi,

On Mon, Sep 30, 2013 at 12:44 PM, Ista Zahn istaz...@gmail.com wrote:
 On Mon, Sep 30, 2013 at 2:49 PM, Steve Lianoglou
 lianoglou.st...@gene.com wrote:
 Hi,

 On Mon, Sep 30, 2013 at 11:12 AM, Cem Girit gi...@comcast.net wrote:
 Hello,



 I recently installed version 3.0.1 of R on to a computer. I
 have a working installation for a Statconn application using R version
 2.15.0 on another computer. I have many libraries under this old
 installation. Can I just copy them into the new library from the old, or do
 I install each one of them under the new R?

 No, you shouldn't do that.

 Really? Why not?

Because it has been my experience that people *just* do that (ie. the
*just* copy the libraries, as the OP asked).

But as you correctly point out:

 Note that the Windows upgrade FAQ
 (http://cran.r-project.org/bin/windows/base/rw-FAQ.html#What_0027s-the-best-way-to-upgrade_003f)
 says to do exactly that.

There is a way to copy the old package and then ensure that they are
updated to the versions that build correctly on the newest version of
R.


-steve

-- 
Steve Lianoglou
Computational Biologist
Bioinformatics and Computational Biology
Genentech

__
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] multilevel analysis

2013-09-30 Thread David Winsemius

On Sep 30, 2013, at 2:50 PM, srecko joksimovic wrote:

 I have an example of multilevel analysis with 3 levels, but data are
 non-normally distributed. In case of normal distribution, I would perform
 multilevel linear analysis using lme function, but what should I do in case
 of non-normal distribution?
 

But normal distribution is not a requirement for linear models. Please review 
your theory.

 thanks,
 Srecko
 
   [[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.

David Winsemius
Alameda, CA, USA

__
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] multilevel analysis

2013-09-30 Thread srecko joksimovic
I thought so, but then I found this:
Normality

The assumption of normality states that the error terms at every level of
the model are normally distributed

maybe I misinterpreted something.


On Mon, Sep 30, 2013 at 3:06 PM, David Winsemius dwinsem...@comcast.netwrote:


 On Sep 30, 2013, at 2:50 PM, srecko joksimovic wrote:

  I have an example of multilevel analysis with 3 levels, but data are
  non-normally distributed. In case of normal distribution, I would perform
  multilevel linear analysis using lme function, but what should I do in
 case
  of non-normal distribution?
 

 But normal distribution is not a requirement for linear models. Please
 review your theory.

  thanks,
  Srecko
 
[[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.

 David Winsemius
 Alameda, CA, USA



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

2013-09-30 Thread Daniel Nordlund


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
 On Behalf Of srecko joksimovic
 Sent: Monday, September 30, 2013 3:22 PM
 To: David Winsemius
 Cc: R help
 Subject: Re: [R] multilevel analysis
 
 I thought so, but then I found this:
 Normality
 
 The assumption of normality states that the error terms at every level of
 the model are normally distributed
 
 maybe I misinterpreted something.
 

Yes, error terms (i.e. residuals), not your raw data, should be normally 
distributed if you are going to conduct significance tests that rely on the 
assumption of normality.  But as David said, the assumption of normality (in 
any form) is not necessary for estimating linear models.

Dan


 
 On Mon, Sep 30, 2013 at 3:06 PM, David Winsemius
 dwinsem...@comcast.netwrote:
 
 
  On Sep 30, 2013, at 2:50 PM, srecko joksimovic wrote:
 
   I have an example of multilevel analysis with 3 levels, but data are
   non-normally distributed. In case of normal distribution, I would
 perform
   multilevel linear analysis using lme function, but what should I do in
  case
   of non-normal distribution?
  
 
  But normal distribution is not a requirement for linear models. Please
  review your theory.
 
   thanks,
   Srecko
  
 [[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.
 
  David Winsemius
  Alameda, CA, USA
 
 


Daniel Nordlund
Bothell, WA USA
 

__
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] multilevel analysis

2013-09-30 Thread David Winsemius

On Sep 30, 2013, at 3:22 PM, srecko joksimovic wrote:

 I thought so, but then I found this:
 Normality
 The assumption of normality states that the error terms at every level of the 
 model are normally distributed
 maybe I misinterpreted something. 

Notice that it is the _error_terms_ that are to be normally distributed, not 
the data itself. One might even infer that normally distrited data might be 
suspect because the correct distribution should be a mixture of normals. Since 
the errors never are going to fit on a straight line on a QQ plot, the real 
question is how far from Normal and what the impact might be on the 
quantities being estimated.

-- 
David.
 
 
 On Mon, Sep 30, 2013 at 3:06 PM, David Winsemius dwinsem...@comcast.net 
 wrote:
 
 On Sep 30, 2013, at 2:50 PM, srecko joksimovic wrote:
 
  I have an example of multilevel analysis with 3 levels, but data are
  non-normally distributed. In case of normal distribution, I would perform
  multilevel linear analysis using lme function, but what should I do in case
  of non-normal distribution?
 
 
 But normal distribution is not a requirement for linear models. Please review 
 your theory.
 
  thanks,
  Srecko
 
[[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.
 
 David Winsemius
 Alameda, CA, USA
 
 

David Winsemius
Alameda, CA, USA

__
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] multilevel analysis

2013-09-30 Thread srecko joksimovic
Thanks for your comments, David and Bert.
The best would be to provide an example. Let's say we have a dataset like
this one:
IDEmployee Company OU CountViewPortal CountLogin TimeOnTask Performance
1 Company1 Company1.OU1 21 33 627.8 4.3
2 Company1 Company1.OU2 45 54 34.8 2.3
3 Company2 Company1.OU1 23 33 3.8 1.0
4 Company2 Company1.OU1 34 12 44.8 2.3
5 Company2 Company1.OU2 55 22 55.8 4.5
6 Company2 Company1.OU3 45 44 34.8 3

I want to see if there is correlation between CountViewPortal and
Performance. Moreover, I'd like to reveal the influence of
CountViewPortal+TimeOnTask on Performance.
However, I expect that employees within a OU, and than a Company have
similar behavior. Thus, I'll have 3 levels - employee, OU, Company. In R,
I would do something like this:
randomInterceptCount - lme(Performance ~ CountViewPortal, data=analysis,
random=~1|OU/Company1, method=ML)

But, then the point is that CountViewPortal, CountLogin and TimeOnTask are
non-normally distributed. I guess that my question is, what should I do in
case of non-normal distribution?

I really appreciate your help. Thanks again!
Srecko


On Mon, Sep 30, 2013 at 5:14 PM, David Winsemius dwinsem...@comcast.netwrote:


 On Sep 30, 2013, at 3:22 PM, srecko joksimovic wrote:

  I thought so, but then I found this:
  Normality
  The assumption of normality states that the error terms at every level
 of the model are normally distributed
  maybe I misinterpreted something.

 Notice that it is the _error_terms_ that are to be normally distributed,
 not the data itself. One might even infer that normally distrited data
 might be suspect because the correct distribution should be a mixture of
 normals. Since the errors never are going to fit on a straight line on a QQ
 plot, the real question is how far from Normal and what the impact might
 be on the quantities being estimated.

 --
 David.
 
 
  On Mon, Sep 30, 2013 at 3:06 PM, David Winsemius dwinsem...@comcast.net
 wrote:
 
  On Sep 30, 2013, at 2:50 PM, srecko joksimovic wrote:
 
   I have an example of multilevel analysis with 3 levels, but data are
   non-normally distributed. In case of normal distribution, I would
 perform
   multilevel linear analysis using lme function, but what should I do in
 case
   of non-normal distribution?
  
 
  But normal distribution is not a requirement for linear models. Please
 review your theory.
 
   thanks,
   Srecko
  
 [[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.
 
  David Winsemius
  Alameda, CA, USA
 
 

 David Winsemius
 Alameda, CA, USA



[[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] [sm.density.compare] scale up y-axis and additional line type

2013-09-30 Thread Xianwen Chen

Dear fellows,

The two questions are on sm.density.compare(). I compare kernel density 
estimates of two arrays of data.


I'd like to scale up y-axis so that I can show better the differences in 
y values. English is not my first language so I'll try to explain it. I 
would like to stretch y-axis a bit longer but not to change the range of 
y values. How can I do this?


Second, I'm using a solid line for one array of date and a dashed line 
for another array of data. The difference is not easy to see, because 
the two curves are approximate to some degree. Is it possible to plot 
one array of data with *, instead of dash?


Thanks!

Kind regards,

Xianwen

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