[R] .jinit() : Cannot create Java virtual machine

2011-11-14 Thread ahwangyuwei
Dear all,
when using .jinit() I get the message .jinit() : Cannot create Java 
virtual machine (-1).
The details:
I am using the Dismo package.Dismo has a function 'maxent' that communi-cates 
with this program(MaxEnt).MaxEnt is available as a stand-alone Java program. 
It is normal when I execute the command :"jar <- 
paste(system.file(package="dismo"), "/java/maxent.jar", sep='')" when I execute 
the function:xm <- maxent(predictors, pres_train, factors='biome').The 
R show the error(Cannot create Java virtual machine) .  Java is correct 
installed .
My R version is 2.14.0.
 I don't know how to solve the problem. Will you help me out?
Thank you,all. 
  Yuwei Wang
Cnic,CAS
  

[[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 in fitted values in lm function

2011-11-14 Thread arunkumar1111
Hi,

I have a data set of 1 rows and ran a linear regression by using the
function lmres = lm(formula,data)

then got the fitted value by using the value fit=fitted(lmres).

but the number of rows in the fitted one is about 9548,

What could be the reason for reduction in the number of rows in the fitted
one 

--
View this message in context: 
http://r.789695.n4.nabble.com/help-in-fitted-values-in-lm-function-tp4038642p4038642.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] .jinit() : Cannot create Java virtual machine

2011-11-14 Thread ahwangyuwei
Dear all,
when using .jinit() I get the message .jinit() : Cannot create Java 
virtual machine (-1).
sessionInfo() R version 2.14.0 (2011-10-31)Platform: i386-pc-mingw32/i386 
(32-bit)locale:[1] LC_COLLATE=Chinese_People's Republic of China.936 [2] 
LC_CTYPE=Chinese_People's Republic of China.936   [3] 
LC_MONETARY=Chinese_People's Republic of China.936[4] LC_NUMERIC=C  
[5] LC_TIME=Chinese_People's Republic of China.936
attached base packages:[1] stats graphics  grDevices utils datasets  
methods   base other attached packages:[1] maptools_0.8-10 lattice_0.20-0  
foreign_0.8-46  rJava_0.9-1[5] dismo_0.7-11raster_1.9-41   sp_0.9-91
  loaded via a namespace (and not attached):[1] grid_2.14.0> The details:
I am using the Dismo package.Dismo has a function 'maxent' that communi-cates 
with this program(MaxEnt).MaxEnt is available as a stand-alone Java program. 
It is normal when I execute the command :"jar <- 
paste(system.file(package="dismo"), "/java/maxent.jar", sep='')" when I execute 
the function:xm <- maxent(predictors, pres_train, factors='biome').The 
R show the error(Cannot create Java virtual machine) .  Java is correct 
installed .
My R version is 2.14.0.
 I don't know how to solve the problem. Will you help me out?
Thank you,all. 
  Yuwei Wang
Cnic,CAS
  

[[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] Error .jcall(mxe, "S", "fit", c("autorun", "-e", afn, "-o", dirout, : java.lang.NoSuchMethodError: density.Params.readFromArgs([Ljava/lang/String; )Ljava/lang/String;

2011-11-14 Thread ahwangyuwei
Dear all,
I get the error when I use maxent.jar:
Error .jcall(mxe, "S", "fit", c("autorun", "-e", afn, "-o", dirout,  : 
  java.lang.NoSuchMethodError: 
density.Params.readFromArgs([Ljava/lang/String;)Ljava/lang/String;

sessionInfo() result: 
R version 2.14.0 (2011-10-31)Platform: i386-pc-mingw32/i386 (32-bit)locale:[1] 
LC_COLLATE=Chinese_People's Republic of China.936 [2] LC_CTYPE=Chinese_People's 
Republic of China.936   [3] LC_MONETARY=Chinese_People's Republic of 
China.936[4] LC_NUMERIC=C  [5] 
LC_TIME=Chinese_People's Republic of China.936attached base packages:[1] 
stats graphics  grDevices utils datasets  methods   base other 
attached packages:[1] maptools_0.8-10 lattice_0.20-0  foreign_0.8-46  
rJava_0.9-2[5] dismo_0.7-11raster_1.9-41   sp_0.9-91  loaded via a 
namespace (and not attached):[1] grid_2.14.0>  The details:
I am using the Dismo package.Dismo has a function 'maxent' that communi-cates 
with this program(MaxEnt).MaxEnt is available as a stand-alone Java program. 
It is normal when I execute the command :"jar <- 
paste(system.file(package="dismo"), "/java/maxent.jar", sep='')" when I execute 
the function:xm <- maxent(predictors, pres_train, factors='biome').The 
R show the error.  Java is correct installed ,version is 1.60._18.
My R version is 2.14.0.
 I don't know how to solve the problem. Will you help me out?
Thank you,all. 
  Yuwei Wang
Cnic,CAS
  

[[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] Confused with an error message related to "plotrix" library in the newer versions of R.

2011-11-14 Thread Jim Lemon

On 11/14/2011 05:59 PM, Prasanth V P wrote:

require(plotrix)



xy.pop<- c(17,15,13,11,9,8,6,5,4,3,2,2,1,3)

xx.pop<- c(17,14,12,11,11,8,6,5,4,3,2,2,2,3)

agelabels<- c("0-4","5-9","10-14","15-19","20-24","25-29","30-34",


"35-39","40-44","45-49","50-54","55-59","60-64","65+")



xycol<-color.gradient(c(0,0,0.5,0.15),c(0.25,0.5,0.5,1.75),c(0.5,1.5,1,0),18)

xxcol<-color.gradient(c(0,1,0.5,1),c(0.25,0.5,0.5,1.25),c(0.5,0.25,0.5,1.5),18)

par(mar=pyramid.plot(xy.pop,xx.pop,labels=agelabels, labelcex=1.125,

 main="Population Pyramid -- Malawi", xycol=xycol,
xxcol=xxcol))


Hi Prasanth V P,
Just a typo. Try this:

par(mar=pyramid.plot(xy.pop,xx.pop,labels=agelabels,labelcex=1.125,
 main="Population Pyramid -- Malawi", lxcol=xycol,rxcol=xxcol))

Nice plot.

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] help in fitted values in lm function

2011-11-14 Thread Petr PIKAL
Hi

> 
> Hi,
> 
> I have a data set of 1 rows and ran a linear regression by using the
> function lmres = lm(formula,data)
> 
> then got the fitted value by using the value fit=fitted(lmres).
> 
> but the number of rows in the fitted one is about 9548,
> 
> What could be the reason for reduction in the number of rows in the 
fitted
> one 

Some NA values in your data?

Petr

> 
> --
> View this message in context: http://r.789695.n4.nabble.com/help-in-
> fitted-values-in-lm-function-tp4038642p4038642.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.


[R] regular expression for selection

2011-11-14 Thread Petr PIKAL
Dear all

I am again (as usual) lost in regular expression use for selection. Here 
are my data:

> dput(mena)
c("138516_10g_50ml_50c_250utes1_m53.00-_s1.imp", 
"138516_10g_50ml_50c_250utes1_m54.00_s1.imp", 
"138516_10g_50ml_50c_250utes1_m55.00_s1.imp", 
"138516_10g_50ml_50c_250utes1_m56.00_s1.imp", 
"138516_10g_50ml_50c_250utes1_m57.00_s1.imp", 
"138516_10g_50ml_50c_250utes1_m58.00_s1.imp", 
"138516_10g_50ml_50c_250utes1_m59.00_s1.imp")

I want to select only values "m" foolowed by numbers from 53 to 59.

I used

sub("m5.", "", mena)

which correctly selects those m53 - m59 values but, in contrary to my 
expectation, it replaced the selected values with specified replacement - 
in that case empty string. 

What I shall use if I want to get rid of all but m53-m59 from those 
strings?

Regards
Petr

__
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] regular expression for selection

2011-11-14 Thread baptiste auguie
Hi,

Try grepl instead of sub,

mena[grepl("m5.", mena)]

HTH,

baptiste

On 14 November 2011 21:45, Petr PIKAL  wrote:
> Dear all
>
> I am again (as usual) lost in regular expression use for selection. Here
> are my data:
>
>> dput(mena)
> c("138516_10g_50ml_50c_250utes1_m53.00-_s1.imp",
> "138516_10g_50ml_50c_250utes1_m54.00_s1.imp",
> "138516_10g_50ml_50c_250utes1_m55.00_s1.imp",
> "138516_10g_50ml_50c_250utes1_m56.00_s1.imp",
> "138516_10g_50ml_50c_250utes1_m57.00_s1.imp",
> "138516_10g_50ml_50c_250utes1_m58.00_s1.imp",
> "138516_10g_50ml_50c_250utes1_m59.00_s1.imp")
>
> I want to select only values "m" foolowed by numbers from 53 to 59.
>
> I used
>
> sub("m5.", "", mena)
>
> which correctly selects those m53 - m59 values but, in contrary to my
> expectation, it replaced the selected values with specified replacement -
> in that case empty string.
>
> What I shall use if I want to get rid of all but m53-m59 from those
> strings?
>
> Regards
> Petr
>
> __
> 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] regular expression for selection

2011-11-14 Thread Jim Lemon

On 11/14/2011 07:45 PM, Petr PIKAL wrote:

Dear all

I am again (as usual) lost in regular expression use for selection. Here
are my data:


dput(mena)

c("138516_10g_50ml_50c_250utes1_m53.00-_s1.imp",
"138516_10g_50ml_50c_250utes1_m54.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m55.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m56.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m57.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m58.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m59.00_s1.imp")

I want to select only values "m" foolowed by numbers from 53 to 59.

I used

sub("m5.", "", mena)

which correctly selects those m53 - m59 values but, in contrary to my
expectation, it replaced the selected values with specified replacement -
in that case empty string.

What I shall use if I want to get rid of all but m53-m59 from those
strings?


Hi Petr,
How about:

grep("m5",mena)

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] regular expression for selection

2011-11-14 Thread Petr PIKAL
Hi

> 
> Hi,
> 
> Try grepl instead of sub,
> 
> mena[grepl("m5.", mena)]

It does not select those "m5?" strings from those character vectors. I 
need as an output a vector

m53, m54, m55, m56, m57, m58, m59

Regards
Petr


> 
> HTH,
> 
> baptiste
> 
> On 14 November 2011 21:45, Petr PIKAL  wrote:
> > Dear all
> >
> > I am again (as usual) lost in regular expression use for selection. 
Here
> > are my data:
> >
> >> dput(mena)
> > c("138516_10g_50ml_50c_250utes1_m53.00-_s1.imp",
> > "138516_10g_50ml_50c_250utes1_m54.00_s1.imp",
> > "138516_10g_50ml_50c_250utes1_m55.00_s1.imp",
> > "138516_10g_50ml_50c_250utes1_m56.00_s1.imp",
> > "138516_10g_50ml_50c_250utes1_m57.00_s1.imp",
> > "138516_10g_50ml_50c_250utes1_m58.00_s1.imp",
> > "138516_10g_50ml_50c_250utes1_m59.00_s1.imp")
> >
> > I want to select only values "m" foolowed by numbers from 53 to 59.
> >
> > I used
> >
> > sub("m5.", "", mena)
> >
> > which correctly selects those m53 - m59 values but, in contrary to my
> > expectation, it replaced the selected values with specified 
replacement -
> > in that case empty string.
> >
> > What I shall use if I want to get rid of all but m53-m59 from those
> > strings?
> >
> > Regards
> > Petr
> >
> > __
> > 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 with text separation

2011-11-14 Thread Michael Griffiths
Good morning R list,

My apologies if this has *already* answered elsewhere, but I have not found
the answer that I am looking for.

I have a character string, i.e.


form<-c('~ A + B + C + C / D + E + E / F + G + H + I + J + K + L * M')

Now, my aim is to find the position of all those instances of '*' and to
remove said '*'. However, I would also like to remove the preceding
variable name before the '*', the math operator preceding this, and also
the variable name after the '*'. So, here I would like to remove '+L*M'

So, far I have come up with the following code:

parts<-strsplit(form,' ')
index<-which(unlist(parts)=="*")
for (i in 1:length(index)){
parts[[1]][index[i]]<-list(NULL)
parts[[1]][index[i]+1]<-list(NULL)
parts[[1]][index[i]-1]<-list(NULL)
parts[[1]][index[i]-2]<-list(NULL)
}
new.form<-unlist(parts)

form<-new.form[0]
for (i in 1: length(new.form)){
form<-paste(form,new.form[i], sep="")
}

However, as you can see, I have had to use strsplit in, what I consider a
rather clumsy manner, as the character string (form) has to be in a certain
format. All variables and maths operators require a space between them in
order for strsplit to work in the manner I require.

I would very much like to accomplish what the above code already does, but
without the need for the initial character string having the need for the
aforementioned spaces.

If the list can offer help, I would be most appreciative.

Yours

Mike Griffiths




-- 

*Michael Griffiths, Ph.D
*Statistician

*Upstream Systems*

8th Floor
Portland House
Bressenden Place
SW1E 5BH



Tel   +44 (0) 20 7869 5147
Fax  +44 207 290 1321
Mob +44 789 4944 145

www.upstreamsystems.com

*griffi...@upstreamsystems.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] regular expression for selection

2011-11-14 Thread Petr PIKAL
Hi

> On 11/14/2011 07:45 PM, Petr PIKAL wrote:
> > Dear all
> >
> > I am again (as usual) lost in regular expression use for selection. 
Here
> > are my data:
> >
> >> dput(mena)
> > c("138516_10g_50ml_50c_250utes1_m53.00-_s1.imp",
> > "138516_10g_50ml_50c_250utes1_m54.00_s1.imp",
> > "138516_10g_50ml_50c_250utes1_m55.00_s1.imp",
> > "138516_10g_50ml_50c_250utes1_m56.00_s1.imp",
> > "138516_10g_50ml_50c_250utes1_m57.00_s1.imp",
> > "138516_10g_50ml_50c_250utes1_m58.00_s1.imp",
> > "138516_10g_50ml_50c_250utes1_m59.00_s1.imp")
> >
> > I want to select only values "m" foolowed by numbers from 53 to 59.
> >
> > I used
> >
> > sub("m5.", "", mena)
> >
> > which correctly selects those m53 - m59 values but, in contrary to my
> > expectation, it replaced the selected values with specified 
replacement -
> > in that case empty string.
> >
> > What I shall use if I want to get rid of all but m53-m59 from those
> > strings?
> >
> Hi Petr,
> How about:
> 
> grep("m5",mena)

It gives numeric values which tells me that there is a match in each 
string, but as a result I need only

m53-m59 substrings.

Regards
Petr



> 
> 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] Running totals

2011-11-14 Thread Mark Carter
>From: Joshua Wiley 


>dat$RTotal <- cumsum(dat$BAL)



Wow, that's really great. I'm starting to really enjoy using R. My statistical 
needs are not that great, but I love the way that R handles tabular data.


__
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] regular expression for selection

2011-11-14 Thread Uwe Ligges



On 14.11.2011 10:22, Petr PIKAL wrote:

Hi


On 11/14/2011 07:45 PM, Petr PIKAL wrote:

Dear all

I am again (as usual) lost in regular expression use for selection.

Here

are my data:


dput(mena)

c("138516_10g_50ml_50c_250utes1_m53.00-_s1.imp",
"138516_10g_50ml_50c_250utes1_m54.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m55.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m56.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m57.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m58.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m59.00_s1.imp")

I want to select only values "m" foolowed by numbers from 53 to 59.

I used

sub("m5.", "", mena)

which correctly selects those m53 - m59 values but, in contrary to my
expectation, it replaced the selected values with specified

replacement -

in that case empty string.

What I shall use if I want to get rid of all but m53-m59 from those
strings?


Hi Petr,
How about:

grep("m5",mena)


It gives numeric values which tells me that there is a match in each
string, but as a result I need only

m53-m59 substrings.



gsub(".*_(m5.).*", "\\1", mena)

Uwe Ligges




Regards
Petr





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.


__
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] Confused with an error message related to "plotrix" library in the newer versions of R.

2011-11-14 Thread Prasanth V P
Hi Jim,

It's working perfectly fine with the "rxcol" parameter. I am just
wondering how could I miss that..!!!
By the way, many thanks for pointing it out... Otherwise, I would have
been using the old version of R for just getting the required plot.

Much Appreciated,
Prasanth.

-Original Message-
From: Jim Lemon [mailto:j...@bitwrit.com.au]
Sent: 14 November 2011 13:39
To: Prasanth V P
Cc: r-help@r-project.org
Subject: Re: [R] Confused with an error message related to "plotrix"
library in the newer versions of R.

On 11/14/2011 05:59 PM, Prasanth V P wrote:
> require(plotrix)
>
>
>
> xy.pop<- c(17,15,13,11,9,8,6,5,4,3,2,2,1,3)
>
> xx.pop<- c(17,14,12,11,11,8,6,5,4,3,2,2,2,3)
>
> agelabels<- c("0-4","5-9","10-14","15-19","20-24","25-29","30-34",
>
>
> "35-39","40-44","45-49","50-54","55-59","60-64","65+")
>
>
>
>
xycol<-color.gradient(c(0,0,0.5,0.15),c(0.25,0.5,0.5,1.75),c(0.5,1.5,1,0),
18)
>
>
xxcol<-color.gradient(c(0,1,0.5,1),c(0.25,0.5,0.5,1.25),c(0.5,0.25,0.5,1.5
),18)
>
> par(mar=pyramid.plot(xy.pop,xx.pop,labels=agelabels, labelcex=1.125,
>
>  main="Population Pyramid -- Malawi", xycol=xycol,
> xxcol=xxcol))

Hi Prasanth V P,
Just a typo. Try this:

par(mar=pyramid.plot(xy.pop,xx.pop,labels=agelabels,labelcex=1.125,
  main="Population Pyramid -- Malawi", lxcol=xycol,rxcol=xxcol))

Nice plot.

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.


[R] Automatic Labeling of Document Clusters

2011-11-14 Thread vioravis
I am performing document clustering on a set of documents using R. I
performed hierarchical clustering using hclust and have identified the
cluster corresponding to each data point. I would like to lablel each
cluster automatically in order to identify the top keywords associated with
each cluster. This would help me in validating the clusters.

Are there any packages in R that helps us do automatic labelling of
clusters???

A few clustering labeling methods are given here:

http://en.wikipedia.org/wiki/Cluster_labeling
http://erulemaking.ucsur.pitt.edu/doc/papers/dgo06-labeling.pdf


Thanks you.

Ravi

--
View this message in context: 
http://r.789695.n4.nabble.com/Automatic-Labeling-of-Document-Clusters-tp4038849p4038849.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] regular expression for selection

2011-11-14 Thread Rainer Schuermann
Does

library( stringr )
str_extract( mena, "m5[0-9]" )

achieve what you are looking for?

Rgds,
Rainer


On Monday 14 November 2011 10:22:09 Petr PIKAL wrote:
> Hi
> 
> > On 11/14/2011 07:45 PM, Petr PIKAL wrote:
> > > Dear all
> > > 
> > > I am again (as usual) lost in regular expression use for
> > > selection.
> 
> Here
> 
> > > are my data:
> > >> dput(mena)
> > > 
> > > c("138516_10g_50ml_50c_250utes1_m53.00-_s1.imp",
> > > "138516_10g_50ml_50c_250utes1_m54.00_s1.imp",
> > > "138516_10g_50ml_50c_250utes1_m55.00_s1.imp",
> > > "138516_10g_50ml_50c_250utes1_m56.00_s1.imp",
> > > "138516_10g_50ml_50c_250utes1_m57.00_s1.imp",
> > > "138516_10g_50ml_50c_250utes1_m58.00_s1.imp",
> > > "138516_10g_50ml_50c_250utes1_m59.00_s1.imp")
> > > 
> > > I want to select only values "m" foolowed by numbers from 53 to
> > > 59.
> > > 
> > > I used
> > > 
> > > sub("m5.", "", mena)
> > > 
> > > which correctly selects those m53 - m59 values but, in contrary
> > > to my expectation, it replaced the selected values with
> > > specified
> replacement -
> 
> > > in that case empty string.
> > > 
> > > What I shall use if I want to get rid of all but m53-m59 from
> > > those
> > > strings?
> > 
> > Hi Petr,
> > How about:
> > 
> > grep("m5",mena)
> 
> It gives numeric values which tells me that there is a match in each
> string, but as a result I need only
> 
> m53-m59 substrings.
> 
> Regards
> Petr
> 
> > 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.

__
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] arrow egdes and lty

2011-11-14 Thread Matthias Gondan
Dear R developers,

I want to draw an arrow in a figure with lty=2. The
lty argument also affects the edge of the arrow, which is 
unfortunate. Feature or bug?

Is there some way to draw an arrow with intact edge, still
with lty=2?

Example code:

plot(1:10)
arrows(4, 5, 6, 7, lty=2)

Best wishes,

Matthias
--

__
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] What is the CADF test criterion="BIC" report?

2011-11-14 Thread Pfaff, Bernhard Dr.
Hello Paul,

just a guess: different sample sizes! In your first call, the sample is shorter 
than in your second. Hence, you can test this, if you curtail your data set in 
your second call and then you should obtain the same result, i.e.:

> library(vars)
> data(Canada)
> test <- summary(CADFtest(Canada[-c(1:13), 1], max.lag.y = 1))
> test
Augmented DF test
ADF test
t-test statistic:  -1.389086
p-value:0.855681
Max lag of the diff. dependent variable:1.00

Call:
dynlm(formula = formula(model), start = obs.1, end = obs.T)

Residuals:
 Min   1Q   Median   3Q  Max
-0.79726 -0.20587 -0.03332  0.23840  0.70460

Coefficients:
 Estimate Std. Error t value Pr(>|t|)
(Intercept) 24.471789  17.521147   1.3970.167
trnd 0.009959   0.006941   1.4350.156
L(y, 1) -0.026068   0.018767  -1.3890.856
L(d(y), 1)   0.615983   0.092632   6.650 7.18e-09 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.3533 on 65 degrees of freedom
Multiple R-squared: 0.413,  Adjusted R-squared: 0.3859
F-statistic:NA on NA and NA DF,  p-value: NA

Though, I am not the package maintainer who could provide you with more 
insights, but the source code itself.

Best,
Bernhard



-Ursprüngliche Nachricht-
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im 
Auftrag von p99323...@ntu.edu.tw
Gesendet: Montag, 14. November 2011 04:35
An: r-help@r-project.org
Betreff: [R] What is the CADF test criterion="BIC" report?

Hello:
   I am a rookie in using R. When I used the unit root test in "CADFtest", I 
got the different t-test statistics between using criterion="BIC" and no using 
criterion. But when I checked the result with eviews, I find out that no using 
criterion is correct. Why after using criterion="BIC", I got the different 
result?


Paul


> data(Canada)

> ADFt <- CADFtest(Canada[,1], max.lag.y = 14, criterion="BIC")

> summary(ADFt)
Augmented DF test
 ADF test
t-test statistic:  -1.389086
p-value:0.855681
Max lag of the diff. dependent variable:1.00

Call:
dynlm(formula = formula(model), start = obs.1, end = obs.T)

Residuals:
  Min   1Q   Median   3Q  Max
-0.79726 -0.20587 -0.03332  0.23840  0.70460

Coefficients:
  Estimate Std. Error t value Pr(>|t|)
(Intercept) 24.342321  17.435476   1.3960.167
trnd 0.009959   0.006941   1.4350.156
L(y, 1) -0.026068   0.018767  -1.3890.856
L(d(y), 1)   0.615983   0.092632   6.650 7.18e-09 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.3533 on 65 degrees of freedom
Multiple R-squared: 0.413,  Adjusted R-squared: 0.3859
F-statistic:NA on NA and NA DF,  p-value: NA

> ADFt1 <- CADFtest(Canada[,1], max.lag.y =1)

> summary(ADFt1)
Augmented DF test
  ADF test
t-test statistic:  -2.7285715
p-value:0.2282588
Max lag of the diff. dependent variable:1.000

Call:
dynlm(formula = formula(model), start = obs.1, end = obs.T)

Residuals:
  Min   1Q   Median   3Q  Max
-0.84769 -0.24745 -0.02081  0.24187  0.82344

Coefficients:
  Estimate Std. Error t value Pr(>|t|)
(Intercept) 47.661910  17.439021   2.733  0.00776 **
trnd 0.019217   0.007005   2.743  0.00754 **
L(y, 1) -0.051256   0.018785  -2.729  0.22826
L(d(y), 1)   0.753011   0.075724   9.944 1.61e-15 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.3937 on 78 degrees of freedom
Multiple R-squared: 0.5674, Adjusted R-squared: 0.5508
F-statistic:NA on NA and NA DF,  p-value: NA

__
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.
*
Confidentiality Note: The information contained in this ...{{dropped:10}}

__
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] Odp: Problem using read.xls - Everything converted to factors

2011-11-14 Thread Ronaldo Reis Júnior
Hi,

I have this same problem using read.xls in a table that I have NA values.

Look:

Using the importing from a csv file using read.table

>  summary(dados)
  TratV1V2
  A:5   Min.   :1.0   Min.   :1.000
  B:5   1st Qu.:1.0   1st Qu.:1.000
Median :1.5   Median :2.000
Mean   :1.5   Mean   :1.556
3rd Qu.:2.0   3rd Qu.:2.000
Max.   :2.0   Max.   :2.000
  NA's   :1.000

Now using read.xls


>  summary(dados.xls)
  TratV1V2
  A:5   Min.   :1.0   1  :4
  B:5   1st Qu.:1.0   2  :5
Median :1.5   NA :1
Mean   :1.5
3rd Qu.:2.0
Max.   :2.0


Look that the V2 variable in read.xls is wrong convert to factors.

Anybody know how to fix it in read.xls?

Thanks
Ronaldo



Em 03-06-2011 12:34, Petr PIKAL escreveu:
> Hi
>
>> [R] Problem using read.xls - Everything converted to factors
>>
>> Hallo,
>>
>> I would like to use to read.xls function from the gdata package to read
>> data from Microsoft Excel files but I experienced a problem: For example
>> I used the following code:
>>
>> testfile<-read.xls("/home/.../wsjecon0603.xls", #file path
>>  header=F,
>>  dec=",",
>>  na.strings="n.a.",
>>  skip=5,
>>  sheet=2,
>>  col.names=c("Name",
> "Firm","GDP1","GDP2","GDP3","GDP4","CPI5",
>> "CPI11","UNEMP5","UNEMP11","PROF03","PROF04","STARTS03","STARTS04"),
>>  nrows=54,
>>
>> #colClasses=c
>>
> (character,character,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric,numeric)
>> )
>> print(testfile)
>>
>> Although the xls file contains numeric values in all the columns except
>> the ones which I named "Name" and "Firm", everything in the data frame
>> has "factor" as class. I tried to use the colClasses option as above and
>> as well with " "'s around each word, but this does not work and I will
> Hm. That shall work. You have got some advice from Gabor but in case
> numeric columns come as non numeric I often find a problem with some kind
> of formating the original values. Numbers like 10 253,52 are treated as
> nonnumeric as there is extra space character between thousands and
> hundereds. Maybe also na.strings are not always marked as n.a. but
> sometimes the value is missing and I suppose this can lead to conversion
> of all column to character vector.
>
>> always receive the following error:
>>
>> Fehler in is(object, Class) :
>> versuche einen Slot "className" von einem Objekt der einfachen Klasse
>> ("list") ohne Slots anzufordern
>> Calls: read.xls ->  read.csv ->  read.table ->->  is
>>
>> After some hours of reasearch I figured out how I can manually change
>> the classes of the columns:
>>
>> testfile$GDP2<-as.numeric(levels(testfile$GDP2))[testfile$GDP2]
>> testfile$Name<-as.character(levels(testfile$Name))[testfile$Name] #and
> so on
>
> you can spare some time to use sapply
>
> testfile[,character columns]<- sapply(testfile[,character columns],
> as.numeric)
>
> shall convert all character columns to numeric at once but you will get
> NAs to all values which could not be converted for any reason.
>
> Regards
> Petr
>
>
>> This works, but is a lot of work since I have to import many different
>> data sets. So I was wondering if there is another way to let the classes
>> be recognized correctly.
>>
>> Additionally I would like to know if there is any way to import data
>> from different sheets with the same layout at once into one data frame.
>>
>> I use Ubuntu 11.04 with Rkward if this is of any importance.
>>
>> Thanks in advance for your answers,
>> Sebastian
>>
>> __
>> 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.
>

-- 
4ª lei - Aja como se seu orientador estivesse sempre certo,
  na maior parte do tempo.

   --Herman, I. P. 2007. Following the law. NATURE, Vol 445, p. 228.

>  Prof. Ronaldo Reis Júnior
|  .''`. UNIMONTES/DBG/Lab. Ecologia Comportamental e Computacional
| : :'  : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia
| `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
|   `- Fone: (38) 3229-8192 | ronaldo.r...@unimontes.br
| http://www.ppgcb.unimontes.br/lecc | LinuxUser#: 205366


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

Re: [R] regular expression for selection

2011-11-14 Thread Petr PIKAL
Hi

Thank you. It is a pure magic, something taught in Unseen University.

this is what I got as a help for selecting only letters from set of 
character vector.

> vzor
 [1] "61A" "62C/27"  "65A/27"  "66C/29"  "69A/29"  "70C/31"
"73A/31" 
 [8] "74C/33"  "77A/33"  "81A/35"  "82C/37"  "85A/37"  "86C/39"
"89A/39" 
[15] "90C/41"  "93A/41"  "94C/43"  "97A/43"  "98C/45"  "101A/45"
"102C/47"
[22] "105A/47" "106C/49" "109A/49" "110C/51" "113A/51"

> gsub("[^A-z]", "", vzor)
 [1] "A" "C" "A" "C" "A" "C" "A" "C" "A" "A" "C" "A" "C" "A" "C" "A" "C"
[18] "A" "C" "A" "C" "A" "C" "A" "C" "A"

Therefore I expected that

sub("m5.", "\\1", mena) or sub("m5.", "", mena)

selects what I wanted. But it was not the case.

Please can you correct me when I try to evaluate your solution?

gsub(".*_(m5.).*", "\\1", mena)

or

gsub(".*(m5.).*", "\\1", mena)

.* matches any characters
() negation? or matching selection for back reference?

Finally the expressin matches whole string and evaluates what is matched 
by parenthesised value. This evaluation is returned by backreference.

Is it correct evaluation?

Regards
Petr

> 
> On 14.11.2011 10:22, Petr PIKAL wrote:
> > Hi
> >
> >> On 11/14/2011 07:45 PM, Petr PIKAL wrote:
> >>> Dear all
> >>>
> >>> I am again (as usual) lost in regular expression use for selection.
> > Here
> >>> are my data:
> >>>
>  dput(mena)
> >>> c("138516_10g_50ml_50c_250utes1_m53.00-_s1.imp",
> >>> "138516_10g_50ml_50c_250utes1_m54.00_s1.imp",
> >>> "138516_10g_50ml_50c_250utes1_m55.00_s1.imp",
> >>> "138516_10g_50ml_50c_250utes1_m56.00_s1.imp",
> >>> "138516_10g_50ml_50c_250utes1_m57.00_s1.imp",
> >>> "138516_10g_50ml_50c_250utes1_m58.00_s1.imp",
> >>> "138516_10g_50ml_50c_250utes1_m59.00_s1.imp")
> >>>
> >>> I want to select only values "m" foolowed by numbers from 53 to 59.
> >>>
> >>> I used
> >>>
> >>> sub("m5.", "", mena)
> >>>
> >>> which correctly selects those m53 - m59 values but, in contrary to 
my
> >>> expectation, it replaced the selected values with specified
> > replacement -
> >>> in that case empty string.
> >>>
> >>> What I shall use if I want to get rid of all but m53-m59 from those
> >>> strings?
> >>>
> >> Hi Petr,
> >> How about:
> >>
> >> grep("m5",mena)
> >
> > It gives numeric values which tells me that there is a match in each
> > string, but as a result I need only
> >
> > m53-m59 substrings.
> 
> 
> gsub(".*_(m5.).*", "\\1", mena)
> 
> Uwe Ligges
> 
> 
> 
> > Regards
> > Petr
> >
> >
> >
> >>
> >> 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.

__
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] regular expression for selection

2011-11-14 Thread Uwe Ligges



On 14.11.2011 11:27, Petr PIKAL wrote:

Hi

Thank you. It is a pure magic, something taught in Unseen University.

this is what I got as a help for selecting only letters from set of
character vector.


vzor

  [1] "61A" "62C/27"  "65A/27"  "66C/29"  "69A/29"  "70C/31"
"73A/31"
  [8] "74C/33"  "77A/33"  "81A/35"  "82C/37"  "85A/37"  "86C/39"
"89A/39"
[15] "90C/41"  "93A/41"  "94C/43"  "97A/43"  "98C/45"  "101A/45"
"102C/47"
[22] "105A/47" "106C/49" "109A/49" "110C/51" "113A/51"


gsub("[^A-z]", "", vzor)

  [1] "A" "C" "A" "C" "A" "C" "A" "C" "A" "A" "C" "A" "C" "A" "C" "A" "C"
[18] "A" "C" "A" "C" "A" "C" "A" "C" "A"

Therefore I expected that

sub("m5.", "\\1", mena) or sub("m5.", "", mena)

selects what I wanted. But it was not the case.

Please can you correct me when I try to evaluate your solution?

gsub(".*_(m5.).*", "\\1", mena)

or

gsub(".*(m5.).*", "\\1", mena)

.* matches any characters


Yes.


() negation? or matching selection for back reference?


The latter. See books about ergular expressions. I think it is also 
mentioned in ?regexp and with an example in ?gsub





Finally the expressin matches whole string and evaluates what is matched
by parenthesised value. This evaluation is returned by backreference.

Is it correct evaluation?


Indeed, where \\1 is the first backreference.

Best,
Uwe





Regards
Petr



On 14.11.2011 10:22, Petr PIKAL wrote:

Hi


On 11/14/2011 07:45 PM, Petr PIKAL wrote:

Dear all

I am again (as usual) lost in regular expression use for selection.

Here

are my data:


dput(mena)

c("138516_10g_50ml_50c_250utes1_m53.00-_s1.imp",
"138516_10g_50ml_50c_250utes1_m54.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m55.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m56.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m57.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m58.00_s1.imp",
"138516_10g_50ml_50c_250utes1_m59.00_s1.imp")

I want to select only values "m" foolowed by numbers from 53 to 59.

I used

sub("m5.", "", mena)

which correctly selects those m53 - m59 values but, in contrary to

my

expectation, it replaced the selected values with specified

replacement -

in that case empty string.

What I shall use if I want to get rid of all but m53-m59 from those
strings?


Hi Petr,
How about:

grep("m5",mena)


It gives numeric values which tells me that there is a match in each
string, but as a result I need only

m53-m59 substrings.



gsub(".*_(m5.).*", "\\1", mena)

Uwe Ligges




Regards
Petr





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.




__
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 include integrate in a function that can be solved with uniroot?

2011-11-14 Thread Gerrit Draisma

Hallo,
I am trying to define expectation as an integral
and use uniroot to find the distribution parameter
for a given expectation.

However I fail to understand how to define properly
the functions involved and pass the parameters correctly.

Can anyone help me out?

Thanks,
Gerrit Draisma.


This what I tried:
===
> # exponential density
> g <- function(x,lambda){ lambda *exp(-lambda*x) }
>
> # expectation with lambda=1/10
> integrate(f = function(x,lambda=1/10) {x*g(x,lambda)}, 0,Inf)
10 with absolute error < 6.7e-05
>
> # *how to write this as a function?*
> E <- function(lambda) {
+  integrate( f = function(x,th){x*g(x,lambda)},
+  0,Inf)$Value}
> E(1/10)
NULL
>
> # *how to include this function in uniroot to find lambda*
> # *for a given expectation?*
> mu <- 10
> uniroot(f<-function(th){E(th)-mu},lower=1,upper=100)
Error in if (is.na(f.lower)) stop("f.lower = f(lower) is NA") :
  argument is of length zero
>


__
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] arrow egdes and lty

2011-11-14 Thread Ted Harding
On 14-Nov-11 09:57:52, Matthias Gondan wrote:
> Dear R developers,
> 
> I want to draw an arrow in a figure with lty=2. The
> lty argument also affects the edge of the arrow, which is 
> unfortunate. Feature or bug?
> 
> Is there some way to draw an arrow with intact edge, still
> with lty=2?
> 
> Example code:
> 
> plot(1:10)
> arrows(4, 5, 6, 7, lty=2)
> 
> Best wishes,
> Matthias

According to ?arrows, it would seem that there is no
provision to draw the arrow shaft and the arrow head
using different line types with a single call to arrows().

To the extent that this represents the absence of a desirable
feature (since you desire it), I would designate it as a bug.

It can be done with two calls to arrows(), as follows:

  plot(1:10)
  arrows(4, 5, 6, 7, lty=2, length=0)
  arrows(5.99, 6.99, 6, 7, lty=1)

Of course, the first could also be done using lines().

Ted.


E-Mail: (Ted Harding) 
Fax-to-email: +44 (0)870 094 0861
Date: 14-Nov-11   Time: 10:39:32
-- XFMail --

__
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] arrow egdes and lty

2011-11-14 Thread Dénes TÓTH

Hi,

> Dear R developers,
>
> I want to draw an arrow in a figure with lty=2. The
> lty argument also affects the edge of the arrow, which is
> unfortunate. Feature or bug?
>
> Is there some way to draw an arrow with intact edge, still
> with lty=2?

AFAIK there is no such option in the arrow function, but you might try to
play around with the shape package and its various arrowhead options.

>
> Example code:
>
> plot(1:10)
> arrows(4, 5, 6, 7, lty=2)

library(shape)
plot(1:10)
Arrows(4, 5, 6, 7, lty=2)

HTH,
  Denes


>
> Best wishes,
>
> Matthias
> --
>
> __
> 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] How to compute eigenvectors and eigenvalues?

2011-11-14 Thread Arnau Mir
Hello.

Consider the following matrix:

mp <- matrix(c(0,1/4,1/4,3/4,0,1/4,1/4,3/4,1/2),3,3,byrow=T)

> mp
 [,1] [,2] [,3]
[1,] 0.00 0.25 0.25
[2,] 0.75 0.00 0.25
[3,] 0.25 0.75 0.50


The eigenvectors of the previous matrix are 1, 0.25 and 0.25 and it is not a 
diagonalizable matrix.

When you try to find the eigenvalues and eigenvectors with R, R responses:

> eigen(mp)

$values
[1]  1.00 -0.25 -0.25

$vectors
  [,1]  [,2]  [,3]
[1,] 0.3207501  1.068531e-08 -1.068531e-08
[2,] 0.4490502 -7.071068e-01 -7.071068e-01
[3,] 0.8339504  7.071068e-01  7.071068e-01

The eigenvalues are correct but the eigenvectors aren't. Moreover, if you try 
to compute the inverse of the matrix of eigenvectors, R is not aware that this 
matrix is singular:


> solve(eigen(mp)$vectors)
  [,1]  [,2]  [,3]
[1,]  6.235383e-01  6.235383e-01  6.235383e-01
[2,]  3.743456e+07 -9.358641e+06 -9.358640e+06
[3,] -3.743456e+07  9.358640e+06  9.358641e+06


My question is: how can I fix it?



Arnau.


Arnau Mir Torres
Edifici A. Turmeda
Campus UIB
Ctra. Valldemossa, km. 7,5
07122 Palma de Mca.
tel: (+34) 971172987
fax: (+34) 971173003
email: arnau@uib.es
URL: http://dmi.uib.es/~arnau



[[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] [R-pkgs] LaF 0.3: fast access to large ASCII files

2011-11-14 Thread Jan van der Laan
The LaF package provides methods for fast access to large ASCII files. 
Currently the following file formats are supported:


* comma separated format (csv) and other separated formats and
* fixed width format.

It is assumed that the files are too large to fit into memory, although 
the package can also be used to efficiently access files that do fit 
into memory.


In order to process files that are too large to fit into memory, methods 
are provided to access and process file blockwise. Furthermore, an 
opened file can be indexed as one would a data.frame. In this way 
subsets. or specific columns can be read into memory. For example, 
assuming that an object laf has been created using one of the functions 
laf_open_csv or laf_open_fwf, the third column from the file can be read 
into memory using:


> col <- laf[,3]


The LaF-manual vignette contains a description of all functionality 
provided:


  http://laf-r.googlecode.com/files/LaF-manual_0.3.pdf

The Laf-benchmark vignette compares the performance of LaF to the 
standard R-routines read.table and read.fwf:


  http://laf-r.googlecode.com/files/LaF-benchmark_0.3.pdf

___
R-packages mailing list
r-packa...@r-project.org
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] arrow egdes and lty

2011-11-14 Thread Martin Maechler
> Ted Harding 
> on Mon, 14 Nov 2011 10:39:35 + writes:

> On 14-Nov-11 09:57:52, Matthias Gondan wrote:
>> Dear R developers,
>> 
>> I want to draw an arrow in a figure with lty=2. The lty
>> argument also affects the edge of the arrow, which is
>> unfortunate. Feature or bug?
>> 
>> Is there some way to draw an arrow with intact edge,
>> still with lty=2?
>> 
>> Example code:
>> 
>> plot(1:10) arrows(4, 5, 6, 7, lty=2)
>> 
>> Best wishes, Matthias

> According to ?arrows, it would seem that there is no
> provision to draw the arrow shaft and the arrow head using
> different line types with a single call to arrows().

> To the extent that this represents the absence of a
> desirable feature (since you desire it), I would designate
> it as a bug.

> It can be done with two calls to arrows(), as follows:

>   plot(1:10) arrows(4, 5, 6, 7, lty=2, length=0)
> arrows(5.99, 6.99, 6, 7, lty=1)

Another possibility is to use p.arrows() from package 'sfsmisc'
which draws "nice arrow heads";
and if you like to keep them simple, do *not* fill them :

install.packages("sfsmisc")

require("sfsmisc")

example(arrows) # - show R's standard arrows()

## The example from the p.arrows()  help page:
plot(x,y, main="p.arrows(.)")
p.arrows(x[s], y[s], x[s+1], y[s+1], col= 1:3, fill = "dark blue")

## not filling the arrow heads -- and using  lty :
plot(x,y, main="p.arrows(.)")
p.arrows(x[s], y[s], x[s+1], y[s+1], col= 1:3, lty = 2, fill = NA)


> Of course, the first could also be done using lines().

> Ted.

__
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] amap new version (multidimensional analysis)

2011-11-14 Thread Antoine
Dear R users,

Thanks to a new contributor, Luigi Cerulo, amap provides 2 more metrics, 
and another agglomeration linkage for distance computation, and hierarchical
clustering.

The new centroid linkage method implemented in the cluster3
software tool (http://bonsai.hgc.jp/~mdehoon/software/cluster/software.htm). 
In this method the pseudoitem of a cluster is computed as the average of
the items coordinates, and clusters are aggregated with the same
distance metrics used between items. This approach reveals very
effective in the context of gene functional expressions analysis.

This update makes amap even more convenient for gene expression analysis, 
but not only; amap provides a lot of tools for robust statistics (rank 
based metrics, robust principal component analysis) with very fast
implementations.

Antoine Lucas.

___
R-packages mailing list
r-packa...@r-project.org
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.


[R] aov output question

2011-11-14 Thread Giovanni Azua
Hello,

I currently get anova results out of the aov function (see below) I use the 
model.tables and I believe it gives me back the model parameters of the fit 
(betas), however I don't see the intercept (beta_0) and don't understand what 
the "rep" output means and there is no description in the documentation. 

Another question: is there a function that outputs the results in a more 
meaningful way e.g. show the percentage of variation of each factor towards the 
response I believe the formula would be something like:
for factor X:  (Sum_Sq_X / Sum_Sq_Total)*100 

Thanks in advance,
Best regards,
Giovanni

> #throughput.aov <- 
> aov(Throughput~No_databases*Partitioning*No_middlewares*Queue_size,data=throughput)
> throughput.aov
Call:
   aov(formula = Throughput ~ No_databases + Partitioning + No_middlewares + 
Queue_size, data = throughput)

Terms:
No_databases Partitioning No_middlewares Queue_size Residuals
Sum of Squares  43146975 73949061130  20710 195504055
Deg. of Freedom11  2  1   433

Residual standard error: 671.9453 
Estimated effects may be unbalanced
> summary(throughput.aov)
DfSum Sq  Mean Sq F valuePr(>F)
No_databases 1  43146975 43146975 95.5614 < 2.2e-16 ***
Partitioning 1  7394 7394  0.01640.8982
No_middlewares   2   9061130  4530565 10.0342 5.497e-05 ***
Queue_size   1 2071020710  0.04590.8305
Residuals  433 195504055   451511  
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 
> model.tables(throughput.aov,type="effects",se=TRUE)
Design is unbalanced - use se.contrast() for se's
Tables of effects

 No_databases 
 1   4
-317.1 310
rep  217.0 222

 Partitioning 
sharding replication
   4.303   -3.91
rep  209.000  230.00

 No_middlewares 
 1  2   4
-97.93 -108.2 199
rep 139.00  150.0 150

 Queue_size 
 40 100
 -6.852   6.883
rep 220.000 219.000
> 
__
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] Fit continuous distribution to truncated empirical values

2011-11-14 Thread Michele Mazzucco
Hello David,

thanks for your answer.
I have done as you told me, however the fit is very poor, much worse than that 
obtained from using the whole dataset (without upper bound).
Any idea?

Thanks,
Michele

On Nov 4, 2011, at 8:56 PM, David Winsemius wrote:

> 
> On Nov 3, 2011, at 7:54 AM, Michele Mazzucco wrote:
> 
>> Hi all,
>> 
>> I am trying to fit a distribution to some data about survival times.
>> I am interested only in a specific interval, e.g., while the data lies in 
>> the interval (0,, 600), I want the best for the interval (0,..., 24).
>> 
>> I have tried both fitdistr (MASS package) and fitdist (from the fitdistrplus 
>> package), but I could not get them working, e.g.
>> 
>> fitdistr(left, "weibull", upper=24)
>> Error in optim(x = c(529L, 528L, 527L, 526L, 525L, 524L, 523L, 522L, 521L,  :
>> L-BFGS-B needs finite values of 'fn'
>> In addition: Warning message:
>> In dweibull(x, shape, scale, log) : NaNs produced
>> 
>> Am I doing something wrong?
> 
> You didn't supply data to test,  but shouldn't you supply a lower bound if 
> you want to fit "weibull"? It is, after all, bounded at 0.
> 
> > left <- c(529L, 528L, 527L, 526L, 525L, 524L, 523L, 522L, 521L, 
> > 50*runif(100))
> > fitdistr(left, "weibull", upper=24)
> Error in optim(x = c(529, 528, 527, 526, 525, 524, 523, 522, 521, 
> 18.3964251773432,  :
>  L-BFGS-B needs finite values of 'fn'
> In addition: Warning message:
> In dweibull(x, shape, scale, log) : NaNs produced
> 
> > fitdistr(left, "weibull", upper=24, lower=0.5)
>  shape scale
>   0.58195013   24.
> ( 0.04046087) ( 3.38621367)
> 
>> 
>> 
>> Thanks,
>> Michele
>> 
>> 
>> p.s. I have seen similar posts, e.g., 
>> http://tolstoy.newcastle.edu.au/R/help/05/02/11558.html, but I am not sure 
>> whether I can apply the same approach here.
>> __
>> 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, MD
> Heritage Laboratories
> West Hartford, CT
> 

__
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] correlations between columns for each row

2011-11-14 Thread Rob Griffin
Hello fellow R-users,
I’ve been mulling this problem over for some time now and have decided it is 
something I have to deal with but can’t, so here goes:
I have a dataset (called maindata, it is 271 columns *13890 rows so I wont post 
the entire thing here, I’ll just explain the situation!) 


I am trying to calculate inter-environment correlation (rF = cov A,B / 
sq.root(varA * varB ) for each row of the dataset. the values needed are (in 80 
of the columns 2*40) in columns 174-213, and 214-253 respectively which 
represent two environments (A or B).

Each of those columns is labelled with Xnumber.A/B
  e.g. X208.A is column 174 (which also relates to the first column in the B 
environment groups, col.214, X208.B)

effectively the equation is:
  rF=cov (columns[174:213] , [214:253]) / sqrt( (var[174:213]) * 
(var[214:253]) )

I want each of the 13890 rows to then have the rF value at the end of it (which 
will then be used later against other variables)


Can anyone help me with this problem? I’ve tried allsorts and I have run out 
of ideas.
Thanks in advance,
Rob
[[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] How to compute eigenvectors and eigenvalues?

2011-11-14 Thread Martin Maechler

 > Consider the following matrix:

 > > mp <- matrix(c(0,1/4,1/4,3/4,0,1/4,1/4,3/4,1/2),3,3,byrow=T)

 > > mp
 >  [,1] [,2] [,3]
 > [1,] 0.00 0.25 0.25
 > [2,] 0.75 0.00 0.25
 > [3,] 0.25 0.75 0.50

 > The eigenvectors of the previous matrix are 1, 0.25 and 0.25 and it is not a 
 > diagonalizable matrix.

 > When you try to find the eigenvalues and eigenvectors with R, R responses:

 > > eigen(mp)

 > $values
 > [1]  1.00 -0.25 -0.25

 > $vectors
 >   [,1]  [,2]  [,3]
 > [1,] 0.3207501  1.068531e-08 -1.068531e-08
 > [2,] 0.4490502 -7.071068e-01 -7.071068e-01
 > [3,] 0.8339504  7.071068e-01  7.071068e-01

 > The eigenvalues are correct but the eigenvectors aren't. 

Well, let's look at   4*mp  which is an integer matrix:

> (M <- matrix(c(rep(c(0, 3, 1, 1), 2),2), 3,3)); em <- eigen(M); V <- 
> em$vectors; lam <- em$values
 [,1] [,2] [,3]
[1,]011
[2,]301
[3,]132
> all.equal(M,  V %*% diag(lam) %*% solve(V))
[1] TRUE
> zapsmall(V %*% diag(lam) %*% solve(V))
 [,1] [,2] [,3]
[1,]011
[2,]301
[3,]132
> 

So, as you see  V is not singular,
and  the basic property of the eigenvalue decomposition is
fulfilled:

   M   = V Lambda V^{-1}
or
   M V = V Lambda

i.e. each column of V  *is* eigenvector to the corresponding 
eigenvalue.


  > Moreover, if you try to compute the inverse of the matrix of eigenvectors, 
R is not aware that this matrix is singular:

  > > solve(eigen(mp)$vectors)
  >   [,1]  [,2]  [,3]
  > [1,]  6.235383e-01  6.235383e-01  6.235383e-01
  > [2,]  3.743456e+07 -9.358641e+06 -9.358640e+06
  > [3,] -3.743456e+07  9.358640e+06  9.358641e+06

it isn't...



  > My question is: how can I fix it?

No need to fix anything, as nothing is broken ;-)

Martin Maechler, ETH Zurich

__
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] State space model

2011-11-14 Thread Kristian Lind
I found an old thread on R-Sig-Finance with the same problem and a possible
solution https://stat.ethz.ch/pipermail/r-sig-finance/2007q2/001362.html

I've used with success a few times but it seems a bit slow.

If anyone has a better way of modelling state-dependent volatility using
one of the available packages please let me know.

Kristian

2011/11/12 Kristian Lind 

> Hi,
>
> I'm trying to estimate the parameters of a state space model of the
> following form
>
> measurement eq:
>
> z_t = a + b*y_t + eps_t
>
> transition eq
>
> y_t+h = (I -exp(-hL))theta + exp(-hL)y_t+ eta_{t+h}.
>
> The problem is that the distribution of the innovations of the transition
> equation depend on the previous value of the state variable.
> To be exact: y_t|y_{t-1} ~N(mu, Q_t) where Q is a diagonal matrix with
> elements equal to
>
> Q_{i,t} =
> sigma_i*(1-exp(-kappa_i*h)/kappa_i*(theta_i/2*(1-exp(kappa_i*h)+exp(-kappa_i*h)y_{t-1,i}
>
> The fkf returns the filtered states variables so y_{t-1,i} is available. I
> just can't figure out how to write my program in such a way  that this
> information is included and updated in the state space model for each
> iteration in optim. Any suggestions on how to solve this are much
> appreciated.
>
> Thank you,
>
> Kristian.
>
> Below my program where the variance matrices are just identity matrices
> and the data is just random numbers. I used the example from the FKF
> package as framework.
>
> library(FKF) #loading Fast Kalman Filter package
> library(Matrix) # matrix exponential package
> library(BB)
> library(alabama)
> x <- matrix(abs(rnorm(400)), nrow=10, ncol=40)
> m <- 2 # m is the number of state variables
> n <- ncol(x) # is the length of the observed sample
> d <- nrow(x) # is the number of observed variables.
> h <- 1/52
> ## creating state space representation of 2-factor CIR model
> CIR2ss <- function(K_1, K_2, sigma_1, sigma_2, lambda_1, lambda_2,
> theta_1, theta_2, delta_0, delta_1, delta_2)  {
>   ## defining auxilary parameters,
> phi_11 <- sqrt((K_1+lambda_1)^2+2*sigma_1^2*delta_1)
>   phi_21 <- sqrt((K_2+lambda_2)^2+2*sigma_2^2*delta_2)
> phi_12 <- K_1+lambda_1+phi_11
> phi_22 <- K_2+lambda_2+phi_21
> phi_13 <- 2*K_1*theta_1/sigma_1^2
> phi_23 <- 2*K_2*theta_2/sigma_2^2
> a <- array(1, c(d,n))
> phi_14 <- numeric(d)
> phi_24 <- numeric(d)
> b1 <- numeric(d)
> b2 <- numeric(d)
> for(t in 1:d){
> phi_14[t] <- 2*phi_11+phi_12*(exp(phi_11*t)-1)
> phi_24[t] <- 2*phi_21+phi_22*(exp(phi_21*t)-1)
> a[t] <- delta_0 -
> phi_13/(t)*log(2*phi_11*exp(phi_12*(t)/2)/phi_14[t])-
> phi_23/(t)*log(2*phi_21*exp(phi_22*(t)/2)/phi_24[t])
> b1[t] <- (delta_1/(t))*2*(exp(phi_11*(t))-1)/phi_14[t]
> b2[t] <- (delta_2/(t))*2*(exp(phi_21*(t))-1)/phi_24[t]
> }
> b <- array(c(b1,b2), c(d,m,n))
> j <- -matrix(c(K_1, 0, 0, K_2), c(2,2))*h
> explh <- as.matrix(expm(j))
>
> Tt <- array(explh, c(m,m,n)) #array giving the factor of the
> transition equation
> Zt <- b #array giving the factor of the measurement equation
> ct <- a #matrix giving the intercept of the measurement equation
> dt <- as.matrix((diag(m)-explh)%*%c(theta_1, theta_2)) #matrix giving
> the intercept of the transition equation
> GGt <- array(diag(d), c(d,d,1)) #array giving the variance of the
> disturbances of the measurement equation
> HHt <- diag(m) #array giving the variance of the innovations of the
> transition equation
> a0 <- c(0.5, 0.5) #vector giving the initial value/estimation of the
> state variable
> P0 <- matrix(1e6, nrow = 2, ncol = 2) # matrix giving the variance of
> a0
> return(list(a0 = a0, P0 = P0, ct = ct, dt = dt, Zt = Zt, Tt = Tt, GGt
> = GGt,
> HHt = HHt))
> }
> ## Objective function passed to optim
> objective <- function(parm, yt) {
>   sp <- CIR2ss(parm["K_1"], parm["K_2"], parm["sigma_1"], parm["sigma_2"],
> parm["lambda_1"], parm["lambda_2"],
>parm["theta_1"], parm["theta_2"], parm["delta_0"],
> parm["delta_1"], parm["delta_2"])
>
>   ans <- fkf(a0 = sp$a0, P0 = sp$P0, dt = sp$dt, ct = sp$ct, Tt = sp$Tt,
>Zt = sp$Zt, HHt = sp$HHt, GGt = sp$GGt, yt = yt)
>   return(-ans$logLik)
> }
>
> parm <- c(K_1 =  0.6048, K_2 = 0.656, sigma_1 =0.1855, sigma_2 =0.5524,
>lambda_1 =0.55, lambda_2 =0.009, theta_1 = 0.173, theta_2 =
> 0.12,
>delta_0 =0.686, delta_1 =-0.003, delta_2=0.0025)
>
> hin <- function(parm, yt){
>   h<- numeric(2)
>   h[1] <- 2*parm[1]*parm[7]-parm[3]^2
>   h[2] <- 2*parm[2]*parm[8]-parm[4]^2
>   h
> }
> ##optimizing objective function
> fit <- auglag(par = parm, fn = objective, yt = x, control.outer =
> list(method = "CG"), hin = hin)
> print(fit)
>
>
>

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

Re: [R] Help with text separation

2011-11-14 Thread Sarah Goslee
Hi,

On Mon, Nov 14, 2011 at 4:20 AM, Michael Griffiths
 wrote:
> Good morning R list,
>
> My apologies if this has *already* answered elsewhere, but I have not found
> the answer that I am looking for.
>
> I have a character string, i.e.
>
>
> form<-c('~ A + B + C + C / D + E + E / F + G + H + I + J + K + L * M')
>
> Now, my aim is to find the position of all those instances of '*' and to
> remove said '*'. However, I would also like to remove the preceding
> variable name before the '*', the math operator preceding this, and also
> the variable name after the '*'. So, here I would like to remove '+L*M'

You just want to get rid of them? gsub() it is.

I've changed your formula a little bit to better demonstrate what's going on:
> form<-c('~ A + B * C + C / D + E + E / F * G + H + I + J + K + L * M')
> gsub(" \\+ [A-Z] \\* [A-Z]", "", form)
[1] "~ A + C / D + E + E / F * G + H + I + J + K"

That regular expression will take out a
space
+
any capital letter
space
*
space
any capital letter.

It will take out all occurrences of that sequence, but won't take out
occurrences of * not in that sequence.

If you don't want the spaces, you don't need them. Just take them out
of the regular expression as well.

Not that strsplit() was remotely the right tool here, but you can
split into characters without a separator:
> form <- 'abcd'
> strsplit(form, '')
[[1]]
[1] "a" "b" "c" "d"

Sarah

> So, far I have come up with the following code:
>
> parts<-strsplit(form,' ')
> index<-which(unlist(parts)=="*")
> for (i in 1:length(index)){
>    parts[[1]][index[i]]<-list(NULL)
>    parts[[1]][index[i]+1]<-list(NULL)
>    parts[[1]][index[i]-1]<-list(NULL)
>    parts[[1]][index[i]-2]<-list(NULL)
> }
> new.form<-unlist(parts)
>
> form<-new.form[0]
> for (i in 1: length(new.form)){
>    form<-paste(form,new.form[i], sep="")
> }
>
> However, as you can see, I have had to use strsplit in, what I consider a
> rather clumsy manner, as the character string (form) has to be in a certain
> format. All variables and maths operators require a space between them in
> order for strsplit to work in the manner I require.
>
> I would very much like to accomplish what the above code already does, but
> without the need for the initial character string having the need for the
> aforementioned spaces.
>
> If the list can offer help, I would be most appreciative.
>
> Yours
>
> Mike Griffiths
>
>
>
-- 
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.


[R] Fwd: How to compute eigenvectors and eigenvalues?

2011-11-14 Thread Arnau Mir


Inicio del mensaje reenviado:

> De: Arnau Mir 
> Fecha: 14 de noviembre de 2011 13:24:31 GMT+01:00
> Para: Martin Maechler 
> Asunto: Re: [R] How to compute eigenvectors and eigenvalues?
> 
> Sorry, but I can't explain very well.
> 
> 
> The matrix 4*mp is:
> 
> 4*mp
>  [,1] [,2] [,3]
> [1,]011
> [2,]301
> [3,]132
> > 
> 
> The eigenvalues are:
> lam
> [1]  4 -1 -1
> 
> There is only one eigenvector linearly independent with eigenvalue -1. This 
> eigenvector is c(0,1,-1) but R computes two eigenvectors:
> 
> > V
>   [,1]  [,2]  [,3]
> [1,] 0.3207501  1.068531e-08 -1.068531e-08
> [2,] 0.4490502 -7.071068e-01 -7.071068e-01
> [3,] 0.8339504  7.071068e-01  7.071068e-01
> 
> 
> One is 
>  V[,2]
> [1]  1.068531e-08 -7.071068e-01  7.071068e-01
> 
> and the other one:
> 
> > V[,3]
> [1] -1.068531e-08 -7.071068e-01  7.071068e-01
> 
> The first component of these two vectors must be zero but due to numerical 
> errors, R computes  1.068531e-08  and  -1.068531e-08 respectively. 
> 
> So, the matrix V is singular but R isn't aware of. 
> 
> You are right when you say:
> 
> V %*% diag(lam) %*% solve(V)
>  [,1]  [,2] [,3]
> [1,] 8.788496e-09  1.00e+001
> [2,] 3.00e+00 -9.313226e-101
> [3,] 1.00e+00  3.00e+002
> 
> 
> but this expression doesn't make any sense because solve(V) doesn't exist.
> 
> What I want is that R responses that mp or 4*mp is not diagonalizable and 
> solve(V) doesn't exist.
> 
> Arnau.
> El 14/11/2011, a las 13:06, Martin Maechler escribió:
> 
>> 
>>> Consider the following matrix:
>> 
 mp <- matrix(c(0,1/4,1/4,3/4,0,1/4,1/4,3/4,1/2),3,3,byrow=T)
>> 
 mp
>>> [,1] [,2] [,3]
>>> [1,] 0.00 0.25 0.25
>>> [2,] 0.75 0.00 0.25
>>> [3,] 0.25 0.75 0.50
>> 
>>> The eigenvectors of the previous matrix are 1, 0.25 and 0.25 and it is not 
>>> a diagonalizable matrix.
>> 
>>> When you try to find the eigenvalues and eigenvectors with R, R responses:
>> 
 eigen(mp)
>> 
>>> $values
>>> [1]  1.00 -0.25 -0.25
>> 
>>> $vectors
>>>  [,1]  [,2]  [,3]
>>> [1,] 0.3207501  1.068531e-08 -1.068531e-08
>>> [2,] 0.4490502 -7.071068e-01 -7.071068e-01
>>> [3,] 0.8339504  7.071068e-01  7.071068e-01
>> 
>>> The eigenvalues are correct but the eigenvectors aren't. 
>> 
>> Well, let's look at   4*mp  which is an integer matrix:
>> 
>>> (M <- matrix(c(rep(c(0, 3, 1, 1), 2),2), 3,3)); em <- eigen(M); V <- 
>>> em$vectors; lam <- em$values
>> [,1] [,2] [,3]
>> [1,]011
>> [2,]301
>> [3,]132
>>> all.equal(M,  V %*% diag(lam) %*% solve(V))
>> [1] TRUE
>>> zapsmall(V %*% diag(lam) %*% solve(V))
>> [,1] [,2] [,3]
>> [1,]011
>> [2,]301
>> [3,]132
>>> 
>> 
>> So, as you see  V is not singular,
>> and  the basic property of the eigenvalue decomposition is
>> fulfilled:
>> 
>>   M   = V Lambda V^{-1}
>> or
>>   M V = V Lambda
>> 
>> i.e. each column of V  *is* eigenvector to the corresponding 
>> eigenvalue.
>> 
>> 
>>> Moreover, if you try to compute the inverse of the matrix of eigenvectors, 
>>> R is not aware that this matrix is singular:
>> 
 solve(eigen(mp)$vectors)
>>>  [,1]  [,2]  [,3]
>>> [1,]  6.235383e-01  6.235383e-01  6.235383e-01
>>> [2,]  3.743456e+07 -9.358641e+06 -9.358640e+06
>>> [3,] -3.743456e+07  9.358640e+06  9.358641e+06
>> 
>> it isn't...
>> 
>> 
>> 
>>> My question is: how can I fix it?
>> 
>> No need to fix anything, as nothing is broken ;-)
>> 
>> Martin Maechler, ETH Zurich
>> 
> 
> 
> Arnau Mir Torres
> Edifici A. Turmeda
> Campus UIB
> Ctra. Valldemossa, km. 7,5
> 07122 Palma de Mca.
> tel: (+34) 971172987
> fax: (+34) 971173003
> email: arnau@uib.es
> URL: http://dmi.uib.es/~arnau
> 
> 


Arnau Mir Torres
Edifici A. Turmeda
Campus UIB
Ctra. Valldemossa, km. 7,5
07122 Palma de Mca.
tel: (+34) 971172987
fax: (+34) 971173003
email: arnau@uib.es
URL: http://dmi.uib.es/~arnau



[[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] How to compute eigenvectors and eigenvalues?

2011-11-14 Thread John Fox
Dear Arnau,

In this and a subsequent message, you seem to incorrectly infer that the two
equal eigenvalues of the matrix imply that it's singular. The rank of the
matrix is equal to the number of *nonzero* eigenvalues, here 3, and so the
matrix is nonsingular. That two eigenvalues are equal simply implies that
the corresponding eigenvectors span a subspace of dimension 2; the 2
corresponding eigenvectors reported by R are (within rounding error) a basis
for this subspace.

I hope this helps,
 John


John Fox
Senator William McMaster
  Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Arnau Mir
> Sent: November-14-11 5:53 AM
> To: r-help@r-project.org
> Subject: [R] How to compute eigenvectors and eigenvalues?
> 
> Hello.
> 
> Consider the following matrix:
> 
> mp <- matrix(c(0,1/4,1/4,3/4,0,1/4,1/4,3/4,1/2),3,3,byrow=T)
> 
> > mp
>  [,1] [,2] [,3]
> [1,] 0.00 0.25 0.25
> [2,] 0.75 0.00 0.25
> [3,] 0.25 0.75 0.50
> 
> 
> The eigenvectors of the previous matrix are 1, 0.25 and 0.25 and it is
> not a diagonalizable matrix.
> 
> When you try to find the eigenvalues and eigenvectors with R, R
> responses:
> 
> > eigen(mp)
> 
> $values
> [1]  1.00 -0.25 -0.25
> 
> $vectors
>   [,1]  [,2]  [,3]
> [1,] 0.3207501  1.068531e-08 -1.068531e-08 [2,] 0.4490502 -7.071068e-01
> -7.071068e-01 [3,] 0.8339504  7.071068e-01  7.071068e-01
> 
> The eigenvalues are correct but the eigenvectors aren't. Moreover, if
> you try to compute the inverse of the matrix of eigenvectors, R is not
> aware that this matrix is singular:
> 
> 
> > solve(eigen(mp)$vectors)
>   [,1]  [,2]  [,3]
> [1,]  6.235383e-01  6.235383e-01  6.235383e-01 [2,]  3.743456e+07 -
> 9.358641e+06 -9.358640e+06 [3,] -3.743456e+07  9.358640e+06
> 9.358641e+06
> 
> 
> My question is: how can I fix it?
> 
> 
> 
> Arnau.
> 
> 
> Arnau Mir Torres
> Edifici A. Turmeda
> Campus UIB
> Ctra. Valldemossa, km. 7,5
> 07122 Palma de Mca.
> tel: (+34) 971172987
> fax: (+34) 971173003
> email: arnau@uib.es
> URL: http://dmi.uib.es/~arnau
> 
> 
> 
>   [[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] help in fitted values in lm function

2011-11-14 Thread arunkumar1111
Yes there are few NA in the Data

--
View this message in context: 
http://r.789695.n4.nabble.com/help-in-fitted-values-in-lm-function-tp4038642p4039207.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] What is the CADF test criterion="BIC" report?

2011-11-14 Thread Claudio Lupi
In order for the information criteria to be able to select the model, all the
models have to be estimated on the same sample. Therefore, all the models
are estimated and compared using the same sample used for the model
containing the largest number of lags. You can find this and other details
in
Lupi, C. (2009). "Unit Root CADF Testing with R", Journal of Statistical
Software, 2009, 32(2), 1-19

--
View this message in context: 
http://r.789695.n4.nabble.com/What-is-the-CADF-test-criterion-BIC-report-tp4038700p4039259.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] parralellization without clustering (snow)

2011-11-14 Thread fantomas
Hi,

I'm running R in supercomputer where clusters already are configurered, i.e.
number of procesors are predefined and I cannot change it. Can I still use
package like snow? I'm worrying that command like makeCluster won't be very
'healthy'. Or its ok to use it?

Thanks in advance, Tomas

--
View this message in context: 
http://r.789695.n4.nabble.com/parralellization-without-clustering-snow-tp4039275p4039275.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] Enquiry about 2nd-order interactions survival analysis

2011-11-14 Thread Terry Therneau
David's answers were correct.  You are looking deep into the code when
there is no reason to to so.

1. h(t|(X=x,Z=z)) = exp(Beta0 + XZBeta1) 
Most statisticians will tell you that this is an unwise model.  The
reason is that if you replace X with "X+1" the fit changes, which is
almost never desirable.  What if someone coded your dummy variable as
1/0 instead of 0/1 -- wouldn't you want to get the same fit
  Therefore the default in R for the model
 lm(y ~ x*z)
is to fit  y = b0 + b1 x + b2 z + b3 xz

   You can get exactly the model you specify as lm(y ~ x:z), or as
 temp <- x*z; lm(y ~ temp) 
Statistically, this is almost surely a mistake.

2. The model formulas work across packages.  I used lm() above, but
survreg is no different.  Formula processing is done by the
model.matrix() function, which survreg, lm, glm,   all call.  My C
code is all downstream of this, and irrelevant to your question.

Terry T

On Sun, 2011-11-13 at 14:39 +0800, Kenji Ryusuke wrote:
> Dr Terry Therneau,
> 
> Firstly I do apologize upon unsolicited email. I know about Dr Terry
> through R package "survival" and alot of your papers.
> 
> As we know Equation(1) is a normal parametric survival analysis, I'ld
> like to modify it to be a 2nd-order interactions as in Equation(2) :- 
> h(t|X=x)  = exp(Beta0 + XBeta1)  --- (1)
> h(t|(X=x,Z=z)) = exp(Beta0 + XZBeta1) -- (2)
> 
> Where x and z are two covariates: 
> x = dummy variable (1 or 0) 
> z = factors (people name)
> 
> I would like to modify survreg() to be a second-order interactions
> regression while there is no 2nd-order interactions survival
> regression as I searched over www.rseek.org. I tried to read through
> the codes of survreg(), but I am stuck (cannot understand) at
> survreg6.c 
> 
> survreg6.c apply C Language which involves Cholesky decomposition
> multi-matrix (first-order interactions) calculation. 
> 1) chinv2.c 
> 2) cholesky3.c 
> 3) chsolve2.c (only solve the equations of first-order interactions) 
> 
> I do appreciate if Dr Terry willing to enlighten me.
> Thank you. 
> 
> 
> Best, 
> Ryusuke

__
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 include integrate in a function that can be solved with uniroot?

2011-11-14 Thread R. Michael Weylandt
Try this:

EV <- function(lamb){
 fnc <- function(x) x * dexp(x, lamb)
 integrate(fnc, 0, Inf)$value
}

Your problem is that there's nothing to translate th to lambda in your
code for E.

Michael

On Mon, Nov 14, 2011 at 5:32 AM, Gerrit Draisma  wrote:
> Hallo,
> I am trying to define expectation as an integral
> and use uniroot to find the distribution parameter
> for a given expectation.
>
> However I fail to understand how to define properly
> the functions involved and pass the parameters correctly.
>
> Can anyone help me out?
>
> Thanks,
> Gerrit Draisma.
>
>
> This what I tried:
> ===
>> # exponential density
>> g <- function(x,lambda){ lambda *exp(-lambda*x) }
>>
>> # expectation with lambda=1/10
>> integrate(f = function(x,lambda=1/10) {x*g(x,lambda)}, 0,Inf)
> 10 with absolute error < 6.7e-05
>>
>> # *how to write this as a function?*
>> E <- function(lambda) {
> +      integrate( f = function(x,th){x*g(x,lambda)},
> +      0,Inf)$Value}
>> E(1/10)
> NULL
>>
>> # *how to include this function in uniroot to find lambda*
>> # *for a given expectation?*
>> mu <- 10
>> uniroot(f<-function(th){E(th)-mu},lower=1,upper=100)
> Error in if (is.na(f.lower)) stop("f.lower = f(lower) is NA") :
>  argument is of length zero
>>
> 
>
> __
> 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] Help with text separation

2011-11-14 Thread Michael Griffiths
Thank you Sarah,

Your reply was very helpful. I have the added difficulty that I am not only
dealing with single A-Z characters, but quite often have the following
situation:

form<-c('~Sentence+LEGAL+Intro+Intro/Intro1+Intro*LEGAL+benefit+benefit/benefit1+product+action+mean+CTA*help')

and again, I need to remove the +'CTA*help' part of the character string.
However, in another instance I may have

form<-c('~Sentence*LEGAL+Intro+Intro/Intro1+Intro*LEGAL+benefit+benefit/benefit1+product+action+mean+CTA*help')


In this case I would need to remove 'Sentence*LEGAL+' from form.


Can this be accomplished in the same manner?

Many thanks, once again, for your help

Mike Griffiths



On Mon, Nov 14, 2011 at 12:09 PM, Sarah Goslee wrote:

> Hi,
>
> On Mon, Nov 14, 2011 at 4:20 AM, Michael Griffiths
>  wrote:
> > Good morning R list,
> >
> > My apologies if this has *already* answered elsewhere, but I have not
> found
> > the answer that I am looking for.
> >
> > I have a character string, i.e.
> >
> >
> > form<-c('~ A + B + C + C / D + E + E / F + G + H + I + J + K + L * M')
> >
> > Now, my aim is to find the position of all those instances of '*' and to
> > remove said '*'. However, I would also like to remove the preceding
> > variable name before the '*', the math operator preceding this, and also
> > the variable name after the '*'. So, here I would like to remove '+L*M'
>
> You just want to get rid of them? gsub() it is.
>
> I've changed your formula a little bit to better demonstrate what's going
> on:
> > form<-c('~ A + B * C + C / D + E + E / F * G + H + I + J + K + L * M')
> > gsub(" \\+ [A-Z] \\* [A-Z]", "", form)
> [1] "~ A + C / D + E + E / F * G + H + I + J + K"
>
> That regular expression will take out a
> space
> +
> any capital letter
> space
> *
> space
> any capital letter.
>
> It will take out all occurrences of that sequence, but won't take out
> occurrences of * not in that sequence.
>
> If you don't want the spaces, you don't need them. Just take them out
> of the regular expression as well.
>
> Not that strsplit() was remotely the right tool here, but you can
> split into characters without a separator:
> > form <- 'abcd'
> > strsplit(form, '')
> [[1]]
> [1] "a" "b" "c" "d"
>
> Sarah
>
> > So, far I have come up with the following code:
> >
> > parts<-strsplit(form,' ')
> > index<-which(unlist(parts)=="*")
> > for (i in 1:length(index)){
> >parts[[1]][index[i]]<-list(NULL)
> >parts[[1]][index[i]+1]<-list(NULL)
> >parts[[1]][index[i]-1]<-list(NULL)
> >parts[[1]][index[i]-2]<-list(NULL)
> > }
> > new.form<-unlist(parts)
> >
> > form<-new.form[0]
> > for (i in 1: length(new.form)){
> >form<-paste(form,new.form[i], sep="")
> > }
> >
> > However, as you can see, I have had to use strsplit in, what I consider a
> > rather clumsy manner, as the character string (form) has to be in a
> certain
> > format. All variables and maths operators require a space between them in
> > order for strsplit to work in the manner I require.
> >
> > I would very much like to accomplish what the above code already does,
> but
> > without the need for the initial character string having the need for the
> > aforementioned spaces.
> >
> > If the list can offer help, I would be most appreciative.
> >
> > Yours
> >
> > Mike Griffiths
> >
> >
> >
> --
> Sarah Goslee
> http://www.functionaldiversity.org
>



-- 

*Michael Griffiths, Ph.D
*Statistician

*Upstream Systems*

8th Floor
Portland House
Bressenden Place
SW1E 5BH



Tel   +44 (0) 20 7869 5147
Fax  +44 207 290 1321
Mob +44 789 4944 145

www.upstreamsystems.com

*griffi...@upstreamsystems.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.


[R] Installing binaries from R-Forge

2011-11-14 Thread Millo Giovanni
Hello.

I just installed R 2.14.0 and then did

> install.packages("splm", repos="http://R-Forge.R-project.org";)

in order to replicate your problem. 
It worked "almost" fine. The only problem I had was with some missing
packages: being a fresh install, all suggested and required packages had
to be installed before 'splm', which is automatically done by
install.packages using the 'repos' specified: but some ('spam',
'ibdreg', 'lmtest', 'deldir', 'coda', 'sandwich') aren't available on
R-forge, so I had to install them separately beforehand.

The error you get is typical of moments when the required binary isn't
available yet, because the version is very recent and the automated
compiling process hasn't completed its runs. This isn't a problem with
'splm' because the current version is some months old. In turn, R 2.14.0
was 9 days old at the time of your message, so maybe recompiling wasn't
done yet.

An alternative install, also not requiring the very last R version, is
to download splm_0.9-05.zip to a local folder and install from there. If
you are on Windows, you can always do this through the graphical menu
(Packages > install from local .zip file). If on Linux, same but through
command line.

It would be useful to know 
- whether the problem persists now
- which system are you using etc.

This last piece of information is **required posting info**, and cited
in the posting guide (which in turn is required reading for
non-programmers alike). You can do

> sessionInfo()

Let me know how you get along with this.
Giovanni

Giovanni Millo, PhD
Research Dept.,
Assicurazioni Generali SpA
Via Machiavelli 4,
34132 Trieste (Italy)
tel. +39 040 671184
fax  +39 040 671160

--- Original message ---

Message: 3
Date: Wed, 9 Nov 2011 07:39:09 -0500
From: "Downey, Patrick" 
To: 
Subject: [R] Installing binaries from R-Forge
Message-ID:
<0f96478603980b46aaafba77069582ed131c7...@uiexch.urban.org>
Content-Type: text/plain;   charset="us-ascii"

Hello,

I'm attempting to install the splm package from R-Forge.

https://r-forge.r-project.org/R/?group_id=352

The page says, "In order to successfully install the packages provided
on
R-Forge, you have to switch to the most recent version of R..." It later
says "To install this package directly within R type:
install.packages("splm", repos="http://R-Forge.R-project.org";)".

I just installed R-2.14 and I still get the following error message.

Warning message:
In getDependencies(pkgs, dependencies, available, lib) :
  package 'splm' is not available (for R version 2.14.0)

Can someone please help? I understand that there is relevant information
in
the posting guide, but I'm not a programmer and it's difficult for me to
understand. I thought I've followed the advice from previous posts
(notably, upgrade).

Thank you,
Mitch



--- end original message ---

 
Ai sensi del D.Lgs. 196/2003 si precisa che le informazi...{{dropped:12}}

__
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 include integrate in a function that can be solved with uniroot?

2011-11-14 Thread R. Michael Weylandt
You need to explicitly pass th to your function with the ... argument
of integrate.

E <- function(th){
integrate(function(x,th) x*g(x, th), 0, Inf, th)$value
}

Also, it's value, not Value, which might be producing errors of another sort.

Michael

On Mon, Nov 14, 2011 at 9:16 AM, Gerrit Draisma  wrote:
> Thanks Michael,
>
> I see now how to include integrate function in the EV function.
> And apologies:
> I now realize that my code was sloppy.
> I intended to write
>> E<- function(th) {
>> +      integrate( f = function(x,th){x*g(x,th)},
>> +      0,Inf)$Value}
>> E(1/10)
> But that does not work either,
>
> Gerrit.
>
> Op 11/14/2011 2:50 PM, R. Michael Weylandt schreef:
>>
>> Try this:
>>
>> EV<- function(lamb){
>>      fnc<- function(x) x * dexp(x, lamb)
>>      integrate(fnc, 0, Inf)$value
>> }
>>
>> Your problem is that there's nothing to translate th to lambda in your
>> code for E.
>>
>> Michael
>>
>> On Mon, Nov 14, 2011 at 5:32 AM, Gerrit Draisma
>>  wrote:
>>>
>>> Hallo,
>>> I am trying to define expectation as an integral
>>> and use uniroot to find the distribution parameter
>>> for a given expectation.
>>>
>>> However I fail to understand how to define properly
>>> the functions involved and pass the parameters correctly.
>>>
>>> Can anyone help me out?
>>>
>>> Thanks,
>>> Gerrit Draisma.
>>>
>>>
>>> This what I tried:
>>> ===

 # exponential density
 g<- function(x,lambda){ lambda *exp(-lambda*x) }

 # expectation with lambda=1/10
 integrate(f = function(x,lambda=1/10) {x*g(x,lambda)}, 0,Inf)
>>>
>>> 10 with absolute error<  6.7e-05

 # *how to write this as a function?*
 E<- function(lambda) {
>>>
>>> +      integrate( f = function(x,th){x*g(x,lambda)},
>>> +      0,Inf)$Value}

 E(1/10)
>>>
>>> NULL

 # *how to include this function in uniroot to find lambda*
 # *for a given expectation?*
 mu<- 10
 uniroot(f<-function(th){E(th)-mu},lower=1,upper=100)
>>>
>>> Error in if (is.na(f.lower)) stop("f.lower = f(lower) is NA") :
>>>  argument is of length zero

>>> 
>>>
>>> __
>>> 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] Running totals

2011-11-14 Thread Joshua Wiley
Glad it worked!  The one "gotcha" is that it does not handle missing
values, so for example:

> cumsum(c(1, 2, 3, NA, 4))
[1]  1  3  6 NA NA

both the NA, and everything after it become NA (missing).  If you find
yourself working with tables and frequencies and the like, you may
also like (if you have not already seen):

?table # tabulate data ?function pulls up documentation
## example
> table(c("john", "jane", "jane", "jane"))

jane john
   31

?xtabs # cross tabulation
## examples using the built in mtcars dataset
## (vs and am are 0/1 data)
> xtabs( ~ vs + am, data = mtcars)
   am
vs   0  1
  0 12  6
  1  7  7

You may also like the vcd (visualizing categorical data) package by
Michael Friendly:

Keeping with the mtcars data, we might want to visualize that little cross tab:

require(vcd)
pairs(xtabs(~ vs + am, data = mtcars))

Cheers,

Josh

On Mon, Nov 14, 2011 at 1:30 AM, Mark Carter  wrote:
>>From: Joshua Wiley 
>
>
>>dat$RTotal <- cumsum(dat$BAL)
>
>
>
> Wow, that's really great. I'm starting to really enjoy using R. My 
> statistical needs are not that great, but I love the way that R handles 
> tabular data.
>
>
> __
> 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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.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 text separation

2011-11-14 Thread Petr PIKAL
Hi

r-help-boun...@r-project.org napsal dne 14.11.2011 14:54:05:

> Thank you Sarah,
> 
> Your reply was very helpful. I have the added difficulty that I am not 
only
> dealing with single A-Z characters, but quite often have the following
> situation:
> 
> form<-c('~Sentence+LEGAL+Intro+Intro/Intro1+Intro*LEGAL+benefit+benefit/
> benefit1+product+action+mean+CTA*help')
> 
> and again, I need to remove the +'CTA*help' part of the character 
string.
> However, in another instance I may have
> 
> form<-c('~Sentence*LEGAL+Intro+Intro/Intro1+Intro*LEGAL+benefit+benefit/
> benefit1+product+action+mean+CTA*help')
> 
> 
> In this case I would need to remove 'Sentence*LEGAL+' from form.
> 
> 
> Can this be accomplished in the same manner?

Hm. I am not at all an expert in regular expressions but recently I 
learned some ways (thanks Uwe)

sub("^(~)\\+(.+)\\+$", "\\1\\2", gsub("[[:alnum:]]+\\*[[:alnum:]]+", "", 
form))
[1] "~Intro+Intro/Intro1++benefit+benefit/benefit1+product+action+mean"

this will remove all values xx*y from your form together with 
leading and trailing +

I wonder if any automatic process can remove only one from several 
xx*y substrings.

Regards
Petr

PS and still it is not perfect as there is one middle + more.

> 
> Many thanks, once again, for your help
> 
> Mike Griffiths
> 
> 
> 
> On Mon, Nov 14, 2011 at 12:09 PM, Sarah Goslee 
wrote:
> 
> > Hi,
> >
> > On Mon, Nov 14, 2011 at 4:20 AM, Michael Griffiths
> >  wrote:
> > > Good morning R list,
> > >
> > > My apologies if this has *already* answered elsewhere, but I have 
not
> > found
> > > the answer that I am looking for.
> > >
> > > I have a character string, i.e.
> > >
> > >
> > > form<-c('~ A + B + C + C / D + E + E / F + G + H + I + J + K + L * 
M')
> > >
> > > Now, my aim is to find the position of all those instances of '*' 
and to
> > > remove said '*'. However, I would also like to remove the preceding
> > > variable name before the '*', the math operator preceding this, and 
also
> > > the variable name after the '*'. So, here I would like to remove 
'+L*M'
> >
> > You just want to get rid of them? gsub() it is.
> >
> > I've changed your formula a little bit to better demonstrate what's 
going
> > on:
> > > form<-c('~ A + B * C + C / D + E + E / F * G + H + I + J + K + L * 
M')
> > > gsub(" \\+ [A-Z] \\* [A-Z]", "", form)
> > [1] "~ A + C / D + E + E / F * G + H + I + J + K"
> >
> > That regular expression will take out a
> > space
> > +
> > any capital letter
> > space
> > *
> > space
> > any capital letter.
> >
> > It will take out all occurrences of that sequence, but won't take out
> > occurrences of * not in that sequence.
> >
> > If you don't want the spaces, you don't need them. Just take them out
> > of the regular expression as well.
> >
> > Not that strsplit() was remotely the right tool here, but you can
> > split into characters without a separator:
> > > form <- 'abcd'
> > > strsplit(form, '')
> > [[1]]
> > [1] "a" "b" "c" "d"
> >
> > Sarah
> >
> > > So, far I have come up with the following code:
> > >
> > > parts<-strsplit(form,' ')
> > > index<-which(unlist(parts)=="*")
> > > for (i in 1:length(index)){
> > >parts[[1]][index[i]]<-list(NULL)
> > >parts[[1]][index[i]+1]<-list(NULL)
> > >parts[[1]][index[i]-1]<-list(NULL)
> > >parts[[1]][index[i]-2]<-list(NULL)
> > > }
> > > new.form<-unlist(parts)
> > >
> > > form<-new.form[0]
> > > for (i in 1: length(new.form)){
> > >form<-paste(form,new.form[i], sep="")
> > > }
> > >
> > > However, as you can see, I have had to use strsplit in, what I 
consider a
> > > rather clumsy manner, as the character string (form) has to be in a
> > certain
> > > format. All variables and maths operators require a space between 
them in
> > > order for strsplit to work in the manner I require.
> > >
> > > I would very much like to accomplish what the above code already 
does,
> > but
> > > without the need for the initial character string having the need 
for the
> > > aforementioned spaces.
> > >
> > > If the list can offer help, I would be most appreciative.
> > >
> > > Yours
> > >
> > > Mike Griffiths
> > >
> > >
> > >
> > --
> > Sarah Goslee
> > http://www.functionaldiversity.org
> >
> 
> 
> 
> -- 
> 
> *Michael Griffiths, Ph.D
> *Statistician
> 
> *Upstream Systems*
> 
> 8th Floor
> Portland House
> Bressenden Place
> SW1E 5BH
> 
>  2F&sa=D&sntz=1&usg=AFrqEzfKYfaAalqvahwrpywpJDL9DxUmWw>
> 
> Tel   +44 (0) 20 7869 5147
> Fax  +44 207 290 1321
> Mob +44 789 4944 145
> 
> www.upstreamsystems.com 
2Fwww.upstreamsystems.com%2F&sa=D&sntz=1&usg=AFrqEzfKYfaAalqvahwrpywpJDL9DxUmWw>
> 
> *griffi...@upstreamsystems.com *
> 
> 
> 
>[[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do re

Re: [R] Upgrade R?

2011-11-14 Thread Cem Girit
Hello Kevin,

Thank you. I will delete the folder and run an application called
CCleaner (free). That will remove all the broken registry entries.

There should be a problem free update path for R installation. As
you rightfully mentioned the R- manual is not clear about package update
issues. I received many helpful suggestions on the update path but some of
the them were contradictory in the order of steps to be taken.  I am also
using statConn (DCOM) interface for programming.  So my problems are
multifold.  I will compile the answers I received on the R version update
issue and publish them so that that the experts could put them into more
effective use.

Sincerely,

Cem


-Original Message-
From: Kevin Burton [mailto:rkevinbur...@charter.net] 
Sent: Sunday, November 13, 2011 4:11 PM
To: 'Cem Girit'
Subject: RE: [R] Upgrade R?

I don't know if it was correct but I just removed the directory and then
searched and removed all instances in the registry that referred to 2.13.1
(in my case searching for this seemed to only return references to 'R'). I
have since been given some links that address specific registry entries but
I haven't had any problem yet with my 'slash and burn' approach. It removed
it from the 'Install/Uninstall' list with windows so it seems to have be
removed and the disk space that 2.13.2 took up has been reclaimed. 

Hope this helps. Let me know if you find any more definitive answers.

Thanks.

Kevin

-Original Message-
From: Cem Girit [mailto:gi...@comcast.net] 
Sent: Saturday, November 12, 2011 6:33 PM
To: 'Kevin Burton'
Subject: RE: [R] Upgrade R?

Hello Kevin,

I am getting the same error "utCompiledCode..." since I  installed
R2.14 while R2.13 existed.  How did you get rid of R2.13 eventually? Did you
just delete it? If so, how did you clean the registry? 

Thank you,

Cem

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Kevin Burton
Sent: Thursday, November 10, 2011 11:54 AM
To: 'jose Bartolomei'; 'R Help'
Subject: Re: [R] Upgrade R?

The problem with this documentation is two-fold. One it seems to concentrate
on building from source which I don't need. Two it doesn't address the
upgade. I have a number of packages and so I need to do what has been
suggested and install the latest version *first*. Then copy the libraries
(packages). Then uninstall the previous version. It is on this last step
that I am stuck on right now. The last link on uninstalling R manually was
what I needed. Thank you.

 

Kevin

 

From: jose Bartolomei [mailto:surfpr...@hotmail.com]
Sent: Thursday, November 10, 2011 10:19 AM
To: rkevinbur...@charter.net; R Help
Subject: RE: [R] Upgrade R?

 

Hi,
Don't know if this will help you but...
In my short experience and following the guidelines you should first
uninstall R.

http://cran.r-project.org/doc/manuals/R-admin.html#Installing-R-under-Window
s
 
Unistall it from the Windows control panel.
 
The old R version libraries file will be kept on machine.
For example : C:\Program Files\R\R-2.13.0\library
 
Then install the new version via:
http://cran.r-project.org/doc/manuals/R-admin.html#Installing-R-under-Window
s
 
You can copy/paste libraries from the old version R library file to the new
one.
C:\Program Files\R\R-2.14.0\library
 
There is too an function named:
?update.packagee

If above was what you did, then there is a post on Uninstalling R manually:
 
http://learnserver.csd.univie.ac.at/rcomwiki/doku.php?id=wiki:uninstalling_r
_manually
 
Regards,
Jose
 

> From: rkevinbur...@charter.net
> To: r-help@r-project.org
> Date: Thu, 10 Nov 2011 09:07:20 -0600
> Subject: Re: [R] Upgrade R?
> 
> Since apparently there is no one familiar with this error message let 
> me rephrase the question. Is there a 'manual' process to fully remove 
> a
version
> of 'R' from my machine? This is a Window PC running Windows 7.
> 
> 
> 
> Thank you.
> 
> 
> 
> Kevin
> 
> 
> 
> From: Kevin Burton [mailto:rkevinbur...@charter.net]
> Sent: Monday, November 07, 2011 2:23 PM
> To: 'r-help@r-project.org'
> Subject: Upgrade R?
> 
> 
> 
> I am trying to upgrade to R 2.14 from R 2.13.1 I have compied all the 
> libraries from the 'library' directory in my existing installation
(2.13.1)
> to the installed R 2.14. Now I want to uninstall the old installation 
> (R
> 2.13.1) and I get the error:
> 
> 
> 
> Internal Error: Cannot find utCompiledCode record for this version of 
> the uninstaller.
> 
> 
> 
> Any ideas?
> 
> 
> 
> Kevin
> 
> 
> [[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-pr

[R] lme4:glmer with nested data

2011-11-14 Thread hijita
Dear all,

I have the following dataset with results from an experiment with individual 
bats that performed two tasks related to prey capture under different 
conditions:

X variables:
indiv - 5 individual bats used in the experiment; all of which performed both 
tasks
task - 2 tasks that each individual bat had to perform
dist - 5 repeated measures of individual bats at 5 different distances from the 
object

all x variables I treat as categorical factors with levels

Y - I have 8 dependent variables related to the structure of ultrasound calls 
emitted by bats when performing each task. I know I can use them together in 
the same model with the function “cbind()” but each variable behaves a bit 
differently. Thus, I guess it would be better to build 8 separate models. 

I believe "indiv" should be a random effect in the model; "dist" and "task" 
should be fixed effects.

I´d like to use the “glmer” (lme4) function to test two hypotheses:

Main hypothesis:
There are differences in Y measurements between tasks, which are related also 
to distance from the object.

Secondary hypothesis:
Differences in Y measurements between tasks do not depend on the individual.


I guess the simplest model for an AIC model selection would be:
print(Model.01<-glmer(y~task*dist+(1|indiv))
 - so any model that provides more details should have a lower (better)  AIC 
score.
I’m not sure if I’m coding the model correctly, so my hypothesis would be 
properly tested. 

1- Literature suggests to get rid of the pseudo-replication: my repeated 
measures (“dist”) seem to behave like longitudinal data (as it is basically a 
time series). This way, "indiv" would be nested in "dist". Furthermore, "dist" 
levels have different variance, so it would be good to group the data and 
somehow tell the model, that it should ignore differences in variance.
(1|dist:indiv) or (dist|indiv)?
I am still wondering if the “weights=” argument would apply here?

2- “dist” is nested in “task”, as for both tasks I have the same distances 
measured.
According to the description of the package “lme4”, I should write:
print(Model.02<-glmer(y~task*dist+(1|indiv)+(1|task:dist))

3- according to the text -book “The R book” I understand that I should do the 
following (as mentioned for the ratliver treatment-dataset):
rename factor levels to unique labels:
taskdist<-task:dist
taskdistindiv<-task:dist:indiv
print(Model.03<-glmer(y~task+(1|taskdist)+(1|taskdistindiv)))

Or, pooling 1 and 3 together myself I would end up with:
print(Model.04<-glmer(y~dist*task+(1|indiv)+(1|task:dist)+(1|dist:indiv))

I doubt that all of them actually describe correctly what I want the model to 
answer...

I did not find any directly related comment in the R help.

Thank you for your attention and for any help you may provide.

--

__
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] Understand Ncells and Vcells, from gc()

2011-11-14 Thread Lafaye de Micheaux
Dear all,

I am working on a 64 bits Linux system.
I issue the following R commands:

 > rm(list=ls()) # To remove all objects in the workspace.
 > gc() # To free memory.
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124250 6.7 35 18.7 35 18.7
Vcells 124547 1.0 786432 6.0 476934 3.7
 > gc() # I had to do it again, don't know why!
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124257 6.7 35 18.7 35 18.7
Vcells 124574 1.0 786432 6.0 476934 3.7
 > gc() # Just to be sure things have stabilized.
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124257 6.7 35 18.7 35 18.7
Vcells 124574 1.0 786432 6.0 476934 3.7
 > x <- as.integer(3)
 > object.size(x)
48 bytes
 > gc() # To free memory.
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124255 6.7 35 18.7 35 18.7
Vcells 124550 1.0 786432 6.0 476934 3.7
 > gc() # I had to do it again, don't know why!
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124259 6.7 35 18.7 35 18.7
Vcells 124575 1.0 786432 6.0 476934 3.7
 > gc() # Just to be sure things have stabilized.
used (Mb) gc trigger (Mb) max used (Mb)
Ncells 124259 6.7 35 18.7 35 18.7
Vcells 124575 1.0 786432 6.0 476934 3.7


My questions are:

1) Why should I use the command gc() two times before the values 
displayed do not change anymore?

2) object.size(x) is 48 bytes on my system. As I understand it, this is 
8 bytes for storing the value 3L and 40 bytes (on my 64 bits OS) to 
store the header of x. Am-I right? (Note that I understand it would be 
the same for x <- c(3L,4L))

3) If 2) is OK, then you can see that Ncells increased by 2 units and 
Vcells by 1 unit.
I think that 1 unit of Vcells = 8 bytes. Is it TRUE? (This is written in 
help(gc))
And in my mind, 1 unit of Ncells should be 20 bytes, so that:
1 unit of Vcells + 2 units of Ncells = 8 + 2*20 = 48, the size of x as 
returned by the command object.size(x).

BUT, when you look at help(gc), one can read:
'gc' returns a matrix with rows '"Ncells"' (_cons cells_), usually
28 bytes each on 32-bit systems and 56 bytes on 64-bit systems,

So, can you please help me to undertsand all of this?

Thanks in advance.

Best regards,

Pierre

-- 
Pierre Lafaye de Micheaux

Adresse courrier:
Département de Mathématiques et Statistique
Université de Montréal
CP 6128, succ. Centre-ville
Montréal, Québec H3C 3J7
CANADA

Adresse physique:
Département de Mathématiques et Statistique
Bureau 4249, Pavillon André-Aisenstadt
2920, chemin de la Tour
Montréal, Québec H3T 1J4
CANADA

Tél.: (00-1) 514-343-6607 / Fax: (00-1) 514-343-5700
laf...@dms.umontreal.ca
http://www.biostatisticien.eu

-- 
Pierre Lafaye de Micheaux

Adresse courrier:
Département de Mathématiques et Statistique
Université de Montréal
CP 6128, succ. Centre-ville
Montréal, Québec H3C 3J7
CANADA

Adresse physique:
Département de Mathématiques et Statistique
Bureau 4249, Pavillon André-Aisenstadt
2920, chemin de la Tour
Montréal, Québec H3T 1J4
CANADA

Tél.: (00-1) 514-343-6607 / Fax: (00-1) 514-343-5700
laf...@dms.umontreal.ca
http://www.biostatisticien.eu


[[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] Help with text separation

2011-11-14 Thread Sarah Goslee
Hi,

On Mon, Nov 14, 2011 at 8:54 AM, Michael Griffiths
 wrote:
> Thank you Sarah,
>
> Your reply was very helpful. I have the added difficulty that I am not only
> dealing with single A-Z characters, but quite often have the following
> situation:
>
> form<-c('~Sentence+LEGAL+Intro+Intro/Intro1+Intro*LEGAL+benefit+benefit/benefit1+product+action+mean+CTA*help')
>
> and again, I need to remove the +'CTA*help' part of the character string.
> However, in another instance I may have
>
> form<-c('~Sentence*LEGAL+Intro+Intro/Intro1+Intro*LEGAL+benefit+benefit/benefit1+product+action+mean+CTA*help')
>
>
> In this case I would need to remove 'Sentence*LEGAL+' from form.
>
> Can this be accomplished in the same manner?

Regular expressions are *very* powerful, so yes. You should read a good
intro to regular expressions, and pay careful attention to the word markers,
then take a look at the specifics of R's implementation.

Why do I send you to the help? Because the possible answers all look a
lot like this:
> form<-c('~Sentence*LEGAL+Intro+Intro/Intro1+Intro*LEGAL+benefit+benefit/benefit1+product+action+mean+CTA*help')
> gsub("\\+\\<\\w*\\>\\*\\<\\w*\\>", "", form)
[1] 
"~Sentence*LEGAL+Intro+Intro/Intro1+benefit+benefit/benefit1+product+action+mean"

Sarah

>
> Many thanks, once again, for your help
>
> Mike Griffiths
>
>
>
> On Mon, Nov 14, 2011 at 12:09 PM, Sarah Goslee 
> wrote:
>>
>> Hi,
>>
>> On Mon, Nov 14, 2011 at 4:20 AM, Michael Griffiths
>>  wrote:
>> > Good morning R list,
>> >
>> > My apologies if this has *already* answered elsewhere, but I have not
>> > found
>> > the answer that I am looking for.
>> >
>> > I have a character string, i.e.
>> >
>> >
>> > form<-c('~ A + B + C + C / D + E + E / F + G + H + I + J + K + L * M')
>> >
>> > Now, my aim is to find the position of all those instances of '*' and to
>> > remove said '*'. However, I would also like to remove the preceding
>> > variable name before the '*', the math operator preceding this, and also
>> > the variable name after the '*'. So, here I would like to remove '+L*M'
>>
>> You just want to get rid of them? gsub() it is.
>>
>> I've changed your formula a little bit to better demonstrate what's going
>> on:
>> > form<-c('~ A + B * C + C / D + E + E / F * G + H + I + J + K + L * M')
>> > gsub(" \\+ [A-Z] \\* [A-Z]", "", form)
>> [1] "~ A + C / D + E + E / F * G + H + I + J + K"
>>
>> That regular expression will take out a
>> space
>> +
>> any capital letter
>> space
>> *
>> space
>> any capital letter.
>>
>> It will take out all occurrences of that sequence, but won't take out
>> occurrences of * not in that sequence.
>>
>> If you don't want the spaces, you don't need them. Just take them out
>> of the regular expression as well.
>>
>> Not that strsplit() was remotely the right tool here, but you can
>> split into characters without a separator:
>> > form <- 'abcd'
>> > strsplit(form, '')
>> [[1]]
>> [1] "a" "b" "c" "d"
>>
>> Sarah
>>
>> > So, far I have come up with the following code:
>> >
>> > parts<-strsplit(form,' ')
>> > index<-which(unlist(parts)=="*")
>> > for (i in 1:length(index)){
>> >    parts[[1]][index[i]]<-list(NULL)
>> >    parts[[1]][index[i]+1]<-list(NULL)
>> >    parts[[1]][index[i]-1]<-list(NULL)
>> >    parts[[1]][index[i]-2]<-list(NULL)
>> > }
>> > new.form<-unlist(parts)
>> >
>> > form<-new.form[0]
>> > for (i in 1: length(new.form)){
>> >    form<-paste(form,new.form[i], sep="")
>> > }
>> >
>> > However, as you can see, I have had to use strsplit in, what I consider
>> > a
>> > rather clumsy manner, as the character string (form) has to be in a
>> > certain
>> > format. All variables and maths operators require a space between them
>> > in
>> > order for strsplit to work in the manner I require.
>> >
>> > I would very much like to accomplish what the above code already does,
>> > but
>> > without the need for the initial character string having the need for
>> > the
>> > aforementioned spaces.
>> >
>> > If the list can offer help, I would be most appreciative.
>> >
>> > Yours
>> >
>> > Mike Griffiths
>> >
>> >
>> >
>> --
>> 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] help in fitted values in lm function

2011-11-14 Thread William Dunlap
If you want fitted() to return NAs in the positions where
there were NA's in data, use na.action=na.exclude in your
call to lm().  E.g.,

  > z <- data.frame(y=1:5, x=c(1,NA,3,3,5))
  > fitted(lm(y~x, data=z))
 1345 
  1.25 3.25 3.25 5.25 
  > fitted(lm(y~x, data=z, na.action=na.exclude))
 12345 
  1.25   NA 3.25 3.25 5.25

I think the help file for model.matrix has more detail,
including how to use options() to set the na.action for
your R session.

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 arunkumar
> Sent: Monday, November 14, 2011 3:36 AM
> To: r-help@r-project.org
> Subject: Re: [R] help in fitted values in lm function
> 
> Yes there are few NA in the Data
> 
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/help-in-fitted-values-in-lm-function-
> tp4038642p4039207.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] lme4:glmer with nested data

2011-11-14 Thread Bert Gunter
1. Post this on the R-sig-mixed-models list, not here.

2. (The following "advice" should be treated cautiously): Forget it! With
only 5 bats, you have too little information to estimate variance
components. Treat the bats as fixed effects and fit via lm (or glm if some
of your responses are not gaussian).

As your statistical skills seem a mite weak, I would also suggest that you
collaborate with your local statistician. As I would not submit my brain
(diminished as it may be)  to someone whose training comes largely from
reading "Brain surgery for Dummies,"  neither would I trust the data
analysis of someone whose statistical background is analogously informed.

Apologies if I have misjudged.

Cheers,
Bert

On Mon, Nov 14, 2011 at 5:44 AM,  wrote:

> Dear all,
>
> I have the following dataset with results from an experiment with
> individual bats that performed two tasks related to prey capture under
> different conditions:
>
> X variables:
> indiv - 5 individual bats used in the experiment; all of which performed
> both tasks
> task - 2 tasks that each individual bat had to perform
> dist - 5 repeated measures of individual bats at 5 different distances
> from the object
>
> all x variables I treat as categorical factors with levels
>
> Y - I have 8 dependent variables related to the structure of ultrasound
> calls emitted by bats when performing each task. I know I can use them
> together in the same model with the function “cbind()” but each variable
> behaves a bit differently. Thus, I guess it would be better to build 8
> separate models.
>
> I believe "indiv" should be a random effect in the model; "dist" and
> "task" should be fixed effects.
>
> I´d like to use the “glmer” (lme4) function to test two hypotheses:
>
> Main hypothesis:
> There are differences in Y measurements between tasks, which are related
> also to distance from the object.
>
> Secondary hypothesis:
> Differences in Y measurements between tasks do not depend on the
> individual.
>
>
> I guess the simplest model for an AIC model selection would be:
> print(Model.01<-glmer(y~task*dist+(1|indiv))
>  - so any model that provides more details should have a lower (better)
>  AIC score.
> I’m not sure if I’m coding the model correctly, so my hypothesis would be
> properly tested.
>
> 1- Literature suggests to get rid of the pseudo-replication: my repeated
> measures (“dist”) seem to behave like longitudinal data (as it is basically
> a time series). This way, "indiv" would be nested in "dist". Furthermore,
> "dist" levels have different variance, so it would be good to group the
> data and somehow tell the model, that it should ignore differences in
> variance.
> (1|dist:indiv) or (dist|indiv)?
> I am still wondering if the “weights=” argument would apply here?
>
> 2- “dist” is nested in “task”, as for both tasks I have the same distances
> measured.
> According to the description of the package “lme4”, I should write:
> print(Model.02<-glmer(y~task*dist+(1|indiv)+(1|task:dist))
>
> 3- according to the text -book “The R book” I understand that I should do
> the following (as mentioned for the ratliver treatment-dataset):
> rename factor levels to unique labels:
> taskdist<-task:dist
> taskdistindiv<-task:dist:indiv
> print(Model.03<-glmer(y~task+(1|taskdist)+(1|taskdistindiv)))
>
> Or, pooling 1 and 3 together myself I would end up with:
> print(Model.04<-glmer(y~dist*task+(1|indiv)+(1|task:dist)+(1|dist:indiv))
>
> I doubt that all of them actually describe correctly what I want the model
> to answer...
>
> I did not find any directly related comment in the R help.
>
> Thank you for your attention and for any help you may provide.
>
> --
>
> __
> 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] help in fitted values in lm function

2011-11-14 Thread Timothy Bates
This caught me learning R, and no doubt thousands of others. 

When would one ever want the results of fitted() or residuals() to NOT match 
the data frame rows which went into the model? Certainly making shrinking the 
results the default is not what 99% of user will want  if they need to access 
residuals: They will want a list of residuals padded with NAs to plot or use in 
further analyses in the originating data frame.

IMHO, the default na.action for lm() should be “na.exclude" (which, believe it 
or not, INcludes NAs in the results…)

Best, tim

On 14 Nov 2011, at 3:49 PM, William Dunlap wrote:
> If you want fitted() to return NAs in the positions where
> there were NA's in data, use na.action=na.exclude in your
> call to lm().  E.g.,
> 
>> z <- data.frame(y=1:5, x=c(1,NA,3,3,5))
>> fitted(lm(y~x, data=z))
> 1345 
>  1.25 3.25 3.25 5.25 
>> fitted(lm(y~x, data=z, na.action=na.exclude))
> 12345 
>  1.25   NA 3.25 3.25 5.25
> 
> I think the help file for model.matrix has more detail,
> including how to use options() to set the na.action for
> your R session.
> 
> 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 arunkumar
>> Sent: Monday, November 14, 2011 3:36 AM
>> To: r-help@r-project.org
>> Subject: Re: [R] help in fitted values in lm function
>> 
>> Yes there are few NA in the Data
>> 
>> --
>> View this message in context: 
>> http://r.789695.n4.nabble.com/help-in-fitted-values-in-lm-function-
>> tp4038642p4039207.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.

__
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] Fit continuous distribution to truncated empirical values

2011-11-14 Thread David Winsemius


On Nov 14, 2011, at 6:11 AM, Michele Mazzucco wrote:


Hello David,

thanks for your answer.
I have done as you told me, however the fit is very poor, much worse  
than that obtained from using the whole dataset (without upper bound).

Any idea?


Counter questions in the absence of data:

??? Is there a reason from domain specific knowledge and theory to  
expect that the procedure you are attempting should be correct?


??? Why would you want to exclude data?

??? Why are you not looking for more general tutorials (such as the  
one by Ricci) rather than asking what is as yet an open-ended question  
on fitting methods that surely does not admit an answer easily  
provided on a mailing list?


--
David.




Thanks,
Michele

On Nov 4, 2011, at 8:56 PM, David Winsemius wrote:



On Nov 3, 2011, at 7:54 AM, Michele Mazzucco wrote:


Hi all,

I am trying to fit a distribution to some data about survival times.
I am interested only in a specific interval, e.g., while the data  
lies in the interval (0,, 600), I want the best for the  
interval (0,..., 24).


I have tried both fitdistr (MASS package) and fitdist (from the  
fitdistrplus package), but I could not get them working, e.g.


fitdistr(left, "weibull", upper=24)
Error in optim(x = c(529L, 528L, 527L, 526L, 525L, 524L, 523L,  
522L, 521L,  :

L-BFGS-B needs finite values of 'fn'
In addition: Warning message:
In dweibull(x, shape, scale, log) : NaNs produced

Am I doing something wrong?


You didn't supply data to test,  but shouldn't you supply a lower  
bound if you want to fit "weibull"? It is, after all, bounded at 0.


left <- c(529L, 528L, 527L, 526L, 525L, 524L, 523L, 522L, 521L,  
50*runif(100))

fitdistr(left, "weibull", upper=24)
Error in optim(x = c(529, 528, 527, 526, 525, 524, 523, 522, 521,  
18.3964251773432,  :

L-BFGS-B needs finite values of 'fn'
In addition: Warning message:
In dweibull(x, shape, scale, log) : NaNs produced


fitdistr(left, "weibull", upper=24, lower=0.5)

shape scale
 0.58195013   24.
( 0.04046087) ( 3.38621367)




Thanks,
Michele


p.s. I have seen similar posts, e.g., http://tolstoy.newcastle.edu.au/R/help/05/02/11558.html 
, but I am not sure whether I can apply the same approach here.

__
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, MD
Heritage Laboratories
West Hartford, CT





David Winsemius, MD
West Hartford, CT

__
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] max & min values within dataframe

2011-11-14 Thread B Laura
dear R-team

I need to find the min, max values for each patient from dataset and keep
the output of it as a dataframe with the following columns
 - Patient nr
 - Region (remains same per patient)
 - Min score
 - Max score


Patient Region Score Time
11  X19   28
21  X20  126
31  X22  100
41  X25  191
52  Y121
62  Y122
72  Y254
82  Y267
93  X 61
10   3  X 64
11   3  X21   31
12   3  X22   68
13   3  X23   31
14   3  X24   38
15   3  X21   15
16   3  X22   24
17   3  X23   15
18   3  X24  243
19   3  X25   77
20   4  Y 65
21   4  Y22   28
22   4  Y23   75
23   4  Y24   19
24   5  Y233
25   5  Y241
26   5  Y23   33
27   5  Y24   13
28   5  Y25   42
29   5  Y26   21
30   5  Y274
31   6  Y244
32   6  Y328

So far I could find the min and max values for each patient, but the output
of it is not (yet) what I need.

> Patient.nr = unique(Patient)
> aggregate(Score, list(Patient), max)
  Group.1  x
1   1 25
2   2 26
3   3 25
4   4 24
5   5 27
6   6 32

> aggregate(Score, list(Patient), min)
  Group.1  x
1   1 19
2   2 12
3   3  6
4   4  6
5   5 23
6   6 24
I would like to do same but writing this new information (min, max values)
in a dataframe with following columns
 - Patient nr
- Region (remains same per patient)
- Min score
- Max score

Can anybody help me with this?

Thanks
Laura

[[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] Upgrade R?

2011-11-14 Thread Kevin Burton
I am also using statConn so I will let you know if I hear anything new.

-Original Message-
From: Cem Girit [mailto:gi...@comcast.net] 
Sent: Monday, November 14, 2011 8:52 AM
To: 'Kevin Burton'
Cc: r-help@r-project.org
Subject: RE: [R] Upgrade R?

Hello Kevin,

Thank you. I will delete the folder and run an application called
CCleaner (free). That will remove all the broken registry entries.

There should be a problem free update path for R installation. As
you rightfully mentioned the R- manual is not clear about package update
issues. I received many helpful suggestions on the update path but some of
the them were contradictory in the order of steps to be taken.  I am also
using statConn (DCOM) interface for programming.  So my problems are
multifold.  I will compile the answers I received on the R version update
issue and publish them so that that the experts could put them into more
effective use.

Sincerely,

Cem


-Original Message-
From: Kevin Burton [mailto:rkevinbur...@charter.net]
Sent: Sunday, November 13, 2011 4:11 PM
To: 'Cem Girit'
Subject: RE: [R] Upgrade R?

I don't know if it was correct but I just removed the directory and then
searched and removed all instances in the registry that referred to 2.13.1
(in my case searching for this seemed to only return references to 'R'). I
have since been given some links that address specific registry entries but
I haven't had any problem yet with my 'slash and burn' approach. It removed
it from the 'Install/Uninstall' list with windows so it seems to have be
removed and the disk space that 2.13.2 took up has been reclaimed. 

Hope this helps. Let me know if you find any more definitive answers.

Thanks.

Kevin

-Original Message-
From: Cem Girit [mailto:gi...@comcast.net]
Sent: Saturday, November 12, 2011 6:33 PM
To: 'Kevin Burton'
Subject: RE: [R] Upgrade R?

Hello Kevin,

I am getting the same error "utCompiledCode..." since I  installed
R2.14 while R2.13 existed.  How did you get rid of R2.13 eventually? Did you
just delete it? If so, how did you clean the registry? 

Thank you,

Cem

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Kevin Burton
Sent: Thursday, November 10, 2011 11:54 AM
To: 'jose Bartolomei'; 'R Help'
Subject: Re: [R] Upgrade R?

The problem with this documentation is two-fold. One it seems to concentrate
on building from source which I don't need. Two it doesn't address the
upgade. I have a number of packages and so I need to do what has been
suggested and install the latest version *first*. Then copy the libraries
(packages). Then uninstall the previous version. It is on this last step
that I am stuck on right now. The last link on uninstalling R manually was
what I needed. Thank you.

 

Kevin

 

From: jose Bartolomei [mailto:surfpr...@hotmail.com]
Sent: Thursday, November 10, 2011 10:19 AM
To: rkevinbur...@charter.net; R Help
Subject: RE: [R] Upgrade R?

 

Hi,
Don't know if this will help you but...
In my short experience and following the guidelines you should first
uninstall R.

http://cran.r-project.org/doc/manuals/R-admin.html#Installing-R-under-Window
s
 
Unistall it from the Windows control panel.
 
The old R version libraries file will be kept on machine.
For example : C:\Program Files\R\R-2.13.0\library
 
Then install the new version via:
http://cran.r-project.org/doc/manuals/R-admin.html#Installing-R-under-Window
s
 
You can copy/paste libraries from the old version R library file to the new
one.
C:\Program Files\R\R-2.14.0\library
 
There is too an function named:
?update.packagee

If above was what you did, then there is a post on Uninstalling R manually:
 
http://learnserver.csd.univie.ac.at/rcomwiki/doku.php?id=wiki:uninstalling_r
_manually
 
Regards,
Jose
 

> From: rkevinbur...@charter.net
> To: r-help@r-project.org
> Date: Thu, 10 Nov 2011 09:07:20 -0600
> Subject: Re: [R] Upgrade R?
> 
> Since apparently there is no one familiar with this error message let 
> me rephrase the question. Is there a 'manual' process to fully remove 
> a
version
> of 'R' from my machine? This is a Window PC running Windows 7.
> 
> 
> 
> Thank you.
> 
> 
> 
> Kevin
> 
> 
> 
> From: Kevin Burton [mailto:rkevinbur...@charter.net]
> Sent: Monday, November 07, 2011 2:23 PM
> To: 'r-help@r-project.org'
> Subject: Upgrade R?
> 
> 
> 
> I am trying to upgrade to R 2.14 from R 2.13.1 I have compied all the 
> libraries from the 'library' directory in my existing installation
(2.13.1)
> to the installed R 2.14. Now I want to uninstall the old installation 
> (R
> 2.13.1) and I get the error:
> 
> 
> 
> Internal Error: Cannot find utCompiledCode record for this version of 
> the uninstaller.
> 
> 
> 
> Any ideas?
> 
> 
> 
> Kevin
> 
> 
> [[alternative HTML version deleted]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] max & min values within dataframe

2011-11-14 Thread Sarah Goslee
Hi Laura,

This looks suspiciously like homework. Nonetheless, you may wish to
check out ?cbind.

Sarah

On Mon, Nov 14, 2011 at 11:10 AM, B Laura  wrote:
> dear R-team
>
> I need to find the min, max values for each patient from dataset and keep
> the output of it as a dataframe with the following columns
>  - Patient nr
>  - Region (remains same per patient)
>  - Min score
>  - Max score
>
>
>    Patient Region Score Time
> 1        1      X    19   28
> 2        1      X    20  126
> 3        1      X    22  100
> 4        1      X    25  191
> 5        2      Y    12    1
> 6        2      Y    12    2
> 7        2      Y    25    4
> 8        2      Y    26    7
> 9        3      X     6    1
> 10       3      X     6    4
> 11       3      X    21   31
> 12       3      X    22   68
> 13       3      X    23   31
> 14       3      X    24   38
> 15       3      X    21   15
> 16       3      X    22   24
> 17       3      X    23   15
> 18       3      X    24  243
> 19       3      X    25   77
> 20       4      Y     6    5
> 21       4      Y    22   28
> 22       4      Y    23   75
> 23       4      Y    24   19
> 24       5      Y    23    3
> 25       5      Y    24    1
> 26       5      Y    23   33
> 27       5      Y    24   13
> 28       5      Y    25   42
> 29       5      Y    26   21
> 30       5      Y    27    4
> 31       6      Y    24    4
> 32       6      Y    32    8
>
> So far I could find the min and max values for each patient, but the output
> of it is not (yet) what I need.
>
>> Patient.nr = unique(Patient)
>> aggregate(Score, list(Patient), max)
>  Group.1  x
> 1       1 25
> 2       2 26
> 3       3 25
> 4       4 24
> 5       5 27
> 6       6 32
>
>> aggregate(Score, list(Patient), min)
>  Group.1  x
> 1       1 19
> 2       2 12
> 3       3  6
> 4       4  6
> 5       5 23
> 6       6 24
> I would like to do same but writing this new information (min, max values)
> in a dataframe with following columns
>  - Patient nr
> - Region (remains same per patient)
> - Min score
> - Max score
>
> Can anybody help me with this?
>
> Thanks
> Laura

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


[R] rugarch data format?

2011-11-14 Thread Kevin Burton
I am sorry to ask this group but the maintainer of this package did not
leave an email address. 

 

Has anyone used or is using the 'rugarch' package with time-series data
(ts)? I try to fit a GARCH model to my data using the following:

 

> gf <- ugarchfit(data=l[["MEN"]]$series, spec=spec)

 

and I get:

 

Error in .extractdata(data) : 

rgarch-->error: class of data object not recognized

 

> class(l[["MEN"]]$series)

[1] "ts"

 

The documentation states that :

 


data

A univariate data object. Can be a numeric vector, matrix, data.frame, zoo,
xts, timeSeries, ts or irts object.

 

I am not sure what I am doing wrong.

 

Thank you.

 

Kevin


[[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] Fit continuous distribution to truncated empirical values

2011-11-14 Thread Michele Mazzucco
David,

here is the smallest dataset

# Bid   Price   SurvivalCensored
0.030.029   1   1
0.030.029   11  1
0.030.029   10  1
0.030.029   9   1
0.030.029   8   1
0.030.029   7   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   1   1
0.030.029   1   1
0.030.029   9   1
0.030.029   8   1
0.030.029   7   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   16  1
0.030.029   15  1
0.030.029   14  1
0.030.029   13  1
0.030.029   12  1
0.030.029   11  1
0.030.029   10  1
0.030.029   9   1
0.030.029   8   1
0.030.029   7   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   7   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   30  1
0.030.029   29  1
0.030.029   28  1
0.030.029   27  1
0.030.029   26  1
0.030.029   25  1
0.030.029   24  1
0.030.029   23  1
0.030.029   22  1
0.030.029   21  1
0.030.029   20  1
0.030.029   19  1
0.030.029   18  1
0.030.029   17  1
0.030.029   16  1
0.030.029   15  1
0.030.029   14  1
0.030.029   13  1
0.030.029   12  1
0.030.029   11  1
0.030.029   10  1
0.030.029   9   1
0.030.029   8   1
0.030.029   7   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   8   1
0.030.029   7   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.027   71  0
0.030.027   70  0
0.030.027   69  0
0.030.027   68  0
0.030.027   67  0
0.030.027   66  0
0.030.027   65  0
0.030.027   64  0
0.030.027   63  0
0.030.027   62  0
0.030.027   61  0
0.030.027   60  0
0.030.027   59  0
0.030.027   58  0
0.030.027   57  0
0.030.027   56  0
0.030.027   55  0
0.030.027   54  0
0.030.027   53  0
0.030.027   52  0
0.030.027   51  0
0.030.027   50  0
0.030.027   49  0
0.030.027   48  0
0.030.027   47  0
0.030.027   46  0
0.030.027   45  0
0.030.027   44  0
0.030.027   43  0
0.030.027   42  0
0.030.027   41  0
0.030.027   40  0
0.030.027   39  0
0.030.027   38  0
0.030.027   37  0
0.030.027   36  0
0.030.027   35  0
0.030.027   34  0
0.030.027   33  0
0.030.027   32  0
0.030.027   31  0
0.030.027   30  0
0.030.027   29  0
0.030.027   28  0
0.030.027   27  0
0.030.027   26  0
0.030.027   25  0
0.030.027   24  0
0.030.027   23  0
0.030.027   22  0
0.030.027   21  0
0.030.027   20  0
0.030.027   19  0
0.030.027   18  0
0.030.027   17  0
0.030.027   16  0
0.030.027   15  0
0.030.027   14  0
0.030.027   13  0
0.030.027   12  0
0.030.027   11  0
0.030.027   10  0
0.030.027   9   0
0.030.027   8   0
0.030.027   7   0
0.030.027   6   0
0.030.027   5   0
0.030.027   4   0
0.030.027   3   0
0.030.027   2   0
0.030.027   1   0


This is column # 3
1 11 10  9  8  7  6  5  4  3  2  1  1  1  9  8  7  6  5  4  3  2  1 16 15 14 
13 12 11 10  9  8  7  6  5  4  3  2  1  6  5  4  3  2  1  7  6  5  4  3  2  1
5  4  3  2  1  4  3  2  1  6  5  4  3  2  1 30 29 28 27 26 25 2

Re: [R] Fit continuous distribution to truncated empirical values

2011-11-14 Thread Bert Gunter
A non-helpful reply on a "language" issue.

"Truncated" data are quite different than "censored" data and require
different methodologies to analyze. You -- and many others in their
postings -- have appeared to confuse the two here.

-- Bert



On Mon, Nov 14, 2011 at 8:20 AM, Michele Mazzucco  wrote:

> David,
>
> here is the smallest dataset
>
> # Bid   Price   SurvivalCensored
> 0.030.029   1   1
> 0.030.029   11  1
> 0.030.029   10  1
> 0.030.029   9   1
> 0.030.029   8   1
> 0.030.029   7   1
> 0.030.029   6   1
> 0.030.029   5   1
> 0.030.029   4   1
> 0.030.029   3   1
> 0.030.029   2   1
> 0.030.029   1   1
> 0.030.029   1   1
> 0.030.029   1   1
> 0.030.029   9   1
> 0.030.029   8   1
> 0.030.029   7   1
> 0.030.029   6   1
> 0.030.029   5   1
> 0.030.029   4   1
> 0.030.029   3   1
> 0.030.029   2   1
> 0.030.029   1   1
> 0.030.029   16  1
> 0.030.029   15  1
> 0.030.029   14  1
> 0.030.029   13  1
> 0.030.029   12  1
> 0.030.029   11  1
> 0.030.029   10  1
> 0.030.029   9   1
> 0.030.029   8   1
> 0.030.029   7   1
> 0.030.029   6   1
> 0.030.029   5   1
> 0.030.029   4   1
> 0.030.029   3   1
> 0.030.029   2   1
> 0.030.029   1   1
> 0.030.029   6   1
> 0.030.029   5   1
> 0.030.029   4   1
> 0.030.029   3   1
> 0.030.029   2   1
> 0.030.029   1   1
> 0.030.029   7   1
> 0.030.029   6   1
> 0.030.029   5   1
> 0.030.029   4   1
> 0.030.029   3   1
> 0.030.029   2   1
> 0.030.029   1   1
> 0.030.029   5   1
> 0.030.029   4   1
> 0.030.029   3   1
> 0.030.029   2   1
> 0.030.029   1   1
> 0.030.029   4   1
> 0.030.029   3   1
> 0.030.029   2   1
> 0.030.029   1   1
> 0.030.029   6   1
> 0.030.029   5   1
> 0.030.029   4   1
> 0.030.029   3   1
> 0.030.029   2   1
> 0.030.029   1   1
> 0.030.029   30  1
> 0.030.029   29  1
> 0.030.029   28  1
> 0.030.029   27  1
> 0.030.029   26  1
> 0.030.029   25  1
> 0.030.029   24  1
> 0.030.029   23  1
> 0.030.029   22  1
> 0.030.029   21  1
> 0.030.029   20  1
> 0.030.029   19  1
> 0.030.029   18  1
> 0.030.029   17  1
> 0.030.029   16  1
> 0.030.029   15  1
> 0.030.029   14  1
> 0.030.029   13  1
> 0.030.029   12  1
> 0.030.029   11  1
> 0.030.029   10  1
> 0.030.029   9   1
> 0.030.029   8   1
> 0.030.029   7   1
> 0.030.029   6   1
> 0.030.029   5   1
> 0.030.029   4   1
> 0.030.029   3   1
> 0.030.029   2   1
> 0.030.029   1   1
> 0.030.029   8   1
> 0.030.029   7   1
> 0.030.029   6   1
> 0.030.029   5   1
> 0.030.029   4   1
> 0.030.029   3   1
> 0.030.029   2   1
> 0.030.029   1   1
> 0.030.029   4   1
> 0.030.029   3   1
> 0.030.029   2   1
> 0.030.029   1   1
> 0.030.027   71  0
> 0.030.027   70  0
> 0.030.027   69  0
> 0.030.027   68  0
> 0.030.027   67  0
> 0.030.027   66  0
> 0.030.027   65  0
> 0.030.027   64  0
> 0.030.027   63  0
> 0.030.027   62  0
> 0.030.027   61  0
> 0.030.027   60  0
> 0.030.027   59  0
> 0.030.027   58  0
> 0.030.027   57  0
> 0.030.027   56  0
> 0.030.027   55  0
> 0.030.027   54  0
> 0.030.027   53  0
> 0.030.027   52  0
> 0.030.027   51  0
> 0.030.027   50  0
> 0.030.027   49  0
> 0.030.027   48  0
> 0.030.027   47  0
> 0.030.027   46  0
> 0.030.027   45  0
> 0.030.027   44  0
> 0.030.027   43  0
> 0.030.027   42  0
> 0.030.027   41  0
> 0.030.027   40  0
> 0.030.027   39  0
> 0.030.027   38  0
> 0.030.027   37  0
> 0.030.027   36  0
> 0.030.027   35  0
> 0.030.027   34  0
> 0.030.027   33  0
> 0.030.027   32  0
> 0.030.027   31  0
> 0.030.027   30  0
> 0.030.027   29  0
> 0.030.027   28  0
> 0.030.027   27  0
> 0.030.027   26  0
> 0.030.027   25  0
> 0.030.027   24  0
> 0.030.027   23  0
> 0.030.027   22  0
> 0.030.027   21  0
> 0.030.027   20  0
> 0.030.027   19  0
> 0.030.027   18  0
> 0.030.027   17  0
> 0.030.027 

Re: [R] max & min values within dataframe

2011-11-14 Thread Joshua Wiley
Hi Laura,

You were close.  Just use range() instead of min/max:

## your data (read in and then pasted the output of dput() to make it easy)
dat <- structure(list(Patient = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L,
5L, 5L, 5L, 5L, 5L, 6L, 6L), Region = structure(c(1L, 1L, 1L,
1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("X",
"Y"), class = "factor"), Score = c(19L, 20L, 22L, 25L, 12L, 12L,
25L, 26L, 6L, 6L, 21L, 22L, 23L, 24L, 21L, 22L, 23L, 24L, 25L,
6L, 22L, 23L, 24L, 23L, 24L, 23L, 24L, 25L, 26L, 27L, 24L, 32L
), Time = c(28L, 126L, 100L, 191L, 1L, 2L, 4L, 7L, 1L, 4L, 31L,
68L, 31L, 38L, 15L, 24L, 15L, 243L, 77L, 5L, 28L, 75L, 19L, 3L,
1L, 33L, 13L, 42L, 21L, 4L, 4L, 8L)), .Names = c("Patient", "Region",
"Score", "Time"), class = "data.frame", row.names = c("1", "2",
"3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14",
"15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25",
"26", "27", "28", "29", "30", "31", "32"))

tmp <- with(dat, aggregate(Score, list(Patient), range))
tmpreg <-  with(dat, Region[!duplicated(Patient)])

results <- data.frame(tmp$Group.1, tmpreg, tmp$x)
colnames(results) <- c("Patient", "Region", "Min", "Max")

Note it is a little tricky to get the results in a data frame, because
tmp is a bit of an odd data frame---due to the way aggregate works,
the the first column of the data frame is a regular vector, but the
second column actually contains a two column matrix.  To get it into
regular form, I extracted them separately when creating 'results'.

Cheers,

Josh

On Mon, Nov 14, 2011 at 8:10 AM, B Laura  wrote:
> dear R-team
>
> I need to find the min, max values for each patient from dataset and keep
> the output of it as a dataframe with the following columns
>  - Patient nr
>  - Region (remains same per patient)
>  - Min score
>  - Max score
>
>
>    Patient Region Score Time
> 1        1      X    19   28
> 2        1      X    20  126
> 3        1      X    22  100
> 4        1      X    25  191
> 5        2      Y    12    1
> 6        2      Y    12    2
> 7        2      Y    25    4
> 8        2      Y    26    7
> 9        3      X     6    1
> 10       3      X     6    4
> 11       3      X    21   31
> 12       3      X    22   68
> 13       3      X    23   31
> 14       3      X    24   38
> 15       3      X    21   15
> 16       3      X    22   24
> 17       3      X    23   15
> 18       3      X    24  243
> 19       3      X    25   77
> 20       4      Y     6    5
> 21       4      Y    22   28
> 22       4      Y    23   75
> 23       4      Y    24   19
> 24       5      Y    23    3
> 25       5      Y    24    1
> 26       5      Y    23   33
> 27       5      Y    24   13
> 28       5      Y    25   42
> 29       5      Y    26   21
> 30       5      Y    27    4
> 31       6      Y    24    4
> 32       6      Y    32    8
>
> So far I could find the min and max values for each patient, but the output
> of it is not (yet) what I need.
>
>> Patient.nr = unique(Patient)
>> aggregate(Score, list(Patient), max)
>  Group.1  x
> 1       1 25
> 2       2 26
> 3       3 25
> 4       4 24
> 5       5 27
> 6       6 32
>
>> aggregate(Score, list(Patient), min)
>  Group.1  x
> 1       1 19
> 2       2 12
> 3       3  6
> 4       4  6
> 5       5 23
> 6       6 24
> I would like to do same but writing this new information (min, max values)
> in a dataframe with following columns
>  - Patient nr
> - Region (remains same per patient)
> - Min score
> - Max score
>
> Can anybody help me with this?
>
> Thanks
> Laura
>
>        [[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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.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] Very simple loop

2011-11-14 Thread Davg
I'm very new to R and am trying to create my first loop.

I have:

x <-c(0:200)
A <- dpois(x,exp(4.5355343))
B <- dpois(x,exp(4.5355343 + 0.0118638))
C <- dpois(x,exp(4.5355343  -0.0234615))
D <- dpois(x,exp(4.5355343 + 0.0316557))
E <- dpois(x,exp(4.5355343 + 0.0004716))
F <- dpois(x,exp(4.5355343 + 0.056437))
G <- dpois(x,exp(4.5355343 + 0.1225822))

and would like to to get A[K] + B[K] + C[K] + D[K] + E[K] + F[K] G[K]
for K(0:200)

And then plot these cumulative values.

Many thanks.


--
View this message in context: 
http://r.789695.n4.nabble.com/Very-simple-loop-tp4039895p4039895.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] size of pdf/eps output

2011-11-14 Thread Johannes Radinger
Hello,

I am using a grid.layout for combining multiple ggplot-plots.
So far I am doing it this way to get a pdf/eps:

pdf("/path/to/my/file.pdf") #or postscript("/path/to/my/file.eps")
grid.newpage()
pushViewport(viewport(layout = grid.layout(nrow=2, ncol=2,
widths = unit(c(7.5,7), "cm"),
heights = unit(rep(5, 2), "cm"
print(plot1, vp = viewport(layout.pos.row = 1, layout.pos.col = 1))
print(plot2, vp = viewport(layout.pos.row = 1, layout.pos.col = 2))
print(plot3, vp = viewport(layout.pos.row = 2, layout.pos.col = 1))
dev.off()

With that method I get really nice plots but there is much white space
around them. I'd like to crop the pdf/eps automatically to the maximum
extend of the plot. How can that be done? Is that a setting with viewport?

Thank you very much for your help

/Johannes


--

__
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] Very simple loop

2011-11-14 Thread Sarah Goslee
Hi,

On Mon, Nov 14, 2011 at 10:59 AM, Davg  wrote:
> I'm very new to R and am trying to create my first loop.
>
> I have:
>
> x <-c(0:200)
> A <- dpois(x,exp(4.5355343))
> B <- dpois(x,exp(4.5355343 + 0.0118638))
> C <- dpois(x,exp(4.5355343  -0.0234615))
> D <- dpois(x,exp(4.5355343 + 0.0316557))
> E <- dpois(x,exp(4.5355343 + 0.0004716))
> F <- dpois(x,exp(4.5355343 + 0.056437))
> G <- dpois(x,exp(4.5355343 + 0.1225822))
>
> and would like to to get A[K] + B[K] + C[K] + D[K] + E[K] + F[K] G[K]
> for K(0:200)

R indexing starts with 1, so even though x starts with 0, the corresponding
index is 1:201

You don't need a loop at all: R can easily handle this with:

all.sum <- A + B + C + D + E + F + G

> And then plot these cumulative values.

What kind of plot? You might check out
?hist
and
?plot
for ideas.

Sarah
-- 
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] Very simple loop

2011-11-14 Thread jim holtman
x <-c(0:200)
A <- dpois(x,exp(4.5355343))
B <- dpois(x,exp(4.5355343 + 0.0118638))
C <- dpois(x,exp(4.5355343  -0.0234615))
D <- dpois(x,exp(4.5355343 + 0.0316557))
E <- dpois(x,exp(4.5355343 + 0.0004716))
F <- dpois(x,exp(4.5355343 + 0.056437))
G <- dpois(x,exp(4.5355343 + 0.1225822))
total <- A + B + C + D + E + F + G
matplot(cbind(A, B, C, D, E, F, G, total))



On Mon, Nov 14, 2011 at 10:59 AM, Davg  wrote:
> I'm very new to R and am trying to create my first loop.
>
> I have:
>
> x <-c(0:200)
> A <- dpois(x,exp(4.5355343))
> B <- dpois(x,exp(4.5355343 + 0.0118638))
> C <- dpois(x,exp(4.5355343  -0.0234615))
> D <- dpois(x,exp(4.5355343 + 0.0316557))
> E <- dpois(x,exp(4.5355343 + 0.0004716))
> F <- dpois(x,exp(4.5355343 + 0.056437))
> G <- dpois(x,exp(4.5355343 + 0.1225822))
>
> and would like to to get A[K] + B[K] + C[K] + D[K] + E[K] + F[K] G[K]
> for K(0:200)
>
> And then plot these cumulative values.
>
> Many thanks.
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Very-simple-loop-tp4039895p4039895.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
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.

__
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] Very simple loop

2011-11-14 Thread Joshua Wiley
x <-c(0:200)
dat <- data.frame(
  A = dpois(x,exp(4.5355343)),
  B = dpois(x,exp(4.5355343 + 0.0118638)),
  C = dpois(x,exp(4.5355343  -0.0234615)),
  D = dpois(x,exp(4.5355343 + 0.0316557)),
  E = dpois(x,exp(4.5355343 + 0.0004716)),
  F = dpois(x,exp(4.5355343 + 0.056437)),
  G = dpois(x,exp(4.5355343 + 0.1225822)))

## using a looping approach
## instantiate a vector to hold results
results <- vector("numeric", length = length(x))

for(i in 1:201) {# R starts indexing at 1, not 0
  results[i] <- dat[i, "A"] + dat[i, "B"] + dat[i, "C"] +
dat[i, "D"] + dat[i, "E"] + dat[i, "F"] + dat[i, "G"]
}

## find and plot cumulatively values
plot(x, cumsum(results))

You may be wondering why I put all the variables in a data frame.  It
is because it will be much easier in the long run.  This accomplishes
the same thing as the loop, with a fraction of the effort and much
much faster (loops can be slow in R, and vectorizing is preferred).

plot(x, cumsum(rowSums(dat)))

rowSums() is a vectorized function that finds the (duh) sums of each
row, then I just find the cumulative sum, and plot.

Hope this helps,

Josh

On Mon, Nov 14, 2011 at 7:59 AM, Davg  wrote:
> I'm very new to R and am trying to create my first loop.
>
> I have:
>
> x <-c(0:200)
> A <- dpois(x,exp(4.5355343))
> B <- dpois(x,exp(4.5355343 + 0.0118638))
> C <- dpois(x,exp(4.5355343  -0.0234615))
> D <- dpois(x,exp(4.5355343 + 0.0316557))
> E <- dpois(x,exp(4.5355343 + 0.0004716))
> F <- dpois(x,exp(4.5355343 + 0.056437))
> G <- dpois(x,exp(4.5355343 + 0.1225822))
>
> and would like to to get A[K] + B[K] + C[K] + D[K] + E[K] + F[K] G[K]
> for K(0:200)
>
> And then plot these cumulative values.
>
> Many thanks.
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Very-simple-loop-tp4039895p4039895.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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.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] Very simple loop

2011-11-14 Thread R. Michael Weylandt
But the awesome thing is you don't need a for loop at all thanks to
the magic of R's vectorization!

This will do it (and much faster than an R level loop would):

x = 0:200 # Note that you don't need a c() since you aren't
concatenating 0:200 with anything
A <- dpois(x,exp(4.5355343))
B <- dpois(x,exp(4.5355343 + 0.0118638))
C <- dpois(x,exp(4.5355343  -0.0234615))
D <- dpois(x,exp(4.5355343 + 0.0316557))
E <- dpois(x,exp(4.5355343 + 0.0004716))
F <- dpois(x,exp(4.5355343 + 0.056437))
G <- dpois(x,exp(4.5355343 + 0.1225822))

Y = A + B + C + D+ E+ F + G

plot(x, Y)

I'd advise you to look around for a good R guide: (there are quite a
few free online, many tailored to specific disciplines) vectorization
is pretty sweet and if you don't get into it early, you'll find R to
be much more cumbersome and slow than it truly is.

Hope this helps,

Michael

On Mon, Nov 14, 2011 at 10:59 AM, Davg  wrote:
> I'm very new to R and am trying to create my first loop.
>
> I have:
>
> x <-c(0:200)
> A <- dpois(x,exp(4.5355343))
> B <- dpois(x,exp(4.5355343 + 0.0118638))
> C <- dpois(x,exp(4.5355343  -0.0234615))
> D <- dpois(x,exp(4.5355343 + 0.0316557))
> E <- dpois(x,exp(4.5355343 + 0.0004716))
> F <- dpois(x,exp(4.5355343 + 0.056437))
> G <- dpois(x,exp(4.5355343 + 0.1225822))
>
> and would like to to get A[K] + B[K] + C[K] + D[K] + E[K] + F[K] G[K]
> for K(0:200)
>
> And then plot these cumulative values.
>
> Many thanks.
>
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Very-simple-loop-tp4039895p4039895.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] max & min values within dataframe

2011-11-14 Thread R. Michael Weylandt
I took a stab at this using ddply() from the plyr package. How's this
look to you?

x<- textConnection("Col   Patient Region Score Time
11  X19   28
21  X20  126
31  X22  100
41  X25  191
52  Y121
62  Y122
72  Y254
82  Y267
93  X 61
10   3  X 64
11   3  X21   31
12   3  X22   68
13   3  X23   31
14   3  X24   38
15   3  X21   15
16   3  X22   24
17   3  X23   15
18   3  X24  243
19   3  X25   77
20   4  Y 65
21   4  Y22   28
22   4  Y23   75
23   4  Y24   19
24   5  Y233
25   5  Y241
26   5  Y23   33
27   5  Y24   13
28   5  Y25   42
29   5  Y26   21
30   5  Y274
31   6  Y244
32   6  Y328")
V = read.table(x, header = T)[,-1]
closeAllConnections()
rm("x")
# Everything above is just stuff to get the data in.

R <- ddply(V, c("Patient","Region"), function(d) {c(max =
max(d$Score),min = min(d$Score))})

Patient Region max min
1   1  X  25  19
2   2  Y  26  12
3   3  X  25   6
4   4  Y  24   6
5   5  Y  27  23
6   6  Y  32  24

Michael

On Mon, Nov 14, 2011 at 11:32 AM, Joshua Wiley  wrote:
> Hi Laura,
>
> You were close.  Just use range() instead of min/max:
>
> ## your data (read in and then pasted the output of dput() to make it easy)
> dat <- structure(list(Patient = c(1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 3L,
> 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L,
> 5L, 5L, 5L, 5L, 5L, 6L, 6L), Region = structure(c(1L, 1L, 1L,
> 1L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
> 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("X",
> "Y"), class = "factor"), Score = c(19L, 20L, 22L, 25L, 12L, 12L,
> 25L, 26L, 6L, 6L, 21L, 22L, 23L, 24L, 21L, 22L, 23L, 24L, 25L,
> 6L, 22L, 23L, 24L, 23L, 24L, 23L, 24L, 25L, 26L, 27L, 24L, 32L
> ), Time = c(28L, 126L, 100L, 191L, 1L, 2L, 4L, 7L, 1L, 4L, 31L,
> 68L, 31L, 38L, 15L, 24L, 15L, 243L, 77L, 5L, 28L, 75L, 19L, 3L,
> 1L, 33L, 13L, 42L, 21L, 4L, 4L, 8L)), .Names = c("Patient", "Region",
> "Score", "Time"), class = "data.frame", row.names = c("1", "2",
> "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14",
> "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25",
> "26", "27", "28", "29", "30", "31", "32"))
>
> tmp <- with(dat, aggregate(Score, list(Patient), range))
> tmpreg <-  with(dat, Region[!duplicated(Patient)])
>
> results <- data.frame(tmp$Group.1, tmpreg, tmp$x)
> colnames(results) <- c("Patient", "Region", "Min", "Max")
>
> Note it is a little tricky to get the results in a data frame, because
> tmp is a bit of an odd data frame---due to the way aggregate works,
> the the first column of the data frame is a regular vector, but the
> second column actually contains a two column matrix.  To get it into
> regular form, I extracted them separately when creating 'results'.
>
> Cheers,
>
> Josh
>
> On Mon, Nov 14, 2011 at 8:10 AM, B Laura  wrote:
>> dear R-team
>>
>> I need to find the min, max values for each patient from dataset and keep
>> the output of it as a dataframe with the following columns
>>  - Patient nr
>>  - Region (remains same per patient)
>>  - Min score
>>  - Max score
>>
>>
>>    Patient Region Score Time
>> 1        1      X    19   28
>> 2        1      X    20  126
>> 3        1      X    22  100
>> 4        1      X    25  191
>> 5        2      Y    12    1
>> 6        2      Y    12    2
>> 7        2      Y    25    4
>> 8        2      Y    26    7
>> 9        3      X     6    1
>> 10       3      X     6    4
>> 11       3      X    21   31
>> 12       3      X    22   68
>> 13       3      X    23   31
>> 14       3      X    24   38
>> 15       3      X    21   15
>> 16       3      X    22   24
>> 17       3      X    23   15
>> 18       3      X    24  243
>> 19       3      X    25   77
>> 20       4      Y     6    5
>> 21       4      Y    22   28
>> 22       4      Y    23   75
>> 23       4      Y    24   19
>> 24       5      Y    23    3
>> 25       5      Y    24    1
>> 26       5      Y    23   33
>> 27       5      Y    24   13
>> 28       5      Y    25   42
>> 29       5      Y    26   21
>> 30       5      Y    27    4
>> 31       6      Y    24    4
>> 32       6      Y    32    8
>>
>> So far I could find the min and max values for each patient, but the output
>> of it is not (yet) what I need.
>>
>>> Patient.nr = unique(Patient)
>>> aggregate(Score, list(Patient), max)
>>  Group.1  x
>> 1       1 25
>> 2       2 26
>> 3       3 25
>> 4       4 24
>> 5       5 27
>> 6       6 32
>>
>>> aggregate(Score, list(Patient), min)
>>  Group.1  x
>> 1       1 19
>

[R] unable to get "R CMD" to work as expected on a 64 bit windows machine

2011-11-14 Thread Martyn Byng
Hi,

I've just downloaded and installed R 2.14.0 using the windows binary on
a 64bit windows machine running windows 7.

Rterm / RGui work as expected, as does

R CMD --help

and

R CMD BATCH --help

however

R CMD check --help

returns no information and I seem to be unable to check a package.

Various other options also seem to not be working as expected, i.e. 

R CMD REMOVE aa

(where aa is just a garbage name) appears to do nothing (whereas the
same command on a 32bit windows machine returns with a message that
package aa does not exist.) 

Just invoking R on the command line appears to do nothing on 64 bit
windows as opposed to starting a command line version of R (ala Rterm)
on 32 bit windows.

Any pointers as to what I've done wrong during the installation would be
appreciated.

Cheers

Martyn


> sessionInfo()
R version 2.14.0 (2011-10-31)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United Kingdom.1252
[2] LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252

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


The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. Th...{{dropped:4}}

__
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] unable to get "R CMD" to work as expected on a 64 bit windows machine

2011-11-14 Thread Joshua Wiley
Hi Martyn,

My guess is that you need to add the directory where R is located to
your Windows PATH variable.  It sounds like Windows just doesn't know
where to find R.

HTH,

Josh

On Mon, Nov 14, 2011 at 8:48 AM, Martyn Byng  wrote:
> Hi,
>
> I've just downloaded and installed R 2.14.0 using the windows binary on
> a 64bit windows machine running windows 7.
>
> Rterm / RGui work as expected, as does
>
> R CMD --help
>
> and
>
> R CMD BATCH --help
>
> however
>
> R CMD check --help
>
> returns no information and I seem to be unable to check a package.
>
> Various other options also seem to not be working as expected, i.e.
>
> R CMD REMOVE aa
>
> (where aa is just a garbage name) appears to do nothing (whereas the
> same command on a 32bit windows machine returns with a message that
> package aa does not exist.)
>
> Just invoking R on the command line appears to do nothing on 64 bit
> windows as opposed to starting a command line version of R (ala Rterm)
> on 32 bit windows.
>
> Any pointers as to what I've done wrong during the installation would be
> appreciated.
>
> Cheers
>
> Martyn
>
>
>> sessionInfo()
> R version 2.14.0 (2011-10-31)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United Kingdom.1252
> [2] LC_CTYPE=English_United Kingdom.1252
> [3] LC_MONETARY=English_United Kingdom.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> 
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
> This e-mail has been scanned for all viruses by Star. Th...{{dropped:4}}
>
> __
> 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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.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 text separation

2011-11-14 Thread David Winsemius


On Nov 14, 2011, at 4:20 AM, Michael Griffiths wrote:


Good morning R list,

My apologies if this has *already* answered elsewhere, but I have  
not found

the answer that I am looking for.

I have a character string, i.e.


form<-c('~ A + B + C + C / D + E + E / F + G + H + I + J + K + L * M')

Now, my aim is to find the position of all those instances of '*'  
and to

remove said '*'. However, I would also like to remove the preceding
variable name before the '*', the math operator preceding this, and  
also
the variable name after the '*'. So, here I would like to remove  
'+L*M'


This would be a very narrow implementation that requires the +/spc/ 
alnum/spc/*/alnum sequence exactly;


> sub("\\+*\\s*[[:alnum:]]*\\s*\\*.[[:alnum:]]*", "", form)
[1] "~ A + B + C + C / D + E + E / F + G + H + I + J + K "

This is a more general implementation using the "*" operator that  
matches each of the preceding item 0 or more times.


 form<-c('~ A + B + C + C / D + E + E / F + G + H + I + J + K + L * M',
 '~ A + B + C + C / D + E + E / F + G + H + I + J + K + L*M',
  '~ A + B + C + C / D + E + E / F + G + H + I + J + K +Llll*M'
 )
> sub("\\+*\\s*[[:alnum:]]*\\s*\\*.[[:alnum:]]*", "", form)
[1] "~ A + B + C + C / D + E + E / F + G + H + I + J + K "
[2] "~ A + B + C + C / D + E + E / F + G + H + I + J + K "
[3] "~ A + B + C + C / D + E + E / F + G + H + I + J + K "


---stripped out code---

--
David Winsemius, MD
West Hartford, CT

__
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] unable to get "R CMD" to work as expected on a 64 bit windows machine

2011-11-14 Thread Martyn Byng
Hi Josh,

Thanks for that, which directory needs to be in the path?

There is a file called R.exe in 

C:\Program Files\R\R-2.14.0\bin
C:\Program Files\R\R-2.14.0\bin\x64
and
C:\Program Files\R\R-2.14.0\bin\i386

I currently have

C:\Program Files\R\R-2.14.0\bin\x64

in the path (which is, I'm guessing why "R CMD --help" works), do I need the 
others in the path as well, and if so, in what order?

Cheers

Martyn


-Original Message-
From: Joshua Wiley [mailto:jwiley.ps...@gmail.com] 
Sent: 14 November 2011 16:57
To: Martyn Byng
Cc: r-help@r-project.org
Subject: Re: [R] unable to get "R CMD" to work as expected on a 64 bit windows 
machine

Hi Martyn,

My guess is that you need to add the directory where R is located to
your Windows PATH variable.  It sounds like Windows just doesn't know
where to find R.

HTH,

Josh

On Mon, Nov 14, 2011 at 8:48 AM, Martyn Byng  wrote:
> Hi,
>
> I've just downloaded and installed R 2.14.0 using the windows binary on
> a 64bit windows machine running windows 7.
>
> Rterm / RGui work as expected, as does
>
> R CMD --help
>
> and
>
> R CMD BATCH --help
>
> however
>
> R CMD check --help
>
> returns no information and I seem to be unable to check a package.
>
> Various other options also seem to not be working as expected, i.e.
>
> R CMD REMOVE aa
>
> (where aa is just a garbage name) appears to do nothing (whereas the
> same command on a 32bit windows machine returns with a message that
> package aa does not exist.)
>
> Just invoking R on the command line appears to do nothing on 64 bit
> windows as opposed to starting a command line version of R (ala Rterm)
> on 32 bit windows.
>
> Any pointers as to what I've done wrong during the installation would be
> appreciated.
>
> Cheers
>
> Martyn
>
>
>> sessionInfo()
> R version 2.14.0 (2011-10-31)
> Platform: x86_64-pc-mingw32/x64 (64-bit)
>
> locale:
> [1] LC_COLLATE=English_United Kingdom.1252
> [2] LC_CTYPE=English_United Kingdom.1252
> [3] LC_MONETARY=English_United Kingdom.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United Kingdom.1252
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> 
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
> This e-mail has been scanned for all viruses by Star. Th...{{dropped:4}}
>
> __
> 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.
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/


This e-mail has been scanned for all viruses by Star.



The Numerical Algorithms Group Ltd is a company registered in England
and Wales with company number 1249803. The registered office is:
Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.

This e-mail has been scanned for all viruses by Star. The service is
powered by MessageLabs. 

__
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] Fit continuous distribution to truncated empirical values

2011-11-14 Thread Michele Mazzucco

Bert,

I think there is a misunderstanding here.
Some data is censored, but I want to fit the data with a distribution  
in the interval [0,24] only. Also, please note that I have other  
datasets having values larger than 1000.


Cheers,
Michele

On 14 Nov 2011, at 18:28, Bert Gunter wrote:


A non-helpful reply on a "language" issue.

"Truncated" data are quite different than "censored" data and  
require different methodologies to analyze. You -- and many others  
in their postings -- have appeared to confuse the two here.


-- Bert



On Mon, Nov 14, 2011 at 8:20 AM, Michele Mazzucco > wrote:

David,

here is the smallest dataset

# Bid   Price   SurvivalCensored
0.030.029   1   1
0.030.029   11  1
0.030.029   10  1
0.030.029   9   1
0.030.029   8   1
0.030.029   7   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   1   1
0.030.029   1   1
0.030.029   9   1
0.030.029   8   1
0.030.029   7   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   16  1
0.030.029   15  1
0.030.029   14  1
0.030.029   13  1
0.030.029   12  1
0.030.029   11  1
0.030.029   10  1
0.030.029   9   1
0.030.029   8   1
0.030.029   7   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   7   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   30  1
0.030.029   29  1
0.030.029   28  1
0.030.029   27  1
0.030.029   26  1
0.030.029   25  1
0.030.029   24  1
0.030.029   23  1
0.030.029   22  1
0.030.029   21  1
0.030.029   20  1
0.030.029   19  1
0.030.029   18  1
0.030.029   17  1
0.030.029   16  1
0.030.029   15  1
0.030.029   14  1
0.030.029   13  1
0.030.029   12  1
0.030.029   11  1
0.030.029   10  1
0.030.029   9   1
0.030.029   8   1
0.030.029   7   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   8   1
0.030.029   7   1
0.030.029   6   1
0.030.029   5   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.029   4   1
0.030.029   3   1
0.030.029   2   1
0.030.029   1   1
0.030.027   71  0
0.030.027   70  0
0.030.027   69  0
0.030.027   68  0
0.030.027   67  0
0.030.027   66  0
0.030.027   65  0
0.030.027   64  0
0.030.027   63  0
0.030.027   62  0
0.030.027   61  0
0.030.027   60  0
0.030.027   59  0
0.030.027   58  0
0.030.027   57  0
0.030.027   56  0
0.030.027   55  0
0.030.027   54  0
0.030.027   53  0
0.030.027   52  0
0.030.027   51  0
0.030.027   50  0
0.030.027   49  0
0.030.027   48  0
0.030.027   47  0
0.030.027   46  0
0.030.027   45  0
0.030.027   44  0
0.030.027   43  0
0.030.027   42  0
0.030.027   41  0
0.030.027   40  0
0.030.027   39  0
0.030.027   38  0
0.030.027   37  0
0.030.027   36  0
0.030.027   35  0
0.030.027   34  0
0.030.027   33  0
0.030.027   32  0
0.030.027   31  0
0.030.027   30  0
0.030.027   29  0
0.030.027   28  0
0.030.027   27  0
0.030.027   26  0
0.030.027   25  0
0.030.027   24  0
0.030.027   23  0
0.030.027   22  0
0.030.027   21  0
0.030.027   20  0
0.030.027   19  0
0.030.027   18  0
0.030.027   17  0
0.030.027   16  0
0.030.027   15  

Re: [R] Very simple loop

2011-11-14 Thread Emilio López
Dear David,
You do not need a loop. The vectors are equaly sized, so sum them and then
plot the vector with the sums:

total <- A+B+C+D+E+F+G
plot (total, type="l")

Regards,
Emilio

2011/11/14 Davg 

> I'm very new to R and am trying to create my first loop.
>
> I have:
>
> x <-c(0:200)
> A <- dpois(x,exp(4.5355343))
> B <- dpois(x,exp(4.5355343 + 0.0118638))
> C <- dpois(x,exp(4.5355343  -0.0234615))
> D <- dpois(x,exp(4.5355343 + 0.0316557))
> E <- dpois(x,exp(4.5355343 + 0.0004716))
> F <- dpois(x,exp(4.5355343 + 0.056437))
> G <- dpois(x,exp(4.5355343 + 0.1225822))
>
> and would like to to get A[K] + B[K] + C[K] + D[K] + E[K] + F[K] G[K]
> for K(0:200)
>
> And then plot these cumulative values.
>
> Many thanks.
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/Very-simple-loop-tp4039895p4039895.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.
>



-- 
_

*Emilio López Cano*
+34 665 676 225
Department of Statistics ans Operations Research
Universidad Rey Juan Carlos 




[[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 v2.13.2 - Cannot find Rcmd on path?

2011-11-14 Thread Henrik Bengtsson
FYI,

you can use tools such as Path Manager 1.1.1 (GPL) on Windows:

 http://www.softpedia.com/get/System/System-Miscellaneous/Path-Manager.shtml

to list, modify (add, remove, reorder, remove duplicates, normalize)
your PATH environment variable.  For each directory it identifies in
PATH it will also let you know whether it is valid or not and list
files that exist in that directory, iff valid.  So, if you don't see
Rcmd.exe where you expect it to be, you know you did something wrong
when setting PATH.

My $.02

/Henrik

On Sun, Nov 13, 2011 at 9:50 PM, Yihui Xie  wrote:
> Well, I just mean to give the user an option during installation --
> like you did in Rtools. I have decided not to argue on this issue any
> more. Thanks a lot anyway!
>
> Regards,
> Yihui
> --
> Yihui Xie 
> Phone: 515-294-2465 Web: http://yihui.name
> Department of Statistics, Iowa State University
> 2215 Snedecor Hall, Ames, IA
>
>
>
> On Sun, Nov 13, 2011 at 4:20 PM, Duncan Murdoch
>  wrote:
>> On 11-11-13 1:15 PM, Yihui Xie wrote:
>>>
>>> I remember I was torn into pieces a few months back when I made a
>>> wishlist here that R adds its bin path to PATH on Windows during
>>> installation. People had tons of reasons of objection. Although I do
>>> not use these batchfiles (usually I do not actually use Windows), I
>>> see there is a motivation behind them: there needs to be an easy way
>>> for Windows users to use R in command line (e.g. R CMD build...). You
>>> may argue that it is easy to understand PATH and modify it manually,
>>> and I will say nothing but "thank" Windows again. Sorry this seems to
>>> be off-topic.
>>
>> I don't remember any rending and tearing, but I do remember objections to
>> modifying the path during installation.  I wouldn't want to write code to do
>> that, because it's hard:
>>
>> - Most people don't want to put R first, because it may hide something
>> important.
>>
>> - Putting it last won't work if an earlier version is already there.
>>
>> So you need to examine the path and correct it, an automatic change is
>> unlikely to be successful.
>>
>> But if you want to write code to do that, just go ahead and do it.  Put it
>> in a package, even.
>>
>> Duncan Murdoch
>>
>>>
>>> Regards,
>>> Yihui
>>> --
>>> Yihui Xie
>>> Phone: 515-294-2465 Web: http://yihui.name
>>> Department of Statistics, Iowa State University
>>> 2215 Snedecor Hall, Ames, IA
>>>
>
> __
> 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] unable to get "R CMD" to work as expected on a 64 bit windows machine

2011-11-14 Thread Henrik Bengtsson
See if

Rcmd check --help

works.

I've always been use that form (I'm on Win7 64-bit).

/Henrik


On Mon, Nov 14, 2011 at 9:06 AM, Martyn Byng  wrote:
> Hi Josh,
>
> Thanks for that, which directory needs to be in the path?
>
> There is a file called R.exe in
>
> C:\Program Files\R\R-2.14.0\bin
> C:\Program Files\R\R-2.14.0\bin\x64
> and
> C:\Program Files\R\R-2.14.0\bin\i386
>
> I currently have
>
> C:\Program Files\R\R-2.14.0\bin\x64
>
> in the path (which is, I'm guessing why "R CMD --help" works), do I need the 
> others in the path as well, and if so, in what order?
>
> Cheers
>
> Martyn
>
>
> -Original Message-
> From: Joshua Wiley [mailto:jwiley.ps...@gmail.com]
> Sent: 14 November 2011 16:57
> To: Martyn Byng
> Cc: r-help@r-project.org
> Subject: Re: [R] unable to get "R CMD" to work as expected on a 64 bit 
> windows machine
>
> Hi Martyn,
>
> My guess is that you need to add the directory where R is located to
> your Windows PATH variable.  It sounds like Windows just doesn't know
> where to find R.
>
> HTH,
>
> Josh
>
> On Mon, Nov 14, 2011 at 8:48 AM, Martyn Byng  wrote:
>> Hi,
>>
>> I've just downloaded and installed R 2.14.0 using the windows binary on
>> a 64bit windows machine running windows 7.
>>
>> Rterm / RGui work as expected, as does
>>
>> R CMD --help
>>
>> and
>>
>> R CMD BATCH --help
>>
>> however
>>
>> R CMD check --help
>>
>> returns no information and I seem to be unable to check a package.
>>
>> Various other options also seem to not be working as expected, i.e.
>>
>> R CMD REMOVE aa
>>
>> (where aa is just a garbage name) appears to do nothing (whereas the
>> same command on a 32bit windows machine returns with a message that
>> package aa does not exist.)
>>
>> Just invoking R on the command line appears to do nothing on 64 bit
>> windows as opposed to starting a command line version of R (ala Rterm)
>> on 32 bit windows.
>>
>> Any pointers as to what I've done wrong during the installation would be
>> appreciated.
>>
>> Cheers
>>
>> Martyn
>>
>>
>>> sessionInfo()
>> R version 2.14.0 (2011-10-31)
>> Platform: x86_64-pc-mingw32/x64 (64-bit)
>>
>> locale:
>> [1] LC_COLLATE=English_United Kingdom.1252
>> [2] LC_CTYPE=English_United Kingdom.1252
>> [3] LC_MONETARY=English_United Kingdom.1252
>> [4] LC_NUMERIC=C
>> [5] LC_TIME=English_United Kingdom.1252
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> 
>> The Numerical Algorithms Group Ltd is a company registered in England
>> and Wales with company number 1249803. The registered office is:
>> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>>
>> This e-mail has been scanned for all viruses by Star. Th...{{dropped:4}}
>>
>> __
>> 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.
>>
>
>
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> Programmer Analyst II, ATS Statistical Consulting Group
> University of California, Los Angeles
> https://joshuawiley.com/
>
> 
> This e-mail has been scanned for all viruses by Star.
> 
>
> 
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
> This e-mail has been scanned for all viruses by Star. The service is
> powered by MessageLabs.
> 
> __
> 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] Plot 2 different fields with image.plot()

2011-11-14 Thread Chris82
Dear R users,

Is it possible to plot 2 different fields with image.plot().

For example at first a digitale elevation model and overlying another data
field, where NA values are transparent, so that the digitale elevation model
is still visble at this areas.


Maybe there is another plotting option than image.plot where it's possible?


Thanks.

Chris

--
View this message in context: 
http://r.789695.n4.nabble.com/Plot-2-different-fields-with-image-plot-tp4040413p4040413.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] unable to get "R CMD" to work as expected on a 64 bit windows machine

2011-11-14 Thread Joshua Wiley
Hi Martyn,

I would not expect you to need directories besides Rversion\bin\x64.
That is all I normally have in my path...perhaps because I do a
complete install?

I do not really know how or why it works, so I do not have any great
insight---just my experience.  Perhaps someone else will chime in with
more definitive advice.

Best,

Josh


On Mon, Nov 14, 2011 at 9:06 AM, Martyn Byng  wrote:
> Hi Josh,
>
> Thanks for that, which directory needs to be in the path?
>
> There is a file called R.exe in
>
> C:\Program Files\R\R-2.14.0\bin
> C:\Program Files\R\R-2.14.0\bin\x64
> and
> C:\Program Files\R\R-2.14.0\bin\i386
>
> I currently have
>
> C:\Program Files\R\R-2.14.0\bin\x64
>
> in the path (which is, I'm guessing why "R CMD --help" works), do I need the 
> others in the path as well, and if so, in what order?
>
> Cheers
>
> Martyn
>
>
> -Original Message-
> From: Joshua Wiley [mailto:jwiley.ps...@gmail.com]
> Sent: 14 November 2011 16:57
> To: Martyn Byng
> Cc: r-help@r-project.org
> Subject: Re: [R] unable to get "R CMD" to work as expected on a 64 bit 
> windows machine
>
> Hi Martyn,
>
> My guess is that you need to add the directory where R is located to
> your Windows PATH variable.  It sounds like Windows just doesn't know
> where to find R.
>
> HTH,
>
> Josh
>
> On Mon, Nov 14, 2011 at 8:48 AM, Martyn Byng  wrote:
>> Hi,
>>
>> I've just downloaded and installed R 2.14.0 using the windows binary on
>> a 64bit windows machine running windows 7.
>>
>> Rterm / RGui work as expected, as does
>>
>> R CMD --help
>>
>> and
>>
>> R CMD BATCH --help
>>
>> however
>>
>> R CMD check --help
>>
>> returns no information and I seem to be unable to check a package.
>>
>> Various other options also seem to not be working as expected, i.e.
>>
>> R CMD REMOVE aa
>>
>> (where aa is just a garbage name) appears to do nothing (whereas the
>> same command on a 32bit windows machine returns with a message that
>> package aa does not exist.)
>>
>> Just invoking R on the command line appears to do nothing on 64 bit
>> windows as opposed to starting a command line version of R (ala Rterm)
>> on 32 bit windows.
>>
>> Any pointers as to what I've done wrong during the installation would be
>> appreciated.
>>
>> Cheers
>>
>> Martyn
>>
>>
>>> sessionInfo()
>> R version 2.14.0 (2011-10-31)
>> Platform: x86_64-pc-mingw32/x64 (64-bit)
>>
>> locale:
>> [1] LC_COLLATE=English_United Kingdom.1252
>> [2] LC_CTYPE=English_United Kingdom.1252
>> [3] LC_MONETARY=English_United Kingdom.1252
>> [4] LC_NUMERIC=C
>> [5] LC_TIME=English_United Kingdom.1252
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> 
>> The Numerical Algorithms Group Ltd is a company registered in England
>> and Wales with company number 1249803. The registered office is:
>> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>>
>> This e-mail has been scanned for all viruses by Star. Th...{{dropped:4}}
>>
>> __
>> 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.
>>
>
>
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> Programmer Analyst II, ATS Statistical Consulting Group
> University of California, Los Angeles
> https://joshuawiley.com/
>
> 
> This e-mail has been scanned for all viruses by Star.
> 
>
> 
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
> This e-mail has been scanned for all viruses by Star. The service is
> powered by MessageLabs.
> 
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.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] Plot 2 different fields with image.plot()

2011-11-14 Thread David Winsemius


On Nov 14, 2011, at 1:16 PM, Chris82 wrote:


Dear R users,

Is it possible to plot 2 different fields with image.plot().


There is an add parameter described on the helop page. Have you tried?


For example at first a digitale elevation model and overlying  
another data
field, where NA values are transparent, so that the digitale  
elevation model

is still visble at this areas.


Maybe there is another plotting option than image.plot where it's  
possible?


--

David Winsemius, MD
West Hartford, CT

__
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] unable to get "R CMD" to work as expected on a 64 bit windows machine

2011-11-14 Thread Martyn Byng
Hi,

Thanks for the help.

I have now sorted out the issue.

Somehow the text "C:\Progra~1\R\R-2.14.0\bin\x64\R" had got added to the end of 
an environment variable called "comspec".

Removing the extraneous text solved the problem - so the only mystery now is 
how I managed to paste the text into the environment variable - time to go home 
I think :)

Cheers

Martyn

-Original Message-
From: Joshua Wiley [mailto:jwiley.ps...@gmail.com] 
Sent: 14 November 2011 18:17
To: Martyn Byng
Cc: r-help@r-project.org
Subject: Re: [R] unable to get "R CMD" to work as expected on a 64 bit windows 
machine

Hi Martyn,

I would not expect you to need directories besides Rversion\bin\x64.
That is all I normally have in my path...perhaps because I do a
complete install?

I do not really know how or why it works, so I do not have any great
insight---just my experience.  Perhaps someone else will chime in with
more definitive advice.

Best,

Josh


On Mon, Nov 14, 2011 at 9:06 AM, Martyn Byng  wrote:
> Hi Josh,
>
> Thanks for that, which directory needs to be in the path?
>
> There is a file called R.exe in
>
> C:\Program Files\R\R-2.14.0\bin
> C:\Program Files\R\R-2.14.0\bin\x64
> and
> C:\Program Files\R\R-2.14.0\bin\i386
>
> I currently have
>
> C:\Program Files\R\R-2.14.0\bin\x64
>
> in the path (which is, I'm guessing why "R CMD --help" works), do I need the 
> others in the path as well, and if so, in what order?
>
> Cheers
>
> Martyn
>
>
> -Original Message-
> From: Joshua Wiley [mailto:jwiley.ps...@gmail.com]
> Sent: 14 November 2011 16:57
> To: Martyn Byng
> Cc: r-help@r-project.org
> Subject: Re: [R] unable to get "R CMD" to work as expected on a 64 bit 
> windows machine
>
> Hi Martyn,
>
> My guess is that you need to add the directory where R is located to
> your Windows PATH variable.  It sounds like Windows just doesn't know
> where to find R.
>
> HTH,
>
> Josh
>
> On Mon, Nov 14, 2011 at 8:48 AM, Martyn Byng  wrote:
>> Hi,
>>
>> I've just downloaded and installed R 2.14.0 using the windows binary on
>> a 64bit windows machine running windows 7.
>>
>> Rterm / RGui work as expected, as does
>>
>> R CMD --help
>>
>> and
>>
>> R CMD BATCH --help
>>
>> however
>>
>> R CMD check --help
>>
>> returns no information and I seem to be unable to check a package.
>>
>> Various other options also seem to not be working as expected, i.e.
>>
>> R CMD REMOVE aa
>>
>> (where aa is just a garbage name) appears to do nothing (whereas the
>> same command on a 32bit windows machine returns with a message that
>> package aa does not exist.)
>>
>> Just invoking R on the command line appears to do nothing on 64 bit
>> windows as opposed to starting a command line version of R (ala Rterm)
>> on 32 bit windows.
>>
>> Any pointers as to what I've done wrong during the installation would be
>> appreciated.
>>
>> Cheers
>>
>> Martyn
>>
>>
>>> sessionInfo()
>> R version 2.14.0 (2011-10-31)
>> Platform: x86_64-pc-mingw32/x64 (64-bit)
>>
>> locale:
>> [1] LC_COLLATE=English_United Kingdom.1252
>> [2] LC_CTYPE=English_United Kingdom.1252
>> [3] LC_MONETARY=English_United Kingdom.1252
>> [4] LC_NUMERIC=C
>> [5] LC_TIME=English_United Kingdom.1252
>>
>> attached base packages:
>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>
>> 
>> The Numerical Algorithms Group Ltd is a company registered in England
>> and Wales with company number 1249803. The registered office is:
>> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>>
>> This e-mail has been scanned for all viruses by Star. Th...{{dropped:4}}
>>
>> __
>> 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.
>>
>
>
>
> --
> Joshua Wiley
> Ph.D. Student, Health Psychology
> Programmer Analyst II, ATS Statistical Consulting Group
> University of California, Los Angeles
> https://joshuawiley.com/
>
> 
> This e-mail has been scanned for all viruses by Star.
> 
>
> 
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
>
> This e-mail has been scanned for all viruses by Star. The service is
> powered by MessageLabs.
> 
>



-- 
Joshua Wiley
Ph.D. Student, Health Psychology
Programmer Analyst II, ATS Statistical Consulting Group
University of California, Los Angeles
https://joshuawiley.com/

_

Re: [R] Very simple loop

2011-11-14 Thread Davg
Thank you all!

It's working perfectly.  I will have a look for an online guide.

--
View this message in context: 
http://r.789695.n4.nabble.com/Very-simple-loop-tp4039895p4040291.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] Binary ARMA

2011-11-14 Thread Napon H.
http://r.789695.n4.nabble.com/file/n4040429/model.jpg 

Hi All

I need some help about construct MLE logit for Binary Autogressive Moving
Average model.
Please see the model in the PDF attach file.

This is what i did.

y<-c(0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1)  # y
is a binary data
logitfun <- function(beta,y,){
  zeta1<-beta[1]
  zeta2<-beta[2]
  zeta3<-beta[3]
  ne<-zeta1+zeta2*lag(y,-1)+zeta3*lag(y,-2)#
this is only AR(2)
  mu <- exp(ne)/(1.0+exp(ne))
  sum( y * log! (mu) + (1-y)*log(1-mu) )
}
mle<-optim(c(0,0,0),logitfun,y=y)
mle
summary(mle)

what i tring to do is to modified
"ne<-zeta1+zeta2*lag(y,-1)+zeta3*lag(y,-2)"
How can i do "ne" with lag(y,-1) , lag(y,-2), (lag(y,-1)-lag(mu,-1)),
(lag(y,-2)-lag(mu,-2))

thanks

Napon H.

--
View this message in context: 
http://r.789695.n4.nabble.com/Binary-ARMA-tp4040429p4040429.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] about R instalation

2011-11-14 Thread Francisca Soares dos Santos
Hello,

I would like to get help on the instalation of R.
I have too few free space in my pc hard disk. So I wonder if it is possible
to install R on an external removable hard drive.
Can it be done? How should I proceed?

Thank you for your help.
best regards,
Francisca A. S. dos Santos Bronner


-- 

Francisca Ana Soares dos Santos
2000 - 2004: B.Sc. em Ciências Biológicas pela UFV (M.G., Brasil)
2005 - 2007: M.Sc. em Modelagem Computacional com ênfase em
Bioinformática e Biologia Computacional pelo LNCC (R.J., Brasil)
2008 - 2010: Ph.D. em Biologia pela Universität Potsdam (Potsdam,
Alemanha)
URL: http://lattes.cnpq.br/9418134959504901

"A grande diferença entre construção e criação é esta:
que uma coisa construída só pode ser amada depois de ser
construída; mas uma coisa criada é amada antes de existir."
(Chesterton)

[[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] string to list()

2011-11-14 Thread Kevin Burton
I can get an array of strings for the data that I want using 'paste()' as
follows:

 

paste('ma', 1:am$arma[2], '=', coef(am)[1:am$arma[2] + am$arma[1]], sep='')

 

This results in a vector of strings like:

 

[1] "ma1=1.17760133668255"  "ma2=0.649795570407939" "ma3=0.329456750858276"

 

What I would like is

 

fixed.pars <-
list(ma1=1.17760133668255,ma2=0.649795570407939,ma3=0.329456750858276)

 

Is there an 'R' guru that would be willing to suggest a good way of doing
this?

 

Thank you.

 

Kevin


[[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] about R instalation

2011-11-14 Thread R. Michael Weylandt
I haven't personally used it, but I think this might work:
http://sourceforge.net/projects/rportable/

Michael

2011/11/14 Francisca Soares dos Santos :
> Hello,
>
> I would like to get help on the instalation of R.
> I have too few free space in my pc hard disk. So I wonder if it is possible
> to install R on an external removable hard drive.
> Can it be done? How should I proceed?
>
> Thank you for your help.
> best regards,
> Francisca A. S. dos Santos Bronner
>
>
> --
> 
> Francisca Ana Soares dos Santos
> 2000 - 2004: B.Sc. em Ciências Biológicas pela UFV (M.G., Brasil)
> 2005 - 2007: M.Sc. em Modelagem Computacional com ênfase em
> Bioinformática e Biologia Computacional pelo LNCC (R.J., Brasil)
> 2008 - 2010: Ph.D. em Biologia pela Universität Potsdam (Potsdam,
> Alemanha)
> URL: http://lattes.cnpq.br/9418134959504901
> 
> "A grande diferença entre construção e criação é esta:
> que uma coisa construída só pode ser amada depois de ser
> construída; mas uma coisa criada é amada antes de existir."
> (Chesterton)
>
>        [[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] Very simple loop

2011-11-14 Thread R. Michael Weylandt
The one included in the standard R installation -- which can be
accessed by typing help.start() at your prompt -- is quite good for
beginners (and very conveniently located). If you tell us a bit more
about yourself, we can help direct you to others as well:
specifically,

1) Prior programming experience?
2) Experience with other statistical packages?
3) Is there a specific domain you will be working in? E.g.,
biomedical, time series/financial, simulation, etc. There exist
specialized intros for many branches of stats
4) Level of statistical training: there are some books that provide an
integrated intro to statistical methods and R so if you need to brush
up your stats as well, you can do them both at once.

Best of luck and welcome to the R-world -- it's quite a fun place,

Michael

On Mon, Nov 14, 2011 at 12:38 PM, Davg  wrote:
> Thank you all!
>
> It's working perfectly.  I will have a look for an online guide.
>
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/Very-simple-loop-tp4039895p4040291.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] string to list()

2011-11-14 Thread Bert Gunter
Do it in 2 steps:

z <- as.list( coef(am)[1:am$arma[2] + am$arma[1]])
names(z) <- paste("ma",seq_along(z), sep="")

-- Bert

On Mon, Nov 14, 2011 at 10:40 AM, Kevin Burton wrote:

> I can get an array of strings for the data that I want using 'paste()' as
> follows:
>
>
>
> paste('ma', 1:am$arma[2], '=', coef(am)[1:am$arma[2] + am$arma[1]], sep='')
>
>
>
> This results in a vector of strings like:
>
>
>
> [1] "ma1=1.17760133668255"  "ma2=0.649795570407939" "ma3=0.329456750858276"
>
>
>
> What I would like is
>
>
>
> fixed.pars <-
> list(ma1=1.17760133668255,ma2=0.649795570407939,ma3=0.329456750858276)
>
>
>
> Is there an 'R' guru that would be willing to suggest a good way of doing
> this?
>
>
>
> Thank you.
>
>
>
> Kevin
>
>
>[[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.


[R] Power analysis and sample size calculation for nonlinear regression

2011-11-14 Thread Johannes W. Dietrich
Is there a library that provides power calculation and sample size  
estimation for nonlinear regression?

The task is easy for linear regression with the "pwr" package, but I  
can't find a method for nonlinear regression (estimated with the "nls"  
package).

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --  
-- --
-- Dr. Johannes W. Dietrich, M.D.
-- Laboratory XU44, Endocrine Research
-- Medical Hospital I, Bergmannsheil University Hospitals
-- Ruhr University of Bochum
-- Buerkle-de-la-Camp-Platz 1, D-44789 Bochum, NRW, Germany
-- Phone: +49:234:302-6400, Fax: +49:234:302-6403
-- eMail: "j.w.dietr...@medical-cybernetics.de"
-- WWW: http://medical-cybernetics.de
-- WWW: http://www.bergmannsheil.de
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --  
-- --



[[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] about R instalation

2011-11-14 Thread John C Frain
See R Windows FAQ 2.6


On Monday, 14 November 2011, R. Michael Weylandt 
wrote:
> I haven't personally used it, but I think this might work:
> http://sourceforge.net/projects/rportable/
>
> Michael
>
> 2011/11/14 Francisca Soares dos Santos :
>> Hello,
>>
>> I would like to get help on the instalation of R.O
>> I have too few free space in my pc hard disk. So I wonder if it is
possible
>> to install R on an external removable hard drive.
>> Can it be done? How should I proceed?
>>
>> Thank you for your help.
>> best regards,
>> Francisca A. S. dos Santos Bronner
>>
>>
>> --
>>

>> Francisca Ana Soares dos Santos
>> 2000 - 2004: B.Sc. em Ciências Biológicas pela UFV (M.G., Brasil)
>> 2005 - 2007: M.Sc. em Modelagem Computacional com ênfase em
>> Bioinformática e Biologia Computacional pelo LNCC (R.J., Brasil)
>> 2008 - 2010: Ph.D. em Biologia pela Universität Potsdam (Potsdam,
>> Alemanha)
>> URL: http://lattes.cnpq.br/9418134959504901
>>

>> "A grande diferença entre construção e criação é esta:
>> que uma coisa construída só pode ser amada depois de ser
>> construída; mas uma coisa criada é amada antes de existir."
>> (Chesterton)
>>
>>[[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.
>

-- 
John C Frain
Economics Department
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:fra...@tcd.ie
mailto:fra...@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] R v2.13.2 - Cannot find Rcmd on path?

2011-11-14 Thread Jixiang Wu
Path manager has a  nice feature. Thanks. While I can see that rcmd is in
the path setting, it is still not recognized as an internal command. That
is something really confuses me.

Jixiang Wu

On Mon, Nov 14, 2011 at 11:30 AM, Henrik Bengtsson wrote:

> FYI,
>
> you can use tools such as Path Manager 1.1.1 (GPL) on Windows:
>
>
> http://www.softpedia.com/get/System/System-Miscellaneous/Path-Manager.shtml
>
> to list, modify (add, remove, reorder, remove duplicates, normalize)
> your PATH environment variable.  For each directory it identifies in
> PATH it will also let you know whether it is valid or not and list
> files that exist in that directory, iff valid.  So, if you don't see
> Rcmd.exe where you expect it to be, you know you did something wrong
> when setting PATH.
>
> My $.02
>
> /Henrik
>
> On Sun, Nov 13, 2011 at 9:50 PM, Yihui Xie  wrote:
> > Well, I just mean to give the user an option during installation --
> > like you did in Rtools. I have decided not to argue on this issue any
> > more. Thanks a lot anyway!
> >
> > Regards,
> > Yihui
> > --
> > Yihui Xie 
> > Phone: 515-294-2465 Web: http://yihui.name
> > Department of Statistics, Iowa State University
> > 2215 Snedecor Hall, Ames, IA
> >
> >
> >
> > On Sun, Nov 13, 2011 at 4:20 PM, Duncan Murdoch
> >  wrote:
> >> On 11-11-13 1:15 PM, Yihui Xie wrote:
> >>>
> >>> I remember I was torn into pieces a few months back when I made a
> >>> wishlist here that R adds its bin path to PATH on Windows during
> >>> installation. People had tons of reasons of objection. Although I do
> >>> not use these batchfiles (usually I do not actually use Windows), I
> >>> see there is a motivation behind them: there needs to be an easy way
> >>> for Windows users to use R in command line (e.g. R CMD build...). You
> >>> may argue that it is easy to understand PATH and modify it manually,
> >>> and I will say nothing but "thank" Windows again. Sorry this seems to
> >>> be off-topic.
> >>
> >> I don't remember any rending and tearing, but I do remember objections
> to
> >> modifying the path during installation.  I wouldn't want to write code
> to do
> >> that, because it's hard:
> >>
> >> - Most people don't want to put R first, because it may hide something
> >> important.
> >>
> >> - Putting it last won't work if an earlier version is already there.
> >>
> >> So you need to examine the path and correct it, an automatic change is
> >> unlikely to be successful.
> >>
> >> But if you want to write code to do that, just go ahead and do it.  Put
> it
> >> in a package, even.
> >>
> >> Duncan Murdoch
> >>
> >>>
> >>> Regards,
> >>> Yihui
> >>> --
> >>> Yihui Xie
> >>> Phone: 515-294-2465 Web: http://yihui.name
> >>> Department of Statistics, Iowa State University
> >>> 2215 Snedecor Hall, Ames, IA
> >>>
> >
> > __
> > 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.
>

[[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] Problem with edit()

2011-11-14 Thread Jeff Freedman
Since installing R 2.14.0 on my Mac (a Mac Pro running 10.6.8) an issue has 
arisen when using the vi editor in conjunction with the edit() command. More 
specifically, commented lines disappear from edited functions when using 
[functionname.R] <- edit().

That is, if you have created a function called “test.func” as such:

function ()
{
# This is a test
ex _ 4
duh <- seq(1, 10)
fuh <- seq(11, 20)
plot(duh, fuh)
}

you will of course get an error message:

Error in edit(name, file, title, editor) :
  unexpected input occurred on line 4
 use a command like
 x <- edit()
 to recover

When using the “x <- edit” (or in this case, test.func <- edit()), the comment 
“This is a test” will disappear from the edited function.

Does anyone have any insight into this problem?

Thanks,
Jeff Freedman

_
Jeff Freedman
Lead Research Scientist
AWS Truepower, LLC
463 New Karner Road
Albany, NY 12205
phone: 518-213-0044 (x1049)
fax: 518-640-6897


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

2011-11-14 Thread Supreet kaur
 hello all R experts,
> how do I calculate the reliability between the two groups
> using the ICCs?
-- 
Sincerely,

Supreet kaur,
Biomedical research engineer,
Nationwide Childrens Hospital,
Columbus, OH
(614)355-3509

[[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] rearrange set of items randomly

2011-11-14 Thread Greg Snow
If you don't want to go with the simple method mentioned by David and Ted, or 
you just want some more theory, you can check out: 
http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle and implement that.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of flokke
> Sent: Monday, November 07, 2011 2:09 PM
> To: r-help@r-project.org
> Subject: [R] rearrange set of items randomly
> 
> Dear all,
> I hope that this question is not too weird, I will try to explain it as
> good
> as I can.
> 
> I have to write a function for a school project and one limitation is
> that I
> may not use the in built function sample()
> 
> At one point in the function I would like to resample/rearrange the
> items of
> my sample (so I would want to use sample, but I am not allowed to do
> so), so
> I have to come up with sth else that does the same as the in built
> function
> sample()
> 
> The only thing that sample() does is rearranging the items of a sample,
> so I
> searched the internet for a function that does that to be able to use
> it,
> but I cannot find anything that could help me.
> 
> Can maybe someone help me with this?
> I would be very grateful,
> 
> Cheers,
> Maria
> 
> --
> View this message in context: http://r.789695.n4.nabble.com/rearrange-
> set-of-items-randomly-tp4013723p4013723.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.


[R] Adding units to levelplot's colorkey

2011-11-14 Thread Carlisle Thacker

How to add units (e.g. "cm") to the color key of a lattice levelplot?

The plots looks fantastic, but it would be nice to indicate somewhere 
near the end of the color key that the values associated with its colors 
are in centimeters or some other physical units.


The only thing I find is the possibility to specify the labels so that 
one explicitly includes the units.  That leaves little flexibility for 
positioning where this information appears.  Is there a better way?


__
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] Power analysis and sample size calculation for nonlinear regression

2011-11-14 Thread Bert Gunter
May I suggest you consult your local statistician. For reasons that (s)he
can answer, your request makes little sense.

Hint: Nonlinear regression is much different than linear regression: The
design matrix -- and hence the variance of estimators -- is a function of
the parameters being estimated.

(But there may well be packages that are relevant -- the issue is your
ability to use them properly)

Cheers,
Bert



On Mon, Nov 14, 2011 at 10:52 AM, Johannes W. Dietrich <
johannes.dietr...@ruhr-uni-bochum.de> wrote:

> Is there a library that provides power calculation and sample size
> estimation for nonlinear regression?
>
> The task is easy for linear regression with the "pwr" package, but I
> can't find a method for nonlinear regression (estimated with the "nls"
> package).
>
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- --
> -- Dr. Johannes W. Dietrich, M.D.
> -- Laboratory XU44, Endocrine Research
> -- Medical Hospital I, Bergmannsheil University Hospitals
> -- Ruhr University of Bochum
> -- Buerkle-de-la-Camp-Platz 1, D-44789 Bochum, NRW, Germany
> -- Phone: +49:234:302-6400, Fax: +49:234:302-6403
> -- eMail: "j.w.dietr...@medical-cybernetics.de"
> -- WWW: http://medical-cybernetics.de
> -- WWW: http://www.bergmannsheil.de
> -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
> -- --
>
>
>
>[[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] max & min values within dataframe

2011-11-14 Thread Dennis Murphy
Groupwise data summarization is a very common task, and it is worth
learning the various ways to do it in R. Josh showed you one way to
use aggregate() from the base package and Michael showed you one way
of using the plyr package to do the same; another way would be

ddply(df, .(Patient, Region), summarise, max = max(Score), min = min(Score))

to save on writing an explicit function. Similarly, if you have a
version of R >= 2.11.0, the aggregate() function now has a nice
formula interface, so Josh's code could also be written as

aggregate(Score ~ Patient + Region, data = df, FUN = range)

with a subsequent renaming of the variables as shown.

Other packages that could perform this task with ease include the doBy
package, the data.table package, the remix package, the Hmisc package
and, if you are comfortable with SQL, the sqldf package. For relative
novices, the doBy package is a very nice place to start because it
comes with a well written vignette and the function names correspond
well with the tasks they perform (e.g., summaryBy(), transformBy()).
The plyr and data.table packages are more general and more powerful in
terms of the types of tasks to which each is suited. Unlike
aggregate() and doBy:::summaryBy(), these packages can process
multivariable functions. As noted above, if you have an SQL
background, sqldf operates on R data objects as though they were SQL
tables, which is advantageous in complex data extraction tasks.
Package remix is useful if you want to organize results into a tabular
form that is reminiscent of SAS.

HTH,
Dennis

On Mon, Nov 14, 2011 at 8:10 AM, B Laura  wrote:
> dear R-team
>
> I need to find the min, max values for each patient from dataset and keep
> the output of it as a dataframe with the following columns
>  - Patient nr
>  - Region (remains same per patient)
>  - Min score
>  - Max score
>
>
>    Patient Region Score Time
> 1        1      X    19   28
> 2        1      X    20  126
> 3        1      X    22  100
> 4        1      X    25  191
> 5        2      Y    12    1
> 6        2      Y    12    2
> 7        2      Y    25    4
> 8        2      Y    26    7
> 9        3      X     6    1
> 10       3      X     6    4
> 11       3      X    21   31
> 12       3      X    22   68
> 13       3      X    23   31
> 14       3      X    24   38
> 15       3      X    21   15
> 16       3      X    22   24
> 17       3      X    23   15
> 18       3      X    24  243
> 19       3      X    25   77
> 20       4      Y     6    5
> 21       4      Y    22   28
> 22       4      Y    23   75
> 23       4      Y    24   19
> 24       5      Y    23    3
> 25       5      Y    24    1
> 26       5      Y    23   33
> 27       5      Y    24   13
> 28       5      Y    25   42
> 29       5      Y    26   21
> 30       5      Y    27    4
> 31       6      Y    24    4
> 32       6      Y    32    8
>
> So far I could find the min and max values for each patient, but the output
> of it is not (yet) what I need.
>
>> Patient.nr = unique(Patient)
>> aggregate(Score, list(Patient), max)
>  Group.1  x
> 1       1 25
> 2       2 26
> 3       3 25
> 4       4 24
> 5       5 27
> 6       6 32
>
>> aggregate(Score, list(Patient), min)
>  Group.1  x
> 1       1 19
> 2       2 12
> 3       3  6
> 4       4  6
> 5       5 23
> 6       6 24
> I would like to do same but writing this new information (min, max values)
> in a dataframe with following columns
>  - Patient nr
> - Region (remains same per patient)
> - Min score
> - Max score
>
> Can anybody help me with this?
>
> Thanks
> Laura
>
>        [[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] Problem with edit()

2011-11-14 Thread Jeff Newmiller
There is a difference between parsed functions and .R files.  What you see when 
you type the name of a function alone on the R command line is a text 
representation of the parsed function that is ready to run in RAM. That has 
none of the comments or whitespace from the function as you wrote it.  The 
parsed version is what the "edit" function allows you to modify. This is why we 
use .R files.

FWIW I never use the "edit" function. I use a separate window for editing the 
code I want to keep, and either copy/paste the bits I want to execute (with or 
without the use of macros to facilitate that) into the R command line, or use 
the "source" function to pull in a set of functions all at once.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

Jeff Freedman  wrote:

>Since installing R 2.14.0 on my Mac (a Mac Pro running 10.6.8) an issue
>has arisen when using the vi editor in conjunction with the edit()
>command. More specifically, commented lines disappear from edited
>functions when using [functionname.R] <- edit().
>
>That is, if you have created a function called �test.func� as such:
>
>function ()
>{
># This is a test
>ex _ 4
>duh <- seq(1, 10)
>fuh <- seq(11, 20)
>plot(duh, fuh)
>}
>
>you will of course get an error message:
>
>Error in edit(name, file, title, editor) :
>  unexpected input occurred on line 4
> use a command like
> x <- edit()
> to recover
>
>When using the �x <- edit� (or in this case, test.func <- edit()), the
>comment �This is a test� will disappear from the edited function.
>
>Does anyone have any insight into this problem?
>
>Thanks,
>Jeff Freedman
>
>_
>Jeff Freedman
>Lead Research Scientist
>AWS Truepower, LLC
>463 New Karner Road
>Albany, NY 12205
>phone: 518-213-0044 (x1049)
>fax: 518-640-6897
>
>
>   [[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] Upgrade R?

2011-11-14 Thread Gene Leynes
I have had similar problems.

I have several installations of R and now I have no control over which one
opens when I try opening a RData file.  The RGUI is registered more than
once, but they all have the exact same appearance in the "choose programs"
menu.

It's become particularly annoying now that new versions of R seem to be
published with ever increasing frequency.



On Mon, Nov 14, 2011 at 10:11 AM, Kevin Burton wrote:

> I am also using statConn so I will let you know if I hear anything new.
>
> -Original Message-
> From: Cem Girit [mailto:gi...@comcast.net]
> Sent: Monday, November 14, 2011 8:52 AM
> To: 'Kevin Burton'
> Cc: r-help@r-project.org
> Subject: RE: [R] Upgrade R?
>
> Hello Kevin,
>
>Thank you. I will delete the folder and run an application called
> CCleaner (free). That will remove all the broken registry entries.
>
>There should be a problem free update path for R installation. As
> you rightfully mentioned the R- manual is not clear about package update
> issues. I received many helpful suggestions on the update path but some of
> the them were contradictory in the order of steps to be taken.  I am also
> using statConn (DCOM) interface for programming.  So my problems are
> multifold.  I will compile the answers I received on the R version update
> issue and publish them so that that the experts could put them into more
> effective use.
>
>Sincerely,
>
> Cem
>
>
> -Original Message-
> From: Kevin Burton [mailto:rkevinbur...@charter.net]
> Sent: Sunday, November 13, 2011 4:11 PM
> To: 'Cem Girit'
> Subject: RE: [R] Upgrade R?
>
> I don't know if it was correct but I just removed the directory and then
> searched and removed all instances in the registry that referred to 2.13.1
> (in my case searching for this seemed to only return references to 'R'). I
> have since been given some links that address specific registry entries but
> I haven't had any problem yet with my 'slash and burn' approach. It removed
> it from the 'Install/Uninstall' list with windows so it seems to have be
> removed and the disk space that 2.13.2 took up has been reclaimed.
>
> Hope this helps. Let me know if you find any more definitive answers.
>
> Thanks.
>
> Kevin
>
> -Original Message-
> From: Cem Girit [mailto:gi...@comcast.net]
> Sent: Saturday, November 12, 2011 6:33 PM
> To: 'Kevin Burton'
> Subject: RE: [R] Upgrade R?
>
> Hello Kevin,
>
>I am getting the same error "utCompiledCode..." since I  installed
> R2.14 while R2.13 existed.  How did you get rid of R2.13 eventually? Did
> you
> just delete it? If so, how did you clean the registry?
>
>Thank you,
>
> Cem
>
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
> On
> Behalf Of Kevin Burton
> Sent: Thursday, November 10, 2011 11:54 AM
> To: 'jose Bartolomei'; 'R Help'
> Subject: Re: [R] Upgrade R?
>
> The problem with this documentation is two-fold. One it seems to
> concentrate
> on building from source which I don't need. Two it doesn't address the
> upgade. I have a number of packages and so I need to do what has been
> suggested and install the latest version *first*. Then copy the libraries
> (packages). Then uninstall the previous version. It is on this last step
> that I am stuck on right now. The last link on uninstalling R manually was
> what I needed. Thank you.
>
>
>
> Kevin
>
>
>
> From: jose Bartolomei [mailto:surfpr...@hotmail.com]
> Sent: Thursday, November 10, 2011 10:19 AM
> To: rkevinbur...@charter.net; R Help
> Subject: RE: [R] Upgrade R?
>
>
>
> Hi,
> Don't know if this will help you but...
> In my short experience and following the guidelines you should first
> uninstall R.
>
>
> http://cran.r-project.org/doc/manuals/R-admin.html#Installing-R-under-Window
> s
>
> Unistall it from the Windows control panel.
>
> The old R version libraries file will be kept on machine.
> For example : C:\Program Files\R\R-2.13.0\library
>
> Then install the new version via:
>
> http://cran.r-project.org/doc/manuals/R-admin.html#Installing-R-under-Window
> s
>
> You can copy/paste libraries from the old version R library file to the new
> one.
> C:\Program Files\R\R-2.14.0\library
>
> There is too an function named:
> ?update.packagee
>
> If above was what you did, then there is a post on Uninstalling R manually:
>
>
> http://learnserver.csd.univie.ac.at/rcomwiki/doku.php?id=wiki:uninstalling_r
> _manually
>
> Regards,
> Jose
>
>
> > From: rkevinbur...@charter.net
> > To: r-help@r-project.org
> > Date: Thu, 10 Nov 2011 09:07:20 -0600
> > Subject: Re: [R] Upgrade R?
> >
> > Since apparently there is no one familiar with this error message let
> > me rephrase the question. Is there a 'manual' process to fully remove
> > a
> version
> > of 'R' from my machine? This is a Window PC running Windows 7.
> >
> >
> >
> > Thank you.
> >
> >
> >
> > Kevin
> >
> >
> >
> > From: Kevin Burton [mailto:rkevinbur...@charter.net]
> > Sent: Monday, Nov

[R] JSS Special Volumes for 2011

2011-11-14 Thread Jan de Leeuw
So far in 2011 JSS has published 4 (four !) special volumes. If you have 
additional suggestions for special
volumes, let us know. Also, submit your JSS-adapted package vignettes. 

If you like what you see, friend us at 

http://www.facebook.com/jstatsoft

Tabelow and Whitcher, Guest Editors 
Volume 44: Magnetic Resonance Imaging in R
http://www.jstatsoft.org/v44

Altman, Fox, Jackman and Zeileis , Guest Editors
Volume 42: Political Methodology
http://www.jstatsoft.org/v42

Commandeur, Koopman, and Ooms, Guest Editors
Volume 41: Statistical Software for State Space Methods
http://www.jstatsoft.org/v41

Putter, Guest Editor
Volume 38: Competing Risks and Multi-State Models
http://www.jstatsoft.org/v38

Additional regular volumes, of course, at http://www.jstatsoft.org. ===
Jan de Leeuw; Distinguished Professor and Chair, UCLA Department of Statistics;
Editor: Journal of Multivariate Analysis, Journal of Statistical Software;
US mail: 8125 Math Sciences Bldg, Box 951554, Los Angeles, CA 90095-1554
phone (310)-825-9550;  fax (310)-206-5658;  email: dele...@stat.ucla.edu
.mac: jdeleeuw ++  aim: deleeuwjan ++ skype: j_deleeuw
homepages: http://gifi.stat.ucla.edu ++ http://www.cuddyvalley.org
 
-
  No matter where you go, there you are. --- Buckaroo Banzai
   http://gifi.stat.ucla.edu/sounds/nomatter.au

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