[R] Poisson regression in R

2008-03-01 Thread glmstat

I have these questions:
(1) Use Poisson regression to estimate the main effects of car, age, and
dist (each treated as categorical and modelled using indicator variables)
and interaction terms.  
(2) It was determined by one study that all the interactions were
unimportant and decided that age and car could be treated as though they
were continuous variables. Fit a model incorporating these features and
compare it with the best model obtained in (1). 

n is the number of insurance policies
y is the number of claims
car is the car in an insurance category
age is the age of policy holder
dist is the district where the policy holder lived (1 for London and other
major cities, and 0 otherwise)

Data:

car age disty   n
1   1   0   65  317
1   2   0   65  476
1   3   0   52  486
1   4   0   310 3259
2   1   0   98  486
2   2   0   159 1004
2   3   0   175 1355
2   4   0   877 7660
3   1   0   41  223
3   2   0   117 539
3   3   0   137 697
3   4   0   477 3442
4   1   0   11  40
4   2   0   35  148
4   3   0   39  214
4   4   0   167 1019
1   1   1   2   20
1   2   1   5   33
1   3   1   4   40
1   4   1   36  316
2   1   1   7   31
2   2   1   10  81
2   3   1   22  122
2   4   1   102 724
3   1   1   5   18
3   2   1   7   39
3   3   1   16  68
3   4   1   63  344
4   1   1   0   3
4   2   1   6   16
4   3   1   8   25
4   4   1   33  114



I need help finding the correct R code to construct models. According to the
previous study, the model in (2) "is simpler than (1), fits well (deviance =
53.11, d.f. = 60, p-value = 0.72) and gives coefficients (standard errors):
AGE, – 0.177 (0.018); CAR, 0.198 (0.021); DIST, 0.210 (0.059)." 

As of the first model, I think that I should use this code, but not sure:

> firstmodel<-glm(y~factor(age)*factor(car)*factor(dist),family=poisson)

As of the second model, I used this code, but it produces results that
contradict what the previous study says (and deleting intercept does not
help):

> secondmodel<-glm(y~age+car+factor(dist),family=poisson)
> summary(secondmodel)
Call:
glm(formula = y ~ age + car + factor(dist), family = poisson)

Deviance Residuals: 
 Min1QMedian3Q   Max  
-14.0258   -3.3200   -0.62962.0575   18.1442  

Coefficients:
  Estimate Std. Error z value Pr(>|z|)
(Intercept)3.082220.08127   37.92   <2e-16 ***
age0.836640.02067   40.48   <2e-16 ***
car   -0.167230.01612  -10.37   <2e-16 ***
factor(dist)1 -2.159370.05849  -36.92   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

(Dispersion parameter for poisson family taken to be 1)

Null deviance: 5660.6  on 31  degrees of freedom
Residual deviance: 1154.5  on 28  degrees of freedom
AIC: 1330.8

Number of Fisher Scoring iterations: 5
-- 
View this message in context: 
http://www.nabble.com/Poisson-regression-in-R-tp15784126p15784126.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] One quick question concerning R

2008-03-01 Thread Christofer
?lines

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Elizabeth Purdom
Sent: Sunday, March 02, 2008 10:30 AM
To: Marc Diamond
Cc: R-help@r-project.org
Subject: Re: [R] One quick question concerning R

Hi,
Not sure about what you want your plot to look like, but you should also 
look at 'matplot'.
Best,
Elizabeth

Marc Diamond wrote:
> Just started using 'R'. Nice system. Once quick question: Is it possible
to
> put plot more than one series against a common 'x variable on the same
plot?
> In otherwords, I may want a stacked bar chart of line chart containing
more
> than one series. Could not figure out how to do this.
> 
> Thanks for your help.
> 
> Marc Diamond
> Aviation-Software, Inc.
> 
>   [[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-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] One quick question concerning R

2008-03-01 Thread Elizabeth Purdom
Hi,
Not sure about what you want your plot to look like, but you should also 
look at 'matplot'.
Best,
Elizabeth

Marc Diamond wrote:
> Just started using 'R'. Nice system. Once quick question: Is it possible to
> put plot more than one series against a common 'x variable on the same plot?
> In otherwords, I may want a stacked bar chart of line chart containing more
> than one series. Could not figure out how to do this.
> 
> Thanks for your help.
> 
> Marc Diamond
> Aviation-Software, Inc.
> 
>   [[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] difference between lrm's "Model L.R." and anova's "Chi-Square"

2008-03-01 Thread Frank E Harrell Jr
[EMAIL PROTECTED] wrote:
> I am running lrm() with a single factor. I then run anova() on the fitted
> model to obtain a p-value associated with having that factor in the model.
> 
> I am noticing that the "Model L.R." in the lrm results is almost the same
> as the "Chi-Square" in the anova results, but not quite; the latter value
> is always slightly smaller.
> 
> anova() calculates the p-value based on "Chi-Square", but I have
> independent evidence that "Model L.R." is the actual -2*log(LR), so should
> I be using that?
> 
> Why are the values different?

anova (anova.Design) computes Wald statistics.  When the log-likelihood 
is very quadratic, these statistics will be very close to log-likelihood 
ratio chi-square statistics.  In general LR chi-square tests are better; 
we use Wald tests for speed.  It's best to take the time and do 
lrtest(fit1,fit2) in Design, where one of the two fits is a subset of 
the other.

Frank Harrell

> 
> prob_a <- inv.logit(rnorm(1,0,1))
> prob_b <- inv.logit(rnorm(1,0,1))
> data <- data.frame(
> factor=c(rep("a",500),rep("b",500)),
> outcome=c(sample(c(1,0),100,replace=T,prob=c(prob_a,1-prob_a)),
>   sample(c(1,0),100,replace=T,prob=c(prob_b,1-prob_b
> fit <- lrm(outcome~factor,data)
> 
> fit   # gives "Model L.R." e.g. 8.23, 11.76, 6.89...
> anova(fit)# gives "Chi-Square" e.g. 8.19, 11.69, 6.85...
> 
> Previous  Next|   Save|   Delete  |   Reply   |
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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.


[R] Could not install aroma.affymetrix

2008-03-01 Thread My Coyne
I don't know if this is the correct forum to ask the following question;
however, when I search the aroma.affymetrix discussion group, it suggested
that I should posted the question to r-help.  Here it goes.

 

I followed the instructions on aroma.affymetrix trying to install the
packages; following are the steps:

 

> install.packages(c("R.oo", "R.utils"),
contriburl="http://www.braju.com/R/repos/";) 

trying URL 'http://www.braju.com/R/repos//R.oo_1.4.1.zip'

Content type 'application/zip' length 889981 bytes (869 Kb)

opened URL

downloaded 869 Kb

 

trying URL 'http://www.braju.com/R/repos//R.utils_1.0.0.zip'

Content type 'application/zip' length 893989 bytes (873 Kb)

opened URL

downloaded 873 Kb

 

package 'R.oo' successfully unpacked and MD5 sums checked

package 'R.utils' successfully unpacked and MD5 sums checked

 

The downloaded packages are in

C:\Documents and Settings\mcoyne\Local
Settings\Temp\Rtmpjhahhp\downloaded_packages

updating HTML package descriptions

 

 

However, when I tried to load the package aroma.affymetrix I got the
following error:

 

>  library (aroma.affymetrix)

Error in library(aroma.affymetrix) : 

  there is no package called 'aroma.affymetrix'

 

Any help is greatly appreciated.

 

My D. Coyne

 

 

 

 


[[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] difference between lrm's "Model L.R." and anova's "Chi-Square"

2008-03-01 Thread johnson4
I am running lrm() with a single factor. I then run anova() on the fitted
model to obtain a p-value associated with having that factor in the model.

I am noticing that the "Model L.R." in the lrm results is almost the same
as the "Chi-Square" in the anova results, but not quite; the latter value
is always slightly smaller.

anova() calculates the p-value based on "Chi-Square", but I have
independent evidence that "Model L.R." is the actual -2*log(LR), so should
I be using that?

Why are the values different?

prob_a <- inv.logit(rnorm(1,0,1))
prob_b <- inv.logit(rnorm(1,0,1))
data <- data.frame(
factor=c(rep("a",500),rep("b",500)),
outcome=c(sample(c(1,0),100,replace=T,prob=c(prob_a,1-prob_a)),
  sample(c(1,0),100,replace=T,prob=c(prob_b,1-prob_b
fit <- lrm(outcome~factor,data)

fit   # gives "Model L.R." e.g. 8.23, 11.76, 6.89...
anova(fit)# gives "Chi-Square" e.g. 8.19, 11.69, 6.85...

PreviousNext|   Save|   Delete  |   Reply   |

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Predictive Analytics for Business, Marketing and Web (April 3-4, May 8-9, June 5-6)

2008-03-01 Thread Elise Johnson

http://www.nabble.com/file/p15782617/logo-300-pix-72-dpi-no-sub.jpg 
Predictive Analytics for Business, Marketing and Web is a concentrated
training program that includes interactive breakout sessions.

Dates: April 3-4, May 8-9, and June 5-6, 2008
Locations: Toronto (April), San Francisco (May), New York City (June)
Sponsor: Prediction Impact, Inc.
Instructor:  
http://predictionimpact.com/predictive-analytics-training.html#instructor
Eric Siegel, Ph.D. 

100% of October 2007 attendees rated this program Excellent or Very Good (
http://www.predictionimpact.com/predictive-analytics-seminar.html details ).


**Early-bird special: Sign up one month ahead for $100 off the registration
fee**

(This seminar is offered in conjunction with the eMetrics Marketing
Optimization Summit.)

Business metrics do a great job summarizing the past. But if you want to
predict how customers will respond in the future, there is one place to
turn—predictive analytics. By learning from your abundant historical
data, predictive analytics provides the marketer something beyond standard
business reports and sales forecasts: actionable predictions for each
customer. These predictions encompass all channels, both online and off,
foreseeing which customers will buy, click, respond, convert or cancel. If
you predict it, you own it. 

 The customer predictions generated by predictive analytics deliver more
relevant content to each customer, improving response rates, click rates,
buying behavior, retention and overall profit. For online applications such
as e-marketing and customer care recommendations, predictive analytics acts
in real-time, dynamically selecting the ad, web content or cross-sell
product each visitor is most likely to click on or respond to, according to
that visitor's profile. This is AB selection, rather than just AB testing.

In two days we cover:

The techniques, tips and pointers you need in order to run a successful
predictive analytics and data mining initiative 
How to strategically position and tactically deploy predictive analytics and
data mining at your company 
How to bridge the prevalent gap between technical understanding and
practical use
How a predictive model works, how it's created and how much revenue it
generates
Several detailed case studies that demonstrate predictive analytics in
action and make the concepts concrete

No background in statistics or modeling is required. The only specific
knowledge assumed for this training program is moderate experience with
Excel.

For more information, visit 
http://predictionimpact.com/predictive-analytics-training.html Predictive
Analytics for Business, Marketing and Web , e-mail us at 
mailto:[EMAIL PROTECTED]  [EMAIL PROTECTED]  or call
(415) 683-1146.
-- 
View this message in context: 
http://www.nabble.com/Predictive-Analytics-for-Business%2C-Marketing-and-Web-%28April-3-4%2C-May-8-9%2C-June-5-6%29-tp15782617p15782617.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] Make plots with GNUplot. Have anyone tried that?

2008-03-01 Thread Greg Snow
Another option to get graphs in LaTeX using the same fonts as the rest of the 
document is to export from R as an eps file, then use eps2pgf 
(http://sourceforge.net/projects/eps2pgf) to convert to a pgf file.  Then in 
the LaTeX file just use \input with the created .pgf file.  This creates the 
graph inside of the LaTeX document using the default font(s) within the 
document.
 
Hope this helps,



From: [EMAIL PROTECTED] on behalf of Henrik Bengtsson
Sent: Sat 3/1/2008 4:58 PM
To: Louise Hoffman
Cc: r-help@r-project.org
Subject: Re: [R] Make plots with GNUplot. Have anyone tried that?



On Fri, Feb 29, 2008 at 2:12 PM, Louise Hoffman
<[EMAIL PROTECTED]> wrote:
> [snip]
>
> >  Seriously. Be specific if you have a problem. (read the posting guide). R 
> > can
>  >  also plot. If you don't like R's plots (which I could not understand) you 
> can
>  >  export data and import them to gnuplot. So what?
>
>  Okay, my post was not very good.
>
>  The reason (I think) I need GNUplot, is that I would like to include
>  the plots from R in a Latex report, where I would like to have all the
>  text and equations in the plots with the same font as used in Latex.

FYI, the LaTeX 'psfrag' package was designed for the purpose of having
LaTeX replace the text in EPS figures with text specified in LaTeX.
That should give you the same font as in your main document.  I
haven't used it in a while but it normally does what you want.

My $0.02

Henrik

>
>  So when I read about opening and closing "dev" for making a pdf I
>  figured that the plots that R produces are like the once Matlab makes;
>  shows what they ought to, nothing more, nothing less.
>
>  So I was wondering if anyone know of an GNUplot friendly format and
>  the code that would produce that text file.
>
>  I am new to both R and GNUplot, so I am pure ears if someone knows how
>  to make such plots in R.
>
>
>
>  __
>  R-help@r-project.org mailing list
>  https://stat.ethz.ch/mailman/listinfo/r-help
>  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>  and provide commented, minimal, self-contained, reproducible code.
>

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



[[alternative HTML version deleted]]

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


[R] coxpath() in package glmpath

2008-03-01 Thread array chip
Hi,

I am new to model selection by coefficient shrinkage
method such as lasso. And I became particularly
interested in variable selection in Cox regression by
lasso. I became aware of the coxpath() in R package
glmpath does lasso on Cox model. I have tried the
sample script on the help page of coxpath(), but I
have difficult time understanding the output.
Therefore, I would greatly appreciate if anyone can
help me understand how to use the function.

> data(lung.data)
> attach(lung.data)
> fit.a <- coxpath(lung.data)
> print(fit.a)
Call:
coxpath(data = lung.data)
Step 1 :  karno
Step 2 :  celltype
Step 5 :  trt
Step 6 :  prior
Step 7 :  age
Step 8 :  diagtime

> summary(fit.a)
Call:
coxpath(data = lung.data)
   Df Log.p.lik   AIC   BIC
Step 1  0 -505.8840 1011.7679 1011.7679
Step 2  1 -486.0691  974.1382  977.0581
Step 5  2 -484.8520  973.7040  979.5440
Step 6  3 -483.4018  972.8036  981.5636
Step 7  4 -483.3801  974.7602  986.4401
Step 8  5 -483.2287  976.4573  991.0572
Step 9  6 -483.1112  978.2224  995.7423

first of all, why the number of steps between the
above 2 outputs are different? I confirmed with
coxph() that the numbers (log.p.lik, AIC, BIC) on the
1st row of summary(fit.a) are from a NULL Cox model,
i.e. a model with only an intercept. Then how Step 1
in
the output of summary(fit.a) is corresponding to "Step
1" in the output of print(fit.a) where it seems to
mean a model with the variable "karno"?

>predict(fit.a)
trt celltype karno   diagtime age   prior
1 0. 0.  0. 0.000e+00  0.000e+00 0.000e+00
2 0. 0.0076 -0.0256 0.000e+00  0.000e+00 0.000e+00
5 0. 0.0450 -0.0286 0.000e+00  0.000e+00 0.000e+00
6 0.1428 0.1033 -0.0330 0.000e+00  0.000e+00
-4.326e-05
7 0.1468 0.1048 -0.0332 0.000e+00 -1.043e-07
-3.506e-04
8 0.1755 0.1139 -0.0340 5.642e-06 -1.404e-03
-2.367e-03
attr(,"s")
[1] 1 2 5 6 7 8
attr(,"fraction")
[1] 0.000 0.125 0.500 0.625 0.750 0.875
attr(,"mode")
[1] "step"

Second, if we compare the output of print(fit.a) and
predict(fit.a), I can see some discrepancies. For
example, "Step 1" of print(fit.a) was variable
"karno", however, predict(fit.a) showed that the
coefficient of "karno" was still 0. The same went with
variable "trt" in "Step 5". What is the meaning of the
discrepancies? I think I probably misunderstand the
whole meaning of coefficient shrinkage in the first
place. So I would appreciate if anyone can shed some
lights.

I would also like to have any opinion on how I should
do variable selection from these output? Should I rely
on the table (log.p.lik, aic, bic) from summary fit.a)
, or should I rely on the coefficients table from
print(fit.a) to eliminate those variables with 0
coefficients at certain step?

Thank you very much for your time.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Fwd: Re: How to create following chart for visualizing multivariate time series

2008-03-01 Thread jim holtman
If you want color, then a slight addition to Henrique's solution will do it:

x <- y <- seq(-4*pi, 4*pi, len=27)
r <- sqrt(outer(x^2, y^2, "+"))
library(lattice)
colkey <- colorRampPalette(c('red','yellow','green'))(32)
levelplot(r, colorkey=list(col=colkey),
   col.regions=(col=colkey))

On Sat, Mar 1, 2008 at 6:08 PM, Henrique Dallazuanna <[EMAIL PROTECTED]> wrote:
> This works for me:
>
> x <- y <- seq(-4*pi, 4*pi, len=27)
> r <- sqrt(outer(x^2, y^2, "+"))
> library(lattice)
> levelplot(r, colorkey=list(col=gray((0:32)/32)),
>col.regions=(col=gray((0:32)/32)))
>
> 'r' is a matrix for you?
>
> On 01/03/2008, David Winsemius <[EMAIL PROTECTED]> wrote:
> > "Henrique Dallazuanna" <[EMAIL PROTECTED]> wrote in
> > news:[EMAIL PROTECTED]:
> >
> > library(lattice)
> > levelplot(r, colorkey=list(col=gray((0:32)/32)),
> >  col.regions=(col=gray((0:32)/32)))
> >
> > When I try that example, I get an error, even after updating lattice.
> >
> > > levelplot(r, colorkey=list(col=gray((0:32)/32)),
> > +  col.regions=(col=gray((0:32)/32)))
> > Error in UseMethod("levelplot") : no applicable method for "levelplot"
> >
> > If I simply change colorkey=FALSE to colorkey=TRUE in the first levelplot
> > help page example, I have what looks to me as "success".
> >
> > levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
> >   ylab="", main="Weird Function", sub="with log scales",
> >   colorkey = TRUE,
> >   region = TRUE)
> >
> > --
> > David Winsemius
> >
> > >
> > > On 29/02/2008, Megh Dal <[EMAIL PROTECTED]> wrote:
> > >> Hi Jim, i think you could not get my point. I did not want to put
> > >> red-blue color there. I want to put a pallet which will describe
> > >> the values of r. please have a look on following :
> > > http://bp0.blogger.com/_k3l6qPzizGs/RvDVglPknRI/AKo/itlWOvuuO
> > > tI/s1600-h/pairwise_kl_window60.png. Please see how a color pallate
> > > is added on the right side of this plot describing the value of red
> > > color, value of blue color etc.
> > >>
> > >>   Is there any solution?
> > >>
> > >>   Regards,
> > >>
> > >>
> > >>  jim holtman <[EMAIL PROTECTED]> wrote:
> > >>   Try something like this:
> > >>
> > >>  require(grDevices) # for colours
> > >>  x <- y <- seq(-4*pi, 4*pi, len=27)
> > >>  r <- sqrt(outer(x^2, y^2, "+"))
> > >>  image(x, y, r, col=gray((0:32)/32))
> > >>  colors <- colorRampPalette(c('red', 'yellow', 'blue')) # create
> > >>  you color spectrum
> > >>  image(x,y,r, col=colors(100))
> > >>
> > >>
> > >>
> > >> On Thu, Feb 28, 2008 at 9:28 PM, Megh Dal wrote:
> > >>  > I used ?image function to do that, like below :
> > >>  >
> > >>  > require(grDevices) # for colours
> > >>  > x <- y <- seq(-4*pi, 4*pi, len=27)
> > >>  > r <- sqrt(outer(x^2, y^2, "+"))
> > >>  > image(x, y, r, col=gray((0:32)/32))
> > >>  >
> > >>  > However my next problem to add a color pallet for color
> > >>  > description [as shown in following link]. If anyone here tell
> >    me how to do that, it will be good for me.
> > >>  >
> > >>
> > >> > Megh Dal wrote: Hi all,
> > >>
> > >> >
> > >>  > Can anyone here please tell me whether is it possible to produce
> > >>  > a chart displayed in http://www.datawolf.blogspot.com/ in R for
> > > visualizing multivariate time series? If possible how?
> > >>  >
> > >>  >
> >
> > __
> > R-help@r-project.org mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
> --
> Henrique Dallazuanna
> Curitiba-Paraná-Brasil
> 25° 25' 40" S 49° 16' 22" O
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

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

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


[R] inverse fourier transform

2008-03-01 Thread stephen sefick
y<-ts(x, frequency=1/15)
spec.pgram(y, log="no")

There is high power in the very low frequency range for the data set
of continuous dissolved oxygen on which I am preforming this analysis.
 This is the seasonal trend due to temperature (and all things that
are associated- photosynthesis, respiration, and anything else on
which the doubling of a reaction rate ever ten degrees celcius would
act).  I would like to make this low frequency spike zero and then
inverse fourier transform to get the "filtered" signal.  spec.pgram
spits out a matrix

z<-spec.pgram(y, log="no")
print(z)

spec, frequency, and phase are returned.  They are not matched up and
I would like to take out the frequency and its associated spectrum in
the range of 0-6.53*10^6.   Any suggestions?
thanks

Stephen

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


Re: [R] Make plots with GNUplot. Have anyone tried that?

2008-03-01 Thread Henrik Bengtsson
On Fri, Feb 29, 2008 at 2:12 PM, Louise Hoffman
<[EMAIL PROTECTED]> wrote:
> [snip]
>
> >  Seriously. Be specific if you have a problem. (read the posting guide). R 
> > can
>  >  also plot. If you don't like R's plots (which I could not understand) you 
> can
>  >  export data and import them to gnuplot. So what?
>
>  Okay, my post was not very good.
>
>  The reason (I think) I need GNUplot, is that I would like to include
>  the plots from R in a Latex report, where I would like to have all the
>  text and equations in the plots with the same font as used in Latex.

FYI, the LaTeX 'psfrag' package was designed for the purpose of having
LaTeX replace the text in EPS figures with text specified in LaTeX.
That should give you the same font as in your main document.  I
haven't used it in a while but it normally does what you want.

My $0.02

Henrik

>
>  So when I read about opening and closing "dev" for making a pdf I
>  figured that the plots that R produces are like the once Matlab makes;
>  shows what they ought to, nothing more, nothing less.
>
>  So I was wondering if anyone know of an GNUplot friendly format and
>  the code that would produce that text file.
>
>  I am new to both R and GNUplot, so I am pure ears if someone knows how
>  to make such plots in R.
>
>
>
>  __
>  R-help@r-project.org mailing list
>  https://stat.ethz.ch/mailman/listinfo/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] Fwd: Re: How to create following chart for visualizing multivariate time series

2008-03-01 Thread David Winsemius
"Henrique Dallazuanna" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]: 

> This works for me:
> 
> x <- y <- seq(-4*pi, 4*pi, len=27)
> r <- sqrt(outer(x^2, y^2, "+"))
> library(lattice)
> levelplot(r, colorkey=list(col=gray((0:32)/32)),
> col.regions=(col=gray((0:32)/32)))

Works for me as well.

> 'r' is a matrix for you?

It was the vector created by the first levelplot() example. I had not 
run the code of Megh Dal. 

When I hastily looked at the help page and saw that "colorkey" was 
supposed to be a logical, I assumed that the list argument was throwing 
the error. If I had read the full text I would have seen that a list 
argument was also valid. This gives what appears to me to be identical 
success, but maybe it has risks that I don't understand:

levelplot(r, colorkey=TRUE,
 col.regions=(col=gray((0:32)/32)))

Thanks;
David Winsemius


 
> 
> On 01/03/2008, David Winsemius <[EMAIL PROTECTED]> wrote:
>> "Henrique Dallazuanna" <[EMAIL PROTECTED]> wrote in
>> news:[EMAIL PROTECTED]:
>>
>> library(lattice)
>> levelplot(r, colorkey=list(col=gray((0:32)/32)),
>>  col.regions=(col=gray((0:32)/32)))
>>
>> When I try that example, I get an error, even after updating
>> lattice. 
>>
>> > levelplot(r, colorkey=list(col=gray((0:32)/32)),
>> +  col.regions=(col=gray((0:32)/32)))
>> Error in UseMethod("levelplot") : no applicable method for
>> "levelplot" 
>>
>> If I simply change colorkey=FALSE to colorkey=TRUE in the first
>> level 
> plot
>> help page example, I have what looks to me as "success".
>>
>> levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
>>   ylab="", main="Weird Function", sub="with log scales",
>>   colorkey = TRUE,
>>   region = TRUE)
>>
>> --
>> David Winsemius
>>
>> >
>> > On 29/02/2008, Megh Dal <[EMAIL PROTECTED]> wrote:
>> >> Hi Jim, i think you could not get my point. I did not want to
>> >> put red-blue color there. I want to put a pallet which will
>> >> describe the values of r. please have a look on following :
>> > http://bp0.blogger.com/_k3l6qPzizGs/RvDVglPknRI/AKo/itlWOv
>> > uuO tI/s1600-h/pairwise_kl_window60.png. Please see how a color
>> > pallate is added on the right side of this plot describing the
>> > value of red color, value of blue color etc.
>> >>
>> >>   Is there any solution?
>> >>
>> >>   Regards,
>> >>
>> >>
>> >>  jim holtman <[EMAIL PROTECTED]> wrote:
>> >>   Try something like this:
>> >>
>> >>  require(grDevices) # for colours
>> >>  x <- y <- seq(-4*pi, 4*pi, len=27)
>> >>  r <- sqrt(outer(x^2, y^2, "+"))
>> >>  image(x, y, r, col=gray((0:32)/32))
>> >>  colors <- colorRampPalette(c('red', 'yellow', 'blue')) # create
>> >>  you color spectrum
>> >>  image(x,y,r, col=colors(100))
>> >>
>> >>
>> >>
>> >> On Thu, Feb 28, 2008 at 9:28 PM, Megh Dal wrote:
>> >>  > I used ?image function to do that, like below :
>> >>  >
>> >>  > require(grDevices) # for colours
>> >>  > x <- y <- seq(-4*pi, 4*pi, len=27)
>> >>  > r <- sqrt(outer(x^2, y^2, "+"))
>> >>  > image(x, y, r, col=gray((0:32)/32))
>> >>  >
>> >>  > However my next problem to add a color pallet for color
>> >>  > description [as shown in following link]. If anyone here tell
>>    me how to do that, it will be good for me.
>> >>  >
>> >>
>> >> > Megh Dal wrote: Hi all,
>> >>
>> >> >
>> >>  > Can anyone here please tell me whether is it possible to
>> >>  > produce a chart displayed in
>> >>  > http://www.datawolf.blogspot.com/ in R for 
>> > visualizing multivariate time series? If possible how?
>> >>  >
>> >>  >
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.h 
> tml
>> 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] One quick question concerning R

2008-03-01 Thread Henrique Dallazuanna
x <- rnorm(10)
y <- runif(10)
z <- 1:10

plot(x~z, ylim=range(x, y), type='l')
lines(y, col='red')




On 01/03/2008, Marc Diamond <[EMAIL PROTECTED]> wrote:
> Just started using 'R'. Nice system. Once quick question: Is it possible to
> put plot more than one series against a common 'x variable on the same plot?
> In otherwords, I may want a stacked bar chart of line chart containing more
> than one series. Could not figure out how to do this.
>
> Thanks for your help.
>
> Marc Diamond
> Aviation-Software, Inc.
>
>   [[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.
>


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

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

2008-03-01 Thread Charles Willis
Hello,

I am running the program COMPAR.GEE within the package APE. My dependent
variable is binomial, while my independent variable is a multi-state
categorical variable. The output reports an estimate for each state of the
independent variable except the first one. For example, for the variable X
with 3 states, the output is:

intercept  (estimate)
X2   (estimate)
X3   (estimate)

I have two questions: 1) Why does it not give me an intercept for the first
variable and how do i get it; 2) can a get a general estimate of
correlation, like a wald's statistic for the variable?


Thank you!

Charlie

~~
Charles G. Willis
Department of Organismic and Evolutionary Biology
22 Divinity Ave Cambridge MA 02139
HP (857) 488-2506
WP (617) 496-3890
[EMAIL PROTECTED]
http://www.people.fas.harvard.edu/%7Ecgwillis/
~~

[[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] One quick question concerning R

2008-03-01 Thread Marc Diamond
Just started using 'R'. Nice system. Once quick question: Is it possible to
put plot more than one series against a common 'x variable on the same plot?
In otherwords, I may want a stacked bar chart of line chart containing more
than one series. Could not figure out how to do this.

Thanks for your help.

Marc Diamond
Aviation-Software, Inc.

[[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] Fwd: Re: How to create following chart for visualizing multivariate time series

2008-03-01 Thread Henrique Dallazuanna
This works for me:

x <- y <- seq(-4*pi, 4*pi, len=27)
r <- sqrt(outer(x^2, y^2, "+"))
library(lattice)
levelplot(r, colorkey=list(col=gray((0:32)/32)),
col.regions=(col=gray((0:32)/32)))

'r' is a matrix for you?

On 01/03/2008, David Winsemius <[EMAIL PROTECTED]> wrote:
> "Henrique Dallazuanna" <[EMAIL PROTECTED]> wrote in
> news:[EMAIL PROTECTED]:
>
> library(lattice)
> levelplot(r, colorkey=list(col=gray((0:32)/32)),
>  col.regions=(col=gray((0:32)/32)))
>
> When I try that example, I get an error, even after updating lattice.
>
> > levelplot(r, colorkey=list(col=gray((0:32)/32)),
> +  col.regions=(col=gray((0:32)/32)))
> Error in UseMethod("levelplot") : no applicable method for "levelplot"
>
> If I simply change colorkey=FALSE to colorkey=TRUE in the first levelplot
> help page example, I have what looks to me as "success".
>
> levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
>   ylab="", main="Weird Function", sub="with log scales",
>   colorkey = TRUE,
>   region = TRUE)
>
> --
> David Winsemius
>
> >
> > On 29/02/2008, Megh Dal <[EMAIL PROTECTED]> wrote:
> >> Hi Jim, i think you could not get my point. I did not want to put
> >> red-blue color there. I want to put a pallet which will describe
> >> the values of r. please have a look on following :
> > http://bp0.blogger.com/_k3l6qPzizGs/RvDVglPknRI/AKo/itlWOvuuO
> > tI/s1600-h/pairwise_kl_window60.png. Please see how a color pallate
> > is added on the right side of this plot describing the value of red
> > color, value of blue color etc.
> >>
> >>   Is there any solution?
> >>
> >>   Regards,
> >>
> >>
> >>  jim holtman <[EMAIL PROTECTED]> wrote:
> >>   Try something like this:
> >>
> >>  require(grDevices) # for colours
> >>  x <- y <- seq(-4*pi, 4*pi, len=27)
> >>  r <- sqrt(outer(x^2, y^2, "+"))
> >>  image(x, y, r, col=gray((0:32)/32))
> >>  colors <- colorRampPalette(c('red', 'yellow', 'blue')) # create
> >>  you color spectrum
> >>  image(x,y,r, col=colors(100))
> >>
> >>
> >>
> >> On Thu, Feb 28, 2008 at 9:28 PM, Megh Dal wrote:
> >>  > I used ?image function to do that, like below :
> >>  >
> >>  > require(grDevices) # for colours
> >>  > x <- y <- seq(-4*pi, 4*pi, len=27)
> >>  > r <- sqrt(outer(x^2, y^2, "+"))
> >>  > image(x, y, r, col=gray((0:32)/32))
> >>  >
> >>  > However my next problem to add a color pallet for color
> >>  > description [as shown in following link]. If anyone here tell
>    me how to do that, it will be good for me.
> >>  >
> >>
> >> > Megh Dal wrote: Hi all,
> >>
> >> >
> >>  > Can anyone here please tell me whether is it possible to produce
> >>  > a chart displayed in http://www.datawolf.blogspot.com/ in R for
> > visualizing multivariate time series? If possible how?
> >>  >
> >>  >
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>


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

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


Re: [R] Help needed in R

2008-03-01 Thread Henrique Dallazuanna
Try this:

data <- as.data.frame(data)
names(data) <- c('Data', 'Indicator')

a)
sort(unique(subset(data, Indicator == 1))[,1])

b)  with(subset(data, Indicator == 1),
  tapply(Indicator, Data, sum))



On 01/03/2008, AbouEl-Makarim Aboueissa <[EMAIL PROTECTED]> wrote:
> Dear ALL:
>
> I have two quick questions about how to perform some steps in R. Could you
> please see the attached MS file if the data not clean enough in this email.
>
> Thank you so much for all your helps.
>
>
> Abou
>
>
>
> Here it is:
> =
>
> Consider the following matrix:
>
> data<-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5,
> 4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4,
> 
> 0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0,
> 0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2)
>
>
>   [,1] [,2]
>  [1,]20
>  [2,]20
>  [3,]   120
>  [4,]20
>  [5,]10
>  [6,]   101
>  [7,]   101
>  [8,]40
>  [9,]   101
> [10,]11
> [11,]10
> [12,]21
> [13,]21
> [14,]10
> [15,]20
> [16,]   101
> [17,]30
> [18,]11
> [19,]10
> [20,]10
> [21,]30
> [22,]51
> [23,]   170
> [24,]   230
> [25,]90
> [26,]90
> [27,]30
> [28,]30
> [29,]   151
> [30,]51
> [31,]40
> [32,]51
> [33,]51
> [34,]51
> [35,]40
> [36,]80
> [37,]10
> [38,]   150
> [39,]30
> [40,]30
> [41,]10
> [42,]60
> [43,]30
> [44,]60
> [45,]30
> [46,]40
> [47,]50
> [48,]   140
> [49,]40
>
>
>
>
>
> Q1. Column one is the data set, and column two is an indicator of 1 and 0.
> Some values
>  in column one corresponding to indicator 1 in column two are
> different, and some
>  are the same. There are 5 different groups of values in column one
> with indicator 1
>  in column two.
>
> (a) How I can choose only one value (only one observation) from each of
> these groups to
>  develop a vector of length 5 as: (1   25   10  15).
>
>
>
>
> (b) How I can find number of observations in each of these groups as a
> vector as:
> (2 254   1).
>
>
>
>
>
>
>
>
>
>
>
> These are the values with indicator 1.
>
> [,1] [,2]
>  [1,]11
>  [2,]11
>  [3,]21
>  [4,]21
>  [5,]51
>  [6,]51
>  [7,]51
>  [8,]51
>  [9,]51
> [10,]   101
> [11,]   101
> [12,]   101
> [13,]   101
> [14,]   151
>
> =
>
>
>
>
>
> ==
> AbouEl-Makarim Aboueissa, Ph.D.
> Assistant Professor of Statistics
> Department of Mathematics & Statistics
> University of Southern Maine
> 96 Falmouth Street
> P.O. Box 9300
> Portland, ME 04104-9300
>
> Tel: (207) 228-8389
> Fax: (207) 780-5607
> Email: [EMAIL PROTECTED]
>   [EMAIL PROTECTED]
> Office: 301C Payson Smith
>
>
>


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

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


Re: [R] Help needed in R

2008-03-01 Thread Heinz Tuechler
At 23:07 01.03.2008, AbouEl-Makarim Aboueissa wrote:
>Dear ALL:
>
>I have two quick questions about how to perform some steps in R. 
>Could you please see the attached MS file if the data not clean 
>enough in this email.
>
>Thank you so much for all your helps.
>
>
>Abou
>
>
>
>Here it is:
>=
>
>Consider the following matrix:
>
>data<-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5,
>   4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4,
> 
>0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0,
>   0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2)
>
>
>   [,1] [,2]
>  [1,]20
>  [2,]20
>  [3,]   120
>  [4,]20
>  [5,]10
>  [6,]   101
>  [7,]   101
>  [8,]40
>  [9,]   101
>[10,]11
>[11,]10
>[12,]21
>[13,]21
>[14,]10
>[15,]20
>[16,]   101
>[17,]30
>[18,]11
>[19,]10
>[20,]10
>[21,]30
>[22,]51
>[23,]   170
>[24,]   230
>[25,]90
>[26,]90
>[27,]30
>[28,]30
>[29,]   151
>[30,]51
>[31,]40
>[32,]51
>[33,]51
>[34,]51
>[35,]40
>[36,]80
>[37,]10
>[38,]   150
>[39,]30
>[40,]30
>[41,]10
>[42,]60
>[43,]30
>[44,]60
>[45,]30
>[46,]40
>[47,]50
>[48,]   140
>[49,]40
>
>
>
>
>
>Q1. Column one is the data set, and column two is an indicator of 1 
>and 0. Some values
>  in column one corresponding to indicator 1 in column two 
> are different, and some
>  are the same. There are 5 different groups of values in 
> column one with indicator 1
>  in column two.
>
>(a) How I can choose only one value (only one observation) from each 
>of these groups to
>  develop a vector of length 5 as: (1   25   10  15).
>

table1 <- table(data[data[, 2]==1, 1])

as.numeric(dimnames(table1)[[1]])

[1]  1  2  5 10 15



>(b) How I can find number of observations in each of these groups as 
>a vector as:
> (2 254   1).
>

as.vector(table1)

[1] 2 2 5 4 1

greetings

Heinz










>These are the values with indicator 1.
>
> [,1] [,2]
>  [1,]11
>  [2,]11
>  [3,]21
>  [4,]21
>  [5,]51
>  [6,]51
>  [7,]51
>  [8,]51
>  [9,]51
>[10,]   101
>[11,]   101
>[12,]   101
>[13,]   101
>[14,]   151
>
>=
>
>
>
>
>
>==
>AbouEl-Makarim Aboueissa, Ph.D.
>Assistant Professor of Statistics
>Department of Mathematics & Statistics
>University of Southern Maine
>96 Falmouth Street
>P.O. Box 9300
>Portland, ME 04104-9300
>
>Tel: (207) 228-8389
>Fax: (207) 780-5607
>Email: [EMAIL PROTECTED]
>   [EMAIL PROTECTED]
>Office: 301C Payson Smith
>
>
>
>__
>R-help@r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

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


[R] Help needed in R

2008-03-01 Thread AbouEl-Makarim Aboueissa
Dear ALL:

I have two quick questions about how to perform some steps in R. Could you 
please see the attached MS file if the data not clean enough in this email.

Thank you so much for all your helps.


Abou



Here it is:
=

Consider the following matrix:

data<-matrix(c(2,2,12,2,1,10,10,4,10,1,1,2,2,1,2,10,3,1,1,1,3,5,17,23,9,9,3,3,15,5,
  4,5,5,5,4,8,1,15,3,3,1,6,3,6,3,4,5,14,4,
  
0,0,0,0,0,1,1,0,1,1,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,1,1,0,1,1,1,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0),49,2)


  [,1] [,2]
 [1,]20
 [2,]20
 [3,]   120
 [4,]20
 [5,]10
 [6,]   101
 [7,]   101
 [8,]40
 [9,]   101
[10,]11
[11,]10
[12,]21
[13,]21
[14,]10
[15,]20
[16,]   101
[17,]30
[18,]11
[19,]10
[20,]10
[21,]30
[22,]51
[23,]   170
[24,]   230
[25,]90
[26,]90
[27,]30
[28,]30
[29,]   151
[30,]51
[31,]40
[32,]51
[33,]51
[34,]51
[35,]40
[36,]80
[37,]10
[38,]   150
[39,]30
[40,]30
[41,]10
[42,]60
[43,]30
[44,]60
[45,]30
[46,]40
[47,]50
[48,]   140
[49,]40





Q1. Column one is the data set, and column two is an indicator of 1 and 0. Some 
values 
 in column one corresponding to indicator 1 in column two are 
different, and some 
 are the same. There are 5 different groups of values in column one 
with indicator 1 
 in column two.

(a) How I can choose only one value (only one observation) from each of these 
groups to 
 develop a vector of length 5 as: (1   25   10  15).




(b) How I can find number of observations in each of these groups as a vector 
as: 
(2 254   1).











These are the values with indicator 1.

[,1] [,2]
 [1,]11
 [2,]11
 [3,]21
 [4,]21
 [5,]51
 [6,]51
 [7,]51
 [8,]51
 [9,]51
[10,]   101
[11,]   101
[12,]   101
[13,]   101
[14,]   151

=





==
AbouEl-Makarim Aboueissa, Ph.D.
Assistant Professor of Statistics
Department of Mathematics & Statistics
University of Southern Maine
96 Falmouth Street
P.O. Box 9300
Portland, ME 04104-9300

Tel: (207) 228-8389
Fax: (207) 780-5607
Email: [EMAIL PROTECTED]
  [EMAIL PROTECTED]
Office: 301C Payson Smith


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] A question on getting all possible combinations

2008-03-01 Thread Wolfgang Huber
library("R.utils")
intToBin(0:63)

Best wishes
  Wolfgang

--
Wolfgang Huber  EBI/EMBL  Cambridge UK  http://www.ebi.ac.uk/huber


Benilton Carvalho scripsit:
> target = c("u", "d")
> apply(expand.grid(rep(list(target), 6)), 1, paste, sep="", collapse="")
> 
> b
> 
> On Mar 1, 2008, at 9:13 AM, Megh Dal wrote:
> 
>> Hi all,
>>
>> Suppose I have to letters  'u' and 'd'. Now I want to find all 
>> combinations like that :
>>
>> uu
>> ud
>> du
>> .
>> 
>> dd
>>
>> This type of combination generally required for Option Pricing in 
>> financial/derivative market. Here generally 'u' means: up-move and 'd' 
>> means down move of price like Stock price etc.
>>
>> Is there any easy way in R for doing that?
>>
>> Regards,
>>

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

2008-03-01 Thread jim holtman
It would be helpful if you provided commented, minimal,
self-contained, reproducible code.

What does str(all_differ) say?  That will tell you the structure of
the object that you are trying to work with.

On Sat, Mar 1, 2008 at 3:35 AM, Keizer_71 <[EMAIL PROTECTED]> wrote:
>
> > dim(data.sub)
> [1] 1   140
>
> #extracting all differentially express genes##
> library(multtest)
> two_side<- (1-pt(abs(data.sub),50))*2
> diff<- mt.rawp2adjp(two_side)
> all_differ<-diff[[1]][37211:1,]
> all_differ
>
> #list of differentially expressed genes##
> > probe.names<-
> + all_differ[[2]][all_differ[[1]][,"BY"]<=0.01]
>
> Error in all_differ[[1]][, "BY"] : incorrect number of dimensions
>
> Hi,
>
> I am pretty new with R. What i am trying to do is to find all differentially
> express genes and list of differentially expressed genes. Am i doing
> something wrong?
>
> I keep getting incorrect number of dimensions. How do i find out the correct
> dimensions?
>
> thanks,
> Keizer
>
> --
> View this message in context: 
> http://www.nabble.com/Newbie%3A-Incorrect-number-of-dimensions-tp15773090p15773090.html
> Sent from the R help mailing list archive at Nabble.com.
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



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

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

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


Re: [R] Make plots with GNUplot. Have anyone tried that?

2008-03-01 Thread Greg Snow
There is a very basic interface between R and gnuplot in the TeachingDemos 
package.  Look at the help for gp.plot.
 
gp.open will run gnuplot and link it to R, gp.plot will send data to gnuplot 
and create a scatterplot.  (gp.send will send extra commands to gnuplot and 
gp.close will clean up).
 
Feel free to extend this to fit your needs,



From: [EMAIL PROTECTED] on behalf of Louise Hoffman
Sent: Fri 2/29/2008 4:54 PM
To: Gabor Csardi
Cc: r-help@r-project.org
Subject: Re: [R] Make plots with GNUplot. Have anyone tried that?



>  If you still want to then read ?write.table, that can export your data
>  into a spreadsheet-like ascii format which can be used from GNUplot
>  easily.

Very interesting.

So if I e.g. write:
ts.sim <- arima.sim(list(order = c(1,1,0), ar = 0.7), n = 200)
ts.plot(ts.sim)

How do I know the names of the rows to put in the data.frame() command?

>  Btw, comparing the graphics capabilities of GNUplot and R, it is
>  something like a three-wheel bicycle and a spaceship. Guess
>  which is which.

=) I know that I will most likely spend a lot of time on just making
the plots, but I atleast (for now =) ) think it could be fun to try.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] How to set up multiple spawns of R?

2008-03-01 Thread Greg Snow
You may want to look at the nws package (there are others that also help with 
parallel versions, but on windows, nws seems to work the best (at least in my 
experiance so far)).



From: [EMAIL PROTECTED] on behalf of Guy Perry
Sent: Sat 3/1/2008 7:19 AM
To: r-help@r-project.org
Subject: [R] How to set up multiple spawns of R?



Sorry: resending this; didn't have a title on it.

Trying to set up multiple spawns of R
---

Hi.  I'm new to the list but I have a small problem with R.  I'm trying to
set up multiple spawns of R active at the same time on an AMD with a dual
core in Vista so that I can cut down my permutation processing time. 

I've installed R in multiple places, which I thought was the correct way to
do it but whether I use installs at "C:\Program Files\R1" and "C\...\R2", or
even separately on the C: and D: drive, whenever I try to load my package
(qtl), it gives me the error message:

Error in library(qtl) : there is no package called 'qtl'

The thing is, I've installed the packagen in both places (C\...\R1 and
C\...\R2, or both the C: and D: drives) and it still gives me the message.
Does anyone know how to set up a simultaneous R spawn?  Clearly I'm wrong
about how to get it started.

Thanks,

G Perry

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] How to set up multiple spawns of R?

2008-03-01 Thread Dirk Eddelbuettel

On 1 March 2008 at 09:19, Guy Perry wrote:
| Sorry: resending this; didn't have a title on it.
| 
| Trying to set up multiple spawns of R
| ---
| 
| Hi.  I'm new to the list but I have a small problem with R.  I'm trying to
| set up multiple spawns of R active at the same time on an AMD with a dual
| core in Vista so that I can cut down my permutation processing time.  
| 
| I've installed R in multiple places, which I thought was the correct way to
| do it but whether I use installs at "C:\Program Files\R1" and "C\...\R2", or
| even separately on the C: and D: drive, whenever I try to load my package
| (qtl), it gives me the error message:
| 
| Error in library(qtl) : there is no package called 'qtl'
| 
| The thing is, I've installed the packagen in both places (C\...\R1 and
| C\...\R2, or both the C: and D: drives) and it still gives me the message. 
| Does anyone know how to set up a simultaneous R spawn?  Clearly I'm wrong
| about how to get it started.

Afraid so. What made you think you needed to _install R multiple times_ in
order to _run R multiple times_ ?  In short, you don't.

R's core engine is single-threaded, so there is no obvious shortcut. That
said, yopu can of course use parallel coding toolkits like Rmpi to spawn
multiple R session -- which may be beneficial even if you don't have multiple
cores.   These things have been discussed a few times, so some focused Google
queries (or RSiteSearch() queries) may help.

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


[R] jpeg and margin text

2008-03-01 Thread Thomas Schwander
Hi guys,

 

I use R 2.6.2 and Windows XP.

 

I’ve got the following question: I wrote a lot of text into the margin of a
plot. When I use the “jpeg”-function, only a little part of the margin text
is displayed in the final jpeg? Any ideas to change it?

 

Source-Code:

 

datenbankdaten<-data.frame(LETTERS[1:20],

c(8,4.8,3.8,2.7,2.6,2.1,2,1.9,1.6,1,0.99,0.98,0.98,0.97,0.96,.96,0.8,0.8,0.7
,0.6),

c(8,4.8,3.8,0,2.6,2.1,2,1.9,1.6,1.1,0.99,0.98,0.97,0.97,0.96,.95,0.8,0.8,0,0
.6))

 

Zugehoerigkeit<-LETTERS[1:20]

 

Bezeichnung<-letters[1:20]

 

colnames(datenbankdaten)<-c("Bezeichnung","A","B")

 

# par = Setzt die Grafikparameter, die durch plot automatisch verwendet
werden 

# mar = Anzahl der Textzeilen von den inneren Achsen des Schaubild zum Rand

# Zeilenvektor: c(bottom, left, top, right)

par(mar=c(3,4,4,25),family="serif")

 

Fontparameter<-1

 

today<-Sys.Date()

Vormonat<-Sys.Date()-20

 

Stand_aktuell<-format(today, "%B %Y")

Stand_Vormonat<-format(Vormonat, "%B %Y")

jpeg(paste("C:\\TOP-20.jpeg",sep=""),quality=100,width=1024, height=768)

 
plot(datenbankdaten[,2],ylim=c(0,max(datenbankdaten[,2],datenbankdaten[,3]))
,

  xlab="", ylab="",

 
font.axis=Fontparameter,font.lab=Fontparameter,font.main=Fontparameter,font.
sub=Fontparameter,

  bty="n",axes=F)

  axis(1,at=1:20,label=rep("",20))

  axis(1,at=1:9,label=sprintf("0%.0f",1:9))

  axis(1,at=10:20,label=10:20)

  Maximum<-max(datenbankdaten[,2],datenbankdaten[,3])

  axis(2,at=0:Maximum,label=sprintf("%.2f",0:Maximum))

  for(i in 1:(length(datenbankdaten[,2])+2)){

abline(h=i-1)

  }

  for(i in 1:20){

if(datenbankdaten[i,2]>=datenbankdaten[i,3]) farbe="red" else
farbe="green"

 
arrows(i,datenbankdaten[i,2],i,datenbankdaten[i,3],col=farbe,length=0,lwd=1.
5)

points(i,datenbankdaten[i,2],pch=22,col="light blue",bg="light
blue",cex=1.7)

 
points(i,datenbankdaten[i,3],pch=21,col="grey",bg="grey",cex=1.5)

  }

  

  for(i in 1:20){

if(datenbankdaten[i,2]>datenbankdaten[i,3])

#dreieck nach oben

 
points(i,datenbankdaten[i,2]-0.1,pch=24,col="red",bg="red")

if(datenbankdaten[i,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] How to chain user mouse handlers in rgl

2008-03-01 Thread Duncan Murdoch
On 01/03/2008 5:41 AM, Dieter Menne wrote:
> Dear Rglers,
> 
> With rgl, I would like to set marker when a button is pressed, but leave the
> standard trackball handling otherwise. Thanks to Duncan and Oleg for helping
> me handling key down.

I don't think there's currently an easy way to do that.  What you would 
have to do is to replicate the trackball handler in yours.  (You can see 
what it does in the src/rglview.cpp in the rgl source.)

If you want to write the R code (and docs for it) to fix this, I'll put 
it into rgl.

Duncan Murdoch

> How do I say in a custom mouse handler "after having done your work, forward
> to standard trackball once only"? The example below shows the idea, but it
> works only once, then reverts to standard trackball handling.
> 
> Dieter
> 
> #--
> library(rgl)
> r3dDefaults
> open3d()
> shade3d(cube3d(color=rep(rainbow(6),rep(4,6
> 
> 
> btn3d <- function() {
>   begin <- function(x, y) {
> # Add checking for key down later
> cat(x,y,"\n")
> # Forward to trackball (no easier way?)
> newhandler <- par3d("mouseMode")
> newhandler[1] <- "trackball"
> par3d(mouseMode =  newhandler)
>}
>rgl.setMouseCallbacks(1, begin)
>  }
> 
> btn3d()
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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] Fwd: Re: How to create following chart for visualizing multivariate time series

2008-03-01 Thread David Winsemius
"Henrique Dallazuanna" <[EMAIL PROTECTED]> wrote in
news:[EMAIL PROTECTED]: 

library(lattice)
levelplot(r, colorkey=list(col=gray((0:32)/32)),
 col.regions=(col=gray((0:32)/32)))

When I try that example, I get an error, even after updating lattice. 

> levelplot(r, colorkey=list(col=gray((0:32)/32)),
+  col.regions=(col=gray((0:32)/32)))
Error in UseMethod("levelplot") : no applicable method for "levelplot"

If I simply change colorkey=FALSE to colorkey=TRUE in the first levelplot 
help page example, I have what looks to me as "success".

levelplot(z~x*y, grid, cuts = 50, scales=list(log="e"), xlab="",
  ylab="", main="Weird Function", sub="with log scales",
  colorkey = TRUE,
  region = TRUE)

-- 
David Winsemius

> 
> On 29/02/2008, Megh Dal <[EMAIL PROTECTED]> wrote:
>> Hi Jim, i think you could not get my point. I did not want to put
>> red-blue color there. I want to put a pallet which will describe 
>> the values of r. please have a look on following :
> http://bp0.blogger.com/_k3l6qPzizGs/RvDVglPknRI/AKo/itlWOvuuO
> tI/s1600-h/pairwise_kl_window60.png. Please see how a color pallate
> is added on the right side of this plot describing the value of red
> color, value of blue color etc. 
>>
>>   Is there any solution?
>>
>>   Regards,
>>
>>
>>  jim holtman <[EMAIL PROTECTED]> wrote:
>>   Try something like this:
>>
>>  require(grDevices) # for colours
>>  x <- y <- seq(-4*pi, 4*pi, len=27)
>>  r <- sqrt(outer(x^2, y^2, "+"))
>>  image(x, y, r, col=gray((0:32)/32))
>>  colors <- colorRampPalette(c('red', 'yellow', 'blue')) # create
>>  you color spectrum
>>  image(x,y,r, col=colors(100))
>>
>>
>>
>> On Thu, Feb 28, 2008 at 9:28 PM, Megh Dal wrote:
>>  > I used ?image function to do that, like below :
>>  >
>>  > require(grDevices) # for colours
>>  > x <- y <- seq(-4*pi, 4*pi, len=27)
>>  > r <- sqrt(outer(x^2, y^2, "+"))
>>  > image(x, y, r, col=gray((0:32)/32))
>>  >
>>  > However my next problem to add a color pallet for color
>>  > description [as shown in following link]. If anyone here tell 
   me how to do that, it will be good for me. 
>>  >
>>
>> > Megh Dal wrote: Hi all,
>>
>> >
>>  > Can anyone here please tell me whether is it possible to produce 
>>  > a chart displayed in http://www.datawolf.blogspot.com/ in R for 
> visualizing multivariate time series? If possible how? 
>>  >
>>  >

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

2008-03-01 Thread Matthias Kohl
Hi Marek,

use a list instead of a data.frame; e.g.

boxplot(list(x = rnorm(10), y = rnorm(20)))

hth,
Matthias

Marek Bartkuhn wrote:
> Hi,
>
> I have data in 3 vectors a,b and c looking like
>
> eg  a:1.2 3.4 1.4 ..
>
>
> I like to have the data from each vector as a boxplot, but the 3  
> boxplots within one graph.
>
> One example is the first graph  at
>
> http://www.statmethods.net/graphs/boxplot.html
>
> Unfortunately I do not really understand the corresponding  
> description. The vectors are of different length, therefore R  
> complains when I try to build a data.frame of the 3 vectors:
>
> arguments imply differing number of rows: 6175, 20, 190
>
> What do I have to do?
>
> Marek
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>   

-- 
Dr. Matthias Kohl
www.stamats.de

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] A question on getting all possible combinations

2008-03-01 Thread Benilton Carvalho

target = c("u", "d")
apply(expand.grid(rep(list(target), 6)), 1, paste, sep="", collapse="")

b

On Mar 1, 2008, at 9:13 AM, Megh Dal wrote:


Hi all,

Suppose I have to letters  'u' and 'd'. Now I want to find all  
combinations like that :


uu
ud
du
.

dd

This type of combination generally required for Option Pricing in  
financial/derivative market. Here generally 'u' means: up-move and  
'd' means down move of price like Stock price etc.


Is there any easy way in R for doing that?

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-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] multiple boxplots using boxplot

2008-03-01 Thread Marek Bartkuhn
Hi,

I have data in 3 vectors a,b and c looking like

eg  a:  1.2 3.4 1.4 ..


I like to have the data from each vector as a boxplot, but the 3  
boxplots within one graph.

One example is the first graph  at

http://www.statmethods.net/graphs/boxplot.html

Unfortunately I do not really understand the corresponding  
description. The vectors are of different length, therefore R  
complains when I try to build a data.frame of the 3 vectors:

arguments imply differing number of rows: 6175, 20, 190

What do I have to do?

Marek

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


Re: [R] Fitting long names in boxplot

2008-03-01 Thread hadley wickham
On Fri, Feb 29, 2008 at 4:40 PM, Alex Reynolds <[EMAIL PROTECTED]> wrote:
> I have the following code:
>
>  subsetTimeDataPlot <- boxplot(subsetTimeData$time ~
>  subsetTimeData$build, horizontal=True, col="lightblue", ...)
>
>  The 'names' component consists of strings that can be up to 20-30
>  characters long.
>
>  How would I go about drawing the names vertically (not the boxplot) or
>  shrinking the names text (I tried cex.names=0.7 but this didn't help).

You might try:

library(ggplot2)
qplot(build, time, data=subsetTimeData, geom="boxplot") + coord_flip()

which will automatically allocate enough space for the names.  You can
find out more about ggplot2 at http://had.co.nz/ggplot2.

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.


[R] How to set up multiple spawns of R?

2008-03-01 Thread Guy Perry
Sorry: resending this; didn't have a title on it.

Trying to set up multiple spawns of R
---

Hi.  I'm new to the list but I have a small problem with R.  I'm trying to
set up multiple spawns of R active at the same time on an AMD with a dual
core in Vista so that I can cut down my permutation processing time.  

I've installed R in multiple places, which I thought was the correct way to
do it but whether I use installs at "C:\Program Files\R1" and "C\...\R2", or
even separately on the C: and D: drive, whenever I try to load my package
(qtl), it gives me the error message:

Error in library(qtl) : there is no package called 'qtl'

The thing is, I've installed the packagen in both places (C\...\R1 and
C\...\R2, or both the C: and D: drives) and it still gives me the message. 
Does anyone know how to set up a simultaneous R spawn?  Clearly I'm wrong
about how to get it started.

Thanks,

G Perry

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/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] Grouping 30 arrays (geographical) of 1000 rows (individuals) by 20 columns (time-series data)

2008-03-01 Thread Ng Stanley
Hi,

I have 30 arrays (geographical) of 1000 rows (individuals) by 20 columns
(time-series data), and need to group arrays that are most similar.

What packages and functions will be useful for this task ?

Thanks
Stanley

[[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 on getting all possible combinations

2008-03-01 Thread Megh Dal
Hi all,

Suppose I have to letters  'u' and 'd'. Now I want to find all combinations 
like that :

uu
ud
du
.

dd

This type of combination generally required for Option Pricing in 
financial/derivative market. Here generally 'u' means: up-move and 'd' means 
down move of price like Stock price etc.

Is there any easy way in R for doing that? 

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.


Re: [R] inheritence in S4

2008-03-01 Thread Martin Morgan
Hi Christophe -- 

I don't know whether there's a particularly elegant way. This works

setClass("A", representation(x="numeric"))
setClass("B", representation(y="numeric"))
setClass("C", contains=c("A", "B"))

setMethod("show", "A", function(object) cat("A\n"))
setMethod("show", "B", function(object) cat("B\n"))
setMethod("show", "C", function(object) {
callGeneric(as(object, "A"))
callGeneric(as(object, "B"))
cat("C\n")
})

> new("C")
A
B
C

but obviously involves the developer in making explicit decisions
about method dispatch when there is multiple inheritance.

Martin

[EMAIL PROTECTED] writes:

> Hi the list
>
> I define a class A (slot a and b), a class C (slot c and d) and a class 
> E that inherit from A and B.
> I define print(A) and print(B). For print(C), I would like to use both 
> of them, but I do not see how...
>
> Thanks for your help...
>
> Christophe
>
> 
> Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre
>
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M2 B169
Phone: (206) 667-2793

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


[R] (no subject)

2008-03-01 Thread Guy Perry
Trying to set up multiple spawns of R
---

Hi.  I'm new to the list but I have a small problem with R.  I'm trying to
set up multiple spawns of R active at the same time on an AMD with a dual
core in Vista so that I can cut down my permutation processing time.  

I've installed R in multiple places, which I thought was the correct way to
do it but whether I use installs at "C:\Program Files\R1" and "C\...\R2", or
even separately on the C: and D: drive, whenever I try to load my package
(qtl), it gives me the error message:

Error in library(qtl) : there is no package called 'qtl'

The thing is, I've installed the packagen in both places (C\...\R1 and
C\...\R2, or both the C: and D: drives) and it still gives me the message. 
Does anyone know how to set up a simultaneous R spawn?  Clearly I'm wrong
about how to get it started.

Thanks,

G Perry

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


Re: [R] Running LaTeX dvi previewer on MacOS X

2008-03-01 Thread Frank E Harrell Jr
Charilaos Skiadas wrote:
> On Feb 29, 2008, at 5:39 PM, Michael wrote:
> 
>> On 29 Feb 2008, Charilaos Skiadas wrote:
>>
>>> On Feb 29, 2008, at 12:38 PM, Michael wrote:
 On 29 Feb 2008, Frank E. Harrell, Jr. wrote:

> Several people have given great advice on how to successfully use
> X11 on
> Mac to so we can use the dvi previewer to view latex() output from
> Hmisc.  Now after a version upgrade of X11 and X11sdk we are  
> getting
> lots of crashes.  I noticed a Mac dvi previewer with an executable
> stored as /Applications/TeX/TeXShop.app/Contents/MacOS/TeXShop
>
> Can we bypass X11 problems and point Hmisc to this executable  
> for dvi
> viewing?
 I think TeXshop converts dvi to pdf (something like dvips ->  
 ps2pdf) for
 viewing. Why not just use pdf for Mac?  Preview.app on Leopard  
 does do
 live updating.
>>> And Skim.app does updating on Tiger, and is IMHO much better to
>>> Preview.app in other ways (works with pdfsync for instance, allows
>>> syncing back and forth between the pdf file and the corresponding tex
>>> source)
>> We were not talking about using TeXshop to edit LaTeX files.   
>> Rather the
>> latex() function Hmisc generates a dvi file and the question is how  
>> to view
>> it since Mac does not have native dvi viewer (other than xdvi).   
>> The pdfsync
>> function of Skim or TeXshop is irrelevant.
> 
> Why is it important that the output file be a dvi file? Would it be a  
> problem to have the latex() function produce a pdf file on mac systems?
> I thought the latex() command was just producing tex code.

This discussion is about previewing the result of latex(), and Hmisc has 
several dvi-related functions.  One could write a similar pdf conversion 
or pdf viewer functions taking as input the result of dvi(latex()). 
Also, I'm trying to just make the mechanisms in Hmisc for latex() that 
work fine on Linux/Unix/Windows work well for Mac users.

Frank


> 
>> Michael
> 
> Haris Skiadas
> Department of Mathematics and Computer Science
> Hanover College
> 
> __
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/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.


[R] bifurcation countings in a cluster dendrogram

2008-03-01 Thread yvo


Dear R helpers,
I am quite new  working with R, and that might be a very easy question for
some of you. So I hope you can help me!! I used a hirarchical cluster
analysis to create dendrograms, like that:

hc <- hclust(dist(USArrests), "ave")
plot(hc)
plot(hc, hang = -1)

Here I want to compare the number of bifurcations for each species, but
therefor I need this numbers first. There should be an elegant way to get
this- instead of counting everything. I would be happy if you could tell me
the solution
Thanks a lot in advance!!!
Yvonne Fabian

-- 
View this message in context: 
http://www.nabble.com/bifurcation-countings-in-a-cluster-dendrogram-tp15773122p15773122.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 chain user mouse handlers in rgl

2008-03-01 Thread Dieter Menne
Dear Rglers,

With rgl, I would like to set marker when a button is pressed, but leave the
standard trackball handling otherwise. Thanks to Duncan and Oleg for helping
me handling key down.

How do I say in a custom mouse handler "after having done your work, forward
to standard trackball once only"? The example below shows the idea, but it
works only once, then reverts to standard trackball handling.

Dieter

#--
library(rgl)
r3dDefaults
open3d()
shade3d(cube3d(color=rep(rainbow(6),rep(4,6


btn3d <- function() {
  begin <- function(x, y) {
# Add checking for key down later
cat(x,y,"\n")
# Forward to trackball (no easier way?)
newhandler <- par3d("mouseMode")
newhandler[1] <- "trackball"
par3d(mouseMode =  newhandler)
   }
   rgl.setMouseCallbacks(1, begin)
 }

btn3d()

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


Re: [R] Fitting long names in boxplot

2008-03-01 Thread Gavin Simpson
On Fri, 2008-02-29 at 14:40 -0800, Alex Reynolds wrote:
> I have the following code:
> 
> subsetTimeDataPlot <- boxplot(subsetTimeData$time ~ 
> subsetTimeData$build, horizontal=True, col="lightblue", ...)
> 
> The 'names' component consists of strings that can be up to 20-30 
> characters long.
> 
> How would I go about drawing the names vertically (not the boxplot) or 
> shrinking the names text (I tried cex.names=0.7 but this didn't help).
> 
> Thanks for any advice, I apologize if these are stupid questions,

Look at ?par and argument/parameter 'las', which controls the
orientation of axis tick labels.

You'll also need to increase the margin size on the side of the plot
holding the labels if they are very long. For this, see ?par again and
parameters 'mar' or 'mai' depending on how you wish to define the margin
size.

## Example
dat <- data.frame(values = rnorm(100), group = gl(2, 50))
levels(dat$group) <- c("reallyreallylonglabel", 
   "anevenlongerlabel")
## las = 1 gets y-axis labels horizontal, but note note enough room
boxplot(values ~ group, data = dat, horizontal = TRUE, las = 1)

## so change the margin on the left (no. 2)
## default is c(5, 4, 4, 2) + 0.1
## and shrink text size so we don't need a huge margin
op <- par(mar = c(5, 10, 4, 2) + 0.1)
boxplot(values ~ group, data = dat, horizontal = TRUE, las = 1, 
cex.axis = 0.7)
## reset the plotting parameters
par(op)

HTH

G
> 
> -Alex
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.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.


Re: [R] Make plots with GNUplot. Have anyone tried that?

2008-03-01 Thread Gabor Csardi
On Sat, Mar 01, 2008 at 12:54:56AM +0100, Louise Hoffman wrote:
> >  If you still want to then read ?write.table, that can export your data
> >  into a spreadsheet-like ascii format which can be used from GNUplot
> >  easily.
> 
> Very interesting.
> 
> So if I e.g. write:
> ts.sim <- arima.sim(list(order = c(1,1,0), ar = 0.7), n = 200)
> ts.plot(ts.sim)
> 
> How do I know the names of the rows to put in the data.frame() command?

??? Which data.frame() command? 
(Btw. now you're trying to plot from R?)

> >  Btw, comparing the graphics capabilities of GNUplot and R, it is
> >  something like a three-wheel bicycle and a spaceship. Guess
> >  which is which.
> 
> =) I know that I will most likely spend a lot of time on just making
> the plots, but I atleast (for now =) ) think it could be fun to try.

For you maybe, not for me. I'm lost, and I apologize, but I'll quit
the discussion here.

G.

ps. i take back half of what i've said about GNUplot. It's a nice tool.
Still, IMHO, (in most cases) it makes no sense to export data from R and
plot it with GNUplot. 

-- 
Csardi Gabor <[EMAIL PROTECTED]>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.


[R] "Raw" histogram plots

2008-03-01 Thread Antony Unwin
Why not use the interactive histogram in iplots?  ihist(x)  Then you  
can vary the binwidth interactively and get a very quick idea of the  
structure of your data by looking at a range of plots with different  
binwidths.  Relying on a single plot to reveal everything about a  
variable's distribution is not a good idea.

A couple of people suggested estimating the density.  That may miss  
roundings, discretisation or other odd structures.  We should never  
underestimate what Peter Huber called "the rawness of raw data".

Antony Unwin
Professor of Computer-Oriented Statistics and Data Analysis,
Mathematics Institute,
University of Augsburg,
Germany




[[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] Newbie: Incorrect number of dimensions

2008-03-01 Thread Keizer_71

> dim(data.sub)
[1] 1   140

#extracting all differentially express genes##
library(multtest)
two_side<- (1-pt(abs(data.sub),50))*2
diff<- mt.rawp2adjp(two_side)
all_differ<-diff[[1]][37211:1,]
all_differ

#list of differentially expressed genes##
> probe.names<-
+ all_differ[[2]][all_differ[[1]][,"BY"]<=0.01]

Error in all_differ[[1]][, "BY"] : incorrect number of dimensions

Hi,

I am pretty new with R. What i am trying to do is to find all differentially
express genes and list of differentially expressed genes. Am i doing
something wrong?

I keep getting incorrect number of dimensions. How do i find out the correct
dimensions? 

thanks,
Keizer

-- 
View this message in context: 
http://www.nabble.com/Newbie%3A-Incorrect-number-of-dimensions-tp15773090p15773090.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] Plotting Dendrogram Help Getting Plot to Display Neatly

2008-03-01 Thread Jim Lemon
[EMAIL PROTECTED] wrote:
> I have done a cluster analysis doing:
> 
> 1-clusNorth <-hclust(dist(Artorious)^2, method="ward")
> 2-clusNorth$labels <-Artorious$Name   ## to show the case names and not
> numbers
> 3-dend1 <- as.dendrogram(clusNorth)
> 4-plot(dend1)
> 
> My Dendrogram is now showing the names of my cases in the dataframe on
> the x axis
> 
> 1OMNICELL INC COM  
> 2GETTY IMAGES INC COM 
> 3 INTERCONTINENTALEXCHANGE IN COM
> 4 OPTIONSXPRESS HLDGS INC COM  
> 5  SUPERIOR WELL SVCS INC COM 
> 6 HCP INC COM  
> 7  SENIOR HSG PPTYS TR SH BEN INT  
> 8 NATIONWIDE HEALTH PPTYS INC COM  
> 9DUKE REALTY CORP COM NEW  
> 10   HEALTH CARE REIT INC COM  
> 11   POWERSHARES QQQ TRUST UNIT SER 1  
> 12   FLEXTRONICS INTL LTD ORD  
> 13 VENTAS INC COM
> 
> 
> However with 60 cases the names above are not fitting neatly into plot.
> Can someone advice on plot
> Parameters to fix the size of dendrogram and see the full names on X
> axis?
> 
Hi Neil,
If the names are not too crowded, staxlab in the plotrix package might 
do it.

Jim

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