Re: [R] Building static HTML help pages in R 2.10.x on Windows

2009-12-27 Thread Heinz Tuechler

Instead of an answer, may I add question

c) can someone state that it is impossible to generate static HTML 
help pages under Windows?


At 21:40 22.12.2009, Steve Rowley wrote:

I upgraded to R2.10.1pat and discovered, along with everybody else,
that static HTML pages are no longer the default.  Fine; my tastes
would go the other way, but I'm happy to adapt.

However, I'd still like to build static HTML pages (for stable
bookmarking, use when R is not running, etc.).

I'm using the Windows installer, so the advice in the R Installation 
Admin guide (section 2.2, Help options) to use the configure option
--enable-prebuilt-html doesn't seem to apply.  I'm using
install.packages() rather than R CMD INSTALL, so I don't quite
understand how the --html arg to R CMD INSTALL can apply either.

So, can anybody point me to an example of either:

(a) how to build the static HTML help pages of all currently
installed packages under Windows,

or, failing that

(b) how to do this on Windows ab initio, from a clean install?

Thanks!
--
Steve Rowley s...@alum.mit.edu http://alum.mit.edu/www/sgr/

__
R-help@r-project.org 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@r-project.org 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] svm regression/classification

2009-12-27 Thread Nancy Adam

 
 
Hi everyone,
 
Can anyone please tell whether there is a difference between the code for using 
svm in regression and code for using svm in classification?
 
This is my code for regression, should I change it to do classification?:
 
train - read.table(trainingset.txt,sep=;)
test - read.table(testset.txt,sep=;)
 
 
svmmodelfitness - function(myformula,mydata,mytestdata) 
{
   
 mymodel - svm(myformula,data=mydata) 
 
  mytest - predict(mymodel, mytestdata)
  error - mytest - mytestdata[,1]
  -sqrt(mean(error**2))
}
 
Many thanks,
Nancy 
_


[[alternative HTML version deleted]]

__
R-help@r-project.org 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 create a simple loop ?

2009-12-27 Thread Edouard Tallent
I have a 5-row matrix called “data”. There are headers.
it look like this :
Row 1   Row2Row3Row4Row5
Line1 …………
Line2 …………
Line3 …………
…
Line 1838 …………
 I want to calculate several simple arithmetic means for Row5, that is from 
Line173 to Line193, from Line434 to Line455, from Line699 to Line724, from 
Line955 to Line977
 A simple way is to individually compute these means. The first one (Line173 to 
Line193) is then obtained by :
mean(data[173:193,5], na.rm = TRUE)
That’s right ! But, I aim to automate this calculation by creating a loop.
I tried many things, but I have been unsuccessful at using the ‘for’ loop 
function.
Please, don’t explain things too hard as it is often the case that people 
wants to help but gets into too much sophistication.
Someone can write that little code for this example ? Or suggest functions ?
Thanks for your help.
Cheers,
Édouard.

[[alternative(swapped) HTML version deleted]]

This is MIME Epilogue

__
R-help@r-project.org 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 create a simple loop ?

2009-12-27 Thread Edouard Tallent
Hi everyone. And, Merry Xmas !
I have a 5-row matrix called “data”. There are headers.
it look like this :
Row 1   Row2Row3Row4Row5
Line1 …………
Line2 …………
Line3 …………
…
Line 1838 …………
 I want to calculate several simple arithmetic means for Row5, that is from 
Line173 to Line193, from Line434 to Line455, from Line699 to Line724, from 
Line955 to Line977
 A simple way is to individually compute these means. The first one (Line173 to 
Line193) is then obtained by :
mean(data[173:193,5], na.rm = TRUE)
That’s right ! But, I aim to automate this calculation by creating a loop.
I tried many things, but I have been unsuccessful at using the ‘for’ loop 
function.
Please, don’t explain things too hard as it is often the case that people 
wants to help but gets into too much sophistication.
Someone can write that little code for this example ? Or suggest functions ?
Thanks for your help.
Cheers,
Édouard.

[[alternative(swapped) HTML version deleted]]

This is MIME Epilogue

__
R-help@r-project.org 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 create a simple loop ?

2009-12-27 Thread David Winsemius


On Dec 27, 2009, at 9:15 AM, Edouard Tallent wrote:


Hi everyone. And, Merry Xmas !
I have a 5-row matrix called “data”. There are headers.
it look like this :
Row 1   Row2Row3Row4Row5
Line1 …………
Line2 …………
Line3 …………
…
Line 1838 …………
I want to calculate several simple arithmetic means for Row5, that  
is from Line173 to Line193, from Line434 to Line455, from Line699 to  
Line724, from Line955 to Line977
A simple way is to individually compute these means. The first one  
(Line173 to Line193) is then obtained by :

mean(data[173:193,5], na.rm = TRUE)
That’s right ! But, I aim to automate this calculation by creating a  
loop.
I tried many things, but I have been unsuccessful at using the ‘for’  
loop function.


Generally it would be better to include the failed efforts in the form  
of executable R code that would let the readership see, for instance,  
the list (or vector, or matrix) of intervals that you were trying to  
use in the for loops.


Please, don’t explain things too hard as it is often the case that  
people wants to help but gets into too much sophistication.

Someone can write that little code for this example ?


? No executable example offered.


Or suggest functions ?


A for loop would seem sensible. The sapply function might be used, or  
perhaps the apply function. It really depends on the details of how  
the intervals are represented (which you have not provided.)


and provide commented, minimal, self-contained, reproducible code.

 ^^^
David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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] Identifying outliers in non-normally distributed data

2009-12-27 Thread John
Hello,

I've been searching for a method for identify outliers for quite some
time now. The complication is that I cannot assume that my data is
normally distributed nor symmetrical (i.e. some distributions might
have one longer tail) so I have not been able to find any good tests.
The Walsh's Test (http://www.statistics4u.info/
fundsta...liertest.html#), as I understand assumes that the data is
symmetrical for example.

Also, while I've found some interesting articles:
http://tinyurl.com/yc7w4oq (Missing Values, Outliers, Robust
Statistics  Non-parametric Methods)
I don't really know what to use.

Any ideas? Any R packages available for this? Thanks!

PS. My data has 1000's of observations..

__
R-help@r-project.org 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] Identifying outliers in non-normally distributed data

2009-12-27 Thread Brian G. Peterson

John wrote:

Hello,

I've been searching for a method for identify outliers for quite some
time now. The complication is that I cannot assume that my data is
normally distributed nor symmetrical (i.e. some distributions might
have one longer tail) so I have not been able to find any good tests.
The Walsh's Test (http://www.statistics4u.info/
fundsta...liertest.html#), as I understand assumes that the data is
symmetrical for example.

Also, while I've found some interesting articles:
http://tinyurl.com/yc7w4oq (Missing Values, Outliers, Robust
Statistics  Non-parametric Methods)
I don't really know what to use.

Any ideas? Any R packages available for this? Thanks!

PS. My data has 1000's of observations..


Take a look at package 'robustbase', it provides most of the standard robust 
measures and calculations.


While you didn't say what kind of data you're trying to identify outliers in, 
if it is time series data the function Return.clean in PerformanceAnalytics may 
be useful.


Regards,

  - Brian


--
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock

__
R-help@r-project.org 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] RGtk2 / gWidgets - addHandlerClicked Problem

2009-12-27 Thread Mark Heckmann
In The following code, the table handler is executed twice when the  
button is pressed (from the 2nd pressing on).
I want it to be executed only once. Does someone know, why this  
happens and how I can change it?


library(gWidgets)

w - gwindow()
b - gbutton(press, cont=w)
tbl - gtable(1:10, cont=w)

addhandlerclicked(b, handler=function(h, ...){
cat(addhandlerclicked button\n)
svalue(tbl, index=T) - 1# change the table 
value
})
addhandlerclicked(tbl, handler=function(h, ...){
cat(addhandlerclicked table\n)
})

Thanks!
Mark

–––
Mark Heckmann
Dipl. Wirt.-Ing. cand. Psych.
Vorstraße 93 B01
28359 Bremen
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com

__
R-help@r-project.org 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] Make the output (from a Loop function) a Vector

2009-12-27 Thread David Winsemius


On Dec 27, 2009, at 11:17 AM, Cat Morning wrote:


Hi all,

I have made a loop function which prints outputs. For example:

 for (i in 1:5)
+ print(i)
[1] 1
[1] 2
[1] 3
[1] 4
[1] 5

However, I would like the output to given as a list or a vector,  
e..g c(1,2,3,4,5). Is it possible to do this?


This does suggest that you need to do some more studying of whatever  
text you are using to learn R:


 v - c()
 for (i in 1:5) v - c(v,i)
 v
[1] 1 2 3 4 5

Or if you wanted to see the results with each iteration:
 v - c()
 for (i in 1:5) print(v - c(v,i))
[1] 1
[1] 1 2
[1] 1 2 3
[1] 1 2 3 4
[1] 1 2 3 4 5


(The function I am using outputs many 1000s of results, so is not  
easy to change to a vector manually.)



So you probably would not want the print() version.

Many Thanks.

[[alternative HTML version deleted]]


Set your mail-client up to send plain-text.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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] RGtk2 / gWidgets - addHandlerClicked Problem

2009-12-27 Thread David Winsemius


On Dec 27, 2009, at 11:29 AM, Mark Heckmann wrote:

In The following code, the table handler is executed twice when the  
button is pressed (from the 2nd pressing on).


Can't reproduce. On a Mac 10.5.8, R 2.10.1, running the 64 bit GUI,  
after choosing the gWidgetstcltk option for GUI toolkit when gwindow()  
is first executed, I do not get a behavior that suggests that the  
table handler gets executed twice with each button click. I get an X11  
window with a button across the width of the top of the window. Each  
time the button is clicked I get :


addhandlerclicked button
addhandlerclicked table

Just for fun I modified your tbl handler and got sensible incrementing  
highlighting of the rows with:

 addhandlerclicked(b, handler=function(h, ...){
+   cat(addhandlerclicked button\n)
+ 	svalue(tbl, index=T) - 1+svalue(tbl)	# the earlier code did not  
change values

+ })


I want it to be executed only once. Does someone know, why this  
happens and how I can change it?


library(gWidgets)

w - gwindow()
b - gbutton(press, cont=w)
tbl - gtable(1:10, cont=w)

addhandlerclicked(b, handler=function(h, ...){
cat(addhandlerclicked button\n)
svalue(tbl, index=T) - 1# change the table 
value
})
addhandlerclicked(tbl, handler=function(h, ...){
cat(addhandlerclicked table\n)
})

Thanks!
Mark

--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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] Positions in datasets

2009-12-27 Thread Anders Falk
Could someone help me understand this

Basically I want to know the position of certain numbers in large output
data sets. First consider the following simple example where we get the
postions of ones (1) in the vector q.

 q - c(5,1,1,3,1,1,1,1)
 q
[1] 5 1 1 3 1 1 1 1
 for (i in 1:length(q)) if(q[i]==1) print(i)
[1] 2
[1] 3
[1] 5
[1] 6
[1] 7
[1] 8

Well done!


But now consider the following case where the input consists of different
combinations of the three numbers 2, 3 and 7. They are put into a function
1/x +1/y +1/z +1/(x*y*z). All different combinations will yield the same
result namely precisely 1, which is also clearly seen in the output.
However when I try to get information on the position of the ones in the
output, there are only two that are recognized, although all six items in
the output are indeed ones.

 x - c(2,2,3,3,7,7); y - c(3,7,2,7,2,3); z - c(7,3,7,2,3,2)
 data.frame(x,y,z)
  x y z
1 2 3 7
2 2 7 3
3 3 2 7
4 3 7 2
5 7 2 3
6 7 3 2
 p - numeric(length(x))
 for (i in 1:length(x)) p[i] - ((1/x[i]) + (1/y[i]) + (1/z[i]) +
(1/(x[i]*y[i]*z[i])))
 p
[1] 1 1 1 1 1 1
 for (i in 1:length(p)) if(p[i]==1) print(i)
[1] 4
[1] 6


I suppose there must exist some better way of accessing the position of
certain numbers in a large data output. So apart from getting advice on
that I would certainly also like to understand why the above only seems to
work in some cases.

Anders B Falk PhD
Uppsala Sweden

__
R-help@r-project.org 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] Positions in datasets

2009-12-27 Thread David Winsemius


On Dec 27, 2009, at 12:11 PM, Anders Falk wrote:


Could someone help me understand this

Basically I want to know the position of certain numbers in large  
output
data sets. First consider the following simple example where we get  
the

postions of ones (1) in the vector q.


q - c(5,1,1,3,1,1,1,1)
q

[1] 5 1 1 3 1 1 1 1

for (i in 1:length(q)) if(q[i]==1) print(i)

[1] 2
[1] 3
[1] 5
[1] 6
[1] 7
[1] 8

Well done!


But now consider the following case where the input consists of  
different
combinations of the three numbers 2, 3 and 7. They are put into a  
function
1/x +1/y +1/z +1/(x*y*z). All different combinations will yield the  
same

result namely precisely 1, which is also clearly seen in the output.
However when I try to get information on the position of the ones in  
the
output, there are only two that are recognized, although all six  
items in

the output are indeed ones.


x - c(2,2,3,3,7,7); y - c(3,7,2,7,2,3); z - c(7,3,7,2,3,2)
data.frame(x,y,z)

 x y z
1 2 3 7
2 2 7 3
3 3 2 7
4 3 7 2
5 7 2 3
6 7 3 2

p - numeric(length(x))
for (i in 1:length(x)) p[i] - ((1/x[i]) + (1/y[i]) + (1/z[i]) +

(1/(x[i]*y[i]*z[i])))

p

[1] 1 1 1 1 1 1

for (i in 1:length(p)) if(p[i]==1) print(i)

[1] 4
[1] 6


I suppose there must exist some better way of accessing the position  
of

certain numbers in a large data output.


data output is a bit vague, but if you are talking about vectors then:

?which


So apart from getting advice on
that I would certainly also like to understand why the above only  
seems to

work in some cases.


It's a FAQ, 7.31:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f

 for (i in 1:length(p)) if(all.equal(p[i],1)) print(i)
[1] 1
[1] 2
[1] 3
[1] 4
[1] 5
[1] 6


Anders B Falk PhD
Uppsala Sweden

__
R-help@r-project.org 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 Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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] RGtk2 / gWidgets - addHandlerClicked Problem

2009-12-27 Thread David Winsemius


On Dec 27, 2009, at 12:12 PM, Mark Heckmann wrote:


Hi David,

forgot to mention I use the RGtk2 GUI toolkit.

options(guiToolkit=RGtk2)

Under tcl I do not get this results neither. Under RGtk2 I do (Mac  
OS 10.6.1, R 2.10.0 32-bit).


Any ideas?


I don't have anything constructive to offer. Any time I try to run a  
package that depends on Gtk2+ I fail at some point in ways that seem  
to depend on compilation options or resources that I do not have  
correctly arranged in my libraries. My questions to the R-Mac-SIG list  
list seem to be taken as evidence of irremediable *NIX cluelessness.  
So I have decided to spend my time on other, more productive pursuits.


--
David



TIA!
Mark


Am 27.12.2009 um 18:05 schrieb David Winsemius:



On Dec 27, 2009, at 11:29 AM, Mark Heckmann wrote:

In The following code, the table handler is executed twice when  
the button is pressed (from the 2nd pressing on).


Can't reproduce. On a Mac 10.5.8, R 2.10.1, running the 64 bit GUI,  
after choosing the gWidgetstcltk option for GUI toolkit when  
gwindow() is first executed, I do not get a behavior that suggests  
that the table handler gets executed twice with each button click.  
I get an X11 window with a button across the width of the top of  
the window. Each time the button is clicked I get :


addhandlerclicked button
addhandlerclicked table

Just for fun I modified your tbl handler and got sensible  
incrementing highlighting of the rows with:

 addhandlerclicked(b, handler=function(h, ...){
+   cat(addhandlerclicked button\n)
+ 	svalue(tbl, index=T) - 1+svalue(tbl)	# the earlier code did not  
change values

+ })


I want it to be executed only once. Does someone know, why this  
happens and how I can change it?


library(gWidgets)

w - gwindow()
b - gbutton(press, cont=w)
tbl - gtable(1:10, cont=w)

addhandlerclicked(b, handler=function(h, ...){
cat(addhandlerclicked button\n)
svalue(tbl, index=T) - 1# change the table 
value
})
addhandlerclicked(tbl, handler=function(h, ...){
cat(addhandlerclicked table\n)
})

Thanks!
Mark

--

David Winsemius, MD
Heritage Laboratories
West Hartford, CT


–––
Mark Heckmann
Dipl. Wirt.-Ing. cand. Psych.
Vorstraße 93 B01
28359 Bremen
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com






David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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] Make the output (from a Loop function) a Vector

2009-12-27 Thread Uwe Ligges



David Winsemius wrote:


On Dec 27, 2009, at 11:17 AM, Cat Morning wrote:


Hi all,

I have made a loop function which prints outputs. For example:

 for (i in 1:5)
+ print(i)
[1] 1
[1] 2
[1] 3
[1] 4
[1] 5

However, I would like the output to given as a list or a vector, e..g 
c(1,2,3,4,5). Is it possible to do this?


This does suggest that you need to do some more studying of whatever 
text you are using to learn R:


  v - c()
  for (i in 1:5) v - c(v,i)
  v
[1] 1 2 3 4 5

Or if you wanted to see the results with each iteration:
  v - c()
  for (i in 1:5) print(v - c(v,i))
[1] 1
[1] 1 2
[1] 1 2 3
[1] 1 2 3 4
[1] 1 2 3 4 5


(The function I am using outputs many 1000s of results, so is not easy 
to change to a vector manually.)



Completely right, but just for completeness let me add that the loop is 
slow using your allocation method (add more memory to v in each 
iteration), better allocate the whole vector v at first as in:


v - numeric(5)
for (i in 1:5) print(v[i] - i)

well, given your really need a loop ...

Best,
Uwe Ligges







So you probably would not want the print() version.

Many Thanks.

[[alternative HTML version deleted]]


Set your mail-client up to send plain-text.

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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@r-project.org 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] Positions in datasets

2009-12-27 Thread Uwe Ligges



David Winsemius wrote:


On Dec 27, 2009, at 12:11 PM, Anders Falk wrote:


Could someone help me understand this

Basically I want to know the position of certain numbers in large output
data sets. First consider the following simple example where we get the
postions of ones (1) in the vector q.


q - c(5,1,1,3,1,1,1,1)
q

[1] 5 1 1 3 1 1 1 1

for (i in 1:length(q)) if(q[i]==1) print(i)

[1] 2
[1] 3
[1] 5
[1] 6
[1] 7
[1] 8

Well done!


But now consider the following case where the input consists of different
combinations of the three numbers 2, 3 and 7. They are put into a 
function

1/x +1/y +1/z +1/(x*y*z). All different combinations will yield the same
result namely precisely 1, which is also clearly seen in the output.
However when I try to get information on the position of the ones in the
output, there are only two that are recognized, although all six items in
the output are indeed ones.


x - c(2,2,3,3,7,7); y - c(3,7,2,7,2,3); z - c(7,3,7,2,3,2)
data.frame(x,y,z)

 x y z
1 2 3 7
2 2 7 3
3 3 2 7
4 3 7 2
5 7 2 3
6 7 3 2

p - numeric(length(x))
for (i in 1:length(x)) p[i] - ((1/x[i]) + (1/y[i]) + (1/z[i]) +

(1/(x[i]*y[i]*z[i])))

p

[1] 1 1 1 1 1 1

for (i in 1:length(p)) if(p[i]==1) print(i)

[1] 4
[1] 6


I suppose there must exist some better way of accessing the position of
certain numbers in a large data output.


data output is a bit vague, but if you are talking about vectors then:

?which


So apart from getting advice on
that I would certainly also like to understand why the above only 
seems to

work in some cases.


It's a FAQ, 7.31:
http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f 



  for (i in 1:length(p)) if(all.equal(p[i],1)) print(i)
[1] 1
[1] 2
[1] 3
[1] 4
[1] 5
[1] 6




Completely right, but just for completeness let me add that you do never 
want to say 1:length(p) in your code, because it might happen that p 
becomes empty and your loop will iterate over 1:0, hence better always 
(then you'll never run into that problem) use seq_along as in:


for (i in seq_along(p)) if(all.equal(p[i],1)) print(i)

Best,
Uwe Ligges



Anders B Falk PhD
Uppsala Sweden

__
R-help@r-project.org 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 Winsemius, MD
Heritage Laboratories
West Hartford, CT

__
R-help@r-project.org 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@r-project.org 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 create a simple loop ?

2009-12-27 Thread John Kane
An alternative approach (clumsy  but probably not as clumsy as a loop) would be 
to create a sixth column as a factor and aggregate on that. Simple-minded 
example :
===
mydata  - data.frame(matrix(rnorm(100),nrow=20))
mydata[,6] - c(rep(a,5),rep(b,20-10),rep(c,5))
aggregate(mydata[,5], by=list(mydata[,6]), mean)



Set all the unwanted values to X and subset on that before calculating.
--- On Sun, 12/27/09, Edouard Tallent tallen...@lycos.com wrote:

 From: Edouard Tallent tallen...@lycos.com
 Subject: [R] how to create a simple loop ?
 To: r-help@r-project.org
 Received: Sunday, December 27, 2009, 9:15 AM
 Hi everyone. And, Merry Xmas !
 I have a 5-row matrix called “data”. There are
 headers.
 it look like this :
 Row 1   Row2    Row3   
 Row4    Row5
 Line1     …     
       …         
   …            …
 Line2     …     
       …         
   …            …
 Line3     …     
       …         
   …            …
 …
 Line 1838         
    …         
   …           
 …            …
  I want to calculate several simple arithmetic means for
 Row5, that is from Line173 to Line193, from Line434 to
 Line455, from Line699 to Line724, from Line955 to Line977
  A simple way is to individually compute these means. The
 first one (Line173 to Line193) is then obtained by :
 mean(data[173:193,5], na.rm = TRUE)
 That’s right ! But, I aim to automate this calculation by
 creating a loop.
 I tried many things, but I have been unsuccessful at using
 the ‘for’ loop function.
 Please, don’t explain things too hard as it is often the
 case that people wants to help but gets into too much
 sophistication.
 Someone can write that little code for this example ? Or
 suggest functions ?
 Thanks for your help.
 Cheers,
 Édouard.
 
     [[alternative(swapped) HTML version
 deleted]]
 
 This is MIME Epilogue
 
 
 -Inline Attachment Follows-
 
 __
 R-help@r-project.org
 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.
 


  __
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/

__
R-help@r-project.org 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 create a simple loop ?

2009-12-27 Thread jim holtman
try this:

 mydata - matrix(runif(5000),ncol=5)
 indices - list(c(173, 193),
+ c(434, 455),
+ c(699, 724),
+ c(955, 977))
 result - lapply(indices, function(.indx){
+ mean(mydata[.indx[1]:.indx[2], 5])
+ })


 result
[[1]]
[1] 0.5364535
[[2]]
[1] 0.4080824
[[3]]
[1] 0.5109079
[[4]]
[1] 0.4392921



On Sun, Dec 27, 2009 at 9:14 AM, Edouard Tallent tallen...@lycos.comwrote:

 I have a 5-row matrix called “data”. There are headers.
 it look like this :
 Row 1   Row2Row3Row4Row5
 Line1 …………
 Line2 …………
 Line3 …………
 …
 Line 1838 …………
  I want to calculate several simple arithmetic means for Row5, that is from
 Line173 to Line193, from Line434 to Line455, from Line699 to Line724, from
 Line955 to Line977
  A simple way is to individually compute these means. The first one
 (Line173 to Line193) is then obtained by :
 mean(data[173:193,5], na.rm = TRUE)
 That’s right ! But, I aim to automate this calculation by creating a loop.
 I tried many things, but I have been unsuccessful at using the ‘for’ loop
 function.
 Please, don’t explain things too hard as it is often the case that people
 wants to help but gets into too much sophistication.
 Someone can write that little code for this example ? Or suggest functions
 ?
 Thanks for your help.
 Cheers,
 Édouard.

[[alternative(swapped) HTML version deleted]]

 This is MIME Epilogue


 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.htmlhttp://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 that you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Building static HTML help pages in R 2.10.x on Windows

2009-12-27 Thread Uwe Ligges



Heinz Tuechler wrote:

Instead of an answer, may I add question

c) can someone state that it is impossible to generate static HTML help 
pages under Windows?


No, it is not impossible, see my answers below.



At 21:40 22.12.2009, Steve Rowley wrote:

I upgraded to R2.10.1pat and discovered, along with everybody else,
that static HTML pages are no longer the default.  Fine; my tastes
would go the other way, but I'm happy to adapt.

However, I'd still like to build static HTML pages (for stable
bookmarking, use when R is not running, etc.).

I'm using the Windows installer, so the advice in the R Installation 
Admin guide (section 2.2, Help options) to use the configure option
--enable-prebuilt-html doesn't seem to apply.  I'm using
install.packages() rather than R CMD INSTALL, so I don't quite
understand how the --html arg to R CMD INSTALL can apply either.

So, can anybody point me to an example of either:

(a) how to build the static HTML help pages of all currently
installed packages under Windows,


At least two ways:

Way 1: reinstall all those packages from sources using
  R CMD INSTALL --html

Way 2: go to the man directory of a source package and apply
  R CMD Rdconv --type=html *.Rd
to all Rd files.



or, failing that

(b) how to do this on Windows ab initio, from a clean install?


install the packages from sources as described in (a) Way 1 rather than 
the prebuilt binaries from CRAN.



Best wishes,
Uwe Ligges





Thanks!
--
Steve Rowley s...@alum.mit.edu http://alum.mit.edu/www/sgr/

__
R-help@r-project.org 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@r-project.org 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@r-project.org 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] Scaling error

2009-12-27 Thread Muhammad Rahiz

Hi useRs,

I ran into an inconsistent output problem again. Here is the simplify 
illustration


I've got a matrix as follows

 x
   V1V2   V3
[1,]   1  2 3
[2,]   4  5 6
[3,]   7  8 9

Associated with the matrix is a scaling factor, sca, derived from, say 
the mean of the respective columns, V1-V3;


 sca
   V1V2   V3
   2.5   1.7   3.6

The idea is that the scaling factor gets applied to each element in the 
column matrix. So


 out - x / sca

would give me

V1V2 V3
1 *2.5   2 *1.7   3 *3.6
4 *2.5   5 *1.7   6 *3.6
7 *2.5   8 *1.7   9 *3.6

But what actually happen is this,

V1V2 V3
1 *2.5   2 *2.5   3 *2.5
4 *1.7   5 *1.7   6 *1.7
7 *3.6   8 *3.6   9 *3.6

I can do the following;

 x[,1] / sca[1]
 x[,2] / sca[2]

which is OK for a set of test data but not for my actual dataset.

At the moment, I'm thinking of something in the lines of a for loop 
function i.e.


for (i in ...){
statement...
}

Is there a syntax in the for loop that allows me to select the 
column/row in the file?


Thanks.

--
Muhammad Rahiz  |  Doctoral Student in Regional Climate Modeling

Climate Research Laboratory, School of Geography  the Environment  
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom 
Tel: +44 (0)1865-285194	 Mobile: +44 (0)7854-625974

Email: muhammad.ra...@ouce.ox.ac.uk

__
R-help@r-project.org 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] Building static HTML help pages in R 2.10.x on Windows

2009-12-27 Thread Jonathan Baron
Slightly (but not completely) irrelevant comment.  The next version of
the R rpm packaged by Fedora WILL include static web pages by default
(so I'm told by Tom [Spot] Callaway).  This also goes for the R
packages that they package as RPMs.

This is irrelevant for Windows users of course, but others might be
following this thread.

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

__
R-help@r-project.org 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] Scaling error

2009-12-27 Thread Daniel Malter
If  out  is what you want to achieve, why don't you multiply sca (called
m below) with the transpose of x and then transpose the resulting
matrix?

x=c(1,2,3,4,5,6,7,8,9)
dim(x)=c(3,3)
x=t(x)

x
m=c(2.5,1.7,3.6)

x*m #returns what you don't want

t(t(x)*m) #returns what you want

HTH
Daniel

-
cuncta stricte discussurus
-
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Muhammad Rahiz
Sent: Sunday, December 27, 2009 2:27 PM
To: r-help@r-project.org
Subject: [R] Scaling error

Hi useRs,

I ran into an inconsistent output problem again. Here is the simplify 
illustration

I've got a matrix as follows

  x
V1V2   V3
[1,]   1  2 3
[2,]   4  5 6
[3,]   7  8 9

Associated with the matrix is a scaling factor, sca, derived from, say 
the mean of the respective columns, V1-V3;

  sca
V1V2   V3
2.5   1.7   3.6

The idea is that the scaling factor gets applied to each element in the 
column matrix. So

  out - x / sca

would give me

V1V2 V3
1 *2.5   2 *1.7   3 *3.6
4 *2.5   5 *1.7   6 *3.6
7 *2.5   8 *1.7   9 *3.6

But what actually happen is this,

V1V2 V3
1 *2.5   2 *2.5   3 *2.5
4 *1.7   5 *1.7   6 *1.7
7 *3.6   8 *3.6   9 *3.6

I can do the following;

 x[,1] / sca[1]
 x[,2] / sca[2]

which is OK for a set of test data but not for my actual dataset.

At the moment, I'm thinking of something in the lines of a for loop 
function i.e.

for (i in ...){
statement...
}

Is there a syntax in the for loop that allows me to select the 
column/row in the file?

Thanks.

-- 
Muhammad Rahiz  |  Doctoral Student in Regional Climate Modeling

Climate Research Laboratory, School of Geography  the Environment  
Oxford University Centre for the Environment
South Parks Road, Oxford, OX1 3QY, United Kingdom 
Tel: +44 (0)1865-285194  Mobile: +44 (0)7854-625974
Email: muhammad.ra...@ouce.ox.ac.uk

__
R-help@r-project.org 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@r-project.org 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] very beginner's question

2009-12-27 Thread Facetious Nickname

Begging the list's indulgence, an extremely dumb beginner's question.  I've got 
24 months' worth of numbers - ranging from 2 events per month, to 66 events per 
month.  I want to take a stab at making a reasonable guess as to what the next 
year's data would be, approximately, i.e., based on the 24 months I've got, I 
want to be able to tell someone: the 12 months after this will probably 
average about $number of events per month.  Assuming I'm able to navigate R 
with a minimum degree of proficiency, where would I start with this?  As you 
can doubtless tell, I'm not looking for anything sophisticated - just a 
reasonable estimate.  Am I going to be able to do better than a projected 
per-month guess based on $total/$number_of_months?

Thanks very much -
  
_
Hotmail: Trusted email with powerful SPAM protection.

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] very beginner's question

2009-12-27 Thread Gabor Grothendieck
See ?ets in the forecast package.


On Sun, Dec 27, 2009 at 2:51 PM, Facetious Nickname
facetious_nickn...@hotmail.com wrote:

 Begging the list's indulgence, an extremely dumb beginner's question.  I've 
 got 24 months' worth of numbers - ranging from 2 events per month, to 66 
 events per month.  I want to take a stab at making a reasonable guess as to 
 what the next year's data would be, approximately, i.e., based on the 24 
 months I've got, I want to be able to tell someone: the 12 months after this 
 will probably average about $number of events per month.  Assuming I'm able 
 to navigate R with a minimum degree of proficiency, where would I start with 
 this?  As you can doubtless tell, I'm not looking for anything sophisticated 
 - just a reasonable estimate.  Am I going to be able to do better than a 
 projected per-month guess based on $total/$number_of_months?

 Thanks very much -

 _
 Hotmail: Trusted email with powerful SPAM protection.

        [[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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] Scaling error

2009-12-27 Thread baptiste auguie
Hi,

Try this,

x - matrix(1:9, ncol=3, byrow=T)

sca - c(2.5, 1.7, 3.6)

x %*% diag(1/sca)


HTH,

baptiste

2009/12/27 Muhammad Rahiz muhammad.ra...@ouce.ox.ac.uk:
 Hi useRs,

 I ran into an inconsistent output problem again. Here is the simplify
 illustration

 I've got a matrix as follows

 x
       V1    V2   V3
 [1,]   1      2     3
 [2,]   4      5     6
 [3,]   7      8     9

 Associated with the matrix is a scaling factor, sca, derived from, say the
 mean of the respective columns, V1-V3;

 sca
       V1    V2   V3
       2.5   1.7   3.6

 The idea is that the scaling factor gets applied to each element in the
 column matrix. So

 out - x / sca

 would give me

 V1            V2             V3
 1 *2.5       2 *1.7       3 *3.6
 4 *2.5       5 *1.7       6 *3.6
 7 *2.5       8 *1.7       9 *3.6

 But what actually happen is this,

 V1            V2             V3
 1 *2.5       2 *2.5       3 *2.5
 4 *1.7       5 *1.7       6 *1.7
 7 *3.6       8 *3.6       9 *3.6

 I can do the following;

  x[,1] / sca[1]
  x[,2] / sca[2]

 which is OK for a set of test data but not for my actual dataset.

 At the moment, I'm thinking of something in the lines of a for loop function
 i.e.

 for (i in ...){
 statement...
 }

 Is there a syntax in the for loop that allows me to select the column/row in
 the file?

 Thanks.

 --
 Muhammad Rahiz  |  Doctoral Student in Regional Climate Modeling

 Climate Research Laboratory, School of Geography  the Environment
 Oxford University Centre for the Environment
 South Parks Road, Oxford, OX1 3QY, United Kingdom Tel: +44 (0)1865-285194
  Mobile: +44 (0)7854-625974
 Email: muhammad.ra...@ouce.ox.ac.uk

 __
 R-help@r-project.org 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@r-project.org 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] Positions in datasets

2009-12-27 Thread Anders Falk
Thank you both for your excellent help.

Best Regards, Anders Falk




 David Winsemius wrote:

 On Dec 27, 2009, at 12:11 PM, Anders Falk wrote:

 Could someone help me understand this

 Basically I want to know the position of certain numbers in large
 output
 data sets. First consider the following simple example where we get the
 postions of ones (1) in the vector q.

 q - c(5,1,1,3,1,1,1,1)
 q
 [1] 5 1 1 3 1 1 1 1
 for (i in 1:length(q)) if(q[i]==1) print(i)
 [1] 2
 [1] 3
 [1] 5
 [1] 6
 [1] 7
 [1] 8

 Well done!


 But now consider the following case where the input consists of
 different
 combinations of the three numbers 2, 3 and 7. They are put into a
 function
 1/x +1/y +1/z +1/(x*y*z). All different combinations will yield the
 same
 result namely precisely 1, which is also clearly seen in the output.
 However when I try to get information on the position of the ones in
 the
 output, there are only two that are recognized, although all six items
 in
 the output are indeed ones.

 x - c(2,2,3,3,7,7); y - c(3,7,2,7,2,3); z - c(7,3,7,2,3,2)
 data.frame(x,y,z)
  x y z
 1 2 3 7
 2 2 7 3
 3 3 2 7
 4 3 7 2
 5 7 2 3
 6 7 3 2
 p - numeric(length(x))
 for (i in 1:length(x)) p[i] - ((1/x[i]) + (1/y[i]) + (1/z[i]) +
 (1/(x[i]*y[i]*z[i])))
 p
 [1] 1 1 1 1 1 1
 for (i in 1:length(p)) if(p[i]==1) print(i)
 [1] 4
 [1] 6


 I suppose there must exist some better way of accessing the position of
 certain numbers in a large data output.

 data output is a bit vague, but if you are talking about vectors then:

 ?which

 So apart from getting advice on
 that I would certainly also like to understand why the above only
 seems to
 work in some cases.

 It's a FAQ, 7.31:
 http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f


   for (i in 1:length(p)) if(all.equal(p[i],1)) print(i)
 [1] 1
 [1] 2
 [1] 3
 [1] 4
 [1] 5
 [1] 6



 Completely right, but just for completeness let me add that you do never
 want to say 1:length(p) in your code, because it might happen that p
 becomes empty and your loop will iterate over 1:0, hence better always
 (then you'll never run into that problem) use seq_along as in:

 for (i in seq_along(p)) if(all.equal(p[i],1)) print(i)

 Best,
 Uwe Ligges


 Anders B Falk PhD
 Uppsala Sweden

 __
 R-help@r-project.org 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 Winsemius, MD
 Heritage Laboratories
 West Hartford, CT

 __
 R-help@r-project.org 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.



Anders Falk

Mobil: 0707-913910
email: anders.f...@vbsg.slu.se

__
R-help@r-project.org 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] Building static HTML help pages in R 2.10.x on Windows

2009-12-27 Thread Steve Rowley
Heinz Tuechler wrote:
 At 21:40 22.12.2009, Steve Rowley wrote:
 (a) how to build the static HTML help pages of all currently
 installed packages under Windows, [...]

At least two ways:

Way 1: reinstall all those packages from sources using
   R CMD INSTALL --html

Way 2: go to the man directory of a source package and apply
   R CMD Rdconv --type=html *.Rd
to all Rd files.

Ok, thanks.  That's starting along a helpful path.

The first way sounds dicey on Windows, since some of the packages require tools 
that I
probably have installed (e.g., as part of Cygwin), but have never thought about 
how to
hook together.

The second way sounds useful if I want to download the source for all the 
packages in
addition to the binary installers that I already have.

Is there any way to do this from the Windows binary .zip files, or from the 
installations
generated thereby?  After all, R generates the HTML on the fly somehow, so the 
information
is present; IWBNI there were a way to use that to generate the static HTML.  
(Looking
through the installation dirs doesn't show very many .Rd files.)
-- 
Steve Rowley s...@alum.mit.edu http://alum.mit.edu/www/sgr/

__
R-help@r-project.org 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] Is SEM package of R suitable for sem analysis

2009-12-27 Thread Yihui Xie
Well, I guess it will be extremely difficult to persuade your teacher
to use the sem package in R. AFAIK, AMOS and LISREL have become the
golden standard for SEM in China, and SEM has become a golden model
for analysis in social science and psychology. I have been a cynic to
SEM for a long time, because I strongly believe this model has been
completely abused, and perhaps the easy-to-use AMOS has been helping
people abuse SEM. A common phenomenon I see is, people do not care
about the model at all - all they care about is whether AMOS can
successfully compute the coefficients; if AMOS failed, they will try
to (randomly) set constraints to the model, i.e. add/remove this
arrow, drag some variables into/out of the model, set this
coefficient/variance to 1.

Anyway, I encourage you to ask your teacher why AMOS is more
suitable. I have a couple of very ridiculous stories about the SEM
software, in which I can only feel the blind faith in software.
Sigh...

The good thing is, R is open source, so is the sem package. You can
see everything in it, and you can extend it as you wish (in case your
teacher think it is less suitable).

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-6609 Web: http://yihui.name
Department of Statistics, Iowa State University
3211 Snedecor Hall, Ames, IA



On Sat, Dec 26, 2009 at 8:26 PM, Reeyarn_李智洋_10928113 reey...@gmail.com wrote:
 Dear Bruno and Joe,

 Thanks for advising!


 Reeyarn

 On Sat, Dec 26, 2009 at 9:32 PM, Bruno Falissard falissar...@wanadoo.fr 
 wrote:

 A few years ago it could have been true, but now the package has improved
 (especially with the bootstrap procedure).
 At the moment there is no argument to recommend AMOS.

 On Sun, Dec 27, 2009 at 12:30 AM, Joe King j...@joepking.com wrote:

 I am going to take SEM this next quarter in my doctoral program. My
 suggestion is to use the program your professor suggests and try to
 re-create your models in R using the SEM package.

 __
 R-help@r-project.org 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@r-project.org 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] inquiry

2009-12-27 Thread Jose Betancourt Betancourt
Dear John P. Burkett

I would appreciate you to send me some scripts to run DEA with 20 similar DMU

Best regards

Betancourt



--

Este mensaje le ha llegado mediante el servicio de correo electronico 
que ofrece Infomed para respaldar el cumplimiento de las misiones del Sistem
a Nacional de Salud. La persona que envia este correo asume el compromiso de
 usar el servicio a tales fines y cumplir con las regulaciones establecidas


Infomed: http://www.sld.cu/



[[alternative HTML version deleted]]

__
R-help@r-project.org 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] RGtk2 / gWidgets - addHandlerClicked Problem

2009-12-27 Thread Mark Heckmann
Hi David,

forgot to mention I use the RGtk2 GUI toolkit.

options(guiToolkit=RGtk2)

Under tcl I do not get this results neither. Under RGtk2 I do (Mac OS  
10.6.1, R 2.10.0 32-bit).

Any ideas?

TIA!
Mark


Am 27.12.2009 um 18:05 schrieb David Winsemius:


 On Dec 27, 2009, at 11:29 AM, Mark Heckmann wrote:

 In The following code, the table handler is executed twice when the  
 button is pressed (from the 2nd pressing on).

 Can't reproduce. On a Mac 10.5.8, R 2.10.1, running the 64 bit GUI,  
 after choosing the gWidgetstcltk option for GUI toolkit when gwindow 
 () is first executed, I do not get a behavior that suggests that the  
 table handler gets executed twice with each button click. I get an  
 X11 window with a button across the width of the top of the window.  
 Each time the button is clicked I get :
 
 addhandlerclicked button
 addhandlerclicked table

 Just for fun I modified your tbl handler and got sensible  
 incrementing highlighting of the rows with:
  addhandlerclicked(b, handler=function(h, ...){
 + cat(addhandlerclicked button\n)
 + svalue(tbl, index=T) - 1+svalue(tbl)   # the earlier code did not  
 change values
 + })


 I want it to be executed only once. Does someone know, why this  
 happens and how I can change it?

 library(gWidgets)

 w - gwindow()
 b - gbutton(press, cont=w)
 tbl - gtable(1:10, cont=w)

 addhandlerclicked(b, handler=function(h, ...){
  cat(addhandlerclicked button\n)
  svalue(tbl, index=T) - 1   # change the 
 table value
 })
 addhandlerclicked(tbl, handler=function(h, ...){
  cat(addhandlerclicked table\n)
 })

 Thanks!
 Mark
 --

 David Winsemius, MD
 Heritage Laboratories
 West Hartford, CT

–––
Mark Heckmann
Dipl. Wirt.-Ing. cand. Psych.
Vorstraße 93 B01
28359 Bremen
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com





[[alternative HTML version deleted]]

__
R-help@r-project.org 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: creating a unified histogram

2009-12-27 Thread Yael Yohai
Good evening,

I would like to put the histograms of several matrices on the same graph,
together on a unified histogram (instead of having one bar per value on the
x-axis, have multiple bars: one representing each matrix, with different
colored bars for example to distinguish between the matrices). I couldn't
find a function doing that involving hist,  plot nor other plotting
functions. Is there a function which does this?

Thank you,

Yael Yohai
(Bioinformatics research)

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] gWidgets / RGtk2 - how to change a handler from a toolbar?

2009-12-27 Thread Mark Heckmann


I want to assign a default handler to a toolbar button and change the  
handler later.
The addhandlerclicked() method does not apply to a gAction Object, I  
think...


defHandler - function(h, ...) print(default)
w - gwindow()   
aTest -  gaction(label=Test, icon=open, handler=defHandler)
tblList = list( test = aTest )
toolBar = gtoolbar(tblList, cont=w)

At this point I would like to change the handler from the aTest object.
Does someone know?

TIA
Mark

–––
Mark Heckmann
Dipl. Wirt.-Ing. cand. Psych.
Vorstraße 93 B01
28359 Bremen
Blog: www.markheckmann.de
R-Blog: http://ryouready.wordpress.com

__
R-help@r-project.org 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 and Finance - EAD, LGD, PD

2009-12-27 Thread Ricardo Gonçalves Silva
Hi,

I'm currently beginning to use R for financial analysis (mainly Basel II 
benchmarks) and I would like to know if any R-User can give me some initial 
directions on packages and tutorials which I can use to calculate capital 
requirements, default probabilities, and related stuff.

Thanks in advance,

Rick
[[alternative HTML version deleted]]

__
R-help@r-project.org 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] R and Finance - EAD, LGD, PD

2009-12-27 Thread Cedrick W. Johnson

Howdy-

You may want to check out the R-sig-finance list and search through the 
postings here:

http://n4.nabble.com/Rmetrics-f925806.html

There's quite a few packages in the CRAN taskviews as well:

http://cran.r-project.org/web/views/Finance.html

-cj


Ricardo Gonçalves Silva wrote:

Hi,

I'm currently beginning to use R for financial analysis (mainly Basel II 
benchmarks) and I would like to know if any R-User can give me some initial 
directions on packages and tutorials which I can use to calculate capital 
requirements, default probabilities, and related stuff.

Thanks in advance,

Rick
[[alternative HTML version deleted]]

__
R-help@r-project.org 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@r-project.org 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] help: creating a unified histogram

2009-12-27 Thread milton ruser
Hi Yael,

Have you tried to find it on google R graph gallery ?

bests

milton

On Sun, Dec 27, 2009 at 2:45 PM, Yael Yohai yael.yo...@gmail.com wrote:

 Good evening,

 I would like to put the histograms of several matrices on the same graph,
 together on a unified histogram (instead of having one bar per value on the
 x-axis, have multiple bars: one representing each matrix, with different
 colored bars for example to distinguish between the matrices). I couldn't
 find a function doing that involving hist,  plot nor other plotting
 functions. Is there a function which does this?

 Thank you,

 Yael Yohai
 (Bioinformatics research)

[[alternative HTML version deleted]]

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


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] problems in building R with libpng/cairo/jpeg

2009-12-27 Thread Yihui Xie
Hi,

I'm installing R 2.10.1 under Linux but I don't know why my
installation does not support png/cairo/jpeg:

 capabilities()
jpeg  png tifftcltk  X11 aqua http/ftp  sockets
   FALSEFALSEFALSEFALSEFALSEFALSE TRUE TRUE
  libxml fifo   clediticonv  NLS  profmemcairo
TRUE TRUE TRUE TRUE TRUEFALSEFALSE

Here is some system information:

*...@*** [~]# uname -srvmo
Linux 2.6.28-10.7.intel.IGB.BHsmp #1 SMP Thu Aug 13 21:52:24 MDT 2009
x86_64 GNU/Linux

*...@*** [~]# rpm -qa | grep -E 'libpng|cairo|pango|libjpeg'
libjpeg-devel-6b-37
libjpeg-6b-37
pycairo-1.2.0-1.1
libpng-devel-1.2.10-7.1.el5_3.2
pango-1.14.9-6.el5.centos
cairo-1.2.4-5.el5
libjpeg-devel-6b-37
libpng-1.2.10-7.1.el5_3.2
libpng-1.2.10-7.1.el5_3.2
pango-1.14.9-6.el5.centos
cairo-devel-1.2.4-5.el5
pango-devel-1.14.9-6.el5.centos
cairo-1.2.4-5.el5
libjpeg-6b-37
libpng-devel-1.2.10-7.1.el5_3.2

It seems that all necessary libraries have been installed, and the
configure script can find libpng and jpeglib but cannot find pango and
cairo (even using --with-cairo):

*...@*** [~/etc/R]# ./configure --prefix=$HOME/bin/R
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
loading site script './config.site'
loading build-specific script './config.site'


checking whether pkg-config knows about cairo and pango... no
checking whether pkg-config knows about cairo... no


checking if jpeglib version = 6b... yes
checking for jpeg_destroy_compress in -ljpeg... yes
checking for main in -lz... yes
checking if libpng version = 1.0.5... yes
checking for png_create_write_struct in -lpng... yes


R is now configured for x86_64-unknown-linux-gnu

  Source directory:  .
  Installation directory:/***/bin/R

  C compiler:gcc -std=gnu99  -g -O2
  Fortran 77 compiler:   gfortran  -g -O

  C++ compiler:  g++  -g -O2
  Fortran 90/95 compiler:gfortran -g -O
  Obj-C compiler:

  Interfaces supported:  X11
  External libraries:readline
  Additional capabilities:   PNG, JPEG, TIFF, NLS
  Options enabled:   shared BLAS, R profiling, Java

  Recommended packages:  yes

configure: WARNING: you cannot build DVI versions of the R manuals
configure: WARNING: you cannot build DVI versions of all the help pages
configure: WARNING: you cannot build PDF versions of the R manuals
configure: WARNING: you cannot build PDF versions of all the help pages

After I make  make install, jpeg, png and cairo are not supported.
I'm a Linux novice. Any hints for my installation? Thanks!

Regards,
Yihui
--
Yihui Xie xieyi...@gmail.com
Phone: 515-294-6609 Web: http://yihui.name
Department of Statistics, Iowa State University
3211 Snedecor Hall, Ames, IA

__
R-help@r-project.org 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] help: creating a unified histogram

2009-12-27 Thread jim holtman
Here is one way of doing it using the basic graphics:


# crate some data
x1 - rnorm(1,0,1)
x2 - rnorm(1,1,2)
# get data from histograms
bin.size - seq(-10,10,0.1)  # bin size - may sure it spans the range
h1 - hist(x1, plot=FALSE, breaks=bin.size)
h2 - hist(x2, plot=FALSE, breaks=bin.size)
# create a matrix for 'barplot'
# limit xlim=c(-3, 4)
my.lim - c(-3, 4)
data.mat - rbind(h1$counts[h1$mids  my.lim[1]  h1$mids  my.lim[2]],
  h2$counts[h2$mids  my.lim[1]  h2$mids  my.lim[2]])
z - barplot(data.mat, beside=TRUE, col=c('red', 'green'), space=c(0,0),
legend.text=c('x1', 'x2'))
# now create the axis using current setting of 'usr' and supplying
# your own values for x
my.ticks - seq(my.lim[1], my.lim[2], .5)
axis(1, at=approx(seq(my.lim[1], my.lim[2], length=ncol(z)), colMeans(z),
xout=my.ticks)$y,
labels=my.ticks)





On Sun, Dec 27, 2009 at 2:45 PM, Yael Yohai yael.yo...@gmail.com wrote:

 Good evening,

 I would like to put the histograms of several matrices on the same graph,
 together on a unified histogram (instead of having one bar per value on the
 x-axis, have multiple bars: one representing each matrix, with different
 colored bars for example to distinguish between the matrices). I couldn't
 find a function doing that involving hist,  plot nor other plotting
 functions. Is there a function which does this?

 Thank you,

 Yael Yohai
 (Bioinformatics research)

[[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.htmlhttp://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 that you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] R on amazon's EC2 cloud?

2009-12-27 Thread Carlos J. Gil Bellosta

Hello,

I tried Amazon EC2 with R recently and wrote an entry about it to a blog 
I collaborate with:


http://analisisydecision.es/probando-r-sobre-el-ec2-de-amazon/

(Unfortunately, it is in Spanish...)

Best regards,

Carlos J. Gil Bellosta
http://www.datanalytics.com


Blair Christian wrote:

Hi All,

I was wondering if anybody had experience running R on amazon's ec2
cloud?  More specifically, has anybody created an amazon machine
image (AMI) for use with it?  I was wondering if there was a quantian
type image available as an amazon machine image, maybe running debian
or ubuntu?   It supports open MPI among other libs which is nice.

It would be nice to put together a hardware optimized image that the
community could use (eg lapack with openmp blas support that kind of
thing), maybe a debian with no X installed, but including R + all
packages?

http://aws.amazon.com/ec2/#pricing

I'm at the point where it's almost easier/cost effective to outsource
the hardware...

I bring this up because I saw that they were going to start a spot
market for cycles- useful for things like MCMC chains that need lots
of runs...
http://bit.ly/8A2e1g

__
R-help@r-project.org 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@r-project.org 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] Scaling error

2009-12-27 Thread jim holtman
sweep(x, 2, m, FUN='/')

On Sun, Dec 27, 2009 at 2:26 PM, Muhammad Rahiz 
muhammad.ra...@ouce.ox.ac.uk wrote:

 Hi useRs,

 I ran into an inconsistent output problem again. Here is the simplify
 illustration

 I've got a matrix as follows

  x
   V1V2   V3
 [1,]   1  2 3
 [2,]   4  5 6
 [3,]   7  8 9

 Associated with the matrix is a scaling factor, sca, derived from, say the
 mean of the respective columns, V1-V3;

  sca
   V1V2   V3
   2.5   1.7   3.6

 The idea is that the scaling factor gets applied to each element in the
 column matrix. So

  out - x / sca

 would give me

 V1V2 V3
 1 *2.5   2 *1.7   3 *3.6
 4 *2.5   5 *1.7   6 *3.6
 7 *2.5   8 *1.7   9 *3.6

 But what actually happen is this,

 V1V2 V3
 1 *2.5   2 *2.5   3 *2.5
 4 *1.7   5 *1.7   6 *1.7
 7 *3.6   8 *3.6   9 *3.6

 I can do the following;

  x[,1] / sca[1]
  x[,2] / sca[2]

 which is OK for a set of test data but not for my actual dataset.

 At the moment, I'm thinking of something in the lines of a for loop
 function i.e.

 for (i in ...){
 statement...
 }

 Is there a syntax in the for loop that allows me to select the column/row
 in the file?

 Thanks.

 --
 Muhammad Rahiz  |  Doctoral Student in Regional Climate Modeling

 Climate Research Laboratory, School of Geography  the Environment
 Oxford University Centre for the Environment
 South Parks Road, Oxford, OX1 3QY, United Kingdom Tel: +44 (0)1865-285194
  Mobile: +44 (0)7854-625974
 Email: muhammad.ra...@ouce.ox.ac.uk


 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.htmlhttp://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 that you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] CRAN (and crantastic) updates this week

2009-12-27 Thread Crantastic
CRAN (and crantastic) updates this week

New packages


* batch (1.0-0)
  Thomas Hoffmann
  http://crantastic.org/packages/batch

  Functions to allow you to easily pass command-line arguments into R
  (primary use is linux), and functions to aid in submitting your R
  code in parallel on a cluster and joining the results afterward
  (e.g. multiple parameter values for simulations running in parallel,
  splitting up a permutation test in parallel, etc.). See
  `parseCommandArgs(...)' for the main example of how to use this
  package.

* bfast (1.1)
  Jan Verbesselt
  http://crantastic.org/packages/bfast

  BFAST integrates the decomposition of time series into trend,
  seasonal, and remainder components with methods for detecting and
  characterizing abrupt changes within the trend and seasonal
  components. BFAST can be used to analyze different types of
  satellite image time series and can be applied to other disciplines
  dealing with seasonal or non-seasonal time series, such as
  hydrology, climatology, and econometrics. The algorithm can be
  extended to label detected changes with information on the
  parameters of the fitted piecewise linear models.

* bibtex (0.1-3)
  Romain Francois
  http://crantastic.org/packages/bibtex

  Utility to parse a bibtex file

* BioStatR (1.0.0)
  Frederic Bertrand
  http://crantastic.org/packages/BioStatR

  This packages provides datasets for the book Exercices et problèmes
  de statistique avec le logiciel R.

* boolfun (0.2.1)
  Frederic Lafitte
  http://crantastic.org/packages/boolfun

  This package can be used to assess cryptographic properties of Boolean
  functions (such as nonlinearity, algebraic immunity, resiliency,
  ...).

* BoSSA (1.1)
  Pierre Lefeuvre
  http://crantastic.org/packages/BoSSA

  Sort sequence from genbank. Retrieve sequence information from genbank
  (designed for viruses sequences and retrieve information such as
  isolation dates and host). Detect group of sequences presenting
  phylogeography signal. Read PDB file (protein 3D structure file).

* CCP (0.1)
  Uwe Menzel to
  http://crantastic.org/packages/CCP

  Significance tests for canonical correlation analysis, including
  asymptotic tests and a Monte Carlo method

* cubature (1.0)
  Balasubramanian Narasimhan
  http://crantastic.org/packages/cubature

  Adaptive multivariate integration over hypercubes

* doMPI (0.1-3)
  Steve Weston
  http://crantastic.org/packages/doMPI

  Provides a parallel backend for the %dopar% function using the Rmpi
  package.

* GrassmannOptim (1.0)
  Kofi Placid Adragni
  http://crantastic.org/packages/GrassmannOptim

  Optimizing a function F(U), where U is a semi-orthogonal matrix and F
  is invariant under an orthogonal transformation of U

* heavy (0.1-1)
  Felipe Osorio
  http://crantastic.org/packages/heavy

  Estimation in linear mixed effects models using heavy-tailed
  distributions

* Imap (1.01)
  John R. Wallace
  http://crantastic.org/packages/Imap

  Zoom in and out of maps or any supplied lines or points, with control
  for color, poly fill, and aspect.

* openintro (1.0)
  David Diez
  http://crantastic.org/packages/openintro

  This package is intended to be a supplement to the Open Intro open
  source book project. This package contains data sets used in the
  book along with functions used to make the book's figures.

* r2dRue (1.0)
  Unknown
  http://crantastic.org/packages/r2dRue

  2dRUE is a methodology to make a diagnostic of land condition in a
  large territory during a given time period. Was developed under the
  DeSurvey IP.

* RcmdrPlugin.sos (0.1-0)
  Liviu Andronic
  http://crantastic.org/packages/RcmdrPlugin-sos

  Rcmdr interface to sos. The plug-in renders the sos searching
  functionality easily accessible via the Rcmdr menus. It also
  simplifies the task of performing multiple searches and subsequently
  obtaining the union or the intersection of the search results.

* rngWELL (0.9)
  Christophe Dutang
  http://crantastic.org/packages/rngWELL

  It is a dedicated package to WELL pseudo random generators. But it is
  not intended to use it directly, you are strongly __encouraged__ to
  directly use the 'randtoolbox' package, which depends on this
  package.

* SampleSizeMeans (1.0)
  Lawrence Joseph
  http://crantastic.org/packages/SampleSizeMeans

  A set of R functions for calculating sample size requirements using
  three different Bayesian criteria in the context of designing an
  experiment to estimate a normal mean or the difference between two
  normal means. Functions for calculation of required sample sizes for
  the Average Length Criterion, the Average Coverage Criterion and the
  Worst Outcome Criterion in the context of normal means are provided.
  Functions for both the fully Bayesian and the mixed
  Bayesian/likelihood approaches are provided.

* SampleSizeProportions (1.0)
  Lawrence Joseph
  http://crantastic.org/packages/SampleSizeProportions

  A set of R functions for calculating 

Re: [R] R and Finance - EAD, LGD, PD

2009-12-27 Thread Wensui Liu
i think rick's questions are more related to basel II instead of R and don't
think there is such a R package.
per my limited knowledge, there are many ways to calculate PD, EAD, and LGD,
either on portfolio level or on account level. So it really depends on how
you are going to estimate them. On the side of consumer credit risk, it
makes more sense to estimate 3 models on the account level, which should be
under the umbrella of GLM. While PD / LGD are well studied, EAD is not.
There are multiple ways to estimate EAD, such as LEQ/CCF/EADF, depending on
the characteristic of accounts.

2009/12/27 Cedrick W. Johnson cedr...@cedrickjohnson.com

 Howdy-

 You may want to check out the R-sig-finance list and search through the
 postings here:
 http://n4.nabble.com/Rmetrics-f925806.html

 There's quite a few packages in the CRAN taskviews as well:

 http://cran.r-project.org/web/views/Finance.html

 -cj



 Ricardo Gonçalves Silva wrote:

 Hi,

 I'm currently beginning to use R for financial analysis (mainly Basel II
 benchmarks) and I would like to know if any R-User can give me some initial
 directions on packages and tutorials which I can use to calculate capital
 requirements, default probabilities, and related stuff.

 Thanks in advance,

 Rick
[[alternative HTML version deleted]]

 __
 R-help@r-project.org 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@r-project.org 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.




-- 
==
WenSui Liu
Blog   : statcompute.spaces.live.com
Tough Times Never Last. But Tough People Do.  - Robert Schuller
==

[[alternative HTML version deleted]]

__
R-help@r-project.org 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] Lacunarity analisys using R

2009-12-27 Thread Jose Bustos Melo
Hi R-people, 

I have done spatial and geostatistics for some time and now I am interested in 
concentration indexes. There is one index named Lacunarity.  Is there any 
extension like that in R?

Thank you all, 
José Bustos




  
[[alternative HTML version deleted]]

__
R-help@r-project.org 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] gWidgets / RGtk2 - how to change a handler from a toolbar?

2009-12-27 Thread john verzani
Mark Heckmann mark.heckmann at gmx.de writes:

 
 
 I want to assign a default handler to a toolbar button and change the  
 handler later.
 The addhandlerclicked() method does not apply to a gAction Object, I  
 think...
 
 defHandler - function(h, ...) print(default)   
 w - gwindow()
 aTest -  gaction(label=Test, icon=open, handler=defHandler)
 tblList = list( test = aTest )
 toolBar = gtoolbar(tblList, cont=w)
 

There should be a method to do this, but for now there isn't. A workaround would
be to have the default handler call a function which can be redefined during the
flow of the program:

f - function(h,...) print(default)
defHandler - function(h, ...) f(h,...)

The RGtk2 way would be to remove the handler and add a new one, but even that
isn't so easy, as the id isn't stored at the moment.

--John

 At this point I would like to change the handler from the aTest object.
 Does someone know?
 
 TIA
 Mark
 
 –––
 Mark Heckmann
 Dipl. Wirt.-Ing. cand. Psych.
 Vorstraße 93 B01
 28359 Bremen
 Blog: www.markheckmann.de
 R-Blog: http://ryouready.wordpress.com
 


__
R-help@r-project.org 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] RGtk2 / gWidgets - addHandlerClicked Problem

2009-12-27 Thread john verzani
Mark Heckmann mark.heckmann at gmx.de writes:

 
 In The following code, the table handler is executed twice when the  
 button is pressed (from the 2nd pressing on).
 I want it to be executed only once. Does someone know, why this  
 happens and how I can change it?
 


.. snip ..

 Thanks!
 Mark
 

Mark, it is a bug in how svalue- updates the table, as it does it twice: once
to clear the selection and a second time to set the selection. I'll have to look
into this one to see what I can do.

--John

 –––
 Mark Heckmann
 Dipl. Wirt.-Ing. cand. Psych.
 Vorstraße 93 B01
 28359 Bremen
 Blog: www.markheckmann.de
 R-Blog: http://ryouready.wordpress.com
 


__
R-help@r-project.org 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] RGtk2 - retrieve ggraphics mouse coordinates during drag-and-drop event

2009-12-27 Thread john verzani
Mark Heckmann mark.heckmann at gmx.de writes:

 
 Hi all,
 
 I have a gtable and a ggraphic widget.
 I want to drag an element from the table onto the graphic.
 When the drag object is released over the ggraphic widget, I want the  
 mouse coordinates inside the ggraphic to be returned.
 Right now I do not know how to get the mouse ccordinates of the  
 ggraphic widget at any given time.
 How can I access the ggraphics mouse coordinates?
 

The handler has h$x and h$y components to do this. In your code 
(which I clipped to save space) you might
look at:


defHandlerTarget = function(h, ...){
theArgs - list(...)
w - theArgs[[1]]

allocation = w$GetAllocation()
## h$x, h$y give x,y coords for g
x = h$x/allocation$width
y = 1 - (allocation$height - h$y)/allocation$height
print(c(x,y))
}

If that doesn't help, let me know.

 Below you find my sample code (windows only due to ggraphics).
 

(The ggraphics widget works with linux and mac too, although the mac can have
issues with some installations.)


 TIA,
 Mark
 

..snip..

 –––
 Mark Heckmann
 Dipl. Wirt.-Ing. cand. Psych.
 Vorstraße 93 B01
 28359 Bremen
 Blog: www.markheckmann.de
 R-Blog: http://ryouready.wordpress.com
 


__
R-help@r-project.org 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] Is SEM package of R suitable for sem analysis

2009-12-27 Thread Wincent
I don't know the situation of psychology. In sociology, SEM is
regarded is advanced statistical technique, but I am not quite sure if
it is  golden model. Actually, SEM is not so common in journal papers.
It is not about R. Sorry for being off-topic.

Best

2009/12/28 Yihui Xie x...@yihui.name:
 Well, I guess it will be extremely difficult to persuade your teacher
 to use the sem package in R. AFAIK, AMOS and LISREL have become the
 golden standard for SEM in China, and SEM has become a golden model
 for analysis in social science and psychology. I have been a cynic to
 SEM for a long time, because I strongly believe this model has been
 completely abused, and perhaps the easy-to-use AMOS has been helping
 people abuse SEM. A common phenomenon I see is, people do not care
 about the model at all - all they care about is whether AMOS can
 successfully compute the coefficients; if AMOS failed, they will try
 to (randomly) set constraints to the model, i.e. add/remove this
 arrow, drag some variables into/out of the model, set this
 coefficient/variance to 1.

 Anyway, I encourage you to ask your teacher why AMOS is more
 suitable. I have a couple of very ridiculous stories about the SEM
 software, in which I can only feel the blind faith in software.
 Sigh...

 The good thing is, R is open source, so is the sem package. You can
 see everything in it, and you can extend it as you wish (in case your
 teacher think it is less suitable).

 Regards,
 Yihui
 --
 Yihui Xie xieyi...@gmail.com
 Phone: 515-294-6609 Web: http://yihui.name
 Department of Statistics, Iowa State University
 3211 Snedecor Hall, Ames, IA



 On Sat, Dec 26, 2009 at 8:26 PM, Reeyarn_李智洋_10928113 reey...@gmail.com 
 wrote:
 Dear Bruno and Joe,

 Thanks for advising!


 Reeyarn

 On Sat, Dec 26, 2009 at 9:32 PM, Bruno Falissard falissar...@wanadoo.fr 
 wrote:

 A few years ago it could have been true, but now the package has improved
 (especially with the bootstrap procedure).
 At the moment there is no argument to recommend AMOS.

 On Sun, Dec 27, 2009 at 12:30 AM, Joe King j...@joepking.com wrote:

 I am going to take SEM this next quarter in my doctoral program. My
 suggestion is to use the program your professor suggests and try to
 re-create your models in R using the SEM package.

 __
 R-help@r-project.org 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@r-project.org 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.




-- 
Wincent Ronggui HUANG
Doctoral Candidate
Dept of Public and Social Administration
City University of Hong Kong
http://asrr.r-forge.r-project.org/rghuang.html

__
R-help@r-project.org 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] Modified R Code

2009-12-27 Thread Maithili Shiva

Dear R helpers,
 
I have following input files. (Actually they are more than 10 rates but here i 
am considering only 2 rates to write my problem)
 
rate1.csv
min1    max1    min2  max2  min3   max3
1.051.30   1.30  1.65 1.65  1.99
 
rate2.csv
min1    max1    min2  max2  min3   max3
2.052.30   2.30  2.65 2.65  2.99
   
 
The simple R code I had used to read these files was as given below -
 
# OLD CODE
 
rates1 = read.csv('rate1.csv)
rates2 = read.csv('rate2.csv')
 
rate1_min1  = rates1$min1
rate1_max1 = rates1$max1
rate1_min2  = rates1$min2
rate1_max2 = rates1$max2
rate1_min3  = rates1$min3
rate1_max3 = rates1$max3
 
rate2_min1  = rates2$min1
rate2_max1 = rates2$max1
rate2_min2  = rates2$min2
rate2_max2 = rates2$max2
rate2_min3  = rates2$min3
rate2_max3 = rates2$max3
 
 
Since I am not aware how many rates I will be dealing with (it can be 2, 4, or 
10), hence I can't hardcode my input like I had defined above.
 
So with the guidance of R - help, I had rerwitten the input code as given below.
 
# NEW CODE
 
n = 2  # It gives me no of rates 
 
X = paste('rate', 1:n, '.csv', sep = ' ' )
 
# the output is rate1.csv   rate2.csv
 
newrate = lapply(X, read.csv)
 
# the output is as given below
 
newrate
 
[ [1] ] 
    min1 max1    min2  max2 min3   max3
1   1.05    1.30  1.301.65   1.65    1.99
 
[ [2] ]  
    min1 max1    min2  max2 min3   max3
1   2.05    2.30  2.302.65   2.65    2.99
 
## _
 
## PROBLEM
 
# PROBLEM - A
 
If I apply the command (As given in OLD CODE above)
 
rate1_min1  = rates1$min1
# The output which I get is  
    min1 
1  1.05
 
On similar lines I define
 
rate1_min1 = newrate[[1]] [1]
# The output which I get is  
    min1 
1  1.05
 
rate1_max1 = newrate[[1]] [2]
 
will give me output
 
    max1
1  1.30 
 
and so on.
 
So I will have to define it 12 times to assign the respective min and max 
values.  
 
My problem is instead of hard coding like I have done in OLD CODE, I need to 
assign these respective input values using a loop or some other way (as it 
becomes cumbersome if no of rates exceed say 10 and also since I am not aware 
how many rate files i will be dealing with) so that in the end I should be able 
to assign (say) the values like
 
rate1_min1  = 1.05
rate1_max1 = 1.30
rate1_min2  = 1.30
rate1_max2 = 1.65
rate1_min3  = 1.65
rate1_max3 = 1.99
 
rate2_min1  = 2.05
rate2_max1 = 2.30
rate2_min2  = 2.30
rate2_max2 = 2.65
rate2_min3  = 2.65
rate2_max3 = 2.99
 
If there are say 10 rates, then this will continue till
 
rate10_min1 =  ..
rate10_max1 = ..
.
so on.
 
## 
 
# PROBLEM - B
 
# Suppose Rij = ith Rate and jth range. (There are 3 ranges i.e. j= 3).
 
data_label = expand.grid(c(R11, R12, R13), c(R21, R23, R23))
 
# gives the output like
 
  data_label
 Var1    Var2
1    R11 R21
2    R12 R21
3R13 R21
4    R11 R22
5    R12 R22
6    R13 R22
7    R11 R23
8    R12 R23
9R13 R23
 
  
If instead of two rates, suppose there are three rates, I will have to modify 
my code as
 
data_label = expand.grid(c(R11, R12, R13), c(R21, R23, R23), 
c(R31, R32, R33))
 
If I define say
 
n = no_of_rates  # I will be taking this figure from some otehr csv file.
 
My PROBLEM = B is how do I write the above code pertaining to data_label in 
terms of 'n'.
 
## ___
 
I understand I am giving the impression as I need some kind of spoon feeding. I 
am giving below the original complete OLD CODE (consisting of 4 rates) I had 
written in the beginning. Problem with me is to modify it for varaible number 
of rates.
 
I sincerely apologize for the inconvenience I have caused so far by asking 
queries. Please guide me.
 
Regards
 
Maithili
 
# 
 
MY ORIGINAL CODE (Actual HARD CODE)
 
## ONS - PPA
 
# INPUT
 
rate_1   = read.csv('rate1_range.csv')
rate_2   = read.csv('rate2_range.csv')
rate_3   = read.csv('rate3_range.csv')
rate_4   = read.csv('rate4_range.csv')
 
prob_1   = read.csv('rate1_probs.csv')
prob_2   = read.csv('rate2_probs.csv')
prob_3   = read.csv('rate3_probs.csv')
prob_4   = read.csv('rate4_probs.csv')
 
rate1_min_1   =  rate_1$rate1_range1_min
rate1_max_1  =  rate_1$rate1_range1_max
rate1_min_2   =  rate_1$rate1_range2_min
rate1_max_2  =  rate_1$rate1_range2_max
rate1_min_3   =  rate_1$rate1_range3_min
rate1_max_3  =  rate_1$rate1_range3_max
 
rate2_min_1   =  rate_2$rate2_range1_min
rate2_max_1  =  rate_2$rate2_range1_max
rate2_min_2   =  rate_2$rate2_range2_min
rate2_max_2  = 

Re: [R] help: creating a unified histogram

2009-12-27 Thread Jim Lemon

On 12/28/2009 06:45 AM, Yael Yohai wrote:

Good evening,

I would like to put the histograms of several matrices on the same graph,
together on a unified histogram (instead of having one bar per value on the
x-axis, have multiple bars: one representing each matrix, with different
colored bars for example to distinguish between the matrices). I couldn't
find a function doing that involving hist,  plot nor other plotting
functions. Is there a function which does this?
   

Hi Yael,
See the last example for the barp function in the plotrix package.

Jim

__
R-help@r-project.org 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] Modified R Code

2009-12-27 Thread Maithili Shiva

Dear R helpers,
 
I have following input files. (Actually they are more than 10 rates but here i 
am considering only 2 rates to write my problem)
 
rate1.csv
min1    max1    min2  max2  min3   max3
1.051.30   1.30  1.65 1.65  1.99
 
rate2.csv
min1    max1    min2  max2  min3   max3
2.052.30   2.30  2.65 2.65  2.99
   
 
The simple R code I had used to read these files was as given below -
 
# OLD CODE
 
rates1 = read.csv('rate1.csv)
rates2 = read.csv('rate2.csv')
 
rate1_min1  = rates1$min1
rate1_max1 = rates1$max1
rate1_min2  = rates1$min2
rate1_max2 = rates1$max2
rate1_min3  = rates1$min3
rate1_max3 = rates1$max3
 
rate2_min1  = rates2$min1
rate2_max1 = rates2$max1
rate2_min2  = rates2$min2
rate2_max2 = rates2$max2
rate2_min3  = rates2$min3
rate2_max3 = rates2$max3
 
 
Since I am not aware how many rates I will be dealing with (it can be 2, 4, or 
10), hence I can't hardcode my input like I had defined above.
 
So with the guidance of R - help, I had rerwitten the input code as given below.
 
# NEW CODE
 
n = 2  # It gives me no of rates 
 
X = paste('rate', 1:n, '.csv', sep = ' ' )
 
# the output is rate1.csv   rate2.csv
 
newrate = lapply(X, read.csv)
 
# the output is as given below
 
newrate
 
[ [1] ] 
    min1 max1    min2  max2 min3   max3
1   1.05    1.30  1.301.65   1.65    1.99
 
[ [2] ]  
    min1 max1    min2  max2 min3   max3
1   2.05    2.30  2.302.65   2.65    2.99
 
## _
 
## PROBLEM
 
# PROBLEM - A
 
If I apply the command (As given in OLD CODE above)
 
rate1_min1  = rates1$min1
# The output which I get is  
    min1 
1  1.05
 
On similar lines I define
 
rate1_min1 = newrate[[1]] [1]
# The output which I get is  
    min1 
1  1.05
 
rate1_max1 = newrate[[1]] [2]
 
will give me output
 
    max1
1  1.30 
 
and so on.
 
So I will have to define it 12 times to assign the respective min and max 
values.  
 
My problem is instead of hard coding like I have done in OLD CODE, I need to 
assign these respective input values using a loop or some other way (as it 
becomes cumbersome if no of rates exceed say 10 and also since I am not aware 
how many rate files i will be dealing with) so that in the end I should be able 
to assign (say) the values like
 
rate1_min1  = 1.05
rate1_max1 = 1.30
rate1_min2  = 1.30
rate1_max2 = 1.65
rate1_min3  = 1.65
rate1_max3 = 1.99
 
rate2_min1  = 2.05
rate2_max1 = 2.30
rate2_min2  = 2.30
rate2_max2 = 2.65
rate2_min3  = 2.65
rate2_max3 = 2.99
 
If there are say 10 rates, then this will continue till
 
rate10_min1 =  ..
rate10_max1 = ..
.
so on.
 
## 
 
# PROBLEM - B
 
# Suppose Rij = ith Rate and jth range. (There are 3 ranges i.e. j= 3).
 
data_label = expand.grid(c(R11, R12, R13), c(R21, R23, R23))
 
# gives the output like
 
  data_label
 Var1    Var2
1    R11 R21
2    R12 R21
3R13 R21
4    R11 R22
5    R12 R22
6    R13 R22
7    R11 R23
8    R12 R23
9R13 R23
 
  
If instead of two rates, suppose there are three rates, I will have to modify 
my code as
 
data_label = expand.grid(c(R11, R12, R13), c(R21, R23, R23), 
c(R31, R32, R33))
 
If I define say
 
n = no_of_rates  # I will be taking this figure from some otehr csv file.
 
My PROBLEM = B is how do I write the above code pertaining to data_label in 
terms of 'n'.
 
## ___
 
I sincerely apologize for the inconvenience I have caused so far by asking 
queries. Please guide me.
 
Regards
 
Maithili
 
 
 
 


  The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. 
[[alternative HTML version deleted]]

__
R-help@r-project.org 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 with Moving Average in R

2009-12-27 Thread Saji Ren
Hello,guys:

I want to use a moving average estimation in my analysis.
When refering to this moving average, I mean a MA in a technical analysis 
definition, and not to the definition in Time Series Analysis.
Actually, it is an AR estimation in TSA.

So I use the function filter to compute it. For example, i compute the ma2 as 
below:

 x = 1:10
 ma2 = filter(x,rep(1/2, 2),sides =1)
 ma2
 [1]  NA 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5

Note that the ma2 estimation use the current value as an input, and i want to 
avoid this.
I mean I just want to use the past values x[t-2] and x[t-1] to get the ma2, and 
use that as the current estimation.
So that is actually a ma3 with the coefficient c(1/2, 1/2, 0), so i use the 
command as below:

 MA2 = filter(x,c(rep(1/2,2),0),sides = 1)
 MA2
 [1]  NA  NA 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5

But what I want is:
[1]  NA  NA 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5

And I think the command I used to get MA2 should give a result as what I want, 
but it just does not.
I want to know the reason, and I wondor if anyone could introduce a more 
convinient way to compute that.

Thank you all in advance
Saji from Shanghai
__
R-help@r-project.org 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] MS-VAR

2009-12-27 Thread Henrique
Dear R users,

I would like to estimate a MS-VAR where the probabilities of regime
shifts are dependent of an exogenous variable. Is it possible to do
this using R?

Best,
Henrique C. de Andrade
Doutorando em Economia Aplicada
Universidade Federal do Rio Grande do Sul
www.ufrgs.br/ppge

__
R-help@r-project.org 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] Help with Moving Average in R

2009-12-27 Thread Berend Hasselman


Saji Ren wrote:
 
 ...
 MA2 = filter(x,c(rep(1/2,2),0),sides = 1)
 MA2
  [1]  NA  NA 2.5 3.5 4.5 5.5 6.5 7.5 8.5 9.5
 
 But what I want is:
 [1]  NA  NA 1.5 2.5 3.5 4.5 5.5 6.5 7.5 8.5
 
 And I think the command I used to get MA2 should give a result as what I
 want, but it just does not.
 I want to know the reason, and I wondor if anyone could introduce a more
 convinient way to compute that.
 

How about

MA2 - filter(yts,c(0,rep(0.5,2)),sides=1)

Berend
-- 
View this message in context: 
http://n4.nabble.com/Help-with-Moving-Average-in-R-tp989627p989645.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org 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.