[R] Bootstrap

2004-09-22 Thread nmi13
Dear Any,

Can someone please inform me, if they have a code to estimate the varaince 
using bootstrap resampling method under a two stage cluster design.

Thanks for all your help and time.

Murthy.M.N.,
PhD, Student,
University of Canterbury,
New Zealand.

__
[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] png problem

2004-09-22 Thread Clément Calenge
Hello,
Thanks for the fast reply.
Paul Murrell wrote:
Hi
Clément Calenge wrote:
Dear R-users,
I have a small problem with the function png(), when used with the
argument colortype=pseudo.cube.
  png(toto.png, colortype=pseudo.cube)
  image(matrix(rnorm(1), 100, 100))
  dev.off()
R is blocked at the last command (R does not
print any prompt after the last command). Nothing is
written in the file (Gimp indicates that the file is corrupted).

Did you wait long enough?  This example took a little while to complete 
for me (may need someone more familiar with the code to tell us why it is 
so slow).
You're right, it took 45 minutes for me.
However, since I need to use this code to build a Sweave vignette,
I cannot use it too often (I have about thirty files to create, this
would take about 20 hours to build the vignette !).
I also need the colortype argument (some graphics cards
do not allow the compilation of the vignette without).
Does anyone knows how to speed up the process ?
Clément.

Paul

However,
  png(toto.png)
  image(matrix(rnorm(1), 100, 100))
  dev.off()
works fine.
I tried:
  options(X11colortype = pseudo.cube)
  png(toto.png)
  image(matrix(rnorm(1), 100, 100))
  dev.off()
But, here again, R is blocked. I tried to replace dev.off() by
graphics.off(), but this does not resolve the problem.
The problem does not occurs when the function X11() is used
instead of the function png().
I searched through the mail archive, the FAQ, on google,
but I did not found any solution to this problem.
On the help page on the function png(),
it is indicated that The colour handling will be that of the 'X11'
device in use.
I never used these functions before, but maybe png()
is not suitable with colortype=pseudo.cube ?
Can you tell me where I have missed something ?
Thanks in Advance,
Clément Calenge.
 version
  _
platform sparc-sun-solaris2.9
arch sparc
os   solaris2.9
system   sparc, solaris2.9
status
major1
minor9.1
year 2004
month06
day  21
language R
[[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

--
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/
==
UMR CNRS 5558 - Equipe Ecologie Statistique
Laboratoire de Biométrie et Biologie Evolutive
Université Claude Bernard Lyon 1
43, Boulevard du 11 novembre 1918
69622 Villeurbanne Cedex
FRANCE
tel. (+33) 04.72.43.27.57
fax. (+33) 04.72.43.13.88
__
[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] t test problem?

2004-09-22 Thread kan Liu
Hello,
 
I got two sets of data
x=(124738, 128233, 85901, 33806, ...)
y=(25292, 21877, 45498, 63973, )
When I did a t test, I got two tail p-value = 0.117, which is not significantly 
different.
 
If I changed x, y to log scale, and re-do the t test, I got two tail p-value = 0.042, 
which is significantly different.
 
Now I got confused which one is correct. Any help would be very appreciated.
 
Thanks,
Liu

__



[[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] t test problem?

2004-09-22 Thread Dimitris Rizopoulos
Hi Liu,
before applying a t-test (or any test) you should first check if the 
assumptions of the test are supported by your data, i.e., in a t-test 
x and y must be normally distributed.

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/396887
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
- Original Message - 
From: kan Liu [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 22, 2004 9:52 AM
Subject: [R] t test problem?


Hello,
I got two sets of data
x=(124738, 128233, 85901, 33806, ...)
y=(25292, 21877, 45498, 63973, )
When I did a t test, I got two tail p-value = 0.117, which is not 
significantly different.

If I changed x, y to log scale, and re-do the t test, I got two tail 
p-value = 0.042, which is significantly different.

Now I got confused which one is correct. Any help would be very 
appreciated.

Thanks,
Liu
__

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

__
[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] t test problem?

2004-09-22 Thread Vito Ricci
Hi,

maybe your data are distributed according a log-normal
distribution, so logs are normally distributed.
But remerber the significancy of t test can applied
only on log transformated data and not on original
data. See basic hypothesis for t testing, in
alternative use non-parametric methods to compare
results.
Best
Vito

You wrote:

Hello,
 
I got two sets of data
x=(124738, 128233, 85901, 33806, ...)
y=(25292, 21877, 45498, 63973, )
When I did a t test, I got two tail p-value = 0.117,
which is not significantly different.
 
If I changed x, y to log scale, and re-do the t test,
I got two tail p-value = 0.042, which is significantly
different.
 
Now I got confused which one is correct. Any help
would be very appreciated.
 
Thanks,
Liu

=
Diventare costruttori di soluzioni

Visitate il portale http://www.modugno.it/
e in particolare la sezione su Palese http://www.modugno.it/archivio/cat_palese.shtml



___

http://it.seriea.fantasysports.yahoo.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] t test problem?

2004-09-22 Thread Andrew Robinson
Hi Dimitris,

you are describing a more stringent requirement than the t-test
actually requires.  It's the sampling distribution of the mean that
should be normal, and this condition is addressed by the Central
Limit Theorem.

Whether or not the CLT can be invoked depends on numerous factors,
including the distribution of the sample, and the size of the sample,
neither of which we have any information about. 

Liu, the problem you describe is associated with the application of
the test rather than the test itself.  The difference between log- and
natural- scaled data can often profitably be thought about by asking
whether you would naturally assume that the variation is additive
(natural scale) or multiplicative (log scale).  Given the information
that you've presented there's no way we can tell which version of the
test is more reliable. 

I hope that this helps.

Andrew

On Wed, Sep 22, 2004 at 10:00:16AM +0200, Dimitris Rizopoulos wrote:
 Hi Liu,
 
 before applying a t-test (or any test) you should first check if the 
 assumptions of the test are supported by your data, i.e., in a t-test 
 x and y must be normally distributed.
 
 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/396887
 Fax: +32/16/337015
 Web: http://www.med.kuleuven.ac.be/biostat/
 http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
 
 
 - Original Message - 
 From: kan Liu [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Wednesday, September 22, 2004 9:52 AM
 Subject: [R] t test problem?
 
 
 Hello,
 
 I got two sets of data
 x=(124738, 128233, 85901, 33806, ...)
 y=(25292, 21877, 45498, 63973, )
 When I did a t test, I got two tail p-value = 0.117, which is not 
 significantly different.
 
 If I changed x, y to log scale, and re-do the t test, I got two tail 
 p-value = 0.042, which is significantly different.
 
 Now I got confused which one is correct. Any help would be very 
 appreciated.
 
 Thanks,
 Liu
 
 __
 
 
 
 [[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
 
 
 __
 [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


[R]

2004-09-22 Thread pbrouilly
Dear Any,

Is there a fonction in R to change a string to uppercase ?

Thanks for all your help

__
[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] ordered probit and cauchit

2004-09-22 Thread David Firth
On Wednesday, Sep 22, 2004, at 03:42 Europe/London, roger koenker wrote:
What is the current state of the R-art for ordered probit models, and 
more
esoterically is there any available R strategy for ordered cauchit 
models,
i.e. ordered multinomial alternatives with a cauchy link function.  
MCMC
is an option, obviously, but for a univariate latent variable model 
this seems
to be overkill... standard mle methods should be preferable.  (??)

A quick look at polr (in the MASS package) suggests to me that it 
wouldn't be all that hard to extend it to link functions other than 
logistic.

Is MLE known to be well behaved in these models if the latent variable 
is Cauchy?

David

Googling reveals that spss provides such functions... just to wave a 
red
flag.

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
__
[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] Ever see a stata import problem like this?

2004-09-22 Thread John Hendrickx
I've had a similar problem once. What may have caused the problem
then was a variate for which value lables had been defined for the
highest and lowest values. What complicates things is that the file
had been originally converted from SPSS to Stata. A workaround was to
set convert.factor=FALSE and that seems to work here too (using R
1.91 and the latest update for foreign): 

 m2-read.dta(morgen.dta,convert.factors=FALSE)
 summary(m2)
 CASEID  yearidhrs1 
 Min.   :   19721   Min.   :1972   Min.   :   1   Min.   :0.00  
 1st Qu.: 1983475   1st Qu.:1978   1st Qu.: 445   1st Qu.:   37.00  
 Median : 1996808   Median :1987   Median : 905   Median :   40.00  
 Mean   : 9963040   Mean   :1986   Mean   : 990   Mean   :   41.05  
 3rd Qu.:19872187   3rd Qu.:1994   3rd Qu.:1358   3rd Qu.:   48.00  
 Max.   :20002817   Max.   :2000   Max.   :3247   Max.   :   89.00  
  NA's   :17654.00  
  hrs2 prestigeagewed  age   

 Min.   :0.00   Min.   :   12.00   Min.   :   12.00   Min.   :
18.00  
 1st Qu.:   38.00   1st Qu.:   30.00   1st Qu.:   19.00   1st Qu.:
30.00  
 Median :   40.00   Median :   39.00   Median :   21.00   Median :
42.00  
 Mean   :   39.79   Mean   :   39.36   Mean   :   22.10   Mean   :
45.15  
 3rd Qu.:   45.00   3rd Qu.:   48.00   3rd Qu.:   24.00   3rd Qu.:
58.00  
 Max.   :   89.00   Max.   :   82.00   Max.   :   73.00   Max.   :
89.00  
 NA's   :40159.00   NA's   :1.00   NA's   :15551.00   NA's  
:143.00  
  educpaeduc maeducspeduc
   
 Min.   :  0.00   Min.   :0.00   Min.   :   0.00   Min.   :   
0.00  
 1st Qu.: 11.00   1st Qu.:8.00   1st Qu.:   8.00   1st Qu.:  
12.00  
 Median : 12.00   Median :   11.00   Median :  12.00   Median :  
12.00  
 Mean   : 12.48   Mean   :   10.21   Mean   :  10.41   Mean   :  
12.53  
 3rd Qu.: 14.00   3rd Qu.:   12.00   3rd Qu.:  12.00   3rd Qu.:  
14.00  
 Max.   : 20.00   Max.   :   20.00   Max.   :  20.00   Max.   :  
20.00  
 NA's   :127.00   NA's   :11586.00   NA's   :6782.00   NA's  
:18153.00  
 income
 Min.   :   1.000  
 1st Qu.:   9.000  
 Median :  11.000  
 Mean   :   9.756  
 3rd Qu.:  12.000  
 Max.   :  13.000  
 NA's   :3453.000  
 


--- Paul Johnson [EMAIL PROTECTED] wrote:

 Greetings Everybody:
 
 I generated a 1.2MB dta file based on the general social survey
 with 
 Stata8 for linux. The file can be re-opened with Stata, but when I
 bring 
 it into R, it says all the values are missing for most of the
 variables.
 
 This dataset is called morgen.dta and I dropped a copy online in
 case 
 you are interested
 
 http://www.ku.edu/~pauljohn/R/morgen.dta
 
[snip]

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

2004-09-22 Thread Manoj - Hachibushu Capital
?toupper


p.s:
By default, generally everything on this list *is* regarding R; hence it
would be nice to see a more imaginative subject line.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, September 22, 2004 5:43 PM
To: [EMAIL PROTECTED]
Subject: [R]

Dear Any,

Is there a fonction in R to change a string to uppercase ?

Thanks for all your help

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

2004-09-22 Thread Wayne Jones

The following function will do it. But be warned it will only work if all
the input strings are lower case.


Make.To.Upper.Case-function(my.string){

paste(LETTERS[match(strsplit(my.string,)[[1]],letters)],collapse=)

}

Make.To.Upper.Case(jhjhaskjdakdsj)

 [1] JHJHASKJDAKDSJ




-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: 22 September 2004 09:43
To: [EMAIL PROTECTED]
Subject: [R]

Dear Any,

Is there a fonction in R to change a string to uppercase ?

Thanks for all your help

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


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] convert string to uppercase; was: nothing

2004-09-22 Thread Uwe Ligges
[EMAIL PROTECTED] wrote:
Dear Any,
Is there a fonction in R to change a string to uppercase ?
Thanks for all your help
__
[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
Please read the posting guide and learn
a) to use a sensible subject line
b) to use R's help facilities
You are looking for
?toupper
Uwe Ligges
__
[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]

2004-09-22 Thread Arne Henningsen
help.search(upper)
chartr(base)Character Translation and Casefolding

?chartr 
refers to the function
toupper()

Best wishes,
Arne

On Wednesday 22 September 2004 10:43, [EMAIL PROTECTED] 
wrote:
 Dear Any,

 Is there a fonction in R to change a string to uppercase ?

 Thanks for all your help

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


Re: [R] t test problem?

2004-09-22 Thread kan Liu
Hi, Many thanks for your helpful comments and suggestions. The attached are the data 
in both log10 scale and original scale. It would be very grateful if you could suggest 
which version of test should be used. 
 
By the way, how to check whether the variation is additive (natural scale) or 
multiplicative (log scale) in R? How to check whether the distribution of the data is 
normal? 
 
PS, Can I confirm that do your suggestions mean that in order to check whether there 
is a difference between x and y in terms of mean I need check the distribution of x 
and that of y in both natual and log scales and to see which present normal 
distribution? and then perform a t test using the data scale which presents normal 
distribution? If both scales present normal distribution, then the t tests with both 
scales should give the similar results?
 
 
 
Thanks again.
 
Liu

Andrew Robinson [EMAIL PROTECTED] wrote:
Hi Dimitris,

you are describing a more stringent requirement than the t-test
actually requires. It's the sampling distribution of the mean that
should be normal, and this condition is addressed by the Central
Limit Theorem.

Whether or not the CLT can be invoked depends on numerous factors,
including the distribution of the sample, and the size of the sample,
neither of which we have any information about. 

Liu, the problem you describe is associated with the application of
the test rather than the test itself. The difference between log- and
natural- scaled data can often profitably be thought about by asking
whether you would naturally assume that the variation is additive
(natural scale) or multiplicative (log scale). Given the information
that you've presented there's no way we can tell which version of the
test is more reliable. 

I hope that this helps.

Andrew

On Wed, Sep 22, 2004 at 10:00:16AM +0200, Dimitris Rizopoulos wrote:
 Hi Liu,
 
 before applying a t-test (or any test) you should first check if the 
 assumptions of the test are supported by your data, i.e., in a t-test 
 x and y must be normally distributed.
 
 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/396887
 Fax: +32/16/337015
 Web: http://www.med.kuleuven.ac.be/biostat/
 http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
 
 
 - Original Message - 
 From: kan Liu 
 To: 
 Sent: Wednesday, September 22, 2004 9:52 AM
 Subject: [R] t test problem?
 
 
 Hello,
 
 I got two sets of data
 x=(124738, 128233, 85901, 33806, ...)
 y=(25292, 21877, 45498, 63973, )
 When I did a t test, I got two tail p-value = 0.117, which is not 
 significantly different.
 
 If I changed x, y to log scale, and re-do the t test, I got two tail 
 p-value = 0.042, which is significantly different.
 
 Now I got confused which one is correct. Any help would be very 
 appreciated.
 
 Thanks,
 Liu
 
 __
 
 
 
 [[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
 
 
 __
 [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 441133 W : http://www.uidaho.edu/~andrewr
Moscow ID 83843 Or: http://www.biometrics.uidaho.edu
No statement above necessarily represents my employer's opinion.



-

x   y
37154   32211
114815  124738
10  128233
10  96383
10  85901
371535  338065
10  151008
56234   48978
34674   62087
758578  542001
14125   25645
26915   31696
10  119950
72444   56105
63096   39084
10  131522
33113   68077
37154   30409
26915   31842
70795   24322
93325   74989
10  101859
43652   50119
120226  86497
10  159956
10  44668
10  52602
10  82794
57544   24774
30200   19055
10  56624
10  39719
53703   51286
70795   17258
66069   52000
87096   140605
58884   36141
63096   74645
44668   32359
10  84140
15136   26915
43652   35075
794328  901571
20417   16218
147911  115345
57544   87498
10  73621
14454   19953
10  59429
72444   37670
199526  210378
38905   41020
79433   111944
10  141254
10  92045
23442   22751
18197   20606
316228  345144
83176   154170
48978   33806
10  84723
10  158855
20893   13552
141254  127350
67608   24774
10965   9290
17378   17742
120226  105925
23442   16943
56234   53211
66069   36392
38019   49774
75858   84140
42658   50466
56234   49204
12303   12474
120226  110154
131826  208449
104713  11508
70795   106905

[R] Create bitmap graphic in C

2004-09-22 Thread Bruno Nogent
Hello,
How to create a R graphic bitmap with C or C++
using R api ?


Thanks, samples, ... ?


[[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] t test problem?

2004-09-22 Thread Andrew Robinson
 Hi, Many thanks for your helpful comments and suggestions. 

You're welcome.

 The attached are the data in both log10 scale and original scale. It
 would be very grateful if you could suggest which version of test
 should be used.

I feel that it would be inappropriate.  It depends on the origin
of the data.  You, as the analyst, must make that decision.  If you're
analyzing the data for someone else, then you should make that
decision with their input, or have them make it.

 By the way, how to check whether the variation is additive (natural
 scale) or multiplicative (log scale) in R? 

Unfortuantely you can't do that.  It depends on the context of the
data, which is not amenable to testing.

 How to check whether the distribution of the data is normal?

Tests exist for this, but there are problems with their usage.  Try
searching the help or your preferred search engine for more information.

 PS, Can I confirm that do your suggestions mean that in order to
 check whether there is a difference between x and y in terms of mean
 I need check the distribution of x and that of y in both natual and
 log scales and to see which present normal distribution? 

No, I don't agree with that statement, and I don't think that it
reflects my earlier message.

 and then perform a t test using the data scale which presents normal
 distribution?

Again, I don't agree.  I would advise you to apply the appropriate
test (maybe a t test, maybe not) to the data on the scale that is
suggested by the sampling scheme, the origin of the data, and the
hypothesis that interests you.

I hope that this helps.

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


[R] t test problem?

2004-09-22 Thread Vito Ricci
Hi Liu,

I'd suggest you to use non-parametric tests (see 
http://www.cas.lancs.ac.uk/glossary_v1.1/nonparam.html)
such as:
wilcox.test() in stats package
pairwise.wilcox.test() in stats package

and see the result tou got (significancy/non
significancy) and compare it with t test result;

Parametric Test   Analogous Non-Parametric test 

Student T-test   Wilcoxon Rank Sum Test 
Paired t-testWilcoxon Signed Rank Test or the Sign
Test 

to test normality you can use:

shapiro.test() in stats package 

if you decide to use log scale, you must use this for
both samples.



bye
Vito


You wrote:

Hi, Many thanks for your helpful comments and
suggestions. The attached are the data in both log10
scale and original scale. It would be very grateful if
you could suggest which version of test should be
used. 
 
By the way, how to check whether the variation is
additive (natural scale) or multiplicative (log scale)
in R? How to check whether the distribution of the
data is normal? 
 
PS, Can I confirm that do your suggestions mean that
in order to check whether there is a difference
between x and y in terms of mean I need check the
distribution of x and that of y in both natual and log
scales and to see which present normal distribution?
and then perform a t test using the data scale which
presents normal distribution? If both scales present
normal distribution, then the t tests with both scales
should give the similar results?
 
 
 
Thanks again.
 
Liu

=
Diventare costruttori di soluzioni

Visitate il portale http://www.modugno.it/
e in particolare la sezione su Palese http://www.modugno.it/archivio/cat_palese.shtml



___

http://it.seriea.fantasysports.yahoo.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] Bootstrap

2004-09-22 Thread Ingmar Visser
did you look at library(boot) ?boot

On 9/22/04 9:19 AM, nmi13 [EMAIL PROTECTED] wrote:

 Dear Any,
 
 Can someone please inform me, if they have a code to estimate the varaince
 using bootstrap resampling method under a two stage cluster design.
 
 Thanks for all your help and time.
 
 Murthy.M.N.,
 PhD, Student,
 University of Canterbury,
 New Zealand.
 
 __
 [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] t test problem?

2004-09-22 Thread Wayne Jones
Hi Kan Lui, 

I've had a quick look at the data. The logged data seems reasonably nicely
distributed (roughly symmetrical + equal variance). Indeed the y variable
passed the (very strict) shapiro.test for normality. 

However the main problem is that I do not get the same results as you for
the significance of the t.test. 

The only significant test I see is the paired t.test on the logged data. Is
your data paired data? To see what I mean check out:
http://www.texasoft.com/winkpair.html

The non-parametric tests show no significance (paired data or not) (logged
and natural data). Although in general they do tend to be less strict than
parametric tests. 

Unless the data is paired then the means of these samples most certainly do
not significantly differ from one another.



Here are my workings: 

Temp.Dat-read.table(data_natural.txt,header=T)


hist(log(Temp.Dat$x,10))
hist(log(Temp.Dat$y,10))

shapiro.test(log(Temp.Dat$x,10))
shapiro.test(log(Temp.Dat$y,10))

t.test(log(Temp.Dat$x,10), log(Temp.Dat$y,10))


   Welch Two Sample t-test

data:  log(Temp.Dat$x, 10) and log(Temp.Dat$y, 10) 
t = 0.9126, df = 195.806, p-value = 0.3626
alternative hypothesis: true difference in means is not equal to 0 
95 percent confidence interval:
 -0.0599837  0.1633168 
sample estimates:
mean of x mean of y 
 4.891313  4.839647


 t.test(log(Temp.Dat$x,10), log(Temp.Dat$y,10),paired=T)

Paired t-test

data:  log(Temp.Dat$x, 10) and log(Temp.Dat$y, 10) 
t = 2.3535, df = 98, p-value = 0.02060
alternative hypothesis: true difference in means is not equal to 0 
95 percent confidence interval:
 0.008101002 0.095232132 
sample estimates:
mean of the differences 
 0.05166657 

 wilcox.test(log(Temp.Dat$x,10), log(Temp.Dat$y,10),paired=T)

Wilcoxon signed rank test with continuity correction

data:  log(Temp.Dat$x, 10) and log(Temp.Dat$y, 10) 
V = 2972.5, p-value = 0.0828
alternative hypothesis: true mu is not equal to 0 

 wilcox.test(log(Temp.Dat$x,10), log(Temp.Dat$y,10),paired=F)

Wilcoxon rank sum test with continuity correction

data:  log(Temp.Dat$x, 10) and log(Temp.Dat$y, 10) 
W = 5206, p-value = 0.4491
alternative hypothesis: true mu is not equal to 0



 wilcox.test(Temp.Dat$x, Temp.Dat$y,paired=F)

Wilcoxon rank sum test with continuity correction

data:  Temp.Dat$x and Temp.Dat$y 
W = 5206, p-value = 0.4491
alternative hypothesis: true mu is not equal to 0 

 wilcox.test(Temp.Dat$x, Temp.Dat$y,paired=T)

Wilcoxon signed rank test with continuity correction

data:  Temp.Dat$x and Temp.Dat$y 
V = 2896.5, p-value = 0.1417
alternative hypothesis: true mu is not equal to 0 

 t.test(Temp.Dat$x, Temp.Dat$y,paired=T)

Paired t-test

data:  Temp.Dat$x and Temp.Dat$y 
t = 1.6731, df = 98, p-value = 0.0975
alternative hypothesis: true difference in means is not equal to 0 
95 percent confidence interval:
 -2351.81 27623.53 
sample estimates:
mean of the differences 
   12635.86 

 t.test(Temp.Dat$x, Temp.Dat$y,paired=F)

Welch Two Sample t-test

data:  Temp.Dat$x and Temp.Dat$y 
t = 0.6432, df = 191.177, p-value = 0.5209
alternative hypothesis: true difference in means is not equal to 0 
95 percent confidence interval:
 -26116.18  51387.89 
sample estimates:
mean of x mean of y 
 120544.9  107909.0 



-Original Message-
From: kan Liu [mailto:[EMAIL PROTECTED] 
Sent: 22 September 2004 10:22
To: Andrew Robinson; Dimitris Rizopoulos
Cc: [EMAIL PROTECTED]
Subject: Re: [R] t test problem?

Hi, Many thanks for your helpful comments and suggestions. The attached are
the data in both log10 scale and original scale. It would be very grateful
if you could suggest which version of test should be used. 
 
By the way, how to check whether the variation is additive (natural scale)
or multiplicative (log scale) in R? How to check whether the distribution of
the data is normal? 
 
PS, Can I confirm that do your suggestions mean that in order to check
whether there is a difference between x and y in terms of mean I need check
the distribution of x and that of y in both natual and log scales and to see
which present normal distribution? and then perform a t test using the data
scale which presents normal distribution? If both scales present normal
distribution, then the t tests with both scales should give the similar
results?
 
 
 
Thanks again.
 
Liu

Andrew Robinson [EMAIL PROTECTED] wrote:
Hi Dimitris,

you are describing a more stringent requirement than the t-test
actually requires. It's the sampling distribution of the mean that
should be normal, and this condition is addressed by the Central
Limit Theorem.

Whether or not the CLT can be invoked depends on numerous factors,
including the distribution of the sample, and the size of the sample,
neither of which we have any information about. 

Liu, the problem you describe is associated with the application of
the test rather than the test itself. The difference between log- and
natural- scaled data 

RE: [R] is.constant

2004-09-22 Thread Liaw, Andy
 Christian Hoffmann
 
 x - c(1, 2, NA)
 is.constant(x)
  
  [1] TRUE
  
  For data such as c(1, 1, 1, NA), I should think the safest 
 answer should be
  NA, because one really doesn't know whether that last 
 number is 1 or not.
  
  Andy
   
 My version is
 is.constant -  function(x) {
if (is.numeric(x)  !any(is.na(x)))  identical(min(x), 
 max(x)) else FALSE
 }
 
 rendering
   is.constant(c(1,1,NA))
 [1] FALSE

As I said, the `safest' thing is to return NA, as the NA could be 1, or it
could be something else.  We just don't know.  It's probably a cleaner style
to have is.constant() return NA in the case that the input contains contants
and some NAs, and TRUE or FALSE otherwise; e.g., is.constant(c(1,2,NA))
should clearly be FALSE.  Then the output of is.constant() should be checked
for possible NA.

Just my $0.02...

Andy

   is.constant(c(1,1,NaN))
 [1] FALSE
   is.constant(rep(c(sin(pi/2),1),10)) # TRUE
 [1] TRUE
 -- 
 Dr.sc.math.Christian W. Hoffmann, 
 http://www.wsl.ch/staff/christian.hoffmann
 Mathematics + Statistical Computing   e-mail: 
 [EMAIL PROTECTED]
 Swiss Federal Research Institute WSL  Tel: ++41-44-73922-   
 -77  (office)
 CH-8903 Birmensdorf, Switzerland -11(exchange), -15  (fax)
 
 __
 [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] asypow.noncent. Thanks!!

2004-09-22 Thread david_foreman
Thank y'all for a) pointing out what I was doing wrong b) being so patient with what, 
in retrospect, was such an obvious blunder by me.  I'm afraid I was confused by the 
accompanying pdf file, which is not entirely consistent with the help files.


___
Most doctors use http://www.Doctors.net.uk e-mail.
Move to a free professional address with spam and virus protection.

__
[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] Re: R-help Digest, Vol 19, Issue 22

2004-09-22 Thread Richard Valliant
I will be out of the office 9/22/04 - 9/27/04. For immediate help,
please call the JPSM main number, 301-314-7911.

__
[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] function to change a string to uppercase

2004-09-22 Thread Stefan Drees
On Wed, Sep 22, 2004 at 10:43:18AM +0200 - a wonderful day 
- [EMAIL PROTECTED] wrote:
 Is there a fonction in R to change a string to uppercase ?
toupper()

hint: basic functionality is in package base ;) which is 
easy to investigate in html-help - packages in my installation 
second entry from top of list ...

All the best,
Stefan.
-- 
.o. e-mail: [EMAIL PROTECTED], web: www.sdrees.org, +49 700 SDREESDE
..o fingerprint = 516C C4EF 712A B26F 15C9  C7B7 5651 6964 D508 1B56
ooo  stefan drees  -  consulting and lecturing  -  problems to tasks

__
[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] impenetrable warning

2004-09-22 Thread Simon.Bond
Dear R-help,

Can anyone explain the meaning of  the warning,

Singular precision matrix in level -1, block 1

? Or how to track down where it comes from?

More precisely, using the nlme package, I'm issued with the warning

itt2 - lme(lrna~rx.nrti+lbrna, random=~1|patid,
cor=corExp(form=~days|patid,nugget=T), weights=varPower(
form=~lbrna),data=rna3)
Warning messages:
1: Singular precision matrix in level -1, block 1
2: Singular precision matrix in level -1, block 1

the output is:

Linear mixed-effects model fit by REML
  Data: rna3
  Log-restricted-likelihood: -4990.142
  Fixed: lrna ~ rx.nrti + lbrna
   (Intercept) rx.nrtiZDV+3TC rx.nrtiZDV+ABC  lbrna
 2.6597552  0.8589514  0.4259504  0.2929222

Random effects:
 Formula: ~1 | patid
(Intercept)  Residual
StdDev:1.251113 0.2105329

Correlation Structure: Exponential spatial correlation
 Formula: ~days | patid
 Parameter estimate(s):
  range  nugget
204.6422150   0.3349336
Variance function:
 Structure: Power of variance covariate
 Formula: ~lbrna
 Parameter estimates:
power
0.9733358
Number of Observations: 2390
Number of Groups: 124



Thanks,

Simon Bond.

__
[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] capitalize etc string

2004-09-22 Thread Christian Hoffmann
Dear Any,
Is there a fonction in R to change a string to uppercase ?
Thanks for all your help
Use the following:
capply - function(str, ff) {
  sapply(lapply(strsplit(str, NULL), ff), paste, collapse=)
}
cap - function(char) {
  # change lower letters to upper, others leave unchanged
  if (any(ind - letters==char)) LETTERS[ind]
  else char
}
capitalize - function(str) { # vector of words
  ff - function(x) paste(lapply(unlist(strsplit(x, 
NULL)),cap),collapse=)
  capply(str,ff)
}

lower - function(char) {
  # change upper letters to lower, others leave unchanged
  if (any(ind - LETTERS==char)) letters[ind]
  else char
}
lowerize - function(str) {
  ff - function(x) paste(lapply(unlist(strsplit(x, 
NULL)),lower),collapse=)
  capply(str,ff)
}

CapLeading - function(str) {
  ff - function(x) {r - x; r[1]-cap(x[1]); r}
  capply(str,ff)
}
#cap(f)
#cap(R)
#capitalize(c(TruE,faLSe))
#capitalize(c(faLSe,TruE))
#lower(f)
#lower(R)
#lowerize(TruE)
#lowerize(faLSe)
--
Dr.sc.math.Christian W. Hoffmann, 
http://www.wsl.ch/staff/christian.hoffmann
Mathematics + Statistical Computing   e-mail: [EMAIL PROTECTED]
Swiss Federal Research Institute WSL  Tel: ++41-44-73922-   -77  (office)
CH-8903 Birmensdorf, Switzerland -11(exchange), -15  (fax)

__
[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] t test problem?

2004-09-22 Thread Ted Harding
On 22-Sep-04 kan Liu wrote:
 Hi, Many thanks for your helpful comments and suggestions. The attached
 are the data in both log10 scale and original scale. It would be very
 grateful if you could suggest which version of test should be used. 
  
 By the way, how to check whether the variation is additive (natural
 scale) or multiplicative (log scale) in R? How to check whether the
 distribution of the data is normal? 

As for additive vs multiplicative, this can only be judged in terms
of the process by which the values are created in the real world.
As for normality vs non-normality, an appraisal can often be made
simply by looking at a histogram of the data.

In your case, the commands
  hist(x,breaks=1*(0:100))
  hist(y,breaks=1*(0:100))
indicate that the distributions of x and y do not look at all
normal, since they both have considerable positive skewness
(i.e. long upper tails relative to the main mass of the distribution).

This does strongly suggest that a logarithmic transformation would
give data which are more nearly normally distributed, as indeed
is confirmed by the commands
  hist(log(x))
  hist(log(y))
though in both cases the histograms show some irregularity compared
with what you would expect from a sample from a normal distribution:
the commands
  hist(log(x),breaks=0.2*(40:80))
  hist(log(y),breaks=0.2*(40:80))
show that log(x) has an excessive peak at around 11.7,
while log(y) has holes at around 11.1 and 12.1.

Nevertheless, this inspection of the data shows that the use of
log(x) and log(y) will come much closer to fulfilling the conditions
of validity of the t test than using the raw data x and y.

However, it is not merely the *normality* of each which is needed:
the conditions for the usual t test also require that the two
populations sampled for log(x) and log(y) should have the same
standard deviations. In your case, this also turns out to be
nearly enough true:

   sd(log(x))
  [1] 0.902579
   sd(log(y))
  [1] 0.9314807

 PS, Can I confirm that do your suggestions mean that in order to check
 whether there is a difference between x and y in terms of mean I need
 check the distribution of x and that of y in both natual and log scales
 and to see which present normal distribution?

See above for an approach to this: the answer to your question is,
in effect, yes. It could of course have happened that neither the
raw nor the log scale would be satisfactory, in which case you would
need to consider other possibilities. And, if the SDs had turned out
to be very different, you should not use the standard t test but
a variant which is adpated to the situation (e.g. the Welch test).

You can, of course, also perform formal tests for skewness, for
normality, and for equality of variances.

Best wishes,
Ted.



E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861   [NB: New number!]
Date: 22-Sep-04   Time: 12:07:07
-- 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


[R] is.constant 2

2004-09-22 Thread Christian Hoffmann
x - c(1, 2, NA)
is.constant(x)


 [1] TRUE

 For data such as c(1, 1, 1, NA), I should think the safest answer 
should be
 NA, because one really doesn't know whether that last number is 1 or 
not.

 Andy


My version is
is.constant -  function(x) {
   if (is.numeric(x)  !any(is.na(x)))  identical(min(x), max(x)) else 
FALSE
}

Since the issue of factors surfaced, I improved my function:
is.constant -  function(x) {
  if (is.factor(x)) (length(attributes(x)$levels)==1)  
(!any(is.na(as.character(x
  else (is.numeric(x)  !any(is.na(x))  identical(min(x), max(x)))
}

 is.constant(rep(c(sin(pi/2),1),10)) # TRUE
 x - factor(c(1,1,NA))
 is.constant(x)# FALSE because of NA
 is.constant(x[1:2])   # TRUE
 is.constant(c(1,1,NA))# FALSE because of NA
 is.constant(c(1,1,2)) # FALSE
 is.constant(c(1,1,1)) # TRUE
--
Dr.sc.math.Christian W. Hoffmann, 
http://www.wsl.ch/staff/christian.hoffmann
Mathematics + Statistical Computing   e-mail: [EMAIL PROTECTED]
Swiss Federal Research Institute WSL  Tel: ++41-44-73922-   -77  (office)
CH-8903 Birmensdorf, Switzerland -11(exchange), -15  (fax)

__
[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] Residuals, smoothers and estimates of noise

2004-09-22 Thread Crabb, David
We have a clinical measurement on patients over time. Each patient has
about 5 of these measurements over a period of two years, but the
measurement are not necessarily taken at equal space in time. We want to
use this data to establish test-retest variability. My first thought was
to look at the residuals from fitting simple linear regression (the
measurement may deteriorate over time and we wish to remove this trend
-assuming of course that it is linear). But then what residual do I
choose to represent the variability for each patient? Would it be good
to use the mean of these? Has anyone got any better solutions with some
known functions in R? Do running medians or other smoothers require the
data to be a time series with equal spaces between time points?

Any help/references/suggestions in R would be gratefully received.

---
Dr. David Crabb
School of Science,
The Nottingham Trent University,
Clifton Campus, Nottingham. NG11 8NS
Tel: 0115 848 3275   Fax: 0115 848 6690

__
[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] loops: pasting indexes in variables names

2004-09-22 Thread Umberto Maggiore
I cannot figure out how, using R, I can paste indexes or characters to the 
variable
names which are used within loops. I will explain this with a simple 
example:
Immagine I have a huge series of variables, each one taken two times, say
x1 x2 y1 y2 z1 z2.
Now, immagine that I want to compute a variable from the difference of
each couple, say dx=x1-x2, dy=y1-y2, dz=z1-z2...
In Stata, for example,  this wold be straightforward:
foreach i in x y z   {
		gen  d`i'= `i'1-`i'2
		}
With R I tried to use paste( ) but I found that it applies to objects,
not to variable names.
best regards,
Umberto

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

2004-09-22 Thread Gabor Grothendieck
Christian Hoffmann christian.hoffmann at wsl.ch writes:

 
 x - c(1, 2, NA)
  is.constant(x)
  
  
   [1] TRUE
  
   For data such as c(1, 1, 1, NA), I should think the safest answer 
 should be
   NA, because one really doesn't know whether that last number is 1 or 
 not.
  
   Andy
  
 
  My version is
  is.constant -  function(x) {
 if (is.numeric(x)  !any(is.na(x)))  identical(min(x), max(x)) else 
  FALSE
  }
 
 Since the issue of factors surfaced, I improved my function:
 
 is.constant -  function(x) {
if (is.factor(x)) (length(attributes(x)$levels)==1)  
 (!any(is.na(as.character(x
else (is.numeric(x)  !any(is.na(x))  identical(min(x), max(x)))
 }

Suggest you use an S3 generic and a separate methods for factor, and
in the future, other classes.  Also to make it more consistent with
other R functions have an na.rm= argument which defaults to TRUE.
If na.rm = FALSE then it should return NA  there are any NAs in
the same way that sum(c(1,2,NA), na.rm = FALSE) returns NA. There is 
some question of how to handle zero length arguments (or ones
that become zero length after removing NAs).

is.constant - function(x, ...) UseMethod(is.constant)
is.constant.factor - function(x, na.rm = TRUE) ... code for factor ...
is.constant.default - function(x, na.rm = TRUE) ... code for default ...

__
[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] impenetrable warning

2004-09-22 Thread Liaw, Andy
Generally you can set options(warn=2), run the code, then do traceback().

Andy

 From: Simon.Bond
 
 Dear R-help,
 
 Can anyone explain the meaning of  the warning,
 
 Singular precision matrix in level -1, block 1
 
 ? Or how to track down where it comes from?
 
 More precisely, using the nlme package, I'm issued with the warning
 
 itt2 - lme(lrna~rx.nrti+lbrna, random=~1|patid,
 cor=corExp(form=~days|patid,nugget=T), weights=varPower(
 form=~lbrna),data=rna3)
 Warning messages:
 1: Singular precision matrix in level -1, block 1
 2: Singular precision matrix in level -1, block 1
 
 the output is:
 
 Linear mixed-effects model fit by REML
   Data: rna3
   Log-restricted-likelihood: -4990.142
   Fixed: lrna ~ rx.nrti + lbrna
(Intercept) rx.nrtiZDV+3TC rx.nrtiZDV+ABC  lbrna
  2.6597552  0.8589514  0.4259504  0.2929222
 
 Random effects:
  Formula: ~1 | patid
 (Intercept)  Residual
 StdDev:1.251113 0.2105329
 
 Correlation Structure: Exponential spatial correlation
  Formula: ~days | patid
  Parameter estimate(s):
   range  nugget
 204.6422150   0.3349336
 Variance function:
  Structure: Power of variance covariate
  Formula: ~lbrna
  Parameter estimates:
 power
 0.9733358
 Number of Observations: 2390
 Number of Groups: 124
 
 
 
 Thanks,
 
 Simon Bond.
 
 __
 [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] loops: pasting indexes in variables names

2004-09-22 Thread Dimitris Rizopoulos
Hi Umberto,
look at ?get, ?assign, ?paste and try the following:
x1 - rnorm(10)
x2 - rnorm(10)
y1 - rnorm(10)
y2 - rnorm(10)
z1 - rnorm(10)
z2 - rnorm(10)
##
names. - c(x, y, z)
for(i in names.){
   res1 - get(paste(i,1,sep=))
   res2 - get(paste(i,2,sep=))
   assign(paste(d,i,sep=), res1-res2)
}
###
all.equal(dx, x1-x2)
all.equal(dy, y1-y2)
all.equal(dz, z1-z2)
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/396887
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
- Original Message - 
From: Umberto Maggiore [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, September 22, 2004 2:12 PM
Subject: [R] loops: pasting indexes in variables names


I cannot figure out how, using R, I can paste indexes or characters 
to the variable
names which are used within loops. I will explain this with a simple 
example:
Immagine I have a huge series of variables, each one taken two 
times, say
x1 x2 y1 y2 z1 z2.
Now, immagine that I want to compute a variable from the difference 
of
each couple, say dx=x1-x2, dy=y1-y2, dz=z1-z2...
In Stata, for example,  this wold be straightforward:
foreach i in x y z   {
gen  d`i'= `i'1-`i'2
}
With R I tried to use paste( ) but I found that it applies to 
objects,
not to variable names.
best regards,
Umberto

__
[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] loops: pasting indexes in variables names

2004-09-22 Thread Gabor Grothendieck
Umberto Maggiore umberto_maggiore at hotmail.com writes:

 
 I cannot figure out how, using R, I can paste indexes or characters to the 
 variable
 names which are used within loops. I will explain this with a simple 
 example:
 Immagine I have a huge series of variables, each one taken two times, say
 x1 x2 y1 y2 z1 z2.
 Now, immagine that I want to compute a variable from the difference of
 each couple, say dx=x1-x2, dy=y1-y2, dz=z1-z2...
 In Stata, for example,  this wold be straightforward:
 foreach i in x y z   {
   gen  d`i'= `i'1-`i'2
   }
 With R I tried to use paste( ) but I found that it applies to objects,
 not to variable names.
 best regards,
 Umberto

You can try this:

paste. - function(...) paste(..., sep = )
for(i in c(x, y, z))
   assign(paste.(d, i), get(paste.(i, 1) - paste.(i, 2)))

You also might review why you need this since you may prefer
to use vectors, matrices, arrays, lists or data frames for
this sort of processing.  For example, if they were in a data
frame, DF, then you could write:

   DF[,1] - DF[,2]

and perform all the subtractions at once.

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

2004-09-22 Thread Duncan Murdoch
On Wed, 22 Sep 2004 12:16:10 + (UTC), Gabor Grothendieck
[EMAIL PROTECTED] wrote :

Suggest you use an S3 generic and a separate methods for factor, and
in the future, other classes.  

That's not a bad idea, but is it really worth the trouble?  Why not
piggyback on the unique() generic, and define it as something like

is.constant - function(x, na.rm = FALSE, ...) {
  vals - unique(x, ...)
  if (na.rm) vals - vals[!is.na(vals)]
  
  # What should the value be for c(1, NA)?  If FALSE is wanted,

  length(vals) == 1

  # but if NA is desired

  #  ifelse (any(is.na(vals)),  NA, length(vals) == 1)
}

Also to make it more consistent with
other R functions have an na.rm= argument which defaults to TRUE.

The more common default is FALSE.

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] dot density maps

2004-09-22 Thread Johannes SCHNITZLER
Dear All,

 

In the moment i'm using the map and maptools package to read shapefiles
and display the maps. 

I'm looking for the possibility to draw points (randomly positioned or
positioned according to a grid) into the polygons instead of filling the
polygons with colors.

 

For example: 

a map (shapefile) with 10 countries, 15 points in the polygon of country
A, 20 points in the polygon of country B.

 

 

Thank you in advance for your help

 

Johannes 


[[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] loops: pasting indexes in variables names

2004-09-22 Thread Peter Wolf
Umberto Maggiore wrote:
I cannot figure out how, using R, I can paste indexes or characters to 
the variable
names which are used within loops. I will explain this with a simple 
example:
Immagine I have a huge series of variables, each one taken two times, say
x1 x2 y1 y2 z1 z2.
Now, immagine that I want to compute a variable from the difference of
each couple, say dx=x1-x2, dy=y1-y2, dz=z1-z2...
In Stata, for example,  this wold be straightforward:
foreach i in x y z   {
gen  d`i'= `i'1-`i'2
}
With R I tried to use paste( ) but I found that it applies to objects,
not to variable names.
best regards,
Umberto

__
[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
Try:
x1-10
x2-20
y1-5
y2-22
z1-4
z2-7
for(i in c(x,y,z)){
 eval(parse(text=paste(d,i,-,i,1 - ,i,2,sep=)))
}
ls(pattern=d)
output-start
Wed Sep 22 14:38:28 2004
[1] dx dy dz
output-end
but why don't  you  store x1,y1,z1  and x2,y2,z2  in a list:
a-list(x=1:4, y=1:7, z=1:5)
b-list(x=(1:4)*10, y=1:7, z=(1:5)-20)
d-sapply(1:3, function(i) a[[i]]-b[[i]] )
@
output-start
Wed Sep 22 14:43:09 2004
[[1]]
[1]  -9 -18 -27 -36
[[2]]
[1] 0 0 0 0 0 0 0
[[3]]
[1] 20 20 20 20 20
output-end
Peter Wolf
__
[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] DCOM server high quality graphics ?

2004-09-22 Thread Bruno Nogent
I'm using c# and I can produce some graphics with the DCOM Server on R
but the graphics's quality is very bad, fonts problems, anti-aliasing ?

How to produce high quality graphics with the DCOM server
[[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] Multinomial Response Variable: Estimating the parameters

2004-09-22 Thread Martin Plöderl
Hello!
In a dyslexia-spelling-study we have a multinomial response variable 
with four categories.
There are 12 subjects. Each subject was tested on 30 words, i.e. there 
are 30 responses for each subject.
We are interested in estimating the parameters pi1, pi2, pi3, pi4, if 
possible point estimates and confidence intervals.
Is there a possibility in R to conduct this analysis?

--
Dr. Martin Plöderl
Universität Salzburg
Fachbereich Psychologie
Abteilung Sozialpsychologie
Hellbrunnerstr. 34
5020 Salzburg
Phone: +43 662 8044 5130
[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] R course

2004-09-22 Thread Highland Statistics Ltd.
Apologies for cross-posting
We would like to announce a 3 day course: R programming for beginners.
When: 10-12 January 2005 (Monday-Wednesday).
Location: The Ythan hotel in Newburgh (UK).  Newburgh is a small coastal 
village 10 miles north of Aberdeen airport.
Host: Organised by Highland Statistics Ltd.
Price: 500 Euro for 3 days, excluding 17.5% VAT. The course fee includes a 
copy of Introductory Statistics with R by P. Dalgaard.
You will need to bring you own laptop.
Accommodation is available at the Ythan hotel at a special rate of 30 UK 
pounds per night (including breakfast). Early booking is essential!

In this course, we teach how to use and program in the software package R. 
It is also relevant for S-Plus users who wish to learn script programming. 
The book Introductory Statistics with R from Peter Dalgaard is used as 
course material. We discuss how to import data into R, define vectors and 
nominal variables, make exploratory graphs, and apply ANOVA and linear 
regression. We assume that course attendants are familiar with the basic 
aspects of regression and ANOVA. Course attendants are encouraged to bring 
their own data.

There is only place for 10 people on this course.
Registration:   http://www.brodgar.com/statscourse.htm

Kind regards,
Alain Zuur

Dr. Alain F. Zuur
Highland Statistics Ltd.
6 Laverock road
UK - AB41 6FN Newburgh
Tel: 0044 1358 788177
Email: [EMAIL PROTECTED]
URL: www.highstat.com
URL: www.brodgar.com  (Brodgar complies with R GNU license)
Our 5-day statistics course: Analysing Biological and Environmental Field 
data
Brodgar: Software for multivariate analysis and multivariate time series 
analysis

Statistical consultancy, courses, data analysis and software
__
[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] RMySQL and Blob

2004-09-22 Thread David James
Hi Jonathan,

Currently RMySQL doesn't handle blob objects.  The mechanics of
inserting and extracting blob objects by itself is not too hard,
but issues such as how should blobs be made available to R, how to
prevent buffers overflows, how to prevent huge blobs from exhausting
the available memory, should R callback functions be invoked
as chunks of the blob are brought in, etc., need more consideration.
And these issues are not R/MySQL specific, but also relevant to
other databases and other non-dbms interfaces.

BTW there are R facilities (e.g., external pointers, finalizers) that 
seems quite important for this type of implementation.  

What type and how big are the blobs that want to import?

--
David

[EMAIL PROTECTED] wrote:
 Dear R experts,
 
 Does RMySQL package handle Blob datatype in a MySQL database? Blob can represent an 
 image, a sound or some other 
 large and complex binary objects. In an article published by R-database special 
 interest group, named A common database interface (DBI) (updated June 2003),  it's 
 mentioned in open issues and limitations that We need to carefully plan how to 
 deal with binary objects. 
 
 Before I invest time to try, I would appreciate any experts' opinions.
 
 Thanks,
 Jonathan
 
 __
 [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] R 1.9.1 Fails to Start on WinXP SP2

2004-09-22 Thread Scott Higginbotham
One other suggestion:

Run the msconfig System configuration utility to turn off most of
the software that loads on your machine at startup, and see if that
allows R to start.  Then gradually add it back until you find the
culprit, if there is one.

Bingo! You rock Duncan. I had Rage3D (a video card overclocking utility)
installed on the machine that wouldn't run R and I was able to isolate
that as the problem. Once I uninstalled it, everything worked perfectly.

Thanks a million!

Scott

__
[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] layout for xyplot

2004-09-22 Thread Jacques VESLOT
Dear all,

I tried to use layout argument in xyplot to get one panel per page.

I have a dataframe named 'data' with the following variables:

x, y = coords,
sub, bloc = 2-level factors,
etat = 5-level factor,


I did :

   lset(theme = col.whitebg())
   xyplot(y ~ x | bloc*sub , data=data, groups=etat,
+   layout=c(0,1,4),
+   main=Etat des plantes dans chaque bloc,
+   auto.key=list(columns=5, cex=.8),
+   scales=list(relation=free, draw=FALSE),
+   xlab=, ylab=,
+   ylim=list(c(52, 69), c(16, 33), c(35, 51), c(-1, 15)))


and received this error message :

Error in if (!any(cond.max.level - cond.current.level  0)  (row - 1) *  :
missing value where TRUE/FALSE needed

I tried some changes in arguments - notably layout=c(0,1), but anything
works.

Thanks for helping...

Jacques VESLOT
CIRAD Réunion

__
[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] R 1.9.1 Fails to Start on WinXP SP2

2004-09-22 Thread Duncan Murdoch
On Wed, 22 Sep 2004 09:28:03 -0500, Scott Higginbotham
[EMAIL PROTECTED] wrote :

One other suggestion:

Run the msconfig System configuration utility to turn off most of
the software that loads on your machine at startup, and see if that
allows R to start.  Then gradually add it back until you find the
culprit, if there is one.

Bingo! You rock Duncan. I had Rage3D (a video card overclocking utility)
installed on the machine that wouldn't run R and I was able to isolate
that as the problem. Once I uninstalled it, everything worked perfectly.

Thanks a million!

You're welcome.  You might want to let the Rage3D people know about
the problem; they might be in a position to see what's going wrong
with the R load process, and if it's their bug they might fix it.  I'd
be happy to correspond with them if they need info about R.

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


RE: [R] t test problem?

2004-09-22 Thread kan Liu
Hi, thanks for all your suggestions. It is realy helpful. 
The data was not paired. Sorry for a wrong set number of sample, compared to the 
sample I used for tests.
 
Best
 
Liu
 


Wayne Jones [EMAIL PROTECTED] wrote:

Hi Kan Lui, 

I've had a quick look at the data. The logged data seems reasonably nicely distributed 
(roughly symmetrical + equal variance). Indeed the y variable passed the (very strict) 
shapiro.test for normality. 

However the main problem is that I do not get the same results as you for the 
significance of the t.test. 

The only significant test I see is the paired t.test on the logged data. Is your data 
paired data? To see what I mean check out: http://www.texasoft.com/winkpair.html

The non-parametric tests show no significance (paired data or not) (logged and natural 
data). Although in general they do tend to be less strict than parametric tests. 

Unless the data is paired then the means of these samples most certainly do not 
significantly differ from one another. 



Here are my workings: 

Temp.Dat-read.table(data_natural.txt,header=T) 


hist(log(Temp.Dat$x,10)) 
hist(log(Temp.Dat$y,10)) 

shapiro.test(log(Temp.Dat$x,10)) 
shapiro.test(log(Temp.Dat$y,10)) 

t.test(log(Temp.Dat$x,10), log(Temp.Dat$y,10)) 


   Welch Two Sample t-test 

data:  log(Temp.Dat$x, 10) and log(Temp.Dat$y, 10) 
t = 0.9126, df = 195.806, p-value = 0.3626 
alternative hypothesis: true difference in means is not equal to 0 
95 percent confidence interval: 
 -0.0599837  0.1633168 
sample estimates: 
mean of x mean of y 
 4.891313  4.839647 


 t.test(log(Temp.Dat$x,10), log(Temp.Dat$y,10),paired=T) 

Paired t-test 

data:  log(Temp.Dat$x, 10) and log(Temp.Dat$y, 10) 
t = 2.3535, df = 98, p-value = 0.02060 
alternative hypothesis: true difference in means is not equal to 0 
95 percent confidence interval: 
 0.008101002 0.095232132 
sample estimates: 
mean of the differences 
 0.05166657 

 wilcox.test(log(Temp.Dat$x,10), log(Temp.Dat$y,10),paired=T) 

Wilcoxon signed rank test with continuity correction 

data:  log(Temp.Dat$x, 10) and log(Temp.Dat$y, 10) 
V = 2972.5, p-value = 0.0828 
alternative hypothesis: true mu is not equal to 0 

 wilcox.test(log(Temp.Dat$x,10), log(Temp.Dat$y,10),paired=F) 

Wilcoxon rank sum test with continuity correction 

data:  log(Temp.Dat$x, 10) and log(Temp.Dat$y, 10) 
W = 5206, p-value = 0.4491 
alternative hypothesis: true mu is not equal to 0 



 wilcox.test(Temp.Dat$x, Temp.Dat$y,paired=F) 

Wilcoxon rank sum test with continuity correction 

data:  Temp.Dat$x and Temp.Dat$y 
W = 5206, p-value = 0.4491 
alternative hypothesis: true mu is not equal to 0 

 wilcox.test(Temp.Dat$x, Temp.Dat$y,paired=T) 

Wilcoxon signed rank test with continuity correction 

data:  Temp.Dat$x and Temp.Dat$y 
V = 2896.5, p-value = 0.1417 
alternative hypothesis: true mu is not equal to 0 

 t.test(Temp.Dat$x, Temp.Dat$y,paired=T) 

Paired t-test 

data:  Temp.Dat$x and Temp.Dat$y 
t = 1.6731, df = 98, p-value = 0.0975 
alternative hypothesis: true difference in means is not equal to 0 
95 percent confidence interval: 
 -2351.81 27623.53 
sample estimates: 
mean of the differences 
   12635.86 

 t.test(Temp.Dat$x, Temp.Dat$y,paired=F) 

Welch Two Sample t-test 

data:  Temp.Dat$x and Temp.Dat$y 
t = 0.6432, df = 191.177, p-value = 0.5209 
alternative hypothesis: true difference in means is not equal to 0 
95 percent confidence interval: 
 -26116.18  51387.89 
sample estimates: 
mean of x mean of y 
 120544.9  107909.0 

 

-Original Message- 
From: kan Liu [mailto:[EMAIL PROTECTED] 
Sent: 22 September 2004 10:22 
To: Andrew Robinson; Dimitris Rizopoulos 
Cc: [EMAIL PROTECTED] 
Subject: Re: [R] t test problem? 

Hi, Many thanks for your helpful comments and suggestions. The attached are the data 
in both log10 scale and original scale. It would be very grateful if you could suggest 
which version of test should be used. 

 
By the way, how to check whether the variation is additive (natural scale) or 
multiplicative (log scale) in R? How to check whether the distribution of the data is 
normal? 

 
PS, Can I confirm that do your suggestions mean that in order to check whether there 
is a difference between x and y in terms of mean I need check the distribution of x 
and that of y in both natual and log scales and to see which present normal 
distribution? and then perform a t test using the data scale which presents normal 
distribution? If both scales present normal distribution, then the t tests with both 
scales should give the similar results?

 
  
  
Thanks again. 
  
Liu 

Andrew Robinson [EMAIL PROTECTED] wrote: 
Hi Dimitris, 

you are describing a more stringent requirement than the t-test 
actually requires. It's the sampling distribution of the mean that 
should be normal, and this condition is addressed by the Central 
Limit Theorem. 

Whether or not the CLT can be invoked depends on 

Re: [R] Multinomial Response Variable: Estimating the parameters

2004-09-22 Thread Christian Schulz
hmm,  the design sounds for me similiar to choice-data from 
choice-based-conjoint. 

IMHO check library(MNP) ?

regrads,christian


Am Mittwoch, 22. September 2004 15:04 schrieb Martin Plöderl:
 Hello!

 In a dyslexia-spelling-study we have a multinomial response variable
 with four categories.
 There are 12 subjects. Each subject was tested on 30 words, i.e. there
 are 30 responses for each subject.
 We are interested in estimating the parameters pi1, pi2, pi3, pi4, if
 possible point estimates and confidence intervals.
 Is there a possibility in R to conduct this analysis?

__
[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 correlation structure

2004-09-22 Thread Martin Henry H. Stevens
Running Mac OS 10.3.5 and R 2.0
Does glmmPQL use the same spatial dependence models as gls in nmle? It 
does not seem to - I get the following, for example:
 m2 - glmmPQL(S.Early ~ fertilized*watered, data=geodat, 
family=poisson, random=~1|col)
iteration 1
iteration 2
 plot(Variogram(m2, form=~col+row))
 m3 - update(m2,correlation=corSpher(c(5,.5), form=~col+row, 
nugget=T))
iteration 1
Error in model.frame(formula, rownames, variables, varnames, extras, 
extranames,  :
	invalid variable type


Any leads on how to specify exponential or spherical models would be 
appreciated (e.g., pageg or chapter in Venables and Ripley 2002).

Cheers,
Hank
Dr. Martin Henry H. Stevens, Assistant Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056
Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/botany/bot/henry.html
http://www.muohio.edu/ecology/
http://www.muohio.edu/botany/
E Pluribus Unum
__
[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] layout for xyplot

2004-09-22 Thread Deepayan Sarkar

Have you read the posting guide, which says:

quote
For questions about unexpected behavior or a possible bug provide 
details about your platform (Windows2000, Linux, OS X) and R version 
(type version at the R prompt). State the full version number, e.g., 
`1.8.1', not just `1.8'. State whether you installed a pre-compiled 
binary version of R or compiled it yourself. If the function is in a 
package other than `base', include the header output from 
library(help=thatPackage). If you are using an old version of R and 
think it does not work properly, upgrade. 
/quote

Further, we don't have access to your data, so there's no way we can 
reproduce what you have done. 

My guess is that you are using an old version of R and lattice, and this 
bug has already been fixed. I have no idea if it would help, but have 
you tried layout = c(1,1,4)?

Deepayan

On Wednesday 22 September 2004 09:32, Jacques VESLOT wrote:
 Dear all,

 I tried to use layout argument in xyplot to get one panel per page.

 I have a dataframe named 'data' with the following variables:

 x, y = coords,
 sub, bloc = 2-level factors,
 etat = 5-level factor,

 I did :
lset(theme = col.whitebg())
xyplot(y ~ x | bloc*sub , data=data, groups=etat,

 +   layout=c(0,1,4),
 +   main=Etat des plantes dans chaque bloc,
 +   auto.key=list(columns=5, cex=.8),
 +   scales=list(relation=free, draw=FALSE),
 +   xlab=, ylab=,
 +   ylim=list(c(52, 69), c(16, 33), c(35, 51), c(-1, 15)))


 and received this error message :

 Error in if (!any(cond.max.level - cond.current.level  0)  (row -
 1) *  : missing value where TRUE/FALSE needed

 I tried some changes in arguments - notably layout=c(0,1), but
 anything works.

 Thanks for helping...

 Jacques VESLOT
 CIRAD Réunion

 __
 [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] block statistics with POSIX classes

2004-09-22 Thread Kahra Hannu
I have a monthly price index series x, the related return series y = diff(log(x)) and 
a POSIXlt date-time variable dp. I would like to apply annual blocks to compute for 
example annual block maxima and mean of y.

When studying the POSIX classes, in the first stage of the learning curve, I computed 
the maximum drawdown of x:
 mdd - maxdrawdown(x)
 max.dd - mdd$maxdrawdown
 from - as.character(dp[mdd$from]) 
 to - as.character(dp[mdd$to])   
 from; to
[1] 2000-08-31
[1] 2003-03-31
that gives me the POSIX dates of the start and end of the period and suggests that I 
have done something correctly.

Two questions:
(1) how to implement annual blocks and compute e.g. annual max, min and mean of y 
(each year's max, min, mean)?
(2) how to apply POSIX variables with the 'block' argument in gev in the evir package?

The S+FinMetrics function aggregateSeries does the job in that module; but I do not 
know, how handle it in R. My guess is that (1) is done by using the function 
aggregate, but how to define the 'by' argument with POSIX variables?

Thanks!
Hannu Kahra 
Progetti Speciali 
Monte Paschi Asset Management SGR S.p.A. 
Via San Vittore, 37
IT-20123 Milano, Italia 

Tel.: +39 02 43828 754 
Mobile: +39 333 876 1558 
Fax: +39 02 43828 247 
E-mail: [EMAIL PROTECTED] 
Web: www.mpsam.it

__
[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] Sample without replacement

2004-09-22 Thread Mark G Orr
Hello, I have a simple problem (checked the archives and the appropriate 
help pages, to no avail).  I want to creat a vector that is length(2000). 
The vector is to consist of two strings( std and dev) with 1760 stds 
and 240 devs.  Furthermore, for each element of the vector, i want the 
selection of one of the strings to be approx. random.  The end result will 
be a vector with the following proportions:  .12 dev and .88 std. 
My solution, below, almost works, but i don't get the exact desired 
proportions:

sample.from.vector - c(rep(std,1760),rep(dev,240))
make.vector - rep(99,2000)
for (i in 1:2000){
  make.vector[i] - sample(sample.from.vector,1,replace=F)
}
As I understand the above code (which is not very well, obviously), each 
iteration assigns one element from the sample.from.vector  to the current 
make.vector element;  the element choosen from sample.from.vector is 
tagged so that i is not selected again.  However, after the loop, 
make.vector contains, for example, 1758 stds  and 242 devs.  Each 
iteration results in a different proportion of stds and devs (although 
close to the desired, not right on).

Any help would be greatly apprecitated.
-Mark Orr



Mark G. Orr
Postdoctoral Research Fellow
Dept. of Neuroscience
RM 825 Kennedy Center
Albert Einstein College of Medicine
Bronx, NY  10461
718-430-2610
__
[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] Sample without replacement

2004-09-22 Thread Peter Dalgaard
Mark G Orr [EMAIL PROTECTED] writes:

 Hello, I have a simple problem (checked the archives and the
 appropriate help pages, to no avail).  I want to creat a vector that
 is length(2000). The vector is to consist of two strings( std and
 dev) with 1760 stds and 240 devs.  Furthermore, for each element
 of the vector, i want the selection of one of the strings to be
 approx. random.  The end result will be a vector with the following
 proportions:  .12 dev and .88 std. My solution, below, almost
 works, but i don't get the exact desired proportions:
 
 
 sample.from.vector - c(rep(std,1760),rep(dev,240))
 
 make.vector - rep(99,2000)
 
 for (i in 1:2000){
make.vector[i] - sample(sample.from.vector,1,replace=F)
 }
 
 
 As I understand the above code (which is not very well, obviously),
 each iteration assigns one element from the sample.from.vector  to the
 current make.vector element;  the element choosen from
 sample.from.vector is tagged so that i is not selected again.
 However, after the loop, make.vector contains, for example, 1758 stds
 and 242 devs.  Each iteration results in a different proportion of
 stds and devs (although close to the desired, not right on).
 
 Any help would be greatly apprecitated.

It's staring you right in the face:

make.vector - sample(sample.from.vector)

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


[R] pairs, panel.functions, xlim and ylim

2004-09-22 Thread Valeria Edefonti
Hi,
I have the following problem.
I wanted to get a matrix of scatterplots and I used pairs.
I wanted to add the line y=x in each plot and I created a panel 
function for this scope.
I used points and abline in the following way:

## put y=x in each plot
panel.lin- function(x, y)
{
points(x,y, pch=21, bg=par(bg), col = black,cex=2)
abline(0,1,lwd=2, col=red)
}
and it works.
Now, I want that each plot has the same scale on the axis and I try 
with this modification:

## put y=x in each plot - same scale for all the plots
panel.lincor- function(x, y)
{
points(x,y, pch=21, bg=par(bg), col = 
black,cex=2,xlim=c(-1,1),ylim=c(-1,1))
abline(0,1,lwd=2, col=red)
}

but R tells me that xlim and ylim couldn't be set in high level plot 
functions.
I try to use plot() instead of points, but I realized immediately that 
I can't use plot as a panel function.
I know I could have added xlim and ylim directly in pairs() function, 
if I hadn't had a panel function, but I need the line y=x in every plot 
and I don't know other ways to get it.
Any idea?
Thank you very much
Valeria Edefonti

__
[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] ordered probit and cauchit

2004-09-22 Thread David Reinke
The Political Science Computational Laboratory at Stanford has R code for
ordered probit (courtesy of Simon Jackman):
http://pscl.stanford.edu/oprobit.

David Reinke


-Original Message-
From: David Firth [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 22, 2004 02:04
To: roger koenker
Cc: [EMAIL PROTECTED]
Subject: Re: [R] ordered probit and cauchit

On Wednesday, Sep 22, 2004, at 03:42 Europe/London, roger koenker wrote:

 What is the current state of the R-art for ordered probit models, and
 more
 esoterically is there any available R strategy for ordered cauchit
 models,
 i.e. ordered multinomial alternatives with a cauchy link function.
 MCMC
 is an option, obviously, but for a univariate latent variable model
 this seems
 to be overkill... standard mle methods should be preferable.  (??)


A quick look at polr (in the MASS package) suggests to me that it
wouldn't be all that hard to extend it to link functions other than
logistic.

Is MLE known to be well behaved in these models if the latent variable
is Cauchy?

David


 Googling reveals that spss provides such functions... just to wave a
 red
 flag.

 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

 __
 [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] block statistics with POSIX classes

2004-09-22 Thread Petr Pikal

__
[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] RMySQL and Blob

2004-09-22 Thread jonathan_li
Hi David,

The application I have in mind is for images. In my case, size of images is known and 
they are not big. As an example, a 64*32 image will have 2048 pixels. If they are 
8-bit grey-level pixels, the image occupies 2KB memory. 

I may venture to guess that the unknown size and type of a blob object in MySQL 
prevent it from being very usable in R since R doesn't have a datatype for a binary 
blob?

Thanks!
Jonathan


-Original Message-
From: David James [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 22, 2004 7:05 AM
To: LI,JONATHAN (A-Labs,ex1)
Cc: [EMAIL PROTECTED]
Subject: Re: [R] RMySQL and Blob


Hi Jonathan,

Currently RMySQL doesn't handle blob objects.  The mechanics of
inserting and extracting blob objects by itself is not too hard,
but issues such as how should blobs be made available to R, how to
prevent buffers overflows, how to prevent huge blobs from exhausting
the available memory, should R callback functions be invoked
as chunks of the blob are brought in, etc., need more consideration.
And these issues are not R/MySQL specific, but also relevant to
other databases and other non-dbms interfaces.

BTW there are R facilities (e.g., external pointers, finalizers) that 
seems quite important for this type of implementation.  

What type and how big are the blobs that want to import?

--
David

[EMAIL PROTECTED] wrote:
 Dear R experts,
 
 Does RMySQL package handle Blob datatype in a MySQL database? Blob can represent an 
 image, a sound or some other 
 large and complex binary objects. In an article published by R-database special 
 interest group, named A common database interface (DBI) (updated June 2003),  it's 
 mentioned in open issues and limitations that We need to carefully plan how to 
 deal with binary objects. 
 
 Before I invest time to try, I would appreciate any experts' opinions.
 
 Thanks,
 Jonathan
 
 __
 [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] Issue with predict() for glm models

2004-09-22 Thread Joe Rausch

__
[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] glmmPQL correlation structure

2004-09-22 Thread Spencer Graves
 Have you tried GLMM in lme4?  Doug Bates is the primary architect 
of both nlme and lme4.  Therefore, I would think that a spatial 
dependence model that works in nlme might also work in GLMM. 

 hope this helps.  spencer graves
Martin Henry H. Stevens wrote:
Running Mac OS 10.3.5 and R 2.0
Does glmmPQL use the same spatial dependence models as gls in nmle? It 
does not seem to - I get the following, for example:
 m2 - glmmPQL(S.Early ~ fertilized*watered, data=geodat, 
family=poisson, random=~1|col)
iteration 1
iteration 2
 plot(Variogram(m2, form=~col+row))
 m3 - update(m2,correlation=corSpher(c(5,.5), form=~col+row, nugget=T))
iteration 1
Error in model.frame(formula, rownames, variables, varnames, extras, 
extranames,  :
invalid variable type


Any leads on how to specify exponential or spherical models would be 
appreciated (e.g., pageg or chapter in Venables and Ripley 2002).

Cheers,
Hank
Dr. Martin Henry H. Stevens, Assistant Professor
338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056
Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243
http://www.cas.muohio.edu/botany/bot/henry.html
http://www.muohio.edu/ecology/
http://www.muohio.edu/botany/
E Pluribus Unum
__
[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

--
Spencer Graves, PhD, Senior Development Engineer
O:  (408)938-4420;  mobile:  (408)655-4567
__
[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] THanks, random/repl. prob. SOLVED.

2004-09-22 Thread Mark G Orr
Thanks for the help, it worked.



Mark G. Orr
Postdoctoral Research Fellow
Dept. of Neuroscience
RM 825 Kennedy Center
Albert Einstein College of Medicine
Bronx, NY  10461
718-430-2610
__
[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] impenetrable warning

2004-09-22 Thread Spencer Graves
 In this case, this trick will identify the specify command in the 
lme code that produce the error. 

 If that does not lead you to an answer, have you tried simplifying 
your lme call to identify more clearly which part (or combination) seems 
to generate the problem? 

 hope this helps.  spencer graves
Liaw, Andy wrote:
Generally you can set options(warn=2), run the code, then do traceback().
Andy
 

From: Simon.Bond
Dear R-help,
Can anyone explain the meaning of  the warning,
Singular precision matrix in level -1, block 1
? Or how to track down where it comes from?
More precisely, using the nlme package, I'm issued with the warning
itt2 - lme(lrna~rx.nrti+lbrna, random=~1|patid,
cor=corExp(form=~days|patid,nugget=T), weights=varPower(
form=~lbrna),data=rna3)
Warning messages:
1: Singular precision matrix in level -1, block 1
2: Singular precision matrix in level -1, block 1
the output is:
Linear mixed-effects model fit by REML
 Data: rna3
 Log-restricted-likelihood: -4990.142
 Fixed: lrna ~ rx.nrti + lbrna
  (Intercept) rx.nrtiZDV+3TC rx.nrtiZDV+ABC  lbrna
2.6597552  0.8589514  0.4259504  0.2929222
Random effects:
Formula: ~1 | patid
   (Intercept)  Residual
StdDev:1.251113 0.2105329
Correlation Structure: Exponential spatial correlation
Formula: ~days | patid
Parameter estimate(s):
 range  nugget
204.6422150   0.3349336
Variance function:
Structure: Power of variance covariate
Formula: ~lbrna
Parameter estimates:
   power
0.9733358
Number of Observations: 2390
Number of Groups: 124

Thanks,
Simon Bond.
__
[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
 

--
Spencer Graves, PhD, Senior Development Engineer
O:  (408)938-4420;  mobile:  (408)655-4567
__
[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] Issue with predict() for glm models

2004-09-22 Thread Joe Rausch

__
[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] pairs, panel.functions, xlim and ylim

2004-09-22 Thread Jens Oehlschlägel

Valerie,

A bit ugly, because you must ignore some warnings,
but for me works the code below.

Best


Jens Oehlschlägel


x - rnorm(100, sd=0.2)
x - cbind(x=x-0.1, y=x+0.1)
pairs(x
, panel=function(x,y){
  function to be called with xlim=, ylim= parameters
points(x, y)
abline(0,1)
  }
)

pairs(x
, panel=function(x,y, ...)
  { # adding the three points here allows your panel function to accept the
additional xlim=, ylim= parameters
points(x, y)
abline(0,1)
  }
, xlim=c(-1, 1)
, ylim=c(-1, 1)
)


 I have the following problem.
 I wanted to get a matrix of scatterplots and I used pairs.
 I wanted to add the line y=x in each plot and I created a panel 
 function for this scope.
 I used points and abline in the following way:
 
 ## put y=x in each plot
  panel.lin- function(x, y)
  {
  points(x,y, pch=21, bg=par(bg), col = black,cex=2)
  abline(0,1,lwd=2, col=red)
  }
 
 and it works.
 Now, I want that each plot has the same scale on the axis and I try 
 with this modification:
 
 ## put y=x in each plot - same scale for all the plots
  panel.lincor- function(x, y)
  {
  points(x,y, pch=21, bg=par(bg), col = 
 black,cex=2,xlim=c(-1,1),ylim=c(-1,1))
  abline(0,1,lwd=2, col=red)
  }
 
 but R tells me that xlim and ylim couldn't be set in high level plot 
 functions.
 I try to use plot() instead of points, but I realized immediately that 
 I can't use plot as a panel function.
 I know I could have added xlim and ylim directly in pairs() function, 
 if I hadn't had a panel function, but I need the line y=x in every plot 
 and I don't know other ways to get it.
 Any idea?
 Thank you very much
 Valeria Edefonti

-- 
GMX ProMail mit bestem Virenschutz http://www.gmx.net/de/go/mail
+++ Empfehlung der Redaktion +++ Internet Professionell 10/04 +++

__
[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] aparchFit()$fitted.value

2004-09-22 Thread Lisa
Dear R people,
I'm not able to have the component residuals, fitted.value from an
aparchFit() estimation as explain in the Value of aparchFit Help, package
fSeries.

Could someone help me?
Thanks in advance.
Lisa

__
[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] Issue with predict() for glm models

2004-09-22 Thread jrausch

Hello everyone, 

I am having a problem using the predict (or the predict.glm) function in R.
Basically, I run the glm model on a training data set and try to obtain
predictions for a set of new predictors from a test data set (i.e., not the
predictors that were utilized to obtain the glm parameter estimates).
Unfortunately, every time that I attempt this, I obtain the predictions for the
predictors that were used to fit the glm model. I have looked at the R mailing
list archives and don't believe I am making the same mistakes that have been
made in the past and also have tried to closely follow the predict.glm example
in the help file. Here is an example of what I am trying to do: 


set.seed(545345)


# Necessary Variables # 


p - 2
train.n - 20
test.n - 25 
mean.vec.1 - c(1,1)
mean.vec.2 - c(0,0)

Sigma.1 - matrix(c(1,.5,.5,1),p,p)
Sigma.2 - matrix(c(1,.5,.5,1),p,p)

###
# Load MASS Library #
###

library(MASS)

###
# Data to Parameters for Logistic Regression Model #
###

train.data.1 - mvrnorm(train.n,mu=mean.vec.1,Sigma=Sigma.1)
train.data.2 - mvrnorm(train.n,mu=mean.vec.2,Sigma=Sigma.2)
train.class.var - as.factor(c(rep(1,train.n),rep(2,train.n)))
predictors.train - rbind(train.data.1,train.data.2)

##
# Test Data Where Predictions for Probabilities Using Logistic Reg.  #
# From Training Data are of Interest  #
## 

test.data.1 - mvrnorm(test.n,mu=mean.vec.1,Sigma=Sigma.1)
test.data.2 - mvrnorm(test.n,mu=mean.vec.2,Sigma=Sigma.2)
predictors.test - rbind(test.data.1,test.data.2)

##
# Run Logistic Regression on Training Data #
##

log.reg - glm(train.class.var~predictors.train,
family=binomial(link=logit))
log.reg

# log.reg

#Call:  glm(formula = train.class.var ~ predictors.train, family =
#binomial(link = logit)) 
#
#Coefficients:
#  (Intercept)  predictors.train1  predictors.train2  
#   0.5105-0.2945-1.0811  
#
#Degrees of Freedom: 39 Total (i.e. Null);  37 Residual
#Null Deviance:  55.45 
#Residual Deviance: 41.67AIC: 47.67 

###
# Predicted Probabilities for Test Data #
###

New.Data - data.frame(predictors.train1=predictors.test[,1],
predictors.train2=predictors.test[,2])

logreg.pred.prob.test - predict.glm(log.reg,New.Data,type=response)
logreg.pred.prob.test

#logreg.pred.prob.test
# [1] 0.51106406 0.15597423 0.04948404 0.03863875 0.35587589 0.71331091
# [7] 0.17320087 0.14176632 0.30966718 0.61878952 0.12525988 0.21271139
#[13] 0.70068113 0.18340723 0.10295501 0.44591568 0.72285161 0.31499339
#[19] 0.65789420 0.42750139 0.14435889 0.93008117 0.70798465 0.80109005
#[25] 0.89161472 0.47480625 0.56520952 0.63981834 0.57595189 0.60075882
#[31] 0.96493393 0.77015507 0.87643986 0.62973986 0.63043351 0.45398955
#[37] 0.80855782 0.90835588 0.54809117 0.11568637


Of course, notice that the vector for the predicted probabilities has only 40
elements, while the New.Data has 50 elements (since n.test has 25 per group
for 2 groups) and thus should have 50 predicted probabilities. As it turns out,
the output is for the training data predictors and not for the New.Data as I
would like it to be. I should also note that I have made sure that the names
for the predictors in the New.Data are the same as the names for the
predictors within the glm object (i.e., within log.reg) as this is what is
done in the example for predict.glm() within the help files. 

Could some one help me understand either what I am doing incorrectly or what
problems there might be within the predict() function? I should mention that I
tried the same program using predict.glm() and obtained the same problematic
results. 

Thanks and take care, 

Joe 


Joe Rausch, M.A. 
Psychology Liaison 
Lab for Social Research 
917 Flanner Hall 
University of Notre Dame 
Notre Dame, IN 46556
(574) 631-3910

If we knew what it was we were doing, it would not be called research, would
it?
- Albert Einstein

__
[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] Issue with predict() for glm models

2004-09-22 Thread John Fox
Dear Mark and Joe,

Actually, the problem here appears to be caused by the use of a matrix
on the RHS of the model formula. I'm not sure why this doesn't work (I
must be missing something -- perhaps someone else can say what), but
Joe can get the output he expects by specifying the columns of his
matrix as individual predictors in the model formula. BTW, it's better
form to call the generic predict() rather than the method predict.glm()
directly, though the latter will work here.

Editing the original input:

 x1 - predictors.train[,1]
 x2 - predictors.train[,2]
 
 log.reg - glm(train.class.var ~ x1 + x2,
+ family=binomial(link=logit))
 log.reg

Call:  glm(formula = train.class.var ~ x1 + x2, family = binomial(link
= logit)) 

Coefficients:
(Intercept)   x1   x2  
 0.5102  -0.6118  -0.3192  

Degrees of Freedom: 39 Total (i.e. Null);  37 Residual
Null Deviance:  55.45 
Residual Deviance: 46.49AIC: 52.49 
 New.Data - data.frame(x1=predictors.test[,1],
x2=predictors.test[,2])
 
 logreg.pred.prob.test - predict(log.reg,New.Data, type=response)
 logreg.pred.prob.test
 [1] 0.2160246 0.2706139 0.3536572 0.6206490 0.5218391 0.2363767
0.1072153
 [8] 0.6405459 0.443 0.6680043 0.3377492 0.5892127 0.3230353
0.7540425
[15] 0.2889855 0.5163141 0.6187335 0.1447511 0.5066670 0.4424428
0.4141701
[22] 0.3947212 0.4065674 0.6226195 0.5053101 0.4311552 0.4261810
0.4784102
[29] 0.5126050 0.6756437 0.6147516 0.7659146 0.5219031 0.3938457
0.6495470
[36] 0.5178400 0.8185613 0.7167129 0.5414552 0.8687371 0.5415976
0.8048741
[43] 0.7796451 0.5565636 0.6058371 0.7053130 0.1521769 0.7120320
0.4073465
[50] 0.6801101


I hope this helps,
 John



On Wed, 22 Sep 2004 15:17:23 -0300
 Fowler, Mark [EMAIL PROTECTED] wrote:
 Perhaps your approach reflects a method of producing a prediction
 dataframe
 that is just unfamiliar to me, but it looks to me like you have
 created two
 predictor variables based on the names of the levels of the original
 predictor (predictors.train1, predictors.train2). I don't know how
 the glm
 function would know that predictors.train1 and predictors.train2 are
 two
 subs for predictors.train. Maybe try just using one prediction
 variable, and
 give it the original variable name (predictors.train). If this works,
 just
 repeat for your second set of values.
 
  Mark Fowler
  Marine Fish Division
  Bedford Inst of Oceanography
  Dept Fisheries  Oceans
  Dartmouth NS Canada
  [EMAIL PROTECTED]
 
 
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
 Sent: September 22, 2004 2:53 PM
 To: [EMAIL PROTECTED]
 Subject: [R] Issue with predict() for glm models
 
 
 
 Hello everyone, 
 
 I am having a problem using the predict (or the predict.glm) function
 in R.
 Basically, I run the glm model on a training data set and try to
 obtain
 predictions for a set of new predictors from a test data set (i.e.,
 not
 the predictors that were utilized to obtain the glm parameter
 estimates).
 Unfortunately, every time that I attempt this, I obtain the
 predictions for
 the predictors that were used to fit the glm model. I have looked at
 the R
 mailing list archives and don't believe I am making the same mistakes
 that
 have been made in the past and also have tried to closely follow the
 predict.glm example in the help file. Here is an example of what I am
 trying
 to do: 
 
 
 set.seed(545345)
 
 
 # Necessary Variables # 
 
 
 p - 2
 train.n - 20
 test.n - 25 
 mean.vec.1 - c(1,1)
 mean.vec.2 - c(0,0)
 
 Sigma.1 - matrix(c(1,.5,.5,1),p,p)
 Sigma.2 - matrix(c(1,.5,.5,1),p,p)
 
 ###
 # Load MASS Library #
 ###
 
 library(MASS)
 
 ###
 # Data to Parameters for Logistic Regression Model #
 ###
 
 train.data.1 - mvrnorm(train.n,mu=mean.vec.1,Sigma=Sigma.1)
 train.data.2 - mvrnorm(train.n,mu=mean.vec.2,Sigma=Sigma.2)
 train.class.var - as.factor(c(rep(1,train.n),rep(2,train.n)))
 predictors.train - rbind(train.data.1,train.data.2)
 
 ##
 # Test Data Where Predictions for Probabilities Using Logistic Reg.
  #
 # From Training Data are of Interest
 #
 ## 
 
 test.data.1 - mvrnorm(test.n,mu=mean.vec.1,Sigma=Sigma.1)
 test.data.2 - mvrnorm(test.n,mu=mean.vec.2,Sigma=Sigma.2)
 predictors.test - rbind(test.data.1,test.data.2)
 
 ##
 # Run Logistic Regression on Training Data #
 ##
 
 log.reg - glm(train.class.var~predictors.train,
 family=binomial(link=logit))
 log.reg
 
 # log.reg
 
 #Call:  glm(formula = train.class.var ~ predictors.train, family =
 #binomial(link = logit)) 
 #
 #Coefficients:
 #  (Intercept)  predictors.train1  predictors.train2  
 #   0.5105-0.2945-1.0811  
 #
 

Re: [R] t-test problem

2004-09-22 Thread Cliff Lunneborg


Kan Liu wrote:

 Hello,

 I got two sets of data
 x=(124738, 128233, 85901, 33806, ...)
 y=(25292, 21877, 45498, 63973, )
 When I did a t test, I got two tail p-value = 0.117, which is not
significantly different.

 If I changed x, y to log scale, and re-do the t test, I got two tail
p-value = 0.042, which is
 significantly different.

 Now I got confused which one is correct. Any help would be very
appreciated.

If you are unsure about the metric of the attribute being measured, it
would be preferable to use a rank test, the Wilcoxon-Mann-Whitney,
rather than the parametric t-test.

**
Cliff Lunneborg, Professor Emeritus, Statistics 
Psychology, University of Washington, Seattle
[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] Facing problems with C code compilation - Please help.

2004-09-22 Thread neha chaudhry
Hello,

I started using R a month ago - so I am a novice in this area. I am stuck with a 
problem and need some help urgently.
I am using windows version of R 1.9.1. I am trying to compile C code in it. I have my 
C code - hello.c is lying in C:\Program Files\R\rw1091

This code is - 

#include R.h
void hello(int *n)
{
  int i;
  for(i=0;i *n; i++)
  {
 Rprintf(Hello World ! \n);
  }
}

===
Code hello1.R is also lying in the same directory.
This code is -
hello2 - function(n)
 {
   .C(hello, as.integer))
 }
===

From the command prompt, I go into the directory  C:\Program Files\R\rw1091\bin
and I do 
C:\Program Files\R\rw1091\binR CMD SHLIB hello.c
'make' is not recognized as an internal or external command,
operable program or batch file.

Perl is installed on my machine. I was wondering why am I getting this error. Could 
someone please provide me with some pointers on this? Your help will be greatly 
appreciated.

Thanks,
Neha

__
[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] png problem

2004-09-22 Thread Paul Murrell
Hi
Clément Calenge wrote:
Hello,
Thanks for the fast reply.
Paul Murrell wrote:
Hi
Clément Calenge wrote:
Dear R-users,
I have a small problem with the function png(), when used with the
argument colortype=pseudo.cube.
  png(toto.png, colortype=pseudo.cube)
  image(matrix(rnorm(1), 100, 100))
  dev.off()
R is blocked at the last command (R does not
print any prompt after the last command). Nothing is
written in the file (Gimp indicates that the file is corrupted).

Did you wait long enough?  This example took a little while to 
complete for me (may need someone more familiar with the code to tell 
us why it is so slow).

You're right, it took 45 minutes for me.
However, since I need to use this code to build a Sweave vignette,
I cannot use it too often (I have about thirty files to create, this
would take about 20 hours to build the vignette !).
I also need the colortype argument (some graphics cards
do not allow the compilation of the vignette without).
Does anyone knows how to speed up the process ?

Wow!  It didn't take that long for me (maybe a minute or two).
A possibly useful observation in case anyone else takes a look at this 
before me:  when I debugged it and ctrl-C'ed to interrupt every now and 
then, the interrupt always happened inside a call to XQueryColor (in 
bitgp(), in devX11.c), so that may be the slow part.

Paul

Paul

However,
  png(toto.png)
  image(matrix(rnorm(1), 100, 100))
  dev.off()
works fine.
I tried:
  options(X11colortype = pseudo.cube)
  png(toto.png)
  image(matrix(rnorm(1), 100, 100))
  dev.off()
But, here again, R is blocked. I tried to replace dev.off() by
graphics.off(), but this does not resolve the problem.
The problem does not occurs when the function X11() is used
instead of the function png().
I searched through the mail archive, the FAQ, on google,
but I did not found any solution to this problem.
On the help page on the function png(),
it is indicated that The colour handling will be that of the 'X11'
device in use.
I never used these functions before, but maybe png()
is not suitable with colortype=pseudo.cube ?
Can you tell me where I have missed something ?
Thanks in Advance,
Clément Calenge.
 version
  _
platform sparc-sun-solaris2.9
arch sparc
os   solaris2.9
system   sparc, solaris2.9
status
major1
minor9.1
year 2004
month06
day  21
language R
[[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

--
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/
==
UMR CNRS 5558 - Equipe Ecologie Statistique
Laboratoire de Biométrie et Biologie Evolutive
Université Claude Bernard Lyon 1
43, Boulevard du 11 novembre 1918
69622 Villeurbanne Cedex
FRANCE
tel. (+33) 04.72.43.27.57
fax. (+33) 04.72.43.13.88

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


[R] Cox proportional hazards model

2004-09-22 Thread Min-Han Tan
Good afternoon,

I am currently trying to do some work on survival analysis.

- I hope to seek your advice re: 2 questions (1 general and 1 specific)

(1) I'm trying to do a stratified Cox analysis and subsequently
plot(survfit(object)). It seems to work for some strata, but not for
others.

I have tumor grade, which is a range of 1 - 4. 

When I divide this range of 1:4 into 2 groups, it works fine for
strata(grade2) and strata(grade  3). However, if I do a
strata(grade1), there is an error when I do a survfit( coxph object
)

Call: survfit.coxph(object = s)

Error in print.survfit(structure(list(n = as.integer(46), time = c(22,  : 
length of dimnames [1] not equal to array extent

(2) As a general question, is it possible to distinguish between
confounding and interaction in the Cox proportional hazards model?

Thanks!

Min-Han

__
[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] Re: Your Amazon.com Inquiry

2004-09-22 Thread account-update

Greetings from Amazon.com.

We're sorry. You replied to a notification-only address that cannot
accept incoming e-mail. But that's OK--this automated response will
direct you to the right place at Amazon.com to answer your question or
help you make changes to your order.

To change any unshipped orders, make other changes to your account, or
view your order history, visit:

http://www.amazon.com/your-account

For answers to questions about how to order, our shipping rates, and
how to use any of our services, visit:

http://www.amazon.com/help

We hope our online resources meet all your needs. If you've explored
the above links but find you still need to get in touch with us,
please use the e-mail form available in our online Help department.

Thanks for shopping at Amazon.com!

Sincerely,

Amazon.com Customer Service
http://www.amazon.com

P.S. You received this message because Amazon.com received
the following message:

From [EMAIL PROTECTED]  Wed Sep 22 17:03:56 2004
Received: from mail-border-1001.vdc.amazon.com (mail-border-1001.vdc.amazon.com 
[10.139.9.251])
by mail-admin-1.amazon.com (8.12.7/) with ESMTP id i8N03jsQ016597
for [EMAIL PROTECTED]; Wed, 22 Sep 2004 17:03:46 -0700
Received: from service-5-internal.amazon.com by mail-border-1001.vdc.amazon.com with 
SMTP 
(crosscheck: service-5-internal.amazon.com [10.16.42.51])
id i8N03gKb025643
for [EMAIL PROTECTED]; Thu, 23 Sep 2004 00:03:43 GMT
Message-Id: [EMAIL PROTECTED]
X-Amazon-External-Source: yes
X-Amazon-External-Envelope-Sender: [EMAIL PROTECTED]
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Received: from ga-cmng-cuda2-c2b-182.atlaga.adelphia.net ([68.71.182.182]) by 
service-5-internal.amazon.com
  via smtpd (for mail-border-1001.vdc.amazon.com [10.139.9.251]) with SMTP; 23 
Sep 2004 00:03:42 UT
Subject: %]Re: Hi
Date: Wed, 22 Sep 2004 20:03:39 -0400
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary==_NextPart_000_0016=_NextPart_000_0016
X-Priority: 3
X-MSMail-Priority: Normal
X-PMX-Version: 4.7.0.111621, Antispam-Engine: 2.0.1.0, Antispam-Data: 2004.9.22.3
X-AMAZON-GAUGE: X
X-PMX-REPORT: The following antispam rules were triggered by this message:
Rule Score Description
RELAY_IN_CBL 8.000 Composite Blocking List, see 
http://cbl.abuseat.org/:
   182.182.71.68.cbl.abuseat.org
MIME_BOUND_NEXTPART  2.100 Spam tool pattern in MIME boundary
PRIORITY_NO_NAME 0.716 Message has priority setting, but no X-Mailer
NO_REAL_NAME 0.000 From: does not include a real name

__
[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] Facing problems with C code compilation - Please help.

2004-09-22 Thread Liaw, Andy
Read and follow the instructions in c:\Program
Files\R\rw1091\README.packages _very_, _very_ carefully.  Stray from it even
a bit and you get what you deserve.

Andy

 From: neha chaudhry
 
 Hello,
 
 I started using R a month ago - so I am a novice in this 
 area. I am stuck with a problem and need some help urgently.
 I am using windows version of R 1.9.1. I am trying to compile 
 C code in it. I have my C code - hello.c is lying in 
 C:\Program Files\R\rw1091
 
 This code is - 
 
 #include R.h
 void hello(int *n)
 {
   int i;
   for(i=0;i *n; i++)
   {
  Rprintf(Hello World ! \n);
   }
 }
 
 ===
 Code hello1.R is also lying in the same directory.
 This code is -
 hello2 - function(n)
  {
.C(hello, as.integer))
  }
 ===
 
 From the command prompt, I go into the directory  C:\Program 
 Files\R\rw1091\bin
 and I do 
 C:\Program Files\R\rw1091\binR CMD SHLIB hello.c
 'make' is not recognized as an internal or external command,
 operable program or batch file.
 
 Perl is installed on my machine. I was wondering why am I 
 getting this error. Could someone please provide me with some 
 pointers on this? Your help will be greatly appreciated.
 
 Thanks,
 Neha
 
 __
 [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] multinomial logistic regression

2004-09-22 Thread array chip
Hi, how can I do multinomial logistic regression in R?
I think glm() can only handle binary response
variable, and polr() can only handle ordinal response
variable. how to do logistic regression with
multinomial response variable?

Thanks



__

Y! Messenger - Communicate in real time. Download now.

__
[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] multinomial logistic regression

2004-09-22 Thread Kevin Wang
array chip wrote:
I think glm() can only handle binary response
variable, 
That's not true, have you looked at ?glm and ?family ?
HTH,
Kevin
--
Ko-Kang Kevin Wang
PhD Student
Centre for Mathematics and its Applications
Building 27, Room 1004
Mathematical Sciences Institute (MSI)
Australian National University
Canberra, ACT 0200
Australia
Homepage: http://wwwmaths.anu.edu.au/~wangk/
Ph (W): +61-2-6125-2431
Ph (H): +61-2-6125-7407
Ph (M): +61-40-451-8301
__
[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] Facing problems with C code compilation - Please help.

2004-09-22 Thread neha chaudhry
Hi Guys,

Thanks a ton for all the help. My code is finally compiling and running.

-Neha

- Original Message -
From: Liaw, Andy [EMAIL PROTECTED]
Date: Wednesday, September 22, 2004 5:12 pm
Subject: RE: [R] Facing problems with C code compilation - Please help.

 Read and follow the instructions in c:\Program
 Files\R\rw1091\README.packages _very_, _very_ carefully.  Stray from it even
 a bit and you get what you deserve.
 
 Andy
 
  From: neha chaudhry
  
  Hello,
  
  I started using R a month ago - so I am a novice in this 
  area. I am stuck with a problem and need some help urgently.
  I am using windows version of R 1.9.1. I am trying to compile 
  C code in it. I have my C code - hello.c is lying in 
  C:\Program Files\R\rw1091
  
  This code is - 
  
  #include R.h
  void hello(int *n)
  {
int i;
for(i=0;i *n; i++)
{
   Rprintf(Hello World ! \n);
}
  }
  
  ===
  Code hello1.R is also lying in the same directory.
  This code is -
  hello2 - function(n)
   {
 .C(hello, as.integer))
   }
  ===
  
  From the command prompt, I go into the directory  C:\Program 
  Files\R\rw1091\bin
  and I do 
  C:\Program Files\R\rw1091\binR CMD SHLIB hello.c
  'make' is not recognized as an internal or external command,
  operable program or batch file.
  
  Perl is installed on my machine. I was wondering why am I 
  getting this error. Could someone please provide me with some 
  pointers on this? Your help will be greatly appreciated.
  
  Thanks,
  Neha
  
  __
  [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
  
  
 
 
 ---
 ---
 Notice:  This e-mail message, together with any attachments, contains 
 information of Merck  Co., Inc. (One Merck Drive, Whitehouse Station, New 
 Jersey, USA 08889), and/or its affiliates (which may be known outside the 
 United States as Merck Frosst, Merck Sharp  Dohme or MSD and in Japan, as 
 Banyu) that may be confidential, proprietary copyrighted and/or legally 
 privileged. It is intended solely for the use of the individual or entity 
 named on this message.  If you are not the intended recipient, and have 
 received this message in error, please notify us immediately by reply e-
 mail and then delete it from your system.
 ---
 ---


__
[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] layout for xyplot

2004-09-22 Thread Jacques VESLOT
thanks a lot !

My version is 1.9.1. :
 _

platform i386-pc-mingw32
arch i386
os   mingw32
system   i386, mingw32
status
major1
minor9.0
year 2004
month04
day  12
language R

and I'm working on a Windows2000 platform.

Besides I tried layout = c(1,1,4), but it doesn't work anymore (same error
message).

Please find my dataframe as attached file, and the first 6 columns summary
just below:

  x   yblocsub inoc etat
 Min.   : 0.00   Min.   : 0.0   1:240   C:240   2:135  : 83
 1st Qu.: 3.25   1st Qu.:16.3   2:240   S:240   8:105   F  : 55
 Median : 6.00   Median :34.0   T:240   Fi : 38
 Mean   : 6.02   Mean   :34.0   NF :302
 3rd Qu.: 8.75   3rd Qu.:50.8   NFi:  2
 Max.   :12.00   Max.   :68.0


Is there another means to operate better than with index.cond, by dropping
all combination of conditioning variables but one and ploting it with
layout=c(1,1).

Thanks for helping...

jacques



-Message d'origine-
De : Deepayan Sarkar [mailto:[EMAIL PROTECTED]
Envoyé : mercredi 22 septembre 2004 19:18
À : [EMAIL PROTECTED]; [EMAIL PROTECTED]
Objet : Re: [R] layout for xyplot



Have you read the posting guide, which says:

quote
For questions about unexpected behavior or a possible bug provide
details about your platform (Windows2000, Linux, OS X) and R version
(type version at the R prompt). State the full version number, e.g.,
`1.8.1', not just `1.8'. State whether you installed a pre-compiled
binary version of R or compiled it yourself. If the function is in a
package other than `base', include the header output from
library(help=thatPackage). If you are using an old version of R and
think it does not work properly, upgrade.
/quote

Further, we don't have access to your data, so there's no way we can
reproduce what you have done.

My guess is that you are using an old version of R and lattice, and this
bug has already been fixed. I have no idea if it would help, but have
you tried layout = c(1,1,4)?

Deepayan

On Wednesday 22 September 2004 09:32, Jacques VESLOT wrote:
 Dear all,

 I tried to use layout argument in xyplot to get one panel per page.

 I have a dataframe named 'data' with the following variables:

 x, y = coords,
 sub, bloc = 2-level factors,
 etat = 5-level factor,

 I did :
lset(theme = col.whitebg())
xyplot(y ~ x | bloc*sub , data=data, groups=etat,

 +   layout=c(0,1,4),
 +   main=Etat des plantes dans chaque bloc,
 +   auto.key=list(columns=5, cex=.8),
 +   scales=list(relation=free, draw=FALSE),
 +   xlab=, ylab=,
 +   ylim=list(c(52, 69), c(16, 33), c(35, 51), c(-1, 15)))


 and received this error message :

 Error in if (!any(cond.max.level - cond.current.level  0)  (row -
 1) *  : missing value where TRUE/FALSE needed

 I tried some changes in arguments - notably layout=c(0,1), but
 anything works.

 Thanks for helping...

 Jacques VESLOT
 CIRAD Réunion

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

-
CIRAD Reunion - MailScanner - NO VIRUS found
-
__
[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