[R] Test (ignore)

2007-08-10 Thread Nordlund, Dan (DSHS/RDA)


Daniel J. Nordlund
Research and Data Analysis
Washington State Department of Social and Health Services
Olympia, WA  98504-5204

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


[R] test for contingency table when there are many zeros

2007-08-08 Thread gallon li
Here is my table

 tt
A   B
1 297 398
2 470 376
3  30  23
4   3   3
5   0   0

b/c two cells are zero, I can't use chisq.test() in R which gives the
following output;


 chisq.test(tt)

Pearson's Chi-squared test

data:  tt
X-squared = NaN, df = 4, p-value = NA

Warning message:
Chi-squared approximation may be incorrect in: chisq.test(tt)

What function should I use then? Any suggestion?

[[alternative HTML version deleted]]

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


Re: [R] test for contingency table when there are many zeros

2007-08-08 Thread Francisco J. Zagmutt
fisher.test(tt)

Francisco

gallon li wrote:
 Here is my table
 
 tt
 A   B
 1 297 398
 2 470 376
 3  30  23
 4   3   3
 5   0   0
 
 b/c two cells are zero, I can't use chisq.test() in R which gives the
 following output;
 
 
 chisq.test(tt)
 
 Pearson's Chi-squared test
 
 data:  tt
 X-squared = NaN, df = 4, p-value = NA
 
 Warning message:
 Chi-squared approximation may be incorrect in: chisq.test(tt)
 
 What function should I use then? Any suggestion?
 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


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


[R] Test (please ignore)

2007-08-08 Thread Ted . Harding
Please excuse this -- I need to test whether I can get through to R-help!
(Have failed repeatedly today).
Ted.

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


[R] test the significances of two regression lines

2007-08-06 Thread Luis Ridao Cruz
R-help,

I'm trying to test the significance of two regression lines
, i.e. the significance of the slopes from two samples
originated from the same population.

Is it correct if I fit a liner model for each sample and
then test the slope signicance with 'anova'. Something like this:

lm1 - lm(Y~ a1 + b1*X)# sample 1
lm2 - lm(Y~ a2 + b2*X)# sample 2

anova(lm1, lm2)

Thanks in advance.

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


Re: [R] test the significances of two regression lines

2007-08-06 Thread Ted Harding
On 06-Aug-07 10:32:50, Luis Ridao Cruz wrote:
 R-help,
 
 I'm trying to test the significance of two regression lines
 , i.e. the significance of the slopes from two samples
 originated from the same population.
 
 Is it correct if I fit a liner model for each sample and
 then test the slope signicance with 'anova'. Something like this:
 
 lm1 - lm(Y~ a1 + b1*X)# sample 1
 lm2 - lm(Y~ a2 + b2*X)# sample 2
 
 anova(lm1, lm2)

No, this will not work. From ?anova:

Warning:
  The comparison between two or more models will only be valid if
  they are fitted to the same dataset.

which is not the case in your example. One way to proceed is to
merge the two datasets, and introduve a factor which identifies
the dataset. For example:

  x1-rnorm(100) ; x2-rnorm(100)
  y1 - 0.2 + 0.1*x1 + 0.05*rnorm(100)
  y2 - 0.2 + 0.12*x2 + 0.05*rnorm(100)
  x - c(x1,x2)
  y - c(y1,y2)
  S - factor(c(rep(0,100),rep(1,100)))
  lm12 - lm(y ~ x*S)

First look at the fit of y1~x1:
  summary(lm(y1~x1))
Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept) 0.206042   0.004647   44.34   2e-16 ***
x1  0.0913820.091382   0.004768   19.16   2e-16 ***

Then the fit of y2~x2:
  summary(lm(y2~x2))
Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept) 0.208216   0.005171   40.26   2e-16 ***
x2  0.118840   0.005009   23.73   2e-16 ***

so the estimated slopes idiffere by 0.118840 - 0.091382 = 0.027458
But what is the significance of this difference?

Now:
  summary(lm12)
Coefficients:
Estimate Std. Error t value Pr(|t|)
(Intercept) 0.206042   0.004923  41.852   2e-16 ***
x   0.091382   0.005052  18.088   2e-16 ***
S1  0.002174   0.006953   0.313 0.754926
x:S10.027457   0.006939   3.957 0.000106 ***

so the x:S1 value is the same as the difference in slopes
as estimated from lm1 and lm2; but now we have a standard error
and a P-value for it. You can also use anova now:

  anova(lm12)
Response: y
   Df  Sum Sq Mean Sq  F valuePr(F)
x   1 2.26537 2.26537 946.2702  2.2e-16 ***
S   1 0.00015 0.00015   0.0614 0.8045253
x:S 1 0.03749 0.03749  15.6599 0.0001060 ***
Residuals 196 0.46922 0.00239   

so you get the same P-value, though with anova() you do not see
the actual estimate of the difference between the slopes.

Hoping this helps,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 06-Aug-07   Time: 12:16:06
-- XFMail --

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


[R] test about distribution of data in a single population

2007-07-19 Thread João Fadista
Dear all,
 
I would like to know how can I test which are the intervals of my data that 
have significant less or more counts than the other intervals.
Example:
 
Interval[1:200][200:400][400:600][600:800] ... more 900 
hundred columns
Count   122875  
  
 
 
 

Thanks in advance,
Best regards

João Fadista
Ph.d. student



 UNIVERSITY OF AARHUS   
Faculty of Agricultural Sciences
Dept. of Genetics and Biotechnology 
Blichers Allé 20, P.O. BOX 50   
DK-8830 Tjele   

Phone:   +45 8999 1900  
Direct:  +45 8999 1900  
E-mail:  [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]   
Web: www.agrsci.org http://www.agrsci.org/


News and news media http://www.agrsci.org/navigation/nyheder_og_presse .

This email may contain information that is confidential. Any use or publication 
of this email without written permission from Faculty of Agricultural Sciences 
is not allowed. If you are not the intended recipient, please notify Faculty of 
Agricultural Sciences immediately and delete this email.


[[alternative HTML version deleted]]

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


[R] test of CA axis

2007-07-05 Thread Kris Lockyear
Dear All,

I am not a statistician, and was wondering if anyone could help me 
with the following.

Greenacre, in his Correspondence Analysis in Practice (1993, p.173) 
gives a method for testing the significance of an axis in CA where:

$\chi^2 = \lambda \times n$ where \lambda is the the eigenvalue for 
the principal axis and n is the number of objects in the 
analysis.  The value for \chi^2 is then compared to a table of 
critical values.  The table in his book is a subset of Table 51 in 
Pearson and Hartley 1976, Biometrica Tables for Statisticians vol II, 
described as Percentage points of the extreme roots of 
$|\text{\textbf{S}}\Sigma^{-1}-c\text{\textbf{I}}|=0$

Is there an easy way of doing this test in R?  My main problem in 
that Table 51 only gives values for a maximum of a p=10, \nu = 200 
table and mine are regularly much bigger than that (although it would 
be also nice to be able to put in the figures for lambda, n, p and 
\nu and get the probability back).

Many thanks in advance, Kris Lockyear.

Dr Kris Lockyear
Institute of Archaeology
31-34 Gordon Square
London

phone: 020 7679 4568
email: [EMAIL PROTECTED]

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


Re: [R] test if files in current folder

2007-06-14 Thread Vladimir Eremeev



runner wrote:
 
 I want to test if the files are already in my current folder before I
 download or copy from somewhere else. What's in my mind is to check if a
 file is open-able in current folder. Is there a way to do this, like in
 Perl: 
 if (open()) { do sth}?
 
 To put it another way, how to extract all file names in a folder to an
 array or list? 
 

?files
?dir

BTW, Perl has nice -X functions, which allow file testing without explicit
opening:
 http://perldoc.perl.org/functions/-X.html
-- 
View this message in context: 
http://www.nabble.com/test-if-files-in-current-folder-tf3919587.html#a8347
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] test if files in current folder

2007-06-14 Thread Prof Brian Ripley
On Thu, 14 Jun 2007, Vladimir Eremeev wrote:




 runner wrote:

 I want to test if the files are already in my current folder before I
 download or copy from somewhere else. What's in my mind is to check if a
 file is open-able in current folder. Is there a way to do this, like in
 Perl:
 if (open()) { do sth}?

 To put it another way, how to extract all file names in a folder to an
 array or list?


 ?files
 ?dir

 BTW, Perl has nice -X functions, which allow file testing without explicit
 opening:
 http://perldoc.perl.org/functions/-X.html

which are based on those in 'test' and most Unix shells, as is R's 
file.test() in package 'utils'.

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

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


Re: [R] test for nested factors

2007-06-05 Thread J. R. M. Hosking
Tim Bergsma wrote:
 Is there a conventional way to test for nested factors?  I.e., if 'a' 
 and 'b' are lists of same-length factors, does each level specified by 
 'a' correspond to exactly one level specified by 'b'?

all( tapply(b, a, function(x) length(unique(x))==1 ))


J. R. M. Hosking

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


[R] test for nested factors

2007-06-04 Thread Tim Bergsma
Is there a conventional way to test for nested factors?  I.e., if 'a' 
and 'b' are lists of same-length factors, does each level specified by 
'a' correspond to exactly one level specified by 'b'?

The function below seems to suffice, but I'd be happy to know of a more 
succinct solution, if it already exists.

Thanks,

Tim.

---

%nested.in% - function(x,f,...){
#coerce to list
if(!is.list(x))x-list(x)
if(!is.list(f))f-list(f)
#collapse to vector
x - tapply(x[[1]],x)
f - tapply(f[[1]],f)
#analyse
return(all(sapply(lapply(split(f,x),unique),length)==1))
}

CO2$Plant %nested.in% CO2[,c(Type,Treatment)] #TRUE
CO2$Plant %nested.in% (CO2$uptake  mean(CO2$uptake)) #FALSE

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


Re: [R] test for nested factors

2007-06-04 Thread hadley wickham
On 6/4/07, Tim Bergsma [EMAIL PROTECTED] wrote:
 Is there a conventional way to test for nested factors?  I.e., if 'a'
 and 'b' are lists of same-length factors, does each level specified by
 'a' correspond to exactly one level specified by 'b'?

 The function below seems to suffice, but I'd be happy to know of a more
 succinct solution, if it already exists.

How about:

%nested% - function(a, b) {
if (is.list(a)) a - do.call(interaction, c(a, drop=TRUE))
if (is.list(b)) b - do.call(interaction, c(b, drop=TRUE))

length(unique(a))  == length(unique(interaction(a, b, drop=TRUE)))
}

CO2$Plant %nested% CO2[,c(Type,Treatment)] #TRUE
CO2$Plant %nested% (CO2$uptake  mean(CO2$uptake)) #FALSE

?

Hadley

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


Re: [R] test for nested factors

2007-06-04 Thread Christophe Pallier
Here are two functions I wrote, 'is.nested' and 'are.crossed', that check
whether a factor is nested inside antoher one, or if both are crossed:

is.nested - function (factor1,factor2)
  {
# only one positive number per line in the f1 * f2 crosstable
all(apply(table(factor1,factor2)0,1,sum) == 1)
  }

are.crossed - function (factor1,factor2)
  { all(table(factor1,factor2)  0 ) }

Christophe Pallier
www.pallier.org

On 6/4/07, Tim Bergsma [EMAIL PROTECTED] wrote:

 Is there a conventional way to test for nested factors?  I.e., if 'a'
 and 'b' are lists of same-length factors, does each level specified by
 'a' correspond to exactly one level specified by 'b'?

 The function below seems to suffice, but I'd be happy to know of a more
 succinct solution, if it already exists.

 Thanks,

 Tim.

 ---

 %nested.in% - function(x,f,...){
 #coerce to list
 if(!is.list(x))x-list(x)
 if(!is.list(f))f-list(f)
 #collapse to vector
 x - tapply(x[[1]],x)
 f - tapply(f[[1]],f)
 #analyse
 return(all(sapply(lapply(split(f,x),unique),length)==1))
 }

 CO2$Plant %nested.in% CO2[,c(Type,Treatment)] #TRUE
 CO2$Plant %nested.in% (CO2$uptake  mean(CO2$uptake)) #FALSE

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




-- 
Christophe Pallier (http://www.pallier.org)

[[alternative HTML version deleted]]

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


[R] test to compare significant correlation increase

2007-05-30 Thread David Riano
Hi!
I am calculating correlation between two variables:
1. X versus Y
2. X versus Y(with a 3 steps lag)

I would like to test if the correlation 
increase/decrease from 1 to 2 is significant or not.

Is there any function in R to do this? any hints?

Thanks for help :)

David Riaño
Center for Spatial Technologies and Remote Sensing (CSTARS)
University of California
250-N, The Barn
One Shields Avenue
Davis, CA 95616-8527
USA
1-(517) 629-5499
http://www.cstars.ucdavis.edu/~driano/index.html
http://www.cstars.ucdavis.edu

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


Re: [R] test to compare significant correlation increase

2007-05-30 Thread Mike Lawrence
Just a guess (please correct if I'm way off on this), but maybe you  
could look at the difference in r betwen 1  2 and see if the  
confidence interval (http://davidmlane.com/hyperstat/B8544.html) for  
this value given your sample size includes 0.

On 30-May-07, at 11:24 AM, David Riano wrote:

 Hi!
 I am calculating correlation between two variables:
 1. X versus Y
 2. X versus Y(with a 3 steps lag)

 I would like to test if the correlation
 increase/decrease from 1 to 2 is significant or not.

 Is there any function in R to do this? any hints?

 Thanks for help :)

 David Riaño
 Center for Spatial Technologies and Remote Sensing (CSTARS)
 University of California
 250-N, The Barn
 One Shields Avenue
 Davis, CA 95616-8527
 USA
 1-(517) 629-5499
 http://www.cstars.ucdavis.edu/~driano/index.html
 http://www.cstars.ucdavis.edu

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

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

Website: http://myweb.dal.ca/mc973993
Public calendar: http://icalx.com/public/informavore/Public

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

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


Re: [R] test to compare significant correlation increase

2007-05-30 Thread Jonathan Baron
In response to the original message, see
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/85753.html

which describes two papers about comparing dependent correlations,
which I think is a relevant question.  (Try Google too.  I didn't.)

There is also a paper by Steiger in Psychological Bulletin, 1980,
which I implemented in the following R code.  (Not tested since I
translated it from a BASIC script written in 1981.)

r12 - as.numeric(readline(Difference r12 and r13, given r23. Input r12: ))
r13 - as.numeric(readline(r13: ))
r23 - as.numeric(readline(r23: ))
N - as.numeric(readline(Number of Ss: ))
rd - 1-r12*r12-r13*r13-r23*r23+2*r12*r13*r23
t2 - (r12-r13)*sqrt((N-1)*(1+r23)/(2*rd*(N-1)/(N-3)+((r12+r13)/2)^2*(1-r23)^3))
print(paste(t(,N-3,)=,t2, p=,pt(t2,N-3), one tailed,sep=))
print(Steiger, J.H. (1980). Tests for comparing elements of a)
print(correlation matrix.  Psychological Bulletin, 87, 245-251.)

 On 30-May-07, at 11:24 AM, David Riano wrote:
 
  Hi!
  I am calculating correlation between two variables:
  1. X versus Y
  2. X versus Y(with a 3 steps lag)
 
  I would like to test if the correlation
  increase/decrease from 1 to 2 is significant or not.
 
  Is there any function in R to do this? any hints?
 
  Thanks for help :)
 
  David Ria�o
  Center for Spatial Technologies and Remote Sensing (CSTARS)
  University of California
  250-N, The Barn
  One Shields Avenue
  Davis, CA 95616-8527
  USA
  1-(517) 629-5499
  http://www.cstars.ucdavis.edu/~driano/index.html
  http://www.cstars.ucdavis.edu
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting- 
  guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 --
 Mike Lawrence
 Graduate Student, Department of Psychology, Dalhousie University
 
 Website: http://myweb.dal.ca/mc973993
 Public calendar: http://icalx.com/public/informavore/Public
 
 The road to wisdom? Well, it's plain and simple to express:
 Err and err and err again, but less and less and less.
   - Piet Hein
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

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

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


[R] test deviation from a binomial distribution - lack of 50:50

2007-04-23 Thread parn
Dear R-users,

I have a data set where each observation consists of a number of trials
(n.trials) that varies between 5 and 7, 6 being most common. Each trial
can take either of two outcomes, success or failure.

A dummy data set:
n.trials - sample(5:7, 50, replace=T, prob=c(0.2, 0.6, 0.2))
success - rbinom(50, n.trials, p=0.5)
failure - n.trials - success

I know I could test for a deviation from 50:50 success:failure in one or
the other direction using a glm with binomial errors. However, I
suspect that in my 'real' data set the outcome 50:50 is
underrepresented, not due to a skew in one particular direction, but
rather that within each observation there are either many successes or
many failures. Although I did not manage to create a dummy data set
with these properties, which would be the proper way in R to test for a
'lack of 50:50 outcome' using the simple dummy data above as a starting
point?

Thanks in advance!

Henrik

--

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


[R] test ANOVA/ANCOVA

2007-03-23 Thread sebastien boutry
Hello everybody,


I search a test for compare the k means but I have one quantitative variable 
and two groups date, traitement. And I suppose my samples are dependant with 
the date.
What the statistical test would I use?
Thank you.

my data:

dateEU  DW
wk1 EU1 5,324547829
wk1 EU1 7,321253265
wk1 EU1 4,431712065
wk1 EU2 8,230322407
wk1 EU2 8,546873269
wk1 EU2 5,657332069
wk1 EU3 3,165508618
wk1 EU3 4,431712065
wk1 EU3 1,899305171
wk2 EU1 2,163097556
wk2 EU1 17,61379438
wk2 EU1 15,82754309
wk2 EU2 16,46064481
wk2 EU2 19,30960257
wk2 EU2 13,92823792
wk2 EU3 6,014466374
wk2 EU3 7,280669822
wk2 EU3 5,064813789
wk4 EU1 11,03179753
wk4 EU1 29,75578101
wk4 EU1 22,71252433
wk4 EU2 27,85647584
wk4 EU2 36,71989997
wk4 EU2 20,11680727
wk4 EU3 13,59661321
wk4 EU3 13,2951362
wk4 EU3 14,56133964
wk6 EU1 30,73875474
wk6 EU1 33,27842393
wk6 EU1 35,27512937
wk6 EU2 31,2817185
wk6 EU2 41,53147307
wk6 EU2 35,57093758
wk6 EU3 8,652390223
wk6 EU3 18,6359174
wk6 EU3 15,30807501

_
Avec Windows Live OneCare éliminez tous les virus de votre PC !

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


[R] test for bimodality

2007-03-12 Thread Andrew Smith
Hi,

I found this post from 6 years ago about this:

https://stat.ethz.ch/pipermail/r-help/2001-May/012800.html

Basically, I'd like to find an R implementation of the
multimodality test in the book Introduction to the
Bootstrap by Efron and Tibshirani. There is an R
package bootstrap which is the package to go with the
book, but it does not seem to implement the
multimodality test. I found this post to the S mailing
list giving an implementation in development:

http://www.biostat.wustl.edu/archives/html/s-news/2000-06/msg00038.html

but I'm not sure about it. Anyway, if anyone knows
where I can find an R implementation please let me and
the list know.

thanks,
Andrew Smith

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


[R] Test of Presence Matrix HOWTO?

2007-02-26 Thread Johannes Graumann
Hello,

Imagine 3 lists like so:

 a - list(A,B,C,D)
 b - list(A,B,E,F)
 c - list(A,C,E,G)

What I need (vennDiagram) is a matrix characterizing with 1 or 0 whether any
given member is present or not like so:
 x1 x2 x3
[1,]  1  1  1
[2,]  1  1  0
[3,]  1  0  1
[4,]  1  0  0
[5,]  0  1  1
[6,]  0  1  0
[7,]  0  0  1

(where the rows represent A-G and the columns a-c, respectively).

 table(c(a,b,c))
will give me a quick answer for the 1 1 1 case, but how to deal with the
other cases efficiently without looping over each string and looking for
membership %in% each list?

Thanks for enlightening the learning,

Joh

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


Re: [R] Test of Presence Matrix HOWTO?

2007-02-26 Thread ONKELINX, Thierry
 a - c(A,B,C,D)
 b - c(A,B,E,F)
 c - c(A,C,E,G)
 Df - cbind(a, b, c)
 apply(Df, 2, function(x)(LETTERS[1:7] %in% x))
 a b c
[1,]  TRUE  TRUE  TRUE
[2,]  TRUE  TRUE FALSE
[3,]  TRUE FALSE  TRUE
[4,]  TRUE FALSE FALSE
[5,] FALSE  TRUE  TRUE
[6,] FALSE  TRUE FALSE
[7,] FALSE FALSE  TRUE
 
 apply(Df, 2, function(x)(as.numeric(LETTERS[1:7] %in% x)))
 a b c
[1,] 1 1 1
[2,] 1 1 0
[3,] 1 0 1
[4,] 1 0 0
[5,] 0 1 1
[6,] 0 1 0
[7,] 0 0 1


Cheers,

Thierry



ir. Thierry Onkelinx

Instituut voor natuur- en bosonderzoek / Reseach Institute for Nature
and Forest

Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance

Gaverstraat 4

9500 Geraardsbergen

Belgium

tel. + 32 54/436 185

[EMAIL PROTECTED]

www.inbo.be 

 

Do not put your faith in what statistics say until you have carefully
considered what they do not say.  ~William W. Watt

A statistical analysis, properly conducted, is a delicate dissection of
uncertainties, a surgery of suppositions. ~M.J.Moroney


 -Oorspronkelijk bericht-
 Van: [EMAIL PROTECTED] [mailto:r-help-
 [EMAIL PROTECTED] Namens Johannes Graumann
 Verzonden: maandag 26 februari 2007 16:25
 Aan: r-help@stat.math.ethz.ch
 Onderwerp: [R] Test of Presence Matrix HOWTO?
 
 Hello,
 
 Imagine 3 lists like so:
 
  a - list(A,B,C,D)
  b - list(A,B,E,F)
  c - list(A,C,E,G)
 
 What I need (vennDiagram) is a matrix characterizing with 1 or 0
whether
 any
 given member is present or not like so:
  x1 x2 x3
 [1,]  1  1  1
 [2,]  1  1  0
 [3,]  1  0  1
 [4,]  1  0  0
 [5,]  0  1  1
 [6,]  0  1  0
 [7,]  0  0  1
 
 (where the rows represent A-G and the columns a-c, respectively).
 
  table(c(a,b,c))
 will give me a quick answer for the 1 1 1 case, but how to deal with
the
 other cases efficiently without looping over each string and looking
for
 membership %in% each list?
 
 Thanks for enlightening the learning,
 
 Joh
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-
 guide.html
 and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] Test of Presence Matrix HOWTO?

2007-02-26 Thread Dimitris Rizopoulos
you can use something like the following:

a - list(A,B,C,D)
b - list(A,B,E,F)
c - list(A,C,E,G)

#

abc - list(a, b, c)
unq.abc - unique(unlist(abc))

out.lis - lapply(abc, %in%, x = unq.abc)
out.lis
lapply(out.lis, as.numeric)


I hope it helps.

Best,
Dimitris


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

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


- Original Message - 
From: Johannes Graumann [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Monday, February 26, 2007 4:25 PM
Subject: [R] Test of Presence Matrix HOWTO?


 Hello,

 Imagine 3 lists like so:

 a - list(A,B,C,D)
 b - list(A,B,E,F)
 c - list(A,C,E,G)

 What I need (vennDiagram) is a matrix characterizing with 1 or 0 
 whether any
 given member is present or not like so:
 x1 x2 x3
 [1,]  1  1  1
 [2,]  1  1  0
 [3,]  1  0  1
 [4,]  1  0  0
 [5,]  0  1  1
 [6,]  0  1  0
 [7,]  0  0  1

 (where the rows represent A-G and the columns a-c, 
 respectively).

 table(c(a,b,c))
 will give me a quick answer for the 1 1 1 case, but how to deal 
 with the
 other cases efficiently without looping over each string and looking 
 for
 membership %in% each list?

 Thanks for enlightening the learning,

 Joh

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


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

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


[R] Test for Kurtosis.

2006-12-13 Thread Megh Dal
Dear all R users,
   
  I question is on the subject of Statistics rather R related. I am searching 
some documentation on statistical significance test for Kurtosis especially 
Glyn test. More specifically I am looking for documentation on:
   
  1: Test statistic for Glyn test
  2. Statistical properties of this test like distribution etc.
   
  Can anyone give me any reference on this?
   
  Any help will be highly appreciated.
   
  Thanks and regard,
  megh.

 
-

[[alternative HTML version deleted]]

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


Re: [R] test of spatial dependence?? - ask an ecologist?

2006-12-07 Thread David Farrar
 
  Although you don't have coordinates, there has to be some kind of information 
on spatial relationships.  (I am likely saying the same thing as Roger.)  
   
  Let me see if I have this right.  Some large area is partitioned into cells 
(polygons in an ArcInfo shape file?) and, within each cell you compute 
something.  Then the distance between any two cells may be zero or one, one for 
any pair of cells that are adjacent, zero for any pair not adjacent.  
   
  It doesn't strike me as that odd a situation and so I think I would like to 
know what is a conventional solution.  One possibility would be to use 
Euclidean distances among centroids of cells.  
   
  I have not reviewed the basis of the Mantel tests used by ecologists.  If 
that is what you need, in looking for a program we would need to be mindful of 
the fact that a probably different Mantel test is used routinely for 
evaluation of disease data, in particular specialized as the logrank test of 
survival analysis.  
   
  regards, 
  Farrar
  

Roger Bivand [EMAIL PROTECTED] wrote:
  On Wed, 6 Dec 2006, Xu Yuan wrote:

 Thanks David and Milton for replies. No, I don't have the coordiates.
 In other words, my data are not point data. But I think there is a way
 to test of spatial dependence for areal data or lattice data. In this
 case, the variable of interest is typically the average value of an
 area instead of a point. Do you how to do this?

But do you know where the areas are in relation to each other? Does the 
spatialCovariance package help?

Roger

 
 Thank you.
 Xu
 
 On 12/6/06, Milton Cezar Ribeiro wrote:
 
  I never used it, but I beleave that it is a job for mantel.rtest() 
  available on ade4 package.
 
  In fact Farrar are right, you will neet the XY coordinates. Give a look at 
  Legendre  Legendre text book.
 
  HTH,
 
  Miltinho
  Brazil
 
  David Farrar escreveu:
 
 
  In addition to the 25 numbers, I assume you have coordinates of each field.
  Otherwise, I don't understand what you are trying to do. I think ecologists 
  like to use a test due to Mantel in this situation.
 
  The prefix auto means self, of course, the idea being that measurements 
  of the same variable under different conditions are correlated. I guess 
  this would be a case of autodependence. For correlation versus 
  dependence, check your intro stats book.
 
  de nada,
  X'X
 
  Farrar
 
 
  Xu Yuan wrote:
  hello R-friends,
 
  I am a R beginner and try to ask a basic question:
 
  How to test the spatial dependence of a column of data? for example, I have
  25 agricultural fields, and I measure the average slope (%) or pH for each
  field. All I have is 25 numbers.
 
  PS, could someone confirm that spatial dependence is equivalent to
  spatial correlation or spatial autocorrelation or not.
 
  Thank you very much.
  XY
 
  [[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
  [[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 
  
 O Yahoo! está de cara nova. Venha conferir!
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

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


[[alternative HTML version deleted]]

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


Re: [R] test of spatial dependence??

2006-12-06 Thread Scionforbai
 How to test the spatial dependence of a column of data? for example
[...]
 All I have is 25 numbers.

If you don't have coordinates of your data, as I understand here,
there's nothing you can do, of course ...
If you have coordinates, you should compute the variogram -and/or the
spatial covariance- of your data and look if they are meaningful.
Hint: read a book about geostatistics.

 PS, could someone confirm that spatial dependence is equivalent to
 spatial correlation or spatial autocorrelation or not.

So, to me there is a light difference, but it's really for advanced
users, and maybe questionable.

Bye.

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


Re: [R] test of spatial dependence?? - ask an ecologist?

2006-12-06 Thread Milton Cezar Ribeiro
I never used it, but I beleave that it is a job for mantel.rtest() available 
on ade4 package.
   
  In fact Farrar are right, you will neet the XY coordinates. Give a look at 
Legendre  Legendre text book.
   
  HTH,
   
  Miltinho
  Brazil

David Farrar [EMAIL PROTECTED] escreveu:
  

In addition to the 25 numbers, I assume you have coordinates of each field.
Otherwise, I don't understand what you are trying to do. I think ecologists 
like to use a test due to Mantel in this situation. 

The prefix auto means self, of course, the idea being that measurements of 
the same variable under different conditions are correlated. I guess this would 
be a case of autodependence. For correlation versus dependence, check your 
intro stats book. 

de nada, 
X'X 

Farrar 


Xu Yuan wrote:
hello R-friends,

I am a R beginner and try to ask a basic question:

How to test the spatial dependence of a column of data? for example, I have
25 agricultural fields, and I measure the average slope (%) or pH for each
field. All I have is 25 numbers.

PS, could someone confirm that spatial dependence is equivalent to
spatial correlation or spatial autocorrelation or not.

Thank you very much.
XY

[[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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



-

[[alternative HTML version deleted]]

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


Re: [R] test of spatial dependence?? - ask an ecologist?

2006-12-06 Thread David Farrar
 
  match-making is such fun.
   
  Farrar

Milton Cezar Ribeiro [EMAIL PROTECTED] wrote:
I never used it, but I beleave that it is a job for mantel.rtest() 
available on ade4 package.
   
  In fact Farrar are right, you will neet the XY coordinates. Give a look at 
Legendre  Legendre text book.
   
  HTH,
   
  Miltinho
  Brazil

David Farrar [EMAIL PROTECTED] escreveu:
  

In addition to the 25 numbers, I assume you have coordinates of each field.
Otherwise, I don't understand what you are trying to do. I think ecologists 
like to use a test due to Mantel in this situation. 

The prefix auto means self, of course, the idea being that measurements of 
the same variable under different conditions are correlated. I guess this would 
be a case of autodependence. For correlation versus dependence, check your 
intro stats book. 

de nada, 
X'X 

Farrar 


Xu Yuan wrote:
hello R-friends,

I am a R beginner and try to ask a basic question:

How to test the spatial dependence of a column of data? for example, I have
25 agricultural fields, and I measure the average slope (%) or pH for each
field. All I have is 25 numbers.

PS, could someone confirm that spatial dependence is equivalent to
spatial correlation or spatial autocorrelation or not.

Thank you very much.
XY

[[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


-
  O Yahoo! está de cara nova. Venha conferir!

[[alternative HTML version deleted]]

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


Re: [R] test of spatial dependence?? - ask an ecologist?

2006-12-06 Thread Xu Yuan
Thanks David and Milton for replies. No, I don't have the coordiates.
In other words, my data are not point data. But I think there is a way
to test of spatial dependence for areal data or lattice data. In this
case, the variable of interest is typically the average value of an
area instead of a point. Do you how to do this?

 Thank you.
 Xu

On 12/6/06, Milton Cezar Ribeiro [EMAIL PROTECTED] wrote:

 I never used it, but I beleave that it is a job for mantel.rtest() 
 available on ade4 package.

 In fact Farrar are right, you will neet the XY coordinates. Give a look at 
 Legendre  Legendre text book.

 HTH,

 Miltinho
 Brazil

 David Farrar [EMAIL PROTECTED] escreveu:


 In addition to the 25 numbers, I assume you have coordinates of each field.
 Otherwise, I don't understand what you are trying to do. I think ecologists 
 like to use a test due to Mantel in this situation.

 The prefix auto means self, of course, the idea being that measurements 
 of the same variable under different conditions are correlated. I guess this 
 would be a case of autodependence. For correlation versus dependence, check 
 your  intro stats book.

 de nada,
 X'X

 Farrar


 Xu Yuan wrote:
 hello R-friends,

 I am a R beginner and try to ask a basic question:

 How to test the spatial dependence of a column of data? for example, I have
 25 agricultural fields, and I measure the average slope (%) or pH for each
 field. All I have is 25 numbers.

 PS, could someone confirm that spatial dependence is equivalent to
 spatial correlation or spatial autocorrelation or not.

 Thank you very much.
 XY

 [[alternative HTML version deleted]]

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


 [[alternative HTML version  deleted]]

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



   
  O Yahoo! está de cara nova. Venha conferir!



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


Re: [R] test of spatial dependence?? - ask an ecologist?

2006-12-06 Thread Roger Bivand
On Wed, 6 Dec 2006, Xu Yuan wrote:

 Thanks David and Milton for replies. No, I don't have the coordiates.
 In other words, my data are not point data. But I think there is a way
 to test of spatial dependence for areal data or lattice data. In this
 case, the variable of interest is typically the average value of an
 area instead of a point. Do you how to do this?

But do you know where the areas are in relation to each other? Does the 
spatialCovariance package help?

Roger

 
  Thank you.
  Xu
 
 On 12/6/06, Milton Cezar Ribeiro [EMAIL PROTECTED] wrote:
 
  I never used it, but I beleave that it is a job for mantel.rtest() 
  available on ade4 package.
 
  In fact Farrar are right, you will neet the XY coordinates. Give a look at 
  Legendre  Legendre text book.
 
  HTH,
 
  Miltinho
  Brazil
 
  David Farrar [EMAIL PROTECTED] escreveu:
 
 
  In addition to the 25 numbers, I assume you have coordinates of each field.
  Otherwise, I don't understand what you are trying to do. I think ecologists 
  like to use a test due to Mantel in this situation.
 
  The prefix auto means self, of course, the idea being that measurements 
  of the same variable under different conditions are correlated. I guess 
  this would be a case of autodependence. For correlation versus 
  dependence, check your  intro stats book.
 
  de nada,
  X'X
 
  Farrar
 
 
  Xu Yuan wrote:
  hello R-friends,
 
  I am a R beginner and try to ask a basic question:
 
  How to test the spatial dependence of a column of data? for example, I have
  25 agricultural fields, and I measure the average slope (%) or pH for each
  field. All I have is 25 numbers.
 
  PS, could someone confirm that spatial dependence is equivalent to
  spatial correlation or spatial autocorrelation or not.
 
  Thank you very much.
  XY
 
  [[alternative HTML version deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
  [[alternative HTML version  deleted]]
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 
 
 
  
   O Yahoo! está de cara nova. Venha conferir!
 
 
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: [EMAIL PROTECTED]

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


[R] test of spatial dependence??

2006-12-05 Thread Xu Yuan
hello R-friends,

I am a R beginner and try to ask a basic question:

How to test the spatial dependence of a column of data? for example, I have
25 agricultural fields, and I measure the average slope (%) or pH for each
field. All I have is 25 numbers.

PS, could someone confirm that spatial dependence is equivalent to
spatial correlation or spatial autocorrelation or not.

Thank you very much.
XY

[[alternative HTML version deleted]]

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


Re: [R] test of spatial dependence?? - ask an ecologist?

2006-12-05 Thread David Farrar
 
   
  In addition to the 25 numbers, I assume you have coordinates of each field.
  Otherwise, I don't understand what you are trying to do.  I think ecologists 
like to use a test due to Mantel in this situation.  
   
  The prefix auto means self, of course, the idea being that measurements 
of the same variable under different conditions are correlated.  I guess this 
would be a case of autodependence.  For correlation versus dependence, check 
your intro stats book.  
   
  de nada, 
  X'X 
   
  Farrar 
  

Xu Yuan [EMAIL PROTECTED] wrote:
  hello R-friends,

I am a R beginner and try to ask a basic question:

How to test the spatial dependence of a column of data? for example, I have
25 agricultural fields, and I measure the average slope (%) or pH for each
field. All I have is 25 numbers.

PS, could someone confirm that spatial dependence is equivalent to
spatial correlation or spatial autocorrelation or not.

Thank you very much.
XY

[[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

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


Re: [R] Test internet presence

2006-09-13 Thread mel
Gregor Gorjanc a écrit :

 If I summarize the thread there is (currently) no way to test for
 internet presence with a general approach.

what about try(readLines(...)) ?
(at least it works fine on Windows.)

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


Re: [R] Test internet presence

2006-09-12 Thread Ted Harding
On 11-Sep-06 Gregor Gorjanc wrote:
 Thank you. Your solution is usable but unfortunatelly not portable to
 Windows. I would like to use this test in package check, which can
 include also windows OS.

Now that I think about it (should have done that earlier),
you can use the value of .Platform$OS.type (either unix
or windows) to determine the OS type, and also the
value of the system command to see what is sent back
from the ping command.

Then the R command to ping a remote host once would be

  system(ping -c 1 remote host) for unix

  system(ping -n 1 remote host) for windows
(at any rate for the DOS-based ping in Windows 98).

However, the returned value of system (which consists
of the output of the ping commmand) is a multi-line value,
and is different between Unix and Windows

So to distinguish between success and failure, you would
have to do some slightly complex parsing of the output
returned by system, and evaluate it differently according
to operating system. And the latter may vary between different
versions of the OS ... Maybe it wasn't such a good suggestion
after all.

However, since separate versions of your package would be
compiled for Unix-like systems and for Windows, perhaps a
way round such differences is to write a different script
for each one (shell script as before for Unix, batch file
for Windows), crafted so as to return identical results in
the two cases for success, and for failure.

Best wishes,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 12-Sep-06   Time: 01:28:15
-- XFMail --

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


Re: [R] Test internet presence

2006-09-12 Thread Gregor Gorjanc
Prof Brian Ripley ripley at stats.ox.ac.uk writes:
...
 Check out tests/internet.R.  nsl() checks if you can resolve host names, 
 which has worked well enough there.

Thank you prof. Ripley for this pointer. I am posting here the relevant part if
someone does not look at SVN. I would just like to ask why is .Platform$OS.type
== unix added to the test? Is nsl() available only on unix like platforms or
... I did not found any specifics in its help page.

if(!capabilities()[http/ftp]) {
warning(no internet capabilities)
q()
}

if(.Platform$OS.type == unix 
   is.null(nsl(cran.r-project.org))) q()

Does it make any sense to write a function that would use these two tests.

isNetAvailable - function()
{
  ifelse(!capabilities()[http/ftp]  
## .Platform$OS.type == unix  ## ??? 
 is.null(nsl(cran.r-project.org)), 
 FALSE, 
 TRUE)
}

Regards, Gregor

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


Re: [R] Test internet presence

2006-09-12 Thread Gregor Gorjanc
Gabor Grothendieck wrote:
 Here is a variation for Windows.  The second line returns TRUE or FALSE
 and may need to be varied if the output of ping is not the same on your
 system as on mine:
 
 ping - system(ping www.google.com, intern = TRUE)
 as.numeric(strsplit(grep(Received, ping, value = TRUE), [
 ,])[[1]][8])  0
 

...

Thank you Gabor and Ted! These are all fine ways, but as both of you
have stated not really general as you never know what ping will produce
on different versions etc. I am really keen on test from
tests/internet.R. If that test is OK for base R, I do not see why it
should not be OK for R package. I just hope to get some more feedback on
my question[1] to prof. Ripley.

[1]https://stat.ethz.ch/pipermail/r-help/2006-September/112766.html

Thank you!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

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


Re: [R] Test internet presence

2006-09-12 Thread Prof Brian Ripley
On Mon, 11 Sep 2006, Gregor Gorjanc wrote:

 Prof Brian Ripley ripley at stats.ox.ac.uk writes:
 ...
  Check out tests/internet.R.  nsl() checks if you can resolve host names, 
  which has worked well enough there.
 
 Thank you prof. Ripley for this pointer. I am posting here the relevant part 
 if
 someone does not look at SVN. I would just like to ask why is 
 .Platform$OS.type
 == unix added to the test? Is nsl() available only on unix like platforms or
 ... I did not found any specifics in its help page.

Did you look at the help page on Windows?  Looking at the help page on 
Unix only tells you about Unix.

Hint: the help page is src/library/utils/man/unix/nsl.Rd

(In my country, PhD students are supposed to be able to find things 
like that out for themselves.)

 
 if(!capabilities()[http/ftp]) {
 warning(no internet capabilities)
 q()
 }
 
 if(.Platform$OS.type == unix 
is.null(nsl(cran.r-project.org))) q()
 
 Does it make any sense to write a function that would use these two tests.
 
 isNetAvailable - function()
 {
   ifelse(!capabilities()[http/ftp]  
 ## .Platform$OS.type == unix  ## ??? 
  is.null(nsl(cran.r-project.org)), 
  FALSE, 
  TRUE)
 }
 
 Regards, Gregor
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 

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

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


Re: [R] Test internet presence

2006-09-12 Thread Gregor Gorjanc
Prof Brian Ripley wrote:
 On Mon, 11 Sep 2006, Gregor Gorjanc wrote:
 Prof Brian Ripley ripley at stats.ox.ac.uk writes:
 ...
 Check out tests/internet.R.  nsl() checks if you can resolve host names, 
 which has worked well enough there.
 Thank you prof. Ripley for this pointer. I am posting here the relevant part 
 if
 someone does not look at SVN. I would just like to ask why is 
 .Platform$OS.type
 == unix added to the test? Is nsl() available only on unix like platforms 
 or
 ... I did not found any specifics in its help page.
 
 Did you look at the help page on Windows?  Looking at the help page on 
 Unix only tells you about Unix.
 
 Hint: the help page is src/library/utils/man/unix/nsl.Rd
 
 (In my country, PhD students are supposed to be able to find things 
 like that out for themselves.)
 
 
...

Thank you for additional pointer. I did not look windows help page as I
do not have windows at disposal all the time, but You are right - I
should have looked into the sources. I found out that there is no such
function i.e. nsl() under windows.

If I summarize the thread there is (currently) no way to test for
internet presence with a general approach.

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

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


[R] Test internet presence

2006-09-11 Thread Gregor Gorjanc
Hello useRs!

I have a small package and I need internet access for examples. Of
course it works fine when I have internet access, but not otherwise. I
remember I saw a way to test availability of internet access, but I can
not find it now in archives. Can anyone here help me?

Thanks!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

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


Re: [R] Test internet presence

2006-09-11 Thread Gregor Gorjanc
David Barron wrote:
 I means non-zero, not non-negative.
 
...

Thanks. download.file() is fine!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

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


Re: [R] Test internet presence

2006-09-11 Thread David Barron
The function download.file (invisibly) returns a non-negative integer
if it fails, so I suppose you could use this as a test.

On 11/09/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
 Hello useRs!

 I have a small package and I need internet access for examples. Of
 course it works fine when I have internet access, but not otherwise. I
 remember I saw a way to test availability of internet access, but I can
 not find it now in archives. Can anyone here help me?

 Thanks!

 --
 Lep pozdrav / With regards,
 Gregor Gorjanc

 --
 University of Ljubljana PhD student
 Biotechnical Faculty
 Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
 Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

 SI-1230 Domzale tel: +386 (0)1 72 17 861
 Slovenia, Europefax: +386 (0)1 72 17 888

 --
 One must learn by doing the thing; for though you think you know it,
  you have no certainty until you try. Sophocles ~ 450 B.C.

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



-- 
=
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP

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


Re: [R] Test internet presence

2006-09-11 Thread David Barron
I means non-zero, not non-negative.

On 11/09/06, David Barron [EMAIL PROTECTED] wrote:
 The function download.file (invisibly) returns a non-negative integer
 if it fails, so I suppose you could use this as a test.

 On 11/09/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
  Hello useRs!
 
  I have a small package and I need internet access for examples. Of
  course it works fine when I have internet access, but not otherwise. I
  remember I saw a way to test availability of internet access, but I can
  not find it now in archives. Can anyone here help me?
 
  Thanks!
 
  --
  Lep pozdrav / With regards,
  Gregor Gorjanc
 
  --
  University of Ljubljana PhD student
  Biotechnical Faculty
  Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
  Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si
 
  SI-1230 Domzale tel: +386 (0)1 72 17 861
  Slovenia, Europefax: +386 (0)1 72 17 888
 
  --
  One must learn by doing the thing; for though you think you know it,
   you have no certainty until you try. Sophocles ~ 450 B.C.
 
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.
 


 --
 =
 David Barron
 Said Business School
 University of Oxford
 Park End Street
 Oxford OX1 1HP



-- 
=
David Barron
Said Business School
University of Oxford
Park End Street
Oxford OX1 1HP

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


Re: [R] Test internet presence

2006-09-11 Thread Gregor Gorjanc
Gregor Gorjanc wrote:
 Hello useRs!
 
 I have a small package and I need internet access for examples. Of
 course it works fine when I have internet access, but not otherwise. I
 remember I saw a way to test availability of internet access, but I can
 not find it now in archives. Can anyone here help me?
 
 David Barron wrote:
 I means non-zero, not non-negative.

 ...
 
 Thanks. download.file() is fine!
 

Thinking a bit more, download.file() is not really general as I need to
specify an url and it might happen that I have internet connection, but
server that provides url is down. I am to picky on this?

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

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


Re: [R] Test internet presence

2006-09-11 Thread Gregor Gorjanc
Gregor Gorjanc wrote:
 Gregor Gorjanc wrote:
 Hello useRs!

 I have a small package and I need internet access for examples. Of
 course it works fine when I have internet access, but not otherwise. I
 remember I saw a way to test availability of internet access, but I can
 not find it now in archives. Can anyone here help me?

 David Barron wrote:
 I means non-zero, not non-negative.

 ...

 Thanks. download.file() is fine!

 
 Thinking a bit more, download.file() is not really general as I need to
 specify an url and it might happen that I have internet connection, but
 server that provides url is down. I am to picky on this?

Additionally, download.file throws an error if url is not available i.e.
if I do not have internet access. I have used the following example:

if(download.file(url=http://www.r-project.org/index.html;,
 destfile=tempfile()) == 0) {
  print(Yuhuu)
}

unpluged the net cable and got the following message during R CMD check
(in examples part)

trying URL 'http://www.r-project.org/index.html'
Warning: unable to resolve 'www.r-project.org'.
Error in download.file(url = http://www.r-project.org/index.html;,
destfile = tempfile()) :
cannot open URL 'http://www.r-project.org/index.html'
Execution halted

It seems that 'internal' method was used (I use R 2.3.1 under Linux) as
indicated in help page of download.file. I could use wget or lynx
methods, but these two must be available, so this is not really
portable. Are there any other options for testing internet access? I am
thinking that this might be more relevant for R-devel. I will wait a bit
before moving there.

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

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


Re: [R] Test internet presence

2006-09-11 Thread Ted Harding
On 11-Sep-06 Gregor Gorjanc wrote:
 It seems that 'internal' method was used (I use R 2.3.1 under
 Linux) as indicated in help page of download.file. I could
 use wget or lynx methods, but these two must be available,
 so this is not really portable. Are there any other options
 for testing internet access? I am thinking that this might be
 more relevant for R-devel. I will wait a bit
 before moving there.
 
 -- 
 Lep pozdrav / With regards,
 Gregor Gorjanc

Hi Gorjanc,
Since you are using Linux, I think you should ask R to delegate
the test to the system.

If you have a script, in executable file (755) say test.inet.sh,
which says something like

if ping -c 1 something ; then
export NET_UP=YES
  else
export NETP_UP=NO
fi

where something is the IP address or name of an external host
which responds to 'ping' (some will not, depending on their firewall
settings), then you can use on R:

system(test.inet)
if( sys.getenv(NET_UP) == YES ) { ... } else { ... }

For example (nothing to do with R, but shows the principle),
I have the following script to set my system time and hardware
clock from whichever one of 3 NTP servers is willing to respond:

if /bin/ping -c 1 ntp0.zen.co.uk ; then
export NETTIME=/usr/sbin/ntpdate -u ntp0.zen.co.uk
  elif /bin/ping -c 1 ntp2b.mcc.ac.uk ; then
export NETTIME=/usr/sbin/ntpdate -u ntp2b.mcc.ac.uk
  elif /bin/ping -c 1 ntp2c.mcc.ac.uk ; then
export NETTIME=/usr/sbin/ntpdate -u ntp2c.mcc.ac.uk
  else
export NETTIME=
fi
if [ $NETTIME !=  ] ; then
  sleep 1
  sleep 1
  $NETTIME
  /sbin/clock -u -w
  date
fi


which also illustrates how to allow for the possibility that
the default server might not be responding at the time, so
it has 2 fallback servers.

Hoping this helps,
Ted.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 11-Sep-06   Time: 13:42:22
-- XFMail --

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


Re: [R] Test internet presence

2006-09-11 Thread Prof Brian Ripley
On Mon, 11 Sep 2006, [EMAIL PROTECTED] wrote:

 On 11-Sep-06 Gregor Gorjanc wrote:
  It seems that 'internal' method was used (I use R 2.3.1 under
  Linux) as indicated in help page of download.file. I could
  use wget or lynx methods, but these two must be available,
  so this is not really portable. Are there any other options
  for testing internet access? I am thinking that this might be
  more relevant for R-devel. I will wait a bit
  before moving there.

Check out tests/internet.R.  nsl() checks if you can resolve host names, 
which has worked well enough there.

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

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


Re: [R] Test internet presence

2006-09-11 Thread Ted Harding
[Sorry -- errors due to mistyping especially at  below.
 Corrected in the following lines.]

On 11-Sep-06 Ted Harding wrote:
 On 11-Sep-06 Gregor Gorjanc wrote:
 It seems that 'internal' method was used (I use R 2.3.1 under
 Linux) as indicated in help page of download.file. I could
 use wget or lynx methods, but these two must be available,
 so this is not really portable. Are there any other options
 for testing internet access? I am thinking that this might be
 more relevant for R-devel. I will wait a bit
 before moving there.
 
 -- 
 Lep pozdrav / With regards,
 Gregor Gorjanc
 
 Hi Gregor,
 Since you are using Linux, I think you should ask R to delegate
 the test to the system.
 
 If you have a script, in executable file (755) say test.inet.sh,
 which says something like

  if ping -c 1 something ; then
  export NET_UP=YES
else
  export NETP_UP=NO
  fi

 where something is the IP address or name of an external host
 which responds to 'ping' (some will not, depending on their firewall
 settings), then you can use on R:
 
  system(test.inet)
  if( sys.getenv(NET_UP) == YES ) { ... } else { ... }

system(test.inet.sh)
if( sys.getenv(NET_UP) == YES ) { ... } else { ... }

 For example (nothing to do with R, but shows the principle),
 I have the following script to set my system time and hardware
 clock from whichever one of 3 NTP servers is willing to respond:
 
 if /bin/ping -c 1 ntp0.zen.co.uk ; then
 export NETTIME=/usr/sbin/ntpdate -u ntp0.zen.co.uk
   elif /bin/ping -c 1 ntp2b.mcc.ac.uk ; then
 export NETTIME=/usr/sbin/ntpdate -u ntp2b.mcc.ac.uk
   elif /bin/ping -c 1 ntp2c.mcc.ac.uk ; then
 export NETTIME=/usr/sbin/ntpdate -u ntp2c.mcc.ac.uk
   else
 export NETTIME=
 fi
 if [ $NETTIME !=  ] ; then
   sleep 1
   sleep 1
   $NETTIME
   /sbin/clock -u -w
   date
 fi
 
 
 which also illustrates how to allow for the possibility that
 the default server might not be responding at the time, so
 it has 2 fallback servers.
 
 Hoping this helps,
 Ted.
 
 
 E-Mail: (Ted Harding) [EMAIL PROTECTED]
 Fax-to-email: +44 (0)870 094 0861
 Date: 11-Sep-06   Time: 13:42:22
 -- XFMail --
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


E-Mail: (Ted Harding) [EMAIL PROTECTED]
Fax-to-email: +44 (0)870 094 0861
Date: 11-Sep-06   Time: 14:28:11
-- XFMail --

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


Re: [R] Test internet presence

2006-09-11 Thread Gregor Gorjanc
Thank you. Your solution is usable but unfortunatelly not portable to
Windows. I would like to use this test in package check, which can
include also windows OS.

 On 11-Sep-06 Ted Harding wrote:
 On 11-Sep-06 Gregor Gorjanc wrote:
 It seems that 'internal' method was used (I use R 2.3.1 under
 Linux) as indicated in help page of download.file. I could
 use wget or lynx methods, but these two must be available,
 so this is not really portable. Are there any other options
 for testing internet access? I am thinking that this might be
 more relevant for R-devel. I will wait a bit
 before moving there.

 -- 
 Lep pozdrav / With regards,
 Gregor Gorjanc
 Hi Gregor,
 Since you are using Linux, I think you should ask R to delegate
 the test to the system.

 If you have a script, in executable file (755) say test.inet.sh,
 which says something like
 
   if ping -c 1 something ; then
   export NET_UP=YES
 else
   export NETP_UP=NO
   fi
 
 where something is the IP address or name of an external host
 which responds to 'ping' (some will not, depending on their firewall
 settings), then you can use on R:

 system(test.inet)
 if( sys.getenv(NET_UP) == YES ) { ... } else { ... }
 
 system(test.inet.sh)
 if( sys.getenv(NET_UP) == YES ) { ... } else { ... }
 
 For example (nothing to do with R, but shows the principle),
 I have the following script to set my system time and hardware
 clock from whichever one of 3 NTP servers is willing to respond:

 if /bin/ping -c 1 ntp0.zen.co.uk ; then
 export NETTIME=/usr/sbin/ntpdate -u ntp0.zen.co.uk
   elif /bin/ping -c 1 ntp2b.mcc.ac.uk ; then
 export NETTIME=/usr/sbin/ntpdate -u ntp2b.mcc.ac.uk
   elif /bin/ping -c 1 ntp2c.mcc.ac.uk ; then
 export NETTIME=/usr/sbin/ntpdate -u ntp2c.mcc.ac.uk
   else
 export NETTIME=
 fi
 if [ $NETTIME !=  ] ; then
   sleep 1
   sleep 1
   $NETTIME
   /sbin/clock -u -w
   date
 fi


 which also illustrates how to allow for the possibility that
 the default server might not be responding at the time, so
 it has 2 fallback servers.

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

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


Re: [R] Test internet presence

2006-09-11 Thread Gabor Grothendieck
Here is a variation for Windows.  The second line returns TRUE or FALSE
and may need to be varied if the output of ping is not the same on your
system as on mine:

ping - system(ping www.google.com, intern = TRUE)
as.numeric(strsplit(grep(Received, ping, value = TRUE), [ ,])[[1]][8])  0


On 9/11/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
 Thank you. Your solution is usable but unfortunatelly not portable to
 Windows. I would like to use this test in package check, which can
 include also windows OS.

  On 11-Sep-06 Ted Harding wrote:
  On 11-Sep-06 Gregor Gorjanc wrote:
  It seems that 'internal' method was used (I use R 2.3.1 under
  Linux) as indicated in help page of download.file. I could
  use wget or lynx methods, but these two must be available,
  so this is not really portable. Are there any other options
  for testing internet access? I am thinking that this might be
  more relevant for R-devel. I will wait a bit
  before moving there.
 
  --
  Lep pozdrav / With regards,
  Gregor Gorjanc
  Hi Gregor,
  Since you are using Linux, I think you should ask R to delegate
  the test to the system.
 
  If you have a script, in executable file (755) say test.inet.sh,
  which says something like
 
if ping -c 1 something ; then
export NET_UP=YES
  else
export NETP_UP=NO
fi
 
  where something is the IP address or name of an external host
  which responds to 'ping' (some will not, depending on their firewall
  settings), then you can use on R:
 
  system(test.inet)
  if( sys.getenv(NET_UP) == YES ) { ... } else { ... }
 
  system(test.inet.sh)
  if( sys.getenv(NET_UP) == YES ) { ... } else { ... }
 
  For example (nothing to do with R, but shows the principle),
  I have the following script to set my system time and hardware
  clock from whichever one of 3 NTP servers is willing to respond:
 
  if /bin/ping -c 1 ntp0.zen.co.uk ; then
  export NETTIME=/usr/sbin/ntpdate -u ntp0.zen.co.uk
elif /bin/ping -c 1 ntp2b.mcc.ac.uk ; then
  export NETTIME=/usr/sbin/ntpdate -u ntp2b.mcc.ac.uk
elif /bin/ping -c 1 ntp2c.mcc.ac.uk ; then
  export NETTIME=/usr/sbin/ntpdate -u ntp2c.mcc.ac.uk
else
  export NETTIME=
  fi
  if [ $NETTIME !=  ] ; then
sleep 1
sleep 1
$NETTIME
/sbin/clock -u -w
date
  fi
 
 
  which also illustrates how to allow for the possibility that
  the default server might not be responding at the time, so
  it has 2 fallback servers.

 --
 Lep pozdrav / With regards,
Gregor Gorjanc

 --
 University of Ljubljana PhD student
 Biotechnical Faculty
 Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
 Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

 SI-1230 Domzale tel: +386 (0)1 72 17 861
 Slovenia, Europefax: +386 (0)1 72 17 888

 --
 One must learn by doing the thing; for though you think you know it,
  you have no certainty until you try. Sophocles ~ 450 B.C.

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


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


[R] test the tcltk package

2006-08-21 Thread Adrian Dusa
Dear all,

Could anybody using (K)ubuntu (or Linux in general) confirm if this is a 
general problem or it's just my box?
The problem relates to the Options window in the Rcmdr package (which it looks 
fine in John Fox's Quantian). The last option (Default font) is stubborn and 
won't be set; it behaves strangely (e.g. I type 3 and it appears 2).
This options should have a button to drag left and right, but in my 
configuration this is missing; at this link you can see how it looks like:
http://www.roda.ro/Options.png

What should I do to test if the R tcltk package works fine?

I have R 2.3.1, tcl and tk version 8.4 (dev packages installed as well).

Thanks in advance,
Adrian

-- 
Adrian Dusa
Romanian Social Data Archive
1, Schitu Magureanu Bd
050025 Bucharest sector 5
Romania
Tel./Fax: +40 21 3126618 \
  +40 21 3120210 / int.101

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


Re: [R] test regression against given slope for reduced major axis regression (RMA)

2006-07-25 Thread david bird

Patrick Drechsler wrote on 11 Jul 2006 02:10:21 MET: 

[...] 
 I am now confronted with the problem that I have data which 
 requires a modelII regression (also called reduced major axes 
 regression (RMA) or geometric mean regression). For this I use 
 the function modelII (see below). 
 
 What would be a good way of adapting 
 test_regression_against_slope for use with RMA regression? 
 
 The question I am trying to answer is: Does the slope acquired 
 from experimental data differ significantly from theoretical 
 predictions? 

JFTR: David Warton's smatr package solves the problem. 


DFB: Note that there are conflicting solutions to this question. The
confidence limits based on Pitman, EJG (1939) A note on normal
correlation.  Biometrika 31: 9-12, as implemented in the smatr package, are 
liberal (i.e. narrow), compared to the alternative limits found in Tan, CY
and B. Iglewicz (1999) Measurement-methods comparisons and linear
statistical relationship, Technometrics 41: 192-201.

Note also that equation error, if present, invalidates any confidence
limits calculations. That is, in using the RMA, you are looking for the
perfect underlying relationship between two variables. If the underlying
relationship is not perfect, because missing variables are also important,
the RMA is the wrong approach.
-- 
View this message in context: 
http://www.nabble.com/test-regression-against-given-slope-for-reduced-major-axis-regression-%28RMA%29-tf1921881.html#a5494654
Sent from the R help forum at Nabble.com.

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


[R] test

2006-07-23 Thread Gregor Gorjanc
just a test
-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

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


Re: [R] Test for equality of coefficients in multivariate multipleregression

2006-07-19 Thread John Fox
Dear Berwin,

Simply stacking the problems and treating the resulting observations as
independent will give you the correct coefficients, but incorrect
coefficient variances and artificially zero covariances.

The approach that I suggested originally -- testing a linear hypothesis
using the coefficient estimates and covariances from the multivariate linear
model -- seems simple enough. For example, to test that all three
coefficients are the same across the two equations,

 b - as.vector(coef(x.mlm))
 
 V - vcov(x.mlm)
 
 L - c(1, 0, 0,-1, 0, 0,
0, 1, 0, 0,-1, 0,
0, 0, 1, 0, 0,-1)
 L - matrix(L, nrow=3, byrow=TRUE)
 
 t(L %*% b)  %*% (L %*% V %*% t(L)) %*% (L %*% b)

The test statistic is chi-square with 3 df under the null hypothesis. (Note:
not checked carefully.)

(BTW, it's a bit unclear to me how much of this exchange was on r-help, but
I'm copying to r-help since at least one of Ulrich's messages referring to
alternative approaches appeared there. I hope that's OK.)

Regards,
 John


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

 -Original Message-
 From: Berwin A Turlach 
 [mailto:[EMAIL PROTECTED] On Behalf Of Berwin 
 A Turlach
 Sent: Tuesday, July 18, 2006 9:28 PM
 To: Andrew Robinson
 Cc: Ulrich Keller; John Fox
 Subject: Re: [R] Test for equality of coefficients in 
 multivariate multipleregression
 
 G'day all,
 
  AR == Andrew Robinson [EMAIL PROTECTED] writes:
 
 AR I suggest that you try to rewrite the model system into a
 AR single mixed-effects model, [...] Why a mixed-effect 
 model, wouldn't a fixed effect be o.k. too?
 
 Something like:
 
  DF-data.frame(x1=rep(c(0,1),each=50),x2=rep(c(0,1),50))
  tmp-rnorm(100)
  DF$y1-tmp+DF$x1*.5+DF$x2*.3+rnorm(100,0,.5)
  DF$y2-tmp+DF$x1*.5+DF$x2*.7+rnorm(100,0,.5)
  x.mlm-lm(cbind(y1,y2)~x1+x2,data=DF)
  coef(x.mlm)
  y1  y2
 (Intercept) -0.08885266 -0.05749196
 x1   0.33749086  0.60395258
 x2   0.72017894  1.11932077
 
 
  DF2 - with(DF, data.frame(y=c(y1,y2)))
  DF2$x11 - with(DF, c(x1, rep(0,100)))
  DF2$x21 - with(DF, c(x2, rep(0,100)))
  DF2$x12 - with(DF, c(rep(0,100), x1))
  DF2$x22 - with(DF, c(rep(0,100), x2))
  DF2$x1 - with(DF, c(x1, x1))
  DF2$wh - rep(c(0,1), each=100)
  fm1 - lm(y~wh + x11 + x21 + x12 + x22, DF2)
  fm1
 
 Call:
 lm(formula = y ~ wh + x11 + x21 + x12 + x22, data = DF2)
 
 Coefficients:
 (Intercept)   wh  x11  x21  
 x12  x22  
-0.08885  0.03136  0.33749  0.72018  
 0.60395  1.11932  
 
  fm2 - lm(y~wh + x1 + x21 + x22, DF2)
  anova(fm2,fm1)
 Analysis of Variance Table
 
 Model 1: y ~ wh + x1 + x21 + x22
 Model 2: y ~ wh + x11 + x21 + x12 + x22
   Res.Df RSS  Df Sum of Sq  F Pr(F)
 1195 246.919
 2194 246.031   1 0.888 0.6998 0.4039
 
 
 Cheers,
 
 Berwin
 
 == Full address 
 Berwin A Turlach  Tel.: +61 (8) 6488 3338 
 (secr)   
 School of Mathematics and Statistics+61 (8) 6488 3383 
 (self)  
 The University of Western Australia   FAX : +61 (8) 6488 1028
 35 Stirling Highway   
 Crawley WA 6009e-mail: [EMAIL PROTECTED]
 Australiahttp://www.maths.uwa.edu.au/~berwin


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


Re: [R] Test for equality of coefficients in multivariate multipleregression

2006-07-19 Thread Berwin A Turlach
G'day John,

 JF == John Fox [EMAIL PROTECTED] writes:

JF Simply stacking the problems and treating the resulting
JF observations as independent will give you the correct
JF coefficients, but incorrect coefficient variances
Yes, after Andrew's (off-list) answer I realised this too.  If I am
not mistaken, all variances/covariances should be off by a factor of
1/2 or something like that.

JF and artificially zero covariances.
Well, I must admit that I misread Ulrich's code for most of the day.
I hadn't realised that the variable `tmp' introduces a correlation
between `y1' and `y2' in his code:

 DF-data.frame(x1=rep(c(0,1),each=50),x2=rep(c(0,1),50))
 tmp-rnorm(100)
 DF$y1-tmp+DF$x1*.5+DF$x2*.3+rnorm(100,0,.5)
 DF$y2-tmp+DF$x1*.5+DF$x2*.7+rnorm(100,0,.5)

for some reason, my brain kept parsing this as generate *one* random
intercept for y1 and *one* random intercept for y2, not that each
individual observation has a random intercept.  Under the model that
my brain kept parsing, one would have zero covariances. :)

Now I understand why Andrew suggested the use of mixed models and
would go down that way too.  But I believe your approach is valid too.

JF (BTW, it's a bit unclear to me how much of this exchange was
JF on r-help,
Easy, all those that have r-help either in the TO: or CC: field.
Those were Ulrich's original message and the answer by you and Andrew,
I kept all my mails so far off-list.

JF but I'm copying to r-help since at least one of Ulrich's
JF messages referring to alternative approaches appeared there.
Yes, I noticed that and answered off-list.  In that message, if I read
it correctly, he had confused Andrew and me.

JF I hope that's OK.)
Sure, why not? :)

Cheers,

Berwin

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


Re: [R] Test for equality of coefficients in multivariate multiple regression

2006-07-19 Thread Ulrich Keller
Hello and thank you for your answers, Andrew and Berwin. If I'm not 
mistaken, the mixed-model version of Berwin's approach would be:

#My stuff:
DF-data.frame(x1=rep(c(0,1),each=50),x2=rep(c(0,1),50))
tmp-rnorm(100)
DF$y1-tmp+DF$x1*.5+DF$x2*.3+rnorm(100,0,.5)
DF$y2-tmp+DF$x1*.5+DF$x2*.7+rnorm(100,0,.5)
x.mlm-lm(cbind(y1,y2)~x1+x2,data=DF)

#1st part of Andrew's suggestion:
DF2 - with(DF, data.frame(y=c(y1,y2)))
DF2$x11 - with(DF, c(x1, rep(0,100)))
DF2$x21 - with(DF, c(x2, rep(0,100)))
DF2$x12 - with(DF, c(rep(0,100), x1))
DF2$x22 - with(DF, c(rep(0,100), x2))
DF2$x1 - with(DF, c(x1, x1))
DF2$wh - rep(c(0,1), each=100)

#Mixed version of models:
  DF2$unit - rep(c(1:100), 2)
  library(nlme)
  mm1 - lme(y~wh + x11 + x21 + x12 + x22, random= ~1 | unit, DF2, 
method=ML)
  fixef(mm1)
(Intercept)  wh x11 x21 x12 x22
 0.07800993  0.15234579  0.52936947  0.13853332  0.37285132  0.46048418
  coef(x.mlm)
y1y2
(Intercept) 0.07800993 0.2303557
x1  0.52936947 0.3728513
x2  0.13853332 0.4604842
  mm2 - update(mm1, y~wh + x1 + x12 + x22)
  anova(mm1, mm2)
Model df  AIC  BIClogLik   Test  L.Ratio p-value
mm1 1  8 523.6284 550.0149 -253.8142   
mm2 2  7 522.0173 545.1055 -254.0086 1 vs 2 0.388908  0.5329

This seems to be correct. What anova() tells me is that the effect of x1 
is the same for y1 and y2. What I don't understand then is why the 
coefficients for x12 and x22 differ so much between mm1 and mm2:

  fixef(mm2)
(Intercept)  wh  x1 x12 x22
  0.1472766   0.1384474   0.5293695  -0.1565182   0.3497476
  fixef(mm1)
(Intercept)  wh x11 x21 x12 x22
 0.07800993  0.15234579  0.52936947  0.13853332  0.37285132  0.46048418

Sorry for being a bit slow here, I'm (obviously) not a statistician.
Thanks again,

Uli

Andrew Robinson wrote:
 G'day Berwin,

 my major reason for preferring the mixed-effect approach is that, as
 you can see below, the residual df for your models are 195 and 194,
 respectively.  The 100 units are each contributing two degrees of
 freedom to your inference, and presumably to your estimate of the
 variance.  I feel a little sqeueamish about that, because it's not
 clear to me that they can be assumed to be independent.  I worry about
 the effects on the size of the test.  With a mixed-effects model each
 unit could be a cluster of two observations, and I would guess the
 size would be closer to nominal, if not nominal.

 Cheers

 Andrew

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


[R] Test for equality of coefficients in multivariate multiple regression

2006-07-18 Thread Ulrich Keller
Hello,

suppose I have a multivariate multiple regression model such as the 
following:

  DF-data.frame(x1=rep(c(0,1),each=50),x2=rep(c(0,1),50))
  tmp-rnorm(100)
  DF$y1-tmp+DF$x1*.5+DF$x2*.3+rnorm(100,0,.5)
  DF$y2-tmp+DF$x1*.5+DF$x2*.7+rnorm(100,0,.5)
  x.mlm-lm(cbind(y1,y2)~x1+x2,data=DF)
  coef(x.mlm)
y1y2
(Intercept) 0.07800993 0.2303557
x1  0.52936947 0.3728513
x2  0.13853332 0.4604842

How can I test whether x1 and x2 respectively have the same effect on y1 
and y2? In other words, how can I test if coef(x.mlm)[2,1] is 
statistically equal to coef(x.mlm)[2,2] and coef(x.mlm)[3,1] to 
coef(x.mlm)[3,2]? I looked at linear.hypothesis {car} and glh.test 
{gmodels}, but these do not seem the apply to multivariate models.
Thank you in advance,

Uli Keller

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


Re: [R] Test for equality of coefficients in multivariate multiple regression

2006-07-18 Thread John Fox
Dear Ulrich,

I'll look into generalizing linear.hypothesis() so that it handles
multivariate linear models.

Meanwhile, vcov(x.mlm) will give you the covariance matrix of the
coefficients, so you could construct your own test by ravelling
coef(x.mlm) into a vector.

I hope that this helps,
 John

On Tue, 18 Jul 2006 20:15:12 +0200
 Ulrich Keller [EMAIL PROTECTED] wrote:
 Hello,
 
 suppose I have a multivariate multiple regression model such as the 
 following:
 
   DF-data.frame(x1=rep(c(0,1),each=50),x2=rep(c(0,1),50))
   tmp-rnorm(100)
   DF$y1-tmp+DF$x1*.5+DF$x2*.3+rnorm(100,0,.5)
   DF$y2-tmp+DF$x1*.5+DF$x2*.7+rnorm(100,0,.5)
   x.mlm-lm(cbind(y1,y2)~x1+x2,data=DF)
   coef(x.mlm)
 y1y2
 (Intercept) 0.07800993 0.2303557
 x1  0.52936947 0.3728513
 x2  0.13853332 0.4604842
 
 How can I test whether x1 and x2 respectively have the same effect on
 y1 
 and y2? In other words, how can I test if coef(x.mlm)[2,1] is 
 statistically equal to coef(x.mlm)[2,2] and coef(x.mlm)[3,1] to 
 coef(x.mlm)[3,2]? I looked at linear.hypothesis {car} and glh.test 
 {gmodels}, but these do not seem the apply to multivariate models.
 Thank you in advance,
 
 Uli Keller
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox/

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


Re: [R] Test for equality of coefficients in multivariate multiple regression

2006-07-18 Thread Andrew Robinson
Hi Uli,

I suggest that you try to rewrite the model system into a single
mixed-effects model, which would allow direct parameterization of the
tests that you're interested in.  A useful article, which may be
overkill for your needs, is:

Hall, D.B. and Clutter, M. (2004). Multivariate multilevel nonlinear
mixed effects models for timber yield predictions,  Biometrics, 60:
16-24.

See the publications link on Daniel Hall's website:

http://www.stat.uga.edu/~dhall/

Cheers

Andrew

On Tue, Jul 18, 2006 at 08:15:12PM +0200, Ulrich Keller wrote:
 Hello,
 
 suppose I have a multivariate multiple regression model such as the 
 following:
 
   DF-data.frame(x1=rep(c(0,1),each=50),x2=rep(c(0,1),50))
   tmp-rnorm(100)
   DF$y1-tmp+DF$x1*.5+DF$x2*.3+rnorm(100,0,.5)
   DF$y2-tmp+DF$x1*.5+DF$x2*.7+rnorm(100,0,.5)
   x.mlm-lm(cbind(y1,y2)~x1+x2,data=DF)
   coef(x.mlm)
 y1y2
 (Intercept) 0.07800993 0.2303557
 x1  0.52936947 0.3728513
 x2  0.13853332 0.4604842
 
 How can I test whether x1 and x2 respectively have the same effect on y1 
 and y2? In other words, how can I test if coef(x.mlm)[2,1] is 
 statistically equal to coef(x.mlm)[2,2] and coef(x.mlm)[3,1] to 
 coef(x.mlm)[3,2]? I looked at linear.hypothesis {car} and glh.test 
 {gmodels}, but these do not seem the apply to multivariate models.
 Thank you in advance,
 
 Uli Keller
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.

-- 
Andrew Robinson  
Department of Mathematics and StatisticsTel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
Email: [EMAIL PROTECTED] http://www.ms.unimelb.edu.au

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


Re: [R] test regression against given slope for reduced major axis regression (RMA)

2006-07-14 Thread Patrick Drechsler

Patrick Drechsler wrote on 11 Jul 2006 02:10:21 MET:

[...]
 I am now confronted with the problem that I have data which
 requires a modelII regression (also called reduced major axes
 regression (RMA) or geometric mean regression). For this I use
 the function modelII (see below).

 What would be a good way of adapting
 test_regression_against_slope for use with RMA regression?

 The question I am trying to answer is: Does the slope acquired
 from experimental data differ significantly from theoretical
 predictions?

JFTR: David Warton's smatr package solves the problem.
-- 
You know the world is going crazy when the best rapper is a white
guy, the best golfer is a black guy, the Swiss hold the America's Cup,
France is accusing the US of arrogance, and Germany doesn't want to go
to war.  -- Charles Barkley

__
R-help@stat.math.ethz.ch 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] test regression against given slope for reduced major axis regression (RMA)

2006-07-10 Thread Patrick Drechsler
Hi,

for testing if the slope of experimental data differs from a
given slope I'm using the function
test_regression_against_slope (see below).

I am now confronted with the problem that I have data which
requires a modelII regression (also called reduced major axes
regression (RMA) or geometric mean regression). For this I use
the function modelII (see below).

What would be a good way of adapting
test_regression_against_slope for use with RMA regression?

The question I am trying to answer is: Does the slope acquired
from experimental data differ significantly from theoretical
predictions?

Any feedback on this is highly appreciated. And if you need more
info do not hesitate to ask.

Kind Regards

Patrick



*test_regression_against_slope*

--8schnipp-8---
test_regression_against_slope - function(x,y,slope_2)
{
### TEST_REGRESSION_AGAINST_SLOPE tests a measured regression against a
### given regression.
###
### INPUT: 
###
### x and y: raw data
### slope_2: the slope you would like to test against (ie 1/3)
###
### OUTPUT:
###
### pvalue: the P-value...
### upperlimit95 and lowerlimit95 give the 95 percent confidence
### intervall (two-tailed).
###
### see Sokal and Rohlf, p. 465/471
  
  n - length(x)
  mydf - n-2

  ## least square fit:
  x2 - (x-mean(x))^2
  y2 - (y-mean(y))^2

  ## regression (pedestrian solution):
  xy - (x-mean(x))*(y-mean(y))
  slope1 - sum(xy)/sum(x2)
  intercept_a - mean(y) - slope1 * mean(x)

  ## model data y_hat:
  y_hat - intercept_a + slope1 * x
  ## least squares of model data:
  y_hat2 - (y - y_hat)^2

  s2yx - sum(y_hat2) / (n-2)
  sb - sqrt(s2yx/sum(x2))
  ts - (slope1 - slope_2) / sb
  pvalue -  2*(pt(abs(ts), df, lower.tail=FALSE))

  ## 0.95 for one-tailed 0.975 for two-tailed t-distribution with
  ## alpha-5%:
  tval - qt(.975, df=mydf)
  ts2 - tval*sb

  lowerlimit95 - slope1 - ts2
  upperlimit95 - slope1 + ts2

  list(pvalue = pvalue,
   lowerlimit95 = lowerlimit95,
   upperlimit95 = upperlimit95)
}
--8schnapp-8---




*modelII*

--8schnipp-8---
modelII - function(XjArray,YjArray){
###  
###
### Purpose:
###
### Calculates MODEL II Regression paramaters. Also called reduced
### major axis regression (Prentice 1987) or geometric mean
### regression (Webb et al. 1981).
###
### Input:
###
### Two one dimensional arrays XjArray and YjArray containing the X
### and Y vectors.
###
### XjArray = [0 0.9 1.8 2.6 3.3 4.4 5.2 6.1 6.5 7.4]
### YjArray = [5.9 5.4 4.4 4.6 3.5 3.7 2.8 2.8 2.4 1.5]
###
### Output:
###
### A list with the following:
###
### sumXjYj As Double
### sumXj As Double, sumYj As Double
### sumXjSquared As Double, sumYjSquared As Double
### n As Long
### varXj, varYj
### output(7)
###
###  

  sumXjYj - 0
  sumXj - 0
  sumYj - 0
  n - 0
  n - length(XjArray)
  sumXjSquared - 0
  sumYjSquared - 0
  covariancexy - 0
  
  for(i in 1:n){
sumXjYj - sumXjYj + XjArray[i] * YjArray[i]
sumXj - sumXj + XjArray[i]
sumYj - sumYj + YjArray[i]
sumXjSquared - sumXjSquared + XjArray[i]^2
sumYjSquared - sumYjSquared + YjArray[i]^2
  }
  
  ## Mean of X and Y vectors
  meanyj - sumYj / n
  meanxj - sumXj / n
  
  ## Create covariance
  for(i in 1:n){
covariancexy - covariancexy + ((XjArray[i] - meanxj) * (YjArray[i] - 
meanyj))
  }

  covariancexy - covariancexy / n
  
  
  ## get variance of X and Y (SD)
  varXj - (n * sumXjSquared-sumXj^2)/(n*(n - 1))
  varYj - (n * sumYjSquared-sumYj^2)/(n*(n - 1))
  sdxij - (sumXjSquared)-(sumXj^2/n)
  sdxik - (sumYjSquared)-(sumYj^2/n)

  ## make beta'sgn function to return sign with magnitude of 1
  betacoeff - sign(covariancexy) * ((varYj^0.5) / (varXj^0.5))
  ## 'make intercept
  Intercept - meanyj - meanxj * betacoeff
  
  ## Make R the pearson produce moment correlation coefficient
  if (varYj==0 | varXj==0){
corrCoeff - 0
  }else{
corrCoeff - (sumXjYj - ((sumXj * sumYj) / n)) / ((sdxij * sdxik)^0.5)
  }
  
  ## Make sample variances of betacoefficient and intercept
  variancebeta - (varYj / varXj) * ((1 - (corrCoeff ^ 2)) / n)
  varianceintercept - (varYj / n) * (1 - corrCoeff) * (2 + ((meanxj ^ 2) * ((1 
+ corrCoeff) / varXj)))
  sdbeta - variancebeta^0.5
  sdintercept - varianceintercept^0.5

  list(betacoeff=betacoeff, # - Steigung
   Intercept=Intercept,
   sdbeta=sdbeta, # standard deviation
   sdintercept=sdintercept,
   meanxj=meanxj,
   meanyj=meanyj,
   corrCoeff=corrCoeff) # - pearson correlation koeffizient ;
  
}
--8schnapp-8---

-- 
Snoopy (on being house-trained with a rolled-up newspaper): 
It does tend however to give one a rather distorted view of the press!

__

[R] Test if an image or random field is stationary

2006-05-03 Thread Lu Yuefeng
Hi List,

  I want to know how to test whether an image or generally a random
field, is stationary. I am sure there are a lot of intuitive ways to do this
but right now I need a formal test which can gives the p-value.  And any of
those tests already implemented in R? Thanks a lot!

Yuefeng

[[alternative HTML version deleted]]

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


[R] Test of Significance for overall-accuracy

2006-03-14 Thread Markus Schwarz
Hello,

I have two classifications. How can I compare the overall-accuracy of these 
classifications to each other?
Is there a possibility within R to test if the achieved overall-accuracy 
for the classifications are differing significantly?

Additionaly, are the McNemar-Test and Broker-Test implented in a package of R?

Thank in advance for your help,
Markus
.
Markus Schwarz
Wissenschaftlicher Mitarbeiter
Eidg. Forschungsanstalt WSL
Zürcherstrasse 111
CH-8903 Birmensdorf

Telefon +41-44-739 22 87
Fax +41-44-739 22 15
[EMAIL PROTECTED]
http://www.wsl.ch/staff/markus.schwarz/ 
.

__
R-help@stat.math.ethz.ch 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] test for exponential,lognormal and gammadistribution

2005-09-12 Thread Christoph Buser
Hi Nadja

It depends on your purpose. Often people are using tests to show
that a sample follows a distribution (normal, exponential,
lognormal, ...).
If a test rejects the null hypothesis that the sample comes from
the specified distribution, you are on the safe side, since you
are controlling the significance level (e.g. 5%) and therefore
know the alpha error.
But if a test do not reject the null hypothesis, generally you
have NOT shown that the sample has the specified
distribution. This is related to the power of your test (to
detect differences). 
If the power of a test is lousy, the conclusion that your
sample has the distribution  based on the nonsignificant
test result is misleading or even wrong.

As you mentioned below the kolmogorov-smirnov test does not
adapt for the fact that the parameters of the distribution you
test against are estimated from the data sample.
It assumes that the parameters are know. But in practice that's
not the case in general.
Since the parameter are estimated from the data, but the test do
not have this information, but assumes that these parameters are
a fixed known quantity, the test is to conservative and has a
small power to detect differences.
Therefore it is quite dangerous to conclude that a sample has a
specified distribution, based on the kolmogorov-smirnov test.

An alternative way might be using graphical tools, e.g. quantile
plots (see ?qqplot and ?qqnorm).
Obviously you have the same difficulty by interpreting the
plots, since nobody can tell you for sure if a deviation from
the straight line is significant or just by chance.
But if you conclude that a sample has a distribution by looking
at the plot you will be aware of this subjectivity that can not
be avoided.
The test result will often give you the wrong impression of
objectivity.
The best example to see this is if you have a very small
sample. In general any test has a small power if your sample is
small and it is most probable that the test is
nonsignificant. If we look at the quantile plot (with a small
sample) we often can not judge if it is a straight line or not
(since the sample is to small) and in this case it is the
correct conclusion that we can not say anything about the
distribution. 

I hope this will be helpful.

Regards,

Christoph Buser

--
Christoph Buser [EMAIL PROTECTED]
Seminar fuer Statistik, LEO C13
ETH (Federal Inst. Technology)  8092 Zurich  SWITZERLAND
phone: x-41-44-632-4673 fax: 632-1228
http://stat.ethz.ch/~buser/
--


[EMAIL PROTECTED] writes:
  
  hello!
  i don't want to test my sample data for normality, but exponential- 
  lognormal- 
  or gammadistribution.
  as i've learnt the anderson-darling-test in R is only for normality and i am 
  not supposed to use the kolmogorov-smirnov test of R for parameter estimates 
  from sample data, is that true?
  can you help me, how to do this anyway!
  thank you very much!
  nadja
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
  
  
  !DSPAM:43219660106581956711619!

__
R-help@stat.math.ethz.ch 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] test for exponential,lognormal and gammadistribution

2005-09-10 Thread Spencer Graves
  I just got 73 hits for 'RSiteSearch(test for exponential 
distribution)'.  In skimming quickly the first 20, the one that seemed 
most relevant to me was a reply I wrote to a similar question two months 
ago (http://finzi.psych.upenn.edu/R/Rhelp02a/archive/37055.html).  Of 
course, some of the remaining 72 may help you more.

  spencer graves

[EMAIL PROTECTED] wrote:

 hello!
 i don't want to test my sample data for normality, but exponential- 
 lognormal- 
 or gammadistribution.
 as i've learnt the anderson-darling-test in R is only for normality and i am 
 not supposed to use the kolmogorov-smirnov test of R for parameter estimates 
 from sample data, is that true?
 can you help me, how to do this anyway!
 thank you very much!
 nadja
 
 __
 R-help@stat.math.ethz.ch 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
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
R-help@stat.math.ethz.ch 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] test for exponential,lognormal and gammadistribution

2005-09-09 Thread riedwyl

hello!
i don't want to test my sample data for normality, but exponential- lognormal- 
or gammadistribution.
as i've learnt the anderson-darling-test in R is only for normality and i am 
not supposed to use the kolmogorov-smirnov test of R for parameter estimates 
from sample data, is that true?
can you help me, how to do this anyway!
thank you very much!
nadja

__
R-help@stat.math.ethz.ch 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] test for difference in the order of self generated sequence

2005-07-14 Thread Kaiya Liu
Hello,

I have an experiment in which we ask subjects to generate a list of thoughts
after being exposed to a stimuli. The thoughts were then coded into two
categories (e.g. A  B). The objective is to show that the order in which
thoughts are generated is affected by the experimental conditions. Can
somebody tell me what functions in R can help me do the test or point me to
the appropriate reference? Thanks!

Example data: Subject 1 in condition 1 generated 5 thoughts. The first,
second, and 5th thought is in category A, thought 3 and 4 are in category B.
Subject 2 only generated 4 thoughts.

---Condition-A-B
n1   11, 2, 5  3, 4
n2   23, 4  1, 2
---

Kaiya Liu

__
R-help@stat.math.ethz.ch 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] test for difference in the order of self generated sequence

2005-07-14 Thread Spencer Graves
  Have you considered glmmPQL in library(MASS)?

  spencer graves

Kaiya Liu wrote:

 Hello,
 
 I have an experiment in which we ask subjects to generate a list of thoughts
 after being exposed to a stimuli. The thoughts were then coded into two
 categories (e.g. A  B). The objective is to show that the order in which
 thoughts are generated is affected by the experimental conditions. Can
 somebody tell me what functions in R can help me do the test or point me to
 the appropriate reference? Thanks!
 
 Example data: Subject 1 in condition 1 generated 5 thoughts. The first,
 second, and 5th thought is in category A, thought 3 and 4 are in category B.
 Subject 2 only generated 4 thoughts.
 
 ---Condition-A-B
 n1   11, 2, 5  3, 4
 n2   23, 4  1, 2
 ---
 
 Kaiya Liu
 
 __
 R-help@stat.math.ethz.ch 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
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
R-help@stat.math.ethz.ch 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] test of hazard ratios

2005-06-28 Thread Spencer Graves
  Can you fit a single model that includes the two classifiers from 
which the model with one classifier could be obtained as a special case? 
  If yes (and if neither parameter was at a boundary crudely similar to 
a zero variance component in lme), then you could use the theory that 
2*ln(likelihood ratio) is approximately chi-square.  For many 
capabilities in R, this is implemented as a function anova(fit2, fit1) 
where fit2 and fit1 are the results of fitting the general and the 
specialized models.

  If you don't see how to make this work, PLEASE do read the posting 
guide! http://www.R-project.org/posting-guide.html;.  It might help you 
find a better answer.  Failing that, if you submit another post after 
following the process described therein, it should increase the chances 
that you will get a useful reply.

  spencer graves

Steve Adams wrote:

 Hi,
 
 Is there a R test available that tests whether 2
 hazard ratios obtained from Cox regressions on the
 same patient sample by 2 different classifiers are
 significantly different?
 
 Thanks
 
 Steve
 
 __
 R-help@stat.math.ethz.ch 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
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA

[EMAIL PROTECTED]
www.pdf.com http://www.pdf.com
Tel:  408-938-4420
Fax: 408-280-7915

__
R-help@stat.math.ethz.ch 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] test of hazard ratios

2005-06-27 Thread Steve Adams
Hi,

Is there a R test available that tests whether 2
hazard ratios obtained from Cox regressions on the
same patient sample by 2 different classifiers are
significantly different?

Thanks

Steve

__
R-help@stat.math.ethz.ch 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] test for equality of two data sets with multidimensional variables

2005-06-21 Thread wu sz
Hello there,

I have two data sets with 14 variables each, and wish to do the test
for equality of their covariance matrices and mean vectors. Normally
these tests should be done by chi square test (box provided) and
Hotelling's T square test respectively. Which R functions could do
this kind of test? I just find some functions could do for one
dimension, but no for multidimension. Some one suggests bartlett.test,
but it seems just works for one dimension. Do you know which ones
could do that, or I have to do R programming by myself?

Thank you,
Shengzhe

__
R-help@stat.math.ethz.ch 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] test for equality of two data sets with multidimensional variables

2005-06-21 Thread Petr Pikal
Hi

searching in CRAN homepage for hotelling gave me this response

Thanks everyone for your help on this question. I solved the 
problem by 
writing a procedure to calculate Hotelling's T^2 for a one-sample, 
multivariate t-test. Here's how it looks, perhaps it will be useful to 
others. 


data - cbind(rnorm(50, 0.1, .01), rnorm(50,.1,.01), 
rnorm(50,.1,.01)) 
k - ncol(data) 
n - nrow(data) 
xbar - apply(data, 2, mean) 
mubar - rep(0,k) #hypothesized means are zero 
dbar - xbar - mubar 
v - var(data) 
t2 - n*dbar%*%solve(v)%*%dbar 
F - (n-k)*t2/((n-1)*k) 
P - 1-pf(F,k,n-k) 


A previous post by Peter B. Mandeville was very helpful, as well as 
the 
Johnson/Wichern book on multivariate stats. 
-S. Schultz 

and this

cran.r-project.org/doc/packages/agce.pdf - Podobné stránky 

CRAN - Package SharedHT2
SharedHT2: Shared Hotelling T2 test for small sample microarray 
experiments ...
Derives a Hotelling T2 statistic having an F-distribution using an 
empirical ...

Maybe this is what you want.

HTH
Petr





On 21 Jun 2005 at 13:00, wu sz wrote:

 Hello there,
 
 I have two data sets with 14 variables each, and wish to do the test
 for equality of their covariance matrices and mean vectors. Normally
 these tests should be done by chi square test (box provided) and
 Hotelling's T square test respectively. Which R functions could do
 this kind of test? I just find some functions could do for one
 dimension, but no for multidimension. Some one suggests bartlett.test,
 but it seems just works for one dimension. Do you know which ones
 could do that, or I have to do R programming by myself?
 
 Thank you,
 Shengzhe
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide!
 http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch 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] test for equality of two data sets with multidimensional variables

2005-06-21 Thread wu sz
Hi,

I just find another package shapes for solving the Hotelling T^2
test, but what about the R function for the test of covariance
equality(chi ^ 2 box's test) between two multidimensional data sets?

Shengzhe

__
R-help@stat.math.ethz.ch 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] test for equality of two data sets with multidimensional variables

2005-06-21 Thread Peter Dalgaard
wu sz [EMAIL PROTECTED] writes:

 Hi,
 
 I just find another package shapes for solving the Hotelling T^2
 test, but what about the R function for the test of covariance
 equality(chi ^ 2 box's test) between two multidimensional data sets?
 
 Shengzhe

Rather than looking for a package, it might be more expedient to grab
TW Anderson's book and code the couple of lines it takes to generate
the test statistic and its asymptotic p-value.

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

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


Re: [R] test for equality of two data sets withmultidimensional variables

2005-06-21 Thread John Fox
Dear Petr and Shengzhe,

Also see ?manova.

John


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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Petr Pikal
 Sent: Tuesday, June 21, 2005 7:30 AM
 To: wu sz; r-help@stat.math.ethz.ch
 Subject: Re: [R] test for equality of two data sets 
 withmultidimensional variables
 
 Hi
 
 searching in CRAN homepage for hotelling gave me this response
 
 Thanks everyone for your help on this question. I solved the 
 problem by writing a procedure to calculate Hotelling's T^2 
 for a one-sample, multivariate t-test. Here's how it looks, 
 perhaps it will be useful to others. 
 
 
 data - cbind(rnorm(50, 0.1, .01), rnorm(50,.1,.01),
 rnorm(50,.1,.01))
 k - ncol(data)
 n - nrow(data)
 xbar - apply(data, 2, mean)
 mubar - rep(0,k) #hypothesized means are zero dbar - xbar - 
 mubar v - var(data)
 t2 - n*dbar%*%solve(v)%*%dbar
 F - (n-k)*t2/((n-1)*k)
 P - 1-pf(F,k,n-k) 
 
 
 A previous post by Peter B. Mandeville was very helpful, as 
 well as the Johnson/Wichern book on multivariate stats. 
 -S. Schultz 
 
 and this
 
 cran.r-project.org/doc/packages/agce.pdf - Podobné stránky 
 
 CRAN - Package SharedHT2
 SharedHT2: Shared Hotelling T2 test for small sample 
 microarray experiments ...
 Derives a Hotelling T2 statistic having an F-distribution 
 using an empirical ...
 
 Maybe this is what you want.
 
 HTH
 Petr
 
 
 
 
 
 On 21 Jun 2005 at 13:00, wu sz wrote:
 
  Hello there,
  
  I have two data sets with 14 variables each, and wish to do 
 the test 
  for equality of their covariance matrices and mean vectors. 
 Normally 
  these tests should be done by chi square test (box provided) and 
  Hotelling's T square test respectively. Which R functions could do 
  this kind of test? I just find some functions could do for one 
  dimension, but no for multidimension. Some one suggests 
 bartlett.test, 
  but it seems just works for one dimension. Do you know which ones 
  could do that, or I have to do R programming by myself?
  
  Thank you,
  Shengzhe
  
  __
  R-help@stat.math.ethz.ch mailing list
  https://stat.ethz.ch/mailman/listinfo/r-help
  PLEASE do read the posting guide!
  http://www.R-project.org/posting-guide.html
 
 Petr Pikal
 [EMAIL PROTECTED]
 
 __
 R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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] test of thread behaviour - no need to read this

2005-06-09 Thread Mike R
test of thread behaviour 

this is the initial post

__
R-help@stat.math.ethz.ch 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] test of thread behaviour - no need to read this

2005-06-09 Thread Mike R
this is the first reply to the initial thread
subject line and header unchanged

__
R-help@stat.math.ethz.ch 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] test of thread behaviour - no need to read this -- version2

2005-06-09 Thread Mike R
this is the second reply to the initial thread
subject line has been changed

__
R-help@stat.math.ethz.ch 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] test of thread behaviour - no need to read this -- version 3

2005-06-09 Thread Mike R
this is the fourth reply to the initial post

subject line edited ( Re was removed )

__
R-help@stat.math.ethz.ch 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] test of thread behaviour - no need to read this

2005-06-09 Thread Mike R
this is the seventh reply to the initial post

subject line is unaltered

I added a ficticious (i think) email to the To: field

__
R-help@stat.math.ethz.ch 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] Test on mu with multivariate normal distribution

2005-05-08 Thread Peter Dalgaard
Telse Henschel [EMAIL PROTECTED] writes:

 Dear WizaRds,
 
 I am sorry to bother you with a newbie question, but although I tried to 
 solve my problem using the various .pdf files (Introduction, help pages 
 etc.), I have come to a complete stop. Please be so kind as to guide me a 
 little bit along my way of exploring multivariate analysis in R.
 
 I want to test wether the means-vector mu1 of  X, consisting of the means per 
 column of that matrix , and mu2, i.e. the means per column of Y,  are 
 distributed equally  under the assumption of a multivariate normal 
 distribution. I thought “simtest” could be the right function to get the 
 p-value, but I fail to use R correctly. Here is what I tried to do:
 
 f1- factor(c(8, 10, 12, 14))
 
 X - matrix(1:16, ncol=4)
 colnames(X)   - c(Obj1,Obj2,Obj3,Obj4)
 X.frame   - data.frame(f1,X)
 
 Y - matrix(1:12, ncol=4)
 colnames(Y)   - c(Obj1,Obj2,Obj3,Obj4)
 Y.frame   - data.frame(f1,Y)
 XY- data.frame(X.frame, Y.frame) # won’t work, because of 
 different nr of rows
 
 test.stat - lm(XY ~ f1)  # ???

Try this:

X - matrix(rnorm(16), ncol=4)
Y - matrix(rnorm(12), ncol=4)
XY - rbind(X,Y)
g - factor(rep(1:2,c(4,3)))
fit1 - lm(XY ~ g)
fit0 - lm(XY ~ 1)
anova(fit0,fit1)

(using 1:16 and 1:12 for X and Y gives 

Error in anova.mlmlist(object = fit0, fit1) :
residuals have rank 1  4

)
 
 # simtest(test.stat, XY, type=Tukey)
 
 creates errors already by just staring at it. I apologize.
 
 
 Thank you so much for your support,
 Telse
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

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

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


[R] Test on mu with multivariate normal distribution

2005-05-07 Thread Telse Henschel
Dear WizaRds,

I am sorry to bother you with a newbie question, but although I tried to solve 
my problem using the various .pdf files (Introduction, help pages etc.), I have 
come to a complete stop. Please be so kind as to guide me a little bit along my 
way of exploring multivariate analysis in R.

I want to test wether the means-vector mu1 of  X, consisting of the means per 
column of that matrix , and mu2, i.e. the means per column of Y,  are 
distributed equally  under the assumption of a multivariate normal 
distribution. I thought “simtest” could be the right function to get the 
p-value, but I fail to use R correctly. Here is what I tried to do:

f1  - factor(c(8, 10, 12, 14))

X   - matrix(1:16, ncol=4)
colnames(X) - c(Obj1,Obj2,Obj3,Obj4)
X.frame - data.frame(f1,X)

Y   - matrix(1:12, ncol=4)
colnames(Y) - c(Obj1,Obj2,Obj3,Obj4)
Y.frame - data.frame(f1,Y)
XY  - data.frame(X.frame, Y.frame) # won’t work, because of 
different nr of rows

test.stat   - lm(XY ~ f1)  # ???

# simtest(test.stat, XY, type=Tukey)

creates errors already by just staring at it. I apologize.


Thank you so much for your support,
Telse

__
R-help@stat.math.ethz.ch 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] Test for autocorrelation in nlme model

2005-04-30 Thread Revilla,AJ (pgt)
Dear all,

I am fitting a nonlinear mixed-effects model from a balanced panel of data 
using nlme. I would like to know whay would be the best options for formally 
testing for autocorrelation. Is it possible to carry out a Durbin-Watson test 
on a nlme object? As far as I've seen, I think the durbin.watson function from 
the car package just works on lm objects.

Thank you very much,

Antonio

__
R-help@stat.math.ethz.ch 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] Test for autocorrelation in nlme model

2005-04-30 Thread Spencer Graves
	  Have you reviewed Pinheiro and Bates (2000) Mixed-Effects Models in S 
and S-PLUS (Springer)?  They provide examples with diagnostic plots, 
confidence intervals and likelihood ratio tests in sec. 5.3, for example.

   spencer graves
Revilla,AJ (pgt) wrote:
Dear all,
I am fitting a nonlinear mixed-effects model 
from a balanced panel of data using nlme. I would
like to know whay would be the best options for
formally testing for autocorrelation. Is it
possible to carry out a Durbin-Watson test on a
nlme object? As far as I've seen, I think the
durbin.watson function from the car package just
works on lm objects.
Thank you very much,
Antonio
__
R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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] test ignore

2005-04-14 Thread Briggs, Meredith M

__
R-help@stat.math.ethz.ch 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] [TEST] Do not read

2005-03-17 Thread Mauron Laurent (KETR 31)
test

__
R-help@stat.math.ethz.ch 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] test of significance for nlme coefficients

2005-03-04 Thread Lindsey Root
Hello,

I am using the nlme package to fit an exponential decay model to a
longitudinal data set:

 ##Model a variable called RASCH16A as an exponential function ## of an
initial value A and a decay rate K
 fm2 - nlme(model = RASCH16A ~  A* (exp(-K*DAYS)), 
+ ###A has nonzero fixed and random effects, K has nonzero fixed and
random effects
+ fixed = A + K ~ 1,
+ data = rasch,
+ random = A + K ~ 1 | SUBJECT,
+ ##Give a start value for the fixed effects, expressed using the
concatenate function
+ start = c(60, 0.007))

However, 20 of the 161 estimates decay rates are NOT decay rates, but
are very small positive growth rates (all less than a standard deviation
(.03) from zero).  I would like to run a significance test to see how
many of these positive growth rates are significantly different from
zero. However, the nlme package only offers confidence intervals for the
model parameters, not the person-specific coefficients. I would welcome
any and all suggestions. 

Thanks if you can help,
Lindsey Root

__
R-help@stat.math.ethz.ch 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] test comparing spatial point patterns?

2005-01-28 Thread Alan Swanson
I'm working with animal relocation data.   These are x-y coordinates of
radio-collared coyotes over a period of time.Relocations are far enough
apart in time to be considered independent.  We want to test if the pattern
of space-use has changed from one year to the next.   Relocations roughly
follow a 2D Gaussian distribution, but points are often clustered near one
or more 'cores'.  Sample size varies from year to year with a minimum of
n=34.  We have applied multi-response permutation procedures (MRPP), but
feel this test is too sensitive to the density of points (vs location).  We
have considered using a 2D generalization of the Cramer-von Mises test (to
be adapted from Syrjala, 1996), but this test is sensitive to placement of
the origin and probably requires gridding of the data.   Does anybody know
of a good method to compare the spatial distribution of point pattern data?

Cheers,

Alan Swanson

 


[[alternative HTML version deleted]]

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


[R] test multiple objects for being equal length

2004-12-09 Thread Manuel Gutierrez
I could not find any help pages on How to test many
objects for being of equal length
Something like identical for more than two objects?
x-1:6
y-1:10
z-3:5
## For two objects I can do:
identical(length(x),length(y))
## For more than two I currently can do:
length(unique(c(length(x),length(y),length(z==1

but there must be a better way.
Thanks,
M

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


Re: [R] test multiple objects for being equal length

2004-12-09 Thread Eric Lecoutre
Hi Manuel,
First, encapsulate yoyr objects within a list. That will help you 
manipulate all them at once and ensures that the final function will work 
with whatever number of vectors.

» ll - list(x,y,z)
» sapply(ll,length)
[1]  6 10  3
Then you can use your length(unique(...))==1
Another way is to use all:
» all(sapply(ll,length)==length(ll[[1]]))
[1] FALSE
HTH,
Eric

At 09:09 9/12/2004, Manuel Gutierrez wrote:
I could not find any help pages on How to test many
objects for being of equal length
Something like identical for more than two objects?
x-1:6
y-1:10
z-3:5
## For two objects I can do:
identical(length(x),length(y))
## For more than two I currently can do:
length(unique(c(length(x),length(y),length(z==1
but there must be a better way.
Thanks,
M
__
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Eric Lecoutre
UCL /  Institut de Statistique
Voie du Roman Pays, 20
1348 Louvain-la-Neuve
Belgium
tel: (+32)(0)10473050
[EMAIL PROTECTED]
http://www.stat.ucl.ac.be/ISpersonnel/lecoutre
If the statistics are boring, then you've got the wrong numbers. -Edward 
Tufte

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


RE: [R] test multiple objects for being equal length

2004-12-09 Thread BXC (Bendix Carstensen)
not that its much shorter:

length( table( sapply( list(x,y,z), length ) ) ) == 1

Bendix
--
Bendix Carstensen
Senior Statistician
Steno Diabetes Center
Niels Steensens Vej 2
DK-2820 Gentofte
Denmark
tel: +45 44 43 87 38
mob: +45 30 75 87 38
fax: +45 44 43 07 06
[EMAIL PROTECTED]
www.biostat.ku.dk/~bxc
--



 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Manuel 
 Gutierrez
 Sent: Thursday, December 09, 2004 9:09 AM
 To: [EMAIL PROTECTED]
 Subject: [R] test multiple objects for being equal length
 
 
 I could not find any help pages on How to test many
 objects for being of equal length
 Something like identical for more than two objects?
 x-1:6
 y-1:10
 z-3:5
 ## For two objects I can do:
 identical(length(x),length(y))
 ## For more than two I currently can do: 
 length(unique(c(length(x),length(y),length(z==1
 
 but there must be a better way.
 Thanks,
 M
 
 __
 [EMAIL PROTECTED] mailing list 
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read 
 the posting guide! http://www.R-project.org/posting-guide.html


__
[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] test multiple objects for being equal length

2004-12-09 Thread Liaw, Andy
Wrapping the suggestions into a function:

 sameLength - function(...) {
+ n - sapply(list(...), length)
+ all(n == n[1])
+ }
 sameLength(double(1), double(2))
[1] FALSE
 sameLength(double(1), double(1), list(x=1))
[1] TRUE

[Note that if you have lots of objects to compare, length(unique(...))==1
will not be as efficient.]

HTH,
Andy


 From: Manuel Gutierrez
 
 I could not find any help pages on How to test many
 objects for being of equal length
 Something like identical for more than two objects?
 x-1:6
 y-1:10
 z-3:5
 ## For two objects I can do:
 identical(length(x),length(y))
 ## For more than two I currently can do:
 length(unique(c(length(x),length(y),length(z==1
 
 but there must be a better way.
 Thanks,
 M
 
 __
 [EMAIL PROTECTED] mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! 
 http://www.R-project.org/posting-guide.html
 


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

2004-10-29 Thread Rajdeep Das

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

2004-10-27 Thread Rajdeep Das

[[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] Test of significance in estimation of correlation coefficients

2004-08-24 Thread Vikas Rawal
I estimated spearman's correlation coefficient using cor(). How do I 
test for significance?

Vikas
__
[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] Test of significance in estimation of correlation coefficients

2004-08-24 Thread Jonathan Baron
On 08/24/04 15:05, Vikas Rawal wrote:
I estimated spearman's correlation coefficient using cor(). How do I
test for significance?

cor.test

You could find this many ways, but one is to look at the help
document for cor.  cor.test is listed is at the bottom.  In
general, it is a good idea to look at help before posting here.

BTW, there is a small bug in the documentation for cor: cor.test
is no longer in the ctest package, but in stats.

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

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


Re: [R] Test of significance in estimation of correlation coefficients

2004-08-24 Thread Prof Brian Ripley
On Tue, 24 Aug 2004, Jonathan Baron wrote:

 BTW, there is a small bug in the documentation for cor: cor.test
 is no longer in the ctest package, but in stats.

Your information is not up to date: that page has been changed in
R-patched and R-devel. 

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

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


[R] test for difference between non-independent correlations

2004-07-27 Thread Avril Coghlan
Hello,

  I am wondering whether there is a way to
test whether two non-independent correlation
coefficients are significantly different, in R?

I have an experimentally measure variable Y,
and two different variables X1, and X2, which
are predictions of Y that were predicted using
two different computational models.

I would like to see whether the correlation
of Y and X1, and Y and X2 is significantly different.
Since Y appears in both correlations
the correlation coefficients will be non-independent.
(so you cannot use a Z test like you would for
comparing independent correlation coefficients, I think).

I have read that there is a test for comparing
non-independent correlation coefficients, by
EJ Williams (1959) and Steiger.
There is also a test called Hotelling's t test.
I'm wondering does anyone know whether I can
somehow carry out any of these using an R package, or compare
non-independent correlations using R by some
other method?

I will greatly appreciate any help,
thankyou,
Avril Coghlan
(University College Dublin, Ireland)

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


Re: [R] test for difference between non-independent correlations

2004-07-27 Thread Jonathan Baron
On 07/27/04 13:35, Avril Coghlan wrote:
Hello,

  I am wondering whether there is a way to
test whether two non-independent correlation
coefficients are significantly different, in R?

About 20 years ago I asked the same question (without the R),
found Steiger's paper (below) and wrote this BASIC program to do
it.  (If you try to type it in each time you're bound to make a
mistake.  This has been checked repeatedly.)  It is trivial to
write this as an R script, of course.

I and my colleagues have been using this for about 20 years, and
it seems to be OK as judged by comparing it to the jackknife.
(Remember, when we did this, the bootstrap was a newfangled
idea that we didn't quite trust.)  My hunch is that something
better has come along, and I'd be interested to see how others
respond.  Hence I haven't bothered to translate this into R.  Or
maybe everyone who has this problem just uses the bootstrap now.
That is certainly easy enough.  (I will eventually add this to
our Notes on R for psychology..., since it is a very common
problem in psychology research.)

10 print looks for difference between r12 and r13, given r23
12 print (input r121 to quit)
20 input r12 ; r12
22 if r121 then end
30 input r13 ; r13
40 input r23 ; r23
50 input N ; n
52 let rd=1-r12*r12-r13*r13-r23*r23+2*r12*r13*r23
54 let rb=(r12+r13)/2
56 let cube=(1-r23)*(1-r23)*(1-r23)
60 let t2=(r12-r13)*sqrt((n-1)*(1+r23)/(2*rd*(n-1)/(n-3)+rb*rb*cube))
70 print t (;n-3;) = ;t2
80 print Steiger, J.H. (1980). Tests for comparing elements of a
82 print correlation matrix.  Psychological Bulletin, 87, 245-251.
100 goto 12

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

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


[R] test for end of file on connection

2004-05-11 Thread Vadim Ogranovich
Hi,
 
I am looking for a function to test for end-of-file on a connection.
Apparently this question was already asked a couple of years ago and
then P. Dalgaard suggested to look at help(connections),
help(readLines). Unfortunately, I couldn't find such a function on those
pages, maybe I am missing something.
 
Did anyone figure this out?
 
Thanks,
Vadim
 
 
 

[[alternative HTML version deleted]]

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


Re: [R] test for end of file on connection

2004-05-11 Thread Tony Plate
With the text of your message copied to the clipboard:

 con - file(clipboard, r)
 readLines(con, 1)
[1] I am looking for a function to test for end-of-file on a connection.
 readLines(con, 1)
[1] Apparently this question was already asked a couple of years ago and
 readLines(con, 1)
[1] then P. Dalgaard suggested to look at help(connections),
 readLines(con, 1)
[1] help(readLines). Unfortunately, I couldn't find such a function on those
 readLines(con, 1)
[1] pages, maybe I am missing something.
 readLines(con, 1)
character(0)

i.e., readLines() returns a zero length result upon reaching end of 
file.  AFAIK the other file reading functions have similar behavior.  It's 
still worth reading in detail the help for readLines().

hope this helps,

Tony Plate

At Tuesday 12:08 AM 5/11/2004, Vadim Ogranovich wrote:
Hi,

I am looking for a function to test for end-of-file on a connection.
Apparently this question was already asked a couple of years ago and
then P. Dalgaard suggested to look at help(connections),
help(readLines). Unfortunately, I couldn't find such a function on those
pages, maybe I am missing something.
Did anyone figure this out?

Thanks,
Vadim


[[alternative HTML version deleted]]

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


  1   2   >