[R] convering upper triangular matrix into vector

2005-10-02 Thread e . rapsomaniki
Hi

I have two symmetrical distance matrices and want to compute the correlation
coefficient between them (after turning them into vectors). 

Is there a way of selecting only the upper triangular part of each matrix, then
convert this into a vector so I can compute the correlation?

Many Thanks
Eleni Rapsomaniki

__
R-help@stat.math.ethz.ch 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] convering upper triangular matrix into vector

2005-10-02 Thread Peter Dalgaard
[EMAIL PROTECTED] writes:

 Hi
 
 I have two symmetrical distance matrices and want to compute the correlation
 coefficient between them (after turning them into vectors). 
 
 Is there a way of selecting only the upper triangular part of each matrix, 
 then
 convert this into a vector so I can compute the correlation?

X[upper.tri(X)]

(as help.search(triangular) would have told you soon enough)

-- 
   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] convering upper triangular matrix into vector

2005-10-02 Thread Dimitris Rizopoulos
look at: '?upper.tri()'

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://www.med.kuleuven.be/biostat/
 http://www.student.kuleuven.be/~m0390867/dimitris.htm


- Original Message - 
From: [EMAIL PROTECTED]
To: R-help@stat.math.ethz.ch
Sent: Sunday, October 02, 2005 11:04 AM
Subject: [R] convering upper triangular matrix into vector


 Hi

 I have two symmetrical distance matrices and want to compute the 
 correlation
 coefficient between them (after turning them into vectors).

 Is there a way of selecting only the upper triangular part of each 
 matrix, then
 convert this into a vector so I can compute the correlation?

 Many Thanks
 Eleni Rapsomaniki

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


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


[R] arima.sim bug?

2005-10-02 Thread Kemp S E \(Comp\)
Hi,

I am using the arima.sim function to generate some AR time series. However, the 
function does not seem to produce exactly the same time series when I specify 
the innov parameter. For example

 r - rnorm(300)
 x - arima.sim(300, model=list(order=c(1,0,0),ar=c(.96)), innov=r, n.start=10)
 y - arima.sim(300, model=list(order=c(1,0,0),ar=c(.96)), innov=r, n.start=10)

 x[1:10]
[1] 3.194806 4.214894 5.168017 7.925152 8.810817 9.131695
 [7] 7.521283 8.266911 8.923429 9.651293

 y[1:10]
[1] -0.7202632  0.4564274  1.5598893  4.4613486
 [5]  5.4855660  5.9394547  4.4567320  5.3249417
 [9]  6.0991390  6.9399748

Given the fact that I have provided the innovations shouldn't the time series 
be exactly the same?

Any help would be greatly appreciated.

All the best,

Sam.

[[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] modeling language for optimization problems

2005-10-02 Thread Paolo Cavatore
Does anyone know whether R has its own modeling language for optimization 
problems (like SIMPLE in NuOPT for S-plus)?

Paolo

__
R-help@stat.math.ethz.ch 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] arima.sim bug?

2005-10-02 Thread Sundar Dorai-Raj


Kemp S E (Comp) wrote:
 Hi,
 
 I am using the arima.sim function to generate some AR time series. However, 
 the function does not seem to produce exactly the same time series when I 
 specify the innov parameter. For example
 
 
r - rnorm(300)
x - arima.sim(300, model=list(order=c(1,0,0),ar=c(.96)), innov=r, n.start=10)
y - arima.sim(300, model=list(order=c(1,0,0),ar=c(.96)), innov=r, n.start=10)
 
 
x[1:10]
 
 [1] 3.194806 4.214894 5.168017 7.925152 8.810817 9.131695
  [7] 7.521283 8.266911 8.923429 9.651293
 
 
y[1:10]
 
 [1] -0.7202632  0.4564274  1.5598893  4.4613486
  [5]  5.4855660  5.9394547  4.4567320  5.3249417
  [9]  6.0991390  6.9399748
 
 Given the fact that I have provided the innovations shouldn't the time series 
 be exactly the same?
 
 Any help would be greatly appreciated.
 
 All the best,
 
 Sam.
 

Not a bug, but a difference in seeds. Try:

set.seed(1)
r - rnorm(300)
m - list(order = c(1,0,0), ar = c(.96))
set.seed(1)
x - arima.sim(300, model = m, innov = r, n.start = 10)
set.seed(1)
y - arima.sim(300, model = m, innov = r, n.start = 10)

all.equal(x, y)
# [1] TRUE

HTH,

--sundar

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


Re: [R] plot question when type = b and pch is a vector

2005-10-02 Thread John Fox
Dear tokas,

How about:

x - seq(0.01, 10, length = 20)
xx - x[7]
x[7] - NA

plot(c(0, 10), c(-20, 20), type = n, xlab = x, 
ylab = expression(2 * alpha * log(x)))
for(i in 1:4){
lines(x, 2 * i * log(x), lty = 1)
text(xx,  2 * i * log(xx), i) 
}

I hope this helps,
 John


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

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of toka tokas
 Sent: Sunday, October 02, 2005 5:37 AM
 To: r-help@stat.math.ethz.ch
 Subject: [R] plot question when type = b and pch is a vector
 
 Dear R users,
 
 I've been struggling some days with the following
 problem: I'm interesting in producing the following plot
 
 x - seq(0.01, 10, length = 20)
 
 plot(c(0, 10), c(-20, 20), type = n, xlab = x, 
 ylab = expression(2 * alpha * log(x)))
 
 pch. - rep(NA, length(x))
 for(i in 1:4){
 pch.[7] - as.character(i)
 lines(x, 2 * i * log(x), type = b, pch = pch., lty = 1) }
 
 where all the line segments are connected, except from the 
 7th one where I've put the value of alpha -- in other words 
 I'd like to produce a line plot where the label appears at 
 each line with some white space around it.
 
 thanks in advance,
 tokas
 
 __
 R-help@stat.math.ethz.ch 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


Re: [R] How to get to the varable in a list

2005-10-02 Thread Uwe Ligges
Lisa Wang wrote:

 Hello,
 
 I have a list lis as the following:
 
 $1
   x1 x2
 4  3  1
 
 $2
   x1 x2
 3  3  2
 5  3  2
 
 $3
   x1 x2
 2  3  3
 6  3  3
 
 How do I get the x1 varible?  for example ss1


I can only guess you mean something like

   lis[[1]][[x1]]


Uwe Ligges



 
 
 
 
 This e-mail may contain confidential and/or privileged inf...{{dropped}}

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


Re: [R] User error (was arima.sim bug?)

2005-10-02 Thread Prof Brian Ripley
On Sun, 2 Oct 2005, Kemp S E (Comp) wrote:

 Hi,

 I am using the arima.sim function to generate some AR time series. 
 However, the function does not seem to produce exactly the same time 
 series when I specify the innov parameter. For example

 r - rnorm(300)
 x - arima.sim(300, model=list(order=c(1,0,0),ar=c(.96)), innov=r, 
 n.start=10)
 y - arima.sim(300, model=list(order=c(1,0,0),ar=c(.96)), innov=r, 
 n.start=10)

 x[1:10]
 [1] 3.194806 4.214894 5.168017 7.925152 8.810817 9.131695
 [7] 7.521283 8.266911 8.923429 9.651293

 y[1:10]
 [1] -0.7202632  0.4564274  1.5598893  4.4613486
 [5]  5.4855660  5.9394547  4.4567320  5.3249417
 [9]  6.0991390  6.9399748

 Given the fact that I have provided the innovations shouldn't the time 
 series be exactly the same?

No.  Hint: where does the randomness for the burn-in come from?

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


Re: [R] modeling language for optimization problems

2005-10-02 Thread Prof Brian Ripley
On Sun, 2 Oct 2005, Paolo Cavatore wrote:

 Does anyone know whether R has its own modeling language for optimization
 problems (like SIMPLE in NuOPT for S-plus)?

No.  Note that SIMPLE is the language of NUOPT, not of S-PLUS.  There is 
an (extra-cost) interface module S+NUOPT, but it is an interface to 
NUOPT's engine.

As far as I am aware R itself covers almost none of the ground of S+NUOPT, 
and available packages cover only a small part of it.

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


[R] Size of jpegs/pngs

2005-10-02 Thread stgries
Dear all

I have trouble with setting the size for jpegs and pngs. I need to save a 
dendrogram of 1000 words into a jpeg or png file. On one of my computers, the 
following works just fine: 

bb-agnes(aa, method=ward)
jpeg(C:/Temp/test.txt, width=17000, height=2000)
plot(bb)
dev.off()

On my main computer, however, this doesn't work:
 jpeg(C:/Temp/test.txt, width=17000, height=2000)
Error in jpeg(C:/Temp/test.txt, width = 17000, height = 2000) : 
unable to start device devWindows
In addition: Warning message:
Unable to allocate bitmap 

This is a Windows XP Pro SP2 system, which is started with this chsort
 R.version
 _  
platform i386-pc-mingw32
arch i386   
os   mingw32
system   i386, mingw32  
status  
major2  
minor1.1
year 2005   
month06 
day  20 
language R  

which is started with a shortcut.
C:\rw2011\bin\Rgui.exe --max-mem-size=1500M

I checked the web and the R-help pages, tried out the ppsize option, and 
compared the options settings with those of the machine that works (which 
actually runs R 2.0.1 of 15 Nov 2004), but couldn't come up with an 
explanation. Any idea what I do wrong?
STG
--
Stefan Th. Gries

Max Planck Inst. for Evol. Anthropology
http://people.freenet.de/Stefan_Th_Gries


Machen Sie aus 14 Cent spielend bis zu 100 Euro!
Die neue Gaming-Area von Arcor - über 50 Onlinespiele im Angebot.
http://www.arcor.de/rd/emf-gaming-1

__
R-help@stat.math.ethz.ch 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] p-level in packages mgcv and gam

2005-10-02 Thread Henric Nilsson
Denis Chabot said the following on 2005-09-29 21:55:

 OK, I think I understand better but still have two points to clarify.
 
 The first one is about the number of df. I think those who replied on  
 this objected to the way I chose df, not the fact that I would run a  
 model with 7.4 df per se. If I read you correctly, I artificially  
 reduce my p-value by using the estimated df found in a mgcv gam model  
 into another model where I fix df. This is fine, I am quite willing  not 
 to run a second model with a fixed df and instead tell my readers  that 
 my model is marginally significant with a p-value of 0.03.
 
 This being said, do you know of guidelines for choosing df? A  colleague 
 told me he does not go above 10% of the number of points.  Should I be 
 concerned when mgcv estimates 7.4 df for 34 points? Note  that for this 
 particular model P  1e-16, and P is also very small if  I fix df to 
 either 4 or 7.
 
 My second point is the difference between models fitted by packages  gam 
 and mgcv. Sure, some of you have said different algorithms. And  when 

Maybe that wasn't well put. Think of it as different implementations. 
The packages `mgcv' and `gam' are by no means the only implementations 
of GAM; see e.g. the `gss' package.

 I specify dfs, shouldn't P-values be very similar for the 2  packages? 
 If not, what does it say of the confidence we can have in  the models?

Since there's no universally accepted definition of what a GAM is, you 
shouldn't expect the results to be the same.

 I draw your attention to this exampl: I obtained P-values of 0.50 and  
 0.03 with packages gam and mgcv respectively:

In this case, however, you're trying to compare apples to oranges...

   library(gam)
 Loading required package: splines
   data(kyphosis)
   kyp1 - gam(Kyphosis ~ s(Number, 3), family=binomial, data=kyphosis)
   summary.gam(kyp1)
 
 Call: gam(formula = Kyphosis ~ s(Number, 3), family = binomial, data  = 
 kyphosis)
 Deviance Residuals:
 Min  1Q  Median  3Q Max
 -1.3646 -0.6233 -0.4853 -0.3133  2.0965
 
 (Dispersion Parameter for binomial family taken to be 1)
 
 Null Deviance: 83.2345 on 80 degrees of freedom
 Residual Deviance: 71.9973 on 76. degrees of freedom
 AIC: 79.9976
 
 Number of Local Scoring Iterations: 7
 
 DF for Terms and Chi-squares for Nonparametric Effects
 
  Df Npar Df Npar Chisq  P(Chi)
 (Intercept)   1
 s(Number, 3)  1   21.37149 0.50375

This test concerns only the non-linear part of the term s(Number, 3). In 
order to simultaneously test both the linear and non-linear part, as 
mgcv::summary.gam does, you'd

  kyp1.1 - gam(Kyphosis ~ 1, family=binomial, data=kyphosis)
  anova(kyp1.1, kyp1, test = Chisq)
Analysis of Deviance Table

Model 1: Kyphosis ~ 1
Model 2: Kyphosis ~ s(Number, 3)
   Resid. Df Resid. Dev  Df Deviance P(|Chi|)
1   80. 83.234
2   76. 71.997  3.0001   11.237 0.011


HTH,
Henric

   detach(package:gam)
   library(mgcv)
 This is mgcv 1.3-7
   kyp2 - gam(Kyphosis ~ s(Number, k=4, fx=T),  family=binomial,  
 data=kyphosis)
   summary.gam(kyp2)
 
 Family: binomial
 Link function: logit
 
 Formula:
 Kyphosis ~ s(Number, k = 4, fx = T)
 
 Parametric coefficients:
 Estimate Std. Error z value Pr(|z|)
 (Intercept)  -1.5504 0.3342   -4.64 3.49e-06 ***
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 
 Approximate significance of smooth terms:
   edf Est.rank Chi.sq p-value
 s(Number)   33  8.898  0.0307 *
 ---
 Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 
 R-sq.(adj) =  0.101   Deviance explained = 12.5%
 UBRE score = 0.075202  Scale est. = 1 n = 81
   kyp2$deviance
 [1] 72.85893
   kyp2$null.deviance
 [1] 83.23447
   kyp2$df.null
 [1] 80
   kyp2$df.residual
 [1] 77
 
 How can we explain this huge difference?
 
 Denis
 
 
 Le 05-09-29 à 06:00, [EMAIL PROTECTED] a écrit :

 De : Henric Nilsson [EMAIL PROTECTED]
 Date : 29 septembre 2005 03:55:19 HAE
 À : [EMAIL PROTECTED]
 Cc : r-help@stat.math.ethz.ch
 Objet : Rép : [R] p-level in packages mgcv and gam
 Répondre à : Henric Nilsson [EMAIL PROTECTED]


 Yves Magliulo said the following on 2005-09-28 17:05:

 hi,
 i'll try to help you, i send a mail about this subject last  week... and
 i did not have any response...
 I'm using gam from package mgcv. 1)
 How to interpret the significance of smooth terms is hard for me to
 understand perfectly : using UBRE, you fix df. p-value are  estimated 
 by chi-sq distribution using GCV, the best df are  estimated by GAM. 
 (that's what i want) and
 p-values



 This is not correct. The df are estimated in both cases (i.e. UBRE  
 and GCV), but the scale parameter is fixed in the UBRE case. Hence,  
 by default UBRE is used for family = binomial or poisson since the  
 scale parameter is assumed to be 1. Similarly, GCV is the default  for 
 family = gaussian since we most often want the scale (usually  denoted 
 sigma^2) to be 

Re: [R] Memory management on Windows (was Size of jpegs/pngs)

2005-10-02 Thread Prof Brian Ripley
I think this an issue about the amount of graphics memory.  You are asking 
for an image of about 17*2*3 = 102Mb, and you need more than that.

From the help page:

  Windows imposes limits on the size of bitmaps: these are not
  documented in the SDK and may depend on the version of Windows. It
  seems that 'width' and 'height' are each limited to 2^15-1 and
  there is a 16Mb limit on the total amount of memory in Windows
  95/98/ME.

so I do wonder why you are surprised.

My laptop appears to be limited to about half your example with a 128Mb 
graphics card (and lots of other things going on).

On Sun, 2 Oct 2005 [EMAIL PROTECTED] wrote:

 Dear all

 I have trouble with setting the size for jpegs and pngs. I need to save 
 a dendrogram of 1000 words into a jpeg or png file. On one of my 
 computers, the following works just fine:

 bb-agnes(aa, method=ward)
 jpeg(C:/Temp/test.txt, width=17000, height=2000)
 plot(bb)
 dev.off()

 On my main computer, however, this doesn't work:
 jpeg(C:/Temp/test.txt, width=17000, height=2000)
 Error in jpeg(C:/Temp/test.txt, width = 17000, height = 2000) :
unable to start device devWindows
 In addition: Warning message:
 Unable to allocate bitmap

 This is a Windows XP Pro SP2 system, which is started with this chsort
 R.version
 _
 platform i386-pc-mingw32
 arch i386
 os   mingw32
 system   i386, mingw32
 status
 major2
 minor1.1
 year 2005
 month06
 day  20
 language R

 which is started with a shortcut.
 C:\rw2011\bin\Rgui.exe --max-mem-size=1500M

 I checked the web and the R-help pages, tried out the ppsize option, and 
 compared the options settings with those of the machine that works 
 (which actually runs R 2.0.1 of 15 Nov 2004), but couldn't come up with 
 an explanation. Any idea what I do wrong?

Did you read the help page?

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


[R] rate instead of scale in ?ks.test

2005-10-02 Thread Ramón Casero Cañas

I am not sure whether I'm doing something wrong or there is a bug in the
documentation of ks.test. Following the posting guide, as I'm not sure,
I haven't found this in the bug tracker, and the R FAQ says that stats
is an Add-on package of R, I think this is the place to send it.


?ks.test provides the example

QUOTE
# Does x come from a shifted gamma distribution with shape 3 and scale 2?
ks.test(x+2, pgamma, 3, 2) # two-sided
/QUOTE


Maybe it should say ``with shape 3 and rate 2''?


If I do

 x - rgamma(1e6, shape = 3, scale = 2)
 ks.test( x, 'pgamma', 3, 2 )

One-sample Kolmogorov-Smirnov test

data:  x
D = 0.7513, p-value  2.2e-16
alternative hypothesis: two.sided


whereas with


 y - rgamma(1e6, shape = 3, rate = 2)
 ks.test( y, 'pgamma', 3, 2 )

One-sample Kolmogorov-Smirnov test

data:  y
D = 5e-04, p-value = 0.9469
alternative hypothesis: two.sided


If forcing the parameter meaning:

 ks.test( x, 'pgamma', shape = 3, scale = 2 )

One-sample Kolmogorov-Smirnov test

data:  x
D = 9e-04, p-value = 0.3645
alternative hypothesis: two.sided



 version
platform i386-pc-linux-gnu
arch i386
os   linux-gnu
system   i386, linux-gnu
status
major2
minor1.1
year 2005
month06
day  20
language R

 packageDescription( stats )
Package: stats
Version: 2.1.1
Priority: base
Title: The R Stats Package
Author: R Development Core Team and contributors worldwide
Maintainer: R Core Team [EMAIL PROTECTED]
Description: R statistical functions
License: GPL Version 2 or later.
Built: R 2.1.1; i386-pc-linux-gnu; 2005-06-29 23:30:55; unix

-- File: /usr/lib/R/library/stats/DESCRIPTION

Cheers,

-- 
Ramón Casero Cañas

web:http://www.robots.ox.ac.uk/~rcasero/

__
R-help@stat.math.ethz.ch 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] p-level in packages mgcv and gam

2005-10-02 Thread Denis Chabot
Thank you very much Henric, now I see!

Denis
Le 05-10-02 à 11:47, Henric Nilsson a écrit :

 This test concerns only the non-linear part of the term s(Number,  
 3). In order to simultaneously test both the linear and non-linear  
 part, as mgcv::summary.gam does, you'd

  kyp1.1 - gam(Kyphosis ~ 1, family=binomial, data=kyphosis)
  anova(kyp1.1, kyp1, test = Chisq)
 Analysis of Deviance Table

 Model 1: Kyphosis ~ 1
 Model 2: Kyphosis ~ s(Number, 3)
   Resid. Df Resid. Dev  Df Deviance P(|Chi|)
 1   80. 83.234
 2   76. 71.997  3.0001   11.237 0.011


 HTH,
 Henric



__
R-help@stat.math.ethz.ch 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] generalized linear model for multinomial data?

2005-10-02 Thread Hongyu Sun
Dear All:

Does R have the package as in SAS's generalized logits model for nominal 
response data? I have searched but cannot find the windows package.

Many thanks,

HS

__
R-help@stat.math.ethz.ch 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] question for some tests

2005-10-02 Thread Krzysztof Sroka
Hi! I come from Poland, and my English is not as good as it should be, so I 
have to apologize for my mistakes. 
I would like to ask you for a package, where I can find a test, which is named 
The Test Of Series (in Poland). In econometric models we use this test to check 
if the residuals are completely random ( I mean with destiny). And one more 
thing - I would like to know where I can find a test for symetric of residuals 
(called The Test For The Indicator Of The Structure). 
And In general, where I can the list for the tests being used in ecometrics. 

With greetings, 
Krzysztof Sroka

Please, answer on my e-mail address: [EMAIL PROTECTED] 
[[alternative HTML version deleted]]

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


Re: [R] question for some tests

2005-10-02 Thread Roger Bivand
On Sun, 2 Oct 2005, Krzysztof Sroka wrote:

 Hi! I come from Poland, and my English is not as good as it should be,
 so I have to apologize for my mistakes.  I would like to ask you for a
 package, where I can find a test, which is named The Test Of Series (in
 Poland). In econometric models we use this test to check if the
 residuals are completely random ( I mean with destiny). And one more
 thing - I would like to know where I can find a test for symetric of
 residuals (called The Test For The Indicator Of The Structure).  And In
 general, where I can the list for the tests being used in ecometrics.

R has Task Views, posted on the Archive Network (CRAN), and one of these 
is for econometrics:

http://cran.r-project.org/src/contrib/Views/Econometrics.html

It is quite dense (many links), certainly has what you need, but you will 
have to look around to find what fits your needs more closely. I would 
look at the lmtest package to start with, the Task View includes much 
more.

 
 With greetings, 
 Krzysztof Sroka
 
 Please, answer on my e-mail address: [EMAIL PROTECTED] 
   [[alternative HTML version deleted]]
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
 

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


Re: [R] Access to particular predict value

2005-10-02 Thread Spencer Graves
  If you would still like help from this list, please provide a very 
simple reproducible example to help what you tried that didn't quite 
work.  There are several functions that use inverse distance weighting 
(IDW) and kriging for geostatistical computations.

  spencer graves
p.s.   PLEASE do read the posting guide! 
www.R-project.org/posting-guide.html.  I believe that people who use 
the posting guide generally get better answers quicker, because it is 
easier for others to understand what they want.

Toni Viúdez wrote:

 Hi everybody:
 
 I just generate interpolation maps with differents methods, like IDW and 
 kriging, and now i want to compare the predict values versus real, and i 
 don't who is the commant to do it. I want for example, if I pass from console 
 the coordinates of a place, return me the predict value.
 Could anybody tell me how should do?.
 
 Thanks in advance

-- 
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] generalized linear model for multinomial data?

2005-10-02 Thread John Fox
Dear Hongyu,

See multinom() in the nnet package, associated with Venables and Ripley's
Modern Applied Statistics with S.

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 Hongyu Sun
 Sent: Sunday, October 02, 2005 3:07 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] generalized linear model for multinomial data?
 
 Dear All:
 
 Does R have the package as in SAS's generalized logits model 
 for nominal response data? I have searched but cannot find 
 the windows package.
 
 Many thanks,
 
 HS
 
 __
 R-help@stat.math.ethz.ch 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


Re: [R] R-code for binormla distribution

2005-10-02 Thread Spencer Graves
  What are you trying to do that requires binormal probabilities other 
than pmvnorm?

  spencer graves

Nabil Channouf wrote:

 Dear users,
 does any one have a code (S or R) to compute the binormal distribution 
 (or the upper its quadrant area) other than the pmvnorm.
 Thanks
 
 

-- 
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] generalized linear model for multinomial data?

2005-10-02 Thread Hongyu Sun
Dear Professor: Thanks! I just found it. It is bundled within the VR 
package.

Hongyu

- Original Message - 
From: John Fox [EMAIL PROTECTED]
To: 'Hongyu Sun' [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Sent: Sunday, October 02, 2005 3:27 PM
Subject: RE: [R] generalized linear model for multinomial data?


 Dear Hongyu,

 See multinom() in the nnet package, associated with Venables and Ripley's
 Modern Applied Statistics with S.

 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 Hongyu Sun
 Sent: Sunday, October 02, 2005 3:07 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] generalized linear model for multinomial data?

 Dear All:

 Does R have the package as in SAS's generalized logits model
 for nominal response data? I have searched but cannot find
 the windows package.

 Many thanks,

 HS

 __
 R-help@stat.math.ethz.ch 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] Selecting columns of a table (not consecutive)

2005-10-02 Thread George Papayiannis
Hi everyone,

I have a table with 10 columns and many rows.
I want to select the 3rd,4th and 10th column.

If I wanted to select the 3rd and 4th it would be no
problem.

q3[ ,(3:4)]

but how do I select the 10th along with it?

Thanks for your help,
George

p.s Please respond if you know, assignment is due
tomorrow...

Thanks again..

__
R-help@stat.math.ethz.ch 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] Selecting columns of a table (not consecutive)

2005-10-02 Thread Nolwenn LeMeur
George Papayiannis wrote:

Hi everyone,

I have a table with 10 columns and many rows.
I want to select the 3rd,4th and 10th column.

If I wanted to select the 3rd and 4th it would be no
problem.

q3[ ,(3:4)]

but how do I select the 10th along with it?

Thanks for your help,
George

p.s Please respond if you know, assignment is due
tomorrow...

Thanks again..

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

Hi George,

Try
 subset(q3, select=c(3,4,10))

Nolwenn

__
R-help@stat.math.ethz.ch 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] What is Mandel's (Fitting) Test?

2005-10-02 Thread Mike Lawrence
Hello everyone,

A little background first:
I have collected psychophysical data from 12 participants, and each
participant's data is represented as a scatter plot (Percieved roughness versus
Physical roughness). I would like to know whether, on average, this data is
best fit by a linear function or by a quadratic function. (we have a priori
reasons to expect a quadratic)

Some of my colleagues have suggested the following methods of testing this:
1. For each participant, calculate the r-square values for linear and quadratic
fits, z-transform the resulting values. Collect these z-transformed scores and
then perform a dependent t-test across participants. If significant, then a
quadratic fits better.
2. For each participant, calculate the amount of variance left over from the
linear fit that is accounted for by the quadratic fit. Perform a one-sample
t-test to see if this population of scores differs from zero
3. Same as #2, but z-transform before performing the t-test.

However, I'm sure that these tests fail to take into account the fact that a
quadratic function will generally have an advantage over a linear function
simply by dint of having more terms to play with. So I've been looking for a
test that takes this advantage into account and I came across something called
the Mandel Test. It is available in the quantchem package, but the manual
contains a very meagre description of it's details (assumptions, etc).
Furthermore, besides biology/chemistry papers that reference it in passing,
I've been able to find only one reference online that addresses it's use
(http://www.econ.kuleuven.be/public/ndbae06/PDF-FILES/vanloco.doc), but even
then it lacks specificity.

So the question is, what is the Mandel Test? What are the assumptions and
limitations of the test? Does it sound appropriate for my purposes (if not, how
about the other tests suggested above)? How does it differ from the Lack-of-Fit
test?

Any help would be greatly appreciated.

Cheers,

Mike

-- 

Mike Lawrence, BA(Hons)
Research Assistant to Dr. Gail Eskes
Dalhousie University  QEII Health Sciences Centre (Psychiatry)

[EMAIL PROTECTED]

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


Re: [R] R-code for binormla distribution

2005-10-02 Thread Spencer Graves
  Why do you say we do not have the package that contains pmvnorm? 
It is in library(mvtnorm), which you can get via CRAN (the Comprehensive 
R Archive Network).  If you are using Windows or a standard Linux of 
MacOS, install.packages('mvtnorm') should install it on your computer 
(unless you are using a computer with special protection that makes this 
difficult;  if you are using XEmacs, you should exit R under XEmacs and 
run install.packages from Rgui).  Then library('mvtnorm') should 
make it available to your R session.  If you are using some other 
operating system, you may need to access the source, but that's 
available via CRAN alse.

  If you have not tried install.packages, please do so.  If you have 
tried install.packages and can't make it work, please describe your 
operating system, etc., as explained in the posting guide! 
www.R-project.org/posting-guide.html.

  spencer graves

Nabil Channouf wrote:
  Dear  Mr. Graves,
  i'm trying to write my own function with R, because we do not have the
  package that contains pmvnorm and i need to compute the upper quadrant
  area of the bivariate standard normal, or at least to know the details
  of the function pmvnorm written in Splus or in R.
  Thanks


Spencer Graves wrote:
   What are you trying to do that requires binormal probabilities 
 other than pmvnorm?
 
   spencer graves
 
 Nabil Channouf wrote:
 
 Dear users,
 does any one have a code (S or R) to compute the binormal distribution 
 (or the upper its quadrant area) other than the pmvnorm.
 Thanks


 

-- 
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] Local install of a contributed package under Linux (was: R-code for binormla distribution)

2005-10-02 Thread Spencer Graves
  There probably is a way under Linux to install a contributed package 
in your local directory.  I don't know how, but if you read the 
documentation on download.packages and install.packages, you might 
be able to do it without bothering your Info Tech department.  I know 
there is a way, and with luck someone who knows will respond to this 
email.  If you try something with download.packages and 
install.packages, and you can't make it work, please tell us what you 
try and what doesn't work.  Maybe someone who uses R on Linux will 
respond.  If not, ask your Info Tech department.

  Spencer Graves

Nabil Channouf wrote:
  Mr Graves,
  we are working with linux and it is so complicated to install any thing,
  it should be via the informaticians of the department and we have to
  make a request and wait. I will ask them to do it on monday.
  Thank you so much

Spencer Graves wrote:

   Why do you say we do not have the package that contains pmvnorm? 
 It is in library(mvtnorm), which you can get via CRAN (the Comprehensive 
 R Archive Network).  If you are using Windows or a standard Linux of 
 MacOS, install.packages('mvtnorm') should install it on your computer 
 (unless you are using a computer with special protection that makes this 
 difficult;  if you are using XEmacs, you should exit R under XEmacs and 
 run install.packages from Rgui).  Then library('mvtnorm') should 
 make it available to your R session.  If you are using some other 
 operating system, you may need to access the source, but that's 
 available via CRAN alse.
 
   If you have not tried install.packages, please do so.  If you 
 have tried install.packages and can't make it work, please describe 
 your operating system, etc., as explained in the posting guide! 
 www.R-project.org/posting-guide.html.
 
   spencer graves
 
 Nabil Channouf wrote:
   Dear  Mr. Graves,
   i'm trying to write my own function with R, because we do not have the
   package that contains pmvnorm and i need to compute the upper quadrant
   area of the bivariate standard normal, or at least to know the details
   of the function pmvnorm written in Splus or in R.
   Thanks
 
 
 Spencer Graves wrote:
 
   What are you trying to do that requires binormal probabilities 
 other than pmvnorm?

   spencer graves

 Nabil Channouf wrote:

 Dear users,
 does any one have a code (S or R) to compute the binormal 
 distribution (or the upper its quadrant area) other than the pmvnorm.
 Thanks



 

-- 
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] Local install of a contributed package under Linux (was: R-code for binormla distribution)

2005-10-02 Thread Jonathan Baron
Try

R CMD INSTALL -l lib pkgs

The help file is in the utils package.  I'm sure this is
documented in the manual too.

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


[R] grob questions

2005-10-02 Thread Gabor Grothendieck
If I run the following example from:
http://www.stat.auckland.ac.nz/~paul/grid/doc/grobs.pdf

 grid.newpage()
 pushViewport(viewport(w = 0.5, h = 0.5))
 myplot - gTree(name = myplot, children = gList(rectGrob(name = box,
+ gp = gpar(col = grey)), xaxisGrob(name = xaxis)))
 grid.draw(myplot)
 grid.edit(myplot::xaxis, at = 1:10/11)
 grid.edit(myplot::xaxis::labels, label = round(1:10/11, 2))
 grid.edit(myplot::xaxis::labels, y = unit(-1, lines))

then

 str(myplot$children$xaxis)

lists 'at' but not the 'labels'.

yet if I do this then the labels are listed:

 xx - xaxisGrob(name = myX, at = 1:10)
 childNames(xx)
[1] major  ticks  labels


1. How do I get to labels in the first case?

2. Is there a better construct than myplot$children$xaxis?

Thanks.

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