Re: [R] Re: Reasons not to answer very basic questions...

2004-11-30 Thread Uwe Ligges
Jim Lemon wrote:
A.J. Rossini wrote:
and perhaps the most important reason for the particular socratic form
of teaching on this list...

Golly, anyone who read Plato's Dialogues would realize that the Socratic 
method involves patiently leading the questioner stepwise through the 
solution, not simply writing RTFMeno.

Jim
Jim, yes, that way works as long as the number of questioners does not 
sum up to a lot:
It is easy to teach courses for 20 people and answer individual 
questions, even if these questions are very basic and have been 
explained more than once during the course.
Courses for 700 people (e.g. basic statistics for economists) in the 
biggest auditory aren't that funny and you have to say read what 
I/others have written! - or next month almost each student will be in 
your office asking question he/she could not work out in half an hour 
him/herself ...

So it is my very serious opinion that we need to point people to the 
basic documentation and the FAQ, if they post their first very basic 
question to the list. If the questioner asks the next basic questions as 
well, and with him many others, we will have a flood of many hundreds of 
messages a day!

Uwe
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] about cancor.R

2004-11-30 Thread yan zhao
Hello,
I'm a beginning user of R, now I have a question about canonical correlation analysis (cca). 
In R,there is a function cancor.R used for cca; For example X(n*p1) and Y(n*p2)are the two matrix to be analyzed. In the example given by R, when n max(p1,n2), cancor(X,Y) works; but when np1 or np2, cancor(X,Y) doesn't work well because cancor$cor == 1; how to cope with this case? maybe before apply the two matrix to cancor.R, some time-space transformation should be done? could you give some suggestion? Thanks you in advance!
Best regards,
Yan ZHAO

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] about cancor.R

2004-11-30 Thread Prof Brian Ripley
On Tue, 30 Nov 2004, yan zhao wrote:
Hello,
I'm a beginning user of R, now I have a question about canonical correlation 
analysis (cca). In R,there is a function cancor.R used for cca; For example
There is no such function in R, and I can't find it in any add-on package.
Do you mean the function cancor() in the stats package?
X(n*p1) and Y(n*p2)are the two matrix to be analyzed. In the example given by 
R, when n max(p1,n2), cancor(X,Y) works; but when np1 or np2, cancor(X,Y) 
doesn't work well because cancor$cor == 1; how to cope with this case? maybe 
before apply the two matrix to cancor.R, some time-space transformation 
should be done? could you give some suggestion? Thanks you in advance!
You need to understand the underlying theory: the problem is not with the 
function but your use of the technique.  Assuming non-degenerate matrices, 
you have a situation in which one of the matrices spans the entire space 
of observations and so imposes no restriction.

R help pages come with references: please consult them.  Since you have 
not told us why you are using CCA, we can't help you with the 
methodological questions, even if they are off topic for the R-help list.

--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: Re: [R] systemfit - SUR

2004-11-30 Thread contact

Arne Henningsen [EMAIL PROTECTED] schrieb am 29.11.2004,
17:02:12:
 On Monday 29 November 2004 16:42, [EMAIL PROTECTED] wrote:
  Hello to everyone,
 
  I have 2 problems and would be very pleased if anyone can help me:
 
  1) When I use the package systemfit for SUR regressions, I get two
  different variance-covariance matrices when I firstly do the SUR
  regression (The covariance matrix of the residuals used for
  estimation) and secondly do the OLS regressions. In the manual for
  systemfit on page 14 I see however, that the variance-covariance
  matrix for SUR is obtained from OLS. How can this be explained?
 
 Hi Thomas,
 I get identical residual covariance matrices:
 
 R library(systemfit)
 R data( kmenta )
 R demand  supply  labels  system  fitols  fitols$rcov
  [,1] [,2]
 [1,] 3.725391 4.136963
 [2,] 4.136963 5.784441
 R fitsur  fitsur$rcovest
  [,1] [,2]
 [1,] 3.725391 4.136963
 [2,] 4.136963 5.784441
 
It is a pity, but my matrices are not as nice :-(
An excerpt:
fitsur$rcovest
[,1] [,2] [,3]   ...
 [1,] 0.015097517  0.018005050 
 [2,] 0.018005050  0.276259834
 ...

fitols$rcov
   [,1]  [,2]   [,3] ... 
 [1,]  1.010326e-02  0.0096103837  
 [2,]  9.610384e-03  0.2329884378  
 ...

fitsur The covariance matrix of the residuals used for estimation:
eq1 eq2eq3 ...  
eq1 0.01317429  0.01504719 0.007981307  
eq2 0.01504719  0.25233860 
...

fitols The covariance matrix of the residuals:
eq1  eq2  eq3  ...
eq1 9.51154e-03  0.009137884  0.002648577  
eq2 9.13788e-03  0.220435063  
...

By the way: Why are the figures larger for SUR?
 Did you do _iterated_ SUR?
 
Yes:
systemfit results 
method: iterated SUR 
convergence achieved after 30 iterations

I do not know how to change that. 

 Best wishes,
 Arne
THANKS A LOT FOR YOUR IMMEDIATE HELP!!!

 
  2) Is there an easy possibility to test a) the OLS equations, and b) the
  SUR system for SUR structures? In other words: Is the LM-Test from
  Breusch and Pagan available in R?
 
  Thanks for the attention!
 
  Best Regards,
  Thomas Almer
 
  __
  [EMAIL PROTECTED] mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
 
 -- 
 Arne Henningsen
 Department of Agricultural Economics
 University of Kiel
 Olshausenstr. 40
 D-24098 Kiel (Germany)
 Tel: +49-431-880 4445
 Fax: +49-431-880 1397
 [EMAIL PROTECTED]
 http://www.uni-kiel.de/agrarpol/ahenningsen/

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Problem with print() and backslashes.

2004-11-30 Thread Kevin Brinkmann
Dear R List

I have a small problem concerning the output of print().

My version:

 R.version
 _
platform i386-portbld-freebsd5.2
arch i386
os   freebsd5.2
system   i386, freebsd5.2
status
major1
minor9.0
year 2004
month04
day  12
language R

Consider this: I want to print a backslash with an exclamation mark. Here
is the output.

 print( \! )
[1] !

Now I try it differently...

 print( \\! )
[1] \\!

The output contains two backslashes. Why?

Regards,

Kevin

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Problem with print() and backslashes.

2004-11-30 Thread Prof Brian Ripley
On Tue, 30 Nov 2004, Kevin Brinkmann wrote:
Dear R List
I have a small problem concerning the output of print().
My version:
R.version
_
platform i386-portbld-freebsd5.2
arch i386
os   freebsd5.2
system   i386, freebsd5.2
status
major1
minor9.0
year 2004
month04
day  12
language R
Consider this: I want to print a backslash with an exclamation mark. Here
is the output.
print( \! )
[1] !
Now I try it differently...
print( \\! )
[1] \\!
The output contains two backslashes. Why?
Because it is documented to escape backslashes: use cat() if that is not 
what you want.

--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Problem with print() and backslashes.

2004-11-30 Thread Peter Dalgaard
Kevin Brinkmann [EMAIL PROTECTED] writes:

 Consider this: I want to print a backslash with an exclamation mark. Here
 is the output.
 
  print( \! )
 [1] !
 
 Now I try it differently...
 
  print( \\! )
 [1] \\!
 
 The output contains two backslashes. Why?

(Didn't we do that one only yesterday?)

The answer is: For the same reason that you need them on input. R
likes to line things up in columns when printing vectors so cannot
just print special characters like newline, carriage return, etc.
Instead it represents them as \n, \r just like on input. To
distinguish from backslash-followed-by-n the backslash is itself
escaped with a backslash. Use cat() to output a string as raw
characters. 

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Problem with print() and backslashes.

2004-11-30 Thread Henrik Bengtsson
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Brinkmann
 Sent: Tuesday, November 30, 2004 9:43 AM
 To: [EMAIL PROTECTED]
 Subject: [R] Problem with print() and backslashes.
 
 
 Dear R List
 
 I have a small problem concerning the output of print().

snip/snip 
 
 Consider this: I want to print a backslash with an
 exclamation mark. Here is the output.
 
  print( \! )
 [1] !
 
 Now I try it differently...
 
  print( \\! )
 [1] \\!
 
 The output contains two backslashes. Why?

 cat(\\!)
\!

also

 str(\\!)
 chr \!


What is important to keep in mind is that the string \\! has *two*
characters (when read by R), not three (as on the screen or in your editor);

 nchar(\\!)
[1] 2

The first character is \\, which needs to be escaped in order for the R
parser to recognize it as '\'. The second is of course '!'. I agree that

 nchar(\!)
[1] 1

might be confusing. The thing is that some characters remain the same
escaped or not, whereas others have certain mappings to non-printable ASCII
codes (0-255).

 identical(\!, !)
[1] TRUE

and the well known(?) newline character

 identical(\n, n)
[1] FALSE

Another good example:
 identical(\, '')
[1] TRUE

Given a string, print() gives you the escaped version of the string, which
can be useful for debugging, if you want to cut'n'paste and so on. Thus,

 print(Hello world\n!\n)
[1] Hello world\n!\n

and

 cat(Hello world\n!\n)
Hello world
!

Hope this helps!

Henrik Bengtsson

 Regards,
 
 Kevin
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Creating a factor from a combination of vectors

2004-11-30 Thread Yves Brostaux
Dear list,
Here's a little problem I already solved with my own coding style, but I 
feel there is a more efficient and cleaner way to write it, but had no 
success finding the clever solution.

I want to produce a factor from a subset of the combination of two 
vectors. I have the vectors a et b in a data-frame :

 df - expand.grid(a=c(0, 5, 10, 25, 50), b=c(0, 25, 50, 100, 200))
 fac.df
   a   b
1   0   0
2   5   0
3  10   0
4  25   0
5  50   0
6   0  25
7   5  25
snip
and want to create a factor which levels correspond to particular 
combinations of a and b (let's say Low for a=0  b=0, Medium for a=10  
b=50, High for a=50  b=200, others levels set to NA), reading them from 
a data-frame which describes the desired subset and corresponding levels.

Here's my own solution (inputs are data-frames df and cas, output is the 
sub factor):

 cas - as.data.frame(matrix(c(0, 10,50, 0, 50, 200), 3, 
2,dimnames=list(c(Low, Medium, High), c(a, b
 cas
   a   b
Low 0   0
Medium 10  50
High   50 200

 sub - character(length(df$a))
 for (i in 1:length(df$a)) {
+   temp - rownames(cas)[cas$a==df$a[i]  cas$b==df$b[i]]
+   sub[i] - ifelse(length(temp)0, temp, NA)
+ }
 sub - ordered(sub, levels=c(Low, Medium, High))
 sub
[1] LowNA   NA   NA   NA   NA   NA   NA   NA   
NA   NA   NA   Medium NA   NA   NA   NA 
[18] NA   NA   NA   NA   NA   NA   NA   High 
Levels: Low  Medium  High

I was looking for a vectorized solution (apply style) binding 
data-frames df and cas, but didn't succeed avoiding the for loop. Could 
anybody bring me the ligths over the darkness of my ignorance ? Thank 
you very much in advance.

--
Ir. Yves BROSTAUX
Unité de Statistique et Informatique
Faculté universitaire des Sciences agronomiques de Gembloux (FUSAGx)
8, avenue de la Faculté
B-5030 Gembloux
Belgique
Tél: +32 81 62 24 69
Email: [EMAIL PROTECTED]
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] systemfit - SUR

2004-11-30 Thread Arne Henningsen
On Tuesday 30 November 2004 09:34, [EMAIL PROTECTED] wrote:
 Arne Henningsen [EMAIL PROTECTED] schrieb am 29.11.2004,

 17:02:12:
  On Monday 29 November 2004 16:42, [EMAIL PROTECTED] wrote:
   Hello to everyone,
  
   I have 2 problems and would be very pleased if anyone can help me:
  
   1) When I use the package systemfit for SUR regressions, I get two
   different variance-covariance matrices when I firstly do the SUR
   regression (The covariance matrix of the residuals used for
   estimation) and secondly do the OLS regressions. In the manual for
   systemfit on page 14 I see however, that the variance-covariance
   matrix for SUR is obtained from OLS. How can this be explained?
 
  Hi Thomas,
  I get identical residual covariance matrices:
 
  R library(systemfit)
  R data( kmenta )
  R demand  supply  labels  system  fitols  fitols$rcov
   [,1] [,2]
  [1,] 3.725391 4.136963
  [2,] 4.136963 5.784441
  R fitsur  fitsur$rcovest
   [,1] [,2]
  [1,] 3.725391 4.136963
  [2,] 4.136963 5.784441

 It is a pity, but my matrices are not as nice :-(

Please show how you obtained these results. 

This is what I did:
R data( kmenta )
R demand - q ~ p + d
R supply - q ~ p + f + a
R labels - list( demand, supply )
R system - list( demand, supply )
R
R # OLS estimation:
R fitols - systemfit(OLS, system, labels, data=kmenta )
R # (non-iterated) SUR estimation
R fitsur - systemfit(SUR, system, labels, data=kmenta )
R iterated SUR estimation
R fitsurit - systemfit(SUR, system, labels, data=kmenta, maxit=100 )
R
R fitols$rcov
 [,1] [,2]
[1,] 3.725391 4.136963
[2,] 4.136963 5.784441
R fitsur$rcovest
 [,1] [,2]
[1,] 3.725391 4.136963
[2,] 4.136963 5.784441
R fitsurit$rcovest
 [,1] [,2]
[1,] 6.199071 7.493383
[2,] 7.493383 9.128547


 An excerpt:
 fitsur$rcovest
 [,1] [,2] [,3]   ...
  [1,] 0.015097517  0.018005050
  [2,] 0.018005050  0.276259834
  ...

 fitols$rcov
[,1]  [,2] [,3] ...
  [1,]  1.010326e-02  0.0096103837
  [2,]  9.610384e-03  0.2329884378
  ...

 fitsur The covariance matrix of the residuals used for estimation:
 eq1 eq2eq3 ...
 eq1 0.01317429  0.01504719 0.007981307
 eq2 0.01504719  0.25233860
 ...

 fitols The covariance matrix of the residuals:
 eq1  eq2  eq3  ...
 eq1 9.51154e-03  0.009137884  0.002648577
 eq2 9.13788e-03  0.220435063
 ...

 By the way: Why are the figures larger for SUR?

OLS minimizes the residuals and, thus, also the variance of the residuals 
(=diagonal of the residual covariance matrix).
Iterated SUR is equivalent to a maximum likelihood estimation. Maximizing the 
likelihood value is equivalent to minimizing the determinant of the residual 
covariance matrix. Thus, the determinant of the residual covariance matrix 
and not the residuals itself are minimized:

R det(fitols$rcov)
[1] 4.434845
R det(fitsurit$rcov)
[1] 0.4376941
R det(fitsurit$rcovest)
[1] 0.4377184

  Did you do _iterated_ SUR?

 Yes:
 systemfit results
 method: iterated SUR
 convergence achieved after 30 iterations

If you use iterated SUR, the SUR estimations are iterated. In the first SUR 
estimation the residual covariance matrix of the OLS estimation is used. In 
all following iterations the residual covariance matrix of the previous step 
SUR estimation is used. 

 I do not know how to change that.

Please read the documentation. It says to set argument maxit to 1 - or do 
not provide this argument, since 1 is the default.

  Best wishes,
  Arne

 THANKS A LOT FOR YOUR IMMEDIATE HELP!!!

   2) Is there an easy possibility to test a) the OLS equations, and b)
   the SUR system for SUR structures? In other words: Is the LM-Test from
   Breusch and Pagan available in R?

I don't understand what you want to test. Does the hausman test what you are 
looking for (see ?hausman.systemfit). If you have questions regarding this 
test, you might ask my co-author of systemfit, Jeff Hamann.

Best wishes,
Arne

   Thanks for the attention!
  
   Best Regards,
   Thomas Almer
  
   __
   [EMAIL PROTECTED] mailing list
   https://stat.ethz.ch/mailman/listinfo/r-help
   PLEASE do read the posting guide!
   http://www.R-project.org/posting-guide.html
 
  --
  Arne Henningsen
  Department of Agricultural Economics
  University of Kiel
  Olshausenstr. 40
  D-24098 Kiel (Germany)
  Tel: +49-431-880 4445
  Fax: +49-431-880 1397
  [EMAIL PROTECTED]
  http://www.uni-kiel.de/agrarpol/ahenningsen/

 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

-- 
Arne Henningsen
Department of Agricultural Economics
University of Kiel
Olshausenstr. 40
D-24098 Kiel (Germany)
Tel: +49-431-880 4445
Fax: +49-431-880 1397
[EMAIL PROTECTED]

Re: Re: [R] systemfit - SUR

2004-11-30 Thread contact

Arne Henningsen [EMAIL PROTECTED] schrieb am 30.11.2004,
10:20:29:
 On Tuesday 30 November 2004 09:34, [EMAIL PROTECTED] wrote:
  Arne Henningsen  schrieb am 29.11.2004,
 
  17:02:12:
   On Monday 29 November 2004 16:42, [EMAIL PROTECTED] wrote:
Hello to everyone,
   
I have 2 problems and would be very pleased if anyone can help me:
   
1) When I use the package systemfit for SUR regressions, I get two
different variance-covariance matrices when I firstly do the SUR
regression (The covariance matrix of the residuals used for
estimation) and secondly do the OLS regressions. In the manual for
systemfit on page 14 I see however, that the variance-covariance
matrix for SUR is obtained from OLS. How can this be explained?
  
   Hi Thomas,
   I get identical residual covariance matrices:
  
   R library(systemfit)
   R data( kmenta )
   R demand  supply  labels  system  fitols  fitols$rcov
[,1] [,2]
   [1,] 3.725391 4.136963
   [2,] 4.136963 5.784441
   R fitsur  fitsur$rcovest
[,1] [,2]
   [1,] 3.725391 4.136963
   [2,] 4.136963 5.784441
 
  It is a pity, but my matrices are not as nice :-(
 
 Please show how you obtained these results. 
I did not provide the steps, because the data is not public. But that is
what I did after defining the system and labels (like you  the
documentation):
fitols-systemfit(OLS, system, labels)
fitsur-systemfit(SUR, system, labels, maxit=100)

But after all I think your answers are sufficient. Thanks once again for
your support. R and the community are really excellent and a big thread
to competitors! 

 This is what I did:
 R data( kmenta )
 R demand  supply  labels  system 
 R # OLS estimation:
 R fitols  # (non-iterated) SUR estimation
 R fitsur  iterated SUR estimation
 R fitsurit 
 R fitols$rcov
  [,1] [,2]
 [1,] 3.725391 4.136963
 [2,] 4.136963 5.784441
 R fitsur$rcovest
  [,1] [,2]
 [1,] 3.725391 4.136963
 [2,] 4.136963 5.784441
 R fitsurit$rcovest
  [,1] [,2]
 [1,] 6.199071 7.493383
 [2,] 7.493383 9.128547
 
 
  An excerpt:
  fitsur$rcovest
  [,1] [,2] [,3]   ...
   [1,] 0.015097517  0.018005050
   [2,] 0.018005050  0.276259834
   ...
 
  fitols$rcov
 [,1]  [,2]   [,3] ...
   [1,]  1.010326e-02  0.0096103837
   [2,]  9.610384e-03  0.2329884378
   ...
 
  fitsur The covariance matrix of the residuals used for estimation:
  eq1 eq2eq3 ...
  eq1 0.01317429  0.01504719 0.007981307
  eq2 0.01504719  0.25233860
  ...
 
  fitols The covariance matrix of the residuals:
  eq1  eq2  eq3  ...
  eq1 9.51154e-03  0.009137884  0.002648577
  eq2 9.13788e-03  0.220435063
  ...
 
  By the way: Why are the figures larger for SUR?
 
 OLS minimizes the residuals and, thus, also the variance of the residuals 
 (=diagonal of the residual covariance matrix).
 Iterated SUR is equivalent to a maximum likelihood estimation. Maximizing the 
 likelihood value is equivalent to minimizing the determinant of the residual 
 covariance matrix. Thus, the determinant of the residual covariance matrix 
 and not the residuals itself are minimized:
 
 R det(fitols$rcov)
 [1] 4.434845
 R det(fitsurit$rcov)
 [1] 0.4376941
 R det(fitsurit$rcovest)
 [1] 0.4377184
 
   Did you do _iterated_ SUR?
 
  Yes:
  systemfit results
  method: iterated SUR
  convergence achieved after 30 iterations
 
 If you use iterated SUR, the SUR estimations are iterated. In the first SUR 
 estimation the residual covariance matrix of the OLS estimation is used. In 
 all following iterations the residual covariance matrix of the previous step 
 SUR estimation is used. 
 
  I do not know how to change that.
 
 Please read the documentation. It says to set argument maxit to 1 - or do 
 not provide this argument, since 1 is the default.
 
   Best wishes,
   Arne
 
  THANKS A LOT FOR YOUR IMMEDIATE HELP!!!
 
2) Is there an easy possibility to test a) the OLS equations, and b)
the SUR system for SUR structures? In other words: Is the LM-Test from
Breusch and Pagan available in R?
 
 I don't understand what you want to test. Does the hausman test what you are 
 looking for (see ?hausman.systemfit). If you have questions regarding this 
 test, you might ask my co-author of systemfit, Jeff Hamann.
Primarily I want to test if the variance covariance matrix of the OLS
residuals is diagonal. But this can be done manually, of course. 


 Best wishes,
 Arne
 
Thanks for the attention!
   
Best Regards,
Thomas Almer
   
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
  
   --
   Arne Henningsen
   Department of Agricultural Economics
   University of Kiel
   Olshausenstr. 40
   D-24098 Kiel (Germany)
   Tel: +49-431-880 4445
   Fax: +49-431-880 

Re: [R] plotting data in non-orthogonal coords.

2004-11-30 Thread Andreas Franke
Am Dienstag, 30. November 2004 10:26 schrieb Petr Pikal:
 Hallo Andreas

 There is probably no one who can give you some answer as you
 did provide almost no facts what you really did and what is wrong.
 You probably need to transform your coordinates to orthogonal
 and plot them as you wish. But you have to do it yourself.

 I had some data in polar coordinates some time ago and I did the
 same (see attached picture).

 Cheers
 Petr

 On 29 Nov 2004 at 14:29, Andreas Franke wrote:
  Hi !
  I am wondering how to plot data (e.g.  f(x,y) ) in a coordinate system
  spanned by two non-orthogonal basis vectors (e.g. hexagonal symmetry).
  The data is given on an equally spaced grid in theses coords and i
  would like to do a contour plot (e.g. with filled.contour).
 
  Thanks for your help. Andreas
 
  __
  [EMAIL PROTECTED] mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html

 Petr Pikal
 [EMAIL PROTECTED]

Hi !
Thanks for replying to my post and sorry for not being specific enough.
Maybe I am the one who didnt get the point , but as far as I understand R 
plots filled.contour(x,y,z,...) in the following way:

x,y define a grid in cartesian coords, i.e. the angle between x and y is 90°. 
So if I have data on such a grid I am fine.
My data is on an equally spaced grid in a coordsystem where x and y are at an 
angle of 60°. If you transform into cartesiancoords this isnt an equally 
spaced grid anymore.  You could interpret it as an equally spaced grid on 
which there is only data given on every second grid point.

It would be nice if one could just plot data given as F(x,y) where you supply 
x and y for every data point seperatly so that you dont need any specific 
grid.

I hope that someone can help.
Thanks in advance. Andreas

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] plotting data in non-orthogonal coords.

2004-11-30 Thread Petr Pikal
Hallo Andreas

There is probably no one who can give you some answer as you 
did provide almost no facts what you really did and what is wrong. 
You probably need to transform your coordinates to orthogonal 
and plot them as you wish. But you have to do it yourself. 

I had some data in polar coordinates some time ago and I did the 
same (see attached picture). 

Cheers
Petr 


On 29 Nov 2004 at 14:29, Andreas Franke wrote:

 Hi !
 I am wondering how to plot data (e.g.  f(x,y) ) in a coordinate system
 spanned by two non-orthogonal basis vectors (e.g. hexagonal symmetry).
 The data is given on an equally spaced grid in theses coords and i
 would like to do a contour plot (e.g. with filled.contour).
 
 Thanks for your help. Andreas
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Re: [R] systemfit - SUR

2004-11-30 Thread Arne Henningsen
On Tuesday 30 November 2004 10:50, [EMAIL PROTECTED] wrote:
 [ . . .]
  Please show how you obtained these results.

 I did not provide the steps, because the data is not public. 

A general remark:
In most cases a questioner can use the example data provided with a package or 
construct simple data, e.g. with matrix(1:9,3). See the posting guide, 
section Examples. (If the surprising behavior does not appear with the 
sample data, the questioner has to take a deeper look in _his_ data.)

 But that is 
 what I did after defining the system and labels (like you  the
 documentation):
 fitols-systemfit(OLS, system, labels)
 fitsur-systemfit(SUR, system, labels, maxit=100)

 But after all I think your answers are sufficient. Thanks once again for
 your support. R and the community are really excellent and a big thread
 to competitors!

 [ . . . ]
 2) Is there an easy possibility to test a) the OLS equations, and
 b) the SUR system for SUR structures? In other words: Is the
 LM-Test from Breusch and Pagan available in R?
 
  I don't understand what you want to test. Does the hausman test what you
  are looking for (see ?hausman.systemfit). If you have questions regarding
  this test, you might ask my co-author of systemfit, Jeff Hamann.

 Primarily I want to test if the variance covariance matrix of the OLS
 residuals is diagonal. But this can be done manually, of course.

Please provide the code and a reference to the test. Then, I will add this 
test to systemfit. This is how R works: useRs become developerR :-)

Best wishes,
Arne

-- 
Arne Henningsen
Department of Agricultural Economics
University of Kiel
Olshausenstr. 40
D-24098 Kiel (Germany)
Tel: +49-431-880 4445
Fax: +49-431-880 1397
[EMAIL PROTECTED]
http://www.uni-kiel.de/agrarpol/ahenningsen/

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] lme in R-2.0.0: Problem with lmeControl

2004-11-30 Thread Pavel Khomski
Hello!
One note/question hier about specification of control-parameters in the 
lme(...,control=list(...)) function call:

i tried to specify tne number of iteration needed via 
lme(,control=list(maxIter=..., niterEM=...,msVerbose=TRUE))
but every time i change the defualt values maxIter (e.g. maxIter=1, 
niterEM=0)  on ones specified by me, the call returns all the iterations 
needed until it's converged.
and this is exactly the problem i will to get round.  (e.g. in 
example on p.81 of Pinheiro/Bates,2000: 
fm1Rail.lme-lme(...,control=list(maxIter=1,...)))
so i have tried with option msMaxIter=... and this works.

The other problem is, that i even can not see (in R !!!) the output from 
iterations, despite the msVerbose=TRUE  specification and setting 
options(verbose=TRUE) (The S-plus can do it but also ignoring the 
maxIter=... specification)

Thank you for your hint
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Creating a factor from a combination of vectors

2004-11-30 Thread Eric Lecoutre
Hi Yves,
Using your objects, here is a way:
 cascombo=do.call(paste,c(cas,sep=.))
 factor(do.call(paste,c(df,sep=.)),levels=cascombo,labels=rownames(cas))
[1] 
LowNA   NA   NA   NA   NA   NA   NA   NA   NA   NA 
 NA   Medium NA   NA
[16] NA   NA   NA   NA   NA   NA   NA   NA   NA   High
Levels: Low Medium High

It uses:
? paste (sep=.) to create the combinations ie 0.0, 10.50, etc.
? do.call to invoke the paste on the columns of the data.frames
? factor specifying existing levels (only those defined by cas data.frame) 
anbd labels

Eric

At 10:12 30/11/2004, Yves Brostaux wrote:
Dear list,
Here's a little problem I already solved with my own coding style, but I 
feel there is a more efficient and cleaner way to write it, but had no 
success finding the clever solution.

I want to produce a factor from a subset of the combination of two 
vectors. I have the vectors a et b in a data-frame :

 df - expand.grid(a=c(0, 5, 10, 25, 50), b=c(0, 25, 50, 100, 200))
 fac.df
   a   b
1   0   0
2   5   0
3  10   0
4  25   0
5  50   0
6   0  25
7   5  25
snip
and want to create a factor which levels correspond to particular 
combinations of a and b (let's say Low for a=0  b=0, Medium for a=10  
b=50, High for a=50  b=200, others levels set to NA), reading them from a 
data-frame which describes the desired subset and corresponding levels.

Here's my own solution (inputs are data-frames df and cas, output is the 
sub factor):

 cas - as.data.frame(matrix(c(0, 10,50, 0, 50, 200), 3, 
2,dimnames=list(c(Low, Medium, High), c(a, b
 cas
   a   b
Low 0   0
Medium 10  50
High   50 200

 sub - character(length(df$a))
 for (i in 1:length(df$a)) {
+   temp - rownames(cas)[cas$a==df$a[i]  cas$b==df$b[i]]
+   sub[i] - ifelse(length(temp)0, temp, NA)
+ }
 sub - ordered(sub, levels=c(Low, Medium, High))
 sub
[1] LowNA   NA   NA   NA   NA   NA   NA   NA
NA   NA   NA   Medium NA   NA   NA   NA [18] 
NA   NA   NA   NA   NA   NA   NA   High Levels: Low  Medium 
 High

I was looking for a vectorized solution (apply style) binding data-frames 
df and cas, but didn't succeed avoiding the for loop. Could anybody bring 
me the ligths over the darkness of my ignorance ? Thank you very much in 
advance.

--
Ir. Yves BROSTAUX
Unité de Statistique et Informatique
Faculté universitaire des Sciences agronomiques de Gembloux (FUSAGx)
8, avenue de la Faculté
B-5030 Gembloux
Belgique
Tél: +32 81 62 24 69
Email: [EMAIL PROTECTED]
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Eric Lecoutre
UCL /  Institut de Statistique
Voie du Roman Pays, 20
1348 Louvain-la-Neuve
Belgium
tel: (+32)(0)10473050
[EMAIL PROTECTED]
http://www.stat.ucl.ac.be/ISpersonnel/lecoutre
If the statistics are boring, then you've got the wrong numbers. -Edward 
Tufte

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Creating a factor from a combination of vectors

2004-11-30 Thread Gabor Grothendieck
Yves Brostaux brostaux.y at fsagx.ac.be writes:

: 
: Dear list,
: 
: Here's a little problem I already solved with my own coding style, but I 
: feel there is a more efficient and cleaner way to write it, but had no 
: success finding the clever solution.
: 
: I want to produce a factor from a subset of the combination of two 
: vectors. I have the vectors a et b in a data-frame :
: 
:   df - expand.grid(a=c(0, 5, 10, 25, 50), b=c(0, 25, 50, 100, 200))
:   fac.df
: a   b
: 1   0   0
: 2   5   0
: 3  10   0
: 4  25   0
: 5  50   0
: 6   0  25
: 7   5  25
: snip
: 
: and want to create a factor which levels correspond to particular 
: combinations of a and b (let's say Low for a=0  b=0, Medium for a=10  
: b=50, High for a=50  b=200, others levels set to NA), reading them from 
: a data-frame which describes the desired subset and corresponding levels.
: 
: Here's my own solution (inputs are data-frames df and cas, output is the 
: sub factor):
: 
:   cas - as.data.frame(matrix(c(0, 10,50, 0, 50, 200), 3, 
: 2,dimnames=list(c(Low, Medium, High), c(a, b
:   cas
: a   b
: Low 0   0
: Medium 10  50
: High   50 200
: 
:   sub - character(length(df$a))
:   for (i in 1:length(df$a)) {
: +   temp - rownames(cas)[cas$a==df$a[i]  cas$b==df$b[i]]
: +   sub[i] - ifelse(length(temp)0, temp, NA)
: + }
:   sub - ordered(sub, levels=c(Low, Medium, High))
:   sub
:  [1] LowNA   NA   NA   NA   NA   NA   NA   NA   
: NA   NA   NA   Medium NA   NA   NA   NA 
: [18] NA   NA   NA   NA   NA   NA   NA   High 
: Levels: Low  Medium  High
: 
: I was looking for a vectorized solution (apply style) binding 
: data-frames df and cas, but didn't succeed avoiding the for loop. Could 
: anybody bring me the ligths over the darkness of my ignorance ? Thank 
: you very much in advance.
: 


Use interaction() and factor() like this:

factor( interaction(df), lev = c(0.0, 10.50, 50.200),
  lab = c(Low, Medium, High), ordered = TRUE)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] A basic question

2004-11-30 Thread Kenneth
Hi R users:
I want to know any experience compiling R in other LINUX distributions
besides FEDORA (Red Hat) or Mandrake, for example in BSD, Debian,
Gentoo, Slackware, vector LINUX, Knoppix, Yopper or CERN linux?
Hope this is not a basic question
Thank you for your help.
Kenneth
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] 2k-factorial design with 10 parameters

2004-11-30 Thread Sven
Hi,
I'd like to apply a 2^k factorial design with k=10 parameters. Obviously 
this results in a quite long term for the model equation due to the high 
number of combinations of parameters.

How can I specify the equation for the linear model (lm) without writing 
all combinations explicitly down by hand? Does a R command exist for 
this problematic?

Thanks for your help in advance,
Sven
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] (sem assunto)

2004-11-30 Thread cynthia
  

-

gora!
[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Building latest version of package

2004-11-30 Thread Prof Brian Ripley
On Mon, 29 Nov 2004, michael watson (IAH-C) wrote:
Hi
I have a package which was built using R 1.9.1 and everything worked
fine.  I recently upgraded to R 2.0.1 and tried to re-install my package
- and I got:
Error in library(mypackage) : 'mypackage' is not a valid package --
installed  2.0.0?
I don't think you re-installed it, rather unzipped the zip file.
So I tried rebuilding it using my new version of R:
R CMD BUILD --binary mypackage
hhc: not found
cp: cannot stat `mypackage.chm': No such file or directory
make[1]: *** [chm-mypackage] Error 1
make: *** [pkg-mypackage] Error 2
*** Installation of mypackage failed ***
Removing 'f:/tmp/Rbuild.2972/mypackage'
ERROR
* installation failed
I didn't have these problems before.  What is hhc and why can't R find
it?
README.packages says what it is, and R is not looking for it, but make is.
Probably because you didn't check the checklist in README.packages.  This 
is not a new requirement.

In general, will I have to re-build my package everytime a new version
of R is released?
No.  But we are talking about installing, not building, here.  Please look 
in `Writing R Extensions' to see the difference.

--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] plotting data in non-orthogonal coords.

2004-11-30 Thread Petr Pikal


On 30 Nov 2004 at 11:06, Andreas Franke wrote:

snip
 
 Hi !
 Thanks for replying to my post and sorry for not being specific
 enough. Maybe I am the one who didnt get the point , but as far as I
 understand R plots filled.contour(x,y,z,...) in the following way:
 
 x,y define a grid in cartesian coords, i.e. the angle between x and y
 is 90. So if I have data on such a grid I am fine. My data is on an
 equally spaced grid in a coordsystem where x and y are at an angle of
 60. If you transform into cartesiancoords this isnt an equally spaced
 grid anymore.  You could interpret it as an equally spaced grid on
 which there is only data given on every second grid point.
 
 It would be nice if one could just plot data given as F(x,y) where you
 supply x and y for every data point seperatly so that you dont need
 any specific grid.

Maybe interp() in akima package can help you, but as I said it 
strongly depends on what you really want to achieve.

Cheers
Petr

 
 I hope that someone can help.
 Thanks in advance. Andreas

Petr Pikal
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] 2k-factorial design with 10 parameters

2004-11-30 Thread Dimitris Rizopoulos
Hi Sven,
just use:
lm(y~(x1+x2+x3+...+x10)^10)
e.g.,
y - rnorm(5000)
x1 - factor(sample(0:1, 5000, TRUE))
x2 - factor(sample(0:1, 5000, TRUE))
x3 - factor(sample(0:1, 5000, TRUE))
x4 - factor(sample(0:1, 5000, TRUE))
lm1 - lm(y~(x1+x2+x3+x4)^4)
summary(lm1)
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/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
- Original Message - 
From: Sven [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, November 30, 2004 12:59 PM
Subject: [R] 2k-factorial design with 10 parameters


Hi,
I'd like to apply a 2^k factorial design with k=10 parameters. 
Obviously this results in a quite long term for the model equation 
due to the high number of combinations of parameters.

How can I specify the equation for the linear model (lm) without 
writing all combinations explicitly down by hand? Does a R command 
exist for this problematic?

Thanks for your help in advance,
Sven
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] 2k-factorial design with 10 parameters

2004-11-30 Thread Prof Brian Ripley
On Tue, 30 Nov 2004, Sven wrote:
I'd like to apply a 2^k factorial design with k=10 parameters. Obviously this 
results in a quite long term for the model equation due to the high number of 
combinations of parameters.

How can I specify the equation for the linear model (lm) without writing all 
combinations explicitly down by hand? Does a R command exist for this 
problematic?
I assume you mean k=10 factors (there are a lot more parameters).
aov(y ~ .^10, data=mydata)
will do what you are probably asking, if you have a data frame with 
response y and the ten factors.  I'm not sure how you could analyse the 
1000 odd lines of output, so reduce 10 to something sensible (like 2 or 3)

--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Newsletter - Live-Jackpot und taegliches Glueckshoroskop auf www.casinos.ch

2004-11-30 Thread www.casinos.ch
Live-Jackpot und tägliches Glückshoroskop auf www.casinos.ch 

Seit dieser Woche stellt die Nr. 1 Casino-Plattform der Schweiz seinen 
Besuchern zwei weitere, exklusive Dienstleistungen zur Verfügung.


DIE LIVE-JACKPOT-ANBINDUNG
Nichts ist ärgerlicher für Kunden, als veraltete oder verspätete Informationen. 
Darum bietet casinos.ch den wohl aktuellsten Schweizer Jackpot-Service im 
Internet!

Aufgrund der guten Zusammenarbeit mit unseren Partnern und modernster IT sind 
wir in der Lage die Jackpot-Stände von mehreren Schweizer Casinos Live 
anzubieten. Zur Zeit sind der Swiss Jackpot sowie die Jackpots der Casinos von 
Zürichsee, St.Gallen, Schaffhausen und Bad Ragaz angeschlossen. In Kürze werden 
weitere Jackpots von Schweizer Casinos angeschlossen werden.

Nirgendwo sonst finden Sie eine aktuellere Übersicht über die Schweizer 
Casino-Jackpots.

Link zur Jackpot-Uebersicht
http://www.megajackpot.ch



DAS TAEGLICHE GLUECKSHOROSKOP
Es beantwortet jeden Tag die Frage, ob die Sterne für das Glücksspiel günstig 
stehen. Welche Symbole sind heute der Jungfrau hold, oder auf was sollen 
Zwillinge beim Kartenspiel besonders achten? Mit einem Klick wissen Sie es. Für 
besondere Tage können Sie sich bei unserem Partner www.astro-service.ch auch 
ein ganz persönliches Glückshoroskop erstellen lassen.


Link zum täglichen Glückshoroskop
http://www.glueckshoroskop.ch 


Nebst diesen beiden exklusiven Neuerungen finden Casino-Interessierte, 
-Betreiber, -Angestellte, Newcomers u.a. auch weiterhin alles Wissenswerte über 
Casinos und Glücksspiele 2-sprachig auf www.casinos.ch
- Tägliche News (bereits über 1000 News im 2004)
- Über 2400 Casino-Adressen und Detail-Informationen
- Fotogalerien und Interviews
- Turnier und Eventkalender
- Spielerklärungen zu allen Casino-Spielen
- Gesetze, Facts  Figures
und vieles mehr
 

Good Luck wünscht Ihr Newsletter Team Casinos.ch




Wir bitten um Entschuldigung, falls Sie diese Informationen unerwuenscht 
erhalten.. Sie erhalten diesen Casinos-Informations-Newsletter augrund Ihres 
Eintrages auf www.casinos.ch, www.help.ch oder einer unserer 
Partner-Plattformen.

Sollten Sie KEINEN NEWSLETTER mehr wünschen, so klicken Sie bitte auf folgenden 
Link. 
http://www.casinos.ch/unsubscribe.cfm 

(c) 1996-2004 www.casinos.ch und www.help.ch

[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] How to know if a bug was recognised

2004-11-30 Thread Heinz Tuechler
Hello!

A problem with special characters seemed to me to be a bug. I sent a mail
to [EMAIL PROTECTED] concerning the problem (see below).
How can I find out, if this is considered as a bug or an error of myself?
Which part of FAQs or documentation did I miss to find the answer?

thanks in advance

Heinz Tüchler

 copy of abovementioned mail --
to: [EMAIL PROTECTED]
subject: problem with special characters (ä,ö,ü)
Dear Developers!

Using special characters I found a strange behaviour in R 2.0.1 and equally
in 
R : Copyright 2004, The R Foundation for Statistical Computing
Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0

Operating System: Windows 98SE

example:
factor1-as.factor(c(weiblich,männlich,österreichisch,frühreif,Gruß
))
factor1
 factor1
[1] weiblich   m\344nnlich\366sterreichisch  fr\374hreif
   
[5] Gru\337   
Levels: frühreif Gruß männlich österreichisch weiblich

with best wishes

Heinz Tüchler

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] 2k-factorial design with 10 parameters

2004-11-30 Thread Petr Pikal


On 30 Nov 2004 at 12:59, Sven wrote:

 Hi,
 
 I'd like to apply a 2^k factorial design with k=10 parameters.
 Obviously this results in a quite long term for the model equation due
 to the high number of combinations of parameters.
 
 How can I specify the equation for the linear model (lm) without
 writing all combinations explicitly down by hand? Does a R command
 exist for this problematic?

Hi Sven

from
?lm

The specification 'first*second'
 indicates the _cross_ of 'first' and 'second'.  This is the same
 as 'first + second + first:second'

and from

?formula

## Create a formula for a model with a large number of variables:
 xnam - paste(x, 1:25, sep=)
 (fmla - as.formula(paste(y ~ , paste(xnam, collapse= +

If you change 1:25 to 1:10 and collapse to * and use fmla in your 
model you will get what you want (I suppose). But I woder if it 
has any sense.

Cheers
Petr

 
 Thanks for your help in advance,
 Sven
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to know if a bug was recognised

2004-11-30 Thread Prof Brian Ripley
You have already been sent an answer.  It is a bug in your copy of 
Windows, and it will be worked around in the current version of R-patched. 
From the CHANGES file:

  R 2.0.1 patched
  ===
  We work around reported bugs in Windows XP as to which characters are
  printable by attempting to print all non-control characters when using
  print().
Note: no one else has reported a problem on 98SE, despite this having been 
the behaviour of R for three months, and it seemed only XP SP2 was 
affected.  Indeed, no one reported the problem for 2.0.0 at all, including 
all the alpha and beta test versions (except for Chinese where the 
characters are invalid and so the behaviour was correct), and so the 
workaround did not make 2.0.1.

BTW, your expectation that an email you sent at the weekend will be 
answered by Tuesday is completely unreasonable.  R is a volunteer project, 
and the developers do have other commitments (and occasionally make 
attempts to have a life).

[You could have read the archives of the R mailing lists to find that this 
was a known issue that had already been addressed.]

On Tue, 30 Nov 2004, Heinz Tuechler wrote:
Hello!
A problem with special characters seemed to me to be a bug. I sent a mail
to [EMAIL PROTECTED] concerning the problem (see below).
How can I find out, if this is considered as a bug or an error of myself?
Which part of FAQs or documentation did I miss to find the answer?
thanks in advance
Heinz Tüchler
 copy of abovementioned mail --
to: [EMAIL PROTECTED]
subject: problem with special characters (ä,ö,ü)
Dear Developers!
Using special characters I found a strange behaviour in R 2.0.1 and equally
in
R : Copyright 2004, The R Foundation for Statistical Computing
Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0
Operating System: Windows 98SE
example:
factor1-as.factor(c(weiblich,männlich,österreichisch,frühreif,Gruß
))
factor1
factor1
[1] weiblich   m\344nnlich\366sterreichisch  fr\374hreif
[5] Gru\337
Levels: frühreif Gruß männlich österreichisch weiblich
with best wishes
Heinz Tüchler
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--
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__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

RE: [R] How to know if a bug was recognised

2004-11-30 Thread Henrik Bengtsson
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Heinz Tuechler
 Sent: Tuesday, November 30, 2004 1:25 PM
 To: [EMAIL PROTECTED]
 Subject: [R] How to know if a bug was recognised
 
 
 Hello!
 
 A problem with special characters seemed to me to be a bug. I 
 sent a mail to [EMAIL PROTECTED] concerning the problem 
 (see below). How can I find out, if this is considered as a 
 bug or an error of myself? Which part of FAQs or 
 documentation did I miss to find the answer?

This will not answer your question on what is a bug or not, but if you don't
know, the R team has kindly made a fix for this problem. What I remember
from an earlier thread, this was not really due to R, but to Windows. For
the latest R v2.0.1 patch it now seems to work as before/expected:

R : Copyright 2004, The R Foundation for Statistical Computing
Version 2.0.1 Patched (2004-11-27), ISBN 3-900051-07-0

 å
[1] å
 ä
[1] ä
 ö
[1] ö

Cheers

Henrik Bengtsson


 thanks in advance
 
 Heinz Tüchler
 
  copy of abovementioned mail --
 to: [EMAIL PROTECTED]
 subject: problem with special characters (ä,ö,ü)
 Dear Developers!
 
 Using special characters I found a strange behaviour in R 
 2.0.1 and equally in 
 R : Copyright 2004, The R Foundation for Statistical 
 Computing Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0
 
 Operating System: Windows 98SE
 
 example: 
 factor1-as.factor(c(weiblich,männlich,österreichisch,f
 rühreif,Gruß
 ))
 factor1
  factor1
 [1] weiblich   m\344nnlich\366sterreichisch  
 fr\374hreif

 [5] Gru\337   
 Levels: frühreif Gruß männlich österreichisch weiblich
 
 with best wishes
 
 Heinz Tüchler
 
 __
 [EMAIL PROTECTED] mailing list 
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Opening connection to FTP site

2004-11-30 Thread michael watson \(IAH-C\)
Hi

Is it possible to open a connection to an FTP site such that I can read
the directory listing?  Eg:

URL - url(ftp://ftp.ensembl.org;, open=r)
Error in url(ftp://ftp.ensembl.org;, open=r) :
unable to open connection

URL - url(ftp://ftp.ensembl.org;)
open(URL)
Error in open.connection(URL) : unable to open connection

I think perhaps it is because there isn't actually a file there to
connect to, eg this works fine:

URL - url(ftp://ftp.ensembl.org/pub/README;, open=r)

Thanks in advance

Mick

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Opening connection to FTP site

2004-11-30 Thread Prof Brian Ripley
On Tue, 30 Nov 2004, michael watson (IAH-C) wrote:
Hi
Is it possible to open a connection to an FTP site such that I can read
the directory listing?  Eg:
URL - url(ftp://ftp.ensembl.org;, open=r)
Error in url(ftp://ftp.ensembl.org;, open=r) :
unable to open connection
URL - url(ftp://ftp.ensembl.org;)
open(URL)
Error in open.connection(URL) : unable to open connection
I think perhaps it is because there isn't actually a file there to
connect to, eg this works fine:
URL - url(ftp://ftp.ensembl.org/pub/README;, open=r)
It is not possible using url().  Try, e.g.
tmp - tempfile()
download.file(ftp://ftp.ensembl.org;, tmp, method=lynx) # or wget
readLines(tmp)
--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] lme in R-2.0.0: Problem with lmeControl

2004-11-30 Thread Douglas Bates
Pavel Khomski wrote:
Hello!
One note/question hier about specification of control-parameters in the 
lme(...,control=list(...)) function call:

i tried to specify tne number of iteration needed via 
lme(,control=list(maxIter=..., niterEM=...,msVerbose=TRUE))
but every time i change the defualt values maxIter (e.g. maxIter=1, 
niterEM=0)  on ones specified by me, the call returns all the iterations 
needed until it's converged.
and this is exactly the problem i will to get round.  (e.g. in 
example on p.81 of Pinheiro/Bates,2000: 
fm1Rail.lme-lme(...,control=list(maxIter=1,...)))
so i have tried with option msMaxIter=... and this works.

The other problem is, that i even can not see (in R !!!) the output from 
iterations, despite the msVerbose=TRUE  specification and setting 
options(verbose=TRUE) (The S-plus can do it but also ignoring the 
maxIter=... specification)

Thank you for your hint
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
One difference between the S-PLUS and the R versions of lme is the 
optimizer that is used.  In S-PLUS the ms() function is used to optimize 
the log-likelihood.  In R the most reasonable choices are optim or nlm.

The version of lme in the current nlme package uses optim, which has a 
more sophisticated verbose option than just an on/off switch.  It has 
several levels of verbosity.  If we say that msVerbose corresponds to 
the lowest non-silent level then it only prints out intermediate results 
every five iterations and that example converges before 5 iterations.

 library(nlme)
 fm1Rail.lme - lme(travel ~ 1, Rail, ~ 1|Rail,
+control=list(niterEM=0,msVerbose=TRUE))
initial  value 67.893737
final  value 61.048859
converged

If we were to set msVerbose=TRUE to give the highest level of verbosity 
you would be innundated with output.

The version of lme in the current lme4 package allows the optimizer to 
be chosen.  (The lme4 package cannot be loaded in the same session with 
the nlme package.  You must quit R and restart to be able to load the 
lme4 package).

 library(lme4)
Loading required package: Matrix
Loading required package: latticeExtra
 fm1Rail.lme - lme(travel ~ 1, Rail, ~ 1 | Rail,
+   control = list(msVerbose = TRUE, optimizer = nlm, niterEM = 0))
iteration = 0
Step:
[1] 0
Parameter:
[1] 0.1177830
Function Value
[1] 143.9911
Gradient:
[1] 7.849722
iteration = 1
Step:
[1] -7.849722
Parameter:
[1] -7.731939
Function Value
[1] 136.7956
Gradient:
[1] -4.880857
iteration = 2
Step:
[1] 3.009554
Parameter:
[1] -4.722385
Function Value
[1] 123.8982
Gradient:
[1] -2.879458
iteration = 3
Step:
[1] 0.9505343
Parameter:
[1] -3.771850
Function Value
[1] 122.207
Gradient:
[1] -0.4481287
iteration = 4
Step:
[1] 0.1751970
Parameter:
[1] -3.596653
Function Value
[1] 122.1802
Gradient:
[1] 0.1486718
iteration = 5
Step:
[1] -0.04364416
Parameter:
[1] -3.640298
Function Value
[1] 122.177
Gradient:
[1] -0.003887335
iteration = 6
Step:
[1] 0.00111209
Parameter:
[1] -3.639185
Function Value
[1] 122.177
Gradient:
[1] -3.100244e-05
iteration = 7
Parameter:
[1] -3.639177
Function Value
[1] 122.177
Gradient:
[1] 6.643475e-09
Relative gradient close to zero.
Current iterate is probably solution.
Those results do not match the output in our book because the version in 
 lme4 uses the deviance as the objective function.

(One of the difficulties of writing a book about a particular piece of 
software is that the software is likely to change much more rapidly than 
 the book.)

I show this with some trepidation because I am in the process of 
changing the optimization within lme yet again.  The development version 
ignores optimizer = 'nlm' because it phrases the problem as a 
constrained optimization problem and uses optim unconditionally.  The 
full level of verbosity of optim, which I occasionally use for 
development purposes, is very verbose

 fm1Rail.lme - lme1(travel ~ 1, Rail, ~ 1 | Rail,
+ control = list(msVerbose = TRUE, optimizer = nlm, niterEM = 0))
N = 1, M = 5 machine precision = 2.22045e-16
L = 1e-10
X0 = 0.89
U = inf
At X0, 0 variables are exactly at the bounds
At iterate 0  f=   143.99  |proj g|=   8.8309
Iteration 0
 CAUCHY entered---
There are 0  breakpoints
GCP found in this segment
Piece  1 f1, f2 at start point -7.7985e+01  7.7985e+01
Distance to the stationary point =   1.e+00
Cauchy X =  9.71983
 exit CAUCHY--
1  variables are free at GCP on iteration 1
LINE SEARCH 0 times; norm of step = 1
X = 1.9
G = -4.46694
Iteration 1
 CAUCHY entered---
There are 0  breakpoints
GCP found in this segment
Piece  1 f1, f2 at start point -1.9954e+01  8.7077e+01
Distance to the stationary point =   2.2915e-01
Cauchy X =  2.91248
 exit 

[R] Info

2004-11-30 Thread Catherine Dempsey
I am having difficulty obtaining the scores from my principal component
analysis.  I have used this method before and have had no problems.  The
data set that I am using this time is similar to what I have used in the
past.  What do I need to do to my dataset in order for me to obtain these
scores?

R screen says the following message

Error in factanal(covmat = pasa.cov, factors = 4) : 
Unable to optimize from these starting value(s)

many thanks

Catherine


KSS Ltd
Seventh Floor  St James's Buildings  79 Oxford Street  Manchester  M1 6SS  
England
Company Registration Number 2800886
Tel: +44 (0) 161 228 0040   Fax: +44 (0) 161 236 6305
mailto:[EMAIL PROTECTED]http://www.kssg.com


The information in this Internet email is confidential and m...{{dropped}}

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] A basic question

2004-11-30 Thread Douglas Bates
Kenneth wrote:
I want to know any experience compiling R in other LINUX distributions
besides FEDORA (Red Hat) or Mandrake, for example in BSD, Debian,
Gentoo, Slackware, vector LINUX, Knoppix, Yopper or CERN linux?
Hope this is not a basic question
Thank you for your help.
There is considerable experience compiling R under Debian Linux.  Many 
of the developers use Debian and if you check the sources you will find 
that there is a debian directory in the official source distribution. 
The daily package checking is done on a system running Debian and there 
are dozens of R packages in the Debian distribution.  See 
http://packages.qa.debian.org/r/r-base-core for a history of the 
uploads.  The link to the buildd logs shows compilation of R under 
Debian on many different architectures.

Because Knoppix is derived from Debian and uses the Debian packaging 
system the compilation of R under Knoppix is essentially the same as 
under Debian.  The Quantian distribution comes with R installed.

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] A basic question

2004-11-30 Thread Peter Dalgaard
Kenneth [EMAIL PROTECTED] writes:

 Hi R users:
 
 I want to know any experience compiling R in other LINUX distributions
 besides FEDORA (Red Hat) or Mandrake, for example in BSD, Debian,
 Gentoo, Slackware, vector LINUX, Knoppix, Yopper or CERN linux?
 
 Hope this is not a basic question

BSD is not Linux... 

I'm fairly sure we have people checking BSD (perhaps even on the core
team. Ross?), and also SuSE and Gentoo. We definitely have core
members using Debian, and Knoppix is just a Debian variant (see also
Quantian). CERN Linux is a RedHat variant. Don't know about Yoper,
Slackware, and vector Linux (a Slackware derivative), but building
frome source is not generally a problem on Linux.


-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Info

2004-11-30 Thread Andy Bunn
It looks like factanal is unable to optimize from these starting values
(kinda like the error message says). So, factanal.fit.mle isn't converging
and you have problems with your analysis. Try putting control = list(trace =
T) in your code to see what happenens. E.g.,

R 
R   v1 - c(1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,4,5,6)
R   v2 - c(1,2,1,1,1,1,2,1,2,1,3,4,3,3,3,4,6,5)
R   v3 - c(3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,5,4,6)
R   v4 - c(3,3,4,3,3,1,1,2,1,1,1,1,2,1,1,5,6,4)
R   v5 - c(1,1,1,1,1,3,3,3,3,3,1,1,1,1,1,6,4,5)
R   v6 - c(1,1,1,2,1,3,3,3,4,3,1,1,1,2,1,6,5,4)
R   m1 - cbind(v1,v2,v3,v4,v5,v6)
R   factanal(m1, factors=3, control = list(trace = T))
start 1 value: 0.4755156 uniqs: 0.0050 0.1009 0.0050 0.2241 0.0843 0.0050

Call:
factanal(x = m1, factors = 3, control = list(trace = T))

Uniquenesses:
   v1v2v3v4v5v6
0.005 0.101 0.005 0.224 0.084 0.005

Loadings:
   Factor1 Factor2 Factor3
v1 0.944   0.182   0.267
v2 0.905   0.235   0.159
v3 0.236   0.210   0.946
v4 0.180   0.242   0.828
v5 0.242   0.881   0.286
v6 0.193   0.959   0.196

   Factor1 Factor2 Factor3
SS loadings  1.893   1.886   1.797
Proportion Var   0.316   0.314   0.300
Cumulative Var   0.316   0.630   0.929

The degrees of freedom for the model is 0 and the fit was 0.4755
R 

If you think the model should be OK and there isn't an error somewhere else
then you'll want to fiddle with the control options. From the help for
fractanal:

 control: A list of control values,

  nstart The number of starting values to be tried if 'start =
   NULL'. Default 1.

  trace logical. Output tracing information? Default 'FALSE'.

  lower The lower bound for uniquenesses during optimization.
   Should be  0. Default 0.005.

  opt A list of control values to be passed to 'optim''s
   'control' argument.

  rotate a list of additional arguments for the rotation
   function.

 ...: Components of 'control' can also be supplied as named
  arguments to 'factanal'.


HTH, Andy


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Catherine Dempsey
 Sent: Tuesday, November 30, 2004 7:31 AM
 To: '[EMAIL PROTECTED]'
 Subject: [R] Info


 I am having difficulty obtaining the scores from my principal component
 analysis.  I have used this method before and have had no problems.  The
 data set that I am using this time is similar to what I have used in the
 past.  What do I need to do to my dataset in order for me to obtain these
 scores?

 R screen says the following message

 Error in factanal(covmat = pasa.cov, factors = 4) :
 Unable to optimize from these starting value(s)

 many thanks

 Catherine


 KSS Ltd
 Seventh Floor  St James's Buildings  79 Oxford Street  Manchester
  M1 6SS  England
 Company Registration Number 2800886
 Tel: +44 (0) 161 228 0040 Fax: +44 (0) 161 236 6305
 mailto:[EMAIL PROTECTED]  http://www.kssg.com


 The information in this Internet email is confidential and m...{{dropped}}

 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] A basic question

2004-11-30 Thread Jari Oksanen
On Tue, 2004-11-30 at 13:58, Kenneth wrote:
 Hi R users:
 
 I want to know any experience compiling R in other LINUX distributions
 besides FEDORA (Red Hat) or Mandrake, for example in BSD, Debian,
 Gentoo, Slackware, vector LINUX, Knoppix, Yopper or CERN linux?
 
 Hope this is not a basic question
 
 Thank you for your help.
 
I assume that the following will typically work:
Get the source file, gunzip and untar, cd to the created directory and
type:

./configure
make
sudo make install

It is best to check the resulting configuration after ./configure and
get the software (compilers, libraries, packages, utilities) you need
for the missing functionality you want to have. It is also wise to run
'make check' after 'make' so that you see if you can trust your
compilation. This make check fails in some cases: at least standard
package 'foreign' failed 'make check' in ppc architecture both in Red
Hat/Fedora  based (Yellowdog) and Debian based (Ubuntu) Linuxes when I
tried last time. Otherwise the compilation seems to run smoothly (and
you may not need 'foreign').

BSD is not Linux, but R is officially supported at least for one version
of BSD with GNU tools: MacOS X.

cheers,jari oksanen
-- 
Jari Oksanen [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Testing for S4 objects

2004-11-30 Thread John Chambers
Let me suggest a different test, because slotNames was written to work
differently when given a string or a class definition.  With your
definition,

R x - classRepresentation
R isS4object(x)
[1] TRUE

which I assume is not what you wanted.  (Given a single string, 
slotNames() tries to look up the class definition of that name.)

How about the following?  The logic is that an S4 object must have an
actual class attribute of length 1 (that rules out basic data types,
where class(x) is a string but there is no actual attribute, and also
rules out some S3 objects).  Then if that's true, try to look up the
class definition.  If it is non-null, seems like an S4 object.

R isS4object - function(object)(length(attr(object, class))==1 
+ !is.null(getClass(class(object
R isS4object(x)
[1] FALSE
R isS4object(getClass(class(x)))
[1] TRUE

This definition seems to work, at least on the examples I could think
of right away.  Notice though, that some classes, such as ts, that
have been around for a long while are nevertheless legitimate S4
classes, so:

R t1 = ts(1:12)
R isS4object(t1)
[1] TRUE

(this applies to either version of isS4object).

There are a couple of details, more appropriate for the r-devel list. 
Seems  a good candidate for a function to add to R.


On Sat, 27 Nov 2004 17:48:30 -0500, John Fox [EMAIL PROTECTED] wrote:
 Dear Martin,
 
 As it turns out, the test that I proposed (i.e., testing for NULL slotNames)
 sometimes fails. For example:
 
  library(car)
  data(Prestige)
  sum - summary(lm(prestige ~ income + education, data=Prestige))
  slotNames(sum)
 character(0)
 
 The following, however, seems to work (at least as far as I've been able to
 ascertain):
 
 isS4object - function(object) length(slotNames(object)) != 0
 
 I hope that this is a more robust test.
 
 
 
 John
 
 
 John Fox
 Department of Sociology
 McMaster University
 Hamilton, Ontario
 Canada L8S 4M4
 905-525-9140x23604
 http://socserv.mcmaster.ca/jfox
 
 
  -Original Message-
  From: Martin Maechler [mailto:[EMAIL PROTECTED]
  Sent: Friday, November 26, 2004 3:18 AM
  To: John Fox
  Cc: [EMAIL PROTECTED]
  Subject: Re: [R] Testing for S4 objects
 
   JohnF == John Fox [EMAIL PROTECTED]
   on Thu, 25 Nov 2004 22:28:50 -0500 writes:
 
  JohnF Dear r-help list members, Is there a way to test
  JohnF whether an object is an S4 object? The best that I've
  JohnF been able to come up with is
 
  JohnFisS4object - function(object)
  !(is.null(slotNames(object)))
 
  you can drop one pair of (..) to give
 
isS4object - function(object) !is.null(slotNames(object))
 
 
  JohnF which assumes that an S4 object has at least one
  JohnF slot. I think this is safe, but perhaps I'm missing
  JohnF something.
 
  The question is a very good one -- that I have posed to
  R-core a while ago myself.
 
  Inside  utils:::str.default  {which doesn't show the many
  commments in the *source* of str.default()}, I have wanted a
  way that even works when the 'methods' package is not
  attached and use the more obscure
 
  #NOT yet:if(has.class - !is.null(cl - class(object)))
  if(has.class - !is.null(cl - attr(object, class)))#
  S3 or S4 class
S4 - !is.null(attr(cl, package))## 'kludge' FIXME!
##or length(methods::getSlots(cl))  0
 
  For the time being, I'd keep your function, but I don't think
  we'd guarantee that it will remain the appropriate test in
  all future.  But till then many things will have happened (if
  not all of them ;-).
 
  Martin Maechler, ETH Zurich
 
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] glmmPQL

2004-11-30 Thread Alex
Dear listmembers,

I've adjusted a mixed model with glmmPQL:

nulo-glmmPQL(POS~1,random=~1|GRUPO, family=binomial, data=new)

and I've reched the following results:

Linear mixed-effects model fit by maximum likelihood
 Data: new 
  AIC  BIClogLik
  53238.5 53260.74 -26616.25

Random effects:
 Formula: ~1 | GRUPO
(Intercept)  Residual
StdDev:   0.3402137 0.9952645

Variance function:
 Structure: fixed weights
 Formula: ~invwt 
Fixed effects: POS ~ 1 
Value  Std.ErrorDF  t-value p-value
(Intercept) 0.6214472 0.03723763 12025 16.68869   0

Standardized Within-Group Residuals:
   Min Q1Med Q3Max 
-1.7831032 -1.2642113  0.6508504  0.7058691  1.1945426 

Number of Observations: 12227
Number of Groups: 202 

Could someone clarify me? I don't understand why DF=12025 in the intercept 
t-test above, if the objective is to estimate only one mean for all groups 
(mean=0,6214472). I expected that this DF would equal 201, as I have 202 groups.

Thanks in advance, Alex



 




 
__
Acabe com aquelas janelinhas que pulam na sua tela.
AntiPop-up UOL - É grátis!
http://antipopup.uol.com.br/

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Attn Heinz Tuechler: Re: problem with special characters (ä,ö,ü)

2004-11-30 Thread Duncan Murdoch
[I tried to send this message privately, but the return address
bounced.]

I think this has been fixed in R-patched, but I doubt if the fix has
been tested in Win98.  Could you please download a copy from
http://cran.r-project.org/bin/windows/base/rpatched.html and confirm
that it has been fixed?

Duncan Murdoch

On Sat, 27 Nov 2004 23:31:23 +0100, Heinz Tuechler [EMAIL PROTECTED]
wrote :

Dear Developers!

Using special characters I found a strange behaviour in R 2.0.1 and equally
in 
R : Copyright 2004, The R Foundation for Statistical Computing
Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0

Operating System: Windows 98SE

example:
factor1-as.factor(c(weiblich,männlich,österreichisch,frühreif,Gruß
))
factor1
 factor1
[1] weiblich   m\344nnlich\366sterreichisch  fr\374hreif
   
[5] Gru\337   
Levels: frühreif Gruß männlich österreichisch weiblich

with best wishes

Heinz Tüchler

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Info

2004-11-30 Thread Prof Brian Ripley
Also, factanal() does not do `principal component analysis', and it may 
well be that the data are inappropriate for factor analysis if they are 
appropriate for PCA.

If PCA was really intended, prcomp() and princomp() are appropriate tools.
On Tue, 30 Nov 2004, Andy Bunn wrote:
It looks like factanal is unable to optimize from these starting values
(kinda like the error message says). So, factanal.fit.mle isn't converging
and you have problems with your analysis. Try putting control = list(trace =
T) in your code to see what happenens. E.g.,
R 
R   v1 - c(1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,4,5,6)
R   v2 - c(1,2,1,1,1,1,2,1,2,1,3,4,3,3,3,4,6,5)
R   v3 - c(3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,5,4,6)
R   v4 - c(3,3,4,3,3,1,1,2,1,1,1,1,2,1,1,5,6,4)
R   v5 - c(1,1,1,1,1,3,3,3,3,3,1,1,1,1,1,6,4,5)
R   v6 - c(1,1,1,2,1,3,3,3,4,3,1,1,1,2,1,6,5,4)
R   m1 - cbind(v1,v2,v3,v4,v5,v6)
R   factanal(m1, factors=3, control = list(trace = T))
start 1 value: 0.4755156 uniqs: 0.0050 0.1009 0.0050 0.2241 0.0843 0.0050
Call:
factanal(x = m1, factors = 3, control = list(trace = T))
Uniquenesses:
  v1v2v3v4v5v6
0.005 0.101 0.005 0.224 0.084 0.005
Loadings:
  Factor1 Factor2 Factor3
v1 0.944   0.182   0.267
v2 0.905   0.235   0.159
v3 0.236   0.210   0.946
v4 0.180   0.242   0.828
v5 0.242   0.881   0.286
v6 0.193   0.959   0.196
  Factor1 Factor2 Factor3
SS loadings  1.893   1.886   1.797
Proportion Var   0.316   0.314   0.300
Cumulative Var   0.316   0.630   0.929
The degrees of freedom for the model is 0 and the fit was 0.4755
R 
If you think the model should be OK and there isn't an error somewhere else
then you'll want to fiddle with the control options. From the help for
fractanal:
control: A list of control values,
 nstart The number of starting values to be tried if 'start =
  NULL'. Default 1.
 trace logical. Output tracing information? Default 'FALSE'.
 lower The lower bound for uniquenesses during optimization.
  Should be  0. Default 0.005.
 opt A list of control values to be passed to 'optim''s
  'control' argument.
 rotate a list of additional arguments for the rotation
  function.
...: Components of 'control' can also be supplied as named
 arguments to 'factanal'.
HTH, Andy

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Catherine Dempsey
Sent: Tuesday, November 30, 2004 7:31 AM
To: '[EMAIL PROTECTED]'
Subject: [R] Info
I am having difficulty obtaining the scores from my principal component
analysis.  I have used this method before and have had no problems.  The
data set that I am using this time is similar to what I have used in the
past.  What do I need to do to my dataset in order for me to obtain these
scores?
R screen says the following message
Error in factanal(covmat = pasa.cov, factors = 4) :
Unable to optimize from these starting value(s)
many thanks
Catherine
KSS Ltd
Seventh Floor  St James's Buildings  79 Oxford Street  Manchester
 M1 6SS  England
Company Registration Number 2800886
Tel: +44 (0) 161 228 0040   Fax: +44 (0) 161 236 6305
mailto:[EMAIL PROTECTED]http://www.kssg.com
The information in this Internet email is confidential and m...{{dropped}}
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] plotting data in non-orthogonal coords.

2004-11-30 Thread Deepayan Sarkar
On Tuesday 30 November 2004 04:06, Andreas Franke wrote:

[...]

 It would be nice if one could just plot data given as F(x,y) where
 you supply x and y for every data point seperatly so that you dont
 need any specific grid.

This is one solution, but it's not exactly what you want:


library(lattice)
u - row(matrix(0, nrow = 10, ncol = 15))
v - col(matrix(0, nrow = 10, ncol = 15))
x - u
y - .5 * u + .3 * v
z - log(u + v)
wireframe(z ~ x * y)


Deepayan

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] How to know if a bug was recognised

2004-11-30 Thread Duncan Murdoch
On Tue, 30 Nov 2004 13:24:43 +0100, Heinz Tuechler [EMAIL PROTECTED]
wrote :

Hello!

A problem with special characters seemed to me to be a bug. I sent a mail
to [EMAIL PROTECTED] concerning the problem (see below).
How can I find out, if this is considered as a bug or an error of myself?
Which part of FAQs or documentation did I miss to find the answer?

If you send a private email, please use a return address that works.
I got messages that [EMAIL PROTECTED] has been disabled when I tried to
respond there.

Duncan Murdoch

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Package for multivariate binary logistic regression?

2004-11-30 Thread Lynne Baker
I am trying to find out if someone has implemented a (McFadden-type) 
multivariate 
binary logistic regresssion package for R? From what I can tell, this is not 
available for R.
 
Thank you,
 
Lynne Baker

[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] (no subject)

2004-11-30 Thread jruiz99


Hello,

I am trying to estimate a choice model with varying choice set for each
individual.

I would like to fit different kinds of model (logit ,nested logit,
probit...).

So far I have found that package *mnp* allows me to estimate a probit model
with varying choice set.

But for estimation of a logit model, I have only found function *multinom*
of package *nnet* which does not seem to allow for varying choice set.

I could incorporate indicators of choice availability as explanotary
variables, but it does not seem a very good way to do it.
Instead, for a logit model, I have coded a likelihood computation of the
underlying model with varying choice set and I use optim function to get
the maximum.

I wondered if there were more user friendly functions available and/or
other choice model related package.

Thanks,
Julien

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] adding regression curve to xyplot

2004-11-30 Thread Carlisle Thacker
Dear R-listers,

It seems that predict() behaves differently within panel.xyplot.  Am I
doing something stupid?

Thanks,

Carlisle

First, without xyplot():
 lmtest - lm(t~s,data=subset(P100,whichLon100==1  whichLat100==1))
 lmtest

Call:
lm(formula = s ~ t, data = subset(P100, whichLon100 == 1  whichLat100 ==
   1))

Coefficients:
(Intercept)t
33.3307   0.1393
 range(P100$t)
[1]  4.050469 24.514543
 predict(lmtest,newdata=data.frame(t=range(P100$t)))
   12
33.89501 36.74620

As expected, predict gives two values.  But inside xyplot() predict gives
300 values:

 xyplot(t~s|factor(lonLabels[whichLon100])*factor(latLabels[whichLat100]),
+   data=P100,pch=.,
+   panel=function(x,y,...){panel.xyplot(x,y,...)
+   thislm - lm(x~y)
+  print(thislm)
+   newt - range(P100$t)
+  print(newt)
+   news -
as.vector(predict(thislm,newdata=data.frame(t=newt)))
+  print(news)
+   llines(news,newt,col=red)})

Call:
lm(formula = x ~ y)

Coefficients:
(Intercept)y
33.3307   0.1393

[1]  4.050469 24.514543
  [1] 34.16173 35.31284 34.95317 35.62314 34.64448 34.06225 34.19688 34.03391
  [9] 33.90860 35.28849 35.29911 34.61618 35.19837 35.28966 34.91978 35.32388
 [17] 35.39351 35.54533 35.58760 34.77039 35.07226 35.35643 35.40594 33.98609
 [25] 33.96461 33.91158 34.12389 34.33804 34.72235 34.63541 36.20420 36.13635
 [33] 34.60623 34.32401 35.59768 34.68576 34.64661 34.58804 34.74548 35.09062
 [41] 34.70290 34.22428 35.12743 34.90726 34.52325 34.90041 35.46984 34.79572
 [49] 35.47026 35.35481 34.70722 34.08883 33.97586 33.94797 33.96165 33.97715
 [57] 33.94886 33.99715 34.10887 34.72597 34.20534 34.45016 35.00769 34.56742
 [65] 34.76119 34.87190 34.60760 34.50113 34.56594 34.65954 34.57076 34.91072
 [73] 34.97322 34.99036 34.48229 34.58436 34.56767 34.94204 34.95929 34.89107
 [81] 34.98846 34.51328 34.74252 34.61337 34.62212 34.70953 34.74080 34.71630
 [89] 34.68599 35.58629 34.77031 34.49366 34.49873 34.48112 35.11327 34.62598
 [97] 34.50436 34.50705 34.70170 35.01278 35.12273 35.15541 35.06295 35.15366
[105] 35.15089 35.11312 35.09834 35.05271 34.84838 34.52225 34.34650 34.32637
[113] 34.42911 34.79282 35.06830 35.11559 35.25736 34.43281 34.45208 34.58407
[121] 35.28598 34.34246 34.32532 34.47483 34.79309 34.02772 34.01553 35.33372
[129] 34.19273 34.07622 34.52820 35.27539 35.37703 34.70560 34.77501 34.52084
[137] 34.68773 35.19217 35.69538 34.21886 34.17226 34.94784 34.03079 33.95669
[145] 33.92002 33.92972 33.96568 33.92996 33.94236 33.93887 33.92059 33.91746
[153] 33.98369 34.17190 34.05327 33.96500 34.16136 33.98172 34.02463 34.00802
[161] 34.05238 34.05088 34.16828 34.14888 33.94711 33.96567 34.12450 33.98988
[169] 33.98670 33.98489 34.05447 34.03689 34.17137 34.31777 34.05027 33.97821
[177] 33.99281 34.00209 34.07560 33.98840 33.98930 33.98548 33.99127 35.23652
[185] 35.17034 35.53546 35.53861 34.02384 34.03402 33.93877 33.93540 33.90636
[193] 33.92267 34.57678 34.49457 34.46038 34.64318 35.06561 35.06680 34.76466
[201] 34.00418 35.48020 35.12687 35.28180 35.07281 35.23499 35.14693 34.07914
[209] 33.99047 34.00648 34.10073 34.00784 33.99185 33.98191 34.03089 33.96755
[217] 34.17042 34.10803 34.12671 34.09942 34.25003 34.06542 34.07293 34.19048
[225] 34.06594 34.01929 34.00155 34.11555 33.89754 33.89527 33.89501 33.93433
[233] 33.89881 33.94577 33.96603 33.95199 34.00284 34.12974 33.98116 34.08882
[241] 34.00953 34.98977 34.72824 34.68920 35.15207 34.59716 34.64580 34.25087
[249] 34.96008 34.62607 35.32346 35.16993 34.46759 34.47157 34.46978 34.46092
[257] 34.46561 34.46489 34.49970 34.49599 34.55441 34.52048 34.58480 34.59267
[265] 34.50082 34.57311 34.60421 34.57043 34.53131 34.46365 34.41946 34.74566
[273] 34.64593 34.67921 34.65706 34.71625 34.61487 34.61687 34.58899 34.47081
[281] 34.58366 35.66823 35.61883 34.71477 34.72518 34.69732 34.66265 34.65186
[289] 34.81468 34.74725 34.77658 34.77191 34.81481 34.76427 34.70751 34.96763
[297] 35.11322 35.16852 34.94393 34.89605
Error in xy.coords(x, y) : x and y lengths differ

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Package for multivariate binary logistic regression?

2004-11-30 Thread Prof Brian Ripley
You'll have to help us a bit here.  `McFadden' comes up in connection with 
conditional logistic regression, which package survival supports.  Is that 
what you mean?

On Tue, 30 Nov 2004, Lynne Baker wrote:
I am trying to find out if someone has implemented a (McFadden-type) 
multivariate binary logistic regresssion package for R? From what I can 
tell, this is not available for R.
--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Attn Heinz Tuechler: Re: problem with sp ecial characters ( ä,ö,ü)

2004-11-30 Thread Heinz Tuechler
Thank you for the information. I did already download the 27-11-2004
version and I have the intention to try it within a day and report on the
result, if this is of interest.

My address ([EMAIL PROTECTED]) should work but I will check that too.

Heinz Tüchler

At 10:27 30.11.2004 -0500, you wrote:
[I tried to send this message privately, but the return address
bounced.]

I think this has been fixed in R-patched, but I doubt if the fix has
been tested in Win98.  Could you please download a copy from
http://cran.r-project.org/bin/windows/base/rpatched.html and confirm
that it has been fixed?

Duncan Murdoch

On Sat, 27 Nov 2004 23:31:23 +0100, Heinz Tuechler [EMAIL PROTECTED]
wrote :

Dear Developers!

Using special characters I found a strange behaviour in R 2.0.1 and equally
in 
R : Copyright 2004, The R Foundation for Statistical Computing
Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0

Operating System: Windows 98SE

example:
factor1-as.factor(c(weiblich,männlich,österreichisch,frühreif,Gruß
))
factor1
 factor1
[1] weiblich   m\344nnlich\366sterreichisch  fr\374hreif
   
[5] Gru\337   
Levels: frühreif Gruß männlich österreichisch weiblich

with best wishes

Heinz Tüchler

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] How to know if a bug was recognised

2004-11-30 Thread Heinz Tuechler
Dear Henrik Bengtsson!

Thank you for your kind answer. I am sorry that at the time of writing my
inital message the last version of R was 2004-11-15. As soon as possible I
will try the new version.

with many thanks

Heinz Tüchler


At 14:01 30.11.2004 +0100, you wrote:
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Heinz Tuechler
 Sent: Tuesday, November 30, 2004 1:25 PM
 To: [EMAIL PROTECTED]
 Subject: [R] How to know if a bug was recognised
 
 
 Hello!
 
 A problem with special characters seemed to me to be a bug. I 
 sent a mail to [EMAIL PROTECTED] concerning the problem 
 (see below). How can I find out, if this is considered as a 
 bug or an error of myself? Which part of FAQs or 
 documentation did I miss to find the answer?

This will not answer your question on what is a bug or not, but if you don't
know, the R team has kindly made a fix for this problem. What I remember
from an earlier thread, this was not really due to R, but to Windows. For
the latest R v2.0.1 patch it now seems to work as before/expected:

R : Copyright 2004, The R Foundation for Statistical Computing
Version 2.0.1 Patched (2004-11-27), ISBN 3-900051-07-0

 å
[1] å
 ä
[1] ä
 ö
[1] ö

Cheers

Henrik Bengtsson


 thanks in advance
 
 Heinz Tüchler
 
  copy of abovementioned mail --
 to: [EMAIL PROTECTED]
 subject: problem with special characters (ä,ö,ü)
 Dear Developers!
 
 Using special characters I found a strange behaviour in R 
 2.0.1 and equally in 
 R : Copyright 2004, The R Foundation for Statistical 
 Computing Version 2.0.1  (2004-11-15), ISBN 3-900051-07-0
 
 Operating System: Windows 98SE
 
 example: 
 factor1-as.factor(c(weiblich,männlich,österreichisch,f
 rühreif,Gruß
 ))
 factor1
  factor1
 [1] weiblich   m\344nnlich\366sterreichisch  
 fr\374hreif

 [5] Gru\337   
 Levels: frühreif Gruß männlich österreichisch weiblich
 
 with best wishes
 
 Heinz Tüchler
 
 __
 [EMAIL PROTECTED] mailing list 
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 
 



__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] combinations min problem

2004-11-30 Thread adrian mincu
Hello,
as I was not yet able to find a good solution to the following 
problem, I'd appreciate some help.

 

I am working on finding

the minimum of a list of  vectors, each comprised of x parameters

to include

all combinations of n parameters taken k at a time,

xk

thx. and rgds.

a/m

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] adding regression curve to xyplot

2004-11-30 Thread Prof Brian Ripley
On Tue, 30 Nov 2004, Carlisle Thacker wrote:
Dear R-listers,
It seems that predict() behaves differently within panel.xyplot.  Am I
doing something stupid?
You fitted the model lm(x ~ y) and supplied new values for t, not y.
Using panel.abline would be a bit easier: just call panel.abline(thislm) 
from your panel function.

Thanks,
Carlisle
First, without xyplot():
lmtest - lm(t~s,data=subset(P100,whichLon100==1  whichLat100==1))
lmtest
Call:
lm(formula = s ~ t, data = subset(P100, whichLon100 == 1  whichLat100 ==
  1))
Coefficients:
(Intercept)t
   33.3307   0.1393
range(P100$t)
[1]  4.050469 24.514543
predict(lmtest,newdata=data.frame(t=range(P100$t)))
  12
33.89501 36.74620
As expected, predict gives two values.  But inside xyplot() predict gives
300 values:
xyplot(t~s|factor(lonLabels[whichLon100])*factor(latLabels[whichLat100]),
+   data=P100,pch=.,
+   panel=function(x,y,...){panel.xyplot(x,y,...)
+   thislm - lm(x~y)
+  print(thislm)
+   newt - range(P100$t)
+  print(newt)
+   news -
as.vector(predict(thislm,newdata=data.frame(t=newt)))
+  print(news)
+   llines(news,newt,col=red)})
Call:
lm(formula = x ~ y)
Coefficients:
(Intercept)y
   33.3307   0.1393
[1]  4.050469 24.514543
 [1] 34.16173 35.31284 34.95317 35.62314 34.64448 34.06225 34.19688 34.03391
 [9] 33.90860 35.28849 35.29911 34.61618 35.19837 35.28966 34.91978 35.32388
[17] 35.39351 35.54533 35.58760 34.77039 35.07226 35.35643 35.40594 33.98609
[25] 33.96461 33.91158 34.12389 34.33804 34.72235 34.63541 36.20420 36.13635
[33] 34.60623 34.32401 35.59768 34.68576 34.64661 34.58804 34.74548 35.09062
[41] 34.70290 34.22428 35.12743 34.90726 34.52325 34.90041 35.46984 34.79572
[49] 35.47026 35.35481 34.70722 34.08883 33.97586 33.94797 33.96165 33.97715
[57] 33.94886 33.99715 34.10887 34.72597 34.20534 34.45016 35.00769 34.56742
[65] 34.76119 34.87190 34.60760 34.50113 34.56594 34.65954 34.57076 34.91072
[73] 34.97322 34.99036 34.48229 34.58436 34.56767 34.94204 34.95929 34.89107
[81] 34.98846 34.51328 34.74252 34.61337 34.62212 34.70953 34.74080 34.71630
[89] 34.68599 35.58629 34.77031 34.49366 34.49873 34.48112 35.11327 34.62598
[97] 34.50436 34.50705 34.70170 35.01278 35.12273 35.15541 35.06295 35.15366
[105] 35.15089 35.11312 35.09834 35.05271 34.84838 34.52225 34.34650 34.32637
[113] 34.42911 34.79282 35.06830 35.11559 35.25736 34.43281 34.45208 34.58407
[121] 35.28598 34.34246 34.32532 34.47483 34.79309 34.02772 34.01553 35.33372
[129] 34.19273 34.07622 34.52820 35.27539 35.37703 34.70560 34.77501 34.52084
[137] 34.68773 35.19217 35.69538 34.21886 34.17226 34.94784 34.03079 33.95669
[145] 33.92002 33.92972 33.96568 33.92996 33.94236 33.93887 33.92059 33.91746
[153] 33.98369 34.17190 34.05327 33.96500 34.16136 33.98172 34.02463 34.00802
[161] 34.05238 34.05088 34.16828 34.14888 33.94711 33.96567 34.12450 33.98988
[169] 33.98670 33.98489 34.05447 34.03689 34.17137 34.31777 34.05027 33.97821
[177] 33.99281 34.00209 34.07560 33.98840 33.98930 33.98548 33.99127 35.23652
[185] 35.17034 35.53546 35.53861 34.02384 34.03402 33.93877 33.93540 33.90636
[193] 33.92267 34.57678 34.49457 34.46038 34.64318 35.06561 35.06680 34.76466
[201] 34.00418 35.48020 35.12687 35.28180 35.07281 35.23499 35.14693 34.07914
[209] 33.99047 34.00648 34.10073 34.00784 33.99185 33.98191 34.03089 33.96755
[217] 34.17042 34.10803 34.12671 34.09942 34.25003 34.06542 34.07293 34.19048
[225] 34.06594 34.01929 34.00155 34.11555 33.89754 33.89527 33.89501 33.93433
[233] 33.89881 33.94577 33.96603 33.95199 34.00284 34.12974 33.98116 34.08882
[241] 34.00953 34.98977 34.72824 34.68920 35.15207 34.59716 34.64580 34.25087
[249] 34.96008 34.62607 35.32346 35.16993 34.46759 34.47157 34.46978 34.46092
[257] 34.46561 34.46489 34.49970 34.49599 34.55441 34.52048 34.58480 34.59267
[265] 34.50082 34.57311 34.60421 34.57043 34.53131 34.46365 34.41946 34.74566
[273] 34.64593 34.67921 34.65706 34.71625 34.61487 34.61687 34.58899 34.47081
[281] 34.58366 35.66823 35.61883 34.71477 34.72518 34.69732 34.66265 34.65186
[289] 34.81468 34.74725 34.77658 34.77191 34.81481 34.76427 34.70751 34.96763
[297] 35.11322 35.16852 34.94393 34.89605
Error in xy.coords(x, y) : x and y lengths differ
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--
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
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help

[R] Using mimR

2004-11-30 Thread Andreas Cordes
Hi,
I am trying to use the mimR Package. According to its help pages it 
needs the RDCOMClient package to run.
When I try to evaluate a model I get

 m.sat-mim(..,data=gm.dat)
Error in mim.cmd(clear; clear output) : couldn't find function COMCreate
 m2.sat-emfit(m.sat)
Error in toMIM(mim$data) : Object m.sat not found
 imputeMissing()
Error in mim.cmd(impute) : couldn't find function COMCreate
 imp.dat-retrieveData()
Error in mim.cmd(pf 12,8, look.nice = FALSE) :
   couldn't find function COMCreate
I first thought mimR might not automatically load RDCOMClient, but it 
turned out that RDCOMClient may not be called vie library at al, even 
though it was installed correctly.

 library(RDCOMClient)
Error in library(RDCOMClient) : 'RDCOMClient' is not a valid package -- 
installed  2.0.0?


Does anybody have an idea what the source of the problem might be?
thanks and best regards
Andreas
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] adding regression curve to xyplot

2004-11-30 Thread Deepayan Sarkar
On Tuesday 30 November 2004 10:09, Carlisle Thacker wrote:
 Dear R-listers,

 It seems that predict() behaves differently within panel.xyplot.  Am
 I doing something stupid?

 Thanks,

 Carlisle

 First, without xyplot():
  lmtest - lm(t~s,data=subset(P100,whichLon100==1  whichLat100==1))
  lmtest

 Call:
 lm(formula = s ~ t, data = subset(P100, whichLon100 == 1 
 whichLat100 == 1))

 Coefficients:
 (Intercept)t
 33.3307   0.1393

  range(P100$t)

 [1]  4.050469 24.514543

  predict(lmtest,newdata=data.frame(t=range(P100$t)))

12
 33.89501 36.74620

 As expected, predict gives two values.  But inside xyplot() predict
 gives

 300 values:
  xyplot(t~s|factor(lonLabels[whichLon100])*factor(latLabels[whichLat
 100]),

 +   data=P100,pch=.,
 +   panel=function(x,y,...){panel.xyplot(x,y,...)
 +   thislm - lm(x~y)
 +  print(thislm)
 +   newt - range(P100$t)
 +  print(newt)
 +   news -
 as.vector(predict(thislm,newdata=data.frame(t=newt)))

Why 't' here? The variables involved in 'thislm' are 'x' and 'y'.

Deepayan

 +  print(news)
 +   llines(news,newt,col=red)})

[...]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] adding regression curve to xyplot

2004-11-30 Thread hadley wickham
If you only want a simple linear regression, you might also want to try

 xyplot(t~s|factor(lonLabels[whichLon100])*factor(latLabels[whichLat100]),
+   data=P100,pch=., type =c(p,r)

 - type r will automatically fit and plot the regression line for you.

Hadley

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] adding regression curve to xyplot

2004-11-30 Thread Deepayan Sarkar
On Tuesday 30 November 2004 10:24, Prof Brian Ripley wrote:
 On Tue, 30 Nov 2004, Carlisle Thacker wrote:
  Dear R-listers,
 
  It seems that predict() behaves differently within panel.xyplot. 
  Am I doing something stupid?

 You fitted the model lm(x ~ y) and supplied new values for t, not y.

 Using panel.abline would be a bit easier: just call
 panel.abline(thislm) from your panel function.

That wouldn't quite work, since the response and predictor are switched 
in the lm fit.

Deepayan

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] 2k-factorial design with 10 parameters

2004-11-30 Thread Bob Wheeler

On Tue, 30 Nov 2004, Sven wrote:
I'd like to apply a 2^k factorial design with k=10 parameters. 
Obviously this results in a quite long term for the model equation due 
to the high number of combinations of parameters.

How can I specify the equation for the linear model (lm) without 
writing all combinations explicitly down by hand? Does a R command 
exist for this problematic?

Use expand.formula() in the AlgDesign package.
--
Bob Wheeler --- http://www.bobwheeler.com/
ECHIP, Inc. ---
Randomness comes in bunches.
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] adding regression curve to xyplot

2004-11-30 Thread Deepayan Sarkar
On Tuesday 30 November 2004 10:18, Austin, Matt wrote:
 Inside the panel, you have to only use the parts of x and y for each
 unique combination of
 factor(lonLabels[whichLon100])*factor(latLabels[whichLat100])



 So use   thislm - lm(x[subscripts]~y[subscripts]) in the panel
 function.

That's not true (at least in this situation). The 'x' and 'y' passed to 
the panel function by xyplot are already the appropriate subsets. 
('groups' would have been passed whole, had it been there.)

Deepayan

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] impute missing values in correlated variables: transcan?

2004-11-30 Thread Jonathan Baron
I would like to impute missing data in a set of correlated
variables (columns of a matrix).  It looks like transcan() from
Hmisc is roughly what I want.  It says, transcan automatically
transforms continuous and categorical variables to have maximum
correlation with the best linear combination of the other
variables. And, By default, transcan imputes NAs with best
guess expected values of transformed variables, back transformed
to the original scale.

But I can't get it to work.  I say

m1 - matrix(1:20+rnorm(20),5,)  # four correlated variables
colnames(m1) - paste(R,1:4,sep=)
m1[c(2,19)] - NA# simulate some missing data
library(Hmisc)
transcan(m1,data=m1)

and I get

Error in rcspline.eval(y, nk = nk, inclx = TRUE) : 
  fewer than 6 non-missing observations with knots omitted

I've tried a few other things, but I think it is time to ask for
help.

The specific problem is a real one.  Our graduate admissions
committee (4 members) rates applications, and we average the
ratings to get an overall rating for each applicant.  Sometimes
one of the committee members is absent, or late; hence the
missing data.  The members differ in the way they use the rating
scale, in both slope and intercept (if you regress each on the
mean).  Many decisions end up depending on the second decimal
place of the averages, so we want to do better than just averging
the non-missing ratings.

Maybe I'm just not seeing something really simple.  In fact, the
problem is simpler than transcan assumes, since we are willing to
assume linearity of the regression of each variable on the other
variables.  Other members proposed solutions that assumed this,
but they did not take into account the fact that missing data at
the high or low end of each variable (each member's ratings)
would change its mean.

Jon
-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron
R search page: http://finzi.psych.upenn.edu/

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Google for scientists: search engine

2004-11-30 Thread Hanke, Alex

A new way to search for documentation on your favourite science topic.
http://scholar.google.com/ http://scholar.google.com/ 

Alex Hanke
Department of Fisheries and Oceans
St. Andrews Biological Station
531 Brandy Cove Road
St. Andrews, NB
Canada
E5B 2L9



[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] adding regression curve to xyplot

2004-11-30 Thread Carlisle Thacker
The axes are switched in xyplot.  Oceanographers like to have temperature
as the vertical axis and salinity horizontal.  But temperature is used to
predict salinity.  Confusing, and makes everything complicated.

So panel.abline(thislm) would give the wrong line, as would
type=c(p,r).  And neither would handle a parabolic fit.

The problem was my using t rather than y when getting news.

Thanks for all the help.

Deepayan Sarkar wrote:
 On Tuesday 30 November 2004 10:24, Prof Brian Ripley wrote:
 
On Tue, 30 Nov 2004, Carlisle Thacker wrote:

Dear R-listers,

It seems that predict() behaves differently within panel.xyplot. 
Am I doing something stupid?

You fitted the model lm(x ~ y) and supplied new values for t, not y.

Using panel.abline would be a bit easier: just call
panel.abline(thislm) from your panel function.
 
 
 That wouldn't quite work, since the response and predictor are switched 
 in the lm fit.
 
 Deepayan


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Using mimR

2004-11-30 Thread Uwe Ligges
Andreas Cordes wrote:
Hi,
I am trying to use the mimR Package. According to its help pages it 
needs the RDCOMClient package to run.
When I try to evaluate a model I get

  m.sat-mim(..,data=gm.dat)
Error in mim.cmd(clear; clear output) : couldn't find function 
COMCreate
  m2.sat-emfit(m.sat)
Error in toMIM(mim$data) : Object m.sat not found
  imputeMissing()
Error in mim.cmd(impute) : couldn't find function COMCreate
  imp.dat-retrieveData()
Error in mim.cmd(pf 12,8, look.nice = FALSE) :
   couldn't find function COMCreate

I first thought mimR might not automatically load RDCOMClient, but it 
turned out that RDCOMClient may not be called vie library at al, even 
though it was installed correctly.

  library(RDCOMClient)
Error in library(RDCOMClient) : 'RDCOMClient' is not a valid package -- 
installed  2.0.0?
 

Does anybody have an idea what the source of the problem might be?
That your (binary!) version of the RDCOMClient package has been 
installed with R  2.0.0 ?

Please install a recent version compiled for R-2.0.x. A binary for 
R-2.0.x is available from the Omegahat webpage, or compile from sources 
yourself (you just need to replace one line in Makefile.win, AFAIR).

Uwe Ligges


thanks and best regards
Andreas
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] (no subject)

2004-11-30 Thread anne berthouly
Dear all,
I’ve got problems concerning crossed random effects and nested effects using 
the function  “lme”: I have two crossed random effects and I would like to 
nest each of them in a fixed factor and also test for the effects of these 
fixed factors.
At the moment my model looks like this:
Lme1-lme(x~(A+B+C+D+E)^2, random=list(grp 
=pdBlocked(list(pdIdent(~Z-1),pdIdent(~W-1)
I would like to nest Z in A and C (C/A/Z), an W in B and C (C/B/W) (A,B,C 
being 3 fixed factors with two levels).

If  you have a response to this kind of problem, could you please help me.
Thank you,
Anne Berthouly
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] impute missing values in correlated variables: transcan?

2004-11-30 Thread roger koenker
At the risk of stirring up a hornet's nest , I'd suggest that
means are dangerous in such applications.  A nice paper
on combining ratings is:  Gilbert Bassett and Joseph  Persky,
Rating Skating,  JASA, 1994,  1075-1079.
url:www.econ.uiuc.edu/~rogerRoger Koenker
email   [EMAIL PROTECTED]   Department of Economics
vox:217-333-4558University of Illinois
fax:217-244-6678Champaign, IL 61820
On Nov 30, 2004, at 10:52 AM, Jonathan Baron wrote:
I would like to impute missing data in a set of correlated
variables (columns of a matrix).  It looks like transcan() from
Hmisc is roughly what I want.  It says, transcan automatically
transforms continuous and categorical variables to have maximum
correlation with the best linear combination of the other
variables. And, By default, transcan imputes NAs with best
guess expected values of transformed variables, back transformed
to the original scale.
But I can't get it to work.  I say
m1 - matrix(1:20+rnorm(20),5,)  # four correlated variables
colnames(m1) - paste(R,1:4,sep=)
m1[c(2,19)] - NA# simulate some missing data
library(Hmisc)
transcan(m1,data=m1)
and I get
Error in rcspline.eval(y, nk = nk, inclx = TRUE) :
  fewer than 6 non-missing observations with knots omitted
I've tried a few other things, but I think it is time to ask for
help.
The specific problem is a real one.  Our graduate admissions
committee (4 members) rates applications, and we average the
ratings to get an overall rating for each applicant.  Sometimes
one of the committee members is absent, or late; hence the
missing data.  The members differ in the way they use the rating
scale, in both slope and intercept (if you regress each on the
mean).  Many decisions end up depending on the second decimal
place of the averages, so we want to do better than just averging
the non-missing ratings.
Maybe I'm just not seeing something really simple.  In fact, the
problem is simpler than transcan assumes, since we are willing to
assume linearity of the regression of each variable on the other
variables.  Other members proposed solutions that assumed this,
but they did not take into account the fact that missing data at
the high or low end of each variable (each member's ratings)
would change its mean.
Jon
--
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron
R search page: http://finzi.psych.upenn.edu/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] about the subscript assignment porblem

2004-11-30 Thread kh zu
Hi, Dear,

  I have a problem for the new version 2.0 of R
When I put this code in it give me the error:

uis$ivhx3[uis$ivhx0] - 1*(uis$ivhx==3)
Error: NAs are not allowed in subscripted assignments

but this would happen in version 1.91
there are missing data in the data set and it is
represented as NA
the data set can be find on line 
at the ucla web
actually this is a example from its web site

the c code is at
https://svn.r-project.org/R/trunk/src/main/subassign.c

:
if(length(y)  1)
for(i = 0; i  n; i++)
if(INTEGER(indx)[i] == NA_INTEGER)
error(NAs are not allowed in subscripted
assignments);
 So maybe we need get rid of this conditional code.

  

  Best Wishes
  Ku

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] impute missing values in correlated variables: transcan?

2004-11-30 Thread Jonathan Baron
On 11/30/04 11:23, roger koenker wrote:
At the risk of stirring up a hornet's nest , I'd suggest that
means are dangerous in such applications.  A nice paper
on combining ratings is:  Gilbert Bassett and Joseph  Persky,
Rating Skating,  JASA, 1994,  1075-1079.

Here is the abstract, which seems to capture what the article
says:

Among judged sports, figure skating uses a unique method of
median ranks for determining placement. This system responds
positively to increased marks by each judge and follows majority
rule when a majority of judges agree on a skater's rank. It is
demonstrated that this is the only aggregation system possessing
these two properties. Median ranks provide strong safeguards
against manipulation by a minority of judges. These positive
features do not require the sacrifice of efficiency in
controlling measurement error. In a Monte Carlo study, the median
rank system consistently outperforms alternatives when judges'
marks are significantly skewed toward an upper limit.

I think this is irrelevant.  We are using ratings, not rankings.

(And there was a small error in my original post.  The disturbing
effect of missing data at the high or low end would be on the
slope rather than the intercept or mean.)

Jon
-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] RecordPlot

2004-11-30 Thread Jean Coursol
I want to do a zoom with recordPlot(). I have problems with lists.
(R-2.0.1 patched 2004-11-30 , various linux). I have problems 
with RecordPlot class structure.

 plot(1:10)
 saveP - recordPlot()
 dev.off()

 sx - saveP[[1]][[2]][[2]] 
 saveP[[1]][[2]][[2]] - sx 
Error in [[-(`*tmp*`, 1, value = list(list(
.Primitive(plot.new)), list(.Primitive(plot
.window), c(1,  : 
incompatible types

 typeof(saveP[[1]][[2]][[2]])
[1] double
 typeof(sx)
[1] double


But:

 s1 - saveP[[1]]
 s1[[2]][[2]] - c(4,6)
 saveP[1] - list(s1)
 saveP  # zoom is OK

Also, I don't understand recursive indexing.
With not modified saveP, 

 saveP[[c(1,2)]]
[[1]]
.Primitive(plot.window)

[[2]]
[1]  1 10

[[3]]
[1]  1 10

[[4]]
[1] 

[[5]]
[1] NA

# OK

 saveP[[c(1,2,2)]]
Error: recursive indexing failed at level 2  

# why not [1]  1 10 ??

Jean Coursol

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] A basic question

2004-11-30 Thread asemeria


On gentoo:

 emerge R

and dowload,configuration, compilation of 
all you need to working with base R is performed.
Best!

A.S.



Alessandro Semeria 
Models and Simulations Laboratory
Montecatini Environmental Research Center (Edison Group), 
Via Ciro Menotti 48,
48023 Marina di Ravenna (RA), Italy
Tel. +39 544 536811
Fax. +39 544 538663
E-mail: [EMAIL PROTECTED]





Kenneth [EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
30/11/2004 12.58

 
To: [EMAIL PROTECTED]
cc: 
Subject:[R] A basic question






Hi R users:

I want to know any experience compiling R in other LINUX distributions
besides FEDORA (Red Hat) or Mandrake, for example in BSD, Debian,
Gentoo, Slackware, vector LINUX, Knoppix, Yopper or CERN linux?

Hope this is not a basic question

Thank you for your help.

Kenneth

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html



[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Course ****R/S System: Advanced Programming, Seattle***December 20-21

2004-11-30 Thread elvis
R/S Advanced Programming course in Seattle on 
December 20-21
Please check out the full description and Agenda of 
the 2-day class on the website:

www.xlsolutions-corp.com/Radv.htm


And let us know if we should hold seats for you.
Ask for group discount!


Here's the outline:

Course outline:
- Overview of R/S fundamentals: Syntax and Semantics
- Class and Inheritance in R/S-Plus
- Concepts, Construction and good use of language objects
- Coercion and efficiency
- Object-oriented programming in R and S-Plus
- Advanced manipulation tools: Parse, Deparse, Substitute, etc.
- How to fully take advantage of Vectorization
- Generic and Method Functions; S4 (S-Plus 6)
- Search path, databases and frames Visibility
- Working with large objects
- Handling Properly Recursion and iterative calculations
- Managing loops; For (S-Plus) and for() loops
- Consequences of Lazy Evaluation
- Efficient Code practices for large computations
- Memory management and Resource monitoring
- Writing R/S-Plus functions to call compiled code
- Writing and debugging compiled code for R/S-Plus system
- Connecting R/S-Plus to External Data Sources
- Understanding the structure of model fitting functions in R/S-Plus
- Designing and Packaging efficiently 


This course will also deal with lots of S-Plus efficiency issues and
any special topics from participants is welcome.
Please let us know if you and your colleagues are interested in this
class to take advantage of group discount. Register now to secure your
seat 
in this course!

Cheers,
Elvis Miller, PhD
Manager Training.
XLSolutions Corporation
206 686 1578
www.xlsolutions-corp.com

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] about the subscript assignment porblem

2004-11-30 Thread Thomas Lumley
On Tue, 30 Nov 2004, kh zu wrote:
Hi, Dear,
 I have a problem for the new version 2.0 of R
When I put this code in it give me the error:
uis$ivhx3[uis$ivhx0] - 1*(uis$ivhx==3)
Error: NAs are not allowed in subscripted assignments
but this would happen in version 1.91
What would happen?  In version 1.9.0 (I don't have a 1.9.1 lying around) 
you get a warning if any of the subscripts are FALSE
   x-1:3
   y-7:9
   x[c(TRUE,NA,FALSE)]-y
  Warning message:
  number of items to replace is not a multiple of replacement length

and if all the subscripts are TRUE or NA the NAs are treated as FALSE
   x-1:3
   y-7:9
   x[c(TRUE,NA,TRUE)]-y
   x
  [1] 7 2 9
The change was largely motivated by numerical indices, where the problem 
is worse.   In particular if x is 1,2,3, i is 1, NA, 2  and y is 7,8,9, 
should
   x[i] - y
set the second element of x to 8 or 9?  The answer was different for 
vectors and matrices in 1.9.1.

It was clearly a deliberate change, not a mistake (it's hard to see how it 
could have happened accidentally, and it was documented), and the previous 
behaviour was wrong.

-thomas
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] impute missing values in correlated variables: transcan?

2004-11-30 Thread Frank E Harrell Jr
Jonathan Baron wrote:
I would like to impute missing data in a set of correlated
variables (columns of a matrix).  It looks like transcan() from
Hmisc is roughly what I want.  It says, transcan automatically
transforms continuous and categorical variables to have maximum
correlation with the best linear combination of the other
variables. And, By default, transcan imputes NAs with best
guess expected values of transformed variables, back transformed
to the original scale.
But I can't get it to work.  I say
m1 - matrix(1:20+rnorm(20),5,)  # four correlated variables
colnames(m1) - paste(R,1:4,sep=)
m1[c(2,19)] - NA# simulate some missing data
library(Hmisc)
transcan(m1,data=m1)
and I get
Error in rcspline.eval(y, nk = nk, inclx = TRUE) : 
  fewer than 6 non-missing observations with knots omitted
Jonathan - you would need many more observations to be able to fit 
flexible additive models as transcan does.  Also note that single 
imputation has problems and you may want to consider multiple imputation 
as done by the Hmisc aregImpute function, if you had more data.

Frank
I've tried a few other things, but I think it is time to ask for
help.
The specific problem is a real one.  Our graduate admissions
committee (4 members) rates applications, and we average the
ratings to get an overall rating for each applicant.  Sometimes
one of the committee members is absent, or late; hence the
missing data.  The members differ in the way they use the rating
scale, in both slope and intercept (if you regress each on the
mean).  Many decisions end up depending on the second decimal
place of the averages, so we want to do better than just averging
the non-missing ratings.
Maybe I'm just not seeing something really simple.  In fact, the
problem is simpler than transcan assumes, since we are willing to
assume linearity of the regression of each variable on the other
variables.  Other members proposed solutions that assumed this,
but they did not take into account the fact that missing data at
the high or low end of each variable (each member's ratings)
would change its mean.
Jon

--
Frank E Harrell Jr   Professor and Chair   School of Medicine
 Department of Biostatistics   Vanderbilt University
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] xy_plot

2004-11-30 Thread ebashi
R users; 
Does anyone have a recommendation for a faster
plotting function rather than plot(x,y)?
when I use plot(x,y) for a large number of variables,
it take couple of moments to plot the graph?

Sincerely,

Sean

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] New trellis settings

2004-11-30 Thread David Hinds
On Mon, Nov 29, 2004 at 11:23:35PM -0600, Deepayan Sarkar wrote:
  
  Specifically, I have some code that in the past changed the relative
  proportions of text versus the plot area using:
 
trellis.par.set('fontsize', list(text=8))
 
  which caused all text to get smaller, and the plot area to grow to
  fill the larger available space.  Now, the plot area does not grow on
  its own.  
 
 That does seem to have been a side-effect in 1.9.1, but it was never 
 intended. I would consider that behaviour a bug, not a feature.

It was a pretty convenient bug! ;)

  str(trellis.par.get()$layout.heights)
 List of 18
  $ top.padding  : num 1
  $ main : num 1
  $ main.key.padding : num 1
  $ key.top  : num 1
  $ key.axis.padding : num 1
  ...
 
 I was hoping that the names would be enough of a hint. Anything with 
 'padding' in the name is space, and probably the ones you want to 
 change.

I've fiddled with these and can pretty much get what I want.  But
without really understanding what I'm doing.  It isn't clear to me,
for instance, why the key settings affect my plot when no key is
drawn.

-- Dave

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] A basic question

2004-11-30 Thread Andrew Robinson
R has compiled with no problem in FreeBSD.  It is also included in
the ports, thanks to its FreeBSD maintainer.

Andrew


On Tue, Nov 30, 2004 at 06:58:57AM -0500, Kenneth wrote:
 Hi R users:
 
 I want to know any experience compiling R in other LINUX distributions
 besides FEDORA (Red Hat) or Mandrake, for example in BSD, Debian,
 Gentoo, Slackware, vector LINUX, Knoppix, Yopper or CERN linux?
 
 Hope this is not a basic question
 
 Thank you for your help.
 
 Kenneth
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html

-- 
Andrew Robinson  Ph: 208 885 7115
Department of Forest Resources   Fa: 208 885 6226
University of Idaho  E : [EMAIL PROTECTED]
PO Box 441133W : http://www.uidaho.edu/~andrewr
Moscow ID 83843  Or: http://www.biometrics.uidaho.edu
No statement above necessarily represents my employer's opinion.

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] RecordPlot

2004-11-30 Thread Paul Murrell
Hi
The main problem here is that you really shouldn't be poking around 
inside a recordedplot object.  From the help page:

WARNING:
 The format of recorded plots may change between R versions.
 Recorded plots should *not* be used as a permanent storage format
 for R plots.
 R will always attempt to replay a recorded plot, but if the plot
 was  recorded with a different R version then bad things may
 happen.
This could (should) be more explicit.  In particular, it might be worth 
adding a comment from the C source ...

 * The graphics engine assumes that it is getting a snapshot
 * that was created in THE CURRENT R SESSION
... [snapshot == recordedplot].  The basic message is:  don't rely on 
the internal structure of a recordedplot because we can (and have [and 
will]) change it at any time.

That leaves the problem of how to achieve your zoom, but I'm not sure 
exactly what your zoom is doing (just modifying the axis ranges?). 
Could you (privately) send me screen shots of before and after the zoom? 
Then I can try to suggest a correct way to zoom.

Paul
Jean Coursol wrote:
I want to do a zoom with recordPlot(). I have problems with lists.
(R-2.0.1 patched 2004-11-30 , various linux). I have problems 
with RecordPlot class structure.


plot(1:10)
saveP - recordPlot()
dev.off()

sx - saveP[[1]][[2]][[2]] 
saveP[[1]][[2]][[2]] - sx 
Error in [[-(`*tmp*`, 1, value = list(list(
.Primitive(plot.new)), list(.Primitive(plot
.window), c(1,  : 
incompatible types


typeof(saveP[[1]][[2]][[2]])
[1] double
typeof(sx)
[1] double


But:

s1 - saveP[[1]]
s1[[2]][[2]] - c(4,6)
saveP[1] - list(s1)
saveP  # zoom is OK

Also, I don't understand recursive indexing.
With not modified saveP, 


saveP[[c(1,2)]]
[[1]]
.Primitive(plot.window)
[[2]]
[1]  1 10
[[3]]
[1]  1 10
[[4]]
[1] 
[[5]]
[1] NA
# OK

saveP[[c(1,2,2)]]
Error: recursive indexing failed at level 2  

# why not [1]  1 10 ??
Jean Coursol
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

--
Dr Paul Murrell
Department of Statistics
The University of Auckland
Private Bag 92019
Auckland
New Zealand
64 9 3737599 x85392
[EMAIL PROTECTED]
http://www.stat.auckland.ac.nz/~paul/
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] impute missing values in correlated variables: transcan?

2004-11-30 Thread Jonathan Baron
On 11/30/04 13:21, Frank E Harrell Jr wrote:
Jonathan Baron wrote:
 I would like to impute missing data in a set of correlated
 variables (columns of a matrix).  It looks like transcan() from
 Hmisc is roughly what I want.  It says, transcan automatically
 transforms continuous and categorical variables to have maximum
 correlation with the best linear combination of the other
 variables. And, By default, transcan imputes NAs with best
 guess expected values of transformed variables, back transformed
 to the original scale.

 But I can't get it to work.  I say

 m1 - matrix(1:20+rnorm(20),5,)  # four correlated variables
 colnames(m1) - paste(R,1:4,sep=)
 m1[c(2,19)] - NA# simulate some missing data
 library(Hmisc)
 transcan(m1,data=m1)

 and I get

 Error in rcspline.eval(y, nk = nk, inclx = TRUE) :
   fewer than 6 non-missing observations with knots omitted

Jonathan - you would need many more observations to be able to fit
flexible additive models as transcan does.  Also note that single
imputation has problems and you may want to consider multiple imputation
as done by the Hmisc aregImpute function, if you had more data.

Thanks.  But they don't _need_ to be so flexible as what transcan
does.  Linear would be OK, but I can't find an option for that in
transcan.

We _will_ have more data, about 50 applicants rated by the time
we start making decisions.  So I tried my little simulation with
more data, and it didn't give an error message.  So that was the
problem.  Here is the new one:

m1 - matrix(1:80+rnorm(80),,4)
colnames(m1) - paste(R,1:4,sep=)
m1[c(2,19)] - NA
library(Hmisc)
t1 - transcan(m1,data=m1,long=T,imputed=T)

I've used aregImpute, and I notice it has a defaultlinear
option, which is good.  Thus, it may work better once I figure
out how to get a single value out of it for each missing datum
(which doesn't look too hard).

This is not about statistical inference, which seems to me to be
where the main advantage of multiple imputation lies.  But
probably it won't do any harm.

Jon
-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page: http://www.sas.upenn.edu/~baron
R search page: http://finzi.psych.upenn.edu/

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] xy_plot

2004-11-30 Thread Mike Saunders
Sean:
You need to provide more information on your problem for anyone to help you 
much.  One of the apply functions working in tandem with points or 
lines (or others) can often do multiple item quickly, but again I don't 
know the context of your problem.

Mike
- Original Message - 
From: ebashi [EMAIL PROTECTED]
To: R [EMAIL PROTECTED]
Sent: Tuesday, November 30, 2004 2:31 PM
Subject: [R] xy_plot


R users;
Does anyone have a recommendation for a faster
plotting function rather than plot(x,y)?
when I use plot(x,y) for a large number of variables,
it take couple of moments to plot the graph?
Sincerely,
Sean
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Random effects and non-linear models

2004-11-30 Thread Certo, Trevis
I am trying to model growth over time for a number of companies (my unit
of analysis). My dependent variable is a count (the number of
acquisitions each firm made each year), and I'm having some trouble
figuring out exactly how to model this. My assumption is that modeling
the effect of time on this dependent variable with a linear model is
inappropriate. Does anyone have any guidance regarding how to model such
a dependent variable such that I could include both random and fixed
effects? Thanks in advance.

 

S. Trevis Certo, PhD

Assistant Professor  Mays Research Fellow

Management Department

Mays Business School

Texas AM University

 


[[alternative HTML version deleted]]

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] augPred with lme(...,subset=...)

2004-11-30 Thread Manuel Morales
Hello,

Is there a way to get augPred to work with lme if a subset statement is
used? For example, if I modify the example from ?augPred.lme to include
a subset statement, I get the following error:


fm1 - lme(Orthodont, random = ~1, subset=distance19)
augPred(fm1, length.out = 2, level = c(0,1))
Error in tapply(object[[nm]], groups, FUN[[numeric]], ...) :
arguments must have same length

Thanks!
Manuel

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Reading a tab delimitted text

2004-11-30 Thread Srinivas Iyyer
Dear group,
 I have a tab delimitted text file with 21 column and
1988 rows. When I read the file:

D1 -
read.table(file=gist_data1.txt,sep=\t,header=T)
 dim(D1)
[1] 1811   20

It reads only 1811 rows from that file.

I saved this file as CSV file and I read it again
using:

 D1 -
read.csv(file=gist_data1.txt,sep=,,header=T)


 dim(D1)
[1] 19871
 


This timer it reaad correct number of rows and wrong
column numbers. 

Can any one suggest how to read a tab-delimited text
file and read in corect number of lines. 


thank you.






__ 

The all-new My Yahoo! - What will yours do?

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] bitmap (blank image) plot rendering without X11

2004-11-30 Thread Director, Beracah Yankama
Hi,
I am trying to generate plots on our unix (no X) server to be included 
in our web-pages - specifically pngs.

Without X, png() obviously doesn't work, so I have been trying to define 
the graphics print device bitmap as described in the help:

 bitmap(file=plot.png, type = png256, height = 6, width=6,res=72)
 pie(c(12,5))
 dev2bitmap(file=plot.png, type = png256, height = 6, width = 
6,res=72)

I end up with plot.png as a nonzero png file, but it is always 
blank... I have gs 6.51 installed  R_GSCMD=/usr/bin/gs set.

generating Rplot.ps; pstoimg -antialias (or pstopnm)  would also be an 
acceptable solution if I knew how to control the size of the generated 
image, or if the ps generated by R was consistently compatible with 
pstopnm.  (ps2ps causes me to lose parts of the image)..

So I am asking know-alls of R... if they know of a solution?  We are 
generating thousands of images, so work on a windows or slower machine 
with X is not really an option...

any help much appreciated!
Beracah


--
Beracah Yankama
Director, StudentsReview
StudentsReview.com
[EMAIL PROTECTED]
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Relative subscripting

2004-11-30 Thread Tobias Muhlhofer
Hi!
I'm trying to do the following.
I have monthly a dataset with, among other things, marketcap, and 
return.

I want to multiply return by the marketcap of the previous month. How do 
I do this?

In STATA (which I have used frequently in the past) I would simply use 
an expression of the form

return[_n]*marketcap[_n-1]
I believe they call this relative subscripting. Is there something like 
this in R?

On a completely different note, are there books on R? I read the 
Getting Started notes, but, while helpful, I would need more than those.

Thanks,
Toby
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] SJava

2004-11-30 Thread Yasser El-Zein
How can I increase the JVM's memory using teh SJava library?

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] calling R from Java

2004-11-30 Thread Lana Schaffer
Greetings,
I would like to call a small R function from Java (actually
to Bioconductor).  From a little reading, looks like I can
only do this on a Unix system and not on a PC.  Is this indeed
the case?  Does anyone have experience with calling a R
function from Java?
Lana

Lana Schaffer
Research Specialist
The Scripps Research Institute
DNA Array Core Facility

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Package for multivariate binary logistic regression?

2004-11-30 Thread Kjetil Brinchmann Halvorsen
Lynne Baker wrote:
I am trying to find out if someone has implemented a (McFadden-type) multivariate 
binary logistic regresssion package for R? From what I can tell, this is not available for R.

Thank you,
Lynne Baker
[[alternative HTML version deleted]]
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

You can have a look at package VGAM (I think still not on CRAN)
which has binom2.or, for instance.
Kjetil Halvorsen
--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
  --  Mahdi Elmandjra
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Choice modelling (was:(no subject))

2004-11-30 Thread Kjetil Brinchmann Halvorsen
[EMAIL PROTECTED] wrote:
Hello,
I am trying to estimate a choice model with varying choice set for each
individual.
I would like to fit different kinds of model (logit ,nested logit,
probit...).
So far I have found that package *mnp* allows me to estimate a probit model
with varying choice set.
But for estimation of a logit model, I have only found function *multinom*
of package *nnet* which does not seem to allow for varying choice set.
I could incorporate indicators of choice availability as explanotary
variables, but it does not seem a very good way to do it.
Instead, for a logit model, I have coded a likelihood computation of the
underlying model with varying choice set and I use optim function to get
the maximum.
 

Could you post the code?
I wondered if there were more user friendly functions available and/or
other choice model related package.
 

Look at CRAN package eba (elimination by aspects).
Kjetil
Thanks,
Julien
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 


--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
  --  Mahdi Elmandjra
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] bitmap (blank image) plot rendering without X11

2004-11-30 Thread Peter Dalgaard
Director, Beracah Yankama [EMAIL PROTECTED] writes:

 Hi,
 I am trying to generate plots on our unix (no X) server to be included
 in our web-pages - specifically pngs.
 
 Without X, png() obviously doesn't work, so I have been trying to
 define the graphics print device bitmap as described in the help:
 
   bitmap(file=plot.png, type = png256, height = 6, width=6,res=72)
   pie(c(12,5))
   dev2bitmap(file=plot.png, type = png256, height = 6, width =
 6,res=72)
 
 I end up with plot.png as a nonzero png file, but it is always
 blank... I have gs 6.51 installed  R_GSCMD=/usr/bin/gs set.

Try forgetting the dev2bitmap() line and just terminate the device
with dev.off(). 

-- 
   O__   Peter Dalgaard Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics 2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark  Ph: (+45) 35327918
~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] seriesMerge

2004-11-30 Thread Yasser El-Zein
I want to merge two timeSeries (union) and get a resulting timeSeries.
using union or merge I got a data.frame and when I tried to convert it
to timeSeries the data was corrupt. Is there a more straight forward
way to take two timeSeries and merege them for a resulting timeSeries
of the union of both?


On Thu, 25 Nov 2004 03:50:28 + (UTC), Gabor Grothendieck
[EMAIL PROTECTED] wrote:
 Yasser El-Zein abu3ammar at gmail.com writes:
 
 :
 : Is there a function in R that is equivalent to S-PLUS's
 
 
 : seriesMerge(x1, x2, pos=union)
 : where x1, and x2 are of class timeSeries
 :
 : seriesMerge is in S-PLUS's finmetrics. I looked into R's mergeSeries
 : (in fSeries part of Rmetrics) but I could not make it behave quite the
 : same. In R it expected a timeSeries object and a matrix of the same
 : row count. In S-PLUS when using the union option both objects can be
 : of different lengths.
 
 merge.zoo in package zoo handles union, intersection, left
 and right join of unequal length time series according to the
 setting of the all= argument.  zoo can also work with chron dates
 and times which would allow you to work with your millisecond data
 and can also merge more than two series at a time.   (The its
 package (see ?itsJoin) and for regular time series, cbind.ts, also
 support merging unequal length series but neither of these support
 chron which I gather is a requirement for you.)
 
 eg. zoo example.
 In the following x has  length 8 and y has length 6 and
 they overlap for chron(5:8).  chron(1:4) only belongs
 to x and chron(9:10) only belongs to y.
 
 library(chron)
 library(zoo)
 x - zoo(1:8, chron(1:8))
 y - zoo(5:10, chron(5:10))
 merge(x,y) # union
 merge(x,y,all=FALSE) # intersection
 merge(x,y,all=c(FALSE, TRUE)) # right join
 merge(x,y,all=c(TRUE, FALSE)) # left join
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Relative subscripting

2004-11-30 Thread Jean Eid
 wouldn't it be return[2:NROW(return)]*marketcap[1:(NROW(return)-1)]

(note that return is also a function in R so maybe you should stay away
from calling your variable return. Anyways if you have a data frame you
can add another variable to it but attach an NA to the first element
(since you are lagging variables) i.e.

mydata$myvar-c(NA, 
mydata$return[2:nrow(mydata)]*mydata$marketcap[1:(nrow(mydata)-1)]


Jean



On Tue, 30 Nov 2004, Tobias Muhlhofer wrote:

 Hi!

 I'm trying to do the following.

 I have monthly a dataset with, among other things, marketcap, and
 return.

 I want to multiply return by the marketcap of the previous month. How do
 I do this?

 In STATA (which I have used frequently in the past) I would simply use
 an expression of the form

 return[_n]*marketcap[_n-1]

 I believe they call this relative subscripting. Is there something like
 this in R?

 On a completely different note, are there books on R? I read the
 Getting Started notes, but, while helpful, I would need more than those.

 Thanks,
   Toby

 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Relative subscripting

2004-11-30 Thread Kjetil Brinchmann Halvorsen
Tobias Muhlhofer wrote:
Hi!
I'm trying to do the following.
I have monthly a dataset with, among other things, marketcap, and 
return.

I want to multiply return by the marketcap of the previous month. How 
do I do this?

In STATA (which I have used frequently in the past) I would simply use 
an expression of the form

return[_n]*marketcap[_n-1]
I believe they call this relative subscripting. Is there something 
like this in R?

On a completely different note, are there books on R? I read the 
Getting Started notes, but, while helpful, I would need more than 
those.
Q 2.7 in the R faq (yes, there are many)!
Kjetil
Thanks,
Toby
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html



--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
  --  Mahdi Elmandjra
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Relative subscripting

2004-11-30 Thread Tobias Muhlhofer
OK, yeah. I did think of that in the meantime, but I was also wondering 
if there was some other convenience function to do it. But this will do 
in any case.

Toby
Jean Eid wrote:
 wouldn't it be return[2:NROW(return)]*marketcap[1:(NROW(return)-1)]
(note that return is also a function in R so maybe you should stay away
from calling your variable return. Anyways if you have a data frame you
can add another variable to it but attach an NA to the first element
(since you are lagging variables) i.e.
mydata$myvar-c(NA, 
mydata$return[2:nrow(mydata)]*mydata$marketcap[1:(nrow(mydata)-1)]
Jean

On Tue, 30 Nov 2004, Tobias Muhlhofer wrote:

Hi!
I'm trying to do the following.
I have monthly a dataset with, among other things, marketcap, and
return.
I want to multiply return by the marketcap of the previous month. How do
I do this?
In STATA (which I have used frequently in the past) I would simply use
an expression of the form
return[_n]*marketcap[_n-1]
I believe they call this relative subscripting. Is there something like
this in R?
On a completely different note, are there books on R? I read the
Getting Started notes, but, while helpful, I would need more than those.
Thanks,
Toby
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


--
**
When Thomas Edison invented the light bulb he tried over 2000
experiments before he got it to work. A young reporter asked
him how it felt to have failed so many times. He said
I never failed once. I invented the light bulb.
It just happened to be a 2000-step process.
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Random effects and non-linear models

2004-11-30 Thread Douglas Bates
Certo, Trevis wrote:
I am trying to model growth over time for a number of companies (my unit
of analysis). My dependent variable is a count (the number of
acquisitions each firm made each year), and I'm having some trouble
figuring out exactly how to model this. My assumption is that modeling
the effect of time on this dependent variable with a linear model is
inappropriate. Does anyone have any guidance regarding how to model such
a dependent variable such that I could include both random and fixed
effects? Thanks in advance.
You may want to consider a generalized linear mixed model (GLMM) for the 
Poisson family.  These can be fit with the GLMM function in the lme4 
package.

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


RE: [R] Relative subscripting

2004-11-30 Thread Ted Harding
On 30-Nov-04 Tobias Muhlhofer wrote:
 [...]
 I have monthly a dataset with, among other things, marketcap,
 and return.
 
 I want to multiply return by the marketcap of the previous month.
 How do I do this?
 
 In STATA (which I have used frequently in the past) I would simply
 use an expression of the form
 
 return[_n]*marketcap[_n-1]
 
 I believe they call this relative subscripting. Is there something
 like this in R?

Not as such, as far as I know. But there's an easy way to achieve
the same effect:

Let

  N-length(return)
  new.var - return[2:N]*marketcap[1:(N-1)]

Notes:
1. Note the parantheses in 1:(N-1).
  1:(6-1)
 [1] 1 2 3 4 5
  1:6-1
 [1] 0 1 2 3 4 5
   (i.e. : is evaluated before -)

2. You could also define n - 2:(N-1) in which case you could
   definitely write

 return[n]*marketcap[n-1]

   which looks very similar to what you wrote, but I don't
   know whether it implies the same underlying mechanism.


3. I'm not sure you should use return as the name of a variable,
   since it's a predefined function in R, which you can put in a
   function definition to tell it what to return:
  sq-function(x){return(x^2)}
  sq(4)
 [1] 16

   In my experiments, it didn't seem to change this behaviour
   to assign something to return, e.g. return-2, even inside
   the function definition; but I'd recommend avoiding the practice!

   You could avoid it here by using Return instead of return
   for the name of your variable.

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861  [NB: New number!]
Date: 30-Nov-04   Time: 21:34:02
-- XFMail --

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] augPred with lme(...,subset=...)

2004-11-30 Thread Douglas Bates
Manuel Morales wrote:
Hello,
Is there a way to get augPred to work with lme if a subset statement is
used? For example, if I modify the example from ?augPred.lme to include
a subset statement, I get the following error:
fm1 - lme(Orthodont, random = ~1, subset=distance19)
augPred(fm1, length.out = 2, level = c(0,1))
Error in tapply(object[[nm]], groups, FUN[[numeric]], ...) :
arguments must have same length
Thanks!
Manuel
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Well you could debug the augPred method and send the package maintainer 
a patch :-)

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Reading a tab delimitted text

2004-11-30 Thread Douglas Bates
Srinivas Iyyer wrote:
Dear group,
 I have a tab delimitted text file with 21 column and
1988 rows. When I read the file:
D1 -
read.table(file=gist_data1.txt,sep=\t,header=T)
dim(D1)
[1] 1811   20
It reads only 1811 rows from that file.
I saved this file as CSV file and I read it again
using:

D1 -
read.csv(file=gist_data1.txt,sep=,,header=T)

dim(D1)
[1] 19871

This timer it reaad correct number of rows and wrong
column numbers. 

Can any one suggest how to read a tab-delimited text
file and read in corect number of lines. 

thank you.
Check for the presence of unexpected comment characters or quote 
characters in the file you are reading.  Alternatively, try setting 
quote='', comment='' in the call to read.table.

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] New trellis settings

2004-11-30 Thread Deepayan Sarkar
On Tuesday 30 November 2004 13:33, David Hinds wrote:
 On Mon, Nov 29, 2004 at 11:23:35PM -0600, Deepayan Sarkar wrote:
   Specifically, I have some code that in the past changed the
   relative proportions of text versus the plot area using:
  
 trellis.par.set('fontsize', list(text=8))
  
   which caused all text to get smaller, and the plot area to grow
   to fill the larger available space.  Now, the plot area does not
   grow on its own.
 
  That does seem to have been a side-effect in 1.9.1, but it was
  never intended. I would consider that behaviour a bug, not a
  feature.

 It was a pretty convenient bug! ;)

   str(trellis.par.get()$layout.heights)
 
  List of 18
   $ top.padding  : num 1
   $ main : num 1
   $ main.key.padding : num 1
   $ key.top  : num 1
   $ key.axis.padding : num 1
   ...
 
  I was hoping that the names would be enough of a hint. Anything
  with 'padding' in the name is space, and probably the ones you want
  to change.

 I've fiddled with these and can pretty much get what I want.  But
 without really understanding what I'm doing.  It isn't clear to me,
 for instance, why the key settings affect my plot when no key is
 drawn.

It shouldn't (unless you have messed with lattice.options()). Can you 
provide an example? The following doesn't do anything unusual for me:

xyplot(1~1, 
   par.settings = 
   list(layout.heights = list(key.top = 100, key.bottom = 100)))

(I'm running r-devel though, so there's a small chance something might 
be different.)

Deepayan

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Combined variable names

2004-11-30 Thread Tobias Muhlhofer
I am trying to define a large number of variables through a loop construct.
I have my loop variable i being cycled through 1:100 and I would like 
the variables produced by this to be called

vi (i.e. v1 v2 v3 etc)
so, for example I'm going:
for(i in 1:100) {
blank - a[i:N] # or whatever else you want to put on the right side 

}
where N is previously defined.
What goes in for blank?
Thanks,
Toby
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] nls() error: Object not found

2004-11-30 Thread Yang, Richard
Dear R-helpers;

Using nls() to fit a function,Rdum, defined below I stumbled on an
error: Error in eval(expr, envir, enclos): Object s0 not found. 

The function Rdum is defined as

 Rdum - deriv(~ h1 * (s0 + sl0*sl + sm0*sm  + sp01*sp1 + sp02*sp2 +
sp03*sp3+sp04*sp4) *
  ((1 - exp(-(s1 + sl1*sl + sm1*sm  + sp11*sp1 + sp12*sp2  +
sp14*sp4)*t2)) /
   (1 - exp(-(s1 + sl1*sl + sm1*sm  + sp11*sp1 + sp12*sp2 +
sp14*sp4)*t1)))^
   (s2 + sl2*sl+sm2*sm+ sp21*sp1+sp22*sp2+sp23*sp3+sp24*sp4),
  c(s0, s10,sm0, sp01,sp02,sp03,sp04,
 s1, sl1,sm1, sp11, sp12,sp14,
 s2,sl2,sm2, sp21,sp22,sp23,sp24),
 function(s0,sl0,sm0,sp01,sp02,sp03,sp04, s1, sl1, sm1, sp11,sp12, sp14,

s2, sl2, sm2, sp21,sp22, sp23, sp24, h1, t1,t2, sl, sm,sp1, sp2, sp3,
sp4){})

and variables t1, t2, h1, h2, sl, sm, sp1, sp2, sp3, and sp4 in the gbht10D
data frame are fitted to the function by

   Dum.nls - nls(h2 ~ Rdum(s0, sl0, sm0, sp01, sp02, sp03, sp04, sl,
sl1,sm1,sp11,sp12, sp14,
   s2, sl2, sm2, sp21, sp22, sp23, sp24,h1, t1, t2, sl, sm, sp1, sp2, sp3,
sp4), data=gbht10D,
   start=c(0.8413,-0.1602,-0.0156,0.0527,0.0513,0.00314,0.0378,
   -0.00598,-0.0125,0.00328,0.00989,0.0113,0.00583,
   1.9255,0.9427,0.2408,-0.0643,0.0047,0.0016,-0.00519))

The complained object s0 is one of the 20 parameters in the function
to be estimated from the dataset gbht10D. 

The nls() script is relatively short. Stepping into the source code, I
located the offending line:

Browse[1] start
 [1]  0.84130 -0.16020 -0.01560  0.05270  0.05130  0.00314  0.03780 -0.00598
-0.01250
[10]  0.00328  0.00989  0.01130  0.00583  1.92550  0.94270  0.24080 -0.06430
0.00470
[19]  0.00160 -0.00519
Browse[1] n
debug: pnames - names(start)
Browse[1] n
debug: varNames - varNames[is.na(match(varNames, pnames, nomatch = NA))]
Browse[1] n
debug: varIndex - sapply(varNames, function(varName, data, respLength) {
length(eval(as.name(varName), data))%%respLength == 0
}, data, length(eval(formula[[2]], data)))
Browse[1] varNames
 [1] h2   s0   sl0  sm0  sp01 sp02 sp03 sp04 sl   sl1
sm1  sp11
[13] sp12 sp14 s2   sl2  sm2  sp21 sp22 sp23 sp24 h1
t1   t2  
[25] sm   sp1  sp2  sp3  sp4 
Browse[1] n
Error in eval(expr, envir, enclos) : Object s0 not found. 

The s0 is shown in varNames. Is the error message misleading? Or did I
miss something? Any iedas and suggestions?

I am using R 2.0.0 on Windows XP.

TIA,

Richard Yang

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Combined variable names

2004-11-30 Thread Thomas Lumley
On Tue, 30 Nov 2004, Tobias Muhlhofer wrote:
I am trying to define a large number of variables through a loop construct.
I have my loop variable i being cycled through 1:100 and I would like the 
variables produced by this to be called

vi (i.e. v1 v2 v3 etc)
Look at FAQ 7.21, which explains how to do it and suggest that you might 
not really want to.

-thomas
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] predict.gam problem

2004-11-30 Thread Jon Egil Strand

-
Mac OS X 10.3
R 2.0.1
gam 0.9.2
-

Greetings

I am facing difficulties in prediction on using Trevor Hasties GAM package. 

How can one interpret the response from predict.gam?

Documentation on the type-parameter:
  The default (link) produces predictions on the scale of the additive 
  predictors, ... 

  If response is selected, the predictions are on the scale of the
  response, and are monotone trans-formations of the additive predictors,
  using the inverse link function.

Does on the scale of the response ammount to residals? 

All I want to do is get the predicted response from running my GAM model
on new data. The results given are way off, but I am not able to dechipher 
the documentation, nor use any scale information.


Any help will be highly appreciated.


All the best

Jon Egil Strand




-- 

Jon Egil Strand
[EMAIL PROTECTED]
Phone: +47 45030081

__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


Re: [R] Combined variable names

2004-11-30 Thread Sean Davis
See  the R-FAQ here:
http://cran.r-project.org/doc/FAQ/R-FAQ.html
Number 7.21.
However, as the FAQ also points out, you might be better served using 
lists.

a - list()
for (i in 1:100) {
  a[[i]] - some stuff
}
Sean
On Nov 30, 2004, at 5:42 PM, Tobias Muhlhofer wrote:
I am trying to define a large number of variables through a loop 
construct.

I have my loop variable i being cycled through 1:100 and I would like 
the variables produced by this to be called

vi (i.e. v1 v2 v3 etc)
so, for example I'm going:
for(i in 1:100) {
blank - a[i:N] # or whatever else you want to put on the right side
}
where N is previously defined.
What goes in for blank?
Thanks,
Toby
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


  1   2   >