Re: [R] merge

2007-06-21 Thread Mike Meredith

Looking at the data, maybe what you need is an array:

array(c(A, B), c(5,6,2), dimnames=list(rownames(A),
colnames(A), c("obs","pred")))

This allows you to keep the names and 'supernames'.

This will work if A and B are matrices, not data frames, so you may have to
use 'as.matrix' first.

HTH, Mike.


elyakhlifi mustapha wrote:
> 
> Hello,
> ok I know how to do to merge matrix or data.frame by "row.names" but my
> true objectif is to merge for example this data.frame:
> 
>> A
>   obs
>Rép1 Rép2 Rép3 Rép4 Rép5 Rép6
>   Var1  145  145  150  145  140  145
>   Var2  150  150  160  155  155  150
>   Var3  155  155  160  150  150  140
>   Var4  150  145  145  145  140  145
>   Var5  135  130  145  135  135  130
> 
> and 
> 
>> B
>   pred
>  Rép1   Rép2   Rép3   Rép4   Rép5   Rép6
>   Var1 146.00 144.00 151.00 145.00 143.00 141.00
>   Var2 154.33 152.33 159.33 153.33 151.33 149.33
>   Var3 152.67 150.67 157.67 151.67 149.67 147.67
>   Var4 146.00 144.00 151.00 145.00 143.00 141.00
>   Var5 136.00 134.00 141.00 135.00 133.00 131.00
> 
> and the main difficulty is to keep the names and the supernames.
> 

-- 
View this message in context: 
http://www.nabble.com/merge-tf3953336.html#a11247082
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] logit problem

2007-06-21 Thread yoo hoo
Hi there,
 
 I was trying to fit this dataset into LR model. This dataset includes 18 
normal and 17 
 cancer. There are totally 14 markers (7 mRNAs and 7 Proteins). When I fitted 
into LR 
 model, R gave me warning:
 Warning messages:
 1: algorithm did not converge in: glm.fit(x = X, y = Y, weights = weights, 
start = start, 
 etastart = etastart,
 2: fitted probabilities numerically 0 or 1 occurred in: glm.fit(x = X, y = Y, 
weights = 
 weights, start = start, etastart = etastart,
 
 I don't know why the algorithm did not converge. Is it because sample 
size/marker is 
 small? Is it possible you run this dataset in s-plus? Thank you very much for 
your help.
 
 Michael
   
-

__
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] R.oo 1.2.7 Incompatible with R 2.5.0?

2007-06-21 Thread Feng, Ken
Hi,

I need a sanity check.  When I try the following:

library(R.oo)
setConstructorS3( "QREobject", abstract=TRUE,
  function(...)  {
extend( Object(), "QREobject" );
  }
);

I get:

Error in names(args) : no applicable method for "names"

Things were working fine in R 2.4.1  
I wonder if it has to do with this release note for R 2.5.0:

o   levels<-(), names() and names<-() now dispatch internally for
efficiency and so no longer have S3 default methods.

from here:

https://stat.ethz.ch/pipermail/r-announce/2007/000828.html

I'm wondering if I have done something wrong or is there an incompatibility 
issue.

If it's the latter, I hope Mr. Henrik Bengtsson would be nice enough to update 
the software.
I'm so dependent on R.oo that I will roll back to 2.4.1 until there's a 
workaround for this.

Anyone else having similar issues?  Thanks in advance.

- Ken

__
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] Multinomial models

2007-06-21 Thread Prof Brian Ripley
On Thu, 21 Jun 2007, nicole baerg wrote:

> Hello,
>
> I am VERY new to R (one week) and I am trying to run a multinomial logit 
> model.
> The model I am using is
>
>> model1 <- multinom(Y ~ X1 + X2 + , ..., Xn)
>
> if I put in
>
>> summary(model1)
>
> I get
>
> #Error in function (classes, fdef, mtable)  :
>unable to find an inherited method for function "fitted", for
> signature "multinom"

You have some other package attached (you are using 'nnet' without mention 
or credit) that has broken summary() (the correct summary method does not 
use fitted()).  The R posting guide asks for the output of sessionInfo(), 
and that would have helped us here. All I can tell is that the culprit is 
an S4-using package.

Try again with only the smallest possible set of packages attached.

> and if I put in
>
>> coef(model1)
>
> I get the coefficients. I would like, however, to get the
> coefficients, estimates, Std Erros and t-Ratios and/or z or P>[z]
>
> Also can you change the speficiation of the base category without recoding?

?contr.treatment
?relevel

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

PLEASE do

-- 
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] Data consistency checks in functions

2007-06-21 Thread Anup Nandialath
Dear friends,

I'm writing a function with three arguments

myfun <- function(theta, X, values)

{


}

in this function, I'm trying to write consistency checks. In order to compute 
the statistic of interest I only need theta and values. The idea of having X in 
there is that, if values is not provided by the user, then values is computed 
from X.

my problem is I'm trying to write consistency checks. For instance if i say

output <- myfun(beta, val1), how do I ensure that R reads this as passing 
arguments to "theta" and "values". In other words is it possible to bypass X 
completely if values is provided. Also how is it possible for R to recognize 
the second argument as being values and not X. This is important because X is a 
matrix and values is a vector. Therefore any checks using the dimensions of 
either one will land in trouble if it does not correctly capture that. 

Thanks in advance
Sincerely

Anup

   
-


[[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] set up a talbe with column name and write to the table row by row

2007-06-21 Thread Yuchen Luo
Dear Friends.
I tried to set up a table with column name and write to it row by row.
I have  3 rows to write to the table:

a1 <- list(name="Fred", wife="Mary", no.children=3)
a2 <- list(name="Tom", wife="Joy", no.children=9)
a3 <- list(name="Paul", wife="Alic", no.children=5)

When I write to it, the first write command has to be different than others
in order to put the column name in the table:

write.table(a1, file = "tt.csv", sep=',',row.names=FALSE,col.name=TRUE)

write.table(a2, file="tt.csv", sep=',', append=TRUE, row.names=FALSE,
col.names=FALSE)

write.table(a3, file="tt.csv", sep=',', append=TRUE, row.names=FALSE,
col.names=FALSE)
Is there a way to seperate the operation of
1.putting the column name in the table
and
2. writing the first row to the table
?

Best Wishes
Yuchen



>
>

[[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] Switching X-axis and Y-axis for histogram

2007-06-21 Thread Donghui Feng
Dear all,

I'm creating a histogram with the function hist(). But
right now what I get is column representation (as normal).
I'm wondering if I could switch X-axis and Y-axis and
get row-representation of frequencies?

One more question, can I define the step of each axises
for the histogram?

Thanks so much!

Donghui

__
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] Adding exponents (superscript format) to a plot

2007-06-21 Thread Duncan Murdoch
On 21/06/2007 7:39 PM, Judith Flores wrote:
 > Hi,
 >
 >I need to add exponents to a label in one of the
 > axes of a plot, how can I do this?

See ?plotmath.  For example,

plot(1,2, xlab=expression(x^2), ylab=expression(exp(-x^2/2)))

Duncan Murdoch

__
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] sorting data

2007-06-21 Thread Moshe Olshansky
Try ReadWriteXls package from CRAN.

--- dala <[EMAIL PROTECTED]> wrote:

> 
> I have a 2 columns, Date and Number, in Excel. 
> I copy and paste them into Notepad.
> I can use scan() to import the file but how do I
> plot this data with Date as
> the x-axis?
> -- 
> View this message in context:
>
http://www.nabble.com/sorting-data-tf3958889.html#a11233613
> 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] anova on data means

2007-06-21 Thread Moshe Olshansky
An ugly solution (but which works) would be something
like this (assuming that d is a data.frame with 4
columns named Tank, Trt, Fish, Size):

x <-1:12
for (i in 1:12) x[i] <- mean(d$Size[d$Tank == i])

Regards,
Moshe Olshansky

--- Ronaldo Reis Junior <[EMAIL PROTECTED]> wrote:

> Em Quinta 21 Junho 2007 16:56, Thomas Miller
> escreveu:
> > I am transitioning from SAS to R and am struggling
> with a relatively simple
> > analysis.  Have tried Venables and Ripley and
> other guides but can't find a
> > solution.
> >
> > I have an experiment with 12 tanks.  Each tank
> holds 10 fish.  The 12 tanks
> > have randomly assigned one of 4 food treatments -
> S(tarve), L(ow), M(edium)
> > and H(igh).  There are 3 reps of each treatment. 
> I collect data on size of
> > each fish at the end of the experiment.  So my
> data looks like
> >
> > Tank  Trt   Fish   Size
> > 1  S 1  3.4
> > 1  S 2  3.6
> > 
> > 1  S10  3.5
> > 2  L 1  3.4
> > 
> > 12M 10  2.1
> >
> > To do the correct test of hypothesis using anova,
> I need to calculate the
> > tank means and use those in the anova.  I have
> tried using tapply() and
> > by() functions, but when I do so I "loose" the
> treatment level because it
> > is categorical.  I have used
> > Meandat >
> > But that doesn't give me a dataframe that I can
> then use to do the actual
> > aov analysis.  So what is the most efficient way
> to accomplish the analysis
> >
> > Thanks
> >
> > Tom Miller
> 
> Tom,
> 
> try the aggregate funtion. Somethink like this
> 
> meandat <- aggregate(Size,list(Tank,Trt),mean)
> 
> Inte
> Ronaldo
> --
> > Prof. Ronaldo Reis Júnior
> |  .''`. UNIMONTES/Depto. Biologia Geral/Lab. de
> Ecologia
> | : :'  : Campus Universitário Prof. Darcy Ribeiro,
> Vila Mauricéia
> | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG
> - Brasil
> |   `- Fone: (38) 3229-8187 |
> [EMAIL PROTECTED] | [EMAIL PROTECTED]
> | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 |
> LinuxUser#: 205366
> 
> __
> 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] questions for hist()

2007-06-21 Thread Donghui Feng
Dear all,

I'm creating a histogram with the function hist(). But
right now what I get is column representation (as normal).
I'm wondering if I could switch X-axis and Y-axis and
get row-representation of frequencies?

One more question, can I define the step of each axises
for the histogram?

Thanks so much!

Donghui

__
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] Adding exponents (superscript format) to a plot

2007-06-21 Thread Judith Flores
Hi,

   I need to add exponents to a label in one of the
axes of a plot, how can I do this?

Thank you,

Judith


 

Food fight? Enjoy some healthy debate

__
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 the object of character data type as the name of the slot

2007-06-21 Thread Duncan Murdoch
On 21/06/2007 4:07 PM, Alex Tsoi wrote:
> Dear all,
> 
> I have a character string object:
> 
>> chara
> [1]  "The name of first slot"
> 
> and a list object:
> 
>> class( try1)
> [1] "list"
> 
> 
> what I want to do is to use the chara as a slot's name of "try1".
> 
> Of  course I could do it like:
> 
>> try1$"The name of first slot"  <- matrix("", 3, 4)
> 
> to create a slot of 3x4 matrix with the name "The name of first slot"
> 
> However, I would like to know how could I utilize the object chara , and to
> use the characters it contains as the name of the slot of try1.

You can use

slot(try1, chara) <- matrix("", 3, 4)

as long as the slot name contained in chara really is a slot.

Duncan Murdoch

__
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] Binary decision problem

2007-06-21 Thread Moshe Olshansky
Hi Tolga,

I do not see any problem with:
max {a1*x1 + a2*x2 + ... + a800*x800}
subject to:
x1+x2+ ... + x800 = 100
b1*x1+b2*x2+ ... +b800*x800 <= B
c1*x1+c2*x2+ ... +c800*x800 <= C
and an additional condition that x1,x2,...,x800 are
binary 0-1.

Regards,

Moshe Olshansky

--- Tolga Uzuner <[EMAIL PROTECTED]> wrote:

> Dear R Users,
> 
> I am trying to use LP_SOLVE and would appreciate any
> assistance with
> the following problem:
> - I am trying to choose a fixed number of items out
> of a batch of
> items: say 100 out of 800
> - items have certain characteristics, say
> characteric A, B and C
> - I want to maximise the sum of A across all 100
> items I choose while
> ensuring that the sum of B and C across the items do
> not exceed
> certain constraints
> 
> How exactly do I set this up in lp_solve ? If I
> associate a boolean, 0
> or 1, with each item, I can constrain the sum of the
> boolean to be
> equal to 100. But how do I then further specify the
> other constraints
> (on the sum of B and the sum of C) and the objective
> function (to
> maximise the sum of A) ?
> 
> Thanks,
> Tolga
> 
> __
> 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] Multinomial models

2007-06-21 Thread Roland Rau
Hi,

since you are very new to R, just a small advice: try to give a minimal 
reproducible, self-contained example. This helps quite often to spot 
some mistakes yourself. This is my own experience and has been 
experienced by others, see, for example:
library(fortunes)
fortune("Ripleyed")

  :-)

For example, mention that you are (probably?) using the package 'nnet'.

nicole baerg wrote:
> I get the coefficients. I would like, however, to get the
> coefficients, estimates, Std Erros and t-Ratios and/or z or P>[z]
Check
names(model1) #if model1 is your fitted model as you write

then you will see a list of the components the fitted object should 
have. I guess the list should look similar to this:
  [1] "n" "nunits""nconn" "conn"
  [5] "nsunits"   "decay" "entropy"   "softmax"
  [9] "censored"  "value" "wts"   "fitted.values"
[13] "residuals" "lev"   "call"  "terms"
[17] "weights"   "deviance"  "rank"  "coefnames"
[21] "vcoefnames""contrasts" "xlevels"   "edf"
[25] "AIC"



> 
> Also can you change the speficiation of the base category without recoding?
> 
Check
?relevel

I hope this helps,
Roland

__
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] Result depends on order of factors in unbalanced designs (lme, anova)?

2007-06-21 Thread Karl Knoblick
Dear R-Community!

For example I have a study with 4 treatment groups (10 subjects per group) and 
4 visits. Additionally, the gender is taken into account. I think - and hope 
this is a goog idea (!) - this data can be analysed using lme as below.

In a balanced design everything is fine, but in an unbalanced design there are 
differences depending on fitting y~visit*treat*gender or y~gender*visit*treat - 
at least with anova (see example). Does this make sense? Which ordering might 
be the correct one?

Here the example script:
library(nlme)
set.seed(123)
# Random generation of data:
NSubj<-40 # No. of subjects
set.seed(1234)
id<-factor(rep(c(1:NSubj),4)) # ID of subjects
treat<-factor(rep(rep(1:4,each=5),4)) # Treatment 4 Levels
gender<-factor(rep(rep(1:2, each=20),4))
visit<-factor(rep(1:4, each=NSubj))
y<-runif(4*NSubj) # Results
# Add effects
y<-y+0.01*as.integer(visit)
y<-y+0.02*as.integer(gender)
y<-y+0.024*as.integer(treat)
df<-data.frame(id, treat, gender, visit, y)
# groupedData object for lme
gdat<-groupedData(y ~ visit|id, data=df)
# fits - different ordering of factors
fit1<-lme(y ~ visit*treat*gender, data=gdat, random = ~visit|id)
anova(fit1)
fit2<-lme(y ~ gender*treat*visit, data=gdat, random = ~visit|id)
anova(fit2)
# Result: identical (balanced design so far), ok
# Now change gender of subject 1
gdat$gender[c(1,41,81,121)]<-2
# onece more fits with different ordering of factors
fit1<-lme(y ~ visit*treat*gender, data=gdat, random = ~visit|id)
anova(fit1)
fit2<-lme(y ~ gender*treat*visit, data=gdat, random = ~visit|id)
anova(fit2)
# Result: There are differences!!

Hope anybody can help or give me advice how to interpret these results 
correctly or how to avoid this problem! Is there a better possibility to 
analyse these data than lme?

Thanks!
Karl

__
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] Binary decision problem

2007-06-21 Thread Tolga Uzuner
Dear R Users,

I am trying to use LP_SOLVE and would appreciate any assistance with
the following problem:
- I am trying to choose a fixed number of items out of a batch of
items: say 100 out of 800
- items have certain characteristics, say characteric A, B and C
- I want to maximise the sum of A across all 100 items I choose while
ensuring that the sum of B and C across the items do not exceed
certain constraints

How exactly do I set this up in lp_solve ? If I associate a boolean, 0
or 1, with each item, I can constrain the sum of the boolean to be
equal to 100. But how do I then further specify the other constraints
(on the sum of B and the sum of C) and the objective function (to
maximise the sum of A) ?

Thanks,
Tolga

__
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] abline plots at wrong abscissae after boxplot

2007-06-21 Thread Sundar Dorai-Raj


Brian Wilfley said the following on 6/21/2007 2:44 PM:
> Hi folks,
> 
> I'm using R 2.5.0 under ESS under Windows XP. (This also happens using
> the Rgui application.)
> 
> I'm trying to add lines to a plot originally made with "boxplot", but
> the lines appear in the wrong place. Below is a script that
> illustrates the problem
> 
> # boxablinetest.R - script to show problem with abline on box plot
> 
> x <-  c(  2,  2,  2,  3,  3,  3,  4,  4,  4)
> y <-  c(  1,  2,  3,  2,  3,  4,  3,  4,  5)
> 
> xymodel <- lm( y~x)
> 
> boxplot( y~x)
> abline( xymodel)# Wrong abcissae
> abline( v = 2.5)# Wrong abcissa
> abline( h = 2.75)   # Right ordinate
> 
> # -- end --
> 
> Here, I'm making a box plot with abscissae that start at 2. The box
> plot looks fine: the numbers 2, 3, and 4 appear on the x-axis and the
> boxes are centered at 2, 3, and 4.
> 
> When I add the first abline, the line appears too low, but actually it
> is too far to the right. The abscissae are being interpreted without
> realizing that the plot originates at 2, not 1.
> 
> The second call to abline should put a vertical line between 2 and 3,
> but instead it shows up between 3 and 4. Again, it appears that the
> offset in the origin of the boxplot is not accounted for.
> 
> Finally the last abline appears where it should: between 2 and 3.
> Evidently, ordinate values are correctly interpreted.
> 
> Does anyone have any advice?
> 
> Thanks very much.
> 
> Brian Wilfley
> 
> __
> 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.


That's because the x is converted to a factor (see ?boxplot). Here's 
what you want:

## changesd x==3 to 6 to demonstrate call to boxplot below
x <- c(2, 2, 2, 3, 3, 3, 6, 6, 6)
y <- c(1, 2, 3, 2, 3, 4, 3, 4, 5)

xymodel <- lm(y ~ x)

boxplot(y ~ x) ## note x-labels!

## now fix your problem
plot(y ~ x, type = "n", xlim = c(1, 7))
bxp(boxplot(y ~ x, plot = FALSE), at = c(2, 3, 6),
 add = TRUE, boxwex = 0.5, boxfill = "lightblue")
abline(xymodel)
abline(v = 2.5)
abline(h = 2.75)

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.


[R] Multinomial models

2007-06-21 Thread nicole baerg
Hello,

I am VERY new to R (one week) and I am trying to run a multinomial logit model.
The model I am using is

> model1 <- multinom(Y ~ X1 + X2 + , ..., Xn)

if I put in

> summary(model1)

I get

#Error in function (classes, fdef, mtable)  :
unable to find an inherited method for function "fitted", for
signature "multinom"

and if I put in

> coef(model1)

I get the coefficients. I would like, however, to get the
coefficients, estimates, Std Erros and t-Ratios and/or z or P>[z]

Also can you change the speficiation of the base category without recoding?

Thanks.

Nicole

__
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] abline plots at wrong abscissae after boxplot

2007-06-21 Thread Brian Wilfley
Hi folks,

I'm using R 2.5.0 under ESS under Windows XP. (This also happens using
the Rgui application.)

I'm trying to add lines to a plot originally made with "boxplot", but
the lines appear in the wrong place. Below is a script that
illustrates the problem

# boxablinetest.R - script to show problem with abline on box plot

x <-  c(  2,  2,  2,  3,  3,  3,  4,  4,  4)
y <-  c(  1,  2,  3,  2,  3,  4,  3,  4,  5)

xymodel <- lm( y~x)

boxplot( y~x)
abline( xymodel)# Wrong abcissae
abline( v = 2.5)# Wrong abcissa
abline( h = 2.75)   # Right ordinate

# -- end --

Here, I'm making a box plot with abscissae that start at 2. The box
plot looks fine: the numbers 2, 3, and 4 appear on the x-axis and the
boxes are centered at 2, 3, and 4.

When I add the first abline, the line appears too low, but actually it
is too far to the right. The abscissae are being interpreted without
realizing that the plot originates at 2, not 1.

The second call to abline should put a vertical line between 2 and 3,
but instead it shows up between 3 and 4. Again, it appears that the
offset in the origin of the boxplot is not accounted for.

Finally the last abline appears where it should: between 2 and 3.
Evidently, ordinate values are correctly interpreted.

Does anyone have any advice?

Thanks very much.

Brian Wilfley

__
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] percentage in R

2007-06-21 Thread Roland Rau
[EMAIL PROTECTED] wrote:
> Hi There,
> 
> How to display a number in the formation of percentage?
> 
> For example, a=0.25, how to display 25%?

if you write 'how to display' I guess you mean in a plot?

a <- 0.25
plot(0:10, 0:10, type="n")
text(x=5, y=5, labels=paste(round(a*100,0), "%", sep=""))

does this help?
Roland

__
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] percentage in R

2007-06-21 Thread Christoph Heibl
Hi,

do you want to display the proportion as a character string? This  
would be simple:

 > a <- 0.25
 > aa <- paste(a*100, "%", sep="")
 > aa
[1] "25%"

Cheers,
Christoph


On 21.06.2007, at 22:45, [EMAIL PROTECTED] wrote:

> Hi There,
>
> How to display a number in the formation of percentage?
>
> For example, a=0.25, how to display 25%?
>
> Thank you very much.
>
> Van
>
> __
> 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] percentage in R

2007-06-21 Thread genomenet
Hi There,

How to display a number in the formation of percentage?

For example, a=0.25, how to display 25%?

Thank you very much.

Van

__
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] anova on data means

2007-06-21 Thread Peter Dalgaard
Ronaldo Reis Junior wrote:
> Em Quinta 21 Junho 2007 16:56, Thomas Miller escreveu:
>   
>> I am transitioning from SAS to R and am struggling with a relatively simple
>> analysis.  Have tried Venables and Ripley and other guides but can't find a
>> solution.
>>
>> I have an experiment with 12 tanks.  Each tank holds 10 fish.  The 12 tanks
>> have randomly assigned one of 4 food treatments - S(tarve), L(ow), M(edium)
>> and H(igh).  There are 3 reps of each treatment.  I collect data on size of
>> each fish at the end of the experiment.  So my data looks like
>>
>> Tank  Trt   Fish   Size
>> 1  S 1  3.4
>> 1  S 2  3.6
>> 
>> 1  S10  3.5
>> 2  L 1  3.4
>> 
>> 12M 10  2.1
>>
>> To do the correct test of hypothesis using anova, I need to calculate the
>> tank means and use those in the anova.  I have tried using tapply() and
>> by() functions, but when I do so I "loose" the treatment level because it
>> is categorical.  I have used
>> Meandat>
>> But that doesn't give me a dataframe that I can then use to do the actual
>> aov analysis.  So what is the most efficient way to accomplish the analysis
>>
>> Thanks
>>
>> Tom Miller
>> 
>
> Tom,
>
> try the aggregate funtion. Somethink like this
>
> meandat <- aggregate(Size,list(Tank,Trt),mean)
>   

Why not just include an error term for Tank in the model?

summary(aov(Size~Trt+Error(Tank)))

 
> Inte
> Ronaldo
> --
>   
>> Prof. Ronaldo Reis Júnior
>> 
> |  .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Ecologia
> | : :'  : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia
> | `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
> |   `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED]
> | http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366
>
> __
> 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] calculating co-spectra and quad-spectra

2007-06-21 Thread Bryan K Woods
I am trying to calculate co and quad spectra for meteorological 
variables in order to spectrally examine momentum and energy fluxes. I 
noticed that the spec.pgram function returns power curves for both 
individual variables as well as coherence and phase information, but 
nothing about the co/quad spectrum. Does anyone have any experience with 
this and know of a way to back the cross-spectra out of this information 
or know of another package?

Thanks
Bryan

-- 
Bryan Woods
Dept. of Geology & Geophysics
Yale University, KGL 234
210 Whitney Ave
New Haven, CT 06511

978.726.3462 (cell)
203.432.3134 (fax)
203.404.3365 (home)

__
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] barchart in trellis and NA

2007-06-21 Thread Deepayan Sarkar
On 6/21/07, Sigbert Klinke <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I've a dataset with discrete data and several groups and in one group I
> have also missing values (NA). When I use table and barchart to
> visualize the counts I never get a bar for  NA in the barchart although
> it appears in the result of table. Is there a possibility to get this
> bar too?

Please give a reproducible example, because it's not clear to me what
exactly is supposed to be NA.

-Deepayan

__
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] anova on data means

2007-06-21 Thread Ronaldo Reis Junior
Em Quinta 21 Junho 2007 16:56, Thomas Miller escreveu:
> I am transitioning from SAS to R and am struggling with a relatively simple
> analysis.  Have tried Venables and Ripley and other guides but can't find a
> solution.
>
> I have an experiment with 12 tanks.  Each tank holds 10 fish.  The 12 tanks
> have randomly assigned one of 4 food treatments - S(tarve), L(ow), M(edium)
> and H(igh).  There are 3 reps of each treatment.  I collect data on size of
> each fish at the end of the experiment.  So my data looks like
>
> Tank  Trt   Fish   Size
> 1  S 1  3.4
> 1  S 2  3.6
> 
> 1  S10  3.5
> 2  L 1  3.4
> 
> 12M 10  2.1
>
> To do the correct test of hypothesis using anova, I need to calculate the
> tank means and use those in the anova.  I have tried using tapply() and
> by() functions, but when I do so I "loose" the treatment level because it
> is categorical.  I have used
> Meandat
> But that doesn't give me a dataframe that I can then use to do the actual
> aov analysis.  So what is the most efficient way to accomplish the analysis
>
> Thanks
>
> Tom Miller

Tom,

try the aggregate funtion. Somethink like this

meandat <- aggregate(Size,list(Tank,Trt),mean)

Inte
Ronaldo
--
> Prof. Ronaldo Reis Júnior
|  .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Ecologia
| : :'  : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia
| `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
|   `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | [EMAIL PROTECTED]
| http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366

__
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] Overlaying lattice graphs (continued)

2007-06-21 Thread Deepayan Sarkar
On 6/21/07, Sébastien <[EMAIL PROTECTED]> wrote:
> Hi Hadley,
>
> Hopefully, my dataset won't be too hard to changed. Can I modify the
> aspect of each group using your code (symbols for observed and lines for
> predicted)?
>
> Sebastien
>
> hadley wickham a écrit :
> > Hi Sebastian,
> >
> > I think you need to rearrange your data a bit.  Firstly, you need to
> > put observed on the same footing as the different models, so you would
> > have a new column in your data called value (previously observed and
> > predicted) and a new model type ("observed").  Then you could do:

Yes, and ?make.groups (and reshape of course) could help with that.
This might not be strictly necessary though.

However, I'm finding your pseudo-code confusing. Could you create a
small example data set that can be used to try out some real code?
Just from your description, I would have suggested something like

xyplot(Observed + Predicted ~ Time | Individuals + Model,
   data = mydata,
   panel = panel.superpose.2, type = c("p", "l"),
   layout = c(0, nlevels(mydata$Individuals)),
   <...>)

If all you want is to plot one page at a time, there are easier ways to do that.

-Deepayan

> >
> > xyplot(value ~ time | individauls, data=mydata, group=model)
> >
> > Hadley
> >
> >
> > On 6/21/07, Sébastien <[EMAIL PROTECTED]> wrote:
> >> Dear R Users,
> >>
> >> I recently posted an email on this list  about the use of data.frame and
> >> overlaying multiple plots. Deepayan kindly indicated to me the
> >> panel.superposition command which worked perfectly in the context of the
> >> example I gave.
> >> I'd like to go a little bit further on this topic using a more complex
> >> dataset structure (actually the one I want to work on).
> >>
> >>  >mydata
> >>   PlotModelIndividualsTimeObserved
> >> Predicted
> >> 11A   1  0.05
> >> 1010.2
> >> 21A   1  0.10
> >> 2019.5
> >> etc...
> >> 10  1B   1  0.05 10
> >>  9.8
> >> 11  1B   1  0.10 20
> >>  20.2
> >> etc...
> >>
> >> There are p "levels" in mydata$Plot, m in mydata$Model, n in
> >> mydata$Individuals and t in mydata$Time (Note that I probably use the
> >> word levels improperly as all columns are not factors). Basically, this
> >> dataset summarizes the t measurements obtained in n individuals as well
> >> as the predicted values from m different modeling approaches (applied to
> >> all individuals). Therefore, the observations are repeated m times in
> >> the Observed columns, while the predictions appears only once for a
> >> given model an a given individual.
> >>
> >> What I want to write is a R batch file creating a Trellis graph, where
> >> each panel corresponds to one individual and contains the observations
> >> (as scatterplot) plus the predicted values for all models (as lines of
> >> different colors)... $Plot is just a token: it might be used to not
> >> overload graphs in case there are too many tested models. The fun part
> >> is that the values of p, m, n and t might vary from one dataset to the
> >> other, so everything has to be coded dynamically.
> >>
> >> For the plotting part I was thinking about having a loop in my code
> >> containing something like that:
> >>
> >> for (i in 1:nlevels(mydata$Model)) {
> >>
> >> subdata<-subset(mydata,mydata$Model=level(mydata$Model)[i])
> >> xyplot(subset(Observed + Predicted ~ Time | Individuals, data =
> >> subdata)   #plus additionnal formatting code
> >>
> >> }
> >>
> >> Unfortunately, this code simply creates a new Trellis plot instead of
> >> adding the model one by one on the panels. Any idea or link to a useful
> >> command will wellcome.
> >>
> >> Sebastien
> >>
> >> __
> >> 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.


[R] Using the object of character data type as the name of the slot

2007-06-21 Thread Alex Tsoi
Dear all,

I have a character string object:

> chara
[1]  "The name of first slot"

and a list object:

> class( try1)
[1] "list"


what I want to do is to use the chara as a slot's name of "try1".

Of  course I could do it like:

> try1$"The name of first slot"  <- matrix("", 3, 4)

to create a slot of 3x4 matrix with the name "The name of first slot"

However, I would like to know how could I utilize the object chara , and to
use the characters it contains as the name of the slot of try1.


I appreciate for any suggesion. Thanks.



-- 
Lam C. Tsoi (Alex)
Medical University of South Carolina

[[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] anova on data means

2007-06-21 Thread Thomas Miller
I am transitioning from SAS to R and am struggling with a relatively simple
analysis.  Have tried Venables and Ripley and other guides but can't find a
solution.

I have an experiment with 12 tanks.  Each tank holds 10 fish.  The 12 tanks
have randomly assigned one of 4 food treatments - S(tarve), L(ow), M(edium)
and H(igh).  There are 3 reps of each treatment.  I collect data on size of
each fish at the end of the experiment.  So my data looks like

Tank  Trt   Fish   Size
1  S 1  3.4
1  S 2  3.6

1  S10  3.5
2  L 1  3.4

12M 10  2.1

To do the correct test of hypothesis using anova, I need to calculate the
tank means and use those in the anova.  I have tried using tapply() and by()
functions, but when I do so I "loose" the treatment level because it is
categorical.  I have used 
Meandathttps://stat.ethz.ch/mailman/listinfo/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 hide axis interval values in a plot

2007-06-21 Thread spime

thanks. got my answer.



spime wrote:
> 
> 
> 
>>plot(cars)
> 
> this shows a plot having interval values of axes (x-axis:5-25;
> y-axis:0-120). I want to hide these values. is there any way?
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-hide-axis-interval-values-in-a-plot-tf3960418.html#a11240427
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] [R-pkgs] odfWeave version 0.5.9 released

2007-06-21 Thread Kuhn, Max
A new version of odfWeave has been released to CRAN. This is a
significant change to the package internals. It now uses the XML library
instead of a bunch of regular expressions.

New features include:

   - Captions for tables and figures
   - Functions to insert page breaks and to change the page layout
   - Style objects for frames and pages

Bug fixes include:

   - Parsing of arguments for graphics devices
   - Misc issues with bulleted lists

There is also a 30 page manual in the examples sub-directory that
describes the various style element and their values, with almost 50
code chunks for illustration.

Thanks to Steve Weston, Nathan Coulter, Sarah Goslee and Ralf Herold.

Send me any questions or comments,

Max

--
LEGAL NOTICE\ Unless expressly stated otherwise, this messag...{{dropped}}

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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 create cumulative histogram from two independent variables?

2007-06-21 Thread Jose Borreguero
I think plot.ecdf(rnorm(100),rexp(100)) is a cumulative histogram for
observations
x1,x2, ... xn, but I don't know if there is another intrinsic function that
plots a cumulative histogram for observations (x1,y1) , (x2,y2) ... (xn,yn),
that is, the fraction of observations with x less or equal to some value and
with y less or equal to some value
   Fn(x,y)#{xi˜x & yi˜y n=frac1 n\sum_{i=1}^n \mathbf{1}_{[x_i <= x,
y_i<=y]}

On 6/21/07, Mike Lawrence <[EMAIL PROTECTED]> wrote:
>
>
> ?plot.ecdf
>
> plot.ecdf(rnorm(100),rexp(100))
>
> On 20-Jun-07, at 5:02 PM, Jose Borreguero wrote:
>
> > Hi all,
> > I am extremely newbie to R. Can anybody jump-start me with any
> > clues as to
> > how do I get a cumulative histogram from two independent variables,
> > cumhist(X,Y) ?
> > -jose
> >
> >   [[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.
>
> --
> Mike Lawrence
> Graduate Student, Department of Psychology, Dalhousie University
>
> Website: http://memetic.ca
>
> Public calendar: http://icalx.com/public/informavore/Public
>
> "The road to wisdom? Well, it's plain and simple to express:
> Err and err and err again, but less and less and less."
> - Piet Hein
>
>
>


-- 
Dr. Jose M. Borreguero
Postdoctoral Associate
Center for the Study of Systems Biology,
School of Biology,
Georgia Institute of Technology,
250 14th St NW, Atlanta GA 30318
Email: [EMAIL PROTECTED]
phone: 404 407 8980 Fax: 404 385 7478

[[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] mgcv: lowest estimated degrees of freedom

2007-06-21 Thread Julian Burgos
Dear list,

I do apologize if these are basic questions.  I am fitting some GAM 
models using the mgcv package and following the model selection criteria 
proposed by Wood and Augustin (2002, Ecol. Model. 157, p. 157-177).  One 
criterion to decide if a term should be dropped from a model is if the 
estimated degrees of freedom (EDF) for the term are close to their lower 
limit.

What would be the minimum number of EDF's for
a) Univariate thin plate regression splines(TPRS) with shrinkage, i.e.  
s(...,bs="ts")
b) Bivariate tensor products of TPRS with shrinkage?

Thanks for any help,

Julian Burgos

-- 
Julian M. Burgos

Fisheries Acoustics Research Lab
School of Aquatic and Fishery Science
University of Washington

1122 NE Boat Street
Seattle, WA  98105 

Phone: 206-221-6864

__
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] Generating vetor (shapefiles) from AscGrid raster in R

2007-06-21 Thread Milton Cezar Ribeiro
Hi there,

I need to convert a raster (ascGrid) format to Shape files.
Is there a way of to do that on R?

Kind regards

miltinho


   


http://yahoo.com.br/oqueeuganhocomisso 
[[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 hide axis interval values in a plot

2007-06-21 Thread Marc Schwartz
On Thu, 2007-06-21 at 11:07 -0700, spime wrote:
> 
> 
> >plot(cars)
> 
> this shows a plot having interval values of axes (x-axis:5-25;
> y-axis:0-120). I want to hide these values. is there any way?

  plot(cars, axes = FALSE)

If you still want the box around the plot region, follow the above with:

  box()

or use:

  plot(cars, xaxt = "n", yaxt = "n")

See ?plot.default and ?par for more information and standard arguments
for plots.

If you want axes, but using values and tick marks that you define as
opposed to the defaults, see ?axis

HTH,

Marc Schwartz

__
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] Distance function

2007-06-21 Thread Gavin Simpson
On Thu, 2007-06-21 at 19:56 +0200, Birgit Lemcke wrote:
> Hello you all from the R Help mailing list!
> 
> I am working on a PowerBook with Mac Os X and use R 2.5.0.
> I used the distance function from the analogue package to perform a  
> similarity analysis using the Gowers Index and weighted Variables.
> My variables are bivariate data and measurements as well as interval  
> data transformed into minimum and maximum variables.
> I used this Code:
> 
> Dist.Gowa<-distance(Table1a ,Table0a ,method ="mixed", weights
 
>  
> (weighting),R = NULL )
   ^^^
Something is not right there () is this exactly what you typed?

You should not send questions about contributed packages to the list ---
as detailed in the posting guide. Without seeing Table1a and Table0a, it
is hard to say why this is failing - I suspect something about the
structure of the two data frames is throwing the function off.

If you can, send me that data ***off-list*** and I will take a look for
you, but as I'm teaching all day tomorrow, it won't happen till after
the weekend now.

HTH

G

> 
> 
> weighting is a vector created by this code:
> 
>   (weighting<- c 
> (1/3,1/3,1/3,1/2,1/2,1/2,1/2,1/2,1/2,1/4,1/4,1/4,1/4,1/7,1/7,1/7,1/7,1/7 
> , 
> 1/7,1/7,1/3,1/3,1/3,1/5,1/5,1/5,1/5,1/5,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9, 
> 1/9,1/5,1/5,1/5,1/5,1/5,1/7,1/7,1/7,1/7,1/7,1/7,1/7,1/7,1/7,1/7,1/7,1/7, 
> 1/7,1/7,1/5,1/5,1/5,1/5,1/5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 
> 1,1))
> It contains the weightings for the variables of the two data tables.
> 
> My data tables look like this:
> 
> 
> Anth_cap18.0  NA   NA  4.0  5.0  1  1  3.0  5.0  2.4  4.5  5   
> 5  2  2  2  3  1  1  1  1
> Anth_crin1   5.0  NA   NA  3.5 11.0  1  1  3.0 10.0  2.0  4.5  3   
> 4  2  2  3  3  1  1  2  3
> Anth_eck17.0  NA   NA  6.0 12.0  1  1  6.0 11.0  2.0  3.0  3   
> 5  2  2  3  3  1  1  1  2
> 
> At the end of the analysis I get always this message:
> 
> 1: $ operator is deprecated for atomic vectors, returning NULL in:  
> object$na.action
> 2: $ operator is deprecated for atomic vectors, returning NULL in:  
> object$weights
> 
> Can anybody explain me what this means?
> 
> Does anybody know if I have to standardize my measurements. As I  
> understood this is included in Gowers Index. If not is there a  
> function with different options of standardization more than rescaler  
> from the reshape package provides?
> 
> Thanks for your help in advance.
> 
> Greetings
> 
> Birgit
> 
> Birgit Lemcke
> Institut fr Systematische Botanik
> Zollikerstrasse 107
> CH-8008 Zrich
> Switzerland
> Ph: +41 (0)44 634 8351
> [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.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

__
R-help@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 hide axis interval values in a plot

2007-06-21 Thread spime



>plot(cars)

this shows a plot having interval values of axes (x-axis:5-25;
y-axis:0-120). I want to hide these values. is there any way?
-- 
View this message in context: 
http://www.nabble.com/How-to-hide-axis-interval-values-in-a-plot-tf3960418.html#a11238540
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] working with fractions

2007-06-21 Thread Federico Calboli
Muhammad Subianto wrote:

>  > library(MASS)
>  > as.fractions(c(0, 0.15, 0.827, .06, 0.266))
> [1] 0  3/20 62/75  1/15  4/15

Seems to make things a bit too slow, even though I get a good increase in 
precision.

Fede

-- 
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St Mary's Campus
Norfolk Place, London W2 1PG

Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.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] working with fractions

2007-06-21 Thread Muhammad Subianto
Federico Calboli wrote:
> Hi All,
>
> I am writing a fucntion where I would like to use fractions for all the 
> (numerous) passages.
>
> Is there a way of creating an environment *within a fucntion* so that all the 
> numbers/calculations are fractions?
>
> Best,
>
> Fede
>
>
>   
Maybe like this:

 > library(MASS)
 > as.fractions(c(0, 0.15, 0.827, .06, 0.266))
[1] 0  3/20 62/75  1/15  4/15
 >

Regards, Muhammad Subianto

__
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] Distance function

2007-06-21 Thread Birgit Lemcke
Hello you all from the R Help mailing list!

I am working on a PowerBook with Mac Os X and use R 2.5.0.
I used the distance function from the analogue package to perform a  
similarity analysis using the Gowers Index and weighted Variables.
My variables are bivariate data and measurements as well as interval  
data transformed into minimum and maximum variables.
I used this Code:

Dist.Gowa<-distance(Table1a ,Table0a ,method ="mixed", weights 
(weighting),R = NULL )


weighting is a vector created by this code:

  (weighting<- c 
(1/3,1/3,1/3,1/2,1/2,1/2,1/2,1/2,1/2,1/4,1/4,1/4,1/4,1/7,1/7,1/7,1/7,1/7 
, 
1/7,1/7,1/3,1/3,1/3,1/5,1/5,1/5,1/5,1/5,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9, 
1/9,1/5,1/5,1/5,1/5,1/5,1/7,1/7,1/7,1/7,1/7,1/7,1/7,1/7,1/7,1/7,1/7,1/7, 
1/7,1/7,1/5,1/5,1/5,1/5,1/5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, 
1,1))
It contains the weightings for the variables of the two data tables.

My data tables look like this:


Anth_cap18.0  NA   NA  4.0  5.0  1  1  3.0  5.0  2.4  4.5  5   
5  2  2  2  3  1  1  1  1
Anth_crin1   5.0  NA   NA  3.5 11.0  1  1  3.0 10.0  2.0  4.5  3   
4  2  2  3  3  1  1  2  3
Anth_eck17.0  NA   NA  6.0 12.0  1  1  6.0 11.0  2.0  3.0  3   
5  2  2  3  3  1  1  1  2

At the end of the analysis I get always this message:

1: $ operator is deprecated for atomic vectors, returning NULL in:  
object$na.action
2: $ operator is deprecated for atomic vectors, returning NULL in:  
object$weights

Can anybody explain me what this means?

Does anybody know if I have to standardize my measurements. As I  
understood this is included in Gowers Index. If not is there a  
function with different options of standardization more than rescaler  
from the reshape package provides?

Thanks for your help in advance.

Greetings

Birgit

Birgit Lemcke
Institut für Systematische Botanik
Zollikerstrasse 107
CH-8008 Zürich
Switzerland
Ph: +41 (0)44 634 8351
[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] using lme on multiple datasets in one shot

2007-06-21 Thread maitra
Dear list,

I would like to do a huge number of lme's using the same design matrix
(and fixed and random effects). Is it possible to do this efficiently?
Doing otherwise is not an option for my example.

Basically, I am wanting to do the following which is possible using lm:

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

with lme. Any suggestions?

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] FW: Suse RPM installation problem

2007-06-21 Thread Detlef Steuer
On Thu, 21 Jun 2007 18:01:06 +0100
"Stephen Henderson" <[EMAIL PROTECTED]> wrote:

> Hello 
> 
> I am trying to install the R RPM for Suse 10.0 on an x86_64 PC. However
> I am failing a dependency for  "libpng12.so.0" straight away

Hi Stephen,


if you add 

http://software.opensuse.org/download/home:/dsteuer/SUSE_Linux_10.0/

as installation source, dependencies should get resolved automatically.

Hth
Detlef

> 
> 
> 
> PC5-140:/home/rmgzshd # rpm -i R-base-2.5.0-2.1.x86_64.rpm
> error: Failed dependencies:
> libpng12.so.0(PNG12_0)(64bit) is needed by R-base-2.5.0-2.1.x86_64
> 
> I do seem to have this file
> 
> PC5-140:/home/rmgzshd # whereis libpng12.so.0
> libpng12.so: /usr/lib/libpng12.so.0 /usr/local/lib/libpng12.so 
> 
> but presuming that it is not the 64bit version mentioned I went looking
> for a 64 bit version but could not find it through google.
> 
> However reading the Installation manual I noted that libpng is mention
> in the context of a source build. I therefore downloaded "libpng-1.2.18"
> (v-1.2.8 or later is specified in the manual) and succesfully compiled
> this. This did not however help with my problem.
> 
> Any suggestions?
> 
> Thanks
> Stephen Henderson
>  
> 
> **
> This email and any files transmitted with it are confidentia...{{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.


-- 
"Keinen Gedanken zweimal denken, außer er ist schön." Unbekannte Quelle

__
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] FW: Suse RPM installation problem

2007-06-21 Thread Peter Dalgaard
Stephen Henderson wrote:
> Hello 
>
> I am trying to install the R RPM for Suse 10.0 on an x86_64 PC. However
> I am failing a dependency for  "libpng12.so.0" straight away
>
>
>
> PC5-140:/home/rmgzshd # rpm -i R-base-2.5.0-2.1.x86_64.rpm
> error: Failed dependencies:
> libpng12.so.0(PNG12_0)(64bit) is needed by R-base-2.5.0-2.1.x86_64
>
> I do seem to have this file
>
> PC5-140:/home/rmgzshd # whereis libpng12.so.0
> libpng12.so: /usr/lib/libpng12.so.0 /usr/local/lib/libpng12.so 
>
> but presuming that it is not the 64bit version mentioned I went looking
> for a 64 bit version but could not find it through google.
>
> However reading the Installation manual I noted that libpng is mention
> in the context of a source build. I therefore downloaded "libpng-1.2.18"
> (v-1.2.8 or later is specified in the manual) and succesfully compiled
> this. This did not however help with my problem.
>
> Any suggestions?
>
>   
I have

viggo:~/>rpm -qf /usr/lib/libpng12.so.0
libpng-32bit-1.2.12-25
viggo:~/>rpm -qf /usr/lib64/libpng12.so.0
libpng-1.2.12-25
viggo:~/>rpm -q R-base
R-base-2.5.0-2.1


> Thanks
> Stephen Henderson
>  
>
> **
> This email and any files transmitted with it are confidentia...{{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.
>

__
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 create cumulative histogram from two independent variables?

2007-06-21 Thread Mike Lawrence

?plot.ecdf

plot.ecdf(rnorm(100),rexp(100))

On 20-Jun-07, at 5:02 PM, Jose Borreguero wrote:

> Hi all,
> I am extremely newbie to R. Can anybody jump-start me with any  
> clues as to
> how do I get a cumulative histogram from two independent variables,
> cumhist(X,Y) ?
> -jose
>
>   [[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.

--
Mike Lawrence
Graduate Student, Department of Psychology, Dalhousie University

Website: http://memetic.ca

Public calendar: http://icalx.com/public/informavore/Public

"The road to wisdom? Well, it's plain and simple to express:
Err and err and err again, but less and less and less."
- Piet Hein

__
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] working with fractions

2007-06-21 Thread Federico Calboli
Hi All,

I am writing a fucntion where I would like to use fractions for all the 
(numerous) passages.

Is there a way of creating an environment *within a fucntion* so that all the 
numbers/calculations are fractions?

Best,

Fede


-- 
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St Mary's Campus
Norfolk Place, London W2 1PG

Tel  +44 (0)20 7594 1602 Fax (+44) 020 7594 3193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.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] FW: Suse RPM installation problem

2007-06-21 Thread Stephen Henderson
Hello 

I am trying to install the R RPM for Suse 10.0 on an x86_64 PC. However
I am failing a dependency for  "libpng12.so.0" straight away



PC5-140:/home/rmgzshd # rpm -i R-base-2.5.0-2.1.x86_64.rpm
error: Failed dependencies:
libpng12.so.0(PNG12_0)(64bit) is needed by R-base-2.5.0-2.1.x86_64

I do seem to have this file

PC5-140:/home/rmgzshd # whereis libpng12.so.0
libpng12.so: /usr/lib/libpng12.so.0 /usr/local/lib/libpng12.so 

but presuming that it is not the 64bit version mentioned I went looking
for a 64 bit version but could not find it through google.

However reading the Installation manual I noted that libpng is mention
in the context of a source build. I therefore downloaded "libpng-1.2.18"
(v-1.2.8 or later is specified in the manual) and succesfully compiled
this. This did not however help with my problem.

Any suggestions?

Thanks
Stephen Henderson
 

**
This email and any files transmitted with it are confidentia...{{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] Speed up R

2007-06-21 Thread bogdan romocea
Don't rush to buy new hardware yet (other than perhaps more RAM for
your existing desktop). First of all you should make sure that your R
code can't be made any faster. (I've seen cases where careful
re-writes increased speed by a factor of 10 or more.) There are some
rules (such as pre-allocate enough memory for vectors/lists, use
matrices instead of data frames etc) and tools (?Rprof, ?Sys.time)
that can help a lot. Check the manuals and the archives, for example
http://article.gmane.org/gmane.comp.lang.r.general/48800


> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Robert McFadden
> Sent: Tuesday, June 19, 2007 4:51 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Speed up R
>
> Dear R Users,
> I hope that there is someone who has an experience with a
> problem that I
> describe below and will help me.
> I must buy new desktop computer and I'm wondering which
> processor to choose
> if my only aim is to speed up R. I would like to reduce a
> simulation time -
> sometimes it takes days. I consider buying one of them (I'm
> working under
> Win XP 32 bit):
> 1. Intel Core2 Duo E6700 2.67 GHz
> 2. Dual-Core Intel Xeon processor 3070 - 2,66 GHz
> 3. AMD Athlon 64 X2 6000+
> Or simple Pentium 4?
>
> I'm very confused because I'm not sure whether R takes
> advantage dual-core
> or not. If not, probably Athlon would be better, wouldn't be?
> I would appreciate any help.
> Rob
>
> __
> 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] How to weight cases in R

2007-06-21 Thread Raquel Guimarães
Hi you all,

I need some help, as i'm a begginer using R. I have two objects in my
data.frame, named "homens" e "mulheres" (male and female
observations). For each of them, I have the log-hourly wages (called
logsalh). I have to create a new variable of earnings which is the log-
hourly wage weighted by a other column (called "pesop"), that is in
each data.frame (for men and women).

I've tried this commands, but it failed:

logsalhpm <-transform(mulheres$logsalh mulheres$pesop,
logsalhp=(mulheres$logsalh)*(mulheres$pesop)/sum(mulheres$pesop))

where "logsalp" is the name of the new variable of earnings, weighted.

Could somenone please help me?
Best wishes, Raquel

[[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] Creatiing an R package for solving nonlinear system of equations was: RE: finding roots of multivariate equation

2007-06-21 Thread Ravi Varadhan
Hi,

I have written a simple function to solve a system of nonlinear equations. I
have called it nlsolve().  It actually minimizes the squared-norm of the set
of functions by calling optim().  It uses the BFGS algorithm within optim().
Apart from this restriction, the user can pass all the arguments available
in optim().  All the control parameters can be passed as in the call to
optim().  I have attached a text file containing the source for nlsolve()
and also a number of test problems illustrating the use of nlsolve().  Any
feedback and suggestions to improve it are welcome.

Hope this is useful.

Best,
Ravi.


---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

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






-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ravi Varadhan
Sent: Wednesday, June 20, 2007 5:23 PM
To: r-help@stat.math.ethz.ch
Subject: [R] Creatiing an R package for solving nonlinear system of
equations was: RE: finding roots of multivariate equation

Hi All,

Replying to this and numerous other requests in the past has made me realize
that a nonlinear solver is very much needed for R users.  I have
successfully used a nonlinear solver based on the spectral gradient method,
in FORTRAN.  I can readily translate that to R and make it available as an R
function, but what I would really like to do is to make that into a package.
I can provide the R function and several test examples.  But I am not good
at creating a good/reliable package.  So, it would be ideal if one of the R
gurus is interested in collaborating with me on this project.  Any one
interested?

Ravi.

---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: [EMAIL PROTECTED]

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






-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bill Shipley
Sent: Wednesday, June 20, 2007 1:37 PM
To: r-help@stat.math.ethz.ch
Subject: [R] finding roots of multivariate equation

Hello,
I want to find the roots of an equation in two variables.  I am aware of the
uniroot function, which can do this for a function with a single variable
(as I
understand it...) but cannot find a function that does this for an equation
with more than one variable.  I am looking for something implementing
similar
to a Newton-Raphson algorithm.
Thanks.

-- 
Bill Shipley
North American Editor for Annals of Botany
Subject Editor for Ecology
Département de biologie
Université de Sherbrooke
Sherbrooke (Québec) J1K 2R9
Canada

__
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] MDS size limitations

2007-06-21 Thread Prof Brian Ripley
On Thu, 21 Jun 2007, Steve Antos wrote:

> What are the limitations on size of matrix for MDS functions?

MDS works with a dissimilarity, not a matrix (neither conceptually nor in 
most R implementations, which typically use an object of class "dist").
It is better to think in terms of the number of objects 'n' and the number 
of dimensions of the representation (which I guess you mean as 2).

There are O(n^2) dissimilarities to be considered, and most of the 
algorithms appear to be slightly superlinear in that number. n=1000 runs 
in isoMDS in about a minute on my laptop, using about 75Mb of memory, and 
about 10 secs in sammon or cmdscale.  (Highly non-Euclidean 
dissimilarities are likely to be slower.)

Even 1000 objects is a lot to be considering for what is primarily a 
visualization technique.

Cruder forms of MDS such as Kohonen mapping are able to handle much larger 
datasets (but reveal less about them).

-- 
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] generating a new variable based on results of a by command

2007-06-21 Thread Economics Guy
Perfect!

EG

On 6/21/07, Dimitris Rizopoulos <[EMAIL PROTECTED]> wrote:
>
> maybe you want to use ave(), e.g.,
>
> f$sums <- ave(f$b, f$e, FUN = sum)
>
>
> I hope it helps.
>
> Best,
> Dimitris
>
> 
> Dimitris Rizopoulos
> Ph.D. Student
> Biostatistical Centre
> School of Public Health
> Catholic University of Leuven
>
> Address: Kapucijnenvoer 35, Leuven, Belgium
> Tel: +32/(0)16/336899
> Fax: +32/(0)16/337015
> Web: http://med.kuleuven.be/biostat/
>  http://www.student.kuleuven.be/~m0390867/dimitris.htm
>
>
> - Original Message -
> From: "Economics Guy" <[EMAIL PROTECTED]>
> To: 
> Sent: Thursday, June 21, 2007 3:53 PM
> Subject: [R] generating a new variable based on results of a by
> command
>
>
> >I have a matrix with a set of variables one of which is a factor.
> >Using by()
> > I have calculated something about each group (say the sum). Now I
> > want to
> > create a new variable in the original matrix that contains the
> > results of
> > the by() for each observation that is in the corresponding group.
> >
> > For example I have:
> >
> > -
> >
> > a <-c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
> >
> > b <-c(7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22)
> >
> > e
> > <-c("A","B","C","D","E","F","A","B","C","D","E","F","D","E","F","A")
> >
> > f <-data.frame(e,a,b)
> >
> > # Calculate sum by group
> >
> > sums <- by(f, e, function(x) sum(x$b))
> >
> > ---
> >
> > Now I would like to assign each observation in f a new variable
> > based on the
> > results of the by(). I converted sums into a matrix and then tried
> > using
> > match() and ifthen() but could not get it to work.
> >
> > Thanks,
> >
> > EG
> >
> > [[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.
> >
>
>
> Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm
>
>

[[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] unknown type 63, perhaps written by later version of R

2007-06-21 Thread Mario Cortina
Dear all,
 
I'm using R-2.5.0.
 
If I type: 
 
> load("C:\\Data1\\.RData")
 
I get: 

Error in load("C:\\Data1\\.RData") : 
ReadItem: unknown type 63, perhaps written by later version of R
 
Any idea why?
 
Many thanks,
 
Mario
 
Dr Mario Cortina Borja; Senior Lecturer in Statistics
MRC Centre of Epidemiology for Child Health, Institute of Child Health,
University College London
Tel: 44(0)20-7905-2113; FAX: 44(0)20-7905-2381; [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] Multi-variate Probit model using Bayesm in R

2007-06-21 Thread Mahima Hada
Hello,

I have built a multi-variate probit model using the package "bayesm", which
requires that the X data is constructed using the function "CreateX". I've
gone through the documentation and run my model, but wanted to be sure about
my interpretation of the results for the coefficients - beta.

Steps:
1) I have 5 choices for the dependent variable Y, so p=5
2) I have 8 covariates, so the x data I read in has n rows (n=no. of
respondents) and 8 columns. As follows:

 [,1]  [,2]  [,3] [,4] [,5] [,6] [,7]
[,8]
  [1,] -3.202  0.583  0.026  0.398 -0.117  2.250  1.5210


3) when I use CreateX (setting INT=TRUE and DIFF=FALSE) I get a matrix of
n*5 rows and 36 columns.

  [,1] [,2] [,3] [,4]   [,5] [,6]  [,7]   [,8]   [,9]
[,10][,11]   [,12]  [,13] [,14]   [,15] [,16]  [,17]   [,18]
   [1,]1000 -3.202  0.000  0.000  0.000  0.583  0.000  0.000
0.000  0.026  0.000  0.000  0.000  0.398  0.000
   [2,]0100  0.000 -3.202  0.000  0.000  0.000  0.583  0.000
0.000  0.000   0.026  0.000  0.000  0.000  0.398
   [3,]0010  0.000  0.000 -3.202  0.000  0.000  0.000  0.583
0.000  0.000  0.000  0.026  0.000  0.000  0.000
   [4,]0001  0.000  0.000  0.000 -3.202   0.000  0.000
0.000  0.583  0.000  0.000  0.000  0.026  0.000  0.000
   [5,]0000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
0.000  0.000  0.000  0.000  0.000  0.000  0.000

   [,19]  [,20][,21][,22][,23]  [,24] [,25]
[,26] [,27]   [,28][,29]   [,30][,31]  [,32] [,33] [,34] [,35]
   [1,]  0.000  0.000 -0.117  0.000  0.000  0.000  2.250  0.000  0.000
0.000  1.521  0.000  0.000  0.000 0 0 0
   [2,]  0.000  0.000  0.000 -0.117  0.000  0.000  0.000  2.250  0.000
0.000  0.000  1.521   0.000  0.000 0 0 0
   [3,]  0.398  0.000  0.000  0.000 -0.117  0.000  0.000  0.000  2.250
0.000  0.000  0.000  1.521  0.000 0 0 0
   [4,]  0.000  0.398  0.000  0.000  0.000 -0.117  0.000  0.000  0.000
2.250  0.000  0.000  0.000  1.521 0 0 0
   [5,]  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000  0.000
0.000  0.000  0.000  0.000  0.000 0 0 0
 [,36]
   [1,] 0
   [2,] 0
   [3,] 0
   [4,] 0
   [5,] 0


4) My understanding is that the first four columns are the intercepts for
the first four choices of y, and the value of each covariate is replicated
in four columns (diagonal values) to correspond to the first four choices of
y. Every 5th row is 0. This pattern is repeated for all n respondents. Does
this mean for the FIFTH customer choice - there is NO calculation done??

5) Once I run rmvpgibbs with this data structure, my "betadraw" output
summary is of 36 variables (showing the first 11):

mean std dev num se rel eff s size  1 -2.999 3.32 0.216 77 234  2 -20.62 5.3
0.514 170 106  3 -17.973 2.87 0.276 166 108  4 -14.595 5.1 0.505 177 102  5
2.551 2.13 0.165 109 165  6 -0.235 1.11 0.071 74 240  7 -0.772 0.78 0.061
110 162  8 0.917 0.89 0.061 86 209  9 -1.329 1.58 0.1 72 247  10 1.002 1.05
0.074 89 200  11 0.108 0.66 0.052 111 161
QUESTIONS:

1) To interpret these results, my understanding is that "1"-"4" correspond
to the intercepts for the first four customer choices. Similarly "5"-"9"
correspond to the beta coefficient of the first covariate for the first four
customer choices and so on. Hence, I have NOTHING for the 5th customer
choice. Now I have set DIFF=FALSE in CreateX, but even then it looks like the
interpretation is w.r.t. to the beta coefficients of the fifth customer
choice as Zero.
Is this correct??

2) In the summary of out$betadraw, can somebody please tell me - what is
"num se" "rel eff" and "s size"??

3) The beta output is not identified. For identification, I should divide
all the outputs for channel 1 with sigma(1,1) and so onIs this correct??


Really appreciate whatever help I can get for the MVP model.

Thanks a lot,
Regards,
Mahima


-- 
PhD Student, Marketing
Penn State University

[[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] Need Help: User Defined R Functions in Sweave/Latex

2007-06-21 Thread M. Jankowski
> Back to Dieter's solution for a moment, take note of the Sweave FAQ
> (also in the above manual), specifically FAQ A.9, which covers the issue
> of figure chunks and multiple plots, proposing a looping approach
> consistent with Dieter's.
>
> I hope that this might give you some other insights into alternative
> approaches.
>
> HTH,
>
> Marc Schwartz
>

Marc,

You sure did help me. I reviewed A.9 and found that I simply needed to set:

<< results=tex, echo=false >>=

in the initial function call. Then the route I was pursuing worked smashingly.

The rest of your post has me thinking about my approach. I have more
than enough data, in my mind at least, to justify the extra effort
(and possible confusion) of including captions. I'll need to look at
the options for the "pdf" function to see if it already has the
functionality I am looking for.

Thank you very much for the nice reply to my post!

Matt

__
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] meta-analysis in R

2007-06-21 Thread Mike Cheung
Dear Bernd,

Please be careful in reading the example of meta-regression (12.4) in
.

In that example, the variance component was estimated under a model
without any covariate. Then the estimated variance component was used
as the variance component in the meta-regression with covariates.
Since the variance component is based on the model without any
covariate, it should be overestimated for a model with covariate. I
have emailed the authors about this issue.

A better approach is to use the MiMa function provided by Wolfgang Viechtbauer.

Regards,
Mike
-- 
-
 Mike W.L. Cheung   Phone: (65) 6516-3702
 Department of Psychology   Fax:   (65) 6773-1843
 National University of Singapore
 http://courses.nus.edu.sg/course/psycwlm/internet/
-


On 6/21/07, Bernd Weiss <[EMAIL PROTECTED]> wrote:
> On 21 Jun 2007 at 12:09, Irene Mantzouni wrote:
>
> Date sent:  Thu, 21 Jun 2007 12:09:31 +0200
> From:   "Irene Mantzouni" <[EMAIL PROTECTED]>
> To: 
> Subject:[R] meta-analysis in R
>
> > I would like to combine time-series data to test for correlations
> > and
> > interactions using random and fixed effects meta-analysis.
> >
> > So, I am looking for the right packages and documentation.
> >
> > I know about meta and rmeta packages of R.
> >
> > Are there any more? What are the diffrences in brief?
>
> Yes, there are some more packages for meta-analysis.
> help.search("meta-analysis") will answer your question.
>
> Additionally, one should also mention the MiMa function, see below.
>
> Most of the packages use a method of moments estimator; MiMa offers a
> wider range of estimation methods, e.g. ML or REML (see the MiMa
> documentation for more information).
>
> > Can you please suggest some references that could be used as a guide
> > for
> > meta-analysis in R (or S-plus)?
> >
> >
>
> I know at least two references:
>
> There is a chapter on meta-analysis in Everitt, Brian, und Torsten
> Hothorn, 2006: A handbook of statistical analyses using R. Boca
> Raton: Chapman & Hall/CRC. (see also  project.org/doc/vignettes/HSAUR/Ch_meta_analysis.pdf>)
>
> See also my reply to Lucia Costanzo and my suggestion to use the
> MiMa-package
> .
>
> HTH,
>
> Bernd
>
> __
> 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] sorting data

2007-06-21 Thread ONKELINX, Thierry
Why don't you use a package like RODBC and read the data directly from
the Excel file? Then you probably won't have to worry on how to get the
dates in the right format.

Another, maybe easier, solution is to export the Excel to CSV and then
use read.csv().

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 dala
> Verzonden: donderdag 21 juni 2007 15:54
> Aan: r-help@stat.math.ethz.ch
> Onderwerp: [R] sorting data
> 
> 
> I have a 2 columns, Date and Number, in Excel. 
> I copy and paste them into Notepad.
> I can use scan() to import the file but how do I plot this 
> data with Date as the x-axis?
> --
> View this message in context: 
> http://www.nabble.com/sorting-data-tf3958889.html#a11233613
> 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] model selection criteria in "regsubsets"

2007-06-21 Thread Thomas Lumley

The calculations are in summary.regsubsets.

Sending three copies of questions like this does not increase the chance 
of a response.

-thomas


On Thu, 21 Jun 2007, [EMAIL PROTECTED] wrote:

> Hi All,
> 
> I used "regsubsets" in package "leaps" to do the model subset selection.
> I noticed the "bic" and "cp" criterias are both included in this
> function. But seems like they are not calculated by
> 
> "bic=-n*log(RSS/n)-(p+1)*log(n)" 
> and 
> "cp=(RSS/sigma_hat^2)-(n-2*p-2)" 
> 
> Could you please let me know what formula used for these two criterias?
> 
> Thank you !
> 
> Linda
>

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.


Re: [R] generating a new variable based on results of a by command

2007-06-21 Thread Dimitris Rizopoulos
maybe you want to use ave(), e.g.,

f$sums <- ave(f$b, f$e, FUN = sum)


I hope it helps.

Best,
Dimitris


Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven

Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/(0)16/336899
Fax: +32/(0)16/337015
Web: http://med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


- Original Message - 
From: "Economics Guy" <[EMAIL PROTECTED]>
To: 
Sent: Thursday, June 21, 2007 3:53 PM
Subject: [R] generating a new variable based on results of a by 
command


>I have a matrix with a set of variables one of which is a factor. 
>Using by()
> I have calculated something about each group (say the sum). Now I 
> want to
> create a new variable in the original matrix that contains the 
> results of
> the by() for each observation that is in the corresponding group.
>
> For example I have:
>
> -
>
> a <-c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)
>
> b <-c(7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22)
>
> e 
> <-c("A","B","C","D","E","F","A","B","C","D","E","F","D","E","F","A")
>
> f <-data.frame(e,a,b)
>
> # Calculate sum by group
>
> sums <- by(f, e, function(x) sum(x$b))
>
> ---
>
> Now I would like to assign each observation in f a new variable 
> based on the
> results of the by(). I converted sums into a matrix and then tried 
> using
> match() and ifthen() but could not get it to work.
>
> Thanks,
>
> EG
>
> [[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.
> 


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

__
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] Overlaying lattice graphs (continued)

2007-06-21 Thread hadley wickham
Sebastian,

You should be able to, but I don't know how to do it with lattice.  In
ggplot (http://had.co.nz/ggplot2) you would do it as follows:

ggplot(mydata, aes(x = time, y = value, colour=model)) +
geom_point(subset(data, model != "observed")) +
geom_line((subset(data, model == "observed")) +
facet_grid(. ~ individuals)

or if you only wanted the models coloured:

ggplot(mydata, aes(x = time, y = value)) +
geom_point(subset(data, model != "observed"), aes(colour=model)) +
geom_line((subset(data, model == "observed")) +
facet_grid(. ~ individuals)

Although the way the panels are arranged is probably suboptimal if you
have many individuals.  It's something I plan to fix in the future, so
that  + facet_wrap(individuals) would give you a display like lattice
does.

Hadley


On 6/21/07, Sébastien <[EMAIL PROTECTED]> wrote:
> Hi Hadley,
>
> Hopefully, my dataset won't be too hard to changed. Can I modify the
> aspect of each group using your code (symbols for observed and lines for
> predicted)?
>
> Sebastien
>
> hadley wickham a écrit :
> > Hi Sebastian,
> >
> > I think you need to rearrange your data a bit.  Firstly, you need to
> > put observed on the same footing as the different models, so you would
> > have a new column in your data called value (previously observed and
> > predicted) and a new model type ("observed").  Then you could do:
> >
> > xyplot(value ~ time | individauls, data=mydata, group=model)
> >
> > Hadley
> >
> >
> > On 6/21/07, Sébastien <[EMAIL PROTECTED]> wrote:
> >> Dear R Users,
> >>
> >> I recently posted an email on this list  about the use of data.frame and
> >> overlaying multiple plots. Deepayan kindly indicated to me the
> >> panel.superposition command which worked perfectly in the context of the
> >> example I gave.
> >> I'd like to go a little bit further on this topic using a more complex
> >> dataset structure (actually the one I want to work on).
> >>
> >>  >mydata
> >>   PlotModelIndividualsTimeObserved
> >> Predicted
> >> 11A   1  0.05
> >> 1010.2
> >> 21A   1  0.10
> >> 2019.5
> >> etc...
> >> 10  1B   1  0.05 10
> >>  9.8
> >> 11  1B   1  0.10 20
> >>  20.2
> >> etc...
> >>
> >> There are p "levels" in mydata$Plot, m in mydata$Model, n in
> >> mydata$Individuals and t in mydata$Time (Note that I probably use the
> >> word levels improperly as all columns are not factors). Basically, this
> >> dataset summarizes the t measurements obtained in n individuals as well
> >> as the predicted values from m different modeling approaches (applied to
> >> all individuals). Therefore, the observations are repeated m times in
> >> the Observed columns, while the predictions appears only once for a
> >> given model an a given individual.
> >>
> >> What I want to write is a R batch file creating a Trellis graph, where
> >> each panel corresponds to one individual and contains the observations
> >> (as scatterplot) plus the predicted values for all models (as lines of
> >> different colors)... $Plot is just a token: it might be used to not
> >> overload graphs in case there are too many tested models. The fun part
> >> is that the values of p, m, n and t might vary from one dataset to the
> >> other, so everything has to be coded dynamically.
> >>
> >> For the plotting part I was thinking about having a loop in my code
> >> containing something like that:
> >>
> >> for (i in 1:nlevels(mydata$Model)) {
> >>
> >> subdata<-subset(mydata,mydata$Model=level(mydata$Model)[i])
> >> xyplot(subset(Observed + Predicted ~ Time | Individuals, data =
> >> subdata)   #plus additionnal formatting code
> >>
> >> }
> >>
> >> Unfortunately, this code simply creates a new Trellis plot instead of
> >> adding the model one by one on the panels. Any idea or link to a useful
> >> command will wellcome.
> >>
> >> Sebastien
> >>
> >> __
> >> 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] sorting data

2007-06-21 Thread dala

I have a 2 columns, Date and Number, in Excel. 
I copy and paste them into Notepad.
I can use scan() to import the file but how do I plot this data with Date as
the x-axis?
-- 
View this message in context: 
http://www.nabble.com/sorting-data-tf3958889.html#a11233613
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] generating a new variable based on results of a by command

2007-06-21 Thread Economics Guy
I have a matrix with a set of variables one of which is a factor. Using by()
I have calculated something about each group (say the sum). Now I want to
create a new variable in the original matrix that contains the results of
the by() for each observation that is in the corresponding group.

For example I have:

-

a <-c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16)

b <-c(7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22)

e <-c("A","B","C","D","E","F","A","B","C","D","E","F","D","E","F","A")

f <-data.frame(e,a,b)

# Calculate sum by group

sums <- by(f, e, function(x) sum(x$b))

---

Now I would like to assign each observation in f a new variable based on the
results of the by(). I converted sums into a matrix and then tried using
match() and ifthen() but could not get it to work.

Thanks,

EG

[[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] meta-analysis in R

2007-06-21 Thread Bernd Weiss
On 21 Jun 2007 at 12:09, Irene Mantzouni wrote:

Date sent:  Thu, 21 Jun 2007 12:09:31 +0200
From:   "Irene Mantzouni" <[EMAIL PROTECTED]>
To: 
Subject:[R] meta-analysis in R

> I would like to combine time-series data to test for correlations
> and
> interactions using random and fixed effects meta-analysis.
> 
> So, I am looking for the right packages and documentation. 
> 
> I know about meta and rmeta packages of R. 
> 
> Are there any more? What are the diffrences in brief? 

Yes, there are some more packages for meta-analysis. 
help.search("meta-analysis") will answer your question.

Additionally, one should also mention the MiMa function, see below.

Most of the packages use a method of moments estimator; MiMa offers a 
wider range of estimation methods, e.g. ML or REML (see the MiMa 
documentation for more information).

> Can you please suggest some references that could be used as a guide
> for
> meta-analysis in R (or S-plus)? 
> 
>  

I know at least two references:

There is a chapter on meta-analysis in Everitt, Brian, und Torsten 
Hothorn, 2006: A handbook of statistical analyses using R. Boca 
Raton: Chapman & Hall/CRC. (see also )

See also my reply to Lucia Costanzo and my suggestion to use the  
MiMa-package  
. 

HTH,

Bernd

__
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] MDS size limitations

2007-06-21 Thread Steve Antos
What are the limitations on size of matrix for MDS functions?
steve

-- 
Steve Antos
Priva-Technologies
847-640-9020 x3114
cell (540)409-1231

[[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] meta-analysis in R

2007-06-21 Thread Ingmar Visser
http://www.wvbauer.com/downloads.html

has the mima function (and a number of useful references for meta- 
analysis)

I'm not aware of any specialized needs/functions for timeseries data.

hth, Ingmar

On 21 Jun 2007, at 12:09, Irene Mantzouni wrote:

> I would like to combine time-series data to test for correlations and
> interactions using random and fixed effects meta-analysis.
>
> So, I am looking for the right packages and documentation.
>
> I know about meta and rmeta packages of R.
>
> Are there any more? What are the diffrences in brief?
>
> Can you please suggest some references that could be used as a  
> guide for
> meta-analysis in R (or S-plus)?
>
>
>
> Thank you!
>
>
>
>
>   [[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.

Ingmar Visser
Department of Psychology, University of Amsterdam
Roetersstraat 15
1018 WB Amsterdam
The Netherlands
t: +31-20-5256735



[[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] Need Help: User Defined R Functions in Sweave/Latex

2007-06-21 Thread Marc Schwartz
On Wed, 2007-06-20 at 22:50 -0500, M. Jankowski wrote:
> Dear all,
> 
> I want to start my post by expressing my sincere gratitude for all the
> help this group has given me in Sweave/Latex/R. The tools are
> excellent and so is the community!
> 
> On to the question.
> 
> My Sweave code is intended to make lots of plots and create a *.pdf
> document. Sweave is perfect for this. The only problem is that  I find
> myself using the same R code, within my Sweave input file over an
> over. I know about Latex macros and I can even get R functions,
> essentially used as subroutines, to sort of work. "\Sexpr{}" will not
> work because the R code I want to use over and over is in the R
> environment. I've tried numerous ways to tackle this process and could
> really use some help. If there is some easier way to do this please
> let me know!
> 
> This is the R function:
> basicplot <- function(x, nplots, sectionname){
> # Begin to make figure here
> file = paste("scatter",nplots, ".pdf", sep="")
> pdf(file = file,paper="special", width=6, height = 6)
> plot(x)
> dev.off()
> cat("\\begin{figure}\n")
> cat("\\includegraphics{",file,"}\n", sep="")
> cat("\\caption{", sectionname,"}\n", sep = "")
> cat("\\end{figure}\n")
> #End figure making
> }
> 
> The aim is to generate Latex code which will have some basic
> information as part of the caption. The trouble seems to be that the
> output from the function appears to latex as if it is protected R code
> when I really want to create output that pdflatex will act on.
> Essentially, the resulting *.pdf contains the lines output by the cat
> function in basicplot. Or:
> \begin{figure}
> \includegraphics{scatter1.pdf}
> \caption{myname}
> \end{figure}
> These lines are not in the environment acted by Latex. I tried a
> variant of the function where <> and received
> the same result. Below are the files *.Snw -> *.tex -> *.pdf and the
> output I received while compiling. If there is anything else I can
> give to help you help me just let me know. Thanks!
> 
> Matt


Matt,

I don't know if you have reviewed the Sweave manual, but section 3.4
provides insight into reusing named code chunks, as an alternative to
looping or creating LaTeX macros as proposed by Dieter. These can be
"nested" within other named code chunks and/or R code.

If you don't yet have the manual, it is available here from Fritz' site:

http://www.ci.tuwien.ac.at/~leisch/Sweave/Sweave-manual-20060104.pdf

You could consider using a figure chunk, if the sole output is the plot
and not text. That way you don't have to worry about explicitly cat()ing
the figure related LaTeX markup as you are doing above. Thus, the LaTeX
markup for things like captions will be in LaTeX sections of the .Rnw
file and you can use \Sexpr{}'s to include derived scalar values.

The preferred approach may be to an extent dependent upon whether your
final document will simply have several plots on one or more pages in
sequence, or whether you will need to have text between the plots, such
that you really need LaTeX sections between the figure/code chunks.

Back to Dieter's solution for a moment, take note of the Sweave FAQ
(also in the above manual), specifically FAQ A.9, which covers the issue
of figure chunks and multiple plots, proposing a looping approach
consistent with Dieter's.

I hope that this might give you some other insights into alternative
approaches.

HTH,

Marc Schwartz

__
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] Overlaying lattice graphs (continued)

2007-06-21 Thread Sébastien
Hi Hadley,

Hopefully, my dataset won't be too hard to changed. Can I modify the 
aspect of each group using your code (symbols for observed and lines for 
predicted)?

Sebastien

hadley wickham a écrit :
> Hi Sebastian,
>
> I think you need to rearrange your data a bit.  Firstly, you need to
> put observed on the same footing as the different models, so you would
> have a new column in your data called value (previously observed and
> predicted) and a new model type ("observed").  Then you could do:
>
> xyplot(value ~ time | individauls, data=mydata, group=model)
>
> Hadley
>
>
> On 6/21/07, Sébastien <[EMAIL PROTECTED]> wrote:
>> Dear R Users,
>>
>> I recently posted an email on this list  about the use of data.frame and
>> overlaying multiple plots. Deepayan kindly indicated to me the
>> panel.superposition command which worked perfectly in the context of the
>> example I gave.
>> I'd like to go a little bit further on this topic using a more complex
>> dataset structure (actually the one I want to work on).
>>
>>  >mydata
>>   PlotModelIndividualsTimeObserved
>> Predicted
>> 11A   1  0.05
>> 1010.2
>> 21A   1  0.10
>> 2019.5
>> etc...
>> 10  1B   1  0.05 10
>>  9.8
>> 11  1B   1  0.10 20
>>  20.2
>> etc...
>>
>> There are p "levels" in mydata$Plot, m in mydata$Model, n in
>> mydata$Individuals and t in mydata$Time (Note that I probably use the
>> word levels improperly as all columns are not factors). Basically, this
>> dataset summarizes the t measurements obtained in n individuals as well
>> as the predicted values from m different modeling approaches (applied to
>> all individuals). Therefore, the observations are repeated m times in
>> the Observed columns, while the predictions appears only once for a
>> given model an a given individual.
>>
>> What I want to write is a R batch file creating a Trellis graph, where
>> each panel corresponds to one individual and contains the observations
>> (as scatterplot) plus the predicted values for all models (as lines of
>> different colors)... $Plot is just a token: it might be used to not
>> overload graphs in case there are too many tested models. The fun part
>> is that the values of p, m, n and t might vary from one dataset to the
>> other, so everything has to be coded dynamically.
>>
>> For the plotting part I was thinking about having a loop in my code
>> containing something like that:
>>
>> for (i in 1:nlevels(mydata$Model)) {
>>
>> subdata<-subset(mydata,mydata$Model=level(mydata$Model)[i])
>> xyplot(subset(Observed + Predicted ~ Time | Individuals, data =
>> subdata)   #plus additionnal formatting code
>>
>> }
>>
>> Unfortunately, this code simply creates a new Trellis plot instead of
>> adding the model one by one on the panels. Any idea or link to a useful
>> command will wellcome.
>>
>> Sebastien
>>
>> __
>> 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] Overlaying lattice graphs (continued)

2007-06-21 Thread Sébastien
Sorry, I have forgotten to tell that I work on R version 2.5.0 on 
Windows XP sp2.

Sébastien a écrit :
> Dear R Users,
>
> I recently posted an email on this list  about the use of data.frame and 
> overlaying multiple plots. Deepayan kindly indicated to me the 
> panel.superposition command which worked perfectly in the context of the 
> example I gave.
> I'd like to go a little bit further on this topic using a more complex 
> dataset structure (actually the one I want to work on).
>
>  >mydata
>   PlotModelIndividualsTimeObserved  
> Predicted
> 11A   1  0.05 
> 1010.2
> 21A   1  0.10 
> 2019.5
> etc...
> 10  1B   1  0.05 10
>  9.8
> 11  1B   1  0.10 20
>  20.2
> etc...
>
> There are p "levels" in mydata$Plot, m in mydata$Model, n in 
> mydata$Individuals and t in mydata$Time (Note that I probably use the 
> word levels improperly as all columns are not factors). Basically, this 
> dataset summarizes the t measurements obtained in n individuals as well 
> as the predicted values from m different modeling approaches (applied to 
> all individuals). Therefore, the observations are repeated m times in 
> the Observed columns, while the predictions appears only once for a 
> given model an a given individual.
>
> What I want to write is a R batch file creating a Trellis graph, where 
> each panel corresponds to one individual and contains the observations 
> (as scatterplot) plus the predicted values for all models (as lines of 
> different colors)... $Plot is just a token: it might be used to not 
> overload graphs in case there are too many tested models. The fun part 
> is that the values of p, m, n and t might vary from one dataset to the 
> other, so everything has to be coded dynamically.
>
> For the plotting part I was thinking about having a loop in my code 
> containing something like that:
>
> for (i in 1:nlevels(mydata$Model)) {
>
> subdata<-subset(mydata,mydata$Model=level(mydata$Model)[i])
> xyplot(subset(Observed + Predicted ~ Time | Individuals, data = 
> subdata)   #plus additionnal formatting code
>
> }
>
> Unfortunately, this code simply creates a new Trellis plot instead of 
> adding the model one by one on the panels. Any idea or link to a useful 
> command will wellcome.
>
> Sebastien
>
> __
> 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] "if" within a function

2007-06-21 Thread Martin Maechler
> "HO" == Hong Ooi <[EMAIL PROTECTED]>
> on Thu, 21 Jun 2007 15:49:42 +1000 writes:

HO> R doesn't use the 'functionname = result' idiom to return a value from a
HO> function. It looks like you're after:

HO> aaa <- function(a)
HO> {
HO>   if(a == 1) return(1)
HO>   if(a != 1) return(2)
HO> }


HO> or


HO> aaa <- function(a)
HO> {
HO>   if(a == 1) 1
HO>   else 2
HO> }

HO> see ?return

or to continue the "Variations on a theme" :

   aaa <- function(a)  if(a == 1) 1 else 2

(You don't need "{" .. "}" :
   some people argue you should
   always use them for defensive programming 
   where I would not use them in simple "one liners",
   but would use them otherwise
)

Martin Maechler, ETH Zurich

__
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] Overlaying lattice graphs (continued)

2007-06-21 Thread hadley wickham
Hi Sebastian,

I think you need to rearrange your data a bit.  Firstly, you need to
put observed on the same footing as the different models, so you would
have a new column in your data called value (previously observed and
predicted) and a new model type ("observed").  Then you could do:

xyplot(value ~ time | individauls, data=mydata, group=model)

Hadley


On 6/21/07, Sébastien <[EMAIL PROTECTED]> wrote:
> Dear R Users,
>
> I recently posted an email on this list  about the use of data.frame and
> overlaying multiple plots. Deepayan kindly indicated to me the
> panel.superposition command which worked perfectly in the context of the
> example I gave.
> I'd like to go a little bit further on this topic using a more complex
> dataset structure (actually the one I want to work on).
>
>  >mydata
>   PlotModelIndividualsTimeObserved
> Predicted
> 11A   1  0.05
> 1010.2
> 21A   1  0.10
> 2019.5
> etc...
> 10  1B   1  0.05 10
>  9.8
> 11  1B   1  0.10 20
>  20.2
> etc...
>
> There are p "levels" in mydata$Plot, m in mydata$Model, n in
> mydata$Individuals and t in mydata$Time (Note that I probably use the
> word levels improperly as all columns are not factors). Basically, this
> dataset summarizes the t measurements obtained in n individuals as well
> as the predicted values from m different modeling approaches (applied to
> all individuals). Therefore, the observations are repeated m times in
> the Observed columns, while the predictions appears only once for a
> given model an a given individual.
>
> What I want to write is a R batch file creating a Trellis graph, where
> each panel corresponds to one individual and contains the observations
> (as scatterplot) plus the predicted values for all models (as lines of
> different colors)... $Plot is just a token: it might be used to not
> overload graphs in case there are too many tested models. The fun part
> is that the values of p, m, n and t might vary from one dataset to the
> other, so everything has to be coded dynamically.
>
> For the plotting part I was thinking about having a loop in my code
> containing something like that:
>
> for (i in 1:nlevels(mydata$Model)) {
>
> subdata<-subset(mydata,mydata$Model=level(mydata$Model)[i])
> xyplot(subset(Observed + Predicted ~ Time | Individuals, data =
> subdata)   #plus additionnal formatting code
>
> }
>
> Unfortunately, this code simply creates a new Trellis plot instead of
> adding the model one by one on the panels. Any idea or link to a useful
> command will wellcome.
>
> Sebastien
>
> __
> 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] Dissimilarity

2007-06-21 Thread Birgit Lemcke
Thanks Mark,

but anyway I will try to read it in French first.

Birgit


Am 21.06.2007 um 10:14 schrieb Mark Difford:

>
> Hi Birgit,
>
> If French is a problem, then you will unfortunately (because you  
> miss out on
> Chessel's marvellous insights) have to do with the terser, more  
> formal stuff
> (publications), on the "Links" page of the ade4 site.  Most of this  
> is in
> English:
>
> http://pbil.univ-lyon1.fr/ADE-4/links.php?lang=eng
> ## Chessel's stuff
> http://pbil.univ-lyon1.fr/R/perso/pagechessel.html
>
> Hope that helps.
>
> PS: There is also a brief overview of the one-table methods  
> provided by the
> ade4 package in an R Newsletter:
> http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf
>
>
> Birgit Lemcke wrote:
>>
>> Hello Mark,
>>
>> thank you for your additional advices.
>> I had already a short look at the vegan package but I think I have to
>> look closer and also at the ade4 package.
>>
>> Unfortunately I am basically from Germany and my French is perhaps
>> only a rudimental school french but anyway, I would like to have a
>> look at this lecture notes, but I can not open the link you wrote me.
>> Ah sorry now the link works.
>>
>> Greetings and thanks a lot.
>>
>> Birgit
>>
>> Hey Gavin,
>> I found it funny that your institute is in the Gower Street.
>>
>>
>>
>> Am 20.06.2007 um 21:49 schrieb Mark Difford:
>>
>>>
>>> Hi Birgit,
>>>
>>> Just to add to what Gavin has said.  There are two other very  
>>> powerful
>>> packages in R that handle this kind of thing: ade4 and vegan.   
>>> Have a
>>> thorough look at both of them.  You should be looking at Principal
>>> Coordinate Analysis (Classical Scaling) and Non Metric
>>> Multidimensional
>>> Scaling (NMDS)---with, as Gavin has said, your species as rows.  At
>>> least
>>> the first of these methods goes hand-in-glove with cluster analysis.
>>>
>>> Given that you are based in Switzerland, and perhaps are Swiss, you
>>> probably
>>> therefore read and speak French as a second/third language.  You may
>>> therefore find the ade4 package more useful, since its authors are
>>> French,
>>> and its principal authors, Prof. Daniel Chessel &c., have made
>>> publicly
>>> available some exceptionally useful documentation on these methods
>>> on their
>>> ade4 website.  These are mainly Prof. Chessel's lecture notes:
>>>
>>> http://pbil.univ-lyon1.fr/R/enseignement.html
>>>
>>> I hope that speeds you on your way.
>>>
>>> Regards,
>>> Mark.
>>>
>>> PS: Apropos of the Legendre & Legendre text: It's well worth buying
>>> if you
>>> work in this area; one of its authors, Pierre Legendre, now
>>> collaborates
>>> with Jari Oksanen on some functions of the vegan package.
>>>
>>>
>>> Gavin Simpson wrote:

 On Wed, 2007-06-20 at 16:13 +0200, Birgit Lemcke wrote:
> Hello Stephen,
>
> I am happy that you help me. Thanks a million.
>
> It is a good feeling that you confirm my assumption that dsvdis is
> not able to deal with missing data, because it says me that I  
> am not
> completely incapable.
> Okay now I have the problem what to do.
> I used this function cause there is an option to weight columns
> differently what I havent found in other functions.
>
> But now I dont understand why I have to transpose the species as
> columns? As I read in the help manual of dsvdis this function
> calculates dissimilarities between rows.
> I have to calculate the dissimilarities between species that  
> are in
> rows by the use of morphological characters that are in columns.

 If you really what to measure the associations between species then
 leave them as you had them as the rows. But make sure you are
 choosing a
 dissimilarity coefficient that works well for species associations.
 There is a whole section in Legendre and Legendre 1998 Numerical
 Ecology
 2nd English Edition Elsevier which may help here.

 HTH

 G

>
> Am I completely wrong with my thoughts?
>
> Birgit
>
> Am 20.06.2007 um 15:52 schrieb Stephen B. Cox:
>
>> Hi Birgit - looks like you have a few issues here.
>>
>> Birgit Lemcke  systbot.uzh.ch> writes:
>>
>>>
>>> Hello you all!
>>>
>>> I am a completely new user of R and I have a problem to solve.
>>> I am using Mac OS X on a PowerBook.
>>>
>>> I have a table that looks like this:
>>>
>>> species X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12  
>>> X13 X14
>>> X15 X16 X17 X18 X19 X20 X21
>>> 1Anth_cap1  1  0  0  1  0  1  0  0  1   0   0   0
>>> 0   0
>>> 0   0   1   0   0   0   1
>>> 2   Anth_crin1  1  0  0  1  0  1  0  0  1   0   1   0
>>> 0   0
>>> 0   0   0   1   0   0   1
>>> 3Anth_eck1  1  0  0  1  0  1  0  0  1   0   0   0
>>> 0   0
>>> 0   0   0   1   0   0   1
>>> 4   Anth_gram1  1  0  0  1  0  1  0  0  1  NA  NA  NA   
>>> NA  

Re: [R] [R-pkgs] RGtk2 2.10.x series available

2007-06-21 Thread Uwe Ligges


Prof Brian Ripley wrote:
> Did you not get a dialog box with further details?
> 
> Unfortunately I found no instructions.  You need a version of of Gtk2 
> installed that is at least as late as the Windows maintainer used to 
> build RGtk2, as it adapts to the version installed.  I don't know what 
> that is and had to update mine.
> 
> http://downloads.sourceforge.net/gladewin32/gtk-2.10.11-win32-1.exe?download 
> 
> 
> is the latest available, and sufficed for me.
> 
> Uwe: could you add a note to the Readme, please, with the version 
> requirement?

Thanks for the hint. I'll do so this afternoon.

Uwe


> 
> 
> On Thu, 21 Jun 2007, Giulio Barcaroli wrote:
> 
>> I installed version 2.10.9-1 of RGtk2, but when I tried to load it I
>> received the following message:
>>
>>> local({pkg <- select.list(sort(.packages(all.available = TRUE)))
>>
>> + if(nchar(pkg)) library(pkg, character.only=TRUE)})
>>
>> Error in dyn.load(x, as.logical(local), as.logical(now)) :
>>
>>unable to load shared library 
>> 'C:/Programmi/R/R-2.5.0/library/RGtk2/libs/RGtk2.dll':
>>
>>  LoadLibrary failure:  impossible to find the specified procedure
>>
>> Error: package/namespace load failed for 'RGtk2'
>>
>>>
>>
>> I checked in the directory
>>
>> C:/Programmi/R/R-2.5.0/library/RGtk2/libs/
>>
>> and the RGtk2.dll module does exist.
>> Any indication about how to solve this problem?
>> Giulio Barcaroli
>>
>

__
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] Warning message!!

2007-06-21 Thread Birgit Lemcke
Hello,

I just received a warning message and I don´t understand what it means:

2007-06-21 13:37:17.623 R[201] -[NSTextStorage  
attributesAtIndex:effectiveRange:] called with out-of-bounds index.  
For apps linked on Tiger this will raise an exception. For earlier  
apps it will produce this one-time warning and continue with existing  
behavior (which is undefined).

I am working on a PowerBook with Mac OSX and R 2.5.0.

Regards

Birgit
Birgit Lemcke
Institut für Systematische Botanik
Zollikerstrasse 107
CH-8008 Zürich
Switzerland
Ph: +41 (0)44 634 8351
[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] barchart in trellis and NA

2007-06-21 Thread Sigbert Klinke
Hi,

I've a dataset with discrete data and several groups and in one group I 
have also missing values (NA). When I use table and barchart to 
visualize the counts I never get a bar for  NA in the barchart although 
it appears in the result of table. Is there a possibility to get this 
bar too?

Thanks in advance  Sigbert Klinke

__
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] Extract Df under lme4

2007-06-21 Thread Chuck Cleland
George W. Gilchrist wrote:
> I need to extract the degrees of freedom and log likelihoods from a  
> series of mixed models computed using lmer/lme4. If I ask for logLik 
> (lmer.object), I get something like
>  > logLik(lmer.object)
> 'log Lik.' -177.1000 (df=10)
> 
> Can I easily get that df from there (or elsewhere) into an object?  
> Thank you for any ideas.

  The help page for logLik() suggests the following:

> library(lme4)

> fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)

> logLik(fm1)
'log Lik.' -871.8141 (df=5)

> attr(logLik(fm1), "df")
[1] 5

> George
> 
> ..
> George W. Gilchrist   Email: [EMAIL PROTECTED]
> Director of Graduate Studies Phone: (757) 221-7751
> Department of Biology, Box 8795Fax: (757) 221-6483
> College of William & Mary
> Williamsburg, VA 23187-8795
> http://gwgilc.people.wm.edu/
> 
> 
> 
>   [[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.

-- 
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] Extract Df under lme4

2007-06-21 Thread George W. Gilchrist
I need to extract the degrees of freedom and log likelihoods from a  
series of mixed models computed using lmer/lme4. If I ask for logLik 
(lmer.object), I get something like
 > logLik(lmer.object)
'log Lik.' -177.1000 (df=10)

Can I easily get that df from there (or elsewhere) into an object?  
Thank you for any ideas.

George

..
George W. Gilchrist   Email: [EMAIL PROTECTED]
Director of Graduate Studies Phone: (757) 221-7751
Department of Biology, Box 8795Fax: (757) 221-6483
College of William & Mary
Williamsburg, VA 23187-8795
http://gwgilc.people.wm.edu/



[[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] [R-pkgs] RGtk2 2.10.x series available

2007-06-21 Thread Prof Brian Ripley
Did you not get a dialog box with further details?

Unfortunately I found no instructions.  You need a version of of Gtk2 
installed that is at least as late as the Windows maintainer used to build 
RGtk2, as it adapts to the version installed.  I don't know what that is 
and had to update mine.

http://downloads.sourceforge.net/gladewin32/gtk-2.10.11-win32-1.exe?download

is the latest available, and sufficed for me.

Uwe: could you add a note to the Readme, please, with the version 
requirement?


On Thu, 21 Jun 2007, Giulio Barcaroli wrote:

> I installed version 2.10.9-1 of RGtk2, but when I tried to load it I
> received the following message:
>
>> local({pkg <- select.list(sort(.packages(all.available = TRUE)))
>
> + if(nchar(pkg)) library(pkg, character.only=TRUE)})
>
> Error in dyn.load(x, as.logical(local), as.logical(now)) :
>
>unable to load shared library 
> 'C:/Programmi/R/R-2.5.0/library/RGtk2/libs/RGtk2.dll':
>
>  LoadLibrary failure:  impossible to find the specified procedure
>
> Error: package/namespace load failed for 'RGtk2'
>
>>
>
> I checked in the directory
>
> C:/Programmi/R/R-2.5.0/library/RGtk2/libs/
>
> and the RGtk2.dll module does exist.
> Any indication about how to solve this problem?
> Giulio Barcaroli
>

-- 
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] meta-analysis in R

2007-06-21 Thread Irene Mantzouni
I would like to combine time-series data to test for correlations and
interactions using random and fixed effects meta-analysis.

So, I am looking for the right packages and documentation. 

I know about meta and rmeta packages of R. 

Are there any more? What are the diffrences in brief? 

Can you please suggest some references that could be used as a guide for
meta-analysis in R (or S-plus)? 

 

Thank you!

 


[[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] [R-pkgs] RGtk2 2.10.x series available

2007-06-21 Thread Giulio Barcaroli
I installed version 2.10.9-1 of RGtk2, but when I tried to load it I
received the following message:

> local({pkg <- select.list(sort(.packages(all.available = TRUE)))

+ if(nchar(pkg)) library(pkg, character.only=TRUE)})

Error in dyn.load(x, as.logical(local), as.logical(now)) : 

unable to load shared library 
'C:/Programmi/R/R-2.5.0/library/RGtk2/libs/RGtk2.dll':

  LoadLibrary failure:  impossible to find the specified procedure

Error: package/namespace load failed for 'RGtk2'

> 

I checked in the directory

C:/Programmi/R/R-2.5.0/library/RGtk2/libs/

and the RGtk2.dll module does exist.
Any indication about how to solve this problem?
Giulio Barcaroli
__
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: merge

2007-06-21 Thread Petr PIKAL
[EMAIL PROTECTED] napsal dne 20.06.2007 18:02:07:

> Hello,
> ok I know how to do to merge matrix or data.frame by "row.names" but my 
true 
> objectif is to merge for example this data.frame:
> 
> > A
>   obs
>Rép1 Rép2 Rép3 Rép4 Rép5 Rép6
>   Var1  145  145  150  145  140  145
>   Var2  150  150  160  155  155  150
>   Var3  155  155  160  150  150  140
>   Var4  150  145  145  145  140  145
>   Var5  135  130  145  135  135  130
> 
> and 
> 
> > B
>   pred
>  Rép1   Rép2   Rép3   Rép4   Rép5   Rép6
>   Var1 146.00 144.00 151.00 145.00 143.00 141.00
>   Var2 154.33 152.33 159.33 153.33 151.33 149.33
>   Var3 152.67 150.67 157.67 151.67 149.67 147.67
>   Var4 146.00 144.00 151.00 145.00 143.00 141.00
>   Var5 136.00 134.00 141.00 135.00 133.00 131.00
> 
> and the main difficulty is to keep the names and the supernames.
> Do you know how. I know that the question isn't so easy but it's for a 
good display.
> thanks.

I may be mistaken but in such a case do you really want to do merge? Or 
just connecting both objects (data.frames) to list will do what you want?

In case you want:

pred
Rep1...
Var1

obs
Rep1...
Var1

in one object I think list is what I will go for.

In case you want:

state   var  Rep1 Rep2
predVar1
obs Var1
predVar2
obs Var2

I would try to fiddle with merge after adding a column state to each 
object (I hesitate to call it data frame due to "supernames")

Regards
Petr


> 
> 
> 
_ 

> Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! 
Mail 
>[[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] model selection criteria in "regsubsets"

2007-06-21 Thread nlei

__
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] Prediction Intervals

2007-06-21 Thread Paul Suckling
Hello.

Does anyone out there know if there is a function (or functions) that
will enable me to calculate prediction and confidence intervals from a
non-linear least squares model? (predict.nls does not do this.)
Thank you,

Paul

__
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] Prediction Intervals

2007-06-21 Thread Paul Suckling
Hi.

In part answer to my own question, I just found this link:

https://stat.ethz.ch/pipermail/r-help/2003-August/037654.html

which explains how one might calculate an approximation to the
variance of a non-linear function and use that to calculate a
confidence/prediction interval. If anyone knows an easier way, then
I'd still be glad to hear from you.

Thanks,

Paul

On 21/06/07, Paul Suckling <[EMAIL PROTECTED]> wrote:
> Hello.
>
> Does anyone out there know if there is a function (or functions) that
> will enable me to calculate prediction and confidence intervals from a
> non-linear least squares model? (predict.nls does not do this.)
> Thank you,
>
> Paul
>

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

2007-06-21 Thread Mark Difford

Hi Birgit,

If French is a problem, then you will unfortunately (because you miss out on
Chessel's marvellous insights) have to do with the terser, more formal stuff
(publications), on the "Links" page of the ade4 site.  Most of this is in
English:

http://pbil.univ-lyon1.fr/ADE-4/links.php?lang=eng
## Chessel's stuff
http://pbil.univ-lyon1.fr/R/perso/pagechessel.html

Hope that helps.

PS: There is also a brief overview of the one-table methods provided by the
ade4 package in an R Newsletter:
http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf


Birgit Lemcke wrote:
> 
> Hello Mark,
> 
> thank you for your additional advices.
> I had already a short look at the vegan package but I think I have to  
> look closer and also at the ade4 package.
> 
> Unfortunately I am basically from Germany and my French is perhaps  
> only a rudimental school french but anyway, I would like to have a  
> look at this lecture notes, but I can not open the link you wrote me.
> Ah sorry now the link works.
> 
> Greetings and thanks a lot.
> 
> Birgit
> 
> Hey Gavin,
> I found it funny that your institute is in the Gower Street.
> 
> 
> 
> Am 20.06.2007 um 21:49 schrieb Mark Difford:
> 
>>
>> Hi Birgit,
>>
>> Just to add to what Gavin has said.  There are two other very powerful
>> packages in R that handle this kind of thing: ade4 and vegan.  Have a
>> thorough look at both of them.  You should be looking at Principal
>> Coordinate Analysis (Classical Scaling) and Non Metric  
>> Multidimensional
>> Scaling (NMDS)---with, as Gavin has said, your species as rows.  At  
>> least
>> the first of these methods goes hand-in-glove with cluster analysis.
>>
>> Given that you are based in Switzerland, and perhaps are Swiss, you  
>> probably
>> therefore read and speak French as a second/third language.  You may
>> therefore find the ade4 package more useful, since its authors are  
>> French,
>> and its principal authors, Prof. Daniel Chessel &c., have made  
>> publicly
>> available some exceptionally useful documentation on these methods  
>> on their
>> ade4 website.  These are mainly Prof. Chessel's lecture notes:
>>
>> http://pbil.univ-lyon1.fr/R/enseignement.html
>>
>> I hope that speeds you on your way.
>>
>> Regards,
>> Mark.
>>
>> PS: Apropos of the Legendre & Legendre text: It's well worth buying  
>> if you
>> work in this area; one of its authors, Pierre Legendre, now  
>> collaborates
>> with Jari Oksanen on some functions of the vegan package.
>>
>>
>> Gavin Simpson wrote:
>>>
>>> On Wed, 2007-06-20 at 16:13 +0200, Birgit Lemcke wrote:
 Hello Stephen,

 I am happy that you help me. Thanks a million.

 It is a good feeling that you confirm my assumption that dsvdis is
 not able to deal with missing data, because it says me that I am not
 completely incapable.
 Okay now I have the problem what to do.
 I used this function cause there is an option to weight columns
 differently what I havent found in other functions.

 But now I dont understand why I have to transpose the species as
 columns? As I read in the help manual of dsvdis this function
 calculates dissimilarities between rows.
 I have to calculate the dissimilarities between species that are in
 rows by the use of morphological characters that are in columns.
>>>
>>> If you really what to measure the associations between species then
>>> leave them as you had them as the rows. But make sure you are  
>>> choosing a
>>> dissimilarity coefficient that works well for species associations.
>>> There is a whole section in Legendre and Legendre 1998 Numerical  
>>> Ecology
>>> 2nd English Edition Elsevier which may help here.
>>>
>>> HTH
>>>
>>> G
>>>

 Am I completely wrong with my thoughts?

 Birgit

 Am 20.06.2007 um 15:52 schrieb Stephen B. Cox:

> Hi Birgit - looks like you have a few issues here.
>
> Birgit Lemcke  systbot.uzh.ch> writes:
>
>>
>> Hello you all!
>>
>> I am a completely new user of R and I have a problem to solve.
>> I am using Mac OS X on a PowerBook.
>>
>> I have a table that looks like this:
>>
>> species X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
>> X15 X16 X17 X18 X19 X20 X21
>> 1Anth_cap1  1  0  0  1  0  1  0  0  1   0   0   0   0   0
>> 0   0   1   0   0   0   1
>> 2   Anth_crin1  1  0  0  1  0  1  0  0  1   0   1   0   0   0
>> 0   0   0   1   0   0   1
>> 3Anth_eck1  1  0  0  1  0  1  0  0  1   0   0   0   0   0
>> 0   0   0   1   0   0   1
>> 4   Anth_gram1  1  0  0  1  0  1  0  0  1  NA  NA  NA  NA   0
>> 0   0   0   1   0   0   0
>> 5   Anth_insi1  1  0  0  1  0  1  0  0  1   0   0   0   1   0
>> 0   0   0   1   0   0   1
>>
>> All columns  are binary coded characters.
>> The Import was done by this
>>
>> Test<-read.table("TestRFemMalBivariat1.csv",header = TRUE, sep  
>> = ";")
>

Re: [R] Replace number with month

2007-06-21 Thread Peter Dalgaard
Don MacQueen wrote:
> You can get the names using
>
>month.name[MM]
>
>
> And it may be necessary to use
>
>  factor(month.name[MM], levels=month.name[1:12])
>
> to get them to show up in the correct order in the barchart.
>   

You're crossing the creek to fetch water there, and getting yourself
soaked in the process... (by an unnecessary conversion to character
which is subject to alphabetical sorting)

I think the canonical way is

factor(MM, levels=1:12, labels=month.name)

(and the levels=1:12 may not even be necessary when all 12 months are
present)

-- 
   O__   Peter Dalgaard Øster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark  Ph:  (+45) 35327918
~~ - ([EMAIL PROTECTED])  FAX: (+45) 35327907

__
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 create .rda file to be used in package building

2007-06-21 Thread Robin Hankin
Deli

the way I do it is to start with an
R session with the data objects in
memory.

Then package.skeleton() creates a
directory tree which is, well, a package skeleton,
including the data which appears as .rda files in
the data/ directory.

HTH

Robin


On 20 Jun 2007, at 21:50, Deli Wang wrote:

> Hi,
>
> Can someone tell me how to create .rda data files in R so that they  
> can be
> used contributed package?
>
> Thanks
>
> Deli Wang
>
>   [[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.

--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre, Southampton
European Way, Southampton SO14 3ZH, UK
  tel  023-8059-7743

__
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 create .rda file to be used in package building

2007-06-21 Thread Prof Brian Ripley
On Wed, 20 Jun 2007, Deli Wang wrote:

> Hi,
>
> Can someone tell me how to create .rda data files in R so that they can be
> used contributed package?

The manual says

   Currently, data files can have one of three types as indicated by their
   extension: plain R code (.R or .r), tables (.tab, .txt, or .csv), or
   save() images (.RData or .rda). (All ports of R use the same binary
   (XDR) format and can read compressed images. Use images saved with save(,
   compress = TRUE), the default, to save space.)

What more information do you need?  ?save may help you.


>
> Thanks
>
> Deli Wang
>
>   [[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] Extracting t-tests on coefficients in lm

2007-06-21 Thread Prof Brian Ripley
On Wed, 20 Jun 2007, David C. Howell wrote:

> I am writing a resampling program for multiple regression using lm(). I
> resample the data 10,000 times, each time extracting the regression
> coefficients. At present I extract the individual regression
> coefficients using
>
>  brg = lm(Newdv~Teach + Exam + Knowledge + Grade + Enroll)
>  bcoef[i,] = brg$coef
>
> This works fine.
>
> But now I want to extract the t tests on these coefficients. I cannot
> find how these coefficients are stored, if at all. When I try
>attributes(brg)
> I do not find the t values as the attributes of the object. Typing
> summary(brg) will PRINT the coefficients, their standard errors, t, and
> the associated probability. I would like to type something like
>tcoeff[i,] = brg$tvalue
> but, of course, tvalue doesn't exist.
>
> Is there a simple way to extract, or compute if necessary, these values?

coef(summary(brg)) gives you the table, so coef(summary(brg))[,3] gives 
you the t values (but they are not t-tests per se).

?summary.lm would have told you this.

> Thanks,
> Dave Howell

-- 
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] Dissimilarity

2007-06-21 Thread Birgit Lemcke
Hello Mark,

thank you for your additional advices.
I had already a short look at the vegan package but I think I have to  
look closer and also at the ade4 package.

Unfortunately I am basically from Germany and my French is perhaps  
only a rudimental school french but anyway, I would like to have a  
look at this lecture notes, but I can not open the link you wrote me.
Ah sorry now the link works.

Greetings and thanks a lot.

Birgit

Hey Gavin,
I found it funny that your institute is in the Gower Street.



Am 20.06.2007 um 21:49 schrieb Mark Difford:

>
> Hi Birgit,
>
> Just to add to what Gavin has said.  There are two other very powerful
> packages in R that handle this kind of thing: ade4 and vegan.  Have a
> thorough look at both of them.  You should be looking at Principal
> Coordinate Analysis (Classical Scaling) and Non Metric  
> Multidimensional
> Scaling (NMDS)---with, as Gavin has said, your species as rows.  At  
> least
> the first of these methods goes hand-in-glove with cluster analysis.
>
> Given that you are based in Switzerland, and perhaps are Swiss, you  
> probably
> therefore read and speak French as a second/third language.  You may
> therefore find the ade4 package more useful, since its authors are  
> French,
> and its principal authors, Prof. Daniel Chessel &c., have made  
> publicly
> available some exceptionally useful documentation on these methods  
> on their
> ade4 website.  These are mainly Prof. Chessel's lecture notes:
>
> http://pbil.univ-lyon1.fr/R/enseignement.html
>
> I hope that speeds you on your way.
>
> Regards,
> Mark.
>
> PS: Apropos of the Legendre & Legendre text: It's well worth buying  
> if you
> work in this area; one of its authors, Pierre Legendre, now  
> collaborates
> with Jari Oksanen on some functions of the vegan package.
>
>
> Gavin Simpson wrote:
>>
>> On Wed, 2007-06-20 at 16:13 +0200, Birgit Lemcke wrote:
>>> Hello Stephen,
>>>
>>> I am happy that you help me. Thanks a million.
>>>
>>> It is a good feeling that you confirm my assumption that dsvdis is
>>> not able to deal with missing data, because it says me that I am not
>>> completely incapable.
>>> Okay now I have the problem what to do.
>>> I used this function cause there is an option to weight columns
>>> differently what I havent found in other functions.
>>>
>>> But now I dont understand why I have to transpose the species as
>>> columns? As I read in the help manual of dsvdis this function
>>> calculates dissimilarities between rows.
>>> I have to calculate the dissimilarities between species that are in
>>> rows by the use of morphological characters that are in columns.
>>
>> If you really what to measure the associations between species then
>> leave them as you had them as the rows. But make sure you are  
>> choosing a
>> dissimilarity coefficient that works well for species associations.
>> There is a whole section in Legendre and Legendre 1998 Numerical  
>> Ecology
>> 2nd English Edition Elsevier which may help here.
>>
>> HTH
>>
>> G
>>
>>>
>>> Am I completely wrong with my thoughts?
>>>
>>> Birgit
>>>
>>> Am 20.06.2007 um 15:52 schrieb Stephen B. Cox:
>>>
 Hi Birgit - looks like you have a few issues here.

 Birgit Lemcke  systbot.uzh.ch> writes:

>
> Hello you all!
>
> I am a completely new user of R and I have a problem to solve.
> I am using Mac OS X on a PowerBook.
>
> I have a table that looks like this:
>
> species X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14
> X15 X16 X17 X18 X19 X20 X21
> 1Anth_cap1  1  0  0  1  0  1  0  0  1   0   0   0   0   0
> 0   0   1   0   0   0   1
> 2   Anth_crin1  1  0  0  1  0  1  0  0  1   0   1   0   0   0
> 0   0   0   1   0   0   1
> 3Anth_eck1  1  0  0  1  0  1  0  0  1   0   0   0   0   0
> 0   0   0   1   0   0   1
> 4   Anth_gram1  1  0  0  1  0  1  0  0  1  NA  NA  NA  NA   0
> 0   0   0   1   0   0   0
> 5   Anth_insi1  1  0  0  1  0  1  0  0  1   0   0   0   1   0
> 0   0   0   1   0   0   1
>
> All columns  are binary coded characters.
> The Import was done by this
>
> Test<-read.table("TestRFemMalBivariat1.csv",header = TRUE, sep  
> = ";")

 First - you need to transpose the matrix to have species as
 columns.  You can do
 this with:

 d2 = data.frame(t(Test[,-1]))
 colnames(d2) = Test[,1]  #now use d2



> Now I try to perform a similarity analysis with the dsvdis  
> function
> of the labdsv package with the sorensen-Index.
>
> My first question is if all zeros in my table are seen as missing
> values and if it islike that how can I change without turning zero
> into other numbers?

 no - the zeros are valid observations.  the na's are missing data.


>   DisTest<-dsvdis(Test, index = "sorensen")
>
> But I always get back this error message:
>
> Warnung in

[R] [R-pkgs] spatstat version 2

2007-06-21 Thread adrian
  SPATSTAT version 2

Spatstat is an R package for the statistical analysis of spatial data.

A preliminary announcement about the forthcoming Version 2 of spatstat
is available here:


___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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] Speed up R

2007-06-21 Thread Moshe Olshansky
Robert McFadden writes:

>Dear R Users,
>I hope that there is someone who has an experience
>with a problem that I
>describe below and will help me. 
>I must buy new desktop computer and I'm wondering
>which processor to choose
>if my only aim is to speed up R. I would like to
>reduce a simulation time -
>sometimes it takes days. I consider buying one of
>them (I'm working under
>Win XP 32 bit):  
>1. Intel Core2 Duo E6700 2.67 GHz
>2. Dual-Core Intel Xeon processor 3070 - 2,66 GHz
>3. AMD Athlon 64 X2 6000+
>Or simple Pentium 4?
>
>I'm very confused because I'm not sure whether R
>takes advantage dual-core
>or not. If not, probably Athlon would be better,
>wouldn't be? 
>I would appreciate any help.
>Rob

Hi Robert,

Let me suggest you a "dirty" solution - if simulations
take days and you must run them many times I would
have rewriten them, let say, in C.  I had a program in
Matlab which took more than an hour to run and I had
to run it many times, so I usually prepared a few
runs, started them in the evening before leaving the
office and got the results next morning.  After a
while I have re-written it in C (this took me a few
days) and got a spead-up factor of about 100, so that
now the run took just a few minutes!
Languages like R and Matlab are extreemely convenient
but if performance is a very important issue you shoul
use C, Fortran, C++, etc.

Regards,

Moshe Olshansky.

__
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] extract elements

2007-06-21 Thread Manuele Pesenti
Thank you very much for all the answer!
I found them very usefull

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.


Re: [R] Linear Mixed Models with nlme, more than one random effect

2007-06-21 Thread Dieter Menne
  cropdesign.com> writes:

> Have a look at Rnew volume 5/1 (http://cran.r-project.org/doc/Rnews/) where
> Doug Bates explains this nicely. Consider using lme4 for your purpose.

But be aware of 
if you currently want to use lme4.

Dieter

__
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] User Defined R Functions in Sweave/Latex

2007-06-21 Thread Dieter Menne
M. Jankowski  gmail.com> writes:

> My Sweave code is intended to make lots of plots and create a *.pdf
> document. Sweave is perfect for this. The only problem is that  I find
> myself using the same R code, within my Sweave input file over an
> over. 

 
> This is the R function:
> basicplot <- function(x, nplots, sectionname){
> # Begin to make figure here
> file = paste("scatter",nplots, ".pdf", sep="")
> pdf(file = file,paper="special", width=6, height = 6)
> plot(x)
> dev.off()
> cat("\\begin{figure}\n")
> cat("\\includegraphics{",file,"}\n", sep="")
> cat("\\caption{", sectionname,"}\n", sep = "")
> cat("\\end{figure}\n")
> #End figure making
> }
> 
I don't know if this is exactly what you want, but below an example of using
includegraphics in a latex macro. For a real application, I recommend
\FloatBarrier instead of \clearpage when you have lots of figures/tables and
little text, as it's common in technical stuff.

Dieter

% -- Begin Sweave example
\documentclass[a4paper]{article}
\usepackage{Sweave}
\SweaveOpts{engine=R,eval=TRUE,eps=FALSE,pdf=TRUE, strip.white=TRUE}
\SweaveOpts{echo=FALSE,results=hide,width=6,height=4}

\bibliography{menne}
\begin{document}
\section{Hello}

\newcommand\doaplot[3]{

\begin{figure}
  \centering
\subsection{ #1}
\includegraphics{#2}
  \caption{3}
  \label{fig:#2}
\end{figure}
The meaning of life is The meaning of life is
The meaning of life is
The meaning of life is
The meaning of life is
\clearpage

}

<>=
 for (nplots in 1:3) {
   file = paste("scatter",nplots, ".pdf", sep="")
   pdf(file = file,paper="special", width=6, height = 6)
   plot(rnorm(100),rnorm(100),main=paste("Plot",nplots))
   dev.off()
   cat("\\doaplot{Section",nplots,"}{scatter",nplots,"}{My caption for ",
 nplots,"}\n",sep="")
 }
@

\end{document}

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