[R] Regarding Bivariate normal distribution.

2007-07-25 Thread Arun Kumar Saha
Dear all R gurus,

My question is related to statistics rather directly to R. Suppose
(X,Y) has a bivariate normal distrubution. I want to find two values
of X and Y say x, and y respectively, such that:

P[Xx, Yy] = 0.05

My questions are :

1. Can x and y be uniquely found?
2. If it is, how I can find them using R

Your help will be highly appreciated.

Thanks and regards,

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] lme or gls prediction intervals

2007-07-25 Thread joris . dewolf


Martin,


Have you checked ?intervals.gls


This intervals are approximate, but this would be the obvious starting
point to me.


Joris










   
 Martin Henry H.  
 Stevens  
 [EMAIL PROTECTED]  To 
 edu  R-Help r-help@stat.math.ethz.ch   
 Sent by:   cc 
 [EMAIL PROTECTED] 
 at.math.ethz.ch   Subject 
   [R] lme or gls prediction intervals 
   
 24/07/2007 19:22  
   
   
   
   




Hi folks,
I am trying to generate 95% confidence intervals for a gls model
using predict.nlme
with
R version 2.5.1 (2007-06-27)
. nlme: Linear  and Nonlinear Mixed Effects Models. R package version
   3.1-83.

I have looked in help, and I can do it for lm and glm models, and I
can generate simple predictions for lme models with various levels --
I am familiar with the basics.

Is there a way to get prediction intervals for gls models? My best
model uses varPower(), so I am reluctant to fall back on lm predictions.

Thank you,

Hank


Dr. Hank Stevens, Associate Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/~stevenmh/
http://www.muohio.edu/ecology/
http://www.muohio.edu/botany/

E Pluribus Unum

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] values from a linear model

2007-07-25 Thread Manuele Pesenti
On Tuesday 24 July 2007 12:02:58 Manuele Pesenti wrote:
 Dear R users,
 how can I extrapolate values listed in the summary of an lm model but not
 directly available between object values such as the the standard errors of
 the calculated parameters?

thank you very much for all interesting answer
:)

Manuele



-- 
Manuele Pesenti
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://mpesenti.polito.it

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 use replace for efficiency

2007-07-25 Thread willem vervoort
Hi

I think I have been struggling to use replace correctly, I usually
work my way around this using a loop, but I think this is in fact
inefficient.

I have a dataset with runoff from three plots and associated rainfall.
However either the datarecording was sloppy, or the rainfall very
patchy. So I am trying to remove data from my dataset for which the
runoff is larger than the rainfall on the same day. (Don't worry, the
rainfall data is in fact the rainfall associated to the three days
around the runoff event). On days that no runoff was recorded the data
includes NA

The dataset is called wheat2
I use the following:
for (i in 1:nrow(wheat2)) {
# Insert NA's if runoff data  rainfall data
if (is.na(wheat2[i,5:7])==FALSE  any(wheat2[i,5:7]wheat2[i,8])) {
wheat2[i,5:7] - NA
}
}

I tried this:
wheat1 - replace(wheat2[,5:7],is.na(wheat2[i,5:7])==FALSE 
any(wheat2[i,5:7]wheat2[i,8]),NA)
wheat3 - cbind(wheat2[1:4],wheat1,wheat2[,8])

 wheat3[5539,] # the culprit row
DateRain  Rain  StartDate  EndDate  RO.A RO.B RO.C filtered.Rain
5539 28-Feb-580 27-Feb-58 28-Feb-5861.588.7
  65   0

Not sure what I am doing wrong, any help is appreciated

Willem

Here is a data sample and note the very high value for runoff (RO) and
no rainfall on 28 Feb 1958

DateRain  Rain  StartDate  EndDate  RO.A RO.B RO.C filtered.Rain
14-Feb-58 0   NA NA NA 0
15-Feb-58 0   NA NA NA 0
16-Feb-58 0   NA NA NA 0
17-Feb-58 0   NA NA NA 0
18-Feb-58 0 18-Feb-58 18-Feb-58 0 0 0 23.6
19-Feb-58 23.6   NA NA NA 23.6
20-Feb-58 0   NA NA NA 23.6
21-Feb-58 0   NA NA NA 0
22-Feb-58 0   NA NA NA 0
23-Feb-58 0   NA NA NA 0
24-Feb-58 0   NA NA NA 0
25-Feb-58 0   NA NA NA 0
26-Feb-58 0   NA NA NA 0
27-Feb-58 0   NA NA NA 0
28-Feb-58 0 27-Feb-58 28-Feb-58 61.5 88.7 65 0
01-Mar-58 0   NA NA NA 0
02-Mar-58 0   NA NA NA 0
03-Mar-58 0   NA NA NA 0
04-Mar-58 0   NA NA NA 1.5
05-Mar-58 1.5   NA NA NA 1.5
06-Mar-58 0   NA NA NA 1.5
07-Mar-58 0   NA NA NA 0.5
08-Mar-58 0.5   NA NA NA 0.5
09-Mar-58 0   NA NA NA 7.6
10-Mar-58 7.1   NA NA NA 9.1
11-Mar-58 2   NA NA NA 57.4
12-Mar-58 48.3 09-Mar-58 12-Mar-58 0.1 1.5 0 51.1
13-Mar-58 0.8   NA NA NA 49.9
14-Mar-58 0.8   NA NA NA 1.6

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 use replace for efficiency

2007-07-25 Thread Felix Andrews
You don't need to use 'replace', just use indexing in the assignment:

isCrap - apply((wheat2[,5:7]  wheat2[,8]), 1, any)
wheat2[isCrap,5:7] - NA

Felix

On 7/25/07, willem vervoort [EMAIL PROTECTED] wrote:
 Hi

 I think I have been struggling to use replace correctly, I usually
 work my way around this using a loop, but I think this is in fact
 inefficient.

 I have a dataset with runoff from three plots and associated rainfall.
 However either the datarecording was sloppy, or the rainfall very
 patchy. So I am trying to remove data from my dataset for which the
 runoff is larger than the rainfall on the same day. (Don't worry, the
 rainfall data is in fact the rainfall associated to the three days
 around the runoff event). On days that no runoff was recorded the data
 includes NA

 The dataset is called wheat2
 I use the following:
 for (i in 1:nrow(wheat2)) {
 # Insert NA's if runoff data  rainfall data
 if (is.na(wheat2[i,5:7])==FALSE  any(wheat2[i,5:7]wheat2[i,8])) {
 wheat2[i,5:7] - NA
 }
 }

 I tried this:
 wheat1 - replace(wheat2[,5:7],is.na(wheat2[i,5:7])==FALSE 
 any(wheat2[i,5:7]wheat2[i,8]),NA)
 wheat3 - cbind(wheat2[1:4],wheat1,wheat2[,8])

  wheat3[5539,] # the culprit row
 DateRain  Rain  StartDate  EndDate  RO.A RO.B RO.C filtered.Rain
 5539 28-Feb-580 27-Feb-58 28-Feb-5861.588.7
   65   0

 Not sure what I am doing wrong, any help is appreciated

 Willem

 Here is a data sample and note the very high value for runoff (RO) and
 no rainfall on 28 Feb 1958

 DateRain  Rain  StartDate  EndDate  RO.A RO.B RO.C filtered.Rain
 14-Feb-58 0   NA NA NA 0
 15-Feb-58 0   NA NA NA 0
 16-Feb-58 0   NA NA NA 0
 17-Feb-58 0   NA NA NA 0
 18-Feb-58 0 18-Feb-58 18-Feb-58 0 0 0 23.6
 19-Feb-58 23.6   NA NA NA 23.6
 20-Feb-58 0   NA NA NA 23.6
 21-Feb-58 0   NA NA NA 0
 22-Feb-58 0   NA NA NA 0
 23-Feb-58 0   NA NA NA 0
 24-Feb-58 0   NA NA NA 0
 25-Feb-58 0   NA NA NA 0
 26-Feb-58 0   NA NA NA 0
 27-Feb-58 0   NA NA NA 0
 28-Feb-58 0 27-Feb-58 28-Feb-58 61.5 88.7 65 0
 01-Mar-58 0   NA NA NA 0
 02-Mar-58 0   NA NA NA 0
 03-Mar-58 0   NA NA NA 0
 04-Mar-58 0   NA NA NA 1.5
 05-Mar-58 1.5   NA NA NA 1.5
 06-Mar-58 0   NA NA NA 1.5
 07-Mar-58 0   NA NA NA 0.5
 08-Mar-58 0.5   NA NA NA 0.5
 09-Mar-58 0   NA NA NA 7.6
 10-Mar-58 7.1   NA NA NA 9.1
 11-Mar-58 2   NA NA NA 57.4
 12-Mar-58 48.3 09-Mar-58 12-Mar-58 0.1 1.5 0 51.1
 13-Mar-58 0.8   NA NA NA 49.9
 14-Mar-58 0.8   NA NA NA 1.6

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



-- 
Felix Andrews / 安福立
PhD candidate
Integrated Catchment Assessment and Management Centre
The Fenner School of Environment and Society
The Australian National University (Building 48A), ACT 0200
Beijing Bag, Locked Bag 40, Kingston ACT 2604
http://www.neurofractal.org/felix/
voice:+86_1051404394 (in China)
mobile:+86_13522529265 (in China)
mobile:+61_410400963 (in Australia)
xmpp:[EMAIL PROTECTED]
3358 543D AAC6 22C2 D336  80D9 360B 72DD 3E4C F5D8

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Regarding Bivariate normal distribution.

2007-07-25 Thread Viechtbauer Wolfgang (STAT)
No, x and y are not unique. In fact, there is an infinite number of x and y 
pairs that are roots to the equation P[Xx, Yy] = 0.05.

-- 
Wolfgang Viechtbauer 
 Department of Methodology and Statistics 
 University of Maastricht, The Netherlands 
 http://www.wvbauer.com/ 



-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Arun Kumar Saha
Sent: Wednesday, July 25, 2007 08:58
To: r-help@stat.math.ethz.ch
Subject: [R] Regarding Bivariate normal distribution.


Dear all R gurus,

My question is related to statistics rather directly to R. Suppose
(X,Y) has a bivariate normal distrubution. I want to find two values of X and Y 
say x, and y respectively, such that:

P[Xx, Yy] = 0.05

My questions are :

1. Can x and y be uniquely found?
2. If it is, how I can find them using R

Your help will be highly appreciated.

Thanks and regards,

__
R-help@stat.math.ethz.ch mailing list 
https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Regarding Bivariate normal distribution.

2007-07-25 Thread gyadav

Hi Arun

i hope you will fin this document useful :)
http://www.geocities.com/~mikemclaughlin/math_stat/Dists/Compendium.pdf

no they cannot be found uniquely. as rightly pointed by Mr. Wolfgang, that 
there will be infinite pairs for each x you can get correspoinding y

above document will be of use :)


Regards,

Gaurav Yadav
+++
Assistant Manager, CCIL, Mumbai (India)
Mob: +919821286118 Email: [EMAIL PROTECTED]
Bhagavad Gita:  Man is made by his Belief, as He believes, so He is



Arun Kumar Saha [EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED]
07/25/2007 12:27 PM

To
r-help@stat.math.ethz.ch R-help@stat.math.ethz.ch
cc

Subject
[R] Regarding Bivariate normal distribution.






Dear all R gurus,

My question is related to statistics rather directly to R. Suppose
(X,Y) has a bivariate normal distrubution. I want to find two values
of X and Y say x, and y respectively, such that:

P[Xx, Yy] = 0.05

My questions are :

1. Can x and y be uniquely found?
2. If it is, how I can find them using R

Your help will be highly appreciated.

Thanks and regards,

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




DISCLAIMER AND CONFIDENTIALITY CAUTION:\ \ This message and ...{{dropped}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Strange warning in summary.lm

2007-07-25 Thread ONKELINX, Thierry
Dear Peter, Uwe and Brian,

I've found some more problems with options(OutDec = ,).

1) as.numeric yields NA where it shouldn't

 z - c(12, 12,34, 12.34)
 options(OutDec = ,)
 as.numeric(z)
[1] 12,00NA 12,34
Warning message:
NAs introduced by coercion in: as.double.default(z) 

# should result in c(12, 12.34, NA)

 options(OutDec = .)
 as.numeric(z)
[1] 12.00NA 12.34
Warning message:
NAs introduced by coercion in: as.double.default(z) 


2) anova yields the same warning as summary

 x - runif(100)
 y - rnorm(100)
 options(OutDec = ,)
 summary(lm(y~x))

Call:
lm(formula = y ~ x)

Residuals:
 Min   1Q   Median   3Q  Max 
-2,81744 -0,61680  0,02107  0,66309  2,20599 

Coefficients:
 Estimate Std. Error t value Pr(|t|)
(Intercept) -0,073531   0,195880  -0,3750,708
x0,007519   0,318159   0,0240,981

Residual standard error: 0,9795 on 98 degrees of freedom
Multiple R-Squared: 5.699e-06,  Adjusted R-squared: -0.0102 
F-statistic: 0.0005585 on 1 and 98 DF,  p-value: 0,9812 

Warning message:
NAs introduced by coercion in: as.double.default(Cf[okP]) 
 anova(lm(y~x))
Analysis of Variance Table

Response: y
  Df Sum Sq Mean Sq F value Pr(F)
x  1  0,001   0,001   6e-04 0,9812
Residuals 98 94,031   0,960   
Warning message:
NAs introduced by coercion in: as.double.default(Cf[okP]) 

Cheers,

Thierry



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and 
Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology 
and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
[EMAIL PROTECTED]
www.inbo.be 

Do not put your faith in what statistics say until you have carefully 
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of 
uncertainties, a surgery of suppositions. ~M.J.Moroney

 

 -Oorspronkelijk bericht-
 Van: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] Namens ONKELINX, Thierry
 Verzonden: donderdag 19 juli 2007 13:56
 Aan: Peter Dalgaard
 CC: r-help@stat.math.ethz.ch; Uwe Ligges
 Onderwerp: Re: [R] Strange warning in summary.lm
 
 Dear Peter,
 
 Here's an example. Notice the warning in the last two lines 
 of the summary with options(OutDec = ,). It's not present 
 with options(OutDec = .).
 
 Cheers,
 
 Thierry
 
  x - runif(100)
  y - rnorm(100)
  options(OutDec = ,)
  summary(lm(y~x))
 
 Call:
 lm(formula = y ~ x)
 
 Residuals:
   Min1QMedian3Q   Max 
 -2,389749 -0,607002  0,006969  0,689535  1,713197 
 
 Coefficients:
 Estimate Std. Error t value Pr(|t|)
 (Intercept)  0,033970,17774   0,1910,849
 x   -0,092190,29518  -0,3120,755
 
 Residual standard error: 0,868 on 98 degrees of freedom 
 Multiple R-Squared: 0.0009943,  Adjusted R-squared: -0.0092
 F-statistic: 0.09754 on 1 and 98 DF,  p-value: 0,7555 
 
 Warning message:
 NAs introduced by coercion in: as.double.default(Cf[okP]) 
  options(OutDec = .)
  summary(lm(y~x))
 
 Call:
 lm(formula = y ~ x)
 
 Residuals:
   Min1QMedian3Q   Max 
 -2.389749 -0.607002  0.006969  0.689535  1.713197 
 
 Coefficients:
 Estimate Std. Error t value Pr(|t|)
 (Intercept)  0.033970.17774   0.1910.849
 x   -0.092190.29518  -0.3120.755
 
 Residual standard error: 0.868 on 98 degrees of freedom 
 Multiple R-Squared: 0.0009943,  Adjusted R-squared: -0.0092
 F-statistic: 0.09754 on 1 and 98 DF,  p-value: 0.7555 
 
 
 --
 --
 ir. Thierry Onkelinx
 Instituut voor natuur- en bosonderzoek / Research Institute 
 for Nature and Forest
 Cel biometrie, methodologie en kwaliteitszorg / Section 
 biometrics, methodology and quality assurance
 Gaverstraat 4
 9500 Geraardsbergen
 Belgium
 tel. + 32 54/436 185
 [EMAIL PROTECTED]
 www.inbo.be 
 
 Do not put your faith in what statistics say until you have 
 carefully considered what they do not say.  ~William W. Watt
 A statistical analysis, properly conducted, is a delicate 
 dissection of uncertainties, a surgery of suppositions. ~M.J.Moroney
 
  
 
  -Oorspronkelijk bericht-
  Van: Peter Dalgaard [mailto:[EMAIL PROTECTED] 
  Verzonden: donderdag 19 juli 2007 13:37
  Aan: ONKELINX, Thierry
  CC: Uwe Ligges; r-help@stat.math.ethz.ch
  Onderwerp: Re: [R] Strange warning in summary.lm
  
  ONKELINX, Thierry wrote:
   The problem also exists in a clean workspace. But I've found the 
   troublemaker. I had set options(OutDec = ,). Resetting this to 
   options(OutDec = .) solved the problem.
  
   Thanks,
  
   Thierry
 
  Oups. That sounds like there's a bug somewhere. Can you cook 
  up a minimal example which shows the behaviour?
  
  -- 
 O__   Peter Dalgaard Øster Farimagsgade 5, 

[R] A problem with anova()

2007-07-25 Thread Michal Kneifl
I fitted tree growth data with Chapman-Richards growth function using nls.

summary(CR)

Formula: HEIGHT ~ A * (1 - exp(-B * AGE))^C

Parameters:
   Estimate Std. Error t value Pr(|t|)
A 29.007627   0.270485  107.24   2e-16 ***
B  0.030813   0.001095   28.13   2e-16 ***
C  1.849405   0.068659   26.94   2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 

Residual standard error: 1.879 on 713 degrees of freedom

Algorithm port, convergence message: relative convergence (4) 

When I try to run the anova90 function I get this:

anova(CR)
Error in anova.nls(CR) : anova is only defined for sequences of nls objects

Could you tell me what the problem is?

Thanks

Michael
[[alternative HTML version deleted]]

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


[R] Ggplot2 equivalent of axis and problem with log scale

2007-07-25 Thread ONKELINX, Thierry
Dear useRs,

Recently I've discorved ggplot2 and I must say that I really like it,
although the documentation still is a working in progress.

My first question: How can I change the position of the labels and the
text of the labels? With a basic plot I would use axis(2, at =
position.of.the.ticks, labels = text.at.the.ticks). Could someone
provide me with an example of how to do this with ggplot2?

The second question is probably a little bug. If I plot the y-axis in
log10 scale then geom_errorbar still plot the values in the original
scale. See the example below. The second plot is what I would suspect
when plotting the first graph.

library(ggplot2)
df - data.frame(x = rep(1:10, 10), y = rnorm(100))
df$y - 10 ^ (df$x + df$y)
df - cbind(df, predict(lm(I(log10(y)) ~ x, data = df), interval = c))
df[, 3:5] - 10 ^ df[, 3:5]

ggplot(data = df, aes(x = x, y = y)) + geom_point() + scale_y_log10() +
geom_line(aes(y = fit)) + geom_errorbar(aes(min = lwr, max = upr))

ggplot(data = df, aes(x = x, y = y)) + geom_point() + scale_y_log10() +
geom_line(aes(y = fit)) + geom_errorbar(aes(min = log10(lwr), max =
log10(upr)))

Thanks,

Thierry



ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium
tel. + 32 54/436 185
[EMAIL PROTECTED]
www.inbo.be 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt
A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] options(OutDec) etc {was Strange warning in summary.lm}

2007-07-25 Thread Martin Maechler
Without going into your details,
I think  options() should NEVER influence what as.numeric() does
(which I think you are indirectly suggesting it should).

In my eyes, using a decimal comma instead of decimal point in
scientific computing is an abomination in itself.

Providing an  option for  *output* is one thing,
but having it influence basic R engine functions like
as.numeric(), format(), ...
is an absolute NO!_NO!  for me.
So I am strongly opposed to an 'InDec' option as was mentioned
earlier in this thread.

We could consider adding a 'dec' (or 'decimal.sep')
*argument* to some R functions,
but such an argument must default to .  rather than yet
another option.

R should remain as *functional* as possible.
== options() should be used sparingly.

They should only influence printed output at most, not
computations per se. 
Of course I know that this is not strictly possible since the
computations can use textConnection() etc..

Martin Maechler, ETH Zurich
  

 OT == ONKELINX, Thierry [EMAIL PROTECTED]
 on Wed, 25 Jul 2007 11:04:43 +0200 writes:

OT Dear Peter, Uwe and Brian,
OT I've found some more problems with options(OutDec = ,).

OT 1) as.numeric yields NA where it shouldn't

 z - c(12, 12,34, 12.34)
 options(OutDec = ,)
 as.numeric(z)
OT [1] 12,00NA 12,34
OT Warning message:
OT NAs introduced by coercion in: as.double.default(z) 

OT # should result in c(12, 12.34, NA)

 options(OutDec = .)
 as.numeric(z)
OT [1] 12.00NA 12.34
OT Warning message:
OT NAs introduced by coercion in: as.double.default(z) 


OT 2) anova yields the same warning as summary

 x - runif(100)
 y - rnorm(100)
 options(OutDec = ,)
 summary(lm(y~x))

OT Call:
OT lm(formula = y ~ x)

OT Residuals:
OT Min   1Q   Median   3Q  Max 
OT -2,81744 -0,61680  0,02107  0,66309  2,20599 

OT Coefficients:
OT Estimate Std. Error t value Pr(|t|)
OT (Intercept) -0,073531   0,195880  -0,3750,708
OT x0,007519   0,318159   0,0240,981

OT Residual standard error: 0,9795 on 98 degrees of freedom
OT Multiple R-Squared: 5.699e-06,  Adjusted R-squared: -0.0102 
OT F-statistic: 0.0005585 on 1 and 98 DF,  p-value: 0,9812 

OT Warning message:
OT NAs introduced by coercion in: as.double.default(Cf[okP]) 
 anova(lm(y~x))
OT Analysis of Variance Table

OT Response: y
OT Df Sum Sq Mean Sq F value Pr(F)
OT x  1  0,001   0,001   6e-04 0,9812
OT Residuals 98 94,031   0,960   
OT Warning message:
OT NAs introduced by coercion in: as.double.default(Cf[okP]) 

OT Cheers,

OT Thierry


OT 

OT ir. Thierry Onkelinx
OT Instituut voor natuur- en bosonderzoek / Research Institute for Nature 
and Forest
OT Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, 
methodology and quality assurance
OT Gaverstraat 4
OT 9500 Geraardsbergen
OT Belgium
OT tel. + 32 54/436 185
OT [EMAIL PROTECTED]
OT www.inbo.be 

OT Do not put your faith in what statistics say until you have carefully 
considered what they do not say.  ~William W. Watt
OT A statistical analysis, properly conducted, is a delicate dissection of 
uncertainties, a surgery of suppositions. ~M.J.Moroney

 

 -Oorspronkelijk bericht-
 Van: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] Namens ONKELINX, Thierry
 Verzonden: donderdag 19 juli 2007 13:56
 Aan: Peter Dalgaard
 CC: r-help@stat.math.ethz.ch; Uwe Ligges
 Onderwerp: Re: [R] Strange warning in summary.lm
 
 Dear Peter,
 
 Here's an example. Notice the warning in the last two lines 
 of the summary with options(OutDec = ,). It's not present 
 with options(OutDec = .).
 
 Cheers,
 
 Thierry
 
  x - runif(100)
  y - rnorm(100)
  options(OutDec = ,)
  summary(lm(y~x))
 
 Call:
 lm(formula = y ~ x)
 
 Residuals:
 Min1QMedian3Q   Max 
 -2,389749 -0,607002  0,006969  0,689535  1,713197 
 
 Coefficients:
 Estimate Std. Error t value Pr(|t|)
 (Intercept)  0,033970,17774   0,1910,849
 x   -0,092190,29518  -0,3120,755
 
 Residual standard error: 0,868 on 98 degrees of freedom 
 Multiple R-Squared: 0.0009943,  Adjusted R-squared: -0.0092
 F-statistic: 0.09754 on 1 and 98 DF,  p-value: 0,7555 
 
 Warning message:
 NAs introduced by coercion in: as.double.default(Cf[okP]) 
  options(OutDec = .)
  summary(lm(y~x))
 
 Call:
 lm(formula = y ~ x)
 
 Residuals:
 Min1QMedian3Q   Max 
 -2.389749 -0.607002  0.006969  0.689535  1.713197 
 
 Coefficients:
 Estimate Std. Error t value Pr(|t|)
 (Intercept)  0.03397

[R] plots

2007-07-25 Thread amna khan
Hi Sir

I did not find any function of graph which plot one variable on x-axis and 2
or more than 2 variables on y-axis.
Moreover, how can I change the labels of L-moments diagram obtained by
plotlmrdia(lmrdia())

Thank you

-- 
AMINA SHAHZADI
Department of Statistics
GC University Lahore, Pakistan.
Email:
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Strange warning in summary.lm

2007-07-25 Thread Prof Brian Ripley
On Wed, 25 Jul 2007, ONKELINX, Thierry wrote:

 Dear Peter, Uwe and Brian,

 I've found some more problems with options(OutDec = ,).

 1) as.numeric yields NA where it shouldn't

It should: where does it say otherwise?  OutDec affects output, only.


 z - c(12, 12,34, 12.34)
 options(OutDec = ,)
 as.numeric(z)
 [1] 12,00NA 12,34
 Warning message:
 NAs introduced by coercion in: as.double.default(z)

 # should result in c(12, 12.34, NA)

 options(OutDec = .)
 as.numeric(z)
 [1] 12.00NA 12.34
 Warning message:
 NAs introduced by coercion in: as.double.default(z)


 2) anova yields the same warning as summary

It does not in current R: try any fairly recent version of R-devel.

Please don't keep reporting a problem we have already fixed, as the FAQ 
and the posting guide explicitly ask of you.

[...]


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Obtaining summary of frequencies of value occurrences for a variable in a multivariate dataset.

2007-07-25 Thread Allan Kamau
A subset of the data looks as follows

 df[1:10,14:20]
   PR10 PR11 PR12 PR13 PR14 PR15 PR16
1 VTIKVGD
2 VSIKVGG
3 VTIRVGG
4 VSIKIGG
5 VSIKVGG
6 VSIRVGG
7 VTIKIGG
8 VSIKVEG
9 VSIKVGG
10VSIKVGG

The result I would like is as follows

PR10PR11  PR12   ...
[V:10][S:7,T:3][I:10]

The result can be in a matrix or a vector and each variablename, value and 
frequency should be accessible so as to be used for comparisons with another 
dataset later.
The frequency can be a count or a percentage.


Allan.


- Original Message 
From: Adaikalavan Ramasamy [EMAIL PROTECTED]
To: Allan Kamau [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Sent: Tuesday, July 24, 2007 10:21:51 PM
Subject: Re: [R] Obtaining summary of frequencies of value occurrences for a 
variable in a multivariate dataset.

The name of the table should give you the value. And if you have a 
matrix, you just need to convert it into a vector first.

  m - matrix( LETTERS[ c(1:3, 3:5, 2:4) ], nc=3 )
  m
  [,1] [,2] [,3]
[1,] A  C  B
[2,] B  D  C
[3,] C  E  D
  tb - table( as.vector(m) )
  tb

A B C D E
1 2 3 2 1
  paste( names(tb), :, tb, sep= )
[1] A:1 B:2 C:3 D:2 E:1

If this is not what you want, then please give a simple example.

Regards, Adai



Allan Kamau wrote:
 Hi all,
 If the question below as been answered before I
 apologize for the posting.
 I would like to get the frequencies of occurrence of
 all values in a given variable in a multivariate
 dataset. In short for each variable (or field) a
 summary of values contained with in a value:frequency
 pair, there can be many such pairs for a given
 variable. I would like to do the same for several such
 variables.
 I have used table() but am unable to extract the
 individual value and frequency values.
 Please advise.
 
 Allan.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 gam models

2007-07-25 Thread Lucia Zarauz

Hi again,

I have found a post in R.help archives made from someone who had the same 
problem when exporting the smooth function estimate got from a GAM, to plot it 
into another graphic software 
(http://finzi.psych.upenn.edu/R/Rhelp02a/archive/23136.html)

However, I haven't found any reply to this post. 

She suggested the function preplot() and I have hound that function in gam 
package, but not in mgcv package. Is it possible to do this in mgcv package or 
do I have to move to gam package?

Thank you very much

Lucía zarauz


_ 
AZTI - TecnaliaLucia Zarauz 
AZTI - Tecnalia / Unidad de Investigación Marina
Herrera kaia portualdea z/g
20110 Pasaia (Gipuzkoa)
Tel: 943 004 800 - Fax: 943 004 801
e-mail: [EMAIL PROTECTED]
www.azti.es ; www.tecnalia.info  

_ 

  

 LEGE OHARRA  AVISO LEGAL  
DISCLAIMER 


Mezu hau pertsonala eta isilpekoa da eta baimenik gabeko erabilera debekatua 
dago legalki. Jasotzailea ez bazara ezabatu mezua, bidali eta kontserbatu gabe. 


Este mensaje es personal y confidencial y su uso no autorizado está prohibido 
legalmente. Si usted no es el destinatario, proceda a borrarlo, sin reenviarlo 
ni conservarlo.


This message is personal and confidential, unauthorised use is legally 
prohibited. If you are not the intended recipient, delete it without resending 
or backing it.

-Mensaje original-
De: Lucia Zarauz 
Enviado el: martes, 24 de julio de 2007 13:53
Para: 'Henrique Dallazuanna'
CC: r-help@stat.math.ethz.ch
Asunto: RE: [R] plotting gam models

Hi Henrique,

Thank you for your suggestion. 

Actually, I have already tried it, but I am confused because the plot I get is 
not the same as the output of plot(model) or plot.gam(model). The yaxis is 
different

On the other hand, if I build a more complex model, as for example:

model- gam(x ~ s(lat,long) + s(temperature))

I would like to extract the information to build the effects for each 
explanatory factor (one graph for s(lat,long) and another for s(temperature)), 
as R does when you use 'plot(model)' and you press return for subsequent pages.

My final aim is to plot the influence of s(lat,long) as a contourplot 
superposed on a geographical map. Maybe there is an easier way to do it...

Thank you very much

lucía



_ 
Lucia Zarauz 
AZTI - Tecnalia / Unidad de Investigación Marina
Herrera kaia portualdea z/g
20110 Pasaia (Gipuzkoa)
Tel: 943 004 800 - Fax: 943 004 801
e-mail: [EMAIL PROTECTED]
www.azti.es ; www.tecnalia.info
_ 
  
 LEGE OHARRA  AVISO LEGAL  
DISCLAIMER 
Mezu hau pertsonala eta isilpekoa da eta baimenik gabeko erabilera debekatua 
dago legalki. Jasotzailea ez bazara ezabatu mezua, bidali eta kontserbatu gabe. 
Este mensaje es personal y confidencial y su uso no autorizado está prohibido 
legalmente. Si usted no es el destinatario, proceda a borrarlo, sin reenviarlo 
ni conservarlo.
This message is personal and confidential, unauthorised use is legally 
prohibited. If you are not the intended recipient, delete it without resending 
or backing it.


De: Henrique Dallazuanna [mailto:[EMAIL PROTECTED] 
Enviado el: martes, 24 de julio de 2007 13:36
Para: Lucia Zarauz
CC: r-help@stat.math.ethz.ch
Asunto: Re: [R] plotting gam models

see ?predict.gam

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O 
On 24/07/07, Lucia Zarauz [EMAIL PROTECTED] wrote:

Hi everybody,

I am working with gams and I have found some questions when plotting gams 
models.

I am using mgcv, and my model looks something like this:

model- gam(x ~ s(lat,long))

I can plot the output of the model using plot(model) or plot.gam(model) and I 
get a surface plot.

That is ok, but what I want to do now is to extract the data used to perform 
the surface plot. Like that I would be able to superpose them to a geographical 
map, and to plot these data using other programs. 

Thank you very much in advance

Lucía
_
Lucia Zarauz
AZTI - Tecnalia / Unidad de Investigación Marina
Herrera kaia portualdea z/g
20110 Pasaia (Gipuzkoa) 
Tel: 943 004 800 - Fax: 943 004 801
e-mail: [EMAIL PROTECTED]
www.azti.es ; www.tecnalia.info
_

 LEGE OHARRA  AVISO LEGAL  
DISCLAIMER 
Mezu hau pertsonala eta isilpekoa da eta baimenik gabeko erabilera debekatua 
dago legalki. Jasotzailea ez bazara ezabatu mezua, bidali eta kontserbatu gabe. 
Este mensaje es personal y confidencial y su uso no autorizado está prohibido 
legalmente. Si usted no es el destinatario, proceda a borrarlo, sin reenviarlo 
ni conservarlo.
This message is personal and confidential, 

Re: [R] plots

2007-07-25 Thread Vladimir Eremeev


amna khan wrote:
 
 I did not find any function of graph which plot one variable on x-axis and
 2
 or more than 2 variables on y-axis.
 

You can use xyplot() from the package lattice.
library(lattice)
xyplot(y1+y2+y3~x)

I suspect, the problem is, that plot() erases everything that was plotted
earlier and establishes a new coordinate system in the plotting window.

In case of basic graphics, you can set par(new=TRUE) and call plot() several
times. 

points(), lines() and other functions from the basic graphics will add new
curves to the existing plot.

Initially, you must set axis ranges large enough to fit everything you want
to plot.
-- 
View this message in context: 
http://www.nabble.com/plots-tf4141246.html#a11780013
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Strange warning in summary.lm

2007-07-25 Thread ONKELINX, Thierry
 -Oorspronkelijk bericht-
 Van: Prof Brian Ripley [mailto:[EMAIL PROTECTED] 
 Verzonden: woensdag 25 juli 2007 12:20
 Aan: ONKELINX, Thierry
 CC: r-help@stat.math.ethz.ch
 Onderwerp: Re: [R] Strange warning in summary.lm
 
 On Wed, 25 Jul 2007, ONKELINX, Thierry wrote:
 
  Dear Peter, Uwe and Brian,
 
  I've found some more problems with options(OutDec = ,).
 
  1) as.numeric yields NA where it shouldn't
 
 It should: where does it say otherwise?  OutDec affects output, only.

I was doing something like

 options(OutDec = ,)
 df - data.frame(var = rep(1:8/4, 10), x = rnorm(80))
 df.a - aggregate(df$x, by = list(var = df$var), FUN = sum)
 as.numeric(df.a$var)
[1] NA NA NA  1 NA NA NA  2
Warning message:
NAs introduced by coercion in: as.double.default(df.a$var) 

because I needed df.a$var as numeric again.

  2) anova yields the same warning as summary
 
 It does not in current R: try any fairly recent version of R-devel.
 
 Please don't keep reporting a problem we have already fixed, 
 as the FAQ and the posting guide explicitly ask of you.

Sorry about that. I wasn't aware that the error was in a fixed
subroutine that is used by summary and anova.
I'm hestating to use a R-devel version because I haven't tried
installing R from a tar.gz (I'm one of those lazy windows users that
prefer the .exe version). For now I think I'll return to the good old
option(OutDec = .).
 
 [...]
 
 
 -- 
 Brian D. Ripley,  [EMAIL PROTECTED]
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Odp: plots

2007-07-25 Thread Petr PIKAL
Hi

[EMAIL PROTECTED] napsal dne 25.07.2007 12:17:54:

 Hi Sir
 
 I did not find any function of graph which plot one variable on x-axis 
and 2
 or more than 2 variables on y-axis.

?matplot

or you can do

plot(x,y, ylim=range(all.your.y), type=n)

and add lines/points by

lines(x, one.of.your.y)
points(x, other.of.your.y)

Regards

Petr

 Moreover, how can I change the labels of L-moments diagram obtained by
 plotlmrdia(lmrdia())
 
 Thank you
 
 -- 
 AMINA SHAHZADI
 Department of Statistics
 GC University Lahore, Pakistan.
 Email:
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 
[[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 sub !

2007-07-25 Thread marco.R.help marco.R.help
Dear all,

 I am trying to use sub to replace  patterns  in  a character array that
contains german names with german special characters. I have the following
problem:

  sub(\\xdf,ss,Wei\xdferitzkreis)
Error in sub(pattern, replacement, x, ignore.case, extended, fixed,
useBytes) :
input string 1 is invalid in this locale
  sub(\xdf,ss,Wei\xdferitzkreis)
Error in sub(pattern, replacement, x, ignore.case, extended, fixed,
useBytes) :
'pattern' is invalid in this locale

Does anybody know how to tackle this problem ?

thanks a lot!!

Marco

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 gam models

2007-07-25 Thread Simon Wood
What's wrong with the predict.gam(...,type=terms) suggestion (see 
yesterday)?

Here's example code:
## example data from ?gam
n-400;sig-2
x - runif(n, 0, 1);z - runif(n, 0, 1)
x2 - runif(n, 0, 1);x3 - runif(n, 0, 1)
f0 - function(x) 2 * sin(pi * x)
f1 - function(x) exp(2 * x)
f2 - function(x) 0.2*x^11*(10*(1-x))^6+10*(10*x)^3*(1-x)^10
f3 - function(x) 0*x
f - f0(x) + f1(z) + f2(x2)
e - rnorm(n, 0, sig)
y - f + e
b-gam(y~s(x,z)+s(x2)+s(x3))

## make a grid of data over which to predict
zm - xm - seq(0,1,length=40)
pd - data.frame(x=rep(xm,40),z=rep(zm,rep(40,40)),
 x2=rep(.5,40^2),x3=rep(.5,40^2))
## predict, termwise
pv - predict(b,newdata=pd,type=terms)
colnames(pv)
## plot result
contour(zm,xm,matrix(pv[,1],40,40))



 

On Wednesday 25 July 2007 11:43, Lucia Zarauz wrote:
 Hi again,

 I have found a post in R.help archives made from someone who had the same
 problem when exporting the smooth function estimate got from a GAM, to plot
 it into another graphic software
 (http://finzi.psych.upenn.edu/R/Rhelp02a/archive/23136.html)

 However, I haven't found any reply to this post.

 She suggested the function preplot() and I have hound that function in gam
 package, but not in mgcv package. Is it possible to do this in mgcv package
 or do I have to move to gam package?

 Thank you very much

 Lucía zarauz


 _
 AZTI - TecnaliaLucia Zarauz
 AZTI - Tecnalia / Unidad de Investigación Marina
 Herrera kaia portualdea z/g
 20110 Pasaia (Gipuzkoa)
 Tel: 943 004 800 - Fax: 943 004 801
 e-mail: [EMAIL PROTECTED]
 www.azti.es ; www.tecnalia.info

 _



  LEGE OHARRA  AVISO LEGAL 
 DISCLAIMER 


 Mezu hau pertsonala eta isilpekoa da eta baimenik gabeko erabilera
 debekatua dago legalki. Jasotzailea ez bazara ezabatu mezua, bidali eta
 kontserbatu gabe.


 Este mensaje es personal y confidencial y su uso no autorizado está
 prohibido legalmente. Si usted no es el destinatario, proceda a borrarlo,
 sin reenviarlo ni conservarlo.


 This message is personal and confidential, unauthorised use is legally
 prohibited. If you are not the intended recipient, delete it without
 resending or backing it.

 -Mensaje original-
 De: Lucia Zarauz
 Enviado el: martes, 24 de julio de 2007 13:53
 Para: 'Henrique Dallazuanna'
 CC: r-help@stat.math.ethz.ch
 Asunto: RE: [R] plotting gam models

 Hi Henrique,

 Thank you for your suggestion.

 Actually, I have already tried it, but I am confused because the plot I get
 is not the same as the output of plot(model) or plot.gam(model). The yaxis
 is different

 On the other hand, if I build a more complex model, as for example:

 model- gam(x ~ s(lat,long) + s(temperature))

 I would like to extract the information to build the effects for each
 explanatory factor (one graph for s(lat,long) and another for
 s(temperature)), as R does when you use 'plot(model)' and you press return
 for subsequent pages.

 My final aim is to plot the influence of s(lat,long) as a contourplot
 superposed on a geographical map. Maybe there is an easier way to do it...

 Thank you very much

 lucía



 _
 Lucia Zarauz
 AZTI - Tecnalia / Unidad de Investigación Marina
 Herrera kaia portualdea z/g
 20110 Pasaia (Gipuzkoa)
 Tel: 943 004 800 - Fax: 943 004 801
 e-mail: [EMAIL PROTECTED]
 www.azti.es ; www.tecnalia.info
 _
  
  LEGE OHARRA  AVISO LEGAL 
 DISCLAIMER  Mezu hau pertsonala eta isilpekoa da eta
 baimenik gabeko erabilera debekatua dago legalki. Jasotzailea ez bazara
 ezabatu mezua, bidali eta kontserbatu gabe. Este mensaje es personal y
 confidencial y su uso no autorizado está prohibido legalmente. Si usted no
 es el destinatario, proceda a borrarlo, sin reenviarlo ni conservarlo. This
 message is personal and confidential, unauthorised use is legally
 prohibited. If you are not the intended recipient, delete it without
 resending or backing it.

 
 De: Henrique Dallazuanna [mailto:[EMAIL PROTECTED]
 Enviado el: martes, 24 de julio de 2007 13:36
 Para: Lucia Zarauz
 CC: r-help@stat.math.ethz.ch
 Asunto: Re: [R] plotting gam models

 see ?predict.gam

-- 
 Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
 +44 1225 386603  www.maths.bath.ac.uk/~sw283

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Strange warning in summary.lm

2007-07-25 Thread Prof Brian Ripley
On Wed, 25 Jul 2007, ONKELINX, Thierry wrote:

 -Oorspronkelijk bericht-
 Van: Prof Brian Ripley [mailto:[EMAIL PROTECTED]
 Verzonden: woensdag 25 juli 2007 12:20
 Aan: ONKELINX, Thierry
 CC: r-help@stat.math.ethz.ch
 Onderwerp: Re: [R] Strange warning in summary.lm

 On Wed, 25 Jul 2007, ONKELINX, Thierry wrote:

 Dear Peter, Uwe and Brian,

 I've found some more problems with options(OutDec = ,).

 1) as.numeric yields NA where it shouldn't

 It should: where does it say otherwise?  OutDec affects output, only.

 I was doing something like

 options(OutDec = ,)
 df - data.frame(var = rep(1:8/4, 10), x = rnorm(80))
 df.a - aggregate(df$x, by = list(var = df$var), FUN = sum)
 as.numeric(df.a$var)
 [1] NA NA NA  1 NA NA NA  2
 Warning message:
 NAs introduced by coercion in: as.double.default(df.a$var)

 because I needed df.a$var as numeric again.

And as Martin maechler has pointed out, we don't (and can't because ',' is 
used for other things) support that.


 2) anova yields the same warning as summary

 It does not in current R: try any fairly recent version of R-devel.

 Please don't keep reporting a problem we have already fixed,
 as the FAQ and the posting guide explicitly ask of you.

 Sorry about that. I wasn't aware that the error was in a fixed
 subroutine that is used by summary and anova.
 I'm hestating to use a R-devel version because I haven't tried
 installing R from a tar.gz (I'm one of those lazy windows users that
 prefer the .exe version). For now I think I'll return to the good old
 option(OutDec = .).

Binary versions are available on CRAN.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Function polr and discrete ordinal scale

2007-07-25 Thread Lassalle Géraldine
Dear all, 

To modelize the abundance of fish (4 classes)  with a set of environmental 
variables, I used the polr and predict.polr functions. I would like to know how 
to bring the cumulated probabilities back to a discrete ordinal scale.

For the moment I used the predict.polr function with the argument class. Is 
there an other way?

polrf - polrf - polr_mod(formula = acipenser_gueldenstaedtii ~  Long + 
poly(Surf, 2, raw = TRUE) + poly(TempSum, 2, raw = TRUE) , data = mydata, 
method = logistic, Hess = TRUE, na.action = na.omit)

pred1 - predict.polr(polrf, newdata = mydata2, type = class)


predict.polr - function(object, newdata, type=c(class,probs), ...)
{
if(!inherits(object, polr)) stop(Not a polr fit)
type - match.arg(type)
if(missing(newdata)) Y - object$fitted
else {
newdata - as.data.frame(newdata)
Terms - delete.response(object$terms)
m - model.frame(Terms, newdata, na.action = function(x) x)
X - model.matrix(Terms, m, contrasts = object$contrasts)
xint - match((Intercept), dimnames(X)[[2]], nomatch=0)
if(xint  0) X - X[, -xint, drop=F]
n - nrow(X)
q - length(object$zeta)
eta - drop(X %*% object$coef)
cumpr - matrix(plogis(matrix(object$zeta, n, q, byrow=T) - eta), , q)
Y - t(apply(cumpr, 1, function(x) diff(c(0, x, 1
dimnames(Y) - list(dimnames(X)[[1]], object$lev)
}
if(!is.null(object$na.action)) Y - napredict(object$na.action, Y)
switch(type, class={
Y - factor(max.col(Y), levels=seq(along=object$lev),
labels=object$lev)
}, probs={})
drop(Y)
}

Thank you.

Géraldine LASSALLE
Cemagref
Unité Ecosystèmes estuariens et
Poissons migrateurs amphihalins
50 avenue de Verdun
33612 Gazinet-Cestas

Tel: 05.57.89.09.98
Fax: 05.57.89.08.01
[EMAIL PROTECTED]
http://haddock.bordeaux.cemagref.fr:8080/ocms1/opencms/estuaires/Poissons_migrateurs_et_changement_global.html



[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Best-fit linear model for the two matrices plotted.

2007-07-25 Thread Urmi Trivedi
Hi all..

I am so far successful in plotting the matrices containing r-values and 
evol.distances using R. But I am facing a problem to fit a line to
 it. I tried using lm function  but no success..!!
 
 Can you please help me for that? I am giving the functions, I tried, to get a
 plot here:
 
  dismat - read.table(M:\dreb5.txt,sep=\t)
  cormat - read.table(M:\cordreb5.txt,sep=\t)
  plot(as.vector(as.matrix(cormat)), as.vector(as.matrix(dismat)))
  linmod - lm(cormat~dismat, data=??) - I am not sure what should be given 
  for the data as two matrices are ploted against each other!
 
 Thanking you.

Urmi
 
   
-
 Get the freedom to save as many mails as you wish. Click here to know how.
[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 add circular text for a graph with concentric circles

2007-07-25 Thread Jim Lemon
[EMAIL PROTECTED] wrote:
 Dear R experts,
 
 I am plotting the population of students who live in a city, and in 
 successive circular bands made of the contiguous districts that surround 
 the city. This is a stylized figure, where I specify the area of each 
 successive circle based on the cumulative population of students. I want 
 to compare two sets of concentric circles across different populations - 
 such as 'All students' and 'Private students' (those attending private 
 school) by using the same colours and the same dimension of the outer 
 circle. I have attached the .pdf file with the output, and the R code to 
 generate the first set of circles.
 
 I would appreciate any tips about how to rotate the text label that marks 
 each concentric circle (except the central circle) to be curved around the 
 circle, located in the middle of each band, thus following the circle 
 instead of being horizontal, as I have it now.
 
Hi Suhas,
This is kind of rough, being rejigged from an old piece of Postscript 
code that I wrote to get text in an arc. You specify the text and 
whatever else is needed as in the following example:

arctext-function(x,center=c(0,0),radius=1,
  midangle=pi/2,stretch=1.1,cex=1,...) {
  oldcex-par(cex)
  par(cex=cex)
  xwidth-strwidth(x)*stretch
  startpos-midangle+xwidth/(radius*2)
  xvec-strsplit(x,)[[1]]
  xwidths-rep(mean(stretch*strwidth(xvec)),length(xvec))
  arcpos-startpos-cumsum(xwidths)
  for(i in 1:length(arcpos))
   text(center[1]+radius*cos(arcpos[i]),center[2]+radius*sin(arcpos[i]),
xvec[i],adj=c(0.5,0.5),srt=(arcpos[i]-midangle)*180/pi)
  par(cex=oldcex)
}

plot((1:5)
arctext(bendy as a bloody piece of spaghetti,center=c(3,3))

radius is obviously the radius of the arc,
midangle is where you want the center of the text,
stretch is how much to stretch the text to make it look nice
and cex is the expansion factor.
You will probably notice that I kludged the spacing by making
it monospaced. I'll have a try at getting proportionally spaced
text to work right when I get a chance.

Jim

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Obtaining summary of frequencies of value occurrences for a variable in a multivariate dataset.

2007-07-25 Thread jim holtman
Also if you want to access the individual values, you can just leave
it as a list:

 x.val - apply(x, 2, table)
 # access each value
 x.val$PR14[V]
V
8



On 7/25/07, Allan Kamau [EMAIL PROTECTED] wrote:
 A subset of the data looks as follows

  df[1:10,14:20]
   PR10 PR11 PR12 PR13 PR14 PR15 PR16
 1 VTIKVGD
 2 VSIKVGG
 3 VTIRVGG
 4 VSIKIGG
 5 VSIKVGG
 6 VSIRVGG
 7 VTIKIGG
 8 VSIKVEG
 9 VSIKVGG
 10VSIKVGG

 The result I would like is as follows

 PR10PR11  PR12   ...
 [V:10][S:7,T:3][I:10]

 The result can be in a matrix or a vector and each variablename, value and 
 frequency should be accessible so as to be used for comparisons with another 
 dataset later.
 The frequency can be a count or a percentage.


 Allan.


 - Original Message 
 From: Adaikalavan Ramasamy [EMAIL PROTECTED]
 To: Allan Kamau [EMAIL PROTECTED]
 Cc: r-help@stat.math.ethz.ch
 Sent: Tuesday, July 24, 2007 10:21:51 PM
 Subject: Re: [R] Obtaining summary of frequencies of value occurrences for a 
 variable in a multivariate dataset.

 The name of the table should give you the value. And if you have a
 matrix, you just need to convert it into a vector first.

   m - matrix( LETTERS[ c(1:3, 3:5, 2:4) ], nc=3 )
   m
  [,1] [,2] [,3]
 [1,] A  C  B
 [2,] B  D  C
 [3,] C  E  D
   tb - table( as.vector(m) )
   tb

 A B C D E
 1 2 3 2 1
   paste( names(tb), :, tb, sep= )
 [1] A:1 B:2 C:3 D:2 E:1

 If this is not what you want, then please give a simple example.

 Regards, Adai



 Allan Kamau wrote:
  Hi all,
  If the question below as been answered before I
  apologize for the posting.
  I would like to get the frequencies of occurrence of
  all values in a given variable in a multivariate
  dataset. In short for each variable (or field) a
  summary of values contained with in a value:frequency
  pair, there can be many such pairs for a given
  variable. I would like to do the same for several such
  variables.
  I have used table() but am unable to extract the
  individual value and frequency values.
  Please advise.
 
  Allan.
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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?

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Obtaining summary of frequencies of value occurrences for a variable in a multivariate dataset.

2007-07-25 Thread Gabor Grothendieck
Try summary:

 summary(x)
 PR10   PR11  PR12   PR13  PR14  PR15  PR16
 V:10   S:7   I:10   K:8   I:2   E:1   D:1
T:3  R:2   V:8   G:9   G:9

On 7/25/07, Allan Kamau [EMAIL PROTECTED] wrote:
 A subset of the data looks as follows

  df[1:10,14:20]
   PR10 PR11 PR12 PR13 PR14 PR15 PR16
 1 VTIKVGD
 2 VSIKVGG
 3 VTIRVGG
 4 VSIKIGG
 5 VSIKVGG
 6 VSIRVGG
 7 VTIKIGG
 8 VSIKVEG
 9 VSIKVGG
 10VSIKVGG

 The result I would like is as follows

 PR10PR11  PR12   ...
 [V:10][S:7,T:3][I:10]

 The result can be in a matrix or a vector and each variablename, value and 
 frequency should be accessible so as to be used for comparisons with another 
 dataset later.
 The frequency can be a count or a percentage.


 Allan.


 - Original Message 
 From: Adaikalavan Ramasamy [EMAIL PROTECTED]
 To: Allan Kamau [EMAIL PROTECTED]
 Cc: r-help@stat.math.ethz.ch
 Sent: Tuesday, July 24, 2007 10:21:51 PM
 Subject: Re: [R] Obtaining summary of frequencies of value occurrences for a 
 variable in a multivariate dataset.

 The name of the table should give you the value. And if you have a
 matrix, you just need to convert it into a vector first.

   m - matrix( LETTERS[ c(1:3, 3:5, 2:4) ], nc=3 )
   m
  [,1] [,2] [,3]
 [1,] A  C  B
 [2,] B  D  C
 [3,] C  E  D
   tb - table( as.vector(m) )
   tb

 A B C D E
 1 2 3 2 1
   paste( names(tb), :, tb, sep= )
 [1] A:1 B:2 C:3 D:2 E:1

 If this is not what you want, then please give a simple example.

 Regards, Adai



 Allan Kamau wrote:
  Hi all,
  If the question below as been answered before I
  apologize for the posting.
  I would like to get the frequencies of occurrence of
  all values in a given variable in a multivariate
  dataset. In short for each variable (or field) a
  summary of values contained with in a value:frequency
  pair, there can be many such pairs for a given
  variable. I would like to do the same for several such
  variables.
  I have used table() but am unable to extract the
  individual value and frequency values.
  Please advise.
 
  Allan.
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Obtaining summary of frequencies of value occurrences for a variable in a multivariate dataset.

2007-07-25 Thread jim holtman
Is this what you want:

 x - read.table(textConnection(  PR10 PR11 PR12 PR13 PR14 PR15 PR16
+ 1 VTIKVGD
+ 2 VSIKVGG
+ 3 VTIRVGG
+ 4 VSIKIGG
+ 5 VSIKVGG
+ 6 VSIRVGG
+ 7 VTIKIGG
+ 8 VSIKVEG
+ 9 VSIKVGG
+ 10VSIKVGG), header=TRUE)
 x.t - apply(x, 2, function(.col){
+ .tab - table(.col)
+ paste('[', paste(names(.tab), .tab, sep=:, collapse=','), ']', sep='')
+ })


 x.t
   PR10PR11PR12PR13PR14PR15
   [V:10] [S:7,T:3][I:10] [K:8,R:2] [I:2,V:8] [E:1,G:9]
   PR16
[D:1,G:9]



On 7/25/07, Allan Kamau [EMAIL PROTECTED] wrote:
 A subset of the data looks as follows

  df[1:10,14:20]
   PR10 PR11 PR12 PR13 PR14 PR15 PR16
 1 VTIKVGD
 2 VSIKVGG
 3 VTIRVGG
 4 VSIKIGG
 5 VSIKVGG
 6 VSIRVGG
 7 VTIKIGG
 8 VSIKVEG
 9 VSIKVGG
 10VSIKVGG

 The result I would like is as follows

 PR10PR11  PR12   ...
 [V:10][S:7,T:3][I:10]

 The result can be in a matrix or a vector and each variablename, value and 
 frequency should be accessible so as to be used for comparisons with another 
 dataset later.
 The frequency can be a count or a percentage.


 Allan.


 - Original Message 
 From: Adaikalavan Ramasamy [EMAIL PROTECTED]
 To: Allan Kamau [EMAIL PROTECTED]
 Cc: r-help@stat.math.ethz.ch
 Sent: Tuesday, July 24, 2007 10:21:51 PM
 Subject: Re: [R] Obtaining summary of frequencies of value occurrences for a 
 variable in a multivariate dataset.

 The name of the table should give you the value. And if you have a
 matrix, you just need to convert it into a vector first.

   m - matrix( LETTERS[ c(1:3, 3:5, 2:4) ], nc=3 )
   m
  [,1] [,2] [,3]
 [1,] A  C  B
 [2,] B  D  C
 [3,] C  E  D
   tb - table( as.vector(m) )
   tb

 A B C D E
 1 2 3 2 1
   paste( names(tb), :, tb, sep= )
 [1] A:1 B:2 C:3 D:2 E:1

 If this is not what you want, then please give a simple example.

 Regards, Adai



 Allan Kamau wrote:
  Hi all,
  If the question below as been answered before I
  apologize for the posting.
  I would like to get the frequencies of occurrence of
  all values in a given variable in a multivariate
  dataset. In short for each variable (or field) a
  summary of values contained with in a value:frequency
  pair, there can be many such pairs for a given
  variable. I would like to do the same for several such
  variables.
  I have used table() but am unable to extract the
  individual value and frequency values.
  Please advise.
 
  Allan.
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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?

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 sub !

2007-07-25 Thread Vladimir Eremeev

Try Sys.setlocale().


marco.R.help marco.R.help wrote:
 
  I am trying to use sub to replace  patterns  in  a character array that
 contains german names with german special characters. I have the following
 problem:
 
  sub(\\xdf,ss,Wei\xdferitzkreis)
 Error in sub(pattern, replacement, x, ignore.case, extended, fixed,
 useBytes) :
 input string 1 is invalid in this locale
  sub(\xdf,ss,Wei\xdferitzkreis)
 Error in sub(pattern, replacement, x, ignore.case, extended, fixed,
 useBytes) :
 'pattern' is invalid in this locale
 
 Does anybody know how to tackle this problem ?
 

-- 
View this message in context: 
http://www.nabble.com/problem-with-sub-%21-tf4141431.html#a11781512
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Operator and

2007-07-25 Thread Chuck Cleland
Yann Mauon wrote:
 Hello, 
 
 I'am new to the R world and have a lot of question but the first is : How to
 deal with  opertor in table objects? (Or how to deal with  in
 general...) I explain my problem. 
 
 I read a file with the read.table expression. I then obtain a matrix. I read
 the first line for example with the commande data[,1]. Then I would like to
 select only the element in this line that are greater than 2. Is there an
 elegant way to achieve that ?
 
 Thanks by advance...

  Note that read.table() returns a data frame, not a matrix.  To subset,
try this:

subset(data, data[,1]  2)

OR

subset(data, data[,1]  2, select=1)

  Of course, it is always nice if each column in your data frame has a
meaningful name, so it can be referred to by name rather than number.

?subset
?names

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Operator and

2007-07-25 Thread John Kane
mm  - matrix(1:9, nrow=3) ; mm
subset(mm[,1],mm[,1] 3)  # Note I used 3 not 2 here.

Have a look at some of the introductory documents on 
the R site  ( Contributed documents under OTHER in the
documentation). They should answer a lot of your basic
questions like this.

Documents by Lemon, Maindonald and Verzani are good
places to start.

Also the Introduction to R is useful.


--- Yann Mauon [EMAIL PROTECTED] wrote:

 
 Hello, 
 
 I'am new to the R world and have a lot of question
 but the first is : How to
 deal with  opertor in table objects? (Or how to
 deal with  in
 general...) I explain my problem. 
 
 I read a file with the read.table expression. I then
 obtain a matrix. I read
 the first line for example with the commande
 data[,1]. Then I would like to
 select only the element in this line that are
 greater than 2. Is there an
 elegant way to achieve that ?
 
 Thanks by advance...
 -- 
 View this message in context:

http://www.nabble.com/Operator-%3E-and-%3C-tf4141869.html#a11781567
 Sent from the R help mailing list archive at
 Nabble.com.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Operator and

2007-07-25 Thread Yann Mauon

Hello, 

I'am new to the R world and have a lot of question but the first is : How to
deal with  opertor in table objects? (Or how to deal with  in
general...) I explain my problem. 

I read a file with the read.table expression. I then obtain a matrix. I read
the first line for example with the commande data[,1]. Then I would like to
select only the element in this line that are greater than 2. Is there an
elegant way to achieve that ?

Thanks by advance...
-- 
View this message in context: 
http://www.nabble.com/Operator-%3E-and-%3C-tf4141869.html#a11781567
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Odp: Operator and

2007-07-25 Thread Petr PIKAL
Hi

you definitely shall make a quick glance to some documentation which comes 
with R e.g. R intro manual. Or look at CRAN where is quite impressive 
amount of literature from basic stuff to advanced papers.

To your question:

[EMAIL PROTECTED] napsal dne 25.07.2007 14:23:58:

 
 Hello, 
 
 I'am new to the R world and have a lot of question but the first is : 
How to
 deal with  opertor in table objects? (Or how to deal with  in
 general...) I explain my problem. 
 
 I read a file with the read.table expression. I then obtain a matrix. I 
read
 the first line for example with the commande data[,1]. Then I would like 
to

You did not select line but column. 

data[,1]  2 

will give you logical vector which you can use for selection of rows from 
data. 

data[data[,1]  2,]

Regards.
Petr
 

 select only the element in this line that are greater than 2. Is there 
an
 elegant way to achieve that ?
 
 Thanks by advance...
 -- 
 View this message in context: 
http://www.nabble.com/Operator-%3E-and-%3C-
 tf4141869.html#a11781567
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Minitab Parametric Distribution Analysis in R

2007-07-25 Thread Tom La Bone
Minitab can perform a Parametric Distribution Analysis - Arbitrary
Censoring with one of eight distributions (e.g., weibull), giving the
maximum likelihood estimates of the parameters in the distribution for a
given dataset. Does R have a package that provides equivalent functionality?
Thanks for any advice you can offer.

 

Tom La Bone


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Is Rwiki down?

2007-07-25 Thread Jin Lo
Dear R-friends,

is Rwiki down? I've been trying to login for the past
couple of days with no success.

Yours sincerely,

Jin




   


wherever you're surfing.

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


Re: [R] plots

2007-07-25 Thread John Kane

--- amna khan [EMAIL PROTECTED] wrote:

 Hi Sir
 
 I did not find any function of graph which plot one
 variable on x-axis and 2
 or more than 2 variables on y-axis.
I think
?points
or 
?lines 
may be what you want.

 Moreover, how can I change the labels of L-moments
 diagram obtained by
 plotlmrdia(lmrdia())

Cannot help here.
 
 Thank you
 
 -- 
 AMINA SHAHZADI
 Department of Statistics
 GC University Lahore, Pakistan.
 Email:
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]
 [EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Rgraphviz and R 2.5.1 entry point Rf_allocString could not be located

2007-07-25 Thread My Coyne
Dear R-Helpers

 

In R 2.5.1, the command library(Rgraphviz) fails on my Windows (XP SP2)
system with error popup The procedure entry point Rf_allocString could not
be located in the dynamic link library R.dll.

 

Thanks in advance for any suggestion in solving the error. 

 

My D. Coyne

Imagination is more important than knowledge... (Albert Einstein)

[EMAIL PROTECTED]  

BioInformatics Enthusiast  

Office: 301-865-0243

Cell:301-399-6351

 

 

 


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Rgraphviz and R 2.5.1 entry point Rf_allocString could not be located

2007-07-25 Thread Prof Brian Ripley
On Wed, 25 Jul 2007, My Coyne wrote:

 Dear R-Helpers

 In R 2.5.1, the command library(Rgraphviz) fails on my Windows (XP SP2)
 system with error popup The procedure entry point Rf_allocString could not
 be located in the dynamic link library R.dll.

 Thanks in advance for any suggestion in solving the error.

Use a version of the package compiled for R 2.5.1.  That currently picked 
up by using the menus in R 2.5.1 works for me.

Also, this is not the right list for questions about Bioconductor 
packages, and please send properly formatted plain text only.

 My D. Coyne
 Imagination is more important than knowledge... (Albert Einstein)
 [EMAIL PROTECTED]
 BioInformatics Enthusiast
 Office: 301-865-0243
 Cell:301-399-6351

   [[alternative HTML version deleted]]

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


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] lme or gls prediction intervals

2007-07-25 Thread Martin Henry H. Stevens
Hi Joris,
Thank you for the reply.
I also realize that I meant confidence intervals, not prediction  
intervals!

I am trying to do something analogous to

predict(model.gls, newdata, interval=confidence)

but predict.gls does not have an interval argument. I am guessing  
that this is because it is subtle and complicated to figure out what  
the appropriate hypothesis is, but I was hoping to get some feedback.

Cheers,
Hank

On Jul 25, 2007, at 3:21 AM, [EMAIL PROTECTED] wrote:



 Martin,


 Have you checked ?intervals.gls


 This intervals are approximate, but this would be the obvious starting
 point to me.


 Joris











  Martin Henry H.
  Stevens
   
 [EMAIL PROTECTED]  To
  edu  R-Help r- 
 [EMAIL PROTECTED]
  Sent  
 by:   cc
  [EMAIL PROTECTED]
  at.math.ethz.ch
 Subject
[R] lme or gls prediction  
 intervals

  24/07/2007 19:22








 Hi folks,
 I am trying to generate 95% confidence intervals for a gls model
 using predict.nlme
 with
 R version 2.5.1 (2007-06-27)
 . nlme: Linear  and Nonlinear Mixed Effects Models. R package version
3.1-83.

 I have looked in help, and I can do it for lm and glm models, and I
 can generate simple predictions for lme models with various levels --
 I am familiar with the basics.

 Is there a way to get prediction intervals for gls models? My best
 model uses varPower(), so I am reluctant to fall back on lm  
 predictions.

 Thank you,

 Hank


 Dr. Hank Stevens, Associate Professor
 338 Pearson Hall
 Botany Department
 Miami University
 Oxford, OH 45056

 Office: (513) 529-4206
 Lab: (513) 529-4262
 FAX: (513) 529-4243
 http://www.cas.muohio.edu/~stevenmh/
 http://www.muohio.edu/ecology/
 http://www.muohio.edu/botany/

 E Pluribus Unum

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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. Hank Stevens, Associate Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/~stevenmh/
http://www.muohio.edu/ecology/
http://www.muohio.edu/botany/
E Pluribus Unum

If you send an attachment, please try to send it in a format anyone  
can read, such as PDF, text, Open Document Format, HTML, or RTF.  
Please try not to send me MS Word or PowerPoint attachments-
Why? See:  http://www.gnu.org/philosophy/no-word-attachments.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Is Rwiki down?

2007-07-25 Thread Martin Henry H. Stevens
Me too.
Hank
On Jul 25, 2007, at 7:50 AM, Jin Lo wrote:

 Dear R-friends,

 is Rwiki down? I've been trying to login for the past
 couple of days with no success.

 Yours sincerely,

 Jin





 __ 
 __

 wherever you're surfing.

 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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. Hank Stevens, Associate Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/~stevenmh/
http://www.muohio.edu/ecology/
http://www.muohio.edu/botany/
E Pluribus Unum

If you send an attachment, please try to send it in a format anyone  
can read, such as PDF, text, Open Document Format, HTML, or RTF.  
Please try not to send me MS Word or PowerPoint attachments-
Why? See:  http://www.gnu.org/philosophy/no-word-attachments.html

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Open two graphic devices at a time

2007-07-25 Thread MatzeK

Hello,

I would like to export my plots to harddisk (jpeg or pdf). I know that could
be done with pdf(...) and jpeg(...).
But my problem is that if I open e.g. the pdf device my plot does not appear
on the screen. If I plot to the x11 device and try to export later the
outputfile is damaged.
How can I manage that problem? I want to see my plots on screen and want to
export them. Is there a chance to open two different devices, or is the only
way printing twice. One time to x11() and one time to pdf()?

Thanks a lot for any idea
-- 
View this message in context: 
http://www.nabble.com/Open-two-graphic-devices-at-a-time-tf4142321.html#a11783029
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Time when object was created

2007-07-25 Thread Rubén Roa-Ureta
Dear ComRades,
Last night I left an Intel Core Duo Windows Vista system running an 
extensive mixed glm with lmer. This morning I found that R-lmer had 
finished the job successfully. I would like to know at what time the 
object containing the results (call it lme_1) was finished. I guess 
there is some simple function that when applied to the object would give 
me the time stamp?
Thanks
Rubén

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 add circular text for a graph with concentric circles

2007-07-25 Thread sparandekar
Thanks, Jim. I tried to implement this but the text swings all over the place. I
had thought that there could be a function where I could specify the circle's
origin, radius and angle of the location of the starting letter, then, based on
a specified font size and letter spacing, the arc could be plotted out. But
clearly, the problem is not as small as I thought, and it appears that I need to
spend some time learning more of the basics  before attempting something this
complicated. Thanks for your help anyways.

best regards,
Suhas




 Jim Lemon  
 [EMAIL PROTECTED] 
   
 m.au   To 
 [EMAIL PROTECTED]  
 07/25/2007  cc 
 07:38 AMr-help@stat.math.ethz.ch   
Subject 
 Re: [R] How to add circular text for a 
 graph with concentric circles  










[EMAIL PROTECTED] wrote:
 Dear R experts,

 I am plotting the population of students who live in a city, and in
 successive circular bands made of the contiguous districts that surround
 the city. This is a stylized figure, where I specify the area of each
 successive circle based on the cumulative population of students. I want
 to compare two sets of concentric circles across different populations -
 such as 'All students' and 'Private students' (those attending private
 school) by using the same colours and the same dimension of the outer
 circle. I have attached the .pdf file with the output, and the R code to
 generate the first set of circles.

 I would appreciate any tips about how to rotate the text label that marks
 each concentric circle (except the central circle) to be curved around the
 circle, located in the middle of each band, thus following the circle
 instead of being horizontal, as I have it now.

Hi Suhas,
This is kind of rough, being rejigged from an old piece of Postscript
code that I wrote to get text in an arc. You specify the text and
whatever else is needed as in the following example:

arctext-function(x,center=c(0,0),radius=1,
  midangle=pi/2,stretch=1.1,cex=1,...) {
  oldcex-par(cex)
  par(cex=cex)
  xwidth-strwidth(x)*stretch
  startpos-midangle+xwidth/(radius*2)
  xvec-strsplit(x,)[[1]]
  xwidths-rep(mean(stretch*strwidth(xvec)),length(xvec))
  arcpos-startpos-cumsum(xwidths)
  for(i in 1:length(arcpos))
   text(center[1]+radius*cos(arcpos[i]),center[2]+radius*sin(arcpos[i]),
xvec[i],adj=c(0.5,0.5),srt=(arcpos[i]-midangle)*180/pi)
  par(cex=oldcex)
}

plot((1:5)
arctext(bendy as a bloody piece of spaghetti,center=c(3,3))

radius is obviously the radius of the arc,
midangle is where you want the center of the text,
stretch is how much to stretch the text to make it look nice
and cex is the expansion factor.
You will probably notice that I kludged the spacing by making
it monospaced. I'll have a try at getting proportionally spaced
text to work right when I get a chance.

Jim

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Odp: Open two graphic devices at a time

2007-07-25 Thread Petr PIKAL
Hi

far from beeing an expert in graphic devices AFAIK you can either see your 
graph on screen (x11 device) or to open other device (pdf, png, ...) and 
to issue plotting commands to that device. Do not forget

dev.off()

after your plot is finished.

Or you can save your plot by menu command File/Save as... (on Windows), 
which you did not specify.

Regards
Petr

[EMAIL PROTECTED] napsal dne 25.07.2007 15:55:12:

 
 Hello,
 
 I would like to export my plots to harddisk (jpeg or pdf). I know that 
could
 be done with pdf(...) and jpeg(...).
 But my problem is that if I open e.g. the pdf device my plot does not 
appear
 on the screen. If I plot to the x11 device and try to export later the
 outputfile is damaged.
 How can I manage that problem? I want to see my plots on screen and want 
to
 export them. Is there a chance to open two different devices, or is the 
only
 way printing twice. One time to x11() and one time to pdf()?
 
 Thanks a lot for any idea
 -- 
 View this message in context: 
http://www.nabble.com/Open-two-graphic-devices-
 at-a-time-tf4142321.html#a11783029
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Odp: Open two graphic devices at a time

2007-07-25 Thread MatzeK

@Petr
Hello,

now I tried it with savePlot(). This is a very easy way. Now I don't need
two devices.

Thanks a lot
MatzeK 



Petr Pikal wrote:
 
 Hi
 
 far from beeing an expert in graphic devices AFAIK you can either see your 
 graph on screen (x11 device) or to open other device (pdf, png, ...) and 
 to issue plotting commands to that device. Do not forget
 
 dev.off()
 
 after your plot is finished.
 
 Or you can save your plot by menu command File/Save as... (on Windows), 
 which you did not specify.
 
 Regards
 Petr
 
 [EMAIL PROTECTED] napsal dne 25.07.2007 15:55:12:
 
 
 Hello,
 
 I would like to export my plots to harddisk (jpeg or pdf). I know that 
 could
 be done with pdf(...) and jpeg(...).
 But my problem is that if I open e.g. the pdf device my plot does not 
 appear
 on the screen. If I plot to the x11 device and try to export later the
 outputfile is damaged.
 How can I manage that problem? I want to see my plots on screen and want 
 to
 export them. Is there a chance to open two different devices, or is the 
 only
 way printing twice. One time to x11() and one time to pdf()?
 
 Thanks a lot for any idea
 -- 
 View this message in context: 
 http://www.nabble.com/Open-two-graphic-devices-
 at-a-time-tf4142321.html#a11783029
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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/Open-two-graphic-devices-at-a-time-tf4142321.html#a11783905
Sent from the R help mailing list archive at Nabble.com.

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Constructing bar charts with standard error bars

2007-07-25 Thread John Zabroski
I am new to R.

I want to graph group data using a Traditional Bar Chart with Standard
Error Bar, like the kind shown here:
http://samiam.colorado.edu/~mcclella/ftep/twoGroups/twoGroupGraphs.html

Is there a simple way to do this?

So far, I have only figured out how to plot the bars using barplot.

testdata - scan(, list(group=0,xbar=0,se=0))
400 0.36038 0.02154
200 0.35927 0.02167
100 0.35925 0.02341
50 0.35712 0.01968
25 0.35396 0.01931

barplot(testdata$xbar, names.arg=as.character(testdata$group), main=a=4.0,
xlab=Group, ylab=xbar)
xvalues - c(0.7, 1.9, 3.1, 4.3, 5.5)
arrows(xvalues, testdata$xbar, xvalues, testdata$xbar+testdata$se, length=
0.4, angle=90, code=3)


The best clue I have so far is Rtips #5.9:
http://pj.freefaculty.org/R/Rtips.html#5.9 which is what I based my present
solution off of.

However, I do not understand how this works.  It seems like there is no
concrete way to determine the arrow drawing parameters x0 and x1 for a
barplot.  Moreover, the bars seem to be cut off.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Ggplot2 equivalent of axis and problem with log scale

2007-07-25 Thread hadley wickham
On 7/25/07, ONKELINX, Thierry [EMAIL PROTECTED] wrote:
 Dear useRs,

 Recently I've discorved ggplot2 and I must say that I really like it,
 although the documentation still is a working in progress.

 My first question: How can I change the position of the labels and the
 text of the labels? With a basic plot I would use axis(2, at =
 position.of.the.ticks, labels = text.at.the.ticks). Could someone
 provide me with an example of how to do this with ggplot2?

Have a look at scale_continous - in particular the breaks and labels
arguments (although I haven´t tested them much yet).  You need +
scale_x_continuous() and + scale_y_continuous() as appropriate.

 The second question is probably a little bug. If I plot the y-axis in
 log10 scale then geom_errorbar still plot the values in the original
 scale. See the example below. The second plot is what I would suspect
 when plotting the first graph.

Yes, that's a bug - I`ll try and get it fixed in the next version.

Thanks,

Hadley

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Minitab Parametric Distribution Analysis in R

2007-07-25 Thread Thomas Lumley

The survival package (survreg() function) will fit quite a few parametric 
models under censoring.

If you aren't doing regression, but just one-sample fitting, you can feed the 
appropriate censored or truncated likelihood to mle() in the stat4 package.

Both packages should be part of your R distribution.

-thomas



On Wed, 25 Jul 2007, Tom La Bone wrote:

 Minitab can perform a Parametric Distribution Analysis - Arbitrary
 Censoring with one of eight distributions (e.g., weibull), giving the
 maximum likelihood estimates of the parameters in the distribution for a
 given dataset. Does R have a package that provides equivalent functionality?
 Thanks for any advice you can offer.



 Tom La Bone


   [[alternative HTML version deleted]]

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


Thomas Lumley   Assoc. Professor, Biostatistics
[EMAIL PROTECTED]   University of Washington, Seattle

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] qda(MASS) function error

2007-07-25 Thread Mauro Rossi

Dear R user,
 I'm using qda (quadratic discriminant analysis) function (package 
MASS) to classify 58 explanatory variables (numeric type with different 
ranges) using a grouping variable (factor 2 levels 0 1). I'm using 
the qda method for class 'data.frame' (in this way I don't need to 
specify a formula).

Using the function:
result.qda-qda(explanatory.variables, grouping.variable, method=moment)
I obtain the following error message:
Error in qda.default(x, grouping, ...) : rank deficiency in group 0
I run the script excluding some variables and I've individuated 2 
explanatory variables that give problems, but  I don't understand why 
they give them. The two excluded variables are numeric with two possible 
values: 0 and 1, but in the rest of group of  variables, some similar 
variables are considered.


I don't have this problem using lda  function for linear discriminant 
analysis.


What does this error message mean?
What types of variables does qda function consider?

Thank in advance,
Mauro Rossi

--

Mauro Rossi

Istituto di Ricerca per la Protezione Idrogeologica

Consiglio Nazionale delle Ricerche

Via della Madonna Alta, 126

06128 Perugia

Italia

Tel. +39 075 5014421

Fax +39 075 5014420

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Constructing bar charts with standard error bars

2007-07-25 Thread Frank E Harrell Jr
John Zabroski wrote:
 I am new to R.
 
 I want to graph group data using a Traditional Bar Chart with Standard
 Error Bar, like the kind shown here:
 http://samiam.colorado.edu/~mcclella/ftep/twoGroups/twoGroupGraphs.html

There are severe problems with dynamite plots such as these.  See 
http://biostat.mc.vanderbilt.edu/DynamitePlots for a list of problems 
and solutions.

Frank

 
 Is there a simple way to do this?
 
 So far, I have only figured out how to plot the bars using barplot.
 
 testdata - scan(, list(group=0,xbar=0,se=0))
 400 0.36038 0.02154
 200 0.35927 0.02167
 100 0.35925 0.02341
 50 0.35712 0.01968
 25 0.35396 0.01931
 
 barplot(testdata$xbar, names.arg=as.character(testdata$group), main=a=4.0,
 xlab=Group, ylab=xbar)
 xvalues - c(0.7, 1.9, 3.1, 4.3, 5.5)
 arrows(xvalues, testdata$xbar, xvalues, testdata$xbar+testdata$se, length=
 0.4, angle=90, code=3)
 
 
 The best clue I have so far is Rtips #5.9:
 http://pj.freefaculty.org/R/Rtips.html#5.9 which is what I based my present
 solution off of.
 
 However, I do not understand how this works.  It seems like there is no
 concrete way to determine the arrow drawing parameters x0 and x1 for a
 barplot.  Moreover, the bars seem to be cut off.
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Constructing bar charts with standard error bars

2007-07-25 Thread Ben Bolker
John Zabroski johnzabroski at gmail.com writes:

 
 I am new to R.
 
 I want to graph group data using a Traditional Bar Chart with Standard
 Error Bar, like the kind shown here:
 http://samiam.colorado.edu/~mcclella/ftep/twoGroups/twoGroupGraphs.html
 
 Is there a simple way to do this?

   [snip]

 The best clue I have so far is Rtips #5.9:
 http://pj.freefaculty.org/R/Rtips.html#5.9 which is what I based my present
 solution off of.
 
 However, I do not understand how this works.  It seems like there is no
 concrete way to determine the arrow drawing parameters x0 and x1 for a
 barplot.  Moreover, the bars seem to be cut off.
 
  
  barplot() returns the x values you need for x0 and x1.
barplot(...,ylim=c(0,xbar+se)) will set the upper y limit so
the bars don't get cut off.

Here are three ways to create such a barplot (I will add
this to the wiki once it's back on line):  (n.b.: the
with() command is just a shortcut to avoid having
to type testdata$xbar, testdata$group, etc.)

## 1. tweaked version of what you did above

testdata - data.frame(group=c(400,200,100,50,25),
xbar= c(0.36038 , 0.35927 , 0.35925 , 0.35712 , 0.35396), 
se = c(0.02154,0.02167,0.02341,0.01968, 0.01931))
xvals = with(testdata,
 barplot(xbar, names.arg=group, main=a=4.0,
xlab=Group, ylab=xbar,ylim=c(0,max(xbar+se
with(testdata,
 arrows(xvals, xbar, xvals, xbar+se, length=0.4, angle=90, code=3))

## 2. using the plotCI function from plotrix to draw the
##arrows instead
library(plotrix)
xvals = with(testdata,
 barplot(xbar, names.arg=group, main=a=4.0,
xlab=Group, ylab=xbar,ylim=c(0,max(xbar+se
with(testdata,
 plotCI(xvals, xbar, liw=0,uiw=se,add=TRUE,pch=NA,gap=FALSE))

## 3. the most automatic way, using barplot2() from the
## gplots package

library(gplots)
with(testdata,
 barplot2(xbar,names.arg=group,main=a=4.0,
  xlab=Group,ylab=xbar,plot.ci=TRUE,
  ci.u=xbar+se,ci.l=xbar))

  P.S. I hope you're not hoping to infer a statistically
significant difference among these groups ...

  cheers
   Ben Bolker

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] initalizing and checking validity of S4 classes

2007-07-25 Thread Seth Falcon
Martin Morgan [EMAIL PROTECTED] writes:

 Hi Michal --

 Add validObject to your initialize method:

Actually, a call to valid object is part of the default initialization
method which has been masked.  A different solution, which might have
some other benefits is to delegate back to the default method using
callNextMethod.  So you could do:

setMethod(initialize, someclass,
function(.Object, v=numeric(0), l=character(0))
{
# strip the vector names

cv - v
cl - l
names(cv) - NULL
names(cl) - NULL
callNextMethod(.Object=.Object, v=cv, l=cl)
} )


 Here are two interpretations of this. (1) using 'initialize' means
 that you are taking control of the initialization process, and hence
 know when you need to call validObject.

Yes.  Anytime you specialize a method you must take responsibility for
any less specific methods.  In this case, the default 'initialize'
does object validation.  So if you want validation, you either need to
do it directly or invoke the default method.

 (2) Responsibility for object
 validity is ambiguous -- does it belong with 'new', 'initialize', or a
 'constructor' that the programmer might write? This is particularly
 problematic with R's copy semantics, where creating transiently
 invalid objects seems to be almost necessary (e.g., callNextMethod()
 in 'initialize' might initialize the inherited slots of the object,
 but the object itself is of the derived class and could well be
 invalid 'invalid' after the base class has finished with initialize).

This is a good point.  It suggests that, at least, one must initialize
all non-inherited slots to valid values _before_ calling the next
method.

+ seth

-- 
Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center
http://bioconductor.org

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] if - else

2007-07-25 Thread James J. Roper
Greetings,

I have some confusion with the use of if - else.  Let's say I have a
four variables as follows:

Condition   DateFound  DateFirstEvent
DateSecondEvent
NA10Jan2000  NA NA
0   05Jan2000  07Jan2000
   10Jan2000
1   07Jan2000  07Jan2000
   08Jan2000
2   09Jan2000  NA NA

Now, what I need to do is make a new variable that is either the
midpoint of the first and second event dates, or the date found (I
will call Start).

I tried an if - else condition as follows:

Start - if (DateFirstEven  DateSecondEvent)
(DateFirstEvent+DateSecondEvent)/2 else DateFound

I also tried

Start - if (any(DateFirstEven  DateSecondEvent))
(DateFirstEvent+DateSecondEvent)/2 else DateFound

Only the first half of the expression was ever evaluated.

I hope I have not been to brief, and will certainly appreciate any help.

Thanks,

Jim

-- 
James J. Roper
Population Dynamics and Conservation of
Terrestrial Vertebrates
Caixa Postal 19034
81531-990 Curitiba, Paraná, Brasil
===
E-mail:   [EMAIL PROTECTED]
Phone/Fone/Teléfono: 55 41 33611764
celular: 55 41 99870543
Casa:   55 41 33857249
===
Ecologia e Conservação na UFPR
http://www.bio.ufpr.br/ecologia/
---
http://jjroper.googlepages.com/
http://arsartium.googlepages.com/

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] reversing the x-axis terms on a boxplot

2007-07-25 Thread Dylan Beaudette
Hi,

I am able to reverse the order of plotting on regular plots (i.e. with the 
plot() function) by manually setting the xlim variable. 

Is there some trick like this which will work for a boxplot?

* for example:

l - sample(letters, 500, replace=TRUE)
n - runif(500)
boxplot(n ~ l)


this will produce a plot with the x-axis ranging from a-z ... i know that 
these are labels, associated with an integer index-- but is there someway to 
reverse the plotting order?

Thanks in advance,

Dylan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Updating packages in Ubuntu feisty for 2.5

2007-07-25 Thread Christophe Bonenfant
Hi -  I do have exactly the same problem with the same distribution 
(Ubuntu Feisty amd64) and am unable to upgrade to R 2.5.1. The 
r-base-core is version 2.4.1 in Ubuntu depositories while all others 
r-cran related packages are upgraded to R 2.5.1 (r-base-dev, r-base...). 
So far I have been unsuccessful at upgrading R. I posted on the Ubuntu 
forum but got no answer yet.

Details:

$ uname -a

Linux bronski 2.6.20-16-generic #2 SMP Thu Jun 7 19:00:28 UTC 2007 
x86_64 GNU/Linux

  R.version
_
platform   x86_64-pc-linux-gnu
arch   x86_64
os linux-gnu
system x86_64, linux-gnu
status
major  2
minor  4.1
year   2006
month  12
day18
svn rev40228
language   R
version.string R version 2.4.1 (2006-12-18)

Christophe


Colleen Doherty a écrit :
 Hi,
 I would like to run R2.5.1 in Ubuntu feisty on an AMD64 chip.
 I am a total newbie to Linux.
 I have successfully compiled 2.5 however, I am not able to figure out
 how to upgrade the packages.
 I am not able to find an R-base-core_2.5.1-1_amd64 or all on the CRAN mirrors.
 I can find one on the Ubuntu feisty site, however when I try to
 install it I get a warning that Dependency is not stisfiable: libc6
 I am pretty convinced I have libc6 installed.
 When I reinstall it with apt-get It says the latest version is
 currently installed.
 I would appreciate any help or advice that y'all have.
 If this is more appropriate on another list, please let me know where
 and I will post it there.
 Thanks!


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] initalizing and checking validity of S4 classes

2007-07-25 Thread Bojanowski, M.J. (Michal)
Dear Martin and Seth,

Thanks a million for explanations and suggestions. I find myself still in the
process of learning S4 system. Can you possibly suggest some material that I
could use in this process?

Anything apart from Programming with data book? I also know the notes written
by John Chambers and I also have Fritz Leisch's slides from the first UseR!,
all three available on the Web. Do you have any suggestions in that matter?

Thanks a lot in advance!

Best, Michal

 Martin Morgan mtmorgan at fhcrc.org writes:
 
  Hi Michal --
 
  Add validObject to your initialize method:
 
 Actually, a call to valid object is part of the default initialization
 method which has been masked.  A different solution, which might have
 some other benefits is to delegate back to the default method using
 callNextMethod.  So you could do:
 
 setMethod(initialize, someclass,
 function(.Object, v=numeric(0), l=character(0))
 {
 # strip the vector names
 
 cv - v
 cl - l
 names(cv) - NULL
 names(cl) - NULL
 callNextMethod(.Object=.Object, v=cv, l=cl)
 } )
 
 
  Here are two interpretations of this. (1) using 'initialize' means
  that you are taking control of the initialization process, and hence
  know when you need to call validObject.
 
 Yes.  Anytime you specialize a method you must take responsibility for
 any less specific methods.  In this case, the default 'initialize'
 does object validation.  So if you want validation, you either need to
 do it directly or invoke the default method.
 
  (2) Responsibility for object
  validity is ambiguous -- does it belong with 'new', 'initialize', or a
  'constructor' that the programmer might write? This is particularly
  problematic with R's copy semantics, where creating transiently
  invalid objects seems to be almost necessary (e.g., callNextMethod()
  in 'initialize' might initialize the inherited slots of the object,
  but the object itself is of the derived class and could well be
  invalid 'invalid' after the base class has finished with initialize).
 
 This is a good point.  It suggests that, at least, one must initialize
 all non-inherited slots to valid values _before_ calling the next
 method.
 
 + seth



:
::
::: Note that my e-mail address has changed to m.j.bojanowski at uu dot nl
::: Please update you address books accordingly. Thank you!
::
:



Michal Bojanowski
ICS / Department of Sociology
Utrecht University
Heidelberglaan 2; 3584 CS Utrecht
The Netherlands
m.j.bojanowski at uu dot nl
http://www.fss.uu.nl/soc/bojanowski/


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Subscript out of bounds when using datadist() from Design library

2007-07-25 Thread Cody Hamilton
I am running R version 2.4.1 on Windows XP.  I have a question regarding the 
datadist() function from the Design library.  I have a data.frame (call it 
my.data) with 4 columns.  When I submit the code

datadist(data=my.data)

I get the following error message:

Error in X[[1]] : subscript out of bounds

I suspect there may be something wrong with my data.frame (I'm certain there is 
nothing wrong with datadist()), but I don't know what.  Has anyone experienced 
the mistake I seem to be making?

Regards,
Cody Hamilton
Edwards Lifesciences

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Subscript out of bounds when using datadist() from Design library

2007-07-25 Thread Chuck Cleland
Cody Hamilton wrote:
 I am running R version 2.4.1 on Windows XP.  I have a question regarding the 
 datadist() function from the Design library.  I have a data.frame (call it 
 my.data) with 4 columns.  When I submit the code
 
 datadist(data=my.data)
 
 I get the following error message:
 
 Error in X[[1]] : subscript out of bounds
 
 I suspect there may be something wrong with my data.frame (I'm certain there 
 is nothing wrong with datadist()), but I don't know what.  Has anyone 
 experienced the mistake I seem to be making?

  If I follow the help page for datadist(), I think you want the following:

datadist(my.data)

  Note the following in the description of the data argument:

Unless the first argument is a fit object, data must be an integer.

  A data frame is not a fit object, so I think that was the reason it
did not work for you.

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

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] using contrasts on matrix regressions (using gmodels, perhaps)

2007-07-25 Thread Ranjan Maitra
Hi, 

I want to test for a contrast from a regression where I am regressing the 
columns of a matrix. In short, the following.

X - matrix(rnorm(50),10,5)
Y - matrix(rnorm(50),10,5)
lm(Y~X)  

Call:
lm(formula = Y ~ X)

Coefficients:
 [,1] [,2] [,3] [,4] [,5]   
(Intercept)   0.3350  -0.1989  -0.1932   0.7528   0.0727
X10.2007  -0.8505   0.0520   0.1501   0.3248
X20.3212   0.7008  -0.0963  -0.2584   0.6711
X30.3781  -0.7321   0.1907  -0.1721   0.3073
X4   -0.1778   0.2822  -0.0644  -0.2649  -0.4140
X5   -0.1079  -0.0475   0.6047  -0.8369  -0.5928


I want to test for c'b = 0 where c is (lets say) the contrast (0, 0, 1, 0, -1). 
Is it possible to do so, in one shot, using gmodels or something else?

Many thanks and best wishes,
Ranjan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Subscript out of bounds when using datadist() from Design library

2007-07-25 Thread Cody Hamilton
Chuck,

Quite right.  Thank you.

Regards, -Cody

-Original Message-
From: Chuck Cleland [mailto:[EMAIL PROTECTED]
Sent: Wednesday, July 25, 2007 4:33 PM
To: Cody Hamilton
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Subscript out of bounds when using datadist() from Design 
library

Cody Hamilton wrote:
 I am running R version 2.4.1 on Windows XP.  I have a question regarding the 
 datadist() function from the Design library.  I have a data.frame (call it 
 my.data) with 4 columns.  When I submit the code

 datadist(data=my.data)

 I get the following error message:

 Error in X[[1]] : subscript out of bounds

 I suspect there may be something wrong with my data.frame (I'm certain there 
 is nothing wrong with datadist()), but I don't know what.  Has anyone 
 experienced the mistake I seem to be making?

  If I follow the help page for datadist(), I think you want the following:

datadist(my.data)

  Note the following in the description of the data argument:

Unless the first argument is a fit object, data must be an integer.

  A data frame is not a fit object, so I think that was the reason it
did not work for you.

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

--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] using contrasts on matrix regressions (using gmodels, perhaps)

2007-07-25 Thread Søren Højsgaard
The doBy package has an esticon function which allows you to do that. 
Regards
Søren



Fra: [EMAIL PROTECTED] på vegne af Ranjan Maitra
Sendt: to 26-07-2007 01:30
Til: R-help
Emne: [R] using contrasts on matrix regressions (using gmodels, perhaps)



Hi,

I want to test for a contrast from a regression where I am regressing the 
columns of a matrix. In short, the following.

X - matrix(rnorm(50),10,5)
Y - matrix(rnorm(50),10,5)
lm(Y~X) 

Call:
lm(formula = Y ~ X)

Coefficients:
 [,1] [,2] [,3] [,4] [,5]  
(Intercept)   0.3350  -0.1989  -0.1932   0.7528   0.0727
X10.2007  -0.8505   0.0520   0.1501   0.3248
X20.3212   0.7008  -0.0963  -0.2584   0.6711
X30.3781  -0.7321   0.1907  -0.1721   0.3073
X4   -0.1778   0.2822  -0.0644  -0.2649  -0.4140
X5   -0.1079  -0.0475   0.6047  -0.8369  -0.5928


I want to test for c'b = 0 where c is (lets say) the contrast (0, 0, 1, 0, -1). 
Is it possible to do so, in one shot, using gmodels or something else?

Many thanks and best wishes,
Ranjan

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] reversing the x-axis terms on a boxplot

2007-07-25 Thread Sundar Dorai-Raj


Dylan Beaudette said the following on 7/25/2007 11:18 AM:
 Hi,
 
 I am able to reverse the order of plotting on regular plots (i.e. with the 
 plot() function) by manually setting the xlim variable. 
 
 Is there some trick like this which will work for a boxplot?
 
 * for example:
 
 l - sample(letters, 500, replace=TRUE)
 n - runif(500)
 boxplot(n ~ l)
 
 
 this will produce a plot with the x-axis ranging from a-z ... i know that 
 these are labels, associated with an integer index-- but is there someway to 
 reverse the plotting order?
 
 Thanks in advance,
 
 Dylan
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

Try this:

set.seed(1)
l - sample(letters, 500, replace=TRUE)
n - runif(500)
l - factor(l, levels = rev(letters))
boxplot(n ~ l)

This is explained in the details section of ?boxplot.

  If multiple groups are supplied either as multiple arguments or
  via a formula, parallel boxplots will be plotted, in the order of
  the arguments or the order of the levels of the factor (see
  'factor').

This means you can create any order you want by setting the factor 
levels explicitly.

HTH,

--sundar

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Subscript out of bounds when using datadist() from Design library

2007-07-25 Thread Frank E Harrell Jr
Cody Hamilton wrote:
 I am running R version 2.4.1 on Windows XP.  I have a question regarding the 
 datadist() function from the Design library.  I have a data.frame (call it 
 my.data) with 4 columns.  When I submit the code
 
 datadist(data=my.data)

You can just use
dd - datadist(my.data); options(datadist='dd')

If that doesn't fix it, generate a test dataset that fails or do 
save(..., compress=TRUE) and send me your dataset so I can debug.

Frank

 
 I get the following error message:
 
 Error in X[[1]] : subscript out of bounds
 
 I suspect there may be something wrong with my data.frame (I'm certain there 
 is nothing wrong with datadist()), but I don't know what.  Has anyone 
 experienced the mistake I seem to be making?
 
 Regards,
 Cody Hamilton
 Edwards Lifesciences
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/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@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] question on using gl1ce from lasso2 package

2007-07-25 Thread Berwin A Turlach
G'day Li,

On Wed, 25 Jul 2007 00:50:43 -0400
Li Li [EMAIL PROTECTED] wrote:

 I tried several settings by using the family=gaussian
 in gl1ce, but none of them works. [...]
  gl1ce(Petal.Width~Sepal.Length+Sepal.Width+Petal.Length,
  data=iris,family=gaussian())
 Error in eval(expr, envir, enclos) : object etastart not found
 
 Does anyone have experience with this function?
 Any help will be appreciated,

Actually,

 gl1ce(Petal.Width~Sepal.Length+Sepal.Width+Petal.Length, data=iris,
+ family=gaussian)

should work.  No need to say `family=gaussian()'.

However, omitting the brackets leads to an even more obscure error
message and using traceback() makes me believe that the function
`family()' must have been changed since this code was ported from
S-Plus to R.  

The version with brackets does not seem to work since the function that
tries to determine initial values for the iterative process of
fitting a GLM tries to access an object called `etastart', which exist
in the list of formal parameters of glm() but is not a formal parameter
of gl1ce(). I am not sure whether this problem always existed or is also
new due to changes in glm() and accompanying functions.  (Time to
re-work the whole lasso2 package, I guess.)

A way to solve your problem is to issue the following commands:

 etastart - NULL
 gl1ce(Petal.Width~Sepal.Length+Sepal.Width+Petal.Length, data=iris,
+ family=gaussian())

However, since you are using the gaussian family, why not use l1ce()
directly?  The following command leads to the same output:

 l1ce(Petal.Width~Sepal.Length+Sepal.Width+Petal.Length, data=iris,
+ absolute=TRUE)

Hope this helps.

Cheers,

Berwin

=== Full address =
Berwin A TurlachTel.: +65 6515 4416 (secr)
Dept of Statistics and Applied Probability+65 6515 6650 (self)
Faculty of Science  FAX : +65 6872 3919   
National University of Singapore
6 Science Drive 2, Blk S16, Level 7  e-mail: [EMAIL PROTECTED]
Singapore 117546http://www.stat.nus.edu.sg/~statba

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] For loops

2007-07-25 Thread Joaquim J. S. Ramalho
Hi,

is there a way of simplifying the following code:

G - rep(NA,n)

for(i in 1:n)
{
gj - 0
for(j in 1:n)
{
for(l in 1:n)
{
for(m in 1:n)
{
gj - gj+G.fun(XB[i]+p[3]*X[j,3]+p[4]*X[l,4]+p[5]*X[m,5],ff)
}
}
}
G[i] - gj/n^3
}

Thanks.

Joaquim Santos

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] [BioC] Color Question about image function in graphics package

2007-07-25 Thread Joern Toedling
Hello Shiliang,

please have a look a the manual page for image (access from R by typing 
?image ). You can specify which colors to use and at which values to 
switch colors using the arguments breaks and colors. For example:

image(matrix(rnorm(36),4,9)+20,col=c(red,blue),breaks=c(-1e5,20,1e5))

basically says: display every cell with a value below 20 in red 
(breaks[1:2] specify the interval for red) and every value above 20 in 
blue
(breaks[2:3] specify the interval for blue).

Regards,
Joern


swang wrote:
 Dear Lists:

 I had  a matrix which has lrt score for my microarray data. I just wonder
 how to visualize them with score over 20 in particular color such as blue.
 I cannot understand the color relationship with the value in z matrix. For
 example, If I see a red color in my image generated by image function. I
 don't know what is the value of z in that spot.
 Example:
 aaa - matrix(rnorm(36),4,9)
 image(aaa)

 Can I paint the cells at which their values are higher than a certain value
 in image()?
 Or I have to use some other functions,

 best

 Shiliang

   [[alternative HTML version deleted]]

 ___
 Bioconductor mailing list
 [EMAIL PROTECTED]
 https://stat.ethz.ch/mailman/listinfo/bioconductor
 Search the archives: 
 http://news.gmane.org/gmane.science.biology.informatics.conductor


__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Updating packages in Ubuntu feisty for 2.5

2007-07-25 Thread Dirk Eddelbuettel
On Wed, Jul 25, 2007 at 09:57:18PM +0200, Christophe Bonenfant wrote:
 Hi -  I do have exactly the same problem with the same distribution 
 (Ubuntu Feisty amd64) and am unable to upgrade to R 2.5.1. The 
 r-base-core is version 2.4.1 in Ubuntu depositories while all others 
 r-cran related packages are upgraded to R 2.5.1 (r-base-dev, r-base...). 
 So far I have been unsuccessful at upgrading R. I posted on the Ubuntu 
 forum but got no answer yet.

Wrong place. Please subscribe to r-sig-debian, and ask there. Someone
may just walk you through (locally) building the R 2.5.1 package for
Debian.  After all, there *are* R 2.5.1 packages for Ubuntu, though
for 32-bit bit aka x86 intel.

Dirk

 
 Details:
 
 $ uname -a
 
 Linux bronski 2.6.20-16-generic #2 SMP Thu Jun 7 19:00:28 UTC 2007 
 x86_64 GNU/Linux
 
   R.version
 _
 platform   x86_64-pc-linux-gnu
 arch   x86_64
 os linux-gnu
 system x86_64, linux-gnu
 status
 major  2
 minor  4.1
 year   2006
 month  12
 day18
 svn rev40228
 language   R
 version.string R version 2.4.1 (2006-12-18)
 
 Christophe
 
 
 Colleen Doherty a écrit :
  Hi,
  I would like to run R2.5.1 in Ubuntu feisty on an AMD64 chip.
  I am a total newbie to Linux.
  I have successfully compiled 2.5 however, I am not able to figure out
  how to upgrade the packages.
  I am not able to find an R-base-core_2.5.1-1_amd64 or all on the CRAN 
  mirrors.
  I can find one on the Ubuntu feisty site, however when I try to
  install it I get a warning that Dependency is not stisfiable: libc6
  I am pretty convinced I have libc6 installed.
  When I reinstall it with apt-get It says the latest version is
  currently installed.
  I would appreciate any help or advice that y'all have.
  If this is more appropriate on another list, please let me know where
  and I will post it there.
  Thanks!
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] if - else

2007-07-25 Thread jim holtman
try:

Start - ifelse (DateFirstEven  DateSecondEvent,
(DateFirstEvent+DateSecondEvent)/2, DateFound)



On 7/25/07, James J. Roper [EMAIL PROTECTED] wrote:
 Greetings,

 I have some confusion with the use of if - else.  Let's say I have a
 four variables as follows:

 Condition   DateFound  DateFirstEvent
 DateSecondEvent
 NA10Jan2000  NA NA
 0   05Jan2000  07Jan2000
   10Jan2000
 1   07Jan2000  07Jan2000
   08Jan2000
 2   09Jan2000  NA 
 NA

 Now, what I need to do is make a new variable that is either the
 midpoint of the first and second event dates, or the date found (I
 will call Start).

 I tried an if - else condition as follows:

 Start - if (DateFirstEven  DateSecondEvent)
 (DateFirstEvent+DateSecondEvent)/2 else DateFound

 I also tried

 Start - if (any(DateFirstEven  DateSecondEvent))
 (DateFirstEvent+DateSecondEvent)/2 else DateFound

 Only the first half of the expression was ever evaluated.

 I hope I have not been to brief, and will certainly appreciate any help.

 Thanks,

 Jim

 --
 James J. Roper
 Population Dynamics and Conservation of
 Terrestrial Vertebrates
 Caixa Postal 19034
 81531-990 Curitiba, Paraná, Brasil
 ===
 E-mail:   [EMAIL PROTECTED]
 Phone/Fone/Teléfono: 55 41 33611764
 celular: 55 41 99870543
 Casa:   55 41 33857249
 ===
 Ecologia e Conservação na UFPR
 http://www.bio.ufpr.br/ecologia/
 ---
 http://jjroper.googlepages.com/
 http://arsartium.googlepages.com/

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

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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 auto-scale cex of y-axis labels in lattice dotplot?

2007-07-25 Thread Kevin Wright
When I create a dotplot in lattice, I frequently observe overplotting
of the labels along the vertical axis.  On my screen, this illustrates
overplotting of the letters:

windows()
reps=6
dat=data.frame(let=rep(letters,each=reps), grp=rep(1:reps, 26),
  y=runif(26*reps))
dotplot(let~y|grp, dat)

Is there a way to automatically scale the labels so that they are not
over-plotted?

I currently do something like this:
Calculate or guess the number of panel rows: NumPanelRows
cexLab - min(1, .9*par()$pin[2]/
  (nlevels(dat$let)*NumPanelRows*strheight(A,units=in)))
dotplot(..., scales=list(y=list(cex=cexLab))

Is there an easier way?

Is there a function that I can call which calculates the layout of the
panels that will be used in the dotplot?

Any tips will be appreciated.

K Wright

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] Updating packages in Ubuntu feisty for 2.5

2007-07-25 Thread Colleen Doherty
Hi,
I would like to run R2.5.1 in Ubuntu feisty on an AMD64 chip.
I am a total newbie to Linux.
I have successfully compiled 2.5 however, I am not able to figure out
how to upgrade the packages.
I am not able to find an R-base-core_2.5.1-1_amd64 or all on the CRAN mirrors.
I can find one on the Ubuntu feisty site, however when I try to
install it I get a warning that Dependency is not stisfiable: libc6
I am pretty convinced I have libc6 installed.
When I reinstall it with apt-get It says the latest version is
currently installed.
I would appreciate any help or advice that y'all have.
If this is more appropriate on another list, please let me know where
and I will post it there.
Thanks!

-- 
Colleen Doherty
Thomashow Lab
310 Plant Biology
Michigan State University
East Lansing, MI 48824

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/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] DF and intercept term meaning for mixed (lme) models

2007-07-25 Thread Dylan Beaudette
Hi,

I am using the lme package to fit mixed effects models to a set of data.

I am having a difficult time understanding the *meaning* of the numDF (degrees 
of freedom in the numerator), denDF (DF in the denomenator), as well as the 
Intercept term in the output.

For example:

I have a groupedData object called 'Soil', and am fitting an lme model as 
follows:

## fit a simple model
# errors partitioned among replicates
fit1 - lme(
   log(ksat) ~ log(conc) + ordered(sar) + soil_id ,
   random = ~ 1 | rep,
   data=Soil
)

## check significance of model terms
anova(fit1)

              numDF denDF  F-value p-value
(Intercept)      1  1253 64313.21  .0001
log(conc)        1   597   173.34  .0001
ordered(sar)     2   597    13.87  .0001
soil_id         29   597    54.92  .0001


I am pretty sure that I am interpreting the p-values for the predictor terms 
to mean that these terms contribute significantly to the variation in the 
response variable, (?) . I am not sure what the significance of the Intercept 
term really means. Does it have something to do with the significance of the 
random effects in the model?

Also, from a practical standpoint, how can I best describe / interpret the 
numDF and denDF terms to others... or do they even matter to a person who is 
looking to see if the 'treatment' predictor terms had any effect on the 
response term?

Thanks in advance. 

Dylan

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