[R] I need your help.

2009-05-05 Thread 풍이

   Hi, I need your help, so I send letter to you.


   I have a problem about plsr in pls package. I want to show how classfied or
   related each ohter samples, so I tried to use plsr and biplot.


   But, I failed. Because, I had to change data type of my sample.
   Unfortunately, I didn't know how change data type.


   I want you to help me about that.


   please, help me.


   I show you my sample data , my scripts and error message.


   sample data

   > asdf
 sp mw.1 mw.2 mw.3
   1  a125
   2  a236
   3  b347
   4  c458
   5  c569

   My script

   p1=plsr(sp~ .,data=asdf,varidation='CV')


   error message


   �€횑횉횕쩔징 쩔징쨌짱colMeans(Y) : 'x'쨈횂 쩌철횆징�€횑쩐챤쩐횩쨍쨍 횉횛쨈횕쨈횢
   횄횩째징횁짚쨘쨍:Warning message:
   In model.response(mf, "numeric") :
 using type="numeric" with a factor response will be ignored



   짹횞쨈챘�€횉 쨩챤쩔징 횉횪쨘쨔�€횑 짹챗쨉챕짹창쨍짝...
   [1][wVpvTe.LSMSRNyWa4ML8cw00] 

   [횉횗쨍횧�€횕 Express][2]쨍횧�€횕쨍챰쨌횕째첬 쨔횑쨍짰쨘쨍짹창쨍짝 쨉쩔쩍횄쩔징! 
   
   [3]쨔횑쩐횈횄짙짹창 횆쨌횈채�€횓
   
[...@from=aliel83&rcpt=r%2Dhelp%40r%2Dproject%2Eorg&msgid=%3C20090506134717%2EH
   M%2EN0EbpdC%40aliel83%2Ewwl513%2Ehanmail%2Enet%3E]

References

   Visible links
   1. mailto:alie...@hanmail.net
   2. http://allim.daum.net/servlet/Redirect?sid=footer_090223_ex
   3. http://hyphen.daum.net/request/campaign/sub/childrensday2009.do

   Hidden links:
   4. 
http://daumdirect.daum.net/websales/main/event/20080516_woori_event.jsp?_partner_code.key=919
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Duplicating meta-regression results from PROC MIXED with lmer

2009-05-05 Thread Brant Inman

R-experts:

In 2002, Hans Van Houwelingen et al. published a tutorial on how to do  
meta-regression in Statistics in Medicine.  They used the classic BCG  
dataset of Colditz to demonstrate correct methodology and computed the  
results using PROC MIXED in SAS. In trying to duplicate the results  
presented in this paper, I have discovered that I can reproduce  
certain items with lmer but not others.  I was hoping that someone  
might point out how I could correctly program R code to arrive at the  
correct solution.  I have placed the paper and the datasets used below  
at the following website for easy access to any helpers:  http://www.duke.edu/~bi6


I start by loading the data into R.

-

bcg   <- read.csv('bcg.csv')
bcg.long  <- read.csv('bcg-long.csv')
bcg$study <- paste(bcg$author, bcg$year)

-

I then perform standard meta-analysis using two different R functions:  
(1) the metabin function (meta package) to pool odds ratios with  
standard inverse variance techniques using the "wide" bcg dataset and  
(2) the lmer function (lme4 package) to perform a multilevel meta- 
analysis using the "long" dataset.  The only reason that the lmer  
function is possible here is because the outcome is binary  
(disease .vs. no disease) and I could create a long dataset.  A 3rd  
option is the mima function, but that is not presented here since I am  
interested in using lmer to extend to situations where there are study  
level (level 2) and individual level (level 1) predictors, something  
mima cannot currently handle.


-

library(meta)
# Fixed and random effects models, no covariates
f0 <- metabin(bcg[,3], bcg[,4], bcg[,5], bcg[,6], sm='OR',  
method='Inverse')

summary(f0)

library(lme4)
# Fixed effects model, no covariates
f1 <- lmer(tb ~ bcg + (1 | study), family=binomial, data=bcg.long)
summary(f1)
exp(fixef(f1)[2])   # OR
exp(f...@fixef[2] - (1.96*sqrt(vcov(f1)[2,2]))) # lci
exp(f...@fixef[2] + (1.96*sqrt(vcov(f1)[2,2]))) # uci

# Random effects model, no covariates.
f2 <- lmer(tb ~ bcg + (bcg | study), family=binomial,  
data=bcg.long)# Random effects, no covariates

summary(f2)
exp(fixef(f2)[2])   # OR
exp(f...@fixef[2] - (1.96*sqrt(vcov(f2)[2,2]))) # lci
exp(f...@fixef[2] + (1.96*sqrt(vcov(f2)[2,2]))) # uci
as.numeric(summary(f2)@REmat[2,3])  # Tau

-

So far these results look good and compare favorably to those obtained  
by Van Houwelingen. It is also obvious that although metabin and lmer  
give similar results, computational time is much longer with lmer than  
meta since it must use the long version of the dataset.  The problem  
comes when two covariates are added to model f2, latitude and year of  
publication.


-

# Random effects model, 1 covariate
f3 <- lmer(tb ~ bcg + latitude + (bcg | study), family=binomial,  
data=bcg.long)

summary(f3)
exp(fixef(f3))  # OR

# Random effects model, 1 covariate
f4 <- lmer(tb ~ bcg + year + (bcg | study), family=binomial,  
data=bcg.long)

summary(f4)
exp(fixef(f4))  # OR


-

I assumed, incorrectly, that models f3 and f4 would reproduce the  
results of Van Houwelingen in sections 5.2.1 and 5.2.2.  They do not  
seem to do so.  I would be very appreciative if someone pointed out my  
error with models f3 and f4 and why they do not seem to be correct.   
Incidentally, other sources (ex: Egger/Altman book on systematic  
reviews) report results on this dataset similar to Van Houwelingen, so  
I think that my code is definitely the problem.


Thanks,

Brant Inman

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

2009-05-05 Thread Antje

Hi Uwe,

thanks a lot for your answer! And thanks a lot to all others helping me with 
this issue!


Uwe Ligges schrieb:



Antje wrote:

Hi Uwe,

I tried to explain my problem with the given example.
I don't see any documentation which tells me that the length of 
"col.regions" should be one less than "at". (At least I assume now 
that it should be this way...)
If it's equal or longer some colors (in the middle of the 
color-vector) are simply not used.
Just try the example below with rainbow(5) and rainbow(6) and compare 
the results... both plot will use 5 colors!
Sorry, but this behaviour is not really self-explaining to me... maybe 
I'm to blind to find the documentation which says that only one color 
less will ensure the usage of all colors.


Well, of you have 5 at locations (i.e. breaks), then you have 4 
intervals in between and that's the amount of colors that is sensible.


From the documentation this was not really clear to me (though it makes sense, 
I agree)





(It is so important for me because I need to display a heatmap with 
colors let's say

* all lower data outliers "green",
* all higher data outliers "blue" and
* everything else within the color range "yellow" to "red".
I've seen that some values do not get blue or green though they are 
outliers...

I've attached one graph, I've generated - maybe it helps to understand)

Any wrong assumption?


Maybe:

Say you want everything below -1 be considered as a lower outlier and 
all above 1 is a higher outlier, then you can say:



levelplot(matrix(c(1,2,0,-2), nrow=2),
at = c(-Inf, seq(-1, 1, length=10), Inf),
col.regions = c(rgb(0,1,0),
 hcl(seq(20, 80, length=10), c=400),
 rgb(0,0,1)))

Then below -1 is green (rgb(0,1,0)), above 1 is blue (rgb(0,0,1)) and in 
between we have 10 regions from -1 to 1 each with a color between some 
kind of yellow and red in hcl() space.


Thank you for this little example. Just two comments:

1) I was not aware of the possibility to use "Inf" - it just has the 
disadvantage that these colors are not displayed at the color vector (maybe 
this can be adjusted somehow)


2) if you replace one number of the matrix with -1, it will be displayed green.
So it would be considered as an outlier. From the documentation it was also not 
clear to me that the lower endpoint of the interval is always excluded (except 
for the very first value of the at-vector), while the upper endpoint will be 
included. (This also makes sense but in this case I have to slightly modify my 
data because I'd like to include both endpoints of my non-outlier-range...)


Anyway, I guess, I solved all problems and found a workable solution :-)

Ciao,
Antje





Uwe Ligges





Ciao,
Antje


Uwe Ligges schrieb:



Antje wrote:

Hi there,

as I'm not sure to understand the coloring levelplot uses, I'm 
looking for another easy way to create a heatmap like this:


library(lattice)
mat <- matrix(seq(1,5, length.out = 12), nrow = 3)
mat[1,2] <- 3.5

my.at <- seq(0.5,5.5, length.out = 6)
my.col.regions <- rainbow(5)

graph <- levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = 
my.col.regions)

print(graph)

Can anybody help me with some hints or little examples?



Dear Antje,

since you are asking the same question again now, maybe you can 
explain what you are going to get? In fact, I do not undertsand where 
your problem is. R places the colors according to the values in your 
matrix very well including the legend and I thought up to today that 
the plot is self explaining.


Best wishes,
Uwe Ligges





Antje

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

2009-05-05 Thread Daniel Fernandez
Hi,
I am trying to call R in my perl program but is not working. It does not
give an error but my program gets stuck indefinitely.

I am using the following command to call R from Perl

`R BATCH regressExpr.spl temp`;

Any suggestions?

Best,

Daniel F.

[[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] problem with ggplot2 boxplot, groups and facets

2009-05-05 Thread Zeljko Vrba
On Tue, May 05, 2009 at 09:21:49PM -0400, stephen sefick wrote:
>
> If you would provide a reproducible example I could tinker.
> 
The code I posted is real.  I attach here the relevant part of the data-set
as CSV.

Best regards,
  Zeljko.

"","sp","wg","n","v.realtime"
"9968","GP","1","1",28.924
"55802","GP","1","2",23.5566
"100084","GP","1","4",23.8152
"146283","GP","1","6",20.3644
"191527","GP","1","8",19.3412
"13090","GP","10","1",28.9244
"56890","GP","10","2",19.6593
"104764","GP","10","4",19.173
"149047","GP","10","6",14.0045
"195123","GP","10","8",12.533
"16563","GP","100","1",28.9294
"63124","GP","100","2",18.513
"108483","GP","100","4",17.384
"152527","GP","100","6",13.5352
"198727","GP","100","8",11.7581
"20049","GP","1000","1",28.9796
"66488","GP","1000","2",14.8717
"111010","GP","1000","4",10.3007
"155762","GP","1000","6",8.83946
"201369","GP","1000","8",7.27704
"24607","GP","1","1",29.4869
"68405","GP","1","2",14.9268
"113522","GP","1","4",7.89828
"158287","GP","1","6",5.63627
"203048","GP","1","8",4.50438
"28327","GP","2","1",30.0536
"72128","GP","2","2",15.3216
"116644","GP","2","4",8.07881
"161163","GP","2","6",5.6511
"206284","GP","2","8",4.51449
"31688","GP","3","1",30.6077
"75481","GP","3","2",15.712
"119402","GP","3","4",8.21318
"164530","GP","3","6",5.78375
"209645","GP","3","8",5.0976
"34447","GP","4","1",31.1623
"78364","GP","4","2",16.0178
"122647","GP","4","4",8.4714
"167881","GP","4","6",6.06354
"213122","GP","4","8",4.87649
"38765","GP","5","1",31.733
"81370","GP","5","2",16.4381
"126127","GP","5","4",8.75029
"171366","GP","5","6",6.38623
"216601","GP","5","8",5.52025
"41041","GP","6","1",32.3026
"85329","GP","6","2",16.8173
"129604","GP","6","4",9.02609
"174849","GP","6","6",6.86584
"220084","GP","6","8",5.67949
"44649","GP","7","1",32.8061
"88087","GP","7","2",17.2785
"133090","GP","7","4",9.30484
"178804","GP","7","6",7.10827
"223564","GP","7","8",6.75607
"48241","GP","8","1",33.4279
"91327","GP","8","2",17.6706
"136569","GP","8","4",9.68908
"181810","GP","8","6",7.34559
"227041","GP","8","8",6.54295
"51841","GP","9","1",33.9465
"94806","GP","9","2",18.0421
"140048","GP","9","4",10.0624
"185767","GP","9","6",7.78839
"233165","GP","9","8",7.08975
"2","WS","1","1",28.9351
"1568","WS","1","2",16.6857
"3130","WS","1","4",13.6384
"4688","WS","1","6",13.1777
"6245","WS","1","8",13.1583
"126","WS","10","1",28.9354
"1681","WS","10","2",14.5145
"3249","WS","10","4",7.50519
"4808","WS","10","6",5.06291
"6370","WS","10","8",3.85133
"242","WS","100","1",28.94
"1802","WS","100","2",14.5032
"3365","WS","100","4",7.3587
"4928","WS","100","6",4.96993
"6486","WS","100","8",3.76491
"367","WS","1000","1",28.9915
"1923","WS","1000","2",14.5092
"3481","WS","1000","4",7.27609
"5045","WS","1000","6",4.87735
"6602","WS","1000","8",3.679
"487","WS","1","1",29.5069
"2046","WS","1","2",14.8593
"3603","WS","1","4",7.49302
"5167","WS","1","6",5.02439
"6724","WS","1","8",3.79203
"608","WS","2","1",30.0853
"2164","WS","2","2",15.2604
"3729","WS","2","4",7.75278
"5282","WS","2","6",5.22471
"6846","WS","2","8",3.96219
"725","WS","3","1",30.6405
"2286","WS","3","2",15.6661
"3844","WS","3","4",8.01553
"5410","WS","3","6",5.43691
"6965","WS","3","8",4.14382
"848","WS","4","1",31.2028
"2406","WS","4","2",16.0644
"3963","WS","4","4",8.28739
"5524","WS","4","6",5.66376
"7081","WS","4","8",4.34761
"961","WS","5","1",31.7782
"2528","WS","5","2",16.4808
"4090","WS","5","4",8.55791
"5649","WS","5","6",5.89866
"7204","WS","5","8",4.57137
"1089","WS","6","1",32.3649
"2650","WS","6","2",16.8966
"4208","WS","6","4",8.84023
"5763","WS","6","6",6.14813
"7327","WS","6","8",4.81468
"1208","WS","7","1",32.8496
"2770","WS","7","2",17.3084
"4328","WS","7","4",9.10388
"5884","WS","7","6",6.40283
"7446","WS","7","8",5.07723
"1329","WS","8","1",33.4982
"2889","WS","8","2",17.7666
"4450","WS","8","4",9.40776
"6001","WS","8","6",6.69435
"7566","WS","8","8",5.36462
"1444","WS","9","1",34.0178
"3004","WS","9","2",18.124
"4566","WS","9","4",9.68832
"6127","WS","9","6",6.98297
"7685","WS","9","8",5.66364
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] subset data

2009-05-05 Thread Bill.Venables
Or somewhat more readibly

selected.data <- subset(data, id %in% selected.id) 


Bill Venables
http://www.cmis.csiro.au/bill.venables/ 


-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
Behalf Of Kushantha Perera
Sent: Wednesday, 6 May 2009 3:15 PM
To: abdul kudus; r-help@r-project.org
Subject: Re: [R] subset data

Try, data[data$id%in%selected.id,]


Good day!
Kushantha

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of abdul kudus
Sent: Wednesday, May 06, 2009 10:12 AM
To: r-help@r-project.org
Subject: [R] subset data

Dear all,

> data <- data.frame(id=seq(1:10),x=runif(10))
> data
   id x
1   1 0.3604464
2   2 0.4813987
3   3 0.0160058
4   4 0.7165909
5   5 0.6092248
6   6 0.2413049
7   7 0.7981568
8   8 0.6093960
9   9 0.2887064
10 10 0.3485780
> selected.id <- sample(data$id,3,replace=F)
> selected.id
[1] 9 7 1

I want to select data with corresponding selected.id, namely

> selected.data
   id x
9   9 0.2887064
7   7 0.7981568
1   1 0.3604464

How to do?

Tq.

Abdul Kudus
Institute for Mathematical Research
Universiti Putra Malaysia

[[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.
This e-mail may contain confidential and/or privileged i...{{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.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Do you use R for data manipulation?

2009-05-05 Thread milton ruser
I also put my 2cents on sqldf :-)

milton

On Wed, May 6, 2009 at 12:30 AM, Wensui Liu  wrote:

> take a look at sqldf package(http://code.google.com/p/sqldf/), you
> will be amazed.
>
> On Wed, May 6, 2009 at 12:22 AM, Farrel Buchinsky 
> wrote:
> > Is R an appropriate tool for data manipulation and data reshaping and
> data
> > organizing? I think so but someone who recently joined our group thinks
> not.
> > The new recruit believes that python or another language is a far better
> > tool for developing data manipulation scripts that can be then used by
> > several members of our research group. Her assessment is that R is useful
> > only when it comes to data analysis and working with statistical models.
> > So what do you think:
> > 1)R is a phenomenally powerful and flexible tool and since you are going
> to
> > do analyses in R you might as well use it to read data in and merge it
> and
> > reshape it to whatever you need.
> > OR
> > 2) Are you crazy? Nobody in their right mind uses R to pipe the data
> around
> > their lab and assemble it for analysis.
> >
> > Your insights would be appreciated.
> >
> > Details if you are interested:
> >
> > Our setup: Hundreds of patients recorded as cases with about 60
> variables.
> > Inputted and stored in a Sybase relational database. High throughput SNP
> > genotyping platforms saved data output to csv or excel tables.
> Previously,
> > not knowing any SQL I had used Microsoft Access to write queries to get
> the
> > data that I needed and to merge the genotyping with the clinical
> database.
> > It was horrible. I could not even use it on anything other than my
> desktop
> > machine at work. When I realized that I was going to need to learn R to
> > handle the genetic analyses I decided to keep Sybase as the data
> repository
> > for the clinical information and the do all the data manipulation,
> merging
> > and piping with R using RODBC. I was and am a very amateur coder.
> > Nevertheless, many many hours later I have scripts that did what I needed
> > them to do and I understand R code and can tinker with it as needed. My
> > scripts work for me but they are not exactly user-friendly for others in
> the
> > laboratory to just run. For instance, depending on what machine the
> script
> > is being run from, one may need to change the file name or file path and
> > tinker under the hood to accomplish that. My bias is to fulfill all our
> data
> > manipulation and reshaping with R. Since I am the principal investigator
> it
> > is me who stays constant and coders or analysts who may come and go.
> >
> > I am even more enamored with R for data manipulation since reading a book
> > about it.
> >
> >[[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.
> >
>
>
>
> --
> ==
> WenSui Liu
> Acquisition Risk, Chase
> Blog   : statcompute.spaces.live.com
>
> Tough Times Never Last. But Tough People Do.  - Robert Schuller
> ==
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] subset data

2009-05-05 Thread Kushantha Perera
Try, data[data$id%in%selected.id,]


Good day!
Kushantha

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of abdul kudus
Sent: Wednesday, May 06, 2009 10:12 AM
To: r-help@r-project.org
Subject: [R] subset data

Dear all,

> data <- data.frame(id=seq(1:10),x=runif(10))
> data
   id x
1   1 0.3604464
2   2 0.4813987
3   3 0.0160058
4   4 0.7165909
5   5 0.6092248
6   6 0.2413049
7   7 0.7981568
8   8 0.6093960
9   9 0.2887064
10 10 0.3485780
> selected.id <- sample(data$id,3,replace=F)
> selected.id
[1] 9 7 1

I want to select data with corresponding selected.id, namely

> selected.data
   id x
9   9 0.2887064
7   7 0.7981568
1   1 0.3604464

How to do?

Tq.

Abdul Kudus
Institute for Mathematical Research
Universiti Putra Malaysia

[[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.
This e-mail may contain confidential and/or privileged i...{{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] subset data

2009-05-05 Thread milton ruser
just a small adjusts...
data[data$id %in% selected.id, ]
 --- so elegant! :-)

On Wed, May 6, 2009 at 1:15 AM, milton ruser  wrote:

> Like this?
>
>
>
> data<-read.table(stdin(), head=T, sep=",")
> id,x
> 1,0.3604464
> 2,0.4813987
> 3,0.0160058
> 4,0.7165909
> 5,0.6092248
> 6,0.2413049
> 7,0.7981568
> 8,0.6093960
> 9,0.2887064
> 10,0.3485780
>
> selected.id <- sample(data$id,3,replace=F)
> selected.id
> data.subset<-subset(data, id %in% selected.id)
> data.subset
>
> Cheers
>
> milton
>   On Wed, May 6, 2009 at 12:42 AM, abdul kudus wrote:
>
>> Dear all,
>>
>> > data <- data.frame(id=seq(1:10),x=runif(10))
>> > data
>>   id x
>> 1   1 0.3604464
>> 2   2 0.4813987
>> 3   3 0.0160058
>> 4   4 0.7165909
>> 5   5 0.6092248
>> 6   6 0.2413049
>> 7   7 0.7981568
>> 8   8 0.6093960
>> 9   9 0.2887064
>> 10 10 0.3485780
>> > selected.id <- sample(data$id,3,replace=F)
>> > selected.id
>> [1] 9 7 1
>>
>> I want to select data with corresponding selected.id, namely
>>
>> > selected.data
>>   id x
>> 9   9 0.2887064
>> 7   7 0.7981568
>> 1   1 0.3604464
>>
>> How to do?
>>
>> Tq.
>>
>> Abdul Kudus
>> Institute for Mathematical Research
>> Universiti Putra Malaysia
>>
>>[[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>

[[alternative HTML version deleted]]

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


Re: [R] subset data

2009-05-05 Thread milton ruser
Like this?



data<-read.table(stdin(), head=T, sep=",")
id,x
1,0.3604464
2,0.4813987
3,0.0160058
4,0.7165909
5,0.6092248
6,0.2413049
7,0.7981568
8,0.6093960
9,0.2887064
10,0.3485780

selected.id <- sample(data$id,3,replace=F)
selected.id
data.subset<-subset(data, id %in% selected.id)
data.subset

Cheers

milton
On Wed, May 6, 2009 at 12:42 AM, abdul kudus  wrote:

> Dear all,
>
> > data <- data.frame(id=seq(1:10),x=runif(10))
> > data
>   id x
> 1   1 0.3604464
> 2   2 0.4813987
> 3   3 0.0160058
> 4   4 0.7165909
> 5   5 0.6092248
> 6   6 0.2413049
> 7   7 0.7981568
> 8   8 0.6093960
> 9   9 0.2887064
> 10 10 0.3485780
> > selected.id <- sample(data$id,3,replace=F)
> > selected.id
> [1] 9 7 1
>
> I want to select data with corresponding selected.id, namely
>
> > selected.data
>   id x
> 9   9 0.2887064
> 7   7 0.7981568
> 1   1 0.3604464
>
> How to do?
>
> Tq.
>
> Abdul Kudus
> Institute for Mathematical Research
> Universiti Putra Malaysia
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] subset data

2009-05-05 Thread Daniel Malter
data[data$id==selected$id, ] 


-
cuncta stricte discussurus
-

-Ursprüngliche Nachricht-
Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im
Auftrag von abdul kudus
Gesendet: Wednesday, May 06, 2009 12:42 AM
An: r-help@r-project.org
Betreff: [R] subset data

Dear all,

> data <- data.frame(id=seq(1:10),x=runif(10))
> data
   id x
1   1 0.3604464
2   2 0.4813987
3   3 0.0160058
4   4 0.7165909
5   5 0.6092248
6   6 0.2413049
7   7 0.7981568
8   8 0.6093960
9   9 0.2887064
10 10 0.3485780
> selected.id <- sample(data$id,3,replace=F) selected.id
[1] 9 7 1

I want to select data with corresponding selected.id, namely

> selected.data
   id x
9   9 0.2887064
7   7 0.7981568
1   1 0.3604464

How to do?

Tq.

Abdul Kudus
Institute for Mathematical Research
Universiti Putra Malaysia

[[alternative HTML version deleted]]

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

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


[R] bivariate normal and rho

2009-05-05 Thread Agostino Capponi
Hi,

Let f(rho) = E[F_1(x) F_2(y)], i.e f(rho) is the expectation of
F(x) * F(y) with respect to the bivariate Gaussian density with mean 0
and covariance matrix [1 rho; rho 1].
Moreover, assume F_1(x) and F_2(y) to be increasing functions of x and y
respectively.

I was wondering if it was true that f(rho) is an increasing function of rho.
If so, are there any references?

Best,

Agos

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

2009-05-05 Thread abdul kudus
Dear all,

> data <- data.frame(id=seq(1:10),x=runif(10))
> data
   id x
1   1 0.3604464
2   2 0.4813987
3   3 0.0160058
4   4 0.7165909
5   5 0.6092248
6   6 0.2413049
7   7 0.7981568
8   8 0.6093960
9   9 0.2887064
10 10 0.3485780
> selected.id <- sample(data$id,3,replace=F)
> selected.id
[1] 9 7 1

I want to select data with corresponding selected.id, namely

> selected.data
   id x
9   9 0.2887064
7   7 0.7981568
1   1 0.3604464

How to do?

Tq.

Abdul Kudus
Institute for Mathematical Research
Universiti Putra Malaysia

[[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] Do you use R for data manipulation?

2009-05-05 Thread Wensui Liu
take a look at sqldf package(http://code.google.com/p/sqldf/), you
will be amazed.

On Wed, May 6, 2009 at 12:22 AM, Farrel Buchinsky  wrote:
> Is R an appropriate tool for data manipulation and data reshaping and data
> organizing? I think so but someone who recently joined our group thinks not.
> The new recruit believes that python or another language is a far better
> tool for developing data manipulation scripts that can be then used by
> several members of our research group. Her assessment is that R is useful
> only when it comes to data analysis and working with statistical models.
> So what do you think:
> 1)R is a phenomenally powerful and flexible tool and since you are going to
> do analyses in R you might as well use it to read data in and merge it and
> reshape it to whatever you need.
> OR
> 2) Are you crazy? Nobody in their right mind uses R to pipe the data around
> their lab and assemble it for analysis.
>
> Your insights would be appreciated.
>
> Details if you are interested:
>
> Our setup: Hundreds of patients recorded as cases with about 60 variables.
> Inputted and stored in a Sybase relational database. High throughput SNP
> genotyping platforms saved data output to csv or excel tables. Previously,
> not knowing any SQL I had used Microsoft Access to write queries to get the
> data that I needed and to merge the genotyping with the clinical database.
> It was horrible. I could not even use it on anything other than my desktop
> machine at work. When I realized that I was going to need to learn R to
> handle the genetic analyses I decided to keep Sybase as the data repository
> for the clinical information and the do all the data manipulation, merging
> and piping with R using RODBC. I was and am a very amateur coder.
> Nevertheless, many many hours later I have scripts that did what I needed
> them to do and I understand R code and can tinker with it as needed. My
> scripts work for me but they are not exactly user-friendly for others in the
> laboratory to just run. For instance, depending on what machine the script
> is being run from, one may need to change the file name or file path and
> tinker under the hood to accomplish that. My bias is to fulfill all our data
> manipulation and reshaping with R. Since I am the principal investigator it
> is me who stays constant and coders or analysts who may come and go.
>
> I am even more enamored with R for data manipulation since reading a book
> about it.
>
>        [[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.
>



-- 
==
WenSui Liu
Acquisition Risk, Chase
Blog   : statcompute.spaces.live.com

Tough Times Never Last. But Tough People Do.  - Robert Schuller
==

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Do you use R for data manipulation?

2009-05-05 Thread Farrel Buchinsky
Is R an appropriate tool for data manipulation and data reshaping and data
organizing? I think so but someone who recently joined our group thinks not.
The new recruit believes that python or another language is a far better
tool for developing data manipulation scripts that can be then used by
several members of our research group. Her assessment is that R is useful
only when it comes to data analysis and working with statistical models.
So what do you think:
1)R is a phenomenally powerful and flexible tool and since you are going to
do analyses in R you might as well use it to read data in and merge it and
reshape it to whatever you need.
OR
2) Are you crazy? Nobody in their right mind uses R to pipe the data around
their lab and assemble it for analysis.

Your insights would be appreciated.

Details if you are interested:

Our setup: Hundreds of patients recorded as cases with about 60 variables.
Inputted and stored in a Sybase relational database. High throughput SNP
genotyping platforms saved data output to csv or excel tables. Previously,
not knowing any SQL I had used Microsoft Access to write queries to get the
data that I needed and to merge the genotyping with the clinical database.
It was horrible. I could not even use it on anything other than my desktop
machine at work. When I realized that I was going to need to learn R to
handle the genetic analyses I decided to keep Sybase as the data repository
for the clinical information and the do all the data manipulation, merging
and piping with R using RODBC. I was and am a very amateur coder.
Nevertheless, many many hours later I have scripts that did what I needed
them to do and I understand R code and can tinker with it as needed. My
scripts work for me but they are not exactly user-friendly for others in the
laboratory to just run. For instance, depending on what machine the script
is being run from, one may need to change the file name or file path and
tinker under the hood to accomplish that. My bias is to fulfill all our data
manipulation and reshaping with R. Since I am the principal investigator it
is me who stays constant and coders or analysts who may come and go.

I am even more enamored with R for data manipulation since reading a book
about it.

[[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 update.packages on repo with a single package

2009-05-05 Thread Michael DiPersio
I've set up a CRAN-style repository to distribute a single package.  The 
repository contains several versions of the package, I was hoping that 
update.packages pointed at this repository would grab the highest 
version number.  In fact it returns an error:


Error in available[, "Bundle"] : incorrect number of dimensions

This is because the private function .remove_stale_dups in utils, which 
is supposed to return a copy of an available.packages matrix with no 
duplicates, does not return a matrix in the case where all available 
packages are stale except one.  To fix this I've made the following 
simple change to the utils package in my copy of R, but if I've 
overlooked something I'd be happy to hear about it:


Index: packages.R
===
--- packages.R(revision 48465)
+++ packages.R(working copy)
@@ -869,5 +869,5 @@
stale_dups[i:end_i] <- wh
i <- end_i + 1L
}
-if(length(stale_dups)) ap[-stale_dups, ] else ap
+if(length(stale_dups)) ap[-stale_dups,,drop=FALSE ] else ap
}

Thanks,

Michael DiPersio

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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-sig-ME] Duplicating meta-regression results from PROC MIXED with lmer

2009-05-05 Thread Rolf Turner


On 6/05/2009, at 3:00 PM, Brant Inman wrote:


R-experts:

In 2002, Hans Van Houwelingen et al. published a tutorial on how to do
meta-regression in Statistics in Medicine.  They used the classic BCG
dataset of Colditz to demonstrate correct methodology and computed the
results using PROC MIXED in SAS. In trying to duplicate the results
presented in this paper, I have discovered that I can reproduce
certain items with lmer but not others.  I was hoping that someone
might point out how I could correctly program R code to arrive at the
correct solution.




There appears to be a tacit assertion here that the results from PROC
MIXED in The-Package-That-Must-Not-Be-Named are the correct results.

This assertion is very likely to bring the wrath of Doug Bates down
upon your head.  An outcome to be devoutly avoided! :-)

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

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


[R] RW: smoothing spline in package gam

2009-05-05 Thread 楊 詩韻

 

Dear jianghua and all R professor:

 

I use the suggestion that jianghua gives. But the problem is still there.

 

Use "summary(m1)" or "summary.gam(m1)" is the same result and it doesn't show 
the significance results of parametric terms.

 

Should I choose another smoother to get significance results of parametric 
terms ?

 

I know another "gam way" in the package "mgcv" and they can show me the 
significance results of parametric terms in package mgcv.

 

But the smoother is different between in package "gam" and "mgcv"

 

Is it possible to find significance results of parametric terms in package 
"gam" ?

 

or maybe I have to try another smoother in package "mgcv" !!

 

Is it possible that in package "mgcv" do some assunptions which can make the 
result is the same in package "gam" ?

 

Ashely, Yang

 

 

in package gam  

¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ

 

> library(gam)
Loading required package: splines
> 
>  
> m1=gam(y~ost+wst+park10+sch50+comm+build+suite+y95+y96+y97+y98+y99+s(builarea)+s(age)+s(fl)+s(totfl)+s(cbd)+s(redl))
>   
> summary.gam(m1)

Call: gam(formula = y ~ ost + wst + park10 + sch50 + comm + build + 
suite + y95 + y96 + y97 + y98 + y99 + s(builarea) + s(age) + 
s(fl) + s(totfl) + s(cbd) + s(redl))
Deviance Residuals:
Min  1Q  Median  3Q Max 
-753.51 -118.98  -15.27   99.16 1253.28 

(Dispersion Parameter for gaussian family taken to be 41952.11)

Null Deviance: 564111793 on 4714 degrees of freedom
Residual Deviance: 196251969 on 4678 degrees of freedom
AIC: 63607.24 

Number of Local Scoring Iterations: 2 

DF for Terms and F-values for Nonparametric Effects

Df Npar Df Npar F Pr(F)
(Intercept)  1 
ost  1 
wst  1 
park10   1 
sch501 
comm 1 
build1 
suite1 
y95  1 
y96  1 
y97  1 
y98  1 
y99  1 
s(builarea)  1   3 13.852 5.440e-09 ***
s(age)   1   3 13.410 1.033e-08 ***
s(fl)1   3 41.732 < 2.2e-16 ***
s(totfl) 1   3 19.146 2.454e-12 ***
s(cbd)   1   3 15.464 5.222e-10 ***
s(redl)  1   3  4.839  0.002300 ** 
---
Signif. codes:  0 ¡¥***¡¦ 0.001 ¡¥**¡¦ 0.01 ¡¥*¡¦ 0.05 ¡¥.¡¦ 0.1 ¡¥ ¡¦ 1 
> 

 

> summary(m1)

Call: gam(formula = y ~ ost + wst + park10 + sch50 + comm + build + 
suite + y95 + y96 + y97 + y98 + y99 + s(builarea) + s(age) + 
s(fl) + s(totfl) + s(cbd) + s(redl))
Deviance Residuals:
Min  1Q  Median  3Q Max 
-753.51 -118.98  -15.27   99.16 1253.28 

(Dispersion Parameter for gaussian family taken to be 41952.11)

Null Deviance: 564111793 on 4714 degrees of freedom
Residual Deviance: 196251969 on 4678 degrees of freedom
AIC: 63607.24 

Number of Local Scoring Iterations: 2 

DF for Terms and F-values for Nonparametric Effects

Df Npar Df Npar F Pr(F)
(Intercept)  1 
ost  1 
wst  1 
park10   1 
sch501 
comm 1 
build1 
suite1 
y95  1 
y96  1 
y97  1 
y98  1 
y99  1 
s(builarea)  1   3 13.852 5.440e-09 ***
s(age)   1   3 13.410 1.033e-08 ***
s(fl)1   3 41.732 < 2.2e-16 ***
s(totfl) 1   3 19.146 2.454e-12 ***
s(cbd)   1   3 15.464 5.222e-10 ***
s(redl)  1   3  4.839  0.002300 ** 
---
Signif. codes:  0 ¡¥***¡¦ 0.001 ¡¥**¡¦ 0.01 ¡¥*¡¦ 0.05 ¡¥.¡¦ 0.1 ¡¥ ¡¦ 1 
> 


 

 

in package mgcv

¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ¡õ


> library(mgcv)
This is mgcv 1.3-29 

Attaching package: 'mgcv'


The following object(s) are masked from package:gam :

 anova.gam,
 gam,
 gam.control,
 gam.fit,
 plot.gam,
 predict.gam,
 print.gam,
 print.summary.gam,
 s,
 summary.gam 

>  
> m1=gam(y~ost+wst+park10+sch50+comm+build+suite+y95+y96+y97+y98+y99+s(builarea)+s(age)+s(fl)+s(totfl)+s(cbd)+s(redl))
>   
> summary(m1)

Family: gaussian 
Link function: identity 

Formula:
y ~ ost + wst + park10 + sch50 + comm + build + suite + y95 + 
y96 + y97 + y98 + y99 + s(builarea) + s(age) + s(fl) + s(totfl) + 
s(cbd) + s(redl)

Parametric coefficients:
Estimate S

Re: [R] re shape package - use one cast() instead of many

2009-05-05 Thread hadley wickham
On Tue, May 5, 2009 at 3:55 PM, jwg20  wrote:
>
> Thanks for your help! I wasn't sure what the margins variable did, but I'm
> beginning to understand. I'm almost there, but with my data (and with ff_d)
> I tried to margin over two variable names, however it only does one of them.
> So with ff_d I set margins=c("treatment","variable"); however I only ever
> get 1_(all) 2_(all) and 3_(all)... never something like (all)_painty. (This
> also happens for margins=TRUE)

Ah ok.  Margins only work in one direction, so currently there's no
way to do what you want in a single step.

Hadley

-- 
http://had.co.nz/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Stepwise logistic regression with significance testing - stepAIC

2009-05-05 Thread Frank E Harrell Jr

David Freedman wrote:

Didn't a 2008 paper by Austin in J Clin Epidemiol show that bootstrapping was
just as bad as backward stepwise regression for finding the true predictors?


Yes

Any variable selection without shrinkage is problematic.
Frank



http://xrl.in/26em



Dimitris Rizopoulos-4 wrote:

Greg Snow wrote:

There is not a meaningful alternative way since the way you propose is
not meaningful.  The Wald tests have some know problems even in the well
defined cases.  Both types of tests are designed to test a predefined
hypothesis, not a conditional hypothesis on the stepwise procedure.  It
is best to use other approaches than stepwise selection (it has been
shown to give biased results) such as the lasso.  If you need to use
stepwise, then you should bootstrap the entire selection process to get
better estimates/standard errors.  
For bootstrapping the stepAIC procedure you may have a look at package 
bootStepAIC.


Best,
Dimitris



Frank Harrell's book and package go into more detail on this and provide
some tools to help (as well as the other packages that can be used).

Hope this helps,


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

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

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







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

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


Re: [R] dotplot: labeling coordinates for each point

2009-05-05 Thread Qifei Zhu
Hi Deepayan,

Thanks for the hint. I spent some time on the research but haven't got any luck 
in writing the custom panel function for the conditional labeling of points in 
a graph. Could you please provide some more thoughts and probably some pseudo 
code? Thank you so much for your time!

Best,
Tony

-Original Message-
From: Deepayan Sarkar [mailto:deepayan.sar...@gmail.com] 
Sent: Sunday, April 26, 2009 2:32 PM
To: Qifei Zhu
Cc: David Winsemius; r-help@r-project.org
Subject: Re: [R] dotplot: labeling coordinates for each point

On 4/26/09, Qifei Zhu  wrote:
> Hi David,
>
>  Thanks! It looks much better now. but is there any way to add (x,y)
>  coordinates as labels to all the points in the graph? Best case if I can
>  enforce some conditions saying if (y>10,000) label, else no label. Any
>  advice is appreciated.

Sure, write a panel function. See the examples in ?xyplot.

-Deepayan

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

2009-05-05 Thread Don MacQueen

Have you tried dbSendQuery() ?

That is, construct an SQL insert statement and use it in dbSendQuery. 
Might have to follow it with dbCommit().


You could also use break your data up into smaller pieces and use 
dbWriteTable to write it a piece at a time, if really is too much to 
do all at once.


-Don

At 12:56 PM +0200 5/5/09, Martijn Ras wrote:

Heya Folks,

I can not find anything on executing insert statement through RMySQL,
can someone please enlighten me?

All i've found so far on getting data into a database is the write
table functionality. Reading all data into memory appending additional
information and writing that into a table is fine on my test
environment, but won't be possible on the production environment
because of the amount of data it will contain.

Mazzel,

Martijn.

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



--
-
Don MacQueen
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062
m...@llnl.gov

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


Re: [R] xYplot() produces empty pdf

2009-05-05 Thread x

print() fixed it. Thank you!

sp


--- On Tue, 5/5/09, Rolf Turner  wrote:

> From: Rolf Turner 
> Subject: Re: [R] xYplot() produces empty pdf
> To: "to_rent_2...@yahoo.com" 
> Cc: "r-help@r-project.org" 
> Date: Tuesday, May 5, 2009, 9:26 PM
> On 6/05/2009, at 12:50 PM, x wrote:
> 
> > 
> > Hi,
> > 
> > While xYplot(...) below produces an empty pdf file,
> plot(...) works fine. The same xYplot(...) produces correct
> output if tried directly in R console. Any suggestions?
> 
> RTFFAQ (7.22)
> 
>   cheers,
> 
>   Rolf Turner
> 
> ##
> Attention:This e-mail message is privileged and
> confidential. If you are not theintended recipient please
> delete the message and notify the sender.Any views or
> opinions presented are solely those of the author.
> 
> This e-mail has been scanned and cleared by
> MailMarshalwww.marshalsoftware.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] xYplot() produces empty pdf

2009-05-05 Thread Rolf Turner


On 6/05/2009, at 12:50 PM, x wrote:



Hi,

While xYplot(...) below produces an empty pdf file, plot(...) works  
fine. The same xYplot(...) produces correct output if tried  
directly in R console. Any suggestions?


RTFFAQ (7.22)

cheers,

Rolf Turner

##
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}

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


[R] R readline customization with rl_application_name

2009-05-05 Thread Britton Kerin
I tried to customize R completion in my .inputrc like this:

$if RCustomCompletion
  Control-q: "q(save=\"no\")\n"
$endif

I looked in the R source to find about RCustomCompletion 

BUBBA$ grep -r 'rl_readline_name' *
src/unix/sys-std.c:rl_readline_name = "RCustomCompletion";

but this poster:

https://stat.ethz.ch/pipermail/r-help/2008-September/173828.html

sounds like he found the same information in the docs somewhere.

But it doesn't seem to work.  Setting the exact same binding
globally (i.e. not in an $if) gives the desired result.  Other
applications seem to work about as expected, for example the
following workaround gives the desired result for the programs
I use regularly:

Control-q: "q(save=\"no\")\n"
$if Bash
  Control-q: "\C-d"
$endif
$if bc
  Control-q: "\C-d"
$endif
$if perldb
  Control-q: "\C-d"
$endif

Britton

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

2009-05-05 Thread stephen sefick
If you would provide a reproducible example I could tinker.

Stephen Sefick

On Tue, May 5, 2009 at 4:59 PM, Zeljko Vrba  wrote:
> I have a following problem:
>
> The call
>
> qplot(wg, v.realtime, data=df.best.medians$gv1, colour=sp,  geom="boxplot")
>
> works nice: for each value of the wg factor I get two box-plots (two levels in
> the sp factor) in different colours, side-by-side, centered at the wg x-axis.
> However, I want to separate the data belonging to different levels of the n
> factor, so I add the facets option:
>
> qplot(wg, v.realtime, data=df.best.medians$gv1, facets = . ~ n,
>  colour=sp, geom="boxplot")
>
> At this point, the things break with more than 50 warnings, here are the
> first few:
>
> 1: In Ops.factor(width, n) : / not meaningful for factors
> 2: In Ops.factor(n, 1) : - not meaningful for factors
> 3: In Ops.factor(2, n) : * not meaningful for factors
> 4: In Ops.factor(d_width, n) : / not meaningful for factors
>
> Interestingly enough, removing the colour option, also produces a boxplot,
> but now the data for the two levels of sp are drawn in the same box, i.e.,
> the following works:
>
> qplot(wg, v.realtime, data=df.best.medians$gv1, facets = . ~ n, 
> geom="boxplot")
>
> but does not plot what I want.
>
> Any suggestions for a workaround?
>
> Thanks.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Stephen Sefick

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

-K. Mullis

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


[R] xYplot() produces empty pdf

2009-05-05 Thread x

Hi,

While xYplot(...) below produces an empty pdf file, plot(...) works fine. The 
same xYplot(...) produces correct output if tried directly in R console. Any 
suggestions?

Thanks,
sp

# empty pdf
trellis.device("pdf", file="./resid1_lat.pdf");
xYplot(resid(f) ~ fitted(f), method='quantile', nx=20,
   ylim=c(-100,250), xlim = c(-25,150),
   abline=list(h=0, lwd=0.5, lty=2),
   xlab="Fitted Values [lat]",
   ylab="Residuals [lat]")
dev.off();

# non-empty pdf
trellis.device("pdf", file="./resid1_lat.pdf");
plot(resid(f) ~ fitted(f), method='quantile', nx=20,
   ylim=c(-100,250), xlim = c(-25,150),
   abline=list(h=0, lwd=0.5, lty=2),
   xlab="Fitted Values [lat]",
   ylab="Residuals [lat]");
dev.off();

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

2009-05-05 Thread Duncan Murdoch

On 05/05/2009 6:28 PM, Antonio Lucadamo wrote:

Dear all,
I'm using the ellipse package and I would like to verify if the
confidence region that I build with this package can be equivalent to  
an Union Intersection Test. I used different value for the t-statistic  
but I can not find the right equivalence.

Does someone know how to choose the right value?


You've posted this question several times now, with no reply that I've 
seen.  I think you need to be more specific.  As far as I know, 
"union-intersection" is a strategy for constructing a test, it's not a 
uniquely defined test.  So you should describe your union-intersection 
test, and then someone could help you to compare it to the confidence 
regions that ellipse computes.


Duncan Murdoch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Stepwise logistic regression with significance testing - stepAIC

2009-05-05 Thread David Freedman

Didn't a 2008 paper by Austin in J Clin Epidemiol show that bootstrapping was
just as bad as backward stepwise regression for finding the true predictors?

http://xrl.in/26em



Dimitris Rizopoulos-4 wrote:
> 
> Greg Snow wrote:
>> There is not a meaningful alternative way since the way you propose is
>> not meaningful.  The Wald tests have some know problems even in the well
>> defined cases.  Both types of tests are designed to test a predefined
>> hypothesis, not a conditional hypothesis on the stepwise procedure.  It
>> is best to use other approaches than stepwise selection (it has been
>> shown to give biased results) such as the lasso.  If you need to use
>> stepwise, then you should bootstrap the entire selection process to get
>> better estimates/standard errors.  
> 
> For bootstrapping the stepAIC procedure you may have a look at package 
> bootStepAIC.
> 
> Best,
> Dimitris
> 
> 
>> Frank Harrell's book and package go into more detail on this and provide
>> some tools to help (as well as the other packages that can be used).
>> 
>> Hope this helps,
>> 
> 
> -- 
> Dimitris Rizopoulos
> Assistant Professor
> Department of Biostatistics
> Erasmus University Medical Center
> 
> Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands
> Tel: +31/(0)10/7043478
> Fax: +31/(0)10/7043014
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Stepwise-logistic-regression-with-significance-testing---stepAIC-tp23388859p23398154.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] novice question regarding R archives

2009-05-05 Thread Mike Lawrence
http://cran.r-project.org/web/packages/

On Tue, May 5, 2009 at 8:28 PM, Xao Ping  wrote:
> Dear All:
> I am new here. Please, advise how can I reach the R-archives to look through 
> the libraries available for download.
>
> Thanks
>
> Xao Ping
> R&R Pharmakinetics
> Taiwan
>
>
>
>        [[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.
>
>



-- 
Mike Lawrence
Graduate Student
Department of Psychology
Dalhousie University

Looking to arrange a meeting? Check my public calendar:
http://tr.im/mikes_public_calendar

~ Certainty is folly... I think. ~

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

2009-05-05 Thread Xao Ping
Dear All:
I am new here. Please, advise how can I reach the R-archives to look through 
the libraries available for download.
 
Thanks
 
Xao Ping
R&R Pharmakinetics
Taiwan


  
[[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] Way to handle variable length and numbers of columns using read.table(...)

2009-05-05 Thread jim holtman
You can read in your data with 'readLines' and then edit out the offending
lines.  Here is something that works with the data you posted.  You will
have to tailor to your real data and add error checks:

> # read in the data with 'readLines' to get all the lines
x <- readLines('clipboard')
> cat(x, sep='\n')
Time Loc1 Loc2
---
1 22.33 44.55
2 66.77 88.99
3 222.33344.55
4 66.77 88.99
Avg. Loc1 = 77.88
Avg. Loc2 = 55.66
Final Time = 4
> # assume data starts after '--' and end with a blank line
> dataStart <- grep('', x)
> # delete upto and including that line
> x <- tail(x, -dataStart[1])
> # now find the blank line
> blank <- grep("^\\s*$", x)
> # delete lines after the blank
> x <- head(x, -blank)
> x
[1] "1 22.33 44.55"  "2 66.77 88.99"  "3 222.33344.55"
> z <- read.table(textConnection(x), fill=TRUE)
> z
  V1   V2V3
1  122.33 44.55
2  266.77 88.99
3  3 222.33344.55NA
> str(z)
'data.frame':   3 obs. of  3 variables:
 $ V1: int  1 2 3
 $ V2: Factor w/ 3 levels "22.33","222.33344.55",..: 1 3 2
 $ V3: num  44.5 89 NA
>
>


On Mon, May 4, 2009 at 11:29 PM, Jason Rupert wrote:

>
> Jim,
>
> You guessed it.  There are other "problems" with the data.  Here is a
> closer representation of the data:
> Total time and location
> are listed below.
>
> Time Loc1 Loc2
> ---
> 1 22.33 44.55
> 2 66.77 88.99
> 3 222.33344.55
> 4 66.77 88.99
>
> Avg. Loc1 = 77.88
> Avg. Loc2 = 55.66
> Final Time = 4
>
> Right now I am using "nrows" in order to only read Time 1-4 & "skip" to
> skip over the unusable header info, e.g.
>
> read.table(read.table('clipboard', header=FALSE, fill=TRUE, skip=5,
> nrows=4)
>
> Unfortunately, sometimes the number of "Time" rows varies, so I need to
> also account for that.
>
> Maybe I need to look into what Gabor suggested as well, i.e.
> library(gsubfn)
>
> Thanks again for any feedback and advice on this one, as the data I receive
> is out of my control, but I am working with the go get them to fix it as
> well.
>
>
>
> --- On Mon, 5/4/09, jim holtman  wrote:
>
> > From: jim holtman 
> > Subject: Re: [R] Way to handle variable length and numbers of columns
> using  read.table(...)
> > To: jasonkrup...@yahoo.com
> > Cc: R-help@r-project.org
> > Date: Monday, May 4, 2009, 9:47 PM
> > Well if you read in your data, you get:
> >
> > > x <- read.table('clipboard', header=TRUE,
> > fill=TRUE)
> > Warning message:
> > In read.table("clipboard", header = TRUE, fill =
> > TRUE) :
> >   incomplete final line found by readTableHeader on
> > 'clipboard'
> > > x
> >   Time Loc1  Loc2
> > 1122.33 44.55
> > 2266.77 88.99
> > 33 222.33344.55NA
> > 4466.77 88.99
> > > str(x)
> > 'data.frame':   4 obs. of  3 variables:
> >  $ Time: int  1 2 3 4
> >  $ Loc1: Factor w/ 3 levels
> > "22.33","222.33344.55",..: 1 3 2 3
> >  $ Loc2: num  44.5 89 NA 89
> > >
>
> As you can see the variable that has two decimal points is read in as a
> character and cause the whole column to be converted to a factor.  It
> appears that you have some fixed length fields that are overflowing.  Now
> you could read in the data and use regular expressions and parse the data;
> you just have to match on the first part have two decimal place and then
> extract the rest.  THe question is, is this the only "problems" you have in
> the data?  If so, parsing it is not hard.
>
> > On Mon, May 4, 2009 at 10:20 PM, Jason Rupert
> > wrote:
> >
> > >
> > > I've got read.table to successfully read in my
> > table of three columns.
> > >  Most of the time I will have a set number of rows,
> > but sometime that will
> > > be variable and sometimes there will be only be two
> > variables in one row,
> > > e.g.
> > >
> > > Time Loc1 Loc2
> > > 1 22.33 44.55
> > > 2 66.77 88.99
> > > 3 222.33344.55
> > > 4 66.77 88.99
> > >
> > > Is there any way to have read.table handle (1) a
> > variable number of rows,
> > > and (2) sometime there are only two variables as shown
> > in Time = 3 above?
> > >
> > > Just curious about how to handle this, and if
> > read.table is the right way
> > > to go about or if I should read in all the data and
> > then try to parse it out
> > > best I can.
> > >
> > > Thanks again.
> > >
> > > > R.version
> > >   _
> > > platform   i386-apple-darwin8.11.1
> > > arch   i386
> > > os darwin8.11.1
> > > system i386, darwin8.11.1
> > > status
> > > major  2
> > > minor  8.0
> > > year   2008
> > > month  10
> > > day20
> > > svn rev46754
> > > language   R
> > > version.string R version 2.8.0 (2008-10-20)
> > >
> > > __
> > > R-help@r-project.org mailing list
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide
> > >
> > http://www.R-project.org/posting-guide.html
> 

Re: [R] Relative subscripts?

2009-05-05 Thread jim holtman
?diff

> x
  ID LENGTH DIFF
1  1 10   NA
2  2 155
3  3 205
4  4 12   -8
5  5 186
> x <- x[,-3]
> x
  ID LENGTH
1  1 10
2  2 15
3  3 20
4  4 12
5  5 18
> x$DIFF <- c(NA, diff(x$LENGTH) )
> x
  ID LENGTH DIFF
1  1 10   NA
2  2 155
3  3 205
4  4 12   -8
5  5 186


On Tue, May 5, 2009 at 7:00 PM, Mark Na  wrote:

> Dear R-helpers,
>
> I have a dataframe with several columns, one of which is called LENGTH.
>
> I would like to make a new column called DIFF containing the value of
> LENGTH minus LENGTH in the previous row, like this:
>
>  ID LENGTH DIFF
> 1  1 10   NA
> 2  2 155
> 3  3 205
> 4  4 12   -8
> 5  5 186
>
> I'd like to think there are "relative subscripts" in R but I can't
> find any reference to such a thing.
>
> Any help solving this problem would be much appreciated, thanks!
>
> Mark 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.
>



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

What is the problem that you are trying to solve?

[[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] Relative subscripts?

2009-05-05 Thread Mark Na
Dear R-helpers,

I have a dataframe with several columns, one of which is called LENGTH.

I would like to make a new column called DIFF containing the value of
LENGTH minus LENGTH in the previous row, like this:

  ID LENGTH DIFF
1  1 10   NA
2  2 155
3  3 205
4  4 12   -8
5  5 186

I'd like to think there are "relative subscripts" in R but I can't
find any reference to such a thing.

Any help solving this problem would be much appreciated, thanks!

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


Re: [R] yacas

2009-05-05 Thread Gabor Grothendieck
You haven't provided any code so we have no idea what
the problem is.   Make sure you have read the troubleshooting
sections on the home page?
http://ryacas.googlecode.com

Here is an example:

> library(Ryacas)
Loading required package: XML
> x <- Sym("x")
> Factor(x^2-1)
[1] "Starting Yacas!"
expression((x + 1) * (x - 1))


You can also try the rSymPy package.
Installation has fewer gotchas:

> library(rSymPy)
Loading required package: rJava
> sympy("var('x')") # define x to be symbolic
[1] "x"
> sympy("factor(x**2-1)")
[1] "-(1 + x)*(1 - x)"

See home page at http://rsympy.googlecode.com

On Tue, May 5, 2009 at 6:41 PM, Hassan Mohamed
 wrote:
> Hi,
> as I find problems with yacas package...
> is there any R function equivalent to the yacas function "Factor" ?
> the factor function which i found in the R help is not the same.
> it doesn't factor an algebraic expression..
> thanks
> hassan
>
>
>
>
>        [[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] FOURIER INTEGRALS IN R

2009-05-05 Thread andrew
Isn't it possible to write this as the real part of a fourier
transform?  You could then use the fft to calculate it for all the
values of x, all at once.  The Madan and Carr paper offers some
pointers on how to do this: http://www.imub.ub.es/events/sssf/vgfrier7.pdf

On May 6, 1:06 am, "Ravi Varadhan"  wrote:
> Your integrand is smooth.
>
> What are the limits of integration: 0 to 1 or 0 to infinity?  Main challenge
> is that it is increasingly oscillatory as x and/or t increase.  You can find
> the zeros of thecosinefunction and add up the integrals between successive
> zeros.  In what context does this inttegral arise?  It must have been
> studied well using asymptotic approximation and such.  
>
> Ravi.
>
> 
> ---
>
> Ravi Varadhan, Ph.D.
>
> Assistant Professor, The Center on Aging and Health
>
> Division of Geriatric Medicine and Gerontology
>
> Johns Hopkins University
>
> Ph: (410) 502-2619
>
> Fax: (410) 614-9625
>
> Email: rvarad...@jhmi.edu
>
> Webpage:  http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html
>
> 
> 
>
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
>
> Behalf Of A Achilleos
> Sent: Tuesday, May 05, 2009 10:18 AM
> To: r-h...@r-project.org
> Subject: Re: [R] FOURIER INTEGRALS IN R
>
> Ok thanks..
>
> No, my function is not smooth.
>
> Actually, I am dealing with an integral having the following form, for
> example:
>
> \int cos(tx) (1-t^2)^3 \exp(0.5*t^2) dt
>
> I want to estimate this FourierCosineintegral for a given value of x.
>
> Thanks for the help.
>
> AA
>
> On Tue, May 5, 2009 2:34 am, andrew wrote:
> > integrate offers some one-dimensional algorithms, but you need to
> > start with a smooth function to get it to converge properly.  With a
> >cosineintegral, there may be certain routines that offer better value
> > for money: the Clenshaw-Curtis integration, or perhaps the FFT.  You
> > would have to recast your problem by doing some sort of substitution.
>
> > Perhaps post some latex code to show the exact type of integral you
> > are wanting to calculate.
>
> > Regards,
>
> > On May 5, 6:32 am, "Achilleas Achilleos"  wrote:
> >> Hi,
>
> >> I am wondering whether there exist any function in R (any package)
> >> that calculates Fourier Integrals.
>
> >> Particularly, I am interested for estimation of aCosineFourier
> >> integral...
>
> >> I would be much obliged if you could help me on this..
>
> >> Thanks.
>
> >> Andreas
>
> >> --
>
> >> __
> >> r-h...@r-project.org mailing
> >> listhttps://stat.ethz.ch/mailman/listinfo/r-help
> >> PLEASE do read the posting
> >> guidehttp://www.R-project.org/posting-guide.html
> >> and provide commented, minimal, self-contained, reproducible code.
>
> > __
> > r-h...@r-project.org mailing list
> >https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> >http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> --
> A Achilleos
> ma...@bristol.ac.uk
>
> __
> r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
> __
> r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://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] yacas

2009-05-05 Thread Hassan Mohamed
Hi,
as I find problems with yacas package...
is there any R function equivalent to the yacas function "Factor" ?
the factor function which i found in the R help is not the same.
it doesn't factor an algebraic expression..
thanks
hassan



  
[[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] illegal levels in yaImpute() / AsciiGridImpute()

2009-05-05 Thread Seth W Bigelow
I'm using randomForest in yaImpute to create a yai-type object which 
associates "L" with landscape features. Then I use the sp() package to 
impute L to a landscape consisting of four ascii files) I keep getting the 
message "NA's generated due to illegal level(s)" when I do the imputation. 
It's probably because one of the landscape features ("as", for 
aspect/slope) is stored in numeric form but is treated as a factor when 
the yai object is created. "as" is also stored in numeric form in the 
ascii grids, of course. I included an "xtypes" argument in the 
AsciiGridImpute statement, but that did 
not help. Some relevant statements are:

xfiles <- list(DEM_10 = "dem_10.asc", EASTING = "easting.asc", 
NORTHING = "northing.asc", as = "asp_slop.asc")

AsciiGridImpute(yai_ob, xfiles, outfiles,
xtypes=list("numeric", "numeric", "integer", "character"))

Any insights will be appreciated. I'd particularly like to know how to 
gain access to the "invisible" list, VALUE, containing unexpectedNA's, 
illegal levels, and other information that would help me to troubleshoot 
the issue.

Dr. Seth  W. Bigelow
Biologist, USDA-FS Sierra Nevada Research Center
1731 Research Park Drive, Davis California
[[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] ellipse

2009-05-05 Thread Antonio Lucadamo

Dear all,
I'm using the ellipse package and I would like to verify if the
confidence region that I build with this package can be equivalent to  
an Union Intersection Test. I used different value for the t-statistic  
but I can not find the right equivalence.

Does someone know how to choose the right value?

Thanks a lot.
Antonio





--
Antonio Lucadamo,
Dipartimento di Scienze Economiche e Metodi Quantitativi
Università del Piemonte Orientale "A. Avogadro"
via Perrone, 18 - 28100 Novara
fax:  +39 0321 375305
phone:+39 0321 375338
mobile phone: +39 3385973881
skype contact: antonio.lucadamo

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] self organizing map advice for categorical data

2009-05-05 Thread Thomas Petzoldt

George Chen schrieb:

Hello,

Could anybody offer any advice about implementing a Kohonen self organizing map 
for categorical data?  Specifically I am wondering if there are any 
pre-existent packages that can deal with categorical data and/or how one would 
compare the input vector of categoricals with the self organizing map nodes.

Thanks in advance.

George Chen



Yes, there is a very nice one with excellent graphics, see article:

Ron Wehrens, Lutgarde M. C. Buydens (2007) Self- and Super-organizing 
Maps in R: The kohonen Package. Journal of Statistical Software	21(5). 
http://www.jstatsoft.org/v21/i05



Hope it helps

Thomas Petzoldt

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

2009-05-05 Thread Zeljko Vrba
I have a following problem:

The call

qplot(wg, v.realtime, data=df.best.medians$gv1, colour=sp,  geom="boxplot")

works nice: for each value of the wg factor I get two box-plots (two levels in
the sp factor) in different colours, side-by-side, centered at the wg x-axis.
However, I want to separate the data belonging to different levels of the n
factor, so I add the facets option:

qplot(wg, v.realtime, data=df.best.medians$gv1, facets = . ~ n,
  colour=sp, geom="boxplot")

At this point, the things break with more than 50 warnings, here are the
first few:

1: In Ops.factor(width, n) : / not meaningful for factors
2: In Ops.factor(n, 1) : - not meaningful for factors
3: In Ops.factor(2, n) : * not meaningful for factors
4: In Ops.factor(d_width, n) : / not meaningful for factors

Interestingly enough, removing the colour option, also produces a boxplot,
but now the data for the two levels of sp are drawn in the same box, i.e.,
the following works:

qplot(wg, v.realtime, data=df.best.medians$gv1, facets = . ~ n, geom="boxplot")

but does not plot what I want.

Any suggestions for a workaround?

Thanks.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] re shape package - use one cast() instead of many

2009-05-05 Thread jwg20

Thanks for your help! I wasn't sure what the margins variable did, but I'm
beginning to understand. I'm almost there, but with my data (and with ff_d)
I tried to margin over two variable names, however it only does one of them.
So with ff_d I set margins=c("treatment","variable"); however I only ever
get 1_(all) 2_(all) and 3_(all)... never something like (all)_painty. (This
also happens for margins=TRUE)

To further exemplify, with my data I have the call to cast() as:
cast(data.melted,Subject~CogStat+Animacy,mean,margins=c("CogStat","Animacy"))

which results in:

  Subject COG_aCOG_i COG_(all)nCOG_anCOG_i nCOG_(all)
1 100  794. 676.5556  728.0833  810.7778  798.4103   800.7292
...

I would like additionally to get (all)_i (all)_a. It seems to just apply the
margin to the first part of the formula before "+" (i.e. I can change it to
Animacy+CogStat and get a_COG,a_nCOG,   a_(all), etc.)


hadley wrote:
> 
> On Tue, May 5, 2009 at 3:03 PM, jwg20  wrote:
>>
>> I have a data set that I'm trying to melt and cast in a specific way
>> using
>> the reshape package. (I'll use the ff_d dataset from reshape so I don't
>> have
>> to post a toy data set here. )
>>
>> Lets say I'm looking for the interaction of treatment with each type of
>> "variable" in ff_d. Using the command below gets me this. Subject will
>> get a
>> column and each treatment type by each variable will also get a column
>> with
>> values for each.
>>
>> cast(ff_d, subject~treatment+variable)
>>   subject 1_potato 1_buttery 1_grassy 1_rancid 1_painty 2_potato
>> 2_buttery
>>   3_painty
>> 1        3       18        18       18       18       18       18      
>>  18
>>    18
>> ...
>>
>> Now, if I want to look at just the  the values for each variable by
>> subject
>> I can run the following command.
>> cast(ff_d, subject~variable)
>>   subject potato buttery grassy rancid painty
>> 1        3     54      54     54     54     54
>> ...
>>
>> What I'm wondering now, is run one cast() call and get both of these in
>> one
>> data.frame? Essentially, the values for each separate "condition" and
>> interactions between them? cast() doesn't let me repeat variable names as
>> that's what I first tried.  Right now, i'm just running two separate
>> cast()
>> calls and cbinding/merging them together. Is there a better way?
> 
> Have a look at the margins argument.
> 
> Hadley
> 
> 
> -- 
> http://had.co.nz/
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/reshape-package---use-one-cast%28%29-instead-of-many-tp23394916p23395785.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] re shape package - use one cast() instead of many

2009-05-05 Thread hadley wickham
On Tue, May 5, 2009 at 3:03 PM, jwg20  wrote:
>
> I have a data set that I'm trying to melt and cast in a specific way using
> the reshape package. (I'll use the ff_d dataset from reshape so I don't have
> to post a toy data set here. )
>
> Lets say I'm looking for the interaction of treatment with each type of
> "variable" in ff_d. Using the command below gets me this. Subject will get a
> column and each treatment type by each variable will also get a column with
> values for each.
>
> cast(ff_d, subject~treatment+variable)
>   subject 1_potato 1_buttery 1_grassy 1_rancid 1_painty 2_potato 2_buttery
>   3_painty
> 1        3       18        18       18       18       18       18        18
>    18
> ...
>
> Now, if I want to look at just the  the values for each variable by subject
> I can run the following command.
> cast(ff_d, subject~variable)
>   subject potato buttery grassy rancid painty
> 1        3     54      54     54     54     54
> ...
>
> What I'm wondering now, is run one cast() call and get both of these in one
> data.frame? Essentially, the values for each separate "condition" and
> interactions between them? cast() doesn't let me repeat variable names as
> that's what I first tried.  Right now, i'm just running two separate cast()
> calls and cbinding/merging them together. Is there a better way?

Have a look at the margins argument.

Hadley


-- 
http://had.co.nz/

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] documenting quirky behavior of as.POSIXct, as.POSIX.lt regarding AM/PM, possibly other cases

2009-05-05 Thread jim holtman
Seems to work fine for me on R 2.9.0:

> as.POSIXct("2009/03/26 01:00:00 AM" , format="%Y/%m/%d %I:%M:%S %p" )
[1] "2009-03-26 01:00:00 GMT"
> as.POSIXct("2009/03/26 01:00:00 PM" , format="%Y/%m/%d %I:%M:%S %p" )
[1] "2009-03-26 13:00:00 GMT"
>


On Tue, May 5, 2009 at 2:55 PM, Galkowski, Jan  wrote:

>
> I wanted to put this on the R Wiki, but found the suitable pages were
> read-only.  I wanted to get it out in public to save people work.
>
> I was converting dates like "2009/03/26 01:00:00 AM" using as.POSIXct.  I
> found that using a format of "%Y/%m/%d %I:%M:%S %p" did not work correctly
> to distinguish AM from PM.  Both were converted into the same timestamp.
>  Indeed, what I found worked was affixing a space after the string timestamp
> to produce "2009/03/26 01:00:00 AM " or "2009/03/26 01:00:00 PM ".  That
> works.
>
> Didn't see this documented in the associated pages anywhere.
>
> I wonder if the help system might benefit from user comments like for
> instance PHP has?
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

What is the problem that you are trying to solve?

[[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] re shape package - use one cast() instead of many

2009-05-05 Thread jwg20

I have a data set that I'm trying to melt and cast in a specific way using
the reshape package. (I'll use the ff_d dataset from reshape so I don't have
to post a toy data set here. )

Lets say I'm looking for the interaction of treatment with each type of
"variable" in ff_d. Using the command below gets me this. Subject will get a
column and each treatment type by each variable will also get a column with
values for each.

cast(ff_d, subject~treatment+variable)
   subject 1_potato 1_buttery 1_grassy 1_rancid 1_painty 2_potato 2_buttery
  3_painty
13   1818   18   18   18   1818 
   
   18
...

Now, if I want to look at just the  the values for each variable by subject
I can run the following command.
cast(ff_d, subject~variable)
   subject potato buttery grassy rancid painty
13 54  54 54 54 54
...

What I'm wondering now, is run one cast() call and get both of these in one
data.frame? Essentially, the values for each separate "condition" and
interactions between them? cast() doesn't let me repeat variable names as
that's what I first tried.  Right now, i'm just running two separate cast()
calls and cbinding/merging them together. Is there a better way?  
-- 
View this message in context: 
http://www.nabble.com/reshape-package---use-one-cast%28%29-instead-of-many-tp23394916p23394916.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] R 2.9 and XML

2009-05-05 Thread Ian Kennedy

> After I installed R 2.9.0 my XML package cannot load; I get an error
"This
> application has failed to start because iconv.dll was not found.
> Re-installing the application may fix this problem". I already
re-installed
> both but the problem persists. Does anyone know what is going on? I would
> appreciate any help. Thanks a lot

I had this problem (after installing XML through install.packages() ) and
worked around it by making a copy of Riconv.dll (in the R-2.9.0/biin
directory) and naming it iconv.dll. The XML package seems to be working
now, but I'd like to know if there's a better way.

Ian Kennedy

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


Re: [R] Error building package: LaTeX error when creating PDF version

2009-05-05 Thread Patrick Perry

I recently came across the same problem reported here:

http://tolstoy.newcastle.edu.au/R/e6/help/09/04/12383.html

The fix was to edit "$R_HOME/etc/Renviron" and change

R_PDFLATEXCMD=${R_PDFLATEXCMD-${PDFLATEX-'/usr/texbin/pdflatex'}}

to

R_PDFLATEXCMD=${R_PDFLATEXCMD-${PDFLATEX-'pdflatex'}}

with similar modifications to the other TeX-related commands.


Patrick

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] documenting quirky behavior of as.POSIXct, as.POSIX.lt regarding AM/PM, possibly other cases

2009-05-05 Thread Galkowski, Jan
 
I wanted to put this on the R Wiki, but found the suitable pages were 
read-only.  I wanted to get it out in public to save people work.

I was converting dates like "2009/03/26 01:00:00 AM" using as.POSIXct.  I found 
that using a format of "%Y/%m/%d %I:%M:%S %p" did not work correctly to 
distinguish AM from PM.  Both were converted into the same timestamp.  Indeed, 
what I found worked was affixing a space after the string timestamp to produce 
"2009/03/26 01:00:00 AM " or "2009/03/26 01:00:00 PM ".  That works.

Didn't see this documented in the associated pages anywhere. 

I wonder if the help system might benefit from user comments like for instance 
PHP has?

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

2009-05-05 Thread hadley wickham
> If you do write your own, the hardest part will be picking the nice tick
> marks.  They should be approximately evenly spaced, but at nice round values
> of the original variable:  that's hard to do in general.  R has the pretty()
> function for the linear scale, and doesn't do too badly on log axes, but
> you'll need to work out your own rules for the sqrt or other scales.

This seems like a nice (if smallish) research problem...

Hadley


-- 
http://had.co.nz/

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

2009-05-05 Thread baptiste auguie


On 5 May 2009, at 19:28, Duncan Murdoch wrote:


On 5/5/2009 1:05 PM, Markus Loecher wrote:

Dear R users,
while I enjoy the built-in log argument to the plot() function, I  
wished it
would be as easy to create more general custom transformed axes  
such as

sqrt(), logit, etc...

for example, instead of
plot(x=exp(rnorm(10)), y=(1:10)^4, log = "xy"), sth. along the  
lines of

plot(x=exp(rnorm(10)), y=(1:10)^4, trans = list(x = log, y = sqrt))
to encode the desired transfomation.

This involves just transforming the xy values and creating nice  
tick marks

at the appropriate positions.
Before trying to write my own function, I wanted to see if that
functionality already exists in another package ?





Have you tried ggplot2? I think Hadley has given a lot of thinking on  
this sort of issues.


http://had.co.nz/ggplot2/
http://had.co.nz/ggplot2/coord_trans.html

baptiste




I don't know of such a thing, but it may well exist.

If you do write your own, the hardest part will be picking the nice  
tick

marks.  They should be approximately evenly spaced, but at nice round
values of the original variable:  that's hard to do in general.  R has
the pretty() function for the linear scale, and doesn't do too badly  
on

log axes, but you'll need to work out your own rules for the sqrt or
other scales.

Duncan Murdoch

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


_

Baptiste Auguié

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag

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


Re: [R] Heatmap without levelplot

2009-05-05 Thread Uwe Ligges



Antje wrote:

Hi Uwe,

I tried to explain my problem with the given example.
I don't see any documentation which tells me that the length of 
"col.regions" should be one less than "at". (At least I assume now that 
it should be this way...)
If it's equal or longer some colors (in the middle of the color-vector) 
are simply not used.
Just try the example below with rainbow(5) and rainbow(6) and compare 
the results... both plot will use 5 colors!
Sorry, but this behaviour is not really self-explaining to me... maybe 
I'm to blind to find the documentation which says that only one color 
less will ensure the usage of all colors.


Well, of you have 5 at locations (i.e. breaks), then you have 4 
intervals in between and that's the amount of colors that is sensible.



(It is so important for me because I need to display a heatmap with 
colors let's say

* all lower data outliers "green",
* all higher data outliers "blue" and
* everything else within the color range "yellow" to "red".
I've seen that some values do not get blue or green though they are 
outliers...

I've attached one graph, I've generated - maybe it helps to understand)

Any wrong assumption?


Maybe:

Say you want everything below -1 be considered as a lower outlier and 
all above 1 is a higher outlier, then you can say:



levelplot(matrix(c(1,2,0,-2), nrow=2),
at = c(-Inf, seq(-1, 1, length=10), Inf),
col.regions = c(rgb(0,1,0),
 hcl(seq(20, 80, length=10), c=400),
 rgb(0,0,1)))

Then below -1 is green (rgb(0,1,0)), above 1 is blue (rgb(0,0,1)) and in 
between we have 10 regions from -1 to 1 each with a color between some 
kind of yellow and red in hcl() space.



Uwe Ligges





Ciao,
Antje


Uwe Ligges schrieb:



Antje wrote:

Hi there,

as I'm not sure to understand the coloring levelplot uses, I'm 
looking for another easy way to create a heatmap like this:


library(lattice)
mat <- matrix(seq(1,5, length.out = 12), nrow = 3)
mat[1,2] <- 3.5

my.at <- seq(0.5,5.5, length.out = 6)
my.col.regions <- rainbow(5)

graph <- levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = 
my.col.regions)

print(graph)

Can anybody help me with some hints or little examples?



Dear Antje,

since you are asking the same question again now, maybe you can 
explain what you are going to get? In fact, I do not undertsand where 
your problem is. R places the colors according to the values in your 
matrix very well including the legend and I thought up to today that 
the plot is self explaining.


Best wishes,
Uwe Ligges





Antje

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

2009-05-05 Thread Duncan Murdoch

On 5/5/2009 1:05 PM, Markus Loecher wrote:

Dear R users,
while I enjoy the built-in log argument to the plot() function, I wished it
would be as easy to create more general custom transformed axes such as
sqrt(), logit, etc...

for example, instead of
 plot(x=exp(rnorm(10)), y=(1:10)^4, log = "xy"), sth. along the lines of
 plot(x=exp(rnorm(10)), y=(1:10)^4, trans = list(x = log, y = sqrt))
to encode the desired transfomation.

This involves just transforming the xy values and creating nice tick marks
at the appropriate positions.
Before trying to write my own function, I wanted to see if that
functionality already exists in another package ?


I don't know of such a thing, but it may well exist.

If you do write your own, the hardest part will be picking the nice tick 
marks.  They should be approximately evenly spaced, but at nice round 
values of the original variable:  that's hard to do in general.  R has 
the pretty() function for the linear scale, and doesn't do too badly on 
log axes, but you'll need to work out your own rules for the sqrt or 
other scales.


Duncan Murdoch

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Sampling a matrix with different probability distributions

2009-05-05 Thread Silvia Lomascolo



Greg Snow-2 wrote:
> 
> The sample function has a prob argument that can be used to sample with
> unequal probabilities.  It sounds like you can just pass in the species
> abundance vector to prob and it will do what you want.
> 
> It might be that my question is even more basic than it sounds:  I have
> tried what you say, but I may just be writing it wrong as I get an error
> message.  I wrote:
> 
> reduced.M <- matrix(table( factor( sample(rep(M.index,M),800), M.index
> prob=pla)),nr=5)
> 
> but I get and error message saying that the prob argument is "unused"".  I
> have also tried prob=unif, or directly prob=c(10, 9, 6, 5, 3), but I get
> the same error message. Any hints as to how I am passing the prob argument
> wrong? This is probably too basic...
> 
> Thanks, Silvia.
> -- 
> 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-boun...@r-
>> project.org] On Behalf Of Silvia Lomascolo
>> Sent: Tuesday, May 05, 2009 9:52 AM
>> To: r-help@r-project.org
>> Subject: [R] Sampling a matrix with different probability distributions
>> 
>> 
>> I need to sample a matrix according to different distributions, instead
>> of
>> just randomly.  Here is some code that will hopefully clarify what I
>> need:
>> 
>> I have a matrix M of 1287 interactions between species in rows and
>> species
>> in columns, according to their abundance:
>> 
>> pla<- c(10, 9, 6, 5, 3) #abundance of pla species
>> pol<- c(14, 10, 9, 4, 2) #abundance of pol species
>> M<-pla%*%t(pol) #matrix of 1287 interactions according to pla and pol
>> abundance
>> M
>>  [,1] [,2] [,3] [,4] [,5]
>> [1,]  140  100   90   40   20
>> [2,]  126   90   81   36   18
>> [3,]   84   60   54   24   12
>> [4,]   70   50   45   20   10
>> [5,]   42   30   27   126
>> 
>> Thanks to help from people in this forum, I was able to randomly sample
>> 800
>> interactions from matrix M and obtain a subset of the interactions in a
>> smaller matrix called reduced.M:
>> 
>> M.index <- 1:length(M)
>> reduced.M <- matrix(table( factor( sample(rep(M.index,M),800),
>> M.index)),nr=5)
>> reduced.M
>> 
>>  [,1] [,2] [,3] [,4] [,5]
>> [1,]   77   62   56   25   15
>> [2,]   83   53   51   21   11
>> [3,]   57   34   28   18   10
>> [4,]   51   31   21   144
>> [5,]   27   21   1965
>> 
>> Now I need to sample again, not randomly, but according to different
>> distributions.  For example, I need to sample according to the
>> abundance of
>> species pla, (pla vector written above).  The result should be that I
>> sample
>> my first row more intensely than my second row, and the last row should
>> be
>> the least intensely sampled, in proportion to my row species abundance.
>> In
>> the same token, I want to sample with a uniform distribution as well.
>> How
>> do I do this?
>> 
>> Thanks, as usual! Silvia.
>> --
>> View this message in context: http://www.nabble.com/Sampling-a-matrix-
>> with-different-probability-distributions-tp23390324p23390324.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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Sampling-a-matrix-with-different-probability-distributions-tp23390324p23392352.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] big databases

2009-05-05 Thread Pseudo Phobic
Dear all,

I have a .dta database which is about 400 MB. I cannot open it though I have
no problem to import smaller ones (80 MB or even 174 MB).

I tried to modify some options with --max-mem-size=2047M --max-vsize=2047M.
But it does not seem to be enough.

I do not know the exact meaning of these options : vsize seems to be made
for vectors.

I have got Monte Carlo simulations running in another R window. Can MCMC
simulations take enough memory so as to prevent me from opening this
database ?

Thank you very much for any help.

Best Regards

[[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] quick square root axes

2009-05-05 Thread Markus Loecher
Dear R users,
while I enjoy the built-in log argument to the plot() function, I wished it
would be as easy to create more general custom transformed axes such as
sqrt(), logit, etc...

for example, instead of
 plot(x=exp(rnorm(10)), y=(1:10)^4, log = "xy"), sth. along the lines of
 plot(x=exp(rnorm(10)), y=(1:10)^4, trans = list(x = log, y = sqrt))
to encode the desired transfomation.

This involves just transforming the xy values and creating nice tick marks
at the appropriate positions.
Before trying to write my own function, I wanted to see if that
functionality already exists in another package ?

Thanks!

Markus
.

[[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] Sampling a matrix with different probability distributions

2009-05-05 Thread Greg Snow
The sample function has a prob argument that can be used to sample with unequal 
probabilities.  It sounds like you can just pass in the species abundance 
vector to prob and it will do what you want.

-- 
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-boun...@r-
> project.org] On Behalf Of Silvia Lomascolo
> Sent: Tuesday, May 05, 2009 9:52 AM
> To: r-help@r-project.org
> Subject: [R] Sampling a matrix with different probability distributions
> 
> 
> I need to sample a matrix according to different distributions, instead
> of
> just randomly.  Here is some code that will hopefully clarify what I
> need:
> 
> I have a matrix M of 1287 interactions between species in rows and
> species
> in columns, according to their abundance:
> 
> pla<- c(10, 9, 6, 5, 3) #abundance of pla species
> pol<- c(14, 10, 9, 4, 2) #abundance of pol species
> M<-pla%*%t(pol) #matrix of 1287 interactions according to pla and pol
> abundance
> M
>  [,1] [,2] [,3] [,4] [,5]
> [1,]  140  100   90   40   20
> [2,]  126   90   81   36   18
> [3,]   84   60   54   24   12
> [4,]   70   50   45   20   10
> [5,]   42   30   27   126
> 
> Thanks to help from people in this forum, I was able to randomly sample
> 800
> interactions from matrix M and obtain a subset of the interactions in a
> smaller matrix called reduced.M:
> 
> M.index <- 1:length(M)
> reduced.M <- matrix(table( factor( sample(rep(M.index,M),800),
> M.index)),nr=5)
> reduced.M
> 
>  [,1] [,2] [,3] [,4] [,5]
> [1,]   77   62   56   25   15
> [2,]   83   53   51   21   11
> [3,]   57   34   28   18   10
> [4,]   51   31   21   144
> [5,]   27   21   1965
> 
> Now I need to sample again, not randomly, but according to different
> distributions.  For example, I need to sample according to the
> abundance of
> species pla, (pla vector written above).  The result should be that I
> sample
> my first row more intensely than my second row, and the last row should
> be
> the least intensely sampled, in proportion to my row species abundance.
> In
> the same token, I want to sample with a uniform distribution as well.
> How
> do I do this?
> 
> Thanks, as usual! Silvia.
> --
> View this message in context: http://www.nabble.com/Sampling-a-matrix-
> with-different-probability-distributions-tp23390324p23390324.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] Hierarchical Diagram of Networks in sna or otherwise?

2009-05-05 Thread jebyrnes

No worries.  I've actually switched to using Rgraphviz from bioconductor, and
the results are pretty great (after the initial head-pounding to get it
setup).


Gábor Csárdi-2 wrote:
> 
> On Mon, May 4, 2009 at 8:31 PM, jebyrnes  wrote:
>>
>> Nearly.  The algorithm turns up slightly different graphs each time (and
>> set.seed doesn't seem to make it consistent)
> 
> Hmmm, that should not happen, I'll check it out.
> 
>> and periodically chokes.
> 
> Can you send me the graph for which this happens?
> 
>> But
>> better than what I had.  Hrm.  I don't know much about the algorithm
>> graphviz uses for dot.  Do you have a reference on hand?
> 
> No, I don't. Have you checked the graphviz homepage?
> 
>> If it's simple,
>> I'd be willing to take a whack at it.
> 
> I doubt that it is simple, but I think it would be very useful to have
> a free implementation. (I would have already ported the graphviz
> layout algorithms to igraph, but their licenses are not compatible.)
> 
> Best,
> Gabor
> 
>>
>> Gábor Csárdi-2 wrote:
>>>
>>> Jarrett,
>>>
>>> the 'igraph' package has a layout called layout.reingold.tilford that
>>> is designed for trees, there is a slight chance that it is good enough
>>> for you.
>>>
>>> Best,
>>> Gabor
>>>
>>> On Wed, Apr 29, 2009 at 10:11 PM, jebyrnes  wrote:

 I've been using sna to work with some networks, and am trying to
 visualize
 them easily.  My networks are hierarchical (food webs).  All of the
 layout
 engines I've tried with gplot don't seem to plot hierarchical networks,
 as
 one would using dot from graphviz.  While I could do all of this by
 outputting to dotfiles and running it through graphviz, the graphics I
 get
 from R are much cleaner, and more easily integrated into my analyses.

 Is there any good way to diagram a hierarchical network in R, either
 with
 the sna library or otherwise?  It strikes me that at least the
 Netindices
 package can calculate trophic levels.  Could this be used for node
 placement?


 -Jarrett
 --
 View this message in context:
 http://www.nabble.com/Hierarchical-Diagram-of-Networks-in-sna-or-otherwise--tp23301819p23301819.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.

>>>
>>>
>>>
>>> --
>>> Gabor Csardi      UNIL DGM
>>>
>>> __
>>> R-help@r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide
>>> http://www.R-project.org/posting-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Hierarchical-Diagram-of-Networks-in-sna-or-otherwise--tp23301819p23374024.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.
>>
> 
> 
> 
> -- 
> Gabor Csardi  UNIL DGM
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Hierarchical-Diagram-of-Networks-in-sna-or-otherwise--tp23301819p23391709.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] setting trellis auto.key color values

2009-05-05 Thread Steve_Friedman
Sundar,

Thanks for the assistance.

Much appreciated.

Steve



Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

steve_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147


   
 Sundar Dorai-Raj  
To 
   steve_fried...@nps.gov  
 05/05/2009 09:08   cc 
 AM MSTr-help@r-project.org
   Subject 
   Re: [R] setting trellis auto.key
   color values
   
   
   
   
   
   




Set the colors in graph.sets and not auto.key.

graph.sets <- list(axis.text = list(cex = 0.65),
  par.ylab.text = list(cex = 1.25),
  par.xlab.text = list(cex = 1.25),
  superpose.polygon = list(col = 3:5))

Then remove the "col = 3:5" from auto.key and barchart.

Also, you can simplify your code by removing "gator_IR$" and including
"data = gator_IR". I.e.

 barchart(MEAN ~ Hydro | as.factor(IR_ID),
 data = gator_IR, layout = c(4, 1),
 groups = Rain, ylim = c(0, 1), ...)

HTH,

--sundar

On Tue, May 5, 2009 at 8:32 AM,   wrote:
>
>
> I'm working with Lattice graphics and I would like very much to color
code
> the auto.key fill color with the same corresponding colors that I use in
> the panels.  I've looked on the web for clues, and on the CRAN-R help
sites
> searching on "trellis auto.key color" and variations, unfortunately the
> responses there are not very specific.
>
>  Would someone please explain   I have the Book, if you can point me to
the
> pages that explain this I'd appreciate that too
>
>
>
>> graph.sets <- list(axis.text = list(cex = 0.65),
>              par.ylab.text = list(cex = 1.25),
>              par.xlab.text = list(cex = 1.25))
>
>
>>   barchart(gator_IR$MEAN ~ gator_IR$Hydro |
> as.factor(gator_IR$IR_ID),layout=c(4,1),col = c(3:5),
>                 groups=gator_IR$Rain, ylim=c(0,1), par.settings =
> graph.sets,
>                 main = "Alligator Nesting Performance", ylab= "Mean HSI",
>                 auto.key = list("top", columns=3, col=c(3:5))
>
>
> this script creates the graph nicely, with the qualification that the
color
> for the key titles are the correct, but the filling colors are default
> pastels.  Where do I change them ?
>
>
> Windows XP  with R 2.8.1
>
> Thank you.
>
> Steve
>
> Steve Friedman Ph. D.
> Spatial Statistical Analyst
> Everglades and Dry Tortugas National Park
> 950 N Krome Ave (3rd Floor)
> Homestead, Florida 33034
>
> steve_fried...@nps.gov
> Office (305) 224 - 4282
> Fax     (305) 224 - 4147
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Plotting pairs of bars

2009-05-05 Thread Greg Snow
Look at the beside argument to the barplot function.

-- 
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-boun...@r-
> project.org] On Behalf Of Steve Murray
> Sent: Tuesday, May 05, 2009 9:52 AM
> To: r-help@r-project.org
> Subject: [R] Plotting pairs of bars
> 
> 
> Dear all,
> 
> I have a matrix called combine86 which looks as follows:
> 
> > combine86
>  Sim Mean   Obs Mean  Sim Sum Obs Sum
> AMAZON  1172.0424  1394.44604  553204  659573
> NILE 262.4440   164.23921   67973   41881
> CONGO682.8007   722.63971  205523  214624
> MISSISSIPPI  363.0758   142.59883  124535   49054
> AMUR 143.585789.30434   36040   22594
> PARANA   702.3793   388.03030  162952   89635
> YENISEI  208.1396   174.52722   83464   70509
> OB   197.0399   162.82697   79013   63991
> LENA 118.110077.49638   48307   32161
> NIGER374.8258   212.25714   66719   37145
> ZAMBEZI  500.   485.87610   57000   54904
> YANGTZE  358.4172   256.80246   58422   41602
> 
> 
> For each of the rivers (which are the row names of this matrix), I wish
> to plot a bar for Simulated Mean and another for the Observed Mean. So
> far I've only been able to get R to stack the bars (using 'barplot) on
> top of one another, which isn't really what I want! I was hoping more
> for a pairing of bars (one 'Sim' and one 'Mean') followed by a gap,
> then the next pair of bars for the next river, a gap, and so on. Is
> this possible to do in R? If so, how?!
> 
> Many thanks,
> 
> Steve
> 
> 
> _
> [[elided Hotmail spam]]
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Stepwise logistic regression with significance testing - stepAIC

2009-05-05 Thread Dimitris Rizopoulos

Greg Snow wrote:
There is not a meaningful alternative way since the way you propose is not meaningful.  The Wald tests have some know problems even in the well defined cases.  Both types of tests are designed to test a predefined hypothesis, not a conditional hypothesis on the stepwise procedure.  It is best to use other approaches than stepwise selection (it has been shown to give biased results) such as the lasso.  If you need to use stepwise, then you should bootstrap the entire selection process to get better estimates/standard errors.  


For bootstrapping the stepAIC procedure you may have a look at package 
bootStepAIC.


Best,
Dimitris



Frank Harrell's book and package go into more detail on this and provide some 
tools to help (as well as the other packages that can be used).

Hope this helps,



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

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

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

2009-05-05 Thread willow1980

Strangely, summary.gam(m1) should give you significance results of parametric
terms such as ost, wst, park10, sch50, comm, build and suite. These results
should be located above the summary results for smooth terms.
Please using summary.gam(m1) to have a look if there is the information you
need.
Good luck!


楊 詩韻 wrote:
> 
> 
> dear all,
> 
>  
> 
> i have a little question, but it make me torment long time
> 
>  
> 
> hope you can help me and give some advices , thanks
> 
>  
> 
>  
> 
> i use smoothing spline in package gam
> 
>  
> 
> the model
> 
>  
> 
>> m1=gam(y~ost+wst+park10+sch50+comm+build+suite+y05+y06+y07+y99+y98+s(builarea)+s(age)+s(fl)+s(totfl)+s(cbd)+s(redl))
> 
> 
> and summary(m1) can show the "s"(smoothing) variables' Signif. codes.
> 
>  
> 
> but i also want to know the Parametric coefficients and their Signif.
> codes. like ost, wst...etc.
> 
>  
> 
> is that possible to get the Parametric coefficients'  Signif. codes  (in
> package gam) ?
> 
>  
> 
>  
> 
> thanks~~
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> _
> 
> 
>   [[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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/smoothing-spline-in-package-gam-tp23382805p23390437.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] method for calculating grey level occurrence matrices (GLCM) with R

2009-05-05 Thread Hans-Joachim Klemmt

hello,

does anybody know a method for calculating grey-level co-occurrence 
matrices (GLCM) for RGB-pictures with R?
(unfortunately i haven't found a solution for this problem neither via 
(scholar)google nor via r-project helplist)


thank you very much!

best regards

Hans-Joachim Klemmt

--
--

Dr. Hans-Joachim Klemmt

Forstoberrat
Organisationsprogrammierer IHK


Bayerische Landesanstalt für Wald und Forstwirtschaft

zugewiesen an

Lehrstuhl für Waldwachstumskunde
Technische Universität München
Am Hochanger 13

85354 Freising

Tel.: 08161/ 7147-14
Fax : 08161/ 7147-21

eMail: h-j.kle...@lrz.tum.de

Skype: hajo_klemmt

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


[R] Re : Re : Support Vector Machines

2009-05-05 Thread justin bem
Of course SVM is for supervise learning method (classification or regression). 
You cannot use a boat to fly man !
 
Justin BEM
BP 1917 Yaoundé
Tél (237) 99597295
(237) 22040246 







Envoyé le : Mardi, 5 Mai 2009, 16h07mn 10s
Objet : Re : [R] Support Vector Machines


Thank you.

I will look this later but I think i've saw this function and i'm not sure that 
we can make density estimation with this but only classification.


 :


Objet: Re : [R] Support Vector Machines

Cc: "R Maillist" 
Date: Mardi 5 Mai 2009, 16h43


there is a SVM function in svmpath by Trevor Hastie. Before use it take time to 
read this 

http://www-stat.stanford.edu/~hastie/Papers/svmpath.pdf

If you install then svmpath library ! run the attach source file.


Justin BEM
BP 1917 Yaoundé
Tél (237) 99597295
(237) 22040246 






À : r-help@r-project.org
Envoyé le : Mardi, 5 Mai 2009, 8h49mn 49s
Objet : Re: [R] Support Vector Machines


In the R-help of the svm function of the package e1071 it's explained that
this function also makes estimation of density.

But when i made for example
X<-rnorm(1000)
m<-svm(X)

I just have a binary classification of X like SVM do whereas i want an
estimation of the density which generates our sample X ...

I don't know if it's possible and if someone has already use this function
to do that.

Thanks.


David Winsemius wrote:
> 
> 
> On May 4, 2009, at 8:52 AM, excalibur wrote:
> 
>>
>> This question is still unanswered.
> 
> Unanswered questions are often those which do not comply with the  
> guidelines in the Posting Guide. Many people have gotten tired of  
> either making up examples or of writing  "Read the Posting Guide", so  
> they just ignore them.
> 
> 
>> Someone can explain me how use the svm function to make density  
>> estimation ?
> 
> If you post an executable bit of code that shows how you are doing  
> those operations, then I suspect someone will answer.
> 
> excalibur wrote:
>>
>>>
>>> Hi,
>>> i try to use function svm of package e1071 to estimate a density.
>>>
>>> But if my data are X=(X1,...,Xn) and m<-svm(X) some values of m$SV 
>>> are
>>> less than 0.
>>> I don't see how i can get the estimation of the density with this
>>> function.
>>>
>>> Thanks for your help.
>>>
>>> Rémi
>>>
> 
> 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.
> 
> 

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

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


  
[[alternative HTML version deleted]]

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


Re: [R] Stepwise logistic regression with significance testing - stepAIC

2009-05-05 Thread Greg Snow
There is not a meaningful alternative way since the way you propose is not 
meaningful.  The Wald tests have some know problems even in the well defined 
cases.  Both types of tests are designed to test a predefined hypothesis, not a 
conditional hypothesis on the stepwise procedure.  It is best to use other 
approaches than stepwise selection (it has been shown to give biased results) 
such as the lasso.  If you need to use stepwise, then you should bootstrap the 
entire selection process to get better estimates/standard errors.  

Frank Harrell's book and package go into more detail on this and provide some 
tools to help (as well as the other packages that can be used).

Hope this helps,

-- 
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-boun...@r-
> project.org] On Behalf Of Peter-Heinz Fox
> Sent: Tuesday, May 05, 2009 8:02 AM
> To: r-help@r-project.org
> Subject: [R] Stepwise logistic regression with significance testing -
> stepAIC
> 
> Hello R-Users,
> 
> I have one binary dependent variable and a set of independent variables
> (glm(formula,…,family=”binomial”) ) and I am using the function stepAIC
> (“MASS”) for choosing an optimal model. However I am not sure if
> stepAIC considers significance properties like Likelihood ratio test
> and Wald test (see example below).
> 
> > y <- rbinom(30,1,0.4)
> > x1 <- rnorm(30)
> > x2 <- rnorm(30)
> > x3 <- rnorm(30)
> > xdata <- data.frame(x1,x2,x3)
> >
> > fit1 <- glm(y~ . ,family="binomial",data=xdata)
> > stepAIC(fit1,trace=FALSE)
> 
> Call:  glm(formula = y ~ x3, family = "binomial", data = xdata)
> 
> Coefficients:
> (Intercept)   x3
>     -0.3556   0.8404
> 
> Degrees of Freedom: 29 Total (i.e. Null);  28 Residual
> Null Deviance:  40.38
> Residual Deviance: 37.86    AIC: 41.86
> >
> > fit <- glm( stepAIC(fit1,trace=FALSE)$formula  ,family="binomial")
> > my.summ <- summary(fit)
> > # Wald Test
> > print(my.summ$coeff[,4])
> (Intercept)  x3
>   0.3609638   0.1395215
> >
> > my.anova <- anova(fit,test="Chisq")
> > #LR Test
> > print(my.anova$P[2])
> [1] 0.1121783
> >
> 
> Is there an alternative function or a possible way of checking if the
> added variable and the new model are significant within the regression
> steps?
> 
> Thanks in advance for your help
> 
> Regards
> 
> Peter-Heinz Fox
> 
> 
> 
> 
>   [[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] A question about using “by” in GAM model fitting of interaction between smooth terms and factor

2009-05-05 Thread willow1980

I am a little bit confusing about the following help message on how to fit a
GAM model with interaction between factor and smooth terms from
http://rss.acs.unt.edu/Rdoc/library/mgcv/html/gam.models.html:
“Sometimes models of the form: 
E(y)=b0+f(x)z
need to be estimated (where f is a smooth function, as usual.) The
appropriate formula is:
y~z+s(x,by=z)
- the by argument ensures that the smooth function gets multiplied by
covariate z, but GAM smooths are centred (average value zero), so the z+
term is needed as well (f is being represented by a constant plus a centred
smooth). If we'd wanted: 
E(y)=f(x)z
then the appropriate formula would be: y~z+s(x,by=z)-1.”
When I tried two scripts, I found they gave the same results. That is, the
codes “y~z+s(x,by=z)” and “y~z+s(x,by=z)-1” gave the same results. The
following is my result:
###
“anova(model1,model2,test="Chisq")
Analysis of Deviance Table

Model 1: FLBS ~ SES + s(FAFR, by = SES) + s(byear, by = SES) + s(FAFR,
byear, by = SES)
Model 2: FLBS ~ SES + s(FAFR, by = SES) + s(byear, by = SES) + s(FAFR,
byear, by = SES) - 1
   Resid. Df Resid. Dev Df  Deviance P(>|Chi|)
1 1.2076e+03 1458.4   
2 1.2076e+03 1458.4 1.9099e-11 5.030e-10 2.074e-10”
###
Is this in conflict with above statement that “If we'd wanted: E(y)=f(x)z
then the appropriate formula would be: y~z+s(x,by=z)-1.”? Also, if you are
familiar with GAM modelling, please have a look at my modelling process.
That is, I want to study how one factor together with two smooth terms will
influence the response. In model2, I also fitted the interaction between two
smooth terms, together with the interaction of this interaction with factor.
Is model 2 reasonable? I find it is rather complicated to interpret the plot
of model 2.
Thank you very much for helping!

-- 
View this message in context: 
http://www.nabble.com/A-question-about-using-%E2%80%9Cby%E2%80%9D-in-GAM-model-fitting-of-interaction-between-smooth-terms-and-factor-tp23390342p23390342.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] how to modify a function in a R package calling other (invisible?) functions

2009-05-05 Thread Krusty the Klown

Hey hey kids! I'm facing this rough problem: I have to modify a function in a
R package (namely, homals) but I'm not able to do it from the R interface,
since this function recalls other functions which looks like invisible... I
downloaded the source package from CRAN,
http://cran.r-project.org/src/contrib/homals_0.9-10.tar.gz
http://cran.r-project.org/src/contrib/homals_0.9-10.tar.gz 
how can I work it out?
Yours, KtK:-D
-- 
View this message in context: 
http://www.nabble.com/how-to-modify-a-function-in-a-R-package-calling-other-%28invisible-%29-functions-tp23390639p23390639.html
Sent from the R help mailing list archive at Nabble.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] Heatmap without levelplot

2009-05-05 Thread Greg Snow
The image function in base graphics does the same type of plot, just different 
names and structure of the data (and the documentation says that the number of 
breaks should be 1 more than the number of colors).

Hope this helps,

-- 
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-boun...@r-
> project.org] On Behalf Of Antje
> Sent: Tuesday, May 05, 2009 1:12 AM
> To: r-h...@stat.math.ethz.ch
> Subject: [R] Heatmap without levelplot
> 
> Hi there,
> 
> as I'm not sure to understand the coloring levelplot uses, I'm looking
> for
> another easy way to create a heatmap like this:
> 
> library(lattice)
> mat <- matrix(seq(1,5, length.out = 12), nrow = 3)
> mat[1,2] <- 3.5
> 
> my.at <- seq(0.5,5.5, length.out = 6)
> my.col.regions <- rainbow(5)
> 
> graph <- levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions =
> my.col.regions)
> print(graph)
> 
> Can anybody help me with some hints or little examples?
> 
> Antje
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Create Pie chart from .csv file

2009-05-05 Thread Thomas Roth (geb. Kaliwe)

Sorry for mailing to you personally...

for types

read.csv(file.choose())
freqTable = table(types)
pie(freqTable)


##example for some data
temp = data.frame(types = 1:10)
pie(table(temp))

Thomas Roth

PS: use barplot instead of pie

DonkeyRhubarb schrieb:

Hi all,

I am looking to create a pie chart from a given column in a .csv file. 


My class variables are as follows:

entry_type, uniquekey,  types, title,url, abstract, journal, 
author, month,
year, howpublished

So say I want to export a pie chart that groups together all  entries under
'types' e.g. 3 x statistics 2x education etc. Im looking to have a piechart
represent this graphically that shows which type of entry is in most
frequently. Preferably I'd like to export to a PDF chart and while I can do
this by typing variables directly into the R console, I cannot manage it
from a .csv file.

If you cannot help me with this specific problem, just knowing how to create
a generic pie chart would be a great help.

This is part of my final software project which is due in one week. I would
very much appreciate any help.

Many thanks in advance




__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] setting trellis auto.key color values

2009-05-05 Thread Sundar Dorai-Raj
Set the colors in graph.sets and not auto.key.

graph.sets <- list(axis.text = list(cex = 0.65),
  par.ylab.text = list(cex = 1.25),
  par.xlab.text = list(cex = 1.25),
  superpose.polygon = list(col = 3:5))

Then remove the "col = 3:5" from auto.key and barchart.

Also, you can simplify your code by removing "gator_IR$" and including
"data = gator_IR". I.e.

 barchart(MEAN ~ Hydro | as.factor(IR_ID),
 data = gator_IR, layout = c(4, 1),
 groups = Rain, ylim = c(0, 1), ...)

HTH,

--sundar

On Tue, May 5, 2009 at 8:32 AM,   wrote:
>
>
> I'm working with Lattice graphics and I would like very much to color code
> the auto.key fill color with the same corresponding colors that I use in
> the panels.  I've looked on the web for clues, and on the CRAN-R help sites
> searching on "trellis auto.key color" and variations, unfortunately the
> responses there are not very specific.
>
>  Would someone please explain   I have the Book, if you can point me to the
> pages that explain this I'd appreciate that too
>
>
>
>> graph.sets <- list(axis.text = list(cex = 0.65),
>              par.ylab.text = list(cex = 1.25),
>              par.xlab.text = list(cex = 1.25))
>
>
>>   barchart(gator_IR$MEAN ~ gator_IR$Hydro |
> as.factor(gator_IR$IR_ID),layout=c(4,1),col = c(3:5),
>                 groups=gator_IR$Rain, ylim=c(0,1), par.settings =
> graph.sets,
>                 main = "Alligator Nesting Performance", ylab= "Mean HSI",
>                 auto.key = list("top", columns=3, col=c(3:5))
>
>
> this script creates the graph nicely, with the qualification that the color
> for the key titles are the correct, but the filling colors are default
> pastels.  Where do I change them ?
>
>
> Windows XP  with R 2.8.1
>
> Thank you.
>
> Steve
>
> Steve Friedman Ph. D.
> Spatial Statistical Analyst
> Everglades and Dry Tortugas National Park
> 950 N Krome Ave (3rd Floor)
> Homestead, Florida 33034
>
> steve_fried...@nps.gov
> Office (305) 224 - 4282
> Fax     (305) 224 - 4147
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] levelplot question

2009-05-05 Thread Greg Snow
The function that is doing the color assignments is level.colors in the lattice 
package.  Looking at the code confirms that the number of colors should be 1 
less than the length of the at variable (the documentation implies that it 
should be 1 more, looks like a documentation bug to me).

It is possible that at one time the author intended to prepend -Inf and append 
Inf to the at vector so that it did not need to span the entire range of the 
data, but that was not implemented.  I think I would prefer that fix to 
changing the documentation.

The level.colors function uses the cut function to decide on which color to 
use, by default cut will put a value that matches a cutpoint in the group to 
the left, so to answer you original question 3.5 goes into the (2.5,3.5] range 
rather than the (3.5,4.5] group.  level.colors does not allow for changing this 
(hard coded), so if you want the other behaiviour, you either need to rewrite 
level.colors, or add a very small number to your data to shift 3.5 and the like 
into the right bin.

Hope this helps,

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


> -Original Message-
> From: Antje [mailto:niederlein-rs...@yahoo.de]
> Sent: Tuesday, May 05, 2009 1:00 AM
> To: Greg Snow; r-h...@stat.math.ethz.ch
> Subject: Re: [R] levelplot question
> 
> Hi Greg and all the others,
> 
> thanks for your answer. The color-vector has the same length like the
> at-vector
> but the recycling cannot be the reason, because only values slightly
> above my
> "threshold" doe not appear blue.
> I cannot find a good explanation of which colors are assigned to which
> value
> ranges.
> 
> I've made little example:
> 
> #
> mat <- matrix(seq(1,5, length.out = 12), nrow = 3)
> mat[1,2] <- 3.5
> 
> my.at <- seq(0.5,5.5)
> my.col.regions <- rainbow(6)
> 
> graph <- levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions =
> my.col.regions)
> print(graph)
> 
> windows()
> plot(1:10)
> legend("topleft", legend = as.character(my.col.regions), col =
> my.col.regions,
> pch = 18)
> #
> 
> As you can see the green (position 3 in my.col.regions) disappears
> completely
> in the levelplot (look at the color range at the right side!).
> I guess it might also happen in my case...
> 
> I've tested several cases and it looks like the length of the color-
> vector
> should be one less than the at vector (which would make sense).
> 
> Then, the rule might apply:
> 
> [ at[1],at[2] ] = color[1]
> ( at[2],at[3] ] = color[2]
> ...
> ( at[n-1],at[n] ] = color[n-1]
> 
> 
> Please correct me if I'm wrong!!!
> 
> Antje

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Sampling a matrix with different probability distributions

2009-05-05 Thread Silvia Lomascolo

I need to sample a matrix according to different distributions, instead of
just randomly.  Here is some code that will hopefully clarify what I need:

I have a matrix M of 1287 interactions between species in rows and species
in columns, according to their abundance:

pla<- c(10, 9, 6, 5, 3) #abundance of pla species
pol<- c(14, 10, 9, 4, 2) #abundance of pol species
M<-pla%*%t(pol) #matrix of 1287 interactions according to pla and pol
abundance
M
 [,1] [,2] [,3] [,4] [,5]
[1,]  140  100   90   40   20
[2,]  126   90   81   36   18
[3,]   84   60   54   24   12
[4,]   70   50   45   20   10
[5,]   42   30   27   126

Thanks to help from people in this forum, I was able to randomly sample 800
interactions from matrix M and obtain a subset of the interactions in a
smaller matrix called reduced.M:

M.index <- 1:length(M)
reduced.M <- matrix(table( factor( sample(rep(M.index,M),800),
M.index)),nr=5)
reduced.M

 [,1] [,2] [,3] [,4] [,5]
[1,]   77   62   56   25   15
[2,]   83   53   51   21   11
[3,]   57   34   28   18   10
[4,]   51   31   21   144
[5,]   27   21   1965

Now I need to sample again, not randomly, but according to different
distributions.  For example, I need to sample according to the abundance of
species pla, (pla vector written above).  The result should be that I sample
my first row more intensely than my second row, and the last row should be
the least intensely sampled, in proportion to my row species abundance. In
the same token, I want to sample with a uniform distribution as well.  How
do I do this? 

Thanks, as usual! Silvia.
-- 
View this message in context: 
http://www.nabble.com/Sampling-a-matrix-with-different-probability-distributions-tp23390324p23390324.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] Plotting pairs of bars

2009-05-05 Thread Steve Murray

Dear all,

I have a matrix called combine86 which looks as follows:

> combine86
 Sim Mean   Obs Mean  Sim Sum Obs Sum
AMAZON  1172.0424  1394.44604  553204  659573
NILE 262.4440   164.23921   67973   41881
CONGO682.8007   722.63971  205523  214624
MISSISSIPPI  363.0758   142.59883  124535   49054
AMUR 143.585789.30434   36040   22594
PARANA   702.3793   388.03030  162952   89635
YENISEI  208.1396   174.52722   83464   70509
OB   197.0399   162.82697   79013   63991
LENA 118.110077.49638   48307   32161
NIGER374.8258   212.25714   66719   37145
ZAMBEZI  500.   485.87610   57000   54904
YANGTZE  358.4172   256.80246   58422   41602


For each of the rivers (which are the row names of this matrix), I wish to plot 
a bar for Simulated Mean and another for the Observed Mean. So far I've only 
been able to get R to stack the bars (using 'barplot) on top of one another, 
which isn't really what I want! I was hoping more for a pairing of bars (one 
'Sim' and one 'Mean') followed by a gap, then the next pair of bars for the 
next river, a gap, and so on. Is this possible to do in R? If so, how?!

Many thanks,

Steve


_
[[elided Hotmail spam]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] setting trellis auto.key color values

2009-05-05 Thread Steve_Friedman


I'm working with Lattice graphics and I would like very much to color code
the auto.key fill color with the same corresponding colors that I use in
the panels.  I've looked on the web for clues, and on the CRAN-R help sites
searching on "trellis auto.key color" and variations, unfortunately the
responses there are not very specific.

 Would someone please explain   I have the Book, if you can point me to the
pages that explain this I'd appreciate that too



> graph.sets <- list(axis.text = list(cex = 0.65),
  par.ylab.text = list(cex = 1.25),
  par.xlab.text = list(cex = 1.25))


>   barchart(gator_IR$MEAN ~ gator_IR$Hydro |
as.factor(gator_IR$IR_ID),layout=c(4,1),col = c(3:5),
 groups=gator_IR$Rain, ylim=c(0,1), par.settings =
graph.sets,
 main = "Alligator Nesting Performance", ylab= "Mean HSI",
 auto.key = list("top", columns=3, col=c(3:5))


this script creates the graph nicely, with the qualification that the color
for the key titles are the correct, but the filling colors are default
pastels.  Where do I change them ?


Windows XP  with R 2.8.1

Thank you.

Steve

Steve Friedman Ph. D.
Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

steve_fried...@nps.gov
Office (305) 224 - 4282
Fax (305) 224 - 4147

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Bristol mirror GPG problem ubuntu repository

2009-05-05 Thread Daniel Brewer
Hello,

I am getting a GPG error with the ubuntu repository at the bristol UK
mirror.

When my source.list has this line:

deb http://www.stats.bris.ac.uk/R/bin/linux/ubuntu/ intrepid/

On an "apt-get update" you get this:

W: GPG error: http://www.stats.bris.ac.uk intrepid/ Release: The
following signatures were invalid: BADSIG D67FC6EAE2A11821 Vincent
Goulet 

Whereas if I use another mirror e.g.:

deb http://cran.cnr.berkeley.edu/bin/linux/ubuntu/ intrepid/

I don't get such an error.

It could be a problem this end but I think it is more likely that
something is going wrong with the GPG signing at bristol.

Dan

-- 
**
Daniel Brewer, Ph.D.

Institute of Cancer Research
Molecular Carcinogenesis
Email: daniel.bre...@icr.ac.uk
**

The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company 
Limited by Guarantee, Registered in England under Company No. 534147 with its 
Registered Office at 123 Old Brompton Road, London SW7 3RP.

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

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Cox Proportional Hazard with missing covariate data

2009-05-05 Thread Arthur Allignol

(1) Makes sense. Another approach is to use
the time since study entry and include the age
of the part in the model. A related discussion
here: http://tolstoy.newcastle.edu.au/R/e2/help/07/02/9831.html


(2) It is left-truncation. A part is observed only if it has
survived until study entry. Of course, if you reset the clock
at study entry, there's no delayed entries anymore.


Philipp Rappold wrote:

Hi,

Arthur, thanks a lot for your super-fast reply!

In fact I am using the time when the part has been used for the first time, so 
your example should work in my case.
Moreover, as I have time-variant covariates, the example should look like this 
in my specific case:

start   stopstatus  temphumid
5   6   0   32  43
6   7   1   34  42

Just two more things:
(1) I am quite a newbie to cox-regression, so I wonder what you think about the approach 
that I mentioned above? Don't worry, I won't nail you down to this, just want to make 
sure I am not totally "off track"!
(2) I don't think that you'd call this "left-truncated" observations, because I 
DO know the time when the part was used for the first time, I just don't have covariate 
values for its whole time of life, e.g. just the last two years in the example above. 
Left truncation in my eyes would mean that I did not even observe a specific part, e.g. 
because it has died before the study started.

Again, thanks a lot, I'll be happy to provide valuable help on this list as 
soon as my R-skills are advancing.

All the best
Philipp

Arthur Allignol wrote:

Hi,

In fact, you have left-truncated observations.

What timescale do you use, time 0 is the
study entry, or when the wear-part has been used for the
first time?

If it is the latter, you can specify the "age" of the wear part
at study entry in Surv(). For example, if a wear part has been
used for 5 years before study entry, and "dies" 2 years after,
the data will look like that:
start stop status
57  1

Hope this helps,
Arthur Allignol


Philipp Rappold wrote:

Dear friends,

I have used R for some time now and have a tricky question about the
coxph-function: To sum it up, I am not sure whether I can use coxph in
conjunction with missing covariate data in a model with time-variant
covariates. The point is: I know how "old" every piece that I
oberserve is, but do not have fully historical information about the
corresponding covariates. Maybe you have some advice for me, although
this problem might only be 70% R and 30% statistically-related. Here's
a detailled explanation:

SITUATION & OBJECTIVE:
I want to analyze the effect of environmental effects (i.e.
temperature and humidity) on the lifetime of some wear-parts. The
study should be conducted on a yearly basis, meaning that I have
collected empirical data on every wearpart at the end of every year.

DATA:
I have collected the following data:
- Status of the wear-part: Equals "0" if part is still alive, equals
"1" if part has "died" (my event variable)
- Environmental data: Temperature and humidity have been measured at
each of the wear-parts on a yearly basis (because each wear-part is at
a different location, I have different data for each wear-part)

PROBLEM:
I started collecting data between 2001 and 2007. In 2001, a vast
amount of of wearparts has already been in use. I DO KNOW for every
part how long it has been used (even if it was employed before 2001),
but I DO NOT have any information about environmental conditions like
temperature or humidity before 2001 (I call this semi-left-censored).
Of course, one could argue that I should simply exclude these parts
from my analysis, but I don't want to loose valuable information, also
because the amount of "new parts" that have been employed between 2001
and 2007 is rather small.

Additionally, I cannot make any assumption about the underlying
lifetime distribution. Therefore I have to use a non-parametrical
model for estimation (most likely cox).

QUESTION:

From an econometric perspective, is it possible to use Cox

Proportional Hazard model in this setting? As mentioned before, I have
time-variant covariates for each wearpart, as well as what I call
"semi-left-censored" data that I want to use. If not, what kind of
analysis would you suggest?

Thanks a lot for your great help, I really appreciate it.

All the best
Philipp

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

2009-05-05 Thread Ravi Varadhan
Your integrand is smooth. 

What are the limits of integration: 0 to 1 or 0 to infinity?  Main challenge
is that it is increasingly oscillatory as x and/or t increase.  You can find
the zeros of the cosine function and add up the integrals between successive
zeros.  In what context does this inttegral arise?  It must have been
studied well using asymptotic approximation and such.  

Ravi.


---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: rvarad...@jhmi.edu

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







-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of A Achilleos
Sent: Tuesday, May 05, 2009 10:18 AM
To: r-help@r-project.org
Subject: Re: [R] FOURIER INTEGRALS IN R

Ok thanks..

No, my function is not smooth.

Actually, I am dealing with an integral having the following form, for
example:


\int cos(tx) (1-t^2)^3 \exp(0.5*t^2) dt


I want to estimate this Fourier Cosine integral for a given value of x.

Thanks for the help.


AA


On Tue, May 5, 2009 2:34 am, andrew wrote:
> integrate offers some one-dimensional algorithms, but you need to 
> start with a smooth function to get it to converge properly.  With a 
> cosine integral, there may be certain routines that offer better value 
> for money: the Clenshaw-Curtis integration, or perhaps the FFT.  You 
> would have to recast your problem by doing some sort of substitution.
>
> Perhaps post some latex code to show the exact type of integral you 
> are wanting to calculate.
>
> Regards,
>
> On May 5, 6:32 am, "Achilleas Achilleos"  wrote:
>> Hi,
>>
>> I am wondering whether there exist any function in R (any package) 
>> that calculates Fourier Integrals.
>>
>> Particularly, I am interested for estimation of a Cosine Fourier 
>> integral...
>>
>> I would be much obliged if you could help me on this..
>>
>> Thanks.
>>
>> Andreas
>>
>> --
>>
>> __
>> r-h...@r-project.org mailing
>> listhttps://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting
>> guidehttp://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.
>

--
A Achilleos
ma...@bristol.ac.uk

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Stepwise logistic regression with significance testing - stepAIC

2009-05-05 Thread Peter-Heinz Fox
Hello R-Users,
 
I have one binary dependent variable and a set of independent variables 
(glm(formula,…,family=”binomial”) ) and I am using the function stepAIC 
(“MASS”) for choosing an optimal model. However I am not sure if stepAIC 
considers significance properties like Likelihood ratio test and Wald test (see 
example below).  
 
> y <- rbinom(30,1,0.4)
> x1 <- rnorm(30)
> x2 <- rnorm(30)
> x3 <- rnorm(30)
> xdata <- data.frame(x1,x2,x3)
> 
> fit1 <- glm(y~ . ,family="binomial",data=xdata)
> stepAIC(fit1,trace=FALSE)
 
Call:  glm(formula = y ~ x3, family = "binomial", data = xdata) 
 
Coefficients:
(Intercept)           x3  
    -0.3556       0.8404  
 
Degrees of Freedom: 29 Total (i.e. Null);  28 Residual
Null Deviance:      40.38 
Residual Deviance: 37.86        AIC: 41.86 
> 
> fit <- glm( stepAIC(fit1,trace=FALSE)$formula  ,family="binomial")
> my.summ <- summary(fit)
> # Wald Test 
> print(my.summ$coeff[,4])
(Intercept)          x3 
  0.3609638   0.1395215 
> 
> my.anova <- anova(fit,test="Chisq")
> #LR Test
> print(my.anova$P[2])
[1] 0.1121783
>  
 
Is there an alternative function or a possible way of checking if the added 
variable and the new model are significant within the regression steps? 
 
Thanks in advance for your help
 
Regards
 
Peter-Heinz Fox



  
[[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] Re : Support Vector Machines

2009-05-05 Thread justin bem
there is a SVM function in svmpath by Trevor Hastie. Before use it take time to 
read this 

http://www-stat.stanford.edu/~hastie/Papers/svmpath.pdf

If you install then svmpath library ! run the attach source file.


Justin BEM
BP 1917 Yaoundé
Tél (237) 99597295
(237) 22040246 





De : excalibur 
À : r-help@r-project.org
Envoyé le : Mardi, 5 Mai 2009, 8h49mn 49s
Objet : Re: [R] Support Vector Machines


In the R-help of the svm function of the package e1071 it's explained that
this function also makes estimation of density.

But when i made for example
X<-rnorm(1000)
m<-svm(X)

I just have a binary classification of X like SVM do whereas i want an
estimation of the density which generates our sample X ...

I don't know if it's possible and if someone has already use this function
to do that.

Thanks.


David Winsemius wrote:
> 
> 
> On May 4, 2009, at 8:52 AM, excalibur wrote:
> 
>>
>> This question is still unanswered.
> 
> Unanswered questions are often those which do not comply with the  
> guidelines in the Posting Guide. Many people have gotten tired of  
> either making up examples or of writing  "Read the Posting Guide", so  
> they just ignore them.
> 
> 
>> Someone can explain me how use the svm function to make density  
>> estimation ?
> 
> If you post an executable bit of code that shows how you are doing  
> those operations, then I suspect someone will answer.
> 
> excalibur wrote:
>>
>>>
>>> Hi,
>>> i try to use function svm of package e1071 to estimate a density.
>>>
>>> But if my data are X=(X1,...,Xn) and m<-svm(X) some values of m$SV  
>>> are
>>> less than 0.
>>> I don't see how i can get the estimation of the density with this
>>> function.
>>>
>>> Thanks for your help.
>>>
>>> Rémi
>>>
> 
> 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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Support-Vector-Machines-tp19069442p23382683.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] Stepwise logistic Regression with significance testing - stepAIC

2009-05-05 Thread Peter-Heinz Fox
Hello R-Users,
 
I have one binary dependent variable and a set of independent variables 
(glm(formula,…,family=”binomial”) ) and I am using the function stepAIC 
(“MASS”) for choosing an optimal model. However I am not sure if stepAIC 
considers significance properties like Likelihood ratio test and Wald test (see 
example below).  
 
> y <- rbinom(30,1,0.4)
> x1 <- rnorm(30)
> x2 <- rnorm(30)
> x3 <- rnorm(30)
> xdata <- data.frame(x1,x2,x3)
> 
> fit1 <- glm(y~ . ,family="binomial",data=xdata)
> stepAIC(fit1,trace=FALSE)
 
Call:  glm(formula = y ~ x3, family = "binomial", data = xdata) 
 
Coefficients:
(Intercept)           x3  
    -0.3556       0.8404  
 
Degrees of Freedom: 29 Total (i.e. Null);  28 Residual
Null Deviance:      40.38 
Residual Deviance: 37.86        AIC: 41.86 
> 
> fit <- glm( stepAIC(fit1,trace=FALSE)$formula  ,family="binomial")
> my.summ <- summary(fit)
> # Wald Test 
> print(my.summ$coeff[,4])
(Intercept)          x3 
  0.3609638   0.1395215 
> 
> my.anova <- anova(fit,test="Chisq")
> #LR Test
> print(my.anova$P[2])
[1] 0.1121783
>
 
 
Is there an alternative function or a possible way of checking if the added 
variable and the new model are significant within the regression steps? 
 
Thanks in advance for your help
 
Regards
 
Peter-Heinz Fox


  
[[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] FOURIER INTEGRALS IN R

2009-05-05 Thread A Achilleos

Ok thanks..

No, my function is not smooth.

Actually, I am dealing with an integral having the following form, for
example:


\int cos(tx) (1-t^2)^3 \exp(0.5*t^2) dt


I want to estimate this Fourier Cosine integral for a given value of x.

Thanks for the help.


AA


On Tue, May 5, 2009 2:34 am, andrew wrote:

integrate offers some one-dimensional algorithms, but you need to
start with a smooth function to get it to converge properly.  With a
cosine integral, there may be certain routines that offer better value
for money: the Clenshaw-Curtis integration, or perhaps the FFT.  You
would have to recast your problem by doing some sort of substitution.

Perhaps post some latex code to show the exact type of integral you
are wanting to calculate.

Regards,

On May 5, 6:32 am, "Achilleas Achilleos"  wrote:

Hi,

I am wondering whether there exist any function in R (any package) that
calculates Fourier Integrals.

Particularly, I am interested for estimation of a Cosine Fourier
integral...

I would be much obliged if you could help me on this..

Thanks.

Andreas

--

__
r-h...@r-project.org mailing
listhttps://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting
guidehttp://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.



--
A Achilleos
ma...@bristol.ac.uk

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Stepwise logistic regression with significance testing - stepAIC

2009-05-05 Thread Peter-Heinz Fox
Hello R-Users,
 
I have one binary dependent variable and a set of independent variables 
(glm(formula,…,family=”binomial”) ) and I am using the function stepAIC 
(“MASS”) for choosing an optimal model. However I am not sure if stepAIC 
considers significance properties like Likelihood ratio test and Wald test (see 
example below).  
 
> y <- rbinom(30,1,0.4)
> x1 <- rnorm(30)
> x2 <- rnorm(30)
> x3 <- rnorm(30)
> xdata <- data.frame(x1,x2,x3)
> 
> fit1 <- glm(y~ . ,family="binomial",data=xdata)
> stepAIC(fit1,trace=FALSE)
 
Call:  glm(formula = y ~ x3, family = "binomial", data = xdata) 
 
Coefficients:
(Intercept)           x3  
    -0.3556       0.8404  
 
Degrees of Freedom: 29 Total (i.e. Null);  28 Residual
Null Deviance:      40.38 
Residual Deviance: 37.86        AIC: 41.86 
> 
> fit <- glm( stepAIC(fit1,trace=FALSE)$formula  ,family="binomial")
> my.summ <- summary(fit)
> # Wald Test 
> print(my.summ$coeff[,4])
(Intercept)          x3 
  0.3609638   0.1395215 
> 
> my.anova <- anova(fit,test="Chisq")
> #LR Test
> print(my.anova$P[2])
[1] 0.1121783
>  
 
Is there an alternative function or a possible way of checking if the added 
variable and the new model are significant within the regression steps? 
 
Thanks in advance for your help
 
Regards
 
Peter-Heinz Fox



  
[[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] Create Pie chart from .csv file

2009-05-05 Thread Richard . Cotton
> I am looking to create a pie chart from a given column in a .csv file. 
> 
> My class variables are as follows:
> 
> entry_type,   uniquekey,   types, title,url, abstract, journal, 
> author, month,
> year, howpublished
> 
> So say I want to export a pie chart that groups together all  entries 
under
> 'types' e.g. 3 x statistics 2x education etc. Im looking to have a 
piechart
> represent this graphically that shows which type of entry is in most
> frequently. Preferably I'd like to export to a PDF chart and while I can 
do
> this by typing variables directly into the R console, I cannot manage it
> from a .csv file.
> 
> If you cannot help me with this specific problem, just knowing how to 
create
> a generic pie chart would be a great help.

Split the problem up into different stages.

1. Read in your data form the csv file.
?read.csv

2. Plot something.
?pie if you really must, but a bar chart will almost certainly be better. 
See ?barplot and ?barchart (lattice package).

3. Export the graph to PDF.
?pdf

Regards,
Richie.

Mathematical Sciences Unit
HSL




ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

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


Re: [R] calibration plot

2009-05-05 Thread Liaw, Andy
I believe something like:

scatter.smooth(est.prob, as.numeric(y == "level of interest"))

would be close.  You may want to use a larger span than default.

Andy 

From: abbas tavassoli
> 
> Hi, 
> I have a binary variable and corresponding predicted 
> probability (using 
> logistic regression on some explanatoey variables); 
> I want to check that the model is well-calibrated using a 
> calibration plot.
> how can I have the calibration plot for my data?
> thanks.
> 
> 
> 
>   
>   [[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.
> 
Notice:  This e-mail message, together with any attachme...{{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] calibration plot

2009-05-05 Thread Jorge Ivan Velez
Dear Abbas,
Take a look at the results of

require(Hmisc)
require(Design)
apropos("calibrate")
?calibrate
?plot.calibrate

HTH,

Jorge


On Tue, May 5, 2009 at 9:41 AM, abbas tavassoli wrote:

> Hi,
> I have a binary variable and corresponding predicted probability (using
> logistic regression on some explanatoey variables);
> I want to check that the model is well-calibrated using a calibration plot.
> how can I have the calibration plot for my data?
> thanks.
>
>
>
>
>[[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] Heatmap without levelplot

2009-05-05 Thread Antje

Hi Uwe,

I tried to explain my problem with the given example.
I don't see any documentation which tells me that the length of "col.regions" 
should be one less than "at". (At least I assume now that it should be this way...)
If it's equal or longer some colors (in the middle of the color-vector) are 
simply not used.
Just try the example below with rainbow(5) and rainbow(6) and compare the 
results... both plot will use 5 colors!
Sorry, but this behaviour is not really self-explaining to me... maybe I'm to 
blind to find the documentation which says that only one color less will ensure 
the usage of all colors.


(It is so important for me because I need to display a heatmap with colors 
let's say

* all lower data outliers "green",
* all higher data outliers "blue" and
* everything else within the color range "yellow" to "red".
I've seen that some values do not get blue or green though they are outliers...
I've attached one graph, I've generated - maybe it helps to understand)

Any wrong assumption?

Ciao,
Antje


Uwe Ligges schrieb:



Antje wrote:

Hi there,

as I'm not sure to understand the coloring levelplot uses, I'm looking 
for another easy way to create a heatmap like this:


library(lattice)
mat <- matrix(seq(1,5, length.out = 12), nrow = 3)
mat[1,2] <- 3.5

my.at <- seq(0.5,5.5, length.out = 6)
my.col.regions <- rainbow(5)

graph <- levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = 
my.col.regions)

print(graph)

Can anybody help me with some hints or little examples?



Dear Antje,

since you are asking the same question again now, maybe you can explain 
what you are going to get? In fact, I do not undertsand where your 
problem is. R places the colors according to the values in your matrix 
very well including the legend and I thought up to today that the plot 
is self explaining.


Best wishes,
Uwe Ligges





Antje

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

2009-05-05 Thread Wade Wall
Hi all,

I am trying to run a cluster analysis with a relatively large data set
(545 samples) and obviously am having trouble viewing the results
using standard plot() method.  Is there a way to plot the results of a
large cluster analysis in a window with a scroll bar.  Any
recommendations would be appreciated because I have looked around for
a solution to no avail.

Thanks

Wade Wall

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

2009-05-05 Thread Laura Arsanto



Hello everybody,

I'm trying to do text mining on a serie of texts in italian.

I would like to know if it is possible to find the italian synonyms and/or if 
something like WordNet database for English exists also for italian.

Thank you very much in advance.

Regards,

Laura

_
[[elided Hotmail spam]]

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

2009-05-05 Thread Patrik Pluchino

Good morning to Everyone,

   I'm an Italian PhD student 
that is working on ERPs experiment (cognitive psychology) and I would 
like to know if there are R packages for this kind of analysis.
I'm using BrainAmp to record the data and this program gives me three 
different files (an *.eeg, an *.vmrk and *.vhdr).



Thank You in advance.



Patrik

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

2009-05-05 Thread abbas tavassoli
Hi, 
I have a binary variable and corresponding predicted probability (using 
logistic regression on some explanatoey variables); 
I want to check that the model is well-calibrated using a calibration plot.
how can I have the calibration plot for my data?
thanks.



  
[[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] Support Vector Machines

2009-05-05 Thread excalibur

I see that index is giving me the group for the classification problem.

But my problem is not the same. I had a sample X<-rnorm(1000) for example.

I don't want to make classification (i have only one group in fact) but i
want to estimate the density which generates my sample (like i can do with
others methods like kernel density estimation, wavelets estimations, splines
...). 

So, logically, i hope i will find an approximation of the Gaussian density.

But i don't see how i can obtain this density estimation with the function
svm.

Thanks


David Winsemius wrote:
> 
> 
> On May 5, 2009, at 3:49 AM, excalibur wrote:
> 
>>
>> In the R-help of the svm function of the package e1071 it's  
>> explained that
>> this function also makes estimation of density.
>>
>> But when i made for example
>> X<-rnorm(1000)
>> m<-svm(X)
>>
>> I just have a binary classification of X like SVM do whereas i want an
>> estimation of the density which generates our sample X ...
>>
>> I don't know if it's possible and if someone has already use this  
>> function
>> to do that.
> 
> Use str() to look at the object returned by svm. The example in svm's  
> help page uses the svm object's "index" variable although there are  
> other components that are available for extraction. The "fitted"  
> vector looks to have similar binary properties to "index" and the "SV"  
> vector appears to be a distance measure.
> 
> -- 
> David
> 
>>
>>
>> Thanks.
>>
>>
>> David Winsemius wrote:
>>>
>>>
>>> On May 4, 2009, at 8:52 AM, excalibur wrote:
>>>

 This question is still unanswered.
>>>
>>> Unanswered questions are often those which do not comply with the
>>> guidelines in the Posting Guide. Many people have gotten tired of
>>> either making up examples or of writing  "Read the Posting Guide", so
>>> they just ignore them.
>>>
>>>
 Someone can explain me how use the svm function to make density
 estimation ?
>>>
>>> If you post an executable bit of code that shows how you are doing
>>> those operations, then I suspect someone will answer.
>>>
>>> excalibur wrote:

>
> Hi,
> i try to use function svm of package e1071 to estimate a density.
>
> But if my data are X=(X1,...,Xn) and m<-svm(X) some values of m$SV
> are
> less than 0.
> I don't see how i can get the estimation of the density with this
> function.
>
> Thanks for your help.
>
> Rémi
>
>>>
>>> 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.
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Support-Vector-Machines-tp19069442p23382683.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.
> 
> 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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Support-Vector-Machines-tp19069442p23386300.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] Find cyclically identical binary sequences (corrected)

2009-05-05 Thread Michael Kubovy

Dear R-helpers,

I need to generate all the binary sequences of length n (here n = 8)
that start with 1 and have no fewer than two of each digit, and are
not cyclic permutations of each other. Here is what I have done:

len <- 8
df <- as.data.frame(numeric(2^(len - 1)) %o% numeric(len))
require(wle)
for (i in 1:2^(len - 1)) df[i, ] <- binary(i, dim = len)[[1]]
df <- df[which(df[, 1] == 1), ]
df <- df[which(rowSums(df) > 1), ]
df <- df[which(rowSums(df) < len - 1), ]

The following are cyclic permutations of each other:
df[which(rowSums(df) == 3), ][c(2, 15), ]

I would like to retain the larger of the two (if considered a binary
number).

Can someone suggest an algorithm?

Thanks,
Michael

_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Room 102Gilmer Hall
   McCormick RoadCharlottesville, VA 22903
Office:B011+1-434-982-4729
Lab:B019+1-434-982-4751
Fax:+1-434-982-4766
WWW:http://www.people.virginia.edu/~mk9y/

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

2009-05-05 Thread Dirk Eddelbuettel

(off list)

On 5 May 2009 at 05:15, Erin Hodgess wrote:
| I also needed libglu1-mesa-dev, but now all is well.

a) You still haven't explained why you need to rebuild it when 
   sudo apt-get install r-cran-rgl
   gets you a binary
   
b) Yes, as 
   sudo apt-get build-dep r-cran-rgl
   would have found out for you.

We do _a lot of work_ for R on Debian/Ubuntu. Use it, you even have a
money-back guarantee. And ...

c) This rgl header business has been discussed at least a hundred times on
   the R-help list. Use RSiteSearch()

Dirk

-- 
Three out of two people have difficulties with fractions.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Cox Proportional Hazard with missing covariate data

2009-05-05 Thread Arthur Allignol

Hi,

In fact, you have left-truncated observations.

What timescale do you use, time 0 is the
study entry, or when the wear-part has been used for the
first time?

If it is the latter, you can specify the "age" of the wear part
at study entry in Surv(). For example, if a wear part has been
used for 5 years before study entry, and "dies" 2 years after,
the data will look like that:
start stop status
57  1

Hope this helps,
Arthur Allignol


Philipp Rappold wrote:

Dear friends,

I have used R for some time now and have a tricky question about the coxph-function: To 
sum it up, I am not sure whether I can use coxph in conjunction with missing covariate 
data in a model with time-variant covariates. The point is: I know how "old" 
every piece that I oberserve is, but do not have fully historical information about the 
corresponding covariates. Maybe you have some advice for me, although this problem might 
only be 70% R and 30% statistically-related. Here's a detailled explanation:

SITUATION & OBJECTIVE:
I want to analyze the effect of environmental effects (i.e.
temperature and humidity) on the lifetime of some wear-parts. The
study should be conducted on a yearly basis, meaning that I have
collected empirical data on every wearpart at the end of every year.

DATA:
I have collected the following data:
- Status of the wear-part: Equals "0" if part is still alive, equals
"1" if part has "died" (my event variable)
- Environmental data: Temperature and humidity have been measured at
each of the wear-parts on a yearly basis (because each wear-part is at
a different location, I have different data for each wear-part)

PROBLEM:
I started collecting data between 2001 and 2007. In 2001, a vast
amount of of wearparts has already been in use. I DO KNOW for every
part how long it has been used (even if it was employed before 2001),
but I DO NOT have any information about environmental conditions like
temperature or humidity before 2001 (I call this semi-left-censored).
Of course, one could argue that I should simply exclude these parts
from my analysis, but I don't want to loose valuable information, also
because the amount of "new parts" that have been employed between 2001
and 2007 is rather small.

Additionally, I cannot make any assumption about the underlying
lifetime distribution. Therefore I have to use a non-parametrical
model for estimation (most likely cox).

QUESTION:

From an econometric perspective, is it possible to use Cox

Proportional Hazard model in this setting? As mentioned before, I have
time-variant covariates for each wearpart, as well as what I call
"semi-left-censored" data that I want to use. If not, what kind of
analysis would you suggest?

Thanks a lot for your great help, I really appreciate it.

All the best
Philipp

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Cox Proportional Hazard with missing covariate data

2009-05-05 Thread Philipp Rappold
Hi,

Arthur, thanks a lot for your super-fast reply!

In fact I am using the time when the part has been used for the first time, so 
your example should work in my case.
Moreover, as I have time-variant covariates, the example should look like this 
in my specific case:

start   stopstatus  temphumid
5   6   0   32  43
6   7   1   34  42

Just two more things:
(1) I am quite a newbie to cox-regression, so I wonder what you think about the 
approach that I mentioned above? Don't worry, I won't nail you down to this, 
just want to make sure I am not totally "off track"!
(2) I don't think that you'd call this "left-truncated" observations, because I 
DO know the time when the part was used for the first time, I just don't have 
covariate values for its whole time of life, e.g. just the last two years in 
the example above. Left truncation in my eyes would mean that I did not even 
observe a specific part, e.g. because it has died before the study started.

Again, thanks a lot, I'll be happy to provide valuable help on this list as 
soon as my R-skills are advancing.

All the best
Philipp

Arthur Allignol wrote:
> Hi,
> 
> In fact, you have left-truncated observations.
> 
> What timescale do you use, time 0 is the
> study entry, or when the wear-part has been used for the
> first time?
> 
> If it is the latter, you can specify the "age" of the wear part
> at study entry in Surv(). For example, if a wear part has been
> used for 5 years before study entry, and "dies" 2 years after,
> the data will look like that:
> start stop status
> 57  1
> 
> Hope this helps,
> Arthur Allignol
> 
> 
> Philipp Rappold wrote:
>> Dear friends,
>>
>> I have used R for some time now and have a tricky question about the
>> coxph-function: To sum it up, I am not sure whether I can use coxph in
>> conjunction with missing covariate data in a model with time-variant
>> covariates. The point is: I know how "old" every piece that I
>> oberserve is, but do not have fully historical information about the
>> corresponding covariates. Maybe you have some advice for me, although
>> this problem might only be 70% R and 30% statistically-related. Here's
>> a detailled explanation:
>>
>> SITUATION & OBJECTIVE:
>> I want to analyze the effect of environmental effects (i.e.
>> temperature and humidity) on the lifetime of some wear-parts. The
>> study should be conducted on a yearly basis, meaning that I have
>> collected empirical data on every wearpart at the end of every year.
>>
>> DATA:
>> I have collected the following data:
>> - Status of the wear-part: Equals "0" if part is still alive, equals
>> "1" if part has "died" (my event variable)
>> - Environmental data: Temperature and humidity have been measured at
>> each of the wear-parts on a yearly basis (because each wear-part is at
>> a different location, I have different data for each wear-part)
>>
>> PROBLEM:
>> I started collecting data between 2001 and 2007. In 2001, a vast
>> amount of of wearparts has already been in use. I DO KNOW for every
>> part how long it has been used (even if it was employed before 2001),
>> but I DO NOT have any information about environmental conditions like
>> temperature or humidity before 2001 (I call this semi-left-censored).
>> Of course, one could argue that I should simply exclude these parts
>> from my analysis, but I don't want to loose valuable information, also
>> because the amount of "new parts" that have been employed between 2001
>> and 2007 is rather small.
>>
>> Additionally, I cannot make any assumption about the underlying
>> lifetime distribution. Therefore I have to use a non-parametrical
>> model for estimation (most likely cox).
>>
>> QUESTION:
>>> From an econometric perspective, is it possible to use Cox
>> Proportional Hazard model in this setting? As mentioned before, I have
>> time-variant covariates for each wearpart, as well as what I call
>> "semi-left-censored" data that I want to use. If not, what kind of
>> analysis would you suggest?
>>
>> Thanks a lot for your great help, I really appreciate it.
>>
>> All the best
>> Philipp
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/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] Create Pie chart from .csv file

2009-05-05 Thread Philipp Rappold
Hi,

I used ggplot2 for plotting recently, you should give it a try - it's excellent.

http://had.co.nz/ggplot2/

All the best
Philipp

DonkeyRhubarb wrote:
> Hi all,
> 
> I am looking to create a pie chart from a given column in a .csv file. 
> 
> My class variables are as follows:
> 
> entry_type,   uniquekey,  types, title,url, abstract, journal, 
> author, month,
> year, howpublished
> 
> So say I want to export a pie chart that groups together all  entries under
> 'types' e.g. 3 x statistics 2x education etc. Im looking to have a piechart
> represent this graphically that shows which type of entry is in most
> frequently. Preferably I'd like to export to a PDF chart and while I can do
> this by typing variables directly into the R console, I cannot manage it
> from a .csv file.
> 
> If you cannot help me with this specific problem, just knowing how to create
> a generic pie chart would be a great help.
> 
> This is part of my final software project which is due in one week. I would
> very much appreciate any help.
> 
> Many thanks in advance
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Create Pie chart from .csv file

2009-05-05 Thread Sarah Goslee
You could go to rseek.org and search for pie chart; that will give you
lots of ideas and examples, including discussion of why pie charts
are a bad idea.

Sarah

On Tue, May 5, 2009 at 9:02 AM, DonkeyRhubarb  wrote:
>
> Hi all,
>
> I am looking to create a pie chart from a given column in a .csv file.
>
> My class variables are as follows:
>
> entry_type,     uniquekey,      types, title,    url, abstract, journal, 
> author, month,
> year, howpublished
>
> So say I want to export a pie chart that groups together all  entries under
> 'types' e.g. 3 x statistics 2x education etc. Im looking to have a piechart
> represent this graphically that shows which type of entry is in most
> frequently. Preferably I'd like to export to a PDF chart and while I can do
> this by typing variables directly into the R console, I cannot manage it
> from a .csv file.
>
> If you cannot help me with this specific problem, just knowing how to create
> a generic pie chart would be a great help.
>
> This is part of my final software project which is due in one week. I would
> very much appreciate any help.
>
> Many thanks in advance
>

-- 
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] problem with rgl package

2009-05-05 Thread Erin Hodgess
I also needed libglu1-mesa-dev, but now all is well.

thanks for the help!
Sincerely,
Erin


On Tue, May 5, 2009 at 5:07 AM, Barry Rowlingson
 wrote:
> On Tue, May 5, 2009 at 10:55 AM, Erin Hodgess  wrote:
>> Dear R People:
>>
>> Here is something strange.  I'm using Ubuntu 9.04 with R 2.9.0.
>>
>> I need to have the rgl package.  Here are my results from installing:
>>
>>> install.packages("rgl")
>> Warning in install.packages("rgl") :
> []
>> checking for X... no
>> configure: error: X11 not found but required, configure aborted.
>> ERROR: configuration failed for package 'rgl'
>> ** Removing '/usr/local/lib/R/site-library/rgl'
>
>> So presumably there is not an X11.  But when I put in "capabilities",
>> it seems to be there.
>
>  R will have X11 capabilities if you have the X11 _binary_ library
> installed. To compile a package from source that needs to link with
> the X11 library you need the development headers. They come in another
> package.
>
>  From the command line, do:
>
>  sudo apt-get install libx11-dev
>
> and that should pull them from the Ubuntu repository. You'll need the
> root password for this.
>
>  It's possible you may need some other development headers once you
> get past the X11 problem!
>
> Barry
>



-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.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] JGR

2009-05-05 Thread r...@quantide.com

The point is that one Cpu stays at 100% for all time JGR is up.
Any ideas?
Andrea

Uwe Ligges wrote:



r...@quantide.com wrote:

Dear R User
I am using JGR on a Linux Ubuntu Computer with 2 Cpus
When Opening JGR, one Cpu goes up to 100% even if no calculation is 
yet started

Did any of you already noticed this strange behaviour?


Does it take very long? On the first start it builds some databases 
and that takes some time if you have installed many packages.


Uwe Ligges



Thanks for your help
Andrea

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Create Pie chart from .csv file

2009-05-05 Thread DonkeyRhubarb

Hi all,

I am looking to create a pie chart from a given column in a .csv file. 

My class variables are as follows:

entry_type, uniquekey,  types, title,url, abstract, journal, 
author, month,
year, howpublished

So say I want to export a pie chart that groups together all  entries under
'types' e.g. 3 x statistics 2x education etc. Im looking to have a piechart
represent this graphically that shows which type of entry is in most
frequently. Preferably I'd like to export to a PDF chart and while I can do
this by typing variables directly into the R console, I cannot manage it
from a .csv file.

If you cannot help me with this specific problem, just knowing how to create
a generic pie chart would be a great help.

This is part of my final software project which is due in one week. I would
very much appreciate any help.

Many thanks in advance

-- 
View this message in context: 
http://www.nabble.com/Create-Pie-chart-from-.csv-file-tp23387025p23387025.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] Can't build termstrc package from source

2009-05-05 Thread Chirantan Kundu
Thanks, Uwe.
I've managed to get it done with R CMD BUILD -binary.

2009/5/5 Uwe Ligges 

> I guess you asked R to:
>
>   R CMD build ...
>
> which builds the source package, but you need
>
>   R CMD INSTALL ...
>
> in order to install the package or
>
> R CMD INSTALL --build  ...
>
> in order to install *and* build a binary package. See the manual R
> Installation and Administration.
>
> Uwe Ligges
>
>
>
>
>
>
>
> Chirantan Kundu wrote:
>
>> Hi,
>>
>> I'm trying to build the termstrc 1.1 package from its source on R 2.7.2 on
>> Windows XP. However instead of building the package it just zips the
>> entire
>> source into a .tar.gz file.
>> This is the first time I'm trying to build an R package from source. I
>> installed the R toolset for Windows and set RTools as well as Perl & MinGW
>> directories in the path.
>> Anybody tried this out? Any file missing in the source?
>>
>> Any help is appreciated.
>>
>> Thanks,
>> Chirantan
>>
>> 
>> Visit us at http://www.2pirad.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.
>>
>


Visit us at http://www.2pirad.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.


  1   2   >