Re: [R] iplots problem

2007-05-26 Thread ryestone

You have to use Sun's java on your PC and not microsoft's. I just loaded it
on mine and then restarted computer and it seemed to work.

Hope this helps!

mister_bluesman wrote:
 
 Hi
 
 How did u 'load' sun's java in R?
 
 Many thanks
 
 
 
 ryestone wrote:
 
 Did you load Sun's java? Try that and also try rebooting your machine.
 This worked for me.
 
 
 mister_bluesman wrote:
 
 Hi. I try to load iplots using the following commands
 
 library(rJava)
 library(iplots)
 
 but then I get the following error:
 
 Error in .jinit(cp, parameters = -Xmx512m, silent = TRUE) : 
 Cannot create Java Virtual Machine
 Error in library(iplots) : .First.lib failed for 'iplots'
 
 What do I have to do to correct this?
 
 I have jdk1.6 and jre1.6 installed on my windows machine
 Thanks
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/iplots-problem-tf3815516.html#a10813663
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.


[R] How to check for existence url from within a function?

2007-05-26 Thread Heinz Tuechler
Dear All,

To check if an url exists, I can use try(). This works, as I expected, if I
do it directly, as in the first part of the following example, but I could
not find a way to do it from within a function, as in the second part.

Where could I find information on how to do this?

Thanks,
Heinz


## set nonexisting url
url.string - 'http://www.google.at/nonexist.html'

## first part
1 # to start with defined .Last.value
try(con.url - url(url.string, open='rb'))
class.try.res - class(.Last.value)
try.error - class.try.res== 'try-error'
print(try.error)  # TRUE
try(close(con.url))

## try() within a function
url.error - function(url.string) {
  1 # to start with defined .Last.value
  try(con.url - url(url.string, open='rb'))
  class.try.res - class(.Last.value)
  try.error - class.try.res== 'try-error'
  print(try.error)
  try(close(con.url))
  invisible(try.error)
}

## call the function
url.error(url.string)   # result - 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.


[R] polygon error?

2007-05-26 Thread LL
Hi.. I'm not sure why polygon returns an area above the standard normal curve.

z - pretty(c(-3,3), 100)
ht - dnorm(z)
data - data.frame(z=z, ht=ht)
zc - 1.645
plot(data, type=l)
lines(data)
t - subset(data, zzc)
polygon(t, col=red)

Thanks,
Lance


[[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] R: polygon error?

2007-05-26 Thread Guazzetti Stefano
It seems to me that you are using polygon in a wrong way.
What you probably need could be something like:
 
polygon(c(rev(t$z), t$z),
 c(rep(0, nrow(t)), t$ht), col=2, border=NA)

Stefano
-Messaggio originale-
Da: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] conto di LL
Inviato: sabato 26 maggio 2007 12.34
A: r-help@stat.math.ethz.ch
Oggetto: [R] polygon error?


Hi.. I'm not sure why polygon returns an area above the standard normal curve.

z - pretty(c(-3,3), 100)
ht - dnorm(z)
data - data.frame(z=z, ht=ht)
zc - 1.645
plot(data, type=l)
lines(data)
t - subset(data, zzc)
polygon(t, col=red)

Thanks,
Lance


[[alternative HTML version deleted]]

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

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


Re: [R] polygon error?

2007-05-26 Thread Mike Lawrence
polygon expects to be given the vertices, so if you want the area  
under the curve you'll want to include vertices at density=0

z - pretty(c(-3,3), 100)
ht - dnorm(z)
plot(z,ht, type=l)

zc - 1.645
ht-ht[zzc]
z-z[zzc]

ht-c(0,ht,0)
z-c(z[1],z,z[length(z)])

polygon(z,ht,col='red')


On 26-May-07, at 7:34 AM, LL wrote:

 Hi.. I'm not sure why polygon returns an area above the standard  
 normal curve.

 z - pretty(c(-3,3), 100)
 ht - dnorm(z)
 data - data.frame(z=z, ht=ht)
 zc - 1.645
 plot(data, type=l)
 lines(data)
 t - subset(data, zzc)
 polygon(t, col=red)

 Thanks,
 Lance


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

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


[R] linux update probelm

2007-05-26 Thread simon bond
Dear R-help,

I recently updated R to version 2.5. THis is on a machine running linux 
freespire. During the update process it did issue a warning saying I should 
check that I had xserver-xorg and xorg installed. I tried to do this but 
running apt-cache search xserver came up with a huge list of packages, and 
the computer seemed to be running fine; so I left it. 

However next time I booted up, it can't start the xserver  and I don't seem to 
be online. Can any one suggest what I need to do?

THanks very much


Simon Bond. 





 
 

[[alternative HTML version deleted]]

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


Re: [R] How to check for existence url from within a function?

2007-05-26 Thread Duncan Murdoch
On 26/05/2007 7:13 AM, Heinz Tuechler wrote:
 Dear All,
 
 To check if an url exists, I can use try(). This works, as I expected, if I
 do it directly, as in the first part of the following example, but I could
 not find a way to do it from within a function, as in the second part.
 
 Where could I find information on how to do this?
 
 Thanks,
 Heinz
 
 
 ## set nonexisting url
 url.string - 'http://www.google.at/nonexist.html'
 
 ## first part
 1 # to start with defined .Last.value
 try(con.url - url(url.string, open='rb'))
 class.try.res - class(.Last.value)
 try.error - class.try.res== 'try-error'
 print(try.error)  # TRUE
 try(close(con.url))
 
 ## try() within a function
 url.error - function(url.string) {
   1 # to start with defined .Last.value
   try(con.url - url(url.string, open='rb'))
   class.try.res - class(.Last.value)
   try.error - class.try.res== 'try-error'

.Last.value isn't set until your function returns.  You should write this as

con.url - try(url(url.string, open='rb'))
try.error - inherits(con.url, try-error)

Notice that I used inherits, rather than testing for equality.  It's 
documented that the result of try() will be of class 'try-error' if an 
error occurs, but there may be circumstances (in the future?) where 
different types of errors are signalled by using a more complicated class.

Duncan Murdoch

   print(try.error)
   try(close(con.url))
   invisible(try.error)
 }
 
 ## call the function
 url.error(url.string)   # result - 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.

__
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] polygon error?

2007-05-26 Thread LL
Ok.. I see that I did not completely define the polygon. The code below works 
fine

z - pretty(c(-3,3), 100)
ht - dnorm(z)
data - data.frame(z=z, ht=ht)
zc - 1.645
plot(data, type=n)
lines(data)
#segments(160,0,160,dnorm(160, m=160, sd=17), lty=2)
t - subset(data, data$zzc)
xvals - t$z
dvals - t$ht
polygon(c(xvals,rev(xvals)),c(rep(0,length(xvals)),rev(dvals)),col=red)

  - Original Message - 
  From: LL 
  To: r-help@stat.math.ethz.ch 
  Sent: Saturday, May 26, 2007 12:34 PM
  Subject: polygon error?


  Hi.. I'm not sure why polygon returns an area above the standard normal curve.

  z - pretty(c(-3,3), 100)
  ht - dnorm(z)
  data - data.frame(z=z, ht=ht)
  zc - 1.645
  plot(data, type=l)
  lines(data)
  t - subset(data, zzc)
  polygon(t, col=red)

  Thanks,
  Lance


[[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] Interactive plots?

2007-05-26 Thread mister_bluesman

Hi Tony.

I've downloaded the RSVGTipsDevice library and copied some of the examples
in the pdf and I dont seem to be able to get any tooltips appear when I
hover over the objects.

For example, I used the following example:

 devSVGTips(C:\\svgplot2.svg, toolTipMode=2, title=SVG example plot 2:
 shapes and points, tooltips are title + 2 lines)
 getSVGToolTipMode()
 setSVGShapeToolTip(title=First circle title only)
 plot(1:3, cex=10, main=Example SVG plot with title + 2 line tips
 (mode=2))
 setSVGShapeToolTip(title=A rectangle, desc=with a 1 line tip)
 rect(1,1,2,2)
 setSVGShapeToolTip(title=second circle, desc1=first line of
 description, desc2=second line)
 points(1.5,2.5,cex=20,pch=19,col='red')
 dev.off()

This produces a file with the path C:\svgplot2.svg. THis is shown below:

http://www.nabble.com/file/p10816061/demo.jpg 

When I open it in Firefox in XP, however, none of the tooltips appear when I
hover over the object. What do I need to solve this problem?

Thanks





Tony Plate wrote:
 
 The package RSVGTipsDevice allows you to do just it just -- you create a 
 plot in an SVG file that can be viewed in a browser like FireFox, and 
 the points (or shapes) in that plot can have pop-up tooltips.
 
 -- Tony Plate
 
 mister_bluesman wrote:
 Hi there. 
 
 I have a matrix that provides place names and the distances between them:
 
Chelt Exeter  London  Birm
 Chelt 0   118 96  50
 Exeter   1180   118 163
 London  96 118 0   118
 Birm  50 163 118 0
 
 After performing multidimensional scaling I get the following points
 plotted
 as follows
 
 http://www.nabble.com/file/p10810700/demo.jpeg 
 
 I would like to know how if I hover a point I can get a little box
 telling
 me which place the point refers to. Does anyone know?
 
 Many thanks.
 
 __
 R-help@stat.math.ethz.ch mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 

-- 
View this message in context: 
http://www.nabble.com/Interactive-plots--tf3818454.html#a10816061
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.


[R] Rpad examples having problems with local server

2007-05-26 Thread CharlieChi

Hi, this is Charlie. I have installed the Rpad on my server (using Fedora
Core 6 with httpd2.24-2, mod_perl 2.0.2-6.1, perl 5.8.8 from RPM). When I
access to the Rpad (through http://localhost/Rpad/basehtml), it shows me the
main page as normal, however, problems occurs when I am testing the
examples. It shows me a long message like: 
- 
#!/usr/bin/perl -w 
#!c:/apps/perl/bin/perl.exe 

#The following line is a test script to see if it works. 
#httpd://localhost/Rpad/server/R_process.pl?ID=ddNTlmHSvWZFcommand=R_commandscommands=print(hello')
use Statistics::Rpad; 
use strict; 
use CGI qw/:standard send_http_header/; 
use Cwd; 
. 
. 
and so on 
 
Does it mean that perl is not found in my machine? Moreover, when I was
installing Statistics-R_perl_interface, it shows me (Can't locat object
method startRShared via Statistics::Rpad at test.pl line 21) but I still
keep making install. Therefore, I am wondering if I successfully installed
Rpad on my server or not. Thank you for helping me.

Regards 

Charlie
-- 
View this message in context: 
http://www.nabble.com/Rpad-examples-having-problems-with-local-server-tf3820501.html#a10816236
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] Interactive plots?

2007-05-26 Thread Duncan Murdoch
On 26/05/2007 8:45 AM, mister_bluesman wrote:
 Hi Tony.
 
 I've downloaded the RSVGTipsDevice library and copied some of the examples
 in the pdf and I dont seem to be able to get any tooltips appear when I
 hover over the objects.
 
 For example, I used the following example:
 
 devSVGTips(C:\\svgplot2.svg, toolTipMode=2, title=SVG example plot 2:
 shapes and points, tooltips are title + 2 lines)
 getSVGToolTipMode()
 setSVGShapeToolTip(title=First circle title only)
 plot(1:3, cex=10, main=Example SVG plot with title + 2 line tips
 (mode=2))
 setSVGShapeToolTip(title=A rectangle, desc=with a 1 line tip)
 rect(1,1,2,2)
 setSVGShapeToolTip(title=second circle, desc1=first line of
 description, desc2=second line)
 points(1.5,2.5,cex=20,pch=19,col='red')
 dev.off()
 
 This produces a file with the path C:\svgplot2.svg. THis is shown below:
 
 http://www.nabble.com/file/p10816061/demo.jpg 

Your link says jpg, not svg.

 When I open it in Firefox in XP, however, none of the tooltips appear when I
 hover over the object. What do I need to solve this problem?

Don't convert to jpeg?

Duncan Murdoch

__
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] Interactive plots?

2007-05-26 Thread mister_bluesman

The jpeg was just the picture showing you firfox and the svg file loaded into
it.



Duncan Murdoch-2 wrote:
 
 On 26/05/2007 8:45 AM, mister_bluesman wrote:
 Hi Tony.
 
 I've downloaded the RSVGTipsDevice library and copied some of the
 examples
 in the pdf and I dont seem to be able to get any tooltips appear when I
 hover over the objects.
 
 For example, I used the following example:
 
 devSVGTips(C:\\svgplot2.svg, toolTipMode=2, title=SVG example plot 2:
 shapes and points, tooltips are title + 2 lines)
 getSVGToolTipMode()
 setSVGShapeToolTip(title=First circle title only)
 plot(1:3, cex=10, main=Example SVG plot with title + 2 line tips
 (mode=2))
 setSVGShapeToolTip(title=A rectangle, desc=with a 1 line tip)
 rect(1,1,2,2)
 setSVGShapeToolTip(title=second circle, desc1=first line of
 description, desc2=second line)
 points(1.5,2.5,cex=20,pch=19,col='red')
 dev.off()
 
 This produces a file with the path C:\svgplot2.svg. THis is shown below:
 
 http://www.nabble.com/file/p10816061/demo.jpg 
 
 Your link says jpg, not svg.
 
 When I open it in Firefox in XP, however, none of the tooltips appear
 when I
 hover over the object. What do I need to solve this problem?
 
 Don't convert to jpeg?
 
 Duncan Murdoch
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/Interactive-plots--tf3818454.html#a10816361
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.


[R] using cut

2007-05-26 Thread J. Scott Olsson
Suppose I have some data

x - rnorm(1000);
y - x*x;

then try to cut it into 2 chunks,

c - cut(y, breaks=2);

summary(y)
 Min.   1st Qu.Median  Mean   3rd Qu.  Max.
6.879e-06 9.911e-02 3.823e-01 9.499e-01 1.297e+00 8.342e+00

summary(c)
(-0.00833,4.17] (4.17,8.35]
958  42

Is that the correct behavior? Why is the left hand side of the interval
negative?

How would I split a data vector into groups/intervals such that each
interval contained the same number of points?


Thanks much!
Scott

[[alternative HTML version deleted]]

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


Re: [R] How to check for existence url from within a function?

2007-05-26 Thread Heinz Tuechler
Thank you, Duncan, especially for the hint concerning inherits.

Heinz

At 08:02 26.05.2007 -0400, Duncan Murdoch wrote:
On 26/05/2007 7:13 AM, Heinz Tuechler wrote:
 Dear All,
 
 To check if an url exists, I can use try(). This works, as I expected, if I
 do it directly, as in the first part of the following example, but I could
 not find a way to do it from within a function, as in the second part.
 
 Where could I find information on how to do this?
 
 Thanks,
 Heinz
 
 
 ## set nonexisting url
 url.string - 'http://www.google.at/nonexist.html'
 
 ## first part
 1 # to start with defined .Last.value
 try(con.url - url(url.string, open='rb'))
 class.try.res - class(.Last.value)
 try.error - class.try.res== 'try-error'
 print(try.error)  # TRUE
 try(close(con.url))
 
 ## try() within a function
 url.error - function(url.string) {
   1 # to start with defined .Last.value
   try(con.url - url(url.string, open='rb'))
   class.try.res - class(.Last.value)
   try.error - class.try.res== 'try-error'

.Last.value isn't set until your function returns.  You should write this as

con.url - try(url(url.string, open='rb'))
try.error - inherits(con.url, try-error)

Notice that I used inherits, rather than testing for equality.  It's 
documented that the result of try() will be of class 'try-error' if an 
error occurs, but there may be circumstances (in the future?) where 
different types of errors are signalled by using a more complicated class.

Duncan Murdoch

   print(try.error)
   try(close(con.url))
   invisible(try.error)
 }
 
 ## call the function
 url.error(url.string)   # result - 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.


__
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] using cut

2007-05-26 Thread David Barron
You can split a vector into groups with equal numbers using the
quantcut function in the gtools package.  For example, to split into
two groups, use:

c - quantcut(y,c(0,.5,1))

On 26/05/07, J. Scott Olsson [EMAIL PROTECTED] wrote:
 Suppose I have some data

 x - rnorm(1000);
 y - x*x;

 then try to cut it into 2 chunks,

 c - cut(y, breaks=2);

 summary(y)
  Min.   1st Qu.Median  Mean   3rd Qu.  Max.
 6.879e-06 9.911e-02 3.823e-01 9.499e-01 1.297e+00 8.342e+00

 summary(c)
 (-0.00833,4.17] (4.17,8.35]
 958  42

 Is that the correct behavior? Why is the left hand side of the interval
 negative?

 How would I split a data vector into groups/intervals such that each
 interval contained the same number of points?


 Thanks much!
 Scott

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



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


[R] graphics edge in win.metafile?

2007-05-26 Thread LL
Hi... I copy a plot to the clipboard via win.metafile and then paste the 
clipboard into a powerpoint show. The problem is that there is considerable 
white space between the edges of the plot and the figure pasted into 
powerpoint. I've tried many par settings to get less white space between the 
plot sides and the  bounding box.. but haven't succeeded. 

win.metafile(, height=3, width=3)
plot(1:10)
dev.off()

Thanks,
Lance
[[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] normality tests

2007-05-26 Thread John C Frain
For small samples I would think that the Shapiro Wilk test is probably
the most powerful.  Chapter 7 of Thon (2002), Testing for Normality,
Marcel Dekker,  contains a good summary of research in this area.  If
you have a specific alternative in view you might find s better test.

Regards

John

On 25/05/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 On 25/05/07, Frank E Harrell Jr [EMAIL PROTECTED] wrote:
  [EMAIL PROTECTED] wrote:
   Hi all,
  
   apologies for seeking advice on a general stats question. I ve run
   normality tests using 8 different methods:
   - Lilliefors
   - Shapiro-Wilk
   - Robust Jarque Bera
   - Jarque Bera
   - Anderson-Darling
   - Pearson chi-square
   - Cramer-von Mises
   - Shapiro-Francia
  
   All show that the null hypothesis that the data come from a normal
   distro cannot be rejected. Great. However, I don't think it looks nice
   to report the values of 8 different tests on a report. One note is
   that my sample size is really tiny (less than 20 independent cases).
   Without wanting to start a flame war, are there any advices of which
   one/ones would be more appropriate and should be reported (along with
   a Q-Q plot). Thank you.
  
   Regards,
  
 
  Wow - I have so many concerns with that approach that it's hard to know
  where to begin.  But first of all, why care about normality?  Why not
  use distribution-free methods?
 
  You should examine the power of the tests for n=20.  You'll probably
  find it's not good enough to reach a reliable conclusion.

 And wouldn't it be even worse if I used non-parametric tests?

 
  Frank
 
 
  --
  Frank E Harrell Jr   Professor and Chair   School of Medicine
Department of Biostatistics   Vanderbilt University
 


 --
 yianni

 __
 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 C Frain
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:[EMAIL PROTECTED]
mailto:[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] graphics edge in win.metafile?

2007-05-26 Thread Charles Annis, P.E.
Try using Paste, Special in WORD or PowerPoint.  The graphic will be
slightly smaller too but I find the size is just right.


What works better for me, but does require some forethought, is something
like this:

graphics.off()
windows(width = 5.8, height = 5.8, pointsize = 12)
par(mar = c(4.5, 4.5, 4, 0.5) + 0.1)#  -- sized to fit your graphic.
###Customizing par() may solve your cut  paste problem, too.
###
### graphic generating logic goes here.
###
savePlot(graphic name, type = wmf)

The rather than cut  paste, I use WORD or PowerPoint's insert to point to
the new graphic.




Charles Annis, P.E.

[EMAIL PROTECTED]
phone: 561-352-9699
eFax:  614-455-3265
http://www.StatisticalEngineering.com
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of LL
Sent: Saturday, May 26, 2007 1:14 PM
To: LL; r-help@stat.math.ethz.ch
Subject: [R] graphics edge in win.metafile?

Hi... I copy a plot to the clipboard via win.metafile and then paste the
clipboard into a powerpoint show. The problem is that there is considerable
white space between the edges of the plot and the figure pasted into
powerpoint. I've tried many par settings to get less white space between the
plot sides and the  bounding box.. but haven't succeeded. 

win.metafile(, height=3, width=3)
plot(1:10)
dev.off()

Thanks,
Lance
[[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] canoncial correlation

2007-05-26 Thread Soare Marcian-Alin
Hello,

I have a problem with the function concar:

data set:
http://www.statistik.tuwien.ac.at/public/filz/students/multi/ss07/world2.R

source(world2.R)

world[,8] - log(world[,8])
world[,9] - log(world[,9])
x - world[,-c(1,2)]
x - scale(x)

a - cancor(x[,-c(6:9)],x[,-c(1:5)])
attributes(a)
a

How do I plot the first two canonial variables of a? And I want to take the
rownames of world as pch ...

plot(..., pch=rownames(world), col=as.numeric(world[,1]))

Thanks in advance!

-- 
Mit freundlichen Grüssen / Best Regards

Soare Marcian-Alin

[[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] graphics edge in win.metafile?

2007-05-26 Thread LL
Thanks Charles. I just discovered that I get much better behavior if I write 
the graph to a normal R graphics window, right click and select copy as 
metafile, and paste the result normally into powerpoint.

- Original Message - 
From: Charles Annis, P.E. [EMAIL PROTECTED]
To: 'LL' [EMAIL PROTECTED]; r-help@stat.math.ethz.ch
Sent: Saturday, May 26, 2007 7:46 PM
Subject: RE: [R] graphics edge in win.metafile?


 Try using Paste, Special in WORD or PowerPoint.  The graphic will be
 slightly smaller too but I find the size is just right.


 What works better for me, but does require some forethought, is something
 like this:

 graphics.off()
 windows(width = 5.8, height = 5.8, pointsize = 12)
 par(mar = c(4.5, 4.5, 4, 0.5) + 0.1)#  -- sized to fit your graphic.
 ###Customizing par() may solve your cut  paste problem, too.
 ###
 ### graphic generating logic goes here.
 ###
 savePlot(graphic name, type = wmf)

 The rather than cut  paste, I use WORD or PowerPoint's insert to point 
 to
 the new graphic.




 Charles Annis, P.E.

 [EMAIL PROTECTED]
 phone: 561-352-9699
 eFax:  614-455-3265
 http://www.StatisticalEngineering.com


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of LL
 Sent: Saturday, May 26, 2007 1:14 PM
 To: LL; r-help@stat.math.ethz.ch
 Subject: [R] graphics edge in win.metafile?

 Hi... I copy a plot to the clipboard via win.metafile and then paste the
 clipboard into a powerpoint show. The problem is that there is 
 considerable
 white space between the edges of the plot and the figure pasted into
 powerpoint. I've tried many par settings to get less white space between 
 the
 plot sides and the  bounding box.. but haven't succeeded.

 win.metafile(, height=3, width=3)
 plot(1:10)
 dev.off()

 Thanks,
 Lance
 [[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] How to assign RODBC object as R class slots and method signature

2007-05-26 Thread adschai
HiI have a class which would like to hold a connection to ODBC data connection. 
The handle to the connection is something like (according to RODBC 
manual):channel = odbcConnect(DSN,uid=user,pwd=password)However, I would 
like to make a slot of my foo class to hold this object. For 
example:setClass(foo, representation(channel=RODBC))But this won't compile 
as it keeps saying that it cannot find RODBC as a valid class name even I 
have the package loaded in place. And from what I found in RODBC manual, the 
'channel' variable should be of type 'RODBC'. This makes it even more difficult 
when I try define this database connection like 'channel' above as method 
signature.For example, I have a class for method like this.setMethod(setConn, 
foo,   signature(object=foo,newconn=RODBC)   function(object, newconn) 
{   ... do something here.   })This doesn't compile. It will keep saying that 
it doesn't know about type RODBC. Please let me know how we can solve this? 
Thank you.- adschai

[[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] learning lattice graphics

2007-05-26 Thread Tyler Smith
Hi,

I've just produced my first lattice plot - the graphic is very
impressive, but I only partly understand how it works. I crimped from
examples in MASS and the help pages to get most of what I want done.
Howver, I find both MASS and the help pages are a little too terse for
my needs as a beginner. Can anyone suggest web or print resources for
lattice graphics that provide a more thorough introduction? I've been
through the FAQ and standard manuals, but didn't see what I needed
there.

Thanks,

Tyler

__
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] graphics edge in win.metafile?

2007-05-26 Thread jim holtman
You can always use the 'crop' feature in PowerPoint to get the graphics the
way you want them.

On 5/26/07, LL [EMAIL PROTECTED] wrote:

 Thanks Charles. I just discovered that I get much better behavior if I
 write
 the graph to a normal R graphics window, right click and select copy as
 metafile, and paste the result normally into powerpoint.

 - Original Message -
 From: Charles Annis, P.E. [EMAIL PROTECTED]
 To: 'LL' [EMAIL PROTECTED]; r-help@stat.math.ethz.ch
 Sent: Saturday, May 26, 2007 7:46 PM
 Subject: RE: [R] graphics edge in win.metafile?


  Try using Paste, Special in WORD or PowerPoint.  The graphic will be
  slightly smaller too but I find the size is just right.
 
 
  What works better for me, but does require some forethought, is
 something
  like this:
 
  graphics.off()
  windows(width = 5.8, height = 5.8, pointsize = 12)
  par(mar = c(4.5, 4.5, 4, 0.5) + 0.1)#  -- sized to fit your graphic.
  ###Customizing par() may solve your cut  paste problem, too.
  ###
  ### graphic generating logic goes here.
  ###
  savePlot(graphic name, type = wmf)
 
  The rather than cut  paste, I use WORD or PowerPoint's insert to
 point
  to
  the new graphic.
 
 
 
 
  Charles Annis, P.E.
 
  [EMAIL PROTECTED]
  phone: 561-352-9699
  eFax:  614-455-3265
  http://www.StatisticalEngineering.com
 
 
  -Original Message-
  From: [EMAIL PROTECTED]
  [mailto:[EMAIL PROTECTED] On Behalf Of LL
  Sent: Saturday, May 26, 2007 1:14 PM
  To: LL; r-help@stat.math.ethz.ch
  Subject: [R] graphics edge in win.metafile?
 
  Hi... I copy a plot to the clipboard via win.metafile and then paste the
  clipboard into a powerpoint show. The problem is that there is
  considerable
  white space between the edges of the plot and the figure pasted into
  powerpoint. I've tried many par settings to get less white space between
  the
  plot sides and the  bounding box.. but haven't succeeded.
 
  win.metafile(, height=3, width=3)
  plot(1:10)
  dev.off()
 
  Thanks,
  Lance
  [[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.




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[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] windows to unix

2007-05-26 Thread Tyler Smith
On 2007-05-25, Barry Rowlingson [EMAIL PROTECTED] wrote:

 Erin Is there any way to take a Windows version of R, compiled
 from source, compress it, and put it on a Unix-like
 environment, please?


   You can take a Windows-compiled R to Unix, but you can't make it work

   The big unasked question is 'What is this unix-like environment?'.


Perhaps the bigger unasked question is 'Why?'. It may be possible to
run a Windows R under Wine, but I can't imagine there would be any
advantage over running the native Linux version.


Tyler

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


[R] Why ?rmvnorm not working

2007-05-26 Thread Patrick Wang
Hi,

My R version is 2.4.1 and I installed the the packages MASS and run
command library(MASS),

however when I type ?rmvnorm, no help topic found, it worked before.

I tried to ype ?rinvgamma from MCMCpack which works great.

Anybody have idea? I also reinstalled MASS package, but when I try to type
rmvnorm(), no functions found.

Pat

__
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] Why ?rmvnorm not working

2007-05-26 Thread Henrique Dallazuanna
The correct is ?mvrnorm.

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22
Ohttp://maps.google.com/maps?f=qhl=enq=Curitiba,+Brazillayer=ie=UTF8z=18ll=-25.448315,-49.276916spn=0.002054,0.005407t=kom=1

On 26/05/07, Patrick Wang [EMAIL PROTECTED] wrote:

 Hi,

 My R version is 2.4.1 and I installed the the packages MASS and run
 command library(MASS),

 however when I type ?rmvnorm, no help topic found, it worked before.

 I tried to ype ?rinvgamma from MCMCpack which works great.

 Anybody have idea? I also reinstalled MASS package, but when I try to type
 rmvnorm(), no functions found.

 Pat

 __
 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] testing difference (or similarities) between two distance matrices (not independent)

2007-05-26 Thread Tyler Smith
On 2007-05-25, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:

 i'm looking to test if two distance matrices are statistically  
 different from each others.


 both these matrices are obviously not independent from each others, so  
 Mantel test and others correlation tests do not apply here.

 I thought of testing the order of values between these matrices (if  
 distances are ordered the same way for both matrices, we have very  
 similar matrices and the additional factor has quite no effect on the  
 calculation). Is there any package or function in R allowing to do  
 that and statistically test it (with permutations or another approach)?

The mantel() function in the vegan library will do exactly this, with
the method=spearman option. However, I don't think there is any
possible permutation test that will provide you with a valid test of
significance if the samples themselves are not independent.

Tyler

__
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] skiping N value when using scan()

2007-05-26 Thread Milton Cezar Ribeiro
Hi there,

I have a so big text file which contents are just values varing from 1 to 5.
The size of this file are about 800MB and I can´t read it in my R session 
because of memory limits. I would like to know if I can skip the firsts 10.000 
values of the text file, and read the next 5.000 values.

The real dimension of my file are 2048*2048*100 values.

Kind regards,

Miltinho
Brazil

__


[[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] lattice: aligning independent graphs

2007-05-26 Thread Zack Weinberg
I find myself wanting to plot three graphs side by side 'as if' they
were panels -- that is, with the same y-axis limits, no space between
the graphs, and precise vertical alignment of the plot areas. However,
I don't want strip titles; I want each graph to have its own x-axis
label, on the bottom of the plot.

The best way I have so far found to do this is to fake up a data frame
that allows me to use actual panels, turn off the strip, and insert a
whole bunch of white space in the x-axis label so it looks like there
are three separate labels.  Like this:

xyplot(x ~ thing | panel,
   data=wrong.all,
   ylab=list(label='% incorrect responses', cex=0.7),
   xlab=list(label=paste('Trial number ',
 'Subject number  ',
 'Experimental condition'), cex=0.7),
   ylim=c(0,top), col='black', pch=3, strip=F,
   scales=list(
 x=list(alternating=c(1,0), tck=c(1,0), cex=0.5, rot=90,
   relation='free',
   at=list(
 seq(0,33,by=5),
 seq(0,maxsub, by=5),
 seq(1,length(levels(wrongconds,
   labels=list(seq(0,33,by=5), seq(0,maxsub, by=5),
 levels(wrongconds))),
 y=list(at=seq(0,top,by=10), alternating=c(1,0),
   tck=c(1,1),
   cex=0.5)),
   type=list(c('p','smooth'), 'h', 'h'),
   panel=function(..., type=list(p)) {
 panel.grid(h=-1, v=0)
 panel.xyplot(..., type=type[[panel.number()]])
   })

But surely there is a better way?

zw

__
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] tcltk crashing R after the (ab)use of tkwait

2007-05-26 Thread Mike Meredith

 library(tcltk)
 tt - tktoplevel()
 done - tclVar(0)
 but - tkbutton(tt, text=OK, command=function() tclvalue(done) - 1)
 tkpack(but)
 tkwait.variable(done)
 
 works as fine as long as I click the OK. However, if I close
 the window (by clicking in the X), R enters into an infinite loop
 and there's no way of returning except by closing the R window.

I have the same pbm with R 1.5.0 on Window XP Home SP2.

I think it's doing what it's supposed to, ie. waiting for done==1, just that
this never happens.

I've stopped using tkwait.variable for just this reason, and use
tkwait.window(tt). You have to be careful to recover the variables you need
before closing the window, so the function attached to the 'OK' button
should take care of that before calling tkdestroy. (See
http://www.nabble.com/Dropdown-boxes-in-tcltk-and-R-tf3751327.html#a10603161)

Variables can be created in .GlobalEnv with - which will be availble after
the function exits. See also how Greg Snow uses a purpose-built environment
in his 'TeachingDemos' package.

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



-- 
View this message in context: 
http://www.nabble.com/tcltk-crashing-R-after-the-%28ab%29use-of-tkwait-tf3487962.html#a10821463
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] skiping N value when using scan()

2007-05-26 Thread jim holtman
?scan
see 'skip' and 'nlines'


On 5/26/07, Milton Cezar Ribeiro [EMAIL PROTECTED] wrote:

 Hi there,

 I have a so big text file which contents are just values varing from 1 to
 5.
 The size of this file are about 800MB and I can´t read it in my R session
 because of memory limits. I would like to know if I can skip the firsts
 10.000 values of the text file, and read the next 5.000 values.

 The real dimension of my file are 2048*2048*100 values.

 Kind regards,

 Miltinho
 Brazil

 __


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




-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[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] Rpad files do not work as html.

2007-05-26 Thread CharlieChi

Hi, this is Charlie. I have installed Rpad on Windows XP following
ServerNotes. During the installation, I copy the directory Statistics to
my perl\lib while nmake and nmake install commands do not work althought
perl (ActivePerl) is installed (ps. perl Makefile.PL command works). 

While I am testing Rpad, the Rpad home page loaded as normal, but after I
clicking examples, it was loaded as source codes rather than html. I did add
a mime type for .Rpad files in conf\mine as text/html Rpad. After I
check steps I have done, they were same to the guide, therefore, I am not
sure where I did wrong. Thank you for helping me with it.

Regards

Charlie
-- 
View this message in context: 
http://www.nabble.com/Rpad-files-do-not-work-as-html.-tf3822524.html#a10821909
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.


[R] Rpad examples having problems with local server

2007-05-26 Thread Charlie Chi
Hi, this is Charlie. I have installed the Rpad on my server (using Fedora 
Core 6 with httpd2.24-2, mod_perl 2.0.2-6.1, perl 5.8.8 from RPM). When I 
access to the Rpad (through http://localhost/Rpad/basehtml), it shows me 
the main page as normal, however, problems occurs when I am testing the 
examples. It shows me a long message like: 
- 
#!/usr/bin/perl -w 
#!c:/apps/perl/bin/perl.exe 

#The following line is a test script to see if it works. 
#httpd://localhost/Rpad/server/R_process.pl?ID=ddNTlmHSvWZFcommand=R_commandscommands=print(hello')


use Statistics::Rpad; 
use strict; 
use CGI qw/:standard send_http_header/; 
use Cwd; 
. 
. 
and so on 
 
Does it mean that perl is not found in my machine? I have checked my perl 
in path/usr/bin/perl and it is there.
Moreover, when I was installing Statistics-R_perl_interface, it shows me 
(Can't locat object method startRShared via Statistics::Rpad at test.pl 
line 21) but I still keep making install. Therefore, I am wondering if I 
successfully installed

Rpad on my server or not. Thank you for helping me.

Regards 


Charlie

__
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] Question about evalq

2007-05-26 Thread ronggui
The help page of eval says: The 'evalq' form is equivalent to
'eval(quote(expr), ...)'.  But the following is not equivalent.  Can
anyone give me some explaination? Thanks very much.

 f1 - function(x,digits=5) lapply(x, f2)
 f2 - function(x) 
 eval(quote(print(x+1,digits=digits)),list(x=x),parent.frame(2))
 f1(list(x1=1))
[1] 2
$x1
[1] 2


 f1 - function(x,digits=5) lapply(x, f2)
 f2 - function(x) evalq(print(x+1,digits=digits),list(x=x),parent.frame(2))
 f1(list(x1=1))
Error in print.default(x + 1, digits = digits) :
  object digits not found



-- 
Ronggui Huang
Department of Sociology
Fudan University, Shanghai, China

__
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] Question about evalq

2007-05-26 Thread Gabor Grothendieck
evalq looks like this:

evalq
   function (expr, envir, enclos)
   eval.parent(substitute(eval(quote(expr), envir, enclos)))
   environment: namespace:base

so it seems the difference is that

- eval(quote(), envir, enclos) evaluates envir and enclos
  in the current frame but
- evalq evaluates them in the parent.frame.

This may be easier to see in the following example:

   x - G
   f1 - function() eval(quote(x), parent.frame())
   f2 - function() evalq(x, parent.frame())
   f11 - function() {
x - a
f1()
   }
   f22 - function() {
x - b
f2()
   }
   f11() # a
   f22() # G

To avoid this problem pass a variable whose value is
to be enclos= rather than an expression to compute it:

   f1 - function(x,digits=5) lapply(x, f2)
   f2 - function(x) {
  pf2 - parent.frame(2)
  evalq(print(digits), list(x=x), pf2)
   }
   f1(list(x1=1)) # 5



On 5/26/07, ronggui [EMAIL PROTECTED] wrote:
 The help page of eval says: The 'evalq' form is equivalent to
 'eval(quote(expr), ...)'.  But the following is not equivalent.  Can
 anyone give me some explaination? Thanks very much.

  f1 - function(x,digits=5) lapply(x, f2)
  f2 - function(x) 
  eval(quote(print(x+1,digits=digits)),list(x=x),parent.frame(2))
  f1(list(x1=1))
 [1] 2
 $x1
 [1] 2

 
  f1 - function(x,digits=5) lapply(x, f2)
  f2 - function(x) evalq(print(x+1,digits=digits),list(x=x),parent.frame(2))
  f1(list(x1=1))
 Error in print.default(x + 1, digits = digits) :
  object digits not found



 --
 Ronggui Huang
 Department of Sociology
 Fudan University, Shanghai, China

 __
 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] Not able to understand the behaviour of boot

2007-05-26 Thread Ajay Shah
Folks,

I have a time-series of 875 readings of the weekly returns of a stock
market index (India's Nifty). I am interested in the AR(1)
coefficient. When I do arima(r, order=c(1,0,0)) I get a statistically
significant AR1 coefficient.

If we apply the ordinary bootstrap to this problem, this involves
sampling with replacement, which destroys the time-series 
structure. Hence, if we do bootstrap inference (using the ordinary
bootstrap) we ought to get a 95% confidence interval which is roughly
symmetric about zero. Yes?

The program:

---
library(boot)
AR1.boot - function(x, d) { arima(x[d], order=c(1,0,0))$coef[1] }
load(url(http://www.mayin.org/ajayshah/A/nifty_weekly_returns.rda;))
arima(r, order=c(1,0,0))
b - boot(r, AR1.boot, R=5000)
boot.ci(b, type=basic)
---

gives me:

---
 arima(r, order=c(1,0,0))

Call:
arima(x = r, order = c(1, 0, 0))

Coefficients:
 ar1  intercept
  0.0718 0.3061
s.e.  0.0337 0.1392

sigma^2 estimated as 14.61:  log likelihood = -2414.86,  aic = 4835.72
 b - boot(r, AR1.boot, R=R)
 boot.ci(b, type=basic)
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 5000 bootstrap replicates

CALL : 
boot.ci(boot.out = b, type = basic)

Intervals : 
Level  Basic 
95%   ( 0.0760,  0.2109 )  
Calculations and Intervals on Original Scale
---

I find it very strange that the 95% confidence interval runs from
0.076 to 0.2109. I had expected that it should be symmetric about
0. What am I missing?

As an aside, how would you set about using tsboot() to obtain
inference for this AR(1) coefficient?

-- 
Ajay Shah  http://www.mayin.org/ajayshah  
[EMAIL PROTECTED] http://ajayshahblog.blogspot.com
*(:-? - wizard who doesn't know the answer.

__
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] Problem while working with SPSS data

2007-05-26 Thread Arun Kumar Saha
Dear all R users,

I got a strange problem while working with SPSS data :

I wrote following :

library(foreign)
data.original = as.data.frame(read.spss(file=c:/Program Files/SPSS/Employee
data.sav))

data = as.data.frame(cbind(data.original$MINORITY, data.original$EDUC,
data.original$PREVEXP, data.original$JOBCAT, data.original$GENDER))
colnames(data) = c('MINORITY', 'EDUC', 'PREVEXP', 'JOBCAT', 'GENDER')

head( data.original)

  ID GENDER   BDATE EDUC   JOBCAT SALARY SALBEGIN JOBTIME PREVEXP
MINORITY
1  1   NA 11654150400   15  Manager  5700027000  98 144
No
2  2   NA 11852956800   16 Clerical  4020018750  98  36
No
3  3   NA 10943337600   12 Clerical  2145012000  98 381
No
4  4   NA 115025184008 Clerical  2190013200  98 190
No
5  5   NA 11749363200   15 Clerical  4500021000  98 138
No
6  6   NA 11860819200   15 Clerical  3210013500  98  67
No

 head( data)
  V1 V2  V3 V4 V5
1  1  5 144  4 NA
2  1  6  36  2 NA
3  1  3 381  2 NA
4  1  2 190  2 NA
5  1  5 138  2 NA
6  1  5  67  2 NA


here I got the values of variable V2 as 5,6,3,...etc which should
be 15,16,12,

can anyone tell me why I got that?

And my second question is that in my data.original why I got the values of
GENDER as NA? Is there any way to get the actual values i.e. m, and f?

Thanks
Arun

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