Re: [R] table elemets testing

2006-07-22 Thread Uwe Ligges
Emanuele Mazzola wrote:
 Hi everybody,
 
 i'm dealing with some percentage tables, of which i should test rowwise if 
 the entries are sgnificantly equal or not. Namely, on row 1, test H0: 
 element 1= element2, H0: element 1= element3...H0: element 2= element3...H0: 
 element n-1= element n. The same on the other rows.

Do you want to know how to write the code or which method to use? We 
cannot tackle the first question unless we have answered the second, 
which is much more difficult.

Do you really want to a statistical test under H0: element 1 = element 
2? Then you have to make some assumptions re. the *exact* distributions 
of element 1 and element 2 (are you assuming iid?). And if you assume 
the exact distribtion, you do not need to test on equality any more, but 
you want to know if element x is from this distribution, and you can 
simply use the quantiles themselves.

Uwe Ligges




 Anybody knows how this can be done in quick way? I don't have large 
 matrices, but it seems quite boring...
 
 Thank you very much in advance for your answering,
 Emanuele
 
 __
 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] equality constraint

2006-07-22 Thread anamaria
I would like to optimize a (log-)likelihood function subject to
linear equality constraints in parameters. My function has eight
parameters. The first one, third and fourth are greater than zero, the
second one must be less than zero. The problem is that the last four must
sum zero. Function constrOptim only fits inequality constraints.
Is there an alternative to lead with this problem?

Ana Maria

__
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] (no subject)

2006-07-22 Thread ahmed el kenawy
hi
   
  i created two files in excel with a dbf format in a similar way. the first is 
opened in R, however, when i try to open the second. i received the following 
message:
   
  sites.can - read.csv(SITES.csv)
Error in read.table(file = file, header = header, sep = sep, quote = quote,  : 
more columns than column names
 
The second file works with the same command
  larynx.can - read.csv(LARYNX.csv)
 

  SO, WHAT IS THE SOLUTIO
   
  Regards
  Ahmed


-

[[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] How to add a line on the boxplot

2006-07-22 Thread Jiantao Shi
Hi,
I have a data frame,

 df=rnorm(1000)
 dim(df)=c(100,10)

And i can get the boxplot,

 boxplot(data.frame(df))


So how can add a line (aline) on the existing boxplot,eg,
aline=apply(df,2,max)

Thanks in advance.

[[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] Putting x into the right subset

2006-07-22 Thread Uwe Ligges
John Wiedenhoeft wrote:

 Dear all,
 
 I'm sorry I have to bother you with this newbie stuff.
 
 Within a loop I obtain pairs of values x - c(a, b). An empty set M is
 defined before the loop (as a list or whatever). Now I want to do the
 following: if there is a vector y in M  that contains at least one of
 the values of x, then x shall be concatenated to y. If y doesn't contain
 any of the values in x, then x shall be put into M as a new vector. I
 first imagined it to be trivial but I'm having a hard time with the
 if-statement. I tried to define a function contains(value, vector),
 which returns FALSE or TRUE, but R complains that I tried to execute a
 non-function...
 
 Could anybody help a despaired newbie, please!


Example (maybe not efficient, but should do the trick):


M - list()
temp - NA
for(i in 1:20){
 a - sample(1:10, 1)
 b - sample(11:20, 1)
 x - c(a, b)
 if(i  1)
 temp - which(sapply(M, function(y) any(x %in% y)))[1]
 if(!is.na(temp))
 M[[temp]] - c(M[[temp]], x)
 else
 M[[length(M) + 1]] - x
}


 Thanks a lot,
 John
 
 __
 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] different csv files; was: (no subject)

2006-07-22 Thread Uwe Ligges
ahmed el kenawy wrote:

 hi

   i created two files in excel with a dbf format in a similar way. the first 
 is opened in R, however, when i try to open the second. i received the 
 following message:

   sites.can - read.csv(SITES.csv)
 Error in read.table(file = file, header = header, sep = sep, quote = quote,  
 : 
 more columns than column names
 
 The second file works with the same command
   larynx.can - read.csv(LARYNX.csv)
 
 
   SO, WHAT IS THE SOLUTIO

1. Please do not shout.
2. Please read the posting guide.
3. Please use a sensible subject.
4. Please read ?read.csv
5. You might want to check if the format of that csv files are really 
identical and  check if the column names are strange (including comments 
or separators). If it still does not work, send us the first few lines 
of that file. We cannot look at it otherwise!

Uwe Ligges





   Regards
   Ahmed
 
   
 -
 
   [[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.


Re: [R] equality constraint

2006-07-22 Thread Simon Wood
 I would like to optimize a (log-)likelihood function subject to
 linear equality constraints in parameters. My function has eight
 parameters. The first one, third and fourth are greater than zero, the
 second one must be less than zero. The problem is that the last four must
 sum zero. Function constrOptim only fits inequality constraints.
 Is there an alternative to lead with this problem?

- Any reason not to just replace e.g. parameter 8 with minus the sum of 
parameters 5, 6, and 7?

best,
Simon

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

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


Re: [R] How to add a line on the boxplot

2006-07-22 Thread Uwe Ligges
Jiantao Shi wrote:

 Hi,
 I have a data frame,
 
 
df=rnorm(1000)
dim(df)=c(100,10)

 
 And i can get the boxplot,
 
 
boxplot(data.frame(df))
 
 
 
 So how can add a line (aline) on the existing boxplot,eg,
 
 
 Thanks in advance.

Example:


df - rnorm(1000)
dim(df) - c(100,10)
boxplot(data.frame(df))
aline - apply(df, 2, max)

# , now you might want either
abline(h = aline, col = green, lty=dotted)
# or
segments(seq(along = aline) - 0.2, aline,
  seq(along = aline) + 0.2, aline,
  lwd = 2, col = red)



Uwe Ligges




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


Re: [R] How to add a line on the boxplot

2006-07-22 Thread Jiantao Shi
Thanks
The first method,i get many lines,using the second,i get segments.I actually
need one line with y coordinate defined by aline,x along the boxplot.


On 7/22/06, Uwe Ligges [EMAIL PROTECTED] wrote:

 Jiantao Shi wrote:

  Hi,
  I have a data frame,
 
 
 df=rnorm(1000)
 dim(df)=c(100,10)
 
 
  And i can get the boxplot,
 
 
 boxplot(data.frame(df))
 
 
 
  So how can add a line (aline) on the existing boxplot,eg,
 
 
  Thanks in advance.

 Example:


 df - rnorm(1000)
 dim(df) - c(100,10)
 boxplot(data.frame(df))
 aline - apply(df, 2, max)

 # , now you might want either
 abline(h = aline, col = green, lty=dotted)
 # or
 segments(seq(along = aline) - 0.2, aline,
  seq(along = aline) + 0.2, aline,
  lwd = 2, col = red)



 Uwe Ligges




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



[[alternative HTML version deleted]]

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


Re: [R] How to add a line on the boxplot

2006-07-22 Thread Uwe Ligges
Jiantao Shi wrote:
 Thanks
 The first method,i get many lines,using the second,i get segments.I 
 actually
 need one line with y coordinate defined by aline,x along the boxplot.

Do you mean lines(aline)?
If not, please explain in another way how you want to arrange those 10 
values and make lines from it.

Uwe Ligges



 
 On 7/22/06, Uwe Ligges [EMAIL PROTECTED] wrote:

 Jiantao Shi wrote:

  Hi,
  I have a data frame,
 
 
 df=rnorm(1000)
 dim(df)=c(100,10)
 
 
  And i can get the boxplot,
 
 
 boxplot(data.frame(df))
 
 
 
  So how can add a line (aline) on the existing boxplot,eg,
 
 
  Thanks in advance.

 Example:


 df - rnorm(1000)
 dim(df) - c(100,10)
 boxplot(data.frame(df))
 aline - apply(df, 2, max)

 # , now you might want either
 abline(h = aline, col = green, lty=dotted)
 # or
 segments(seq(along = aline) - 0.2, aline,
  seq(along = aline) + 0.2, aline,
  lwd = 2, col = red)



 Uwe Ligges




[[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] R shutdown

2006-07-22 Thread Robert Mcfadden
Dear R Users,
I run simulation that takes very long time (R 2.2.1, Win XP pro., Rgui SDI
mode, editor Tinn-R). 
It's happened that R shuts down and Windows display the message: Rgui.exe
makes an error and the application will shut down. Unfortunately everything
I lost. Below I paste the message that is created when error appear. Maybe
You as an expert will figure out what is happening to me.
Best,
Robert McFadden   


?xml version=1.0 encoding=UTF-16?
DATABASE
EXE NAME=Rgui.exe FILTER=GRABMI_FILTER_PRIVACY
MATCHING_FILE NAME=md5check.exe SIZE=15360 CHECKSUM=0x5685AC04
BIN_FILE_VERSION=2.21.51220.0 BIN_PRODUCT_VERSION=3.0.0.0
FILE_DESCRIPTION=R for Windows files checker FILE_VERSION=2.2.1
(2005-12-20) LEGAL_COPYRIGHT=R Development Core Team 1995-2005
VERFILEDATEHI=0x0 VERFILEDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x1
MODULE_TYPE=WIN32 PE_CHECKSUM=0x3CD5 LINKER_VERSION=0x1
UPTO_BIN_FILE_VERSION=2.21.51220.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
LINK_DATE=12/20/2005 13:17:59 UPTO_LINK_DATE=12/20/2005 13:17:59
VER_LANGUAGE=Angielski (Stany Zjednoczone) [0x409] /
MATCHING_FILE NAME=R.dll SIZE=2201600 CHECKSUM=0xFC7E40D1
BIN_FILE_VERSION=2.21.51220.0 BIN_PRODUCT_VERSION=3.0.0.0
FILE_DESCRIPTION=R for Windows DLL FILE_VERSION=2.2.1(2005-12-20)
LEGAL_COPYRIGHT=R Development Core Team 1995-2005 VERFILEDATEHI=0x0
VERFILEDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x2 MODULE_TYPE=WIN32
PE_CHECKSUM=0x21CDB3 LINKER_VERSION=0x1
UPTO_BIN_FILE_VERSION=2.21.51220.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
LINK_DATE=12/20/2005 13:16:00 UPTO_LINK_DATE=12/20/2005 13:16:00
VER_LANGUAGE=Angielski (Stany Zjednoczone) [0x409] /
MATCHING_FILE NAME=R.exe SIZE=18432 CHECKSUM=0x4407B548
BIN_FILE_VERSION=2.21.51220.0 BIN_PRODUCT_VERSION=3.0.0.0
FILE_DESCRIPTION=R for Windows front-end FILE_VERSION=2.2.1
(2005-12-20) LEGAL_COPYRIGHT=R Development Core Team 1995-2005
VERFILEDATEHI=0x0 VERFILEDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x1
MODULE_TYPE=WIN32 PE_CHECKSUM=0x60D3 LINKER_VERSION=0x1
UPTO_BIN_FILE_VERSION=2.21.51220.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
LINK_DATE=12/20/2005 13:17:58 UPTO_LINK_DATE=12/20/2005 13:17:58
VER_LANGUAGE=Angielski (Stany Zjednoczone) [0x409] /
MATCHING_FILE NAME=Rbitmap.dll SIZE=238592 CHECKSUM=0x861028AC
MODULE_TYPE=WIN32 PE_CHECKSUM=0x457B3 LINKER_VERSION=0x1
LINK_DATE=12/20/2005 13:25:12 UPTO_LINK_DATE=12/20/2005 13:25:12 /
MATCHING_FILE NAME=Rblas.dll SIZE=106496 CHECKSUM=0x9A1FC9D3
BIN_FILE_VERSION=2.21.51220.0 BIN_PRODUCT_VERSION=3.0.0.0
FILE_DESCRIPTION=R for Windows DLL FILE_VERSION=2.2.1(2005-12-20)
LEGAL_COPYRIGHT=R Development Core Team 1995-2005 VERFILEDATEHI=0x0
VERFILEDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x2 MODULE_TYPE=WIN32
PE_CHECKSUM=0x28489 LINKER_VERSION=0x1
UPTO_BIN_FILE_VERSION=2.21.51220.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
LINK_DATE=12/20/2005 13:17:52 UPTO_LINK_DATE=12/20/2005 13:17:52
VER_LANGUAGE=Angielski (Stany Zjednoczone) [0x409] /
MATCHING_FILE NAME=Rchtml.dll SIZE=6144 CHECKSUM=0x880344F
MODULE_TYPE=WIN32 PE_CHECKSUM=0x4204 LINKER_VERSION=0x1
LINK_DATE=12/20/2005 13:17:52 UPTO_LINK_DATE=12/20/2005 13:17:52 /
MATCHING_FILE NAME=Rcmd.exe SIZE=18432 CHECKSUM=0x19E72056
BIN_FILE_VERSION=2.21.51220.0 BIN_PRODUCT_VERSION=3.0.0.0
FILE_DESCRIPTION=R for Windows front-end FILE_VERSION=2.2.1
(2005-12-20) LEGAL_COPYRIGHT=R Development Core Team 1995-2005
VERFILEDATEHI=0x0 VERFILEDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x1
MODULE_TYPE=WIN32 PE_CHECKSUM=0x4A89 LINKER_VERSION=0x1
UPTO_BIN_FILE_VERSION=2.21.51220.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
LINK_DATE=12/20/2005 13:17:54 UPTO_LINK_DATE=12/20/2005 13:17:54
VER_LANGUAGE=Angielski (Stany Zjednoczone) [0x409] /
MATCHING_FILE NAME=Rgui.exe SIZE=10240 CHECKSUM=0x96A0D31D
BIN_FILE_VERSION=2.21.51220.0 BIN_PRODUCT_VERSION=3.0.0.0
FILE_DESCRIPTION=R for Windows GUI front-end FILE_VERSION=2.2.1
(2005-12-20) LEGAL_COPYRIGHT=R Development Core Team 1995-2005
VERFILEDATEHI=0x0 VERFILEDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x1
MODULE_TYPE=WIN32 PE_CHECKSUM=0x6C46 LINKER_VERSION=0x1
UPTO_BIN_FILE_VERSION=2.21.51220.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
LINK_DATE=12/20/2005 13:17:53 UPTO_LINK_DATE=12/20/2005 13:17:53
VER_LANGUAGE=Angielski (Stany Zjednoczone) [0x409] /
MATCHING_FILE NAME=Rlapack.dll SIZE=1184256 CHECKSUM=0x9FA3E37A
BIN_FILE_VERSION=2.21.51220.0 BIN_PRODUCT_VERSION=3.0.0.0
FILE_DESCRIPTION=R DLL for lapack FILE_VERSION=2.2.1(2005-12-20)
LEGAL_COPYRIGHT=R Development Core Team 2002-2005 VERFILEDATEHI=0x0
VERFILEDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x2 MODULE_TYPE=WIN32
PE_CHECKSUM=0x130713 LINKER_VERSION=0x1
UPTO_BIN_FILE_VERSION=2.21.51220.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
LINK_DATE=12/20/2005 13:18:52 UPTO_LINK_DATE=12/20/2005 13:18:52
VER_LANGUAGE=Angielski (Stany Zjednoczone) [0x409] /
MATCHING_FILE NAME=Rproxy.dll SIZE=44544 CHECKSUM=0xDC26CFFF
BIN_FILE_VERSION=2.21.51220.0 BIN_PRODUCT_VERSION=3.0.0.0
FILE_DESCRIPTION=R for Windows terminal front-end FILE_VERSION=2.2.1

[R] ifelse command

2006-07-22 Thread Xin
Dear:

   I try to revise the maximum likelihood function below using something 
constrains. But it seems something wrong with it.  Becasue R would not allow me 
to edit the function like this. It is very appreciate if you can help.
  
function (parameters,y,x1,x2)

{

p-parameters[1]

alpha1-parameters[2]

beta1-parameters[3)]

delta1-parameters[4]

alpha2-parameters[5]

mu-alpha1*((x1)^beta1)*exp(-delta1*(x1^alpha2))

if(y0  x10  x2==1,

L-lgamma(y+p)+p*(log(p)-log(mu+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p)

)

else

if(y0  x10  x2==2,

L-lgamma(y+p)+p*(log(p)-log(mu+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p)

)

else

if(y0  x10  x2==3,

L-lgamma(y+p)+p*(log(p)-log(mu+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p)

)

else

L

}

Thanks a lot!

Xin Shi

[[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] nested repeated measures in R

2006-07-22 Thread Doran, Harold
You can read the manual, read the FAQs, search the help functions and the 
archives.


-Original Message-
From: [EMAIL PROTECTED] on behalf of Eric C Merten
Sent: Fri 7/21/2006 8:51 PM
To: r-help@stat.math.ethz.ch
Subject: [R] nested repeated measures in R
 
R help,

How would I input data, verify assumptions, and run a nested repeated
measures ANOVA using R?  I have STATION nested in SITE nested in BLOCK with
measurements repeated for five YEARs.  All are random variables and it's only
slightly unbalanced.  I'm trying to characterize spatiotemporal variation in
stream habitat variables.  Thanks for your help!

Eric Merten

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


[[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] (no subject)

2006-07-22 Thread Gabor Grothendieck
Check out this recent thread:
https://www.stat.math.ethz.ch/pipermail/r-help/2006-July/109731.html

On 7/22/06, ahmed el kenawy [EMAIL PROTECTED] wrote:
 hi

  i created two files in excel with a dbf format in a similar way. the first 
 is opened in R, however, when i try to open the second. i received the 
 following message:

  sites.can - read.csv(SITES.csv)
 Error in read.table(file = file, header = header, sep = sep, quote = quote,  :
more columns than column names
 
 The second file works with the same command
  larynx.can - read.csv(LARYNX.csv)
 

  SO, WHAT IS THE SOLUTIO

  Regards
  Ahmed


 -

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


Re: [R] Putting x into the right subset

2006-07-22 Thread John Wiedenhoeft
Dear Uwe,

Many thanks for your help! Unfortunately, your function doesn't do
exactly what I need (I slightly modified it, but I don't think that
caused the problem):

M - list()
temp - NA
for (i in 1:length(deppat))
   {
   a - deppat[i]
   b - deptest[i]
   x - c(a, b)
   if (i  1)
  temp - which(sapply(M, function(y) any(x %in% y)))[1]
   if(!is.na(temp))
  M[[temp]] - c(M[[temp]], x)
   else
  M[[length(M) + 1]] - x
   }
   
print(M)
print(length(M))
for (k in 1:length(M))
   {
   M[[k]] - sort(unique(M[[k]]))
   print(M[[k]])
   }

deppat and deptest are equal in length. Additionaly, they may contain
values more than once. At the end, M shall contain exactly
length(unique(c(deppat, deptest))) variables, but it doesn't. Also,
there are some matches that remained undetected: 

M[[1]] 1  5  6 11 22 24 28 29 31 35 49 57 58 62 65 75 80 81 85 86
M[[2]] 2  7 11 12 25 30 31 32 36 50 53 58 59 63 66 69 82 87

11, 31 and 58 occur in two subsets (there are more examples for larger
k).

I've tried to do it more graphic, but for some reason the same failure
occures:

M - list()
for (j in 1:length(deppat))
   {
   for (listpos in 1:(length(M)+1))
  {
  if (listpos  length(M))
 {
 M[[listpos]] - c(deppat[j], deptest[j])
 break
 }
  else
 {
 if (deppat[j] %in% M[[listpos]] || deptest[j] %in%
M[[listpos]])
{
M[[listpos]] - c(M[[listpos]], deppat[j], deptest[j])
break
}
 }
  }
   }
print(M)
   
for (k in 1:length(M))
   {
   M[[k]] - sort(unique(M[[k]]))
   print(M[[k]])
   }

There must be an error in reasoning, but I can't figure out where it
is...

Cheers,
John

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

2006-07-22 Thread Duncan Murdoch
On 7/22/2006 8:22 AM, Robert Mcfadden wrote:
 Dear R Users,
 I run simulation that takes very long time (R 2.2.1, Win XP pro., Rgui SDI
 mode, editor Tinn-R). 
 It's happened that R shuts down and Windows display the message: Rgui.exe
 makes an error and the application will shut down. Unfortunately everything
 I lost. Below I paste the message that is created when error appear. Maybe
 You as an expert will figure out what is happening to me.

I don't think there's any information below that is helpful to diagnose 
the reason for the crash.

What I'd recommend is that you write out partial results as your 
simulation progresses.  Then at least you'll have those partial results, 
but you may also have enough information to be able to be able to make 
the crash reproducible in a short script.

If you can do that, and you can make the crash reproducible in a current 
version of R (version 2.2.1 is obsolete; you should be using 2.3.1 at a 
minimum, perhaps 2.3.1 patched), then there's a good chance someone will 
be able to track down the bug and fix it.

Duncan Murdoch


 Best,
 Robert McFadden   
 
 
 ?xml version=1.0 encoding=UTF-16?
 DATABASE
 EXE NAME=Rgui.exe FILTER=GRABMI_FILTER_PRIVACY
 MATCHING_FILE NAME=md5check.exe SIZE=15360 CHECKSUM=0x5685AC04
 BIN_FILE_VERSION=2.21.51220.0 BIN_PRODUCT_VERSION=3.0.0.0
 FILE_DESCRIPTION=R for Windows files checker FILE_VERSION=2.2.1
 (2005-12-20) LEGAL_COPYRIGHT=R Development Core Team 1995-2005
 VERFILEDATEHI=0x0 VERFILEDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x1
 MODULE_TYPE=WIN32 PE_CHECKSUM=0x3CD5 LINKER_VERSION=0x1
 UPTO_BIN_FILE_VERSION=2.21.51220.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
 LINK_DATE=12/20/2005 13:17:59 UPTO_LINK_DATE=12/20/2005 13:17:59
 VER_LANGUAGE=Angielski (Stany Zjednoczone) [0x409] /
 MATCHING_FILE NAME=R.dll SIZE=2201600 CHECKSUM=0xFC7E40D1
 BIN_FILE_VERSION=2.21.51220.0 BIN_PRODUCT_VERSION=3.0.0.0
 FILE_DESCRIPTION=R for Windows DLL FILE_VERSION=2.2.1(2005-12-20)
 LEGAL_COPYRIGHT=R Development Core Team 1995-2005 VERFILEDATEHI=0x0
 VERFILEDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x2 MODULE_TYPE=WIN32
 PE_CHECKSUM=0x21CDB3 LINKER_VERSION=0x1
 UPTO_BIN_FILE_VERSION=2.21.51220.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
 LINK_DATE=12/20/2005 13:16:00 UPTO_LINK_DATE=12/20/2005 13:16:00
 VER_LANGUAGE=Angielski (Stany Zjednoczone) [0x409] /
 MATCHING_FILE NAME=R.exe SIZE=18432 CHECKSUM=0x4407B548
 BIN_FILE_VERSION=2.21.51220.0 BIN_PRODUCT_VERSION=3.0.0.0
 FILE_DESCRIPTION=R for Windows front-end FILE_VERSION=2.2.1
 (2005-12-20) LEGAL_COPYRIGHT=R Development Core Team 1995-2005
 VERFILEDATEHI=0x0 VERFILEDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x1
 MODULE_TYPE=WIN32 PE_CHECKSUM=0x60D3 LINKER_VERSION=0x1
 UPTO_BIN_FILE_VERSION=2.21.51220.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
 LINK_DATE=12/20/2005 13:17:58 UPTO_LINK_DATE=12/20/2005 13:17:58
 VER_LANGUAGE=Angielski (Stany Zjednoczone) [0x409] /
 MATCHING_FILE NAME=Rbitmap.dll SIZE=238592 CHECKSUM=0x861028AC
 MODULE_TYPE=WIN32 PE_CHECKSUM=0x457B3 LINKER_VERSION=0x1
 LINK_DATE=12/20/2005 13:25:12 UPTO_LINK_DATE=12/20/2005 13:25:12 /
 MATCHING_FILE NAME=Rblas.dll SIZE=106496 CHECKSUM=0x9A1FC9D3
 BIN_FILE_VERSION=2.21.51220.0 BIN_PRODUCT_VERSION=3.0.0.0
 FILE_DESCRIPTION=R for Windows DLL FILE_VERSION=2.2.1(2005-12-20)
 LEGAL_COPYRIGHT=R Development Core Team 1995-2005 VERFILEDATEHI=0x0
 VERFILEDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x2 MODULE_TYPE=WIN32
 PE_CHECKSUM=0x28489 LINKER_VERSION=0x1
 UPTO_BIN_FILE_VERSION=2.21.51220.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
 LINK_DATE=12/20/2005 13:17:52 UPTO_LINK_DATE=12/20/2005 13:17:52
 VER_LANGUAGE=Angielski (Stany Zjednoczone) [0x409] /
 MATCHING_FILE NAME=Rchtml.dll SIZE=6144 CHECKSUM=0x880344F
 MODULE_TYPE=WIN32 PE_CHECKSUM=0x4204 LINKER_VERSION=0x1
 LINK_DATE=12/20/2005 13:17:52 UPTO_LINK_DATE=12/20/2005 13:17:52 /
 MATCHING_FILE NAME=Rcmd.exe SIZE=18432 CHECKSUM=0x19E72056
 BIN_FILE_VERSION=2.21.51220.0 BIN_PRODUCT_VERSION=3.0.0.0
 FILE_DESCRIPTION=R for Windows front-end FILE_VERSION=2.2.1
 (2005-12-20) LEGAL_COPYRIGHT=R Development Core Team 1995-2005
 VERFILEDATEHI=0x0 VERFILEDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x1
 MODULE_TYPE=WIN32 PE_CHECKSUM=0x4A89 LINKER_VERSION=0x1
 UPTO_BIN_FILE_VERSION=2.21.51220.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
 LINK_DATE=12/20/2005 13:17:54 UPTO_LINK_DATE=12/20/2005 13:17:54
 VER_LANGUAGE=Angielski (Stany Zjednoczone) [0x409] /
 MATCHING_FILE NAME=Rgui.exe SIZE=10240 CHECKSUM=0x96A0D31D
 BIN_FILE_VERSION=2.21.51220.0 BIN_PRODUCT_VERSION=3.0.0.0
 FILE_DESCRIPTION=R for Windows GUI front-end FILE_VERSION=2.2.1
 (2005-12-20) LEGAL_COPYRIGHT=R Development Core Team 1995-2005
 VERFILEDATEHI=0x0 VERFILEDATELO=0x0 VERFILEOS=0x4 VERFILETYPE=0x1
 MODULE_TYPE=WIN32 PE_CHECKSUM=0x6C46 LINKER_VERSION=0x1
 UPTO_BIN_FILE_VERSION=2.21.51220.0 UPTO_BIN_PRODUCT_VERSION=3.0.0.0
 LINK_DATE=12/20/2005 13:17:53 UPTO_LINK_DATE=12/20/2005 13:17:53
 VER_LANGUAGE=Angielski (Stany Zjednoczone) [0x409] 

[R] compile R with ACML support | RHEL 4

2006-07-22 Thread Evan Cooch
Greetings -

I'm trying to compile R under GNU/Linux (RHEL 4) on a multi-Opteron box, 
with ACML support.

First, I downloaded and installed ACML 3.5 - GNU version, although I'm 
not entirely sure what the differences are - from the AMD website. The 
ACML libraries were installed to /opt/acml3.5.0/

Second, I ran ./configure --with-blas='-lacml'  

The configure went fine, except that at the end of the output, it 
reports that readline is the only external library configured.

External libraries: readline

OK, so next, I try

./configure --with-lapack

Same think - only readline is referenced.

So, clearly, I'm missing a particular step. I'm guessing that I need to 
change some environment variable (or two), or tweak something at some 
other stage, to get R to properly reference the ACML libraries. I'm 
puzzled why --with-blas='-acml' doesn't do the trick?

Suggestions? Pointers to the obvious mistake?

Thanks...

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


[R] mvpart

2006-07-22 Thread helen . mills
does anyone know of a tutorial that exists for the mvpart package other than the
package documentation and De'ath's original article in Ecology?

thanks,
Helen Mills Poulos
Yale School of Forestry

__
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] equality constraint

2006-07-22 Thread John Fox
Dear Ana Maria,

How about replacing the last of the four parameters with the negative of the
sum of the others?

I hope this helps,
 John


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario
Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox 
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
 Sent: Friday, July 21, 2006 4:31 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] equality constraint
 
 I would like to optimize a (log-)likelihood function subject 
 to linear equality constraints in parameters. My function has 
 eight parameters. The first one, third and fourth are greater 
 than zero, the second one must be less than zero. The problem 
 is that the last four must sum zero. Function constrOptim 
 only fits inequality constraints.
 Is there an alternative to lead with this problem?
 
 Ana Maria
 
 __
 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] Why the contrain does not work for selecting a particular range of data?

2006-07-22 Thread Xin
Dear:

Continuing the issue of 'ifelse'! I selecting the data whose 'x2'=1 for 
maximizing likelihood. I used two way to do this but the results are different.
   
1.Way one I use the data for x2=1 and run the program. It works for me. 
Tthe program is described as below:
function (parameters,y1,x11)
{
p-parameters[1]
alpha1-parameters[2]
beta1-parameters[3]
delta1-parameters[4]
lamda1-parameters[5]

mu-alpha1*((x11)^beta1)*exp(-delta1*(x11^lamda1))

ifelse(y10|x110,

L-lgamma(y1+p)+p*(log(p)-log(mu+p))+y1*(log(mu)-log(mu+p))-lfactorial(y1)-lgamma(p)

,Inf)

L

}

This is working for me.

   2 Way two: I select the data whose x2=1 in the whole range of data. It works 
but it is not right comparing the value of MLE. the program is:
function (parameters,y,x1,x2)

{

p-parameters[1]

alpha1-parameters[2]

beta1-parameters[3]

delta1-parameters[4]

alpha2-parameters[5]

mu-alpha1*((x1)^beta1)*exp(-delta1*(x1^alpha2))

if(x10  x2==1)

{

L-lgamma(y+p)+p*(log(p)-log(mu+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p)

}

else

L

}

   The reason why I edit the program by the second way is I want to use one 
program for getting results of the different range of data.

Anyone can help? Please!

Thanks!



Xin Shi

[[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] multcomp plotting Please help :)

2006-07-22 Thread Nair, Murlidharan T
I REALLY NEED HELP WITH THIS   PLEASE 
 
I am using the multcomp package for doing multiple comparisons (R 2.3.1 
windows). Since the data I am handling is huge the number of comparisons are 
also large. I am interested in:

1  Breaking down my plots to get rid of the clutter that happens when plotting 
the entire data set. How do I pass only part of the data to the plot function ?

fungus.cirec-simint(Fungus.yield~Habitat, data=fungus,conf.level=0.95,type 
=c(Tukey))
plot(fungus.cirec)  #This plots the entire data. I want to plot part of the 
data only

2I am also interested in getting rid of the field name associated with each 
categorical variable.
Here is what the part of the data looks like

Habitat Fungus.yield
Birch 20.83829053
Birch 22.9718181
Birch 22.28216829
Birch 24.23136797
Birch 22.32147961
Birch 20.30783598
Oak 27.24047258
Oak 29.7730014
Oak 30.12608508
Oak 25.76088669
Oak 30.14750974
Hornbeam 17.05307949
Hornbeam 15.32805111
Hornbeam 18.26920177
Hornbeam 21.30987049
Hornbeam 21.7173223

When it plots labels it as HabitatBirch-HabitatOak for example.  How do I get 
rid of the field name Habitat in the plot?

3 How do I tell the method to mark the significant comparisons? (i.e those 
that do not intersect the zero line).

Thanks ../Murli

__
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] multcomp plotting Please help :)

2006-07-22 Thread Gabor Grothendieck
On 7/22/06, Nair, Murlidharan T [EMAIL PROTECTED] wrote:
 I REALLY NEED HELP WITH THIS   PLEASE

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

Suggest you follow the instructions to get better chance of a response.

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

2006-07-22 Thread Nair, Murlidharan T
Here it is again, hope this is more clear
 
I am using the following data (only a small subset is given):
 
Habitat Fungus.yield
Birch 20.83829053
Birch 22.9718181
Birch 22.28216829
Birch 24.23136797
Birch 22.32147961
Birch 20.30783598
Oak 27.24047258
Oak 29.7730014
Oak 30.12608508
Oak 25.76088669
Oak 30.14750974
Hornbeam 17.05307949
Hornbeam 15.32805111
Hornbeam 18.26920177
Hornbeam 21.30987049
Hornbeam 21.7173223

I am using the multcomp package to do multiple comparisons as follows 

library(multcomp) # loads the package

fungus-read.table(fungi.txt, Header=T)# Reads the data from file saved 
as fungi.txt


fungus.cirec-simint(Fungus.yield~Habitat, data=fungus,conf.level=0.95,type 
=c(Tukey))  # Computes cimultaneous intervals using Tukey's method


plot(fungus.cirec)   # plots the data

The plot function plots all the comparisons, I want to plot only part of the 
data since it clutters the graph. 

How do I plot only part of the data ?

How do I tell it to mark the significant comparisons?

How do I get rid of the field names in the plot? For eg. The plot labels are 
HabitatBirch-HabitatOak, I want it to be labeled as Birch-Oak.

 

Hope I have posted it according to the guidelines, let me know otherwise. 

Cheers .../Murli

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

2006-07-22 Thread Gabor Grothendieck
On 7/22/06, Nair, Murlidharan T [EMAIL PROTECTED] wrote:
 Here it is again, hope this is more clear

 I am using the following data (only a small subset is given):

 Habitat Fungus.yield
 Birch 20.83829053
 Birch 22.9718181
 Birch 22.28216829
 Birch 24.23136797
 Birch 22.32147961
 Birch 20.30783598
 Oak 27.24047258
 Oak 29.7730014
 Oak 30.12608508
 Oak 25.76088669
 Oak 30.14750974
 Hornbeam 17.05307949
 Hornbeam 15.32805111
 Hornbeam 18.26920177
 Hornbeam 21.30987049
 Hornbeam 21.7173223

 I am using the multcomp package to do multiple comparisons as follows

 library(multcomp) # loads the package

 fungus-read.table(fungi.txt, Header=T)# Reads the data from file saved 
 as fungi.txt


 fungus.cirec-simint(Fungus.yield~Habitat, data=fungus,conf.level=0.95,type 
 =c(Tukey))  # Computes cimultaneous intervals using Tukey's method


 plot(fungus.cirec)   # plots the data

 The plot function plots all the comparisons, I want to plot only part of the 
 data since it clutters the graph.

 How do I plot only part of the data ?

Don't understand what part of the data means.  Use data = fungus[1:10,]
in the simint call to just process the first 10 data rows.  To
eliminate a portion of
the plot note in ?plot.hmtest that there is a ... argument and its description
is that its passed to plot which in turn passes them to plot.default so you
could use ylim = 1:2, say, to show only part of the plot vertically.


 How do I tell it to mark the significant comparisons?

# after your plot statement:
pp - locator()
# now click on a spot on the plot
# and then right click and choose stop
text(pp$x, pp$y, some text)


 How do I get rid of the field names in the plot? For eg. The plot labels are 
 HabitatBirch-HabitatOak, I want it to be labeled as Birch-Oak.

# change rownames of the estimates which has the effect
# of changing the y axis labels
rownames(fungus.cirec$estimate) - LETTERS[1:3]
plot(fungus.cirec)

__
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] Random structure of nested design in lme

2006-07-22 Thread Spencer Graves
  Have you considered the following:

  anova(lme(NA.1~soiltype*habitat,random=~1|destination/origin))

  This seems more closely to match the 'aov' command in your original 
post.  This model might be written in more detail as follows:

  NA.1[s, h, i,j,k] = b0 + ST[s] + H[h] +
ST.H[s[i],j[j] j] + d[i] + o[i,j] + e[i,j,k]

where b0 = a constant to be estimated,

  s = the soil type for that particular sample,

  h = the habitat for that sample,

  ST = soil type coefficients to be estimated subject to a constraint 
that they sum to 0,

  H = habitat coefficients to be estimated subject to the constraint 
that they sum to 0,

  ST.H = soil type by habitat interaction coefficients to be estimated 
subject to constraints that ST.H[s,.] sum to 0 and ST.H[., h] also sum 
to 0,

  d[i] = a random deviation associated with each destination, assuming 
the d's are all normal, independent, with mean 0 and unknown but 
constant variance s2.d

  o[i, j] = a random deviation associated with each destination / 
origin combination, assuming the o's are all normal, independent, with 
mean 0 and unknown variance s2.o,

and   e[i,j,j] = the standard unknown noise term, normal, independent 
with mean 0 and unknown variance s2.e.

  The model you wrote includes nested noise terms for soil type and 
habitat as well.  These terms are not estimable, which makes the answers 
garbage, but the 'lme' function does not check for replicates and 
therefore sometimes gives garbage answers without warning.

  To get more information from the fit, I suggest you first try 
'methods(class=lme)', and review help pages associated with what you 
see listed there.

  Have you looked at Pinheiro and Bates (2000) Mixed-Effects Models in 
S and S-Plus (Springer)?  This is my all-time favorite reference on 
Bates has been one of the leading original contributors in variance 
components analysis and nonlinear estimation more generally for over 25 
years.  The 'nlme' package is the product of his work and the work of 
many of his graduate students prior to 2000.  The book, at least from my 
perspective, is very well written.  Moreover, the standard R 
distribution includes files named ch01.R, ch02.R, ..., ch06.R, 
ch08.R with the R scripts accompanying each chapter in the book in 
~\library\nlme\scripts under the R installation directory on your hard 
drive, e.g. D:\Program files\R\R-2.3.1\library\nlme\scripts, on my 
computer.  There are minor changes in the syntax in a few places between 
the book and the current R implementation that make it impossible to get 
some of the published answers.  Using these script files increases the 
likelihood that you will get essentially the book's answers and won't be 
defeated by subtle typographical errors or by the difference between x^2 
and I(x^2), for example.

  If you would like further information from this listserver, please 
submit another post, preferably including a commented, minimal, 
self-contained, reproducible code, as suggested in the posting guide 
www.R-project.org/posting-guide.html.

  Hope this helps.
  Spencer Graves

ESCHEN Rene wrote:
 Although I know it's not correct, this is what I tried in lme:
 
 anova(lme(NA.1~soiltype*habitat,random=~1|destination/habitat/origin/soiltype))
 
 # numDF denDF   F-value p-value
 #(Intercept)  1   130 12.136195  0.0007
 #soiltype 1   130 15.099792  0.0002
 #habitat  110  0.699045  0.4226
 #soiltype:habitat 1   130  2.123408  0.1475
 
 René.
 
 -Original Message-
 From: Doran, Harold [mailto:[EMAIL PROTECTED]
 Sent: Wed 2006-07-19 13:53
 To: ESCHEN Rene; r-help@stat.math.ethz.ch
 Subject: RE: [R] Random structure of nested design in lme
  
 Can you provide an example of what you have done with lme so we might be able 
 to evaluate the issue? 
 
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of ESCHEN Rene
 Sent: Wednesday, July 19, 2006 7:37 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] Random structure of nested design in lme

 All,

 I'm trying to analyze the results of a reciprocal transplant 
 experiment using lme(). While I get the error-term right in 
 aov(), in lme() it appears impossible to get as expected. I 
 would be greatful for any help.

 My experiment aimed to identify whether two fixed factors 
 (habitat type and soil type) affect the development of 
 plants. I took soil from six random sites each of two types 
 (arable and grassland) and transplanted them back into the 
 sites of origin in such way that in each of the sites there 
 were six pots containing arable soil and six pots of 
 grassland soil, each containing a seedling.

 With aov(), I got the analysis as I expected, with habitat 
 type tested against destination site, and soil type tested 
 against origin site:

Re: [R] ifelse command

2006-07-22 Thread Carlos J. Gil Bellosta
Dear Xin,

Although I have no idea what your function does, I believe it would be
formally correct in the following way:

foo - function (parameters,y,x1,x2)
{
p -parameters[1]
alpha1-parameters[2]
beta1-parameters[3]
delta1-parameters[4]
alpha2-parameters[5]

mu-alpha1*((x1)^beta1)*exp(-delta1*(x1^alpha2))

if(y0  x10  x2==1) return( lgamma(y+p)+p*(log(p)-log(mu
+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p) )
if(y0  x10  x2==2) return( lgamma(y+p)+p*(log(p)-log(mu
+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p) )
if(y0  x10  x2==3) return( lgamma(y+p)+p*(log(p)-log(mu
+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p) )

return( what then? )
}

Please, compare your code to mine. You will discover more than one error
in your code. See also where the if() parenthesis closes. I do not
believe your else's are necessary within a function. See also that the
code after your ifs is always the same.

Sincerely,

Carlos J. Gil Bellosta
http://www.datanalytics.com
http://www.data-mining-blog.com


El sáb, 22-07-2006 a las 13:25 +0100, Xin escribió:
 Dear:
 
I try to revise the maximum likelihood function below using something 
 constrains. But it seems something wrong with it.  Becasue R would not allow 
 me to edit the function like this. It is very appreciate if you can help.
   
 function (parameters,y,x1,x2)
 
 {
 
 p-parameters[1]
 
 alpha1-parameters[2]
 
 beta1-parameters[3)]
 
 delta1-parameters[4]
 
 alpha2-parameters[5]
 
 mu-alpha1*((x1)^beta1)*exp(-delta1*(x1^alpha2))
 
 if(y0  x10  x2==1,
 
 L-lgamma(y+p)+p*(log(p)-log(mu+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p)
 
 )
 
 else
 
 if(y0  x10  x2==2,
 
 L-lgamma(y+p)+p*(log(p)-log(mu+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p)
 
 )
 
 else
 
 if(y0  x10  x2==3,
 
 L-lgamma(y+p)+p*(log(p)-log(mu+p))+y*(log(mu)-log(mu+p))-lfactorial(y)-lgamma(p)
 
 )
 
 else
 
 L
 
 }
 
 Thanks a lot!
 
 Xin Shi
 
   [[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.


Re: [R] Putting x into the right subset

2006-07-22 Thread John Wiedenhoeft
Ahh, got it:
 There must be an error in reasoning, but I can't figure out where it
 is...

Consider 3 pairs: (1, 2), (2, 3), (1, 3), first is put in the first
line, second in the second, and third in the first, resulting in the 3
being contained in both. Simply folding lines together solves 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] fracdiff

2006-07-22 Thread Spencer Graves
  Confidence intervals for the fracdiff parameter estimates shouldn't 
be too difficult:  the ?fracdiff help file says it returns a list with 
components including 'd', 'ar' 'ma', and 'stderror.dpq'.  From these one 
should easily get the coeffecients, standard errors and naive, Wald 
confidence intervals;  for your convenience, I've embedded these in the 
functions 'coef.fracdiff' and 'confint.fracdiff' given below.

  By 'sigma2', I assume you mean the estimated variance of the whitened 
residuals.  That is not so obvious.  For that, I might try 
'arima(fitdiff(...))$sigma2', operating on a 'fracdiff' fit.

  Hope this helps.
  Spencer Graves
# coef and confint functions for output of fracdiff:
coef.fracdiff - function(object){
   unlist(object[c(d, ar, ma)])
}

confint.fracdiff - function(object, parm, level=0.95, ...){
   b - coef.fracdiff(object)
   se - object$stderror.dpq
   names(se) - names(b)
#
   if(missing(parm))
 parm - 1:length(b)
   b. - b[parm]
   se. - se[parm]
#
   conf.c - (1-level)/2
   conf2 - c(conf.c, 1-conf.c)
   confNames - paste(100*conf2, %)
   k. - length(b.)
   CI - b+outer(se., qnorm(conf2))
   dimnames(CI)[[2]] - confNames
   CI
}



Melissa Ann Haltuch wrote:
 Hi, I'm using the function fracdiff and can not 
figure out how to get the estimated values for
sigma2 or confidence intervals for the parameter
estimates. Does anyone know how to obtain these
values?
 Thanks,
 Melissa
 
 __
 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] connection to X11 problem

2006-07-22 Thread Peter Dalgaard
(Ted Harding) [EMAIL PROTECTED] writes:

 On 21-Jul-06 Paquet, Agnes wrote:
  Dear List,
  
  I am a new Mac user and I am having problem generating png (or jpeg)
  using the GUI version of R. I installed R-2.3.1.dmg (custom install
  with
  everything selected) and X11User.pkg but I am still getting the
  following X11 connection error when I try to generate a png (or a
  jpeg):
  
  Error in X11(paste(png::, filename, sep = ), width, height,
  pointsize,  : 
  unable to start device PNG
  In addition: Warning message:
  unable to open connection to X11 display ''
  
  I tried to set up the DISPLAY variable using the command:
  
  Sys.putenv(DISPLAY=:0)
  
  but I am still running into the same problem. 
 
 Like Marc, I don't use a Mac either. But the underlying BSD OS
 is basically similar to Linux. On Linux, my primary X11 DISPLAY
 envvar would be :0.0, so (at a guess) I suggest you try
 
   Sys.putenv(DISPLAY=:0.0)
 
 Hoping this helps!
 Ted.

A silly question must be asked: One thing is *installing* the X11
package on a Mac, but you do need to be actually *running* an X
server. Are you?

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

2006-07-22 Thread Nair, Murlidharan T
-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL PROTECTED] 
Sent: Saturday, July 22, 2006 1:37 PM
To: Nair, Murlidharan T
Cc: R-help@stat.math.ethz.ch
Subject: Re: [R] Multcomp

On 7/22/06, Nair, Murlidharan T [EMAIL PROTECTED] wrote:
 Here it is again, hope this is more clear

 I am using the following data (only a small subset is given):

 Habitat Fungus.yield
 Birch 20.83829053
 Birch 22.9718181
 Birch 22.28216829
 Birch 24.23136797
 Birch 22.32147961
 Birch 20.30783598
 Oak 27.24047258
 Oak 29.7730014
 Oak 30.12608508
 Oak 25.76088669
 Oak 30.14750974
 Hornbeam 17.05307949
 Hornbeam 15.32805111
 Hornbeam 18.26920177
 Hornbeam 21.30987049
 Hornbeam 21.7173223

 I am using the multcomp package to do multiple comparisons as follows

 library(multcomp) # loads the package

 fungus-read.table(fungi.txt, Header=T)# Reads the data from
file saved as fungi.txt


 fungus.cirec-simint(Fungus.yield~Habitat,
data=fungus,conf.level=0.95,type =c(Tukey))  # Computes cimultaneous
intervals using Tukey's method


 plot(fungus.cirec)   # plots the data

 The plot function plots all the comparisons, I want to plot only part
of the data since it clutters the graph.

 How do I plot only part of the data ?

Don't understand what part of the data means.  Use data =
fungus[1:10,]
in the simint call to just process the first 10 data rows.  To
eliminate a portion of
the plot note in ?plot.hmtest that there is a ... argument and its
description
is that its passed to plot which in turn passes them to plot.default so
you
could use ylim = 1:2, say, to show only part of the plot vertically.


I have to use all the data for my computation. Since the number of
comparisons are many I want to plot it in different graphs so that the
graph does not look cluttered. So part of the data means a subset of
the comparisons in one graph and another subset in another and so
on
 Can you give me an example of the  ylim parameter. I tried
plot(fungus.cirec, ylim=1:2) and it was not happy with it. I am not
completely comfortable with the ... argument. I am trying to read up
on it. 



 How do I tell it to mark the significant comparisons?

# after your plot statement:
pp - locator()
# now click on a spot on the plot
# and then right click and choose stop
text(pp$x, pp$y, some text)

 This is very useful


 How do I get rid of the field names in the plot? For eg. The plot
labels are HabitatBirch-HabitatOak, I want it to be labeled as
Birch-Oak.

# change rownames of the estimates which has the effect
# of changing the y axis labels
rownames(fungus.cirec$estimate) - LETTERS[1:3]
plot(fungus.cirec)

This only labels it a A,B or C. What I wanted was to remove the field
name Habitat in this case and out put the label as Birch-Oak. 

Thanks ../Murli

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

2006-07-22 Thread Gabor Grothendieck
On 7/22/06, Nair, Murlidharan T [EMAIL PROTECTED] wrote:
 -Original Message-
 From: Gabor Grothendieck [mailto:[EMAIL PROTECTED]
 Sent: Saturday, July 22, 2006 1:37 PM
 To: Nair, Murlidharan T
 Cc: R-help@stat.math.ethz.ch
 Subject: Re: [R] Multcomp

 On 7/22/06, Nair, Murlidharan T [EMAIL PROTECTED] wrote:
  Here it is again, hope this is more clear
 
  I am using the following data (only a small subset is given):
 
  Habitat Fungus.yield
  Birch 20.83829053
  Birch 22.9718181
  Birch 22.28216829
  Birch 24.23136797
  Birch 22.32147961
  Birch 20.30783598
  Oak 27.24047258
  Oak 29.7730014
  Oak 30.12608508
  Oak 25.76088669
  Oak 30.14750974
  Hornbeam 17.05307949
  Hornbeam 15.32805111
  Hornbeam 18.26920177
  Hornbeam 21.30987049
  Hornbeam 21.7173223
 
  I am using the multcomp package to do multiple comparisons as follows
 
  library(multcomp) # loads the package
 
  fungus-read.table(fungi.txt, Header=T)# Reads the data from
 file saved as fungi.txt
 
 
  fungus.cirec-simint(Fungus.yield~Habitat,
 data=fungus,conf.level=0.95,type =c(Tukey))  # Computes cimultaneous
 intervals using Tukey's method
 
 
  plot(fungus.cirec)   # plots the data
 
  The plot function plots all the comparisons, I want to plot only part
 of the data since it clutters the graph.
 
  How do I plot only part of the data ?

 Don't understand what part of the data means.  Use data =
 fungus[1:10,]
 in the simint call to just process the first 10 data rows.  To
 eliminate a portion of
 the plot note in ?plot.hmtest that there is a ... argument and its
 description
 is that its passed to plot which in turn passes them to plot.default so
 you
 could use ylim = 1:2, say, to show only part of the plot vertically.


 I have to use all the data for my computation. Since the number of
 comparisons are many I want to plot it in different graphs so that the
 graph does not look cluttered. So part of the data means a subset of
 the comparisons in one graph and another subset in another and so
 on
  Can you give me an example of the  ylim parameter. I tried
 plot(fungus.cirec, ylim=1:2) and it was not happy with it. I am not
 completely comfortable with the ... argument. I am trying to read up
 on it.


 
  How do I tell it to mark the significant comparisons?

 # after your plot statement:
 pp - locator()
 # now click on a spot on the plot
 # and then right click and choose stop
 text(pp$x, pp$y, some text)

  This is very useful

 
  How do I get rid of the field names in the plot? For eg. The plot
 labels are HabitatBirch-HabitatOak, I want it to be labeled as
 Birch-Oak.

 # change rownames of the estimates which has the effect
 # of changing the y axis labels
 rownames(fungus.cirec$estimate) - LETTERS[1:3]
 plot(fungus.cirec)

 This only labels it a A,B or C. What I wanted was to remove the field
 name Habitat in this case and out put the label as Birch-Oak.


See ?gsub

__
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] RfW 2.3.1: regular expressions to detect pairs of identical word-final character sequences

2006-07-22 Thread Stefan Th. Gries
Dear all

I use R for Windows 2.3.1 on a fully updated Windows XP Home SP2 machine and I 
have two related regular expression problems.

platform   i386-pc-mingw32   
arch   i386  
os mingw32   
system i386, mingw32 
status   
major  2 
minor  3.1   
year   2006  
month  06
day01
svn rev38247 
language   R 
version.string Version 2.3.1 (2006-06-01)


I would like to find cases of words in elements of character vectors that end 
in the same character sequences; if I find such cases, I want to add r to 
both potentially rhyming sequences. An example:

INPUT:This is my dog.
DESIRED OUTPUT: Thisr isr my dog.

I found a solution for cases where the potentially rhyming words are adjacent:

text-This is my dog.
gsub((\\w+?)(\\W\\w+?)\\1(\\W), \\1r\\2\\1r\\3, text, perl=TRUE)

However, with another text vector, I came across two problems I cannot seem to 
solve and for which I would love to get some input.

(i) While I know what to do for non-adjacent words in general

gsub((\\w+?)(\\W.+?)\\1(\\W), \\1r\\2\\1r\\3, This not is my dog, 
perl=TRUE) # I know this is not proper English ;-)

this runs into problems with overlapping matches:

text-And this is the second sentence
gsub((\\w+?)(\\W.+?)\\1(\\W), \\1r\\2\\1r\\3, text, perl=TRUE)
[1] Andr this is the secondr sentence

It finds the nd match, but since the is match is within the two nd's, it 
doesn't get it. Any ideas on how to get all pairwise matches?

(ii) How would one tell R to match only when there are 2+ characters matching? 
If the above expression is applied to another character string

text-this is an example sentence.
gsub((\\w+?)(\\W.+?)\\1(\\W), \\1r\\2\\1r\\3, text, perl=TRUE)

it also matches the e's at the end of example and sentence. It's not possible 
to get rid of that by specifying a range such as {2,}

text-this is an example sentence.
gsub((\\w{2,}?)(\\W.+?)\\1(\\W), \\1r\\2\\1r\\3, text, perl=TRUE)

because, as I understand it, this requires the 2+ cases of \\w to be identical 
characters:

text-doo yoo see mee?
gsub((\\w{2,}?)(\\W.+?)\\1(\\W), \\1r\\2\\1r\\3, text, perl=TRUE)

Again, any ideas?

I'd really appreciate any snippets of codes, pointers, etc.
Thanks so much,
STG
--
Stefan Th. Gries
---
University of California, Santa Barbara
http://www.linguistics.ucsb.edu/faculty/stgries

__
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 Messages using rq -quantile regressions

2006-07-22 Thread Neil KM
I am a new to using quantile regressions in R. I have estimated a set of 
coefficients using the method=br algorithm with the rq command at various 
quantiles along the entire distribution.

My data set contains approximately 2,500 observations and I have 7 predictor 
variables. I receive the following warning message:

Solution may be nonunique in: rq.fit.br(x, y, tau = tau, ...)

There are 13 warnings of this type after I run a single  model. My results 
are similiar to the results I received in other stat programs using quantile 
reg procedures. I am unclear what these warning messages imply and if there 
are problems with model fit/convergence that I may need to consider.
Any help would be appreciated. Thanks!

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


Re: [R] RfW 2.3.1: regular expressions to detect pairs of identical word-final character sequences

2006-07-22 Thread Gabor Grothendieck
The following requires more than just a single gsub but it does solve
the problem.  Modify to suit.

The first gsub places ... around the first occurrence of any
duplicated suffixes.  We use the (?=...) zero width regexp
to circumvent the nesting problem.

Then we use strapply from the gsubfn package to extract
the suffixes so marked and paste them together to pass
to a second gsub which locates them in the original
string appending an r to each.   Uncomment the commented
pat if you only want to match 2+ character suffixes.

library(gsubfn)
# places ... around first occurrences of repeated suffixes
text - And this is the second sentence
pat - (\\w+)(?=\\b.+\\1\\b)
# pat - (\\w\\w+)(?=\\b.+\\1\\b)
out - gsub(pat, 1\\, text, perl = TRUE)

suff - strapply(out, ([^]+), function(x,y)y)[[1]]
gsub(paste((, paste(suff, collapse = |), )\\b, sep = ), \\1r, text)


On 7/22/06, Stefan Th. Gries [EMAIL PROTECTED] wrote:
 Dear all

 I use R for Windows 2.3.1 on a fully updated Windows XP Home SP2 machine and 
 I have two related regular expression problems.

 platform   i386-pc-mingw32
 arch   i386
 os mingw32
 system i386, mingw32
 status
 major  2
 minor  3.1
 year   2006
 month  06
 day01
 svn rev38247
 language   R
 version.string Version 2.3.1 (2006-06-01)


 I would like to find cases of words in elements of character vectors that end 
 in the same character sequences; if I find such cases, I want to add r to 
 both potentially rhyming sequences. An example:

 INPUT:This is my dog.
 DESIRED OUTPUT: Thisr isr my dog.

 I found a solution for cases where the potentially rhyming words are adjacent:

 text-This is my dog.
 gsub((\\w+?)(\\W\\w+?)\\1(\\W), \\1r\\2\\1r\\3, text, perl=TRUE)

 However, with another text vector, I came across two problems I cannot seem 
 to solve and for which I would love to get some input.

 (i) While I know what to do for non-adjacent words in general

 gsub((\\w+?)(\\W.+?)\\1(\\W), \\1r\\2\\1r\\3, This not is my dog, 
 perl=TRUE) # I know this is not proper English ;-)

 this runs into problems with overlapping matches:

 text-And this is the second sentence
 gsub((\\w+?)(\\W.+?)\\1(\\W), \\1r\\2\\1r\\3, text, perl=TRUE)
 [1] Andr this is the secondr sentence

 It finds the nd match, but since the is match is within the two nd's, 
 it doesn't get it. Any ideas on how to get all pairwise matches?

 (ii) How would one tell R to match only when there are 2+ characters 
 matching? If the above expression is applied to another character string

 text-this is an example sentence.
 gsub((\\w+?)(\\W.+?)\\1(\\W), \\1r\\2\\1r\\3, text, perl=TRUE)

 it also matches the e's at the end of example and sentence. It's not 
 possible to get rid of that by specifying a range such as {2,}

 text-this is an example sentence.
 gsub((\\w{2,}?)(\\W.+?)\\1(\\W), \\1r\\2\\1r\\3, text, perl=TRUE)

 because, as I understand it, this requires the 2+ cases of \\w to be 
 identical characters:

 text-doo yoo see mee?
 gsub((\\w{2,}?)(\\W.+?)\\1(\\W), \\1r\\2\\1r\\3, text, perl=TRUE)

 Again, any ideas?

 I'd really appreciate any snippets of codes, pointers, etc.
 Thanks so much,
 STG
 --
 Stefan Th. Gries
 ---
 University of California, Santa Barbara
 http://www.linguistics.ucsb.edu/faculty/stgries

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