Re: [R] Recursive partitioning algorithms in R vs. alia

2009-06-19 Thread Tobias Verbeke

Wensui Liu wrote:


well, how difficult to code random forest with sas macro + proc split?
if you are lack of sas programming skill, then you are correct that
you have to wait for 8 years :-)


It is true one can use the macro language to obtain some control flow 
the plain SAS language and its PROCs are missing and for manipulating 
matrices there is even a third language (IML), but my customers prefer 
to leverage community-tested open source implementations as building 
blocks rather than spending unnecessary resources in writing things from 
scratch in their corner.



i don't know how much sas experience you have. as far as i know, both
bagging and boosting have been implemented in sas em for a while,
together with other cut-edge modeling tools such as svm / nnet.


Fair enough, but whenever you will need ensemble methods for survival 
data or would like to escape bias in variable importance in presence
of categorical predictors you will (1) not be able to take something off 
the shelf and (2) neither to programmatically tweak SAS EM procedures

(as they are not exposed but locked in the GUI), so there again your
only option is to implement things from scratch.

Best,
Tobias


On Fri, Jun 19, 2009 at 4:18 PM, Tobias
Verbeke wrote:

Wensui Liu wrote:


in terms of the richness of features and ability to handle large
data(which is normal in bank), SAS EM should be on top of others.

Should be ? That is not at all my experience.
SAS EM is very much lagging behind current
research. You will find variants of random forests
in R that will not be in SAS for the next 8 years,
to give just one example.


however, it is not cheap.
in terms of algorithm, split procedure in sas em can do
chaid/cart/c4.5, if i remember correctly.

These are techniques of the 80s and 90s
(which proves my point). CART is in rpart and
an implementation of C4.5 can be accessed
through RWeka. For the oldest one (CHAID, 1980),
there might be an implementation soon:

http://r-forge.r-project.org/projects/chaid/

but again there have been quite some improvements
in the last decade as well:

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

HTH,
Tobias


On Fri, Jun 19, 2009 at 2:35 PM, Carlos J. Gil
Bellosta wrote:

Dear R-helpers,

I had a conversation with a guy working in a "business intelligence"
department at a major Spanish bank. They rely on recursive partitioning
methods to rank customers according to certain criteria.

They use both SAS EM and Salford Systems' CART. I have used package R
part in the past, but I could not provide any kind of feature comparison
or the like as I have no access to any installation of the first two
proprietary products.

Has anybody experience with them? Is there any public benchmark
available? Is there any very good --although solely technical-- reason
to pay hefty software licences? How would the algorithms implemented in
rpart compare to those in SAS and/or CART?

Best regards,

Carlos J. Gil Bellosta
http://www.datanalytics.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-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] loading .Rdata files please ignore

2009-06-19 Thread Erin Hodgess
Nothing like posting to the list to make you find an answer!

file.info does the trick for file size!

Thanks anyway,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.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] loading .Rdata files

2009-06-19 Thread Erin Hodgess
Dear R People:

I'm loading several thousand .Rdata files in sequence.

If one of them is empty, the function crashes.

I am thinking about using system(wc ) etc., and strsplit for the
results, but was wondering if there is a more clever way via a file
type command, please.

Thanks,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.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] how to apply the dummy coding rule in a dataframe with complete factor levels to another dataframe with incomplete factor levels?

2009-06-19 Thread Sean Zhang
Dear R helpers:

Sorry to bother for a basic question about model.matrix.
Basically, I want to apply the dummy coding rule in a dataframe with
complete factor levels to another dataframe with incomplete factor levels.
I used model.matrix, but could not get what I want.
The following is an example.

#Suppose I have two dataframe A and B
dfA=data.frame(f1=factor(c('a','b','c')), f2=factor(c('aa','bb','cc')))
dfB =data.frame(f1=factor(c('a','b','b')), f2=factor(c('aa','bb','bb')))
#dfB's factor variables have less number of levels

#use model.matrix on dfA
(matA<-model.matrix(~f1+f2,data=dfA))
#use model.matrix on dfB
(matB<-model.matrix(~f1+f2,data=dfB))
#I actaully like to dummy code dfB using the dummy coding rule defined in
model.matrix(~f1+f2,data=dfA))
#matB_wanted  is below
(matB_wanted<-rbind(c(1,0,0,0,0),c(1,1,0,1,0),c(1,1,0,1,0)) )
colnames(matB_wanted)<-colnames(matA)
matB_wanted
Can someone kindly show me how to get matB_wanted?
Many thanks in advance!

-Sean

[[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] read.table error

2009-06-19 Thread jim holtman
Try  comment.char='', quote=''

You may have unbalanced quotes or comments (#) in your data.

On Fri, Jun 19, 2009 at 5:50 PM, Forafo San  wrote:

> Hello,
>
> I'm receiving an error on attempting to use the read.table() function
> to read in data from a tab-delimited file. The file has more than
> 60,000 rows with 94 tab-delimited columns. However, the error occurs
> on row 3 of the file:
>
> > wl <-read.table("sr003lines.tab", header=T, sep="\t")
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,
>  :
>  line 3 did not have 94 elements
>
> On receiving this error, I wrote a python script to go through the
> file to find rows with fewer than the 94 columns -- python finds that
> the first row with fewer than 94 columns is 1,706 -- much later than
> what R reports.  R keeps running into this problem even with my
> python-massaged input file that I know for sure contains only rows
> with 94 columns.
>
> I also copied the first 4 rows of the input file into a separate file
> -- R isn't able to get past this problem.  I examined the row (line 3)
> of the input file -- the only thing that's unique about this line is
> that it contains a long string (236 characters) in a column that in
> the previous rows was empty.  Any chance that this sort of thing would
> cause R to run into a road block?
>
> Thanks,
> Premal P. Vora
> Associate Prof. Finance
> Penn State Harrisburg
>
> __
> 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.
>



-- 
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] please recommend hands-on books on classification, data-mining and machine learning with R?

2009-06-19 Thread Rob Denniker
Seriously?

Did you not receive the reply to the same question from Uwe Ligges at 12:31pm 
today?
You are overfishing the common pool, bro.

2009/6/19 Uwe Ligges :
Most of the times it is advisable to get a good book about the statistical 
concepts (multivariate statistics or data-mining) and another good book about 
the programming language (R), if you have an idea how the concepts work, it is 
really easy to combine.

Gabor Grothendieck's reply to you at 1:45pm was also good advice...

2009/6/19 Gabor Grothendieck :
See

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


> -Original Message-
> From: comtech@gmail.com
> Sent: Fri, 19 Jun 2009 16:13:47 -0700
> To: r-h...@stat.math.ethz.ch
> Subject: [R] please recommend hands-on books on classification,
> data-mining and machine learning with R?
> 
> Hi all,
> 
> Could anybody please recommend some hands-on books on classification,
> data-mining and machine learning with R? I would like to get a very
> good understanding of the statistical tools that are used in these
> areas, while reducing the learning curve.
> 
> Thank you!
> 
> __
> 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] please recommend hands-on books on classification, data-mining and machine learning with R?

2009-06-19 Thread Rob Denniker
Seriously?

Did you not receive the reply to the same question from Uwe Ligges at 12:31pm 
today?
You are overfishing the common pool, bro.

2009/6/19 Uwe Ligges :
Most of the times it is advisable to get a good book about the statistical 
concepts (multivariate statistics or data-mining) and another good book about 
the programming language (R), if you have an idea how the concepts work, it is 
really easy to combine.

Gabor Grothendieck's reply to you at 1:45pm was also good advice...

2009/6/19 Gabor Grothendieck :
See

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


> -Original Message-
> From: comtech@gmail.com
> Sent: Fri, 19 Jun 2009 16:13:47 -0700
> To: r-h...@stat.math.ethz.ch
> Subject: [R] please recommend hands-on books on classification,
> data-mining and machine learning with R?
> 
> Hi all,
> 
> Could anybody please recommend some hands-on books on classification,
> data-mining and machine learning with R? I would like to get a very
> good understanding of the statistical tools that are used in these
> areas, while reducing the learning curve.
> 
> Thank you!
> 
> __
> 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] please recommend hands-on books on classification, data-mining and machine learning with R?

2009-06-19 Thread Rob Denniker
Seriously?

Did you not receive the reply to the same question from Uwe Ligges at 12:31pm 
today?
You are overfishing the common pool, bro.

2009/6/19 Uwe Ligges :
Most of the times it is advisable to get a good book about the statistical 
concepts (multivariate statistics or data-mining) and another good book about 
the programming language (R), if you have an idea how the concepts work, it is 
really easy to combine.

Gabor Grothendieck's reply to you at 1:45pm was also good advice...

2009/6/19 Gabor Grothendieck :
See

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


> -Original Message-
> From: comtech@gmail.com
> Sent: Fri, 19 Jun 2009 16:13:47 -0700
> To: r-h...@stat.math.ethz.ch
> Subject: [R] please recommend hands-on books on classification,
> data-mining and machine learning with R?
> 
> Hi all,
> 
> Could anybody please recommend some hands-on books on classification,
> data-mining and machine learning with R? I would like to get a very
> good understanding of the statistical tools that are used in these
> areas, while reducing the learning curve.
> 
> Thank you!
> 
> __
> 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] Dealing with a counted variable

2009-06-19 Thread Charles C. Berry



See

?xtabs

and take note of the examples


HTH,

Chuck

On Fri, 19 Jun 2009, John Lipkins wrote:


Dear all,

I sometimes receive data which has a following layout:

Age urban   count

34    X 13

64    3

In which count represents the amount of times a certain observation
has been fulfilled. How ever when using this data in R I’m confronted
with the fact that R can not use this data in it’s functions, for
example table().

Is there an easy solution for this problem?

Thanks!

Regards,

John

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



Charles C. Berry(858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cbe...@tajo.ucsd.edu   UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

__
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] please recommend hands-on books on classification, data-mining and machine learning with R?

2009-06-19 Thread Michael
Hi all,

Could anybody please recommend some hands-on books on classification,
data-mining and machine learning with R? I would like to get a very
good understanding of the statistical tools that are used in these
areas, while reducing the learning curve.

Thank you!

__
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] a plot of stacked boxes

2009-06-19 Thread Richard M. Heiberger

I think you are looking for mosaic()

table(df)
library(vcd)
mosaic(outcome ~ group, data=df)

Rich

__
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] read.table error

2009-06-19 Thread Gabor Grothendieck
Use the count.fields function to find out how many fields it thinks
each row has.

On Fri, Jun 19, 2009 at 5:50 PM, Forafo San wrote:
> Hello,
>
> I'm receiving an error on attempting to use the read.table() function
> to read in data from a tab-delimited file. The file has more than
> 60,000 rows with 94 tab-delimited columns. However, the error occurs
> on row 3 of the file:
>
>> wl <-read.table("sr003lines.tab", header=T, sep="\t")
> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
>  line 3 did not have 94 elements
>
> On receiving this error, I wrote a python script to go through the
> file to find rows with fewer than the 94 columns -- python finds that
> the first row with fewer than 94 columns is 1,706 -- much later than
> what R reports.  R keeps running into this problem even with my
> python-massaged input file that I know for sure contains only rows
> with 94 columns.
>
> I also copied the first 4 rows of the input file into a separate file
> -- R isn't able to get past this problem.  I examined the row (line 3)
> of the input file -- the only thing that's unique about this line is
> that it contains a long string (236 characters) in a column that in
> the previous rows was empty.  Any chance that this sort of thing would
> cause R to run into a road block?
>
> Thanks,
> Premal P. Vora
> Associate Prof. Finance
> Penn State Harrisburg
>
> __
> 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] read.table error

2009-06-19 Thread Peter Ehlers

I'm guessing that there's something wrong with one
of your column separators. Have you tried leaving out
the 'sep="\t"' argument?

 -P

Forafo San wrote:

Hello,

I'm receiving an error on attempting to use the read.table() function
to read in data from a tab-delimited file. The file has more than
60,000 rows with 94 tab-delimited columns. However, the error occurs
on row 3 of the file:


wl <-read.table("sr003lines.tab", header=T, sep="\t")

Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
  line 3 did not have 94 elements

On receiving this error, I wrote a python script to go through the
file to find rows with fewer than the 94 columns -- python finds that
the first row with fewer than 94 columns is 1,706 -- much later than
what R reports.  R keeps running into this problem even with my
python-massaged input file that I know for sure contains only rows
with 94 columns.

I also copied the first 4 rows of the input file into a separate file
-- R isn't able to get past this problem.  I examined the row (line 3)
of the input file -- the only thing that's unique about this line is
that it contains a long string (236 characters) in a column that in
the previous rows was empty.  Any chance that this sort of thing would
cause R to run into a road block?

Thanks,
Premal P. Vora
Associate Prof. Finance
Penn State Harrisburg

__
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 import timestamps from emails into R

2009-06-19 Thread Gabor Grothendieck
Try this:


Lines <- "Sun, 14 Jun 2009 07:33:00 -0700
Sun, 14 Jun 2009 08:35:10 -0700
Sun, 14 Jun 2009 21:26:34 -0700
Mon, 15 Jun 2009 19:47:47 -0700
Wed, 17 Jun 2009 21:50:41 -0700"

# L <- readLines("myfile.txt")
L <- readLines(textConnection(Lines))
tt <- as.POSIXct(L, format = "%a, %d %b %Y %H:%M:%S")



On Fri, Jun 19, 2009 at 6:06 PM, Thomas Levine wrote:
> I am analysing occurrences of a phenomenon by time, and each of these
> timestamps taken from email headers represents one occurrence. (The last
> number is the time zone.) I can easily change the format.
>
> Sun, 14 Jun 2009 07:33:00 -0700
> Sun, 14 Jun 2009 08:35:10 -0700
> Sun, 14 Jun 2009 21:26:34 -0700
> Mon, 15 Jun 2009 19:47:47 -0700
> Wed, 17 Jun 2009 21:50:41 -0700
>
> I've found documentation for a plethora of ways of importing time data, but
> I can't decide how to approach it. Any ideas on what may be the cleanest
> way? The only special concern is that I'll want to plot these data by date
> and time, meaning that I would rather not bin all of the occurrences from
> one day.
>
> The time zone isn't important as these are all local times; the time zone
> only changes as a function of daylight savings time, so I probably shouldn't
> use it at all.
>
> Tom
>
>        [[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.


[R] How to import timestamps from emails into R

2009-06-19 Thread Thomas Levine
I am analysing occurrences of a phenomenon by time, and each of these
timestamps taken from email headers represents one occurrence. (The last
number is the time zone.) I can easily change the format.

Sun, 14 Jun 2009 07:33:00 -0700
Sun, 14 Jun 2009 08:35:10 -0700
Sun, 14 Jun 2009 21:26:34 -0700
Mon, 15 Jun 2009 19:47:47 -0700
Wed, 17 Jun 2009 21:50:41 -0700

I've found documentation for a plethora of ways of importing time data, but
I can't decide how to approach it. Any ideas on what may be the cleanest
way? The only special concern is that I'll want to plot these data by date
and time, meaning that I would rather not bin all of the occurrences from
one day.

The time zone isn't important as these are all local times; the time zone
only changes as a function of daylight savings time, so I probably shouldn't
use it at all.

Tom

[[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] read.table error

2009-06-19 Thread Forafo San
Hello,

I'm receiving an error on attempting to use the read.table() function
to read in data from a tab-delimited file. The file has more than
60,000 rows with 94 tab-delimited columns. However, the error occurs
on row 3 of the file:

> wl <-read.table("sr003lines.tab", header=T, sep="\t")
Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings,  :
  line 3 did not have 94 elements

On receiving this error, I wrote a python script to go through the
file to find rows with fewer than the 94 columns -- python finds that
the first row with fewer than 94 columns is 1,706 -- much later than
what R reports.  R keeps running into this problem even with my
python-massaged input file that I know for sure contains only rows
with 94 columns.

I also copied the first 4 rows of the input file into a separate file
-- R isn't able to get past this problem.  I examined the row (line 3)
of the input file -- the only thing that's unique about this line is
that it contains a long string (236 characters) in a column that in
the previous rows was empty.  Any chance that this sort of thing would
cause R to run into a road block?

Thanks,
Premal P. Vora
Associate Prof. Finance
Penn State Harrisburg

__
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] Dealing with a counted variable

2009-06-19 Thread John Lipkins
Dear all,

I sometimes receive data which has a following layout:

Age urban   count

34    X 13

64    3

In which count represents the amount of times a certain observation
has been fulfilled. How ever when using this data in R I’m confronted
with the fact that R can not use this data in it’s functions, for
example table().

Is there an easy solution for this problem?

Thanks!

Regards,

John

__
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] joint estimation of two poisson equations

2009-06-19 Thread ryusuke



ryusuke wrote:
> 
> 
> 
> Owen Powell-2 wrote:
>> 
>> Thanks Tirthankar, that did the trick.
>> Here's the solution to my problem using the "bivpois" package:
>> 
>> rm(list = ls())
>> library(bivpois)
>> 
>> y1 = c(1,2,3,4,4,3)
>> y2 = c(0,2,0,2,3,5)
>> x1 = c(2,3,4,8,1,3)
>> x2 = c(3,5,6,7,8,9)
>> d = data.frame(cbind(y1, y2, x))
>> 
>> eq1 = y1 ~ x1 + x2
>> eq2 = y2 ~ x1 + x2
>> 
>> out = lm.pb(eq1, eq2, data = d, zeroL3 = TRUE)
>> print(out)
>> 
>> I couldn't find out how to get standard errors and p-values from the
>> package, so I bootstrapped them.
>> 
>> ~Owen
>> 
>> 2009/4/13 Tirthankar Chakravarty 
>> 
>>> You should probably try the -bivpois- package:
>>> http://cran.r-project.org/web/packages/bivpois/index.html
>>>
>>> A very good discussion of multivariate Poissons, negative binomials
>>> etc. can be found in Chapter 7 of Rainer Winkelmann's book
>>> "Econometric Analysis of Count Data" (Springer 2008). Most of the
>>> likelihoods involved are fairly straightforward.
>>>
>>> T
>>>
>>> On Mon, Apr 13, 2009 at 9:32 AM, Owen Powell  wrote:
>>> > Dear list members,
>>> >
>>> > Is there a package somewhere for jointly estimating two poisson
>>> processes?
>>> >
>>> > I think the closest I've come is using the "SUR" option in the Zelig
>>> > package (see below), but when I try the "poisson" option instead of
>>> > the "SUR" optioin I get an error (error given below, and indeed,
>>> > reading the documentation of the Zelig package, I get the impression
>>> > "poisson" was not meant to handle a system of equations).
>>> >
>>> > I think I could do it myself by constructing the likelihood function
>>> > and then applying ML, but I'd prefer to avoid doing that unless it's
>>> > entirely necessary.
>>> >
>>> > I'll post my solution to the list when I've worked it out.
>>> >
>>> > Regards,
>>> >
>>> > ~Owen
>>> >
>>> > # CODE FOR "sur" OPTION
>>> > rm(list = ls())
>>> > library(Zelig)
>>> >
>>> > y1 = c(1,2,3,4)
>>> > y2 = c(0,2,0,2)
>>> > x = c(2,3,4,8)
>>> > d = data.frame(cbind(y1, y2, x))
>>> >
>>> > eq1 = y1 ~ x
>>> > eq2 = y2 ~ x
>>> > eqSystem = list (eq1, eq2)
>>> >
>>> > system_out = zelig(formula = eqSystem, model = "sur", data = d)
>>> > summary(system_out)
>>> >
>>> > -
>>> >
>>> > # ERROR FROM REPLACING "sur" WITH "poisson"
>>> > Error in switch(mode(x), `NULL` = structure(NULL, class = "formula"), 
>>> :
>>> >  invalid formula
>>> >
>>> > --
>>> > Owen Powell
>>> > http://center.uvt.nl/phd_stud/powell
>>> >
>>> > __
>>> > 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.
>>> >
>>>
>>>
>>>
>>> --
>>> To every ù-consistent recursive class ê of formulae there correspond
>>> recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
>>> belongs to Flg(ê) (where v is the free variable of r).
>>>
>> 
>> 
>> 
>> -- 
>> Owen Powell
>> http://center.uvt.nl/phd_stud/powell
>> 
>>  [[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.
>> 
>> 
> 
> I would like to know the bivpois coding and write a same function in VBA
> Excel, anyone gonna good suggestion?
> 
http://www.nabble.com/file/p24115406/%257Ebivpois%257E.txt %7Ebivpois%7E.txt 
-- 
View this message in context: 
http://www.nabble.com/joint-estimation-of-two-poisson-equations-tp23019442p24115406.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.


[R] a difficulty in boot package

2009-06-19 Thread Seunghee Baek
Hi,
I have a problem in programming for bootstrapping.
I don't know why it show the error message.
Please see my code below:
#'st' is my original dataset. 
#functions of 'fml.mlogl','pcopula.fam4','ltd','invltd' are already defined

boot.OR<-function(data,i)
{
E=data[i,]
ml1<-glm(c_VAsex90_bf ~ trt,family=binomial,data=E)
ml2<-glm(c_VAsex90_bm ~ trt,family=binomial,data=E)
marg.covariates<-cbind(rep(1,length(E$trt)),E$trt)
dep.covariates<-cbind(rep(1,length(E$age_avr)),E$age_avr)
start<-c(ml1$coef,ml2$coef,0,0)
fml1<-optim(start,fml.mlogl,control=c(maxit=1),hessian=F)
x<-(1+exp(fml1$par[1]))^(-1)
y<-(1+exp(fml1$par[3]))^(-1)
b<-exp(fml1$par[5]+fml1$par[6]*43)+1
p00<-ltd(-log(pcopula.fam4(exp(-invltd(x,b)),exp(-invltd(y,b)),b)),b)
p1<-exp(fml1$par[1])/(1+exp(fml1$par[1]))
p2<-exp(fml1$par[3])/(1+exp(fml1$par[3]))
OR<-p00*(p00+p1+p2-1)/(1-p2-p00)/(1-p1-p00)
OR
}

set.seed(101)

boot(st,boot.OR,R=500)

##
I gives following error message:
Error in fn(par, ...) : object "dep.covariates" not found

I hope you can help me in this problem.

Thanks,
Becky

__
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] ifelse(is.na), with function inside

2009-06-19 Thread Grześ


:) Thank you very much! I have already found solution. I have always problem
with connect logical value and vector :/  You know... everybody helped me a
little. Thanks very much again!

Grzesiek


Petr Pikal wrote:
> 
> Hi
> 
> r-help-boun...@r-project.org napsal dne 17.06.2009 14:59:35:
> 
>> 
>> This is my function:
>> 
>> zywnoscCalosc <- function( zywnosc, sklepik, sklslodycze) { 
>> 
>> b=as.vector(sklslodycze)
>> 
>> fun=function(a,b){
>> a=2+b
>> }
>> zywnosc=ifelse(is.na(sklepik),NA,fun(a,b))#Here I have a problem 
> !
>> }
>> 
>> I always get: Error in 2 + b : non-numeric argument to binary operator
>> I think problem is in my vector b. What I should do to get restult my
>> function fun(a,b) inside "zywnosc"? 
> 
> It is REALLY difficult to understand what you want to achieve.
> 
> There is no problem in your function (I do not get any error when I copy 
> it to R) but it is a mystery how you would like to use it, there is no 
> output from the function.
> 
> I am also almost sure that a or b is not defined for function 
> "zywnoscCalosc". (Try to search "nested function" in help archive.
> 
> A wild guess is that
> 
> zywnosc=ifelse(is.na(sklepik),NA,sklslodycze+2)
> 
> is what you want, however without working example and/or explanation what 
> you REALLY want it is just a guess.
> 
> Regards
> Petr
> 
> 
> 
>> 
>> 
>> 
>> 
>> 
>> 
>> joscani wrote:
>> > 
>> > Try:
>> > 
>> > b<- ifelse(is.na(a),1,2)
>> > 
>> > 
>> > Grześ wrote:
>> >> 
>> >> 2 - is.na(a)  - it's superb! but I need call a function:  wy[i]<-
>> >> ifelse(((is.na(a))), call_fun1(x), call_fun2(x)
>> >> 
>> >> 
>> >> 
>> >> Gabor Grothendieck wrote:
>> >>> 
>> >>> Try:
>> >>> 
>> >>> 2 - is.na(a)
>> >>> 
>> >>> 
>> >>> On Tue, Jun 16, 2009 at 5:46 PM, Grześ wrote:
>> 
>>  Hi,
>>  I have a vector a=c(NA, 3, 4, 4, NA, NA, 3) and I would like to use
>>  is.na(a)
>>  function to get a vector like this:
>>  wy=(1,2,2,2,1,1,2) - you know, this vector create 1 or 2 depends on
>>  value in
>>  vector "a"
>> 
>>  This is my short code but something is wrong and I don't know 
> what...
>> 
>>  for (i in 1:7){
>>   a=c( NA, 3, 4, 4, NA, NA, 3)
>>   fun1=function(x){
>>   x=1
>>   print(x)
>>   }
>>   fun2=function(x){
>>   x=2
>>   print(x)
>>   }
>>   wy[i]<- ifelse(((is.na(a))), fun1(x), fun2(x))
>>   }
>>  [1] 1
>>  [1] 2
>>  [1] 1
>>  [1] 2
>>  [1] 1
>>  [1] 2
>>  [1] 1
>>  [1] 2
>>  [1] 1
>>  [1] 2
>>  [1] 1
>>  [1] 2
>>  [1] 1
>>  [1] 2
>>  and I get a lots of warnings:
>>  Warning messages:
>>  1: In wy[i] <- ifelse(((is.na(a))), fun1(x), fun2(x)) :
>>   number of items to replace is not a multiple of replacement length
>>  2: In wy[i] <- ifelse(((is.na(a))), fun1(x), fun2(x)) :
>>   number of items to replace is not a multiple of replacement 
> length...
>> 
>>  and as an result I get a vector only with 1
>> > wy
>>  [1] 1 1 1 1 1 1 1
>> 
>>  I'll be very happy if someone help me
>> 
>>  --
>>  View this message in context:
>>  http://www.nabble.com/ifelse%28is.na%29%2C-with-function-inside-
>> tp24063455p24063455.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.
>> 
>> >>> 
>> >>> __
>> >>> 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.
>> >>> 
>> >>> 
>> >> 
>> >> 
>> > 
>> > 
>> 
>> -- 
>> View this message in context: 
> http://www.nabble.com/ifelse%28is.na%29%2C-with-
>> function-inside-tp24063455p24073158.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.
> 
> __
> 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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/ifelse%28is.na%29%2C-with-function-inside-tp24063455p24118560.html
Sent from the R help mailing list archive at Nabble.com.

_

Re: [R] Writting multiple tables to csv

2009-06-19 Thread Gabor Grothendieck
Try using append= like this where BOD is built into R:

write.table(BOD[1:3,], "BOD.txt", row.names = FALSE, sep = "\t")
write.table(BOD[4:5,], "BOD.txt", row.names = FALSE, sep = "\t",
col.names = FALSE, append = TRUE)


On Fri, Jun 19, 2009 at 5:20 PM, baked Toast wrote:
> Hey,
>
> Is it possible to write multiple tables at once to a cvs file? Because
> these tables are of different lengths I can not use cbind. When I use
> following:
>
> Test <- c(capture.output(table(test1),capture.output(table(test2))
> write.table(Test,”test.csv”,row.names=FALSE,sep=”\t”)
>
> I receive messy, unusable csv files.
>
> So my question is, is it possible to use similar tools or other
> functions to write multiple tables to a csv file at once?
>
> Thanks in advance.
>
> Kind regards,
>
> __
> 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] Writting multiple tables to csv

2009-06-19 Thread baked Toast
Hey,

Is it possible to write multiple tables at once to a cvs file? Because
these tables are of different lengths I can not use cbind. When I use
following:

Test <- c(capture.output(table(test1),capture.output(table(test2))
write.table(Test,”test.csv”,row.names=FALSE,sep=”\t”)

I receive messy, unusable csv files.

So my question is, is it possible to use similar tools or other
functions to write multiple tables to a csv file at once?

Thanks in advance.

Kind regards,

__
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] correlation between categorical data

2009-06-19 Thread Dylan Beaudette
Not an expert, but I would try some of the following:

# tabulate joint frequencies
?table
?xtabs

# plotting
mosaicplot(Titanic, main = "Survival on the Titanic", color = TRUE, shade=TRUE)

# log-linear models

check the library for more ideas.

Cheers,
Dylan

On Fri, Jun 19, 2009 at 2:04 PM, Michael wrote:
> Hi all,
>
> In a data-frame, I have two columns of data that are categorical.
>
> How do I form some sort of measure of correlation between these two columns?
>
> For numerical data, I just need to regress one to the other, or do
> some pairs plot.
>
> But for categorical data, how do I find and/or visualize correlation
> between the two columns of data?
>
> Thanks!
>
> __
> 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] Recursive partitioning algorithms in R vs. alia

2009-06-19 Thread Wensui Liu
well, how difficult to code random forest with sas macro + proc split?
if you are lack of sas programming skill, then you are correct that
you have to wait for 8 years :-)
i don't know how much sas experience you have. as far as i know, both
bagging and boosting have been implemented in sas em for a while,
together with other cut-edge modeling tools such as svm / nnet.


On Fri, Jun 19, 2009 at 4:18 PM, Tobias
Verbeke wrote:
> Wensui Liu wrote:
>
>> in terms of the richness of features and ability to handle large
>> data(which is normal in bank), SAS EM should be on top of others.
>
> Should be ? That is not at all my experience.
> SAS EM is very much lagging behind current
> research. You will find variants of random forests
> in R that will not be in SAS for the next 8 years,
> to give just one example.
>
>> however, it is not cheap.
>> in terms of algorithm, split procedure in sas em can do
>> chaid/cart/c4.5, if i remember correctly.
>
> These are techniques of the 80s and 90s
> (which proves my point). CART is in rpart and
> an implementation of C4.5 can be accessed
> through RWeka. For the oldest one (CHAID, 1980),
> there might be an implementation soon:
>
> http://r-forge.r-project.org/projects/chaid/
>
> but again there have been quite some improvements
> in the last decade as well:
>
> http://cran.r-project.org/web/views/MachineLearning.html
>
> HTH,
> Tobias
>
>> On Fri, Jun 19, 2009 at 2:35 PM, Carlos J. Gil
>> Bellosta wrote:
>>>
>>> Dear R-helpers,
>>>
>>> I had a conversation with a guy working in a "business intelligence"
>>> department at a major Spanish bank. They rely on recursive partitioning
>>> methods to rank customers according to certain criteria.
>>>
>>> They use both SAS EM and Salford Systems' CART. I have used package R
>>> part in the past, but I could not provide any kind of feature comparison
>>> or the like as I have no access to any installation of the first two
>>> proprietary products.
>>>
>>> Has anybody experience with them? Is there any public benchmark
>>> available? Is there any very good --although solely technical-- reason
>>> to pay hefty software licences? How would the algorithms implemented in
>>> rpart compare to those in SAS and/or CART?
>>>
>>> Best regards,
>>>
>>> Carlos J. Gil Bellosta
>>> http://www.datanalytics.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.
>>>
>>
>>
>>
>
>



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

__
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] correlation between categorical data

2009-06-19 Thread Michael
Hi all,

In a data-frame, I have two columns of data that are categorical.

How do I form some sort of measure of correlation between these two columns?

For numerical data, I just need to regress one to the other, or do
some pairs plot.

But for categorical data, how do I find and/or visualize correlation
between the two columns of data?

Thanks!

__
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] Random number datasets help

2009-06-19 Thread Marc Schwartz

On Jun 19, 2009, at 10:25 AM, Alexandre Lockhart wrote:



My other question involved formatting my output. Normally, my text  
file has 8 columns, each column with 500 values before the next 8  
below are generated, and so on until 28 are reached.   I have  
examined formatting issues with each function (cbind, sink, apply,  
trying matrix (only one set is output)) in my revised code, but am  
unable to achieve my wanted output file: 7 columns of 500 generated  
values, four different times.  Thank you.


a1<- 
c 
(178.07,178.28,178.08,177.74,177.04,178.17,177.58,57.71,59.6,60.92,59.48,59.32,61.59,59.94,28.9,29.82,30.73,25.68,27.93,28.98,29.76,123.48,127.27,127.8,127.2,127.13,126.71,125.5 
)
a2<- 
c 
(1.69,1.3,1 
,. 
18,1.53,1.31,1.35,1.83,1.56,1.12 
,. 
74,1.48,1.67,1.53 
,.95,.87,0.03,1.12,1.95,1.22,1.04,1.64,1.83,1,1,1.08,1.35,2.37)

sink(file='/home/lockhartag/Wim/TRP/output.txt',append=TRUE)
apply(cbind(a1, a2), 1, function(x) rnorm(500, x[1], x[2]))
sink()


Hi Alexandre,

Try this:

set.seed(1)
Result <- apply(cbind(a1, a2), 1, function(x) rnorm(500, x[1], x[2]))

# Take the 28 columns, split them up in groups of 7 columns and  
rbind() them together
Result <- rbind(Result[, 1:7], Result[, 8:14], Result[, 15:21],  
Result[, 22:28])


> str(Result)
 num [1:2000, 1:7] 179 177 180 180 180 ...


That gives you a matrix with 7 columns and 2000 rows. The 2000 rows  
will be 4 sets of 500 each, one set of 500 per time period in order.


You can then use:

  write.table(Result, file = "out.txt")

to write 'Result' to a text file. Using the defaults above, the text  
file will contain both row names and column names. See ?write.table  
for more information.


HTH,

Marc

__
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] Recursive partitioning algorithms in R vs. alia

2009-06-19 Thread Tobias Verbeke

Wensui Liu wrote:


in terms of the richness of features and ability to handle large
data(which is normal in bank), SAS EM should be on top of others.


Should be ? That is not at all my experience.
SAS EM is very much lagging behind current
research. You will find variants of random forests
in R that will not be in SAS for the next 8 years,
to give just one example.


however, it is not cheap.
in terms of algorithm, split procedure in sas em can do
chaid/cart/c4.5, if i remember correctly.


These are techniques of the 80s and 90s
(which proves my point). CART is in rpart and
an implementation of C4.5 can be accessed
through RWeka. For the oldest one (CHAID, 1980),
there might be an implementation soon:

http://r-forge.r-project.org/projects/chaid/

but again there have been quite some improvements
in the last decade as well:

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

HTH,
Tobias


On Fri, Jun 19, 2009 at 2:35 PM, Carlos J. Gil
Bellosta wrote:

Dear R-helpers,

I had a conversation with a guy working in a "business intelligence"
department at a major Spanish bank. They rely on recursive partitioning
methods to rank customers according to certain criteria.

They use both SAS EM and Salford Systems' CART. I have used package R
part in the past, but I could not provide any kind of feature comparison
or the like as I have no access to any installation of the first two
proprietary products.

Has anybody experience with them? Is there any public benchmark
available? Is there any very good --although solely technical-- reason
to pay hefty software licences? How would the algorithms implemented in
rpart compare to those in SAS and/or CART?

Best regards,

Carlos J. Gil Bellosta
http://www.datanalytics.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-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] bivariate time series

2009-06-19 Thread Erin Hodgess
Dear R People:

Does anyone have any "real world" bivariate time series that I could
use for testing purposes, please?

thanks,
Erin


-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.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] Recursive partitioning algorithms in R vs. alia

2009-06-19 Thread Wensui Liu
in terms of the richness of features and ability to handle large
data(which is normal in bank), SAS EM should be on top of others.
however, it is not cheap.
in terms of algorithm, split procedure in sas em can do
chaid/cart/c4.5, if i remember correctly.

On Fri, Jun 19, 2009 at 2:35 PM, Carlos J. Gil
Bellosta wrote:
> Dear R-helpers,
>
> I had a conversation with a guy working in a "business intelligence"
> department at a major Spanish bank. They rely on recursive partitioning
> methods to rank customers according to certain criteria.
>
> They use both SAS EM and Salford Systems' CART. I have used package R
> part in the past, but I could not provide any kind of feature comparison
> or the like as I have no access to any installation of the first two
> proprietary products.
>
> Has anybody experience with them? Is there any public benchmark
> available? Is there any very good --although solely technical-- reason
> to pay hefty software licences? How would the algorithms implemented in
> rpart compare to those in SAS and/or CART?
>
> Best regards,
>
> Carlos J. Gil Bellosta
> http://www.datanalytics.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.
>



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

__
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] Recursive partitioning algorithms in R vs. alia

2009-06-19 Thread Peter Flom
"Carlos J. Gil Bellosta"  wrote
>
>I had a conversation with a guy working in a "business intelligence"
>department at a major Spanish bank. They rely on recursive partitioning
>methods to rank customers according to certain criteria. 
>
>They use both SAS EM and Salford Systems' CART. I have used package R
>part in the past, but I could not provide any kind of feature comparison
>or the like as I have no access to any installation of the first two
>proprietary products.
>
>Has anybody experience with them? Is there any public benchmark
>available? Is there any very good --although solely technical-- reason
>to pay hefty software licences? How would the algorithms implemented in
>rpart compare to those in SAS and/or CART?
>
>Best regards,
>

Hi

I've used CART and a few different R packages - tree, rpart, rparty.

I can't comment on the algorithms - I'm not qualified to judge, and I think
the ones in CART are proprietary.

One big difference is that the output from CART is beautiful with
minimal fuss.  Presentation quality, multicolor, multipage tree diagrams
with the default settings.

Another was speed - I am not sure I was doing everything right in R, but
for one problem I had that had about 500 variables, R was quite slow, and CART
blitzed through it.

Another big difference is the price.  I got CART for a reasonable fee, as 
I was working at a university, but the commercial price is very high (well into
the thousands of dollars, if I recall correctly).

Peter


Peter L. Flom, PhD
Statistical Consultant
www DOT peterflomconsulting DOT 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] typo in Lomb-Scargle periodogram implementation in spec.ls() from cts package?

2009-06-19 Thread Mikhail Titov
Hello!

I tried to contact author of the package, but I got no reply. That is why I 
write it here. This might be useful for those who were using cts for spectral 
analysis of non-uniformly spaced data.

In file spec.ls.R from cts_1.0-1.tar.gz lines 59-60 are written as

pgram[k, i, j] <- 0.5 * ((sum(x[1:length(ti)]* cos(2 * pi * freq.temp[k] * (ti 
- tao^2/sum((cos(2 * 
pi * freq.temp[k] * (ti - tao)))^2) + (sum(x[1:length(ti)] *  sin(2 * pi * 
freq.temp[k] * (ti - tao^2 ===> ) <=== /sum((sin(2 * pi * freq.temp[k] * 
(ti - tao)))^2)

Is there a misplaced bracket (shown like ===> ) <===)? Should it be like the 
following?

pgram[k, i, j] <- 0.5 * ((sum(x[1:length(ti)]* cos(2 * pi * freq.temp[k] * (ti 
- tao^2/sum((cos(2 * 
pi * freq.temp[k] * (ti - tao)))^2) + (sum(x[1:length(ti)] *  sin(2 * pi * 
freq.temp[k] * (ti - tao^2/sum((sin(2 * pi * freq.temp[k] * (ti - tao)))^2) 
===> ) <===


Here is quick reference 
http://en.wikipedia.org/wiki/Least-squares_spectral_analysis#The_Lomb.E2.80.93Scargle_periodogram
 . One half coefficient was not applied to entire expression.

Also I find weird next lines (61-62)

pgram[1, i, j] <- 0.5 * (pgram[2, i, j] + pgram[N, i, j])

First of all, such things should not be in the for loop. Second, I don't quite 
understand the meaning of it.

P.S. Should I use tapering of my data? If I just try to fit sine and cosine, I 
may not use it, however for FFT windowing is a must. What about Lomb-Scargle?

Mikhail

__
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] Recursive partitioning algorithms in R vs. alia

2009-06-19 Thread Carlos J. Gil Bellosta
Dear R-helpers,

I had a conversation with a guy working in a "business intelligence"
department at a major Spanish bank. They rely on recursive partitioning
methods to rank customers according to certain criteria. 

They use both SAS EM and Salford Systems' CART. I have used package R
part in the past, but I could not provide any kind of feature comparison
or the like as I have no access to any installation of the first two
proprietary products.

Has anybody experience with them? Is there any public benchmark
available? Is there any very good --although solely technical-- reason
to pay hefty software licences? How would the algorithms implemented in
rpart compare to those in SAS and/or CART?

Best regards,

Carlos J. Gil Bellosta
http://www.datanalytics.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] good boosting tutorial and package in R?

2009-06-19 Thread Gabor Grothendieck
See

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

On Fri, Jun 19, 2009 at 1:24 PM, Michael wrote:
> Hi all,
>
> Could you please give me some pointers about what's the best boosting
> package in R currently?
>
> in terms of classification accuracy?
>
> And any pointers about tutorials and study-materials to curb the
> learning curve will be greatly appreciated!
>
> Thank you!
>
> p.s. Does anybody happen to know Boosting implemented in other
> language such as Matlab?
>
> Are they good in terms of accuracy?
>
> What are the other competing tools for classification?
>
> Any literature paper/tutorial on comparisons?
>
> Thank you!
>
> __
> 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] good boosting tutorial and package in R?

2009-06-19 Thread Mose
You'd probably get a kick out of the CARET package documentation (and
the package).

http://cran.r-project.org/web/packages/caret/index.html


On Fri, Jun 19, 2009 at 10:24 AM, Michael wrote:
> Hi all,
>
> Could you please give me some pointers about what's the best boosting
> package in R currently?
>
> in terms of classification accuracy?
>
> And any pointers about tutorials and study-materials to curb the
> learning curve will be greatly appreciated!
>
> Thank you!
>
> p.s. Does anybody happen to know Boosting implemented in other
> language such as Matlab?
>
> Are they good in terms of accuracy?
>
> What are the other competing tools for classification?
>
> Any literature paper/tutorial on comparisons?
>
> Thank you!
>
> __
> 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] Adding site id to xyplot

2009-06-19 Thread Deepayan Sarkar
On 6/19/09, SEUNG CHEON HONG  wrote:
> Dear R Lists,
>
>  Can anyone help me add site IDs (site: 1~50) directly to my xyplot. I have 
> 50 sites and collected observations from the sites at 13 different time 
> points. I want to look at the change of my observations in each site. I was 
> able to make a graph using xyplot, however, I can't find how to add site IDs 
> within the graph not adding them in the legend. Overall, I would like to be 
> able to recognize lines matching respective site IDs.
>
>  Here is the code (source: MASS) I used below:
>
>  library(lattice)
>  sps <- trellis.par.get("superpose.symbol")
>  sps$pch <- 1:13
>  trellis.par.set("superpose.symbol", sps)
>  xyplot(CADapt~Date, data= omni.sb08, groups=Plot2,
> panel = panel.superpose, type="b"
>  )

Have you tried adding 'auto.key=TRUE' to your call? If that is along
the lines of what you were hoping for, read the entries for 'key' and
'auto.key' in ?xyplot for details.

-Deepayan

__
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] lattice: axis ticks, axis alignment and remove axis from plot

2009-06-19 Thread Deepayan Sarkar
On 6/18/09, Katharina May  wrote:
> Hi Sorn,
>
>  thanks for your code. I guess I didn't really made myself very clear.
>  What I sort of looking for is a xyplot with both the x axis at the bottom
>  and y axis at the
>  left going through 0, but continuing  in the positive and negative area
>  (forming a kind of cross
>  like e.g.
>  
> http://upload.wikimedia.org/wikipedia/commons/thumb/2/2c/Erf_plot.svg/600px-Erf_plot.svg.png
>
>  I'm not sure if this possible at all or if I just have to add to reference
>  lines at x=0 and y =0 as a
>  workaround even though not fully satisfying...?

Sounds like you want something similar to

xyplot(..., scales = list(draw = FALSE))

or

xyplot(..., scales = list(y = list(draw = FALSE)))

(if you only want to omit the y-axis).

As for drawing the axis inside, you will need to do that explicitly
using a panel function.

-Deepayan

__
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] lattice logaritmic scale (basis "e" ), rewriting labels using xscale.component

2009-06-19 Thread Deepayan Sarkar
On 6/18/09, Katharina May  wrote:
> Hi there,
>
>  sorry for troubling everybody once again, I've got a problem rewriting
>  Sarkar's function for
>  rewriting the tick locations in a logaritmic way (s.
>  http://lmdvr.r-forge.r-project.org/code/Chapter08.R):
>
>  His example works for log 2 but I need log e (natural logarithm). My
>  problem is that if I replace
>  2 with "e" (using paste()), I get the error message that the location
>  isn't a numeric value.

R doesn't have a constant that represents e, but

  tick.at <- logTicks(exp(lim), loc = c(1, 3))

instead of

  tick.at <- logTicks(paste("e^",lim,sep=""), loc = c(1, 3))

should give you e^lim. Or, if it makes it easier,

  e <- exp(1)
  tick.at <- logTicks(e^lim, loc = c(1, 3))

I don't think you need to change the logTicks function.

-Deepayan

>  Is there any way to get this working somehow or do I have to take a
>  different approach?
>
>  Thanks, Katharina
>
>  Here my failing approach:
>
>  require(lattice)
>  data(Earthquake, package = "MEMSS")
>
>  xscale.components.log <- function(lim, ...) {
> ans <- xscale.components.default(lim = lim, ...)
> tick.at <- logTicks(paste("e^",lim,sep=""), loc = c(1, 3))
> ans$bottom$ticks$at <- log(tick.at, 2)
> ans$bottom$labels$at <- log(tick.at, 2)
> ans$bottom$labels$labels <- as.character(tick.at)
> ans
>  }
>
>  logTicks <- function (lim, loc = c(1, 5)) {
> ii <- floor(log(range(lim))) + c(-1, 2)
> main <- paste("e^",(ii[1]:ii[2]),sep="")
> r <- as.numeric(outer(loc, main, "*"))
> r[lim[1] <= r & r <= lim[2]]
>  }
>  xyplot(accel ~ distance, data=Earthquake, scales = list(log = "e"),
>  xscale.components = xscale.components.log,
>
>
>
>
>  Here is the original  code of Sarkar:
>
>  logTicks <- function (lim, loc = c(1, 5)) {
> ii <- floor(log10(range(lim))) + c(-1, 2)
> main <- 10^(ii[1]:ii[2])
> r <- as.numeric(outer(loc, main, "*"))
> r[lim[1] <= r & r <= lim[2]]
>  }
>  xscale.components.log2 <- function(lim, ...) {
> ans <- xscale.components.default(lim = lim, ...)
> tick.at <- logTicks(2^lim, loc = c(1, 3))
> ans$bottom$ticks$at <- log(tick.at, 2)
> ans$bottom$labels$at <- log(tick.at, 2)
> ans$bottom$labels$labels <- as.character(tick.at)
> ans
>  }
>
>  __
>  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] good boosting tutorial and package in R?

2009-06-19 Thread Michael
Hi all,

Could you please give me some pointers about what's the best boosting
package in R currently?

in terms of classification accuracy?

And any pointers about tutorials and study-materials to curb the
learning curve will be greatly appreciated!

Thank you!

p.s. Does anybody happen to know Boosting implemented in other
language such as Matlab?

Are they good in terms of accuracy?

What are the other competing tools for classification?

Any literature paper/tutorial on comparisons?

Thank you!

__
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] biOps load failed after being used for one week

2009-06-19 Thread Michelle2009

Thank you Uwe Ligges!

I had libtiff3.dll in the path. I aslo tested to put libtiff.dll in the path
without zlib1.dll, it didn't work. When I put zlib1.dll in the path, it
works.

Michelle

Uwe Ligges-3 wrote:
> 
> 
> 
> Michelle2009 wrote:
>> With help from my colleague, I found the problem. After I put another
>> library
>> dll, zlib1.dll, at the folder, biOps is working again now. Though it's
>> still
>> amazing to me why biOps worked for about one week before I had zlib1.dll.
> 
> 
> Have you had a libtiff in your path? Its Windows binaries come with a 
> zlib1.dll hence should be found.
> 
> Best,
> Uwe Ligges
> 
> 
> 
> 
>> I hope message could also help people who have the same problem.
>> 
>> Thanks,
>> 
>> Michelle
>> 
>> Michelle2009 wrote:
>>> Hi,
>>>
>>> I installed biOps on my XP, and installed the required dll packages,
>>> jpeg62.dll, libfftw3-3.dll, and libtiff3.dll, as suggested by this
>>> forum.
>>> Then it worked perfectly for about one week till this afternoon. When I
>>> tried to load biOps again, I got the following error message again
>>>
>>> Error in inDL(x, as.logical(local), as.logical(now), ...) : 
>>>   unable to load shared library
>>> 'C:/PROGRA~1/R/R-29~1.0/library/biOps/libs/biOps.dll':
>>>   LoadLibrary failure:  The specified module could not be found.
>>>
>>>
>>> Error: package/namespace load failed for 'biOps'
>>>
>>> I saw the same error message before I installded the above three dll
>>> files. Then I checked the dll files, they are still there. I checked the
>>> PATH, and the PATH includes the path to the folder where I put the dll
>>> files. 
>>>
>>> It's very amazing to me, since biOps worked on the same computer for
>>> about
>>> one week till this afternoon. Then I tried to install biOps on my
>>> another
>>> laptop with the three dll files installed, and biOpst does not work on
>>> my
>>> laptop this time.
>>>
>>> Does any of you have any idea or suggestions? I even re-downloaded the
>>> three dll files from the websites in case the three I have were
>>> contaminated somehow.
>>>
>>> Any help if greatly appreciated!
>>>
>>> Michelle
>>>
>>>
>>
> 
> __
> 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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/biOps-load-failed-after-being-used-for-one-week-tp24095333p24115530.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.


Re: [R] Unable to use jpeg(), png() etc.....

2009-06-19 Thread Uwe Ligges

Have you compiled R yourself?
If so, you probably have the header files for png and friends support 
not installed. If you have a binary install, the one who compiled R for 
you have not had it.


Uwe Ligges



Martial Sankar wrote:
Hello, 


I 've just re-installed R 2.9.0 on ubuntu 9.04.

I do not understand why I am unable to use simple device function such as 
jpeg(), png()...


png()
Error in X11(paste("png::", filename, sep = ""), width, height, pointsize,  : 
  unable to start device PNG

In addition: Warning message:
In png() : no png support in this version of R



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


It's not really a problem because i use cairo but i would like to know the 
source of this error.

I checked the library as proposed in previous post : 


https://stat.ethz.ch/pipermail/r-help/2005-December/085177.html

but all of them (libpng, libjpeg...) are already installed.

Did someone ever find the source of this R Error ?

Thanks !

- Martial



_

? Lancez-vous !

[[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] question about adding plots in a grid (lattice package)

2009-06-19 Thread Deepayan Sarkar
On 6/16/09, Marion Dumas  wrote:
> Hello!
>  I am starting to use the lattice package. I generated an xyplot conditioned
> on a factor that has three levels: hence I get three plots in three panels
> spaces and one is left empty. I would like to add a plot to the empty panel
> space. Is it possible?

Yes. The easiest way depends on what you would like to add. If it's
another lattice plot, then use the 'split' or 'position' arguments in
?print.trellis. More generally, you can set up a grid viewport there
and add whatever you need (for base graphics, you would need the
gridBase package).

-Deepayan

__
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] re ad.table() and setwd() in unix batch mode

2009-06-19 Thread Uwe Ligges



tbigdeli wrote:

My apologies for being overly brief before..

I submit an R script to batch mode as follows:

a list of files (object = 'files').  In each iteration, the next file is
read, alterations made, working directory changed, and output file written
out.  R will take an inordinate amount of time processing the first file,
after which no files seem to be read-in.  For batch mode, are my paths
inappropriate?  Thanks!

setwd("/home/bigdelitb/chr20/merlin/sim/d5/ped")
files<-read.table("d5.rf.list",stringsAsFactors=FALSE)

for(i in 1:length(files$V1)){
setwd("/home/bigdelitb/chr20/merlin/sim/d5/ped")
count <- 1
name<-files$V1[i]
ped <- read.table(name,header=FALSE,stringsAsFactors=FALSE)
...
...
setwd("/home/bigdelitb/chr20/merlin/sim/d5/ped/pdt/")
write.table(ped,name,quote=FALSE,..)
}




1. This should do the same for interactive and batch mode given the 
relevant things are not hidden in "...".

2. You are running both inteactive and batch under the same user?
3. Why do you change working directories all the time, you could give 
full path names instead.
4.  1:length(files$V1) is dangerous in loops (if length becomes 0), 
hence use  seq_along(files$V1)


Uwe Ligges






Uwe Ligges-3 wrote:



tbigdeli wrote:

I continually receive the error

Error in file(file, "r") : cannot open the connection, when running in
batch
mode, but not when inputing directly into R. 

Have you given the full path name?
If not, do you start both R instances from the same working directory?

Otherwise, do you have the same credentials in both cases?

Uwe Ligges






Any ideas?

Thanks!

TB

__
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] Sweave and xtable floating issues -- SOLVED

2009-06-19 Thread Liviu Andronic
Dear all,
I've recently made in LyX a report using Sweave and run into troubles
with xtable() generated LaTeX tables. One example, xtable() commands
inside floats (table, box (minipage), etc.) will make the LaTeX
compilation fail. Another, if four-five xtable() commands are run in a
sequence, at least one of the generated tables will strangely hop onto
the next page.

The culprit is that print.xtable() defaults to floating=TRUE, which
means that each xtable() generated table will be a float. To work
around any such issues instead of
> xtable(as.matrix(mean(c(1:10

simply issue
> print(xtable(as.matrix(mean(c(1:10, floating=F)

If you do so, you might also want to center the command in LaTeX (as
xtable() no longer does this). Hope this is of help,
Liviu



-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail

__
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] problem with axis alignment when plotting 2 time series on same graph

2009-06-19 Thread Uwe Ligges



josef.kar...@phila.gov wrote:
I am trying to plot 2 time series on the same graph. 
For example, X1 is the vector of dates and times, its class is POSIXt. Y1 
is an environmental parameter, e.g. salinity. X2 is a second vector of 
dates and times, also of class POSIXt.X2 has a different length than 
X1, but they have  the exact same range.  Y2 is another environmental 
parameter, e.g. stream flow rate.


My approach is basically like this:
plot(X1,Y1)
par(xaxs = "r")
plot(X1, Y1)
par(new=TRUE)
plot(X2, Y2)


You probably want to use lines() to add the second time series if the 
dates in X1 and X2 are not of identical range.


Uwe Ligges



the result is that the date tick marks for the second graph do not exactly 
align with the first graph. This is because the second time series is 
being slightly 'squeezed'; its timescale should match the first graph but 
for some reason R is plotting it on a smaller scale. 
The strange thing is that this doesn't happen for all time series I plot. 
For example X3 and Y3 which have the same basic characteristics as X2 and 
Y2, overlay perfectly with X1 and Y1. I don't know why it works for some 
but not others.


I also tried setting xaxs to "i" -- and had the same outcome. Also had the 
same outcome when trying either  par(xaxs="i") or par(xaxs="r") after the 
command par(new=TRUE)


Any insights would be appreciated

JK
[[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] paramter restriction in optim

2009-06-19 Thread Uwe Ligges



laist wrote:

Hi,

I would like to know if you could help me... I need to restrict a parameter
in a problem of optimization but I don't know how to do it.

function(s){
c<-s[1]
a1<-s[2]
a2<-s[2]

return(-sum())
}

optim(...)

In fact I need to know how to specify 0<=a1<=1. I've tried but without
success



In optim "L-BFGS-B" is a method that allows for box constraints. See its 
help page or provide a full example that we can use in order to give an 
example with your data / function different from those in ?optim.


Uwe Ligges








Thank you 



__
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] re ad.table() and setwd() in unix batch mode

2009-06-19 Thread tbigdeli

My apologies for being overly brief before..

I submit an R script to batch mode as follows:

a list of files (object = 'files').  In each iteration, the next file is
read, alterations made, working directory changed, and output file written
out.  R will take an inordinate amount of time processing the first file,
after which no files seem to be read-in.  For batch mode, are my paths
inappropriate?  Thanks!

setwd("/home/bigdelitb/chr20/merlin/sim/d5/ped")
files<-read.table("d5.rf.list",stringsAsFactors=FALSE)

for(i in 1:length(files$V1)){
setwd("/home/bigdelitb/chr20/merlin/sim/d5/ped")
count <- 1
name<-files$V1[i]
ped <- read.table(name,header=FALSE,stringsAsFactors=FALSE)
...
...
setwd("/home/bigdelitb/chr20/merlin/sim/d5/ped/pdt/")
write.table(ped,name,quote=FALSE,..)
}

Uwe Ligges-3 wrote:
> 
> 
> 
> tbigdeli wrote:
>> I continually receive the error
>> 
>> Error in file(file, "r") : cannot open the connection, when running in
>> batch
>> mode, but not when inputing directly into R. 
> 
> Have you given the full path name?
> If not, do you start both R instances from the same working directory?
> 
> Otherwise, do you have the same credentials in both cases?
> 
> Uwe Ligges
> 
> 
> 
> 
> 
>> 
>> Any ideas?
>> 
>> Thanks!
>> 
>> TB
> 
> __
> 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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/read.table%28%29-and-setwd%28%29-in-unix-batch-mode-tp24107008p24114888.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.


Re: [R] a plot of stacked boxes

2009-06-19 Thread David Winsemius

Perhaps this package can help:

http://cran.r-project.org/web/packages/vcd/index.html

Page 4 of this vignette looks like a complete solutions has already  
been programmed:


http://cran.r-project.org/web/packages/vcd/vignettes/residual-shadings.pdf

--

On Jun 19, 2009, at 12:41 PM, Osman Al-Radi wrote:


Hello,

I would like to create a plot composed of stacked boxes (squares or
rectangles), where the size of the box would represent the frequency  
of

observations based on a categorical variable (group), the color would
represent the proportion of success (binary) within that group  
(outcome) on

a predetermined color scale. Ideally the boxes can be stacked from the
bottom left to the top right based on size. The x and y scales are not
informative. I am experimenting with the rect() function and loops  
but I

wasn't able to generate an appealing graph.

Thanks

Osman

Here is simulated data set

group<-rep(c('a','b','c','d','e','f','g'),c(100,20,300,40,2,10,40))

outcome<-c(sample(c(0,1),100,rep=T,p=c(0.98,0.02)),

sample(c(0,1),20,rep=T,p=c(0.9,0.1)),

sample(c(0,1),300,rep=T,p=c(0.99,0.01)),

 sample(c(0,1),40,rep=T,p=c(0.95,0.05)),

  sample(c(0,1),2,rep=T,p=c(0.5,0.5)),

   sample(c(0,1),10,rep=T,p=c(0.9,0.1)),

sample(c(0,1),40,rep=T,p=c(0.8,0.2)))

df<-data.frame(group=group,outcome=as.numeric(outcome))


Osman O. Al-Radi, MD, MSc, FRCSC
Staff Cardiovascular Surgeon
Co-medical director, Tissue Bank
The Hospital for Sick Children
University of Toronto, Canada-


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] getting cd_plot in vcd package to work with layout

2009-06-19 Thread Uwe Ligges



Lyndon Walker wrote:

Hi,
I'm trying to get 2x2 (or other layouts) of cd_plot from the vcd package.  I
have tried the usual commands like layout, par(mfrow...) etc and but cd_plot
seems to ignore them and send the plotting window back to 1x1.  I have also
tried turning off the pop and newpage options in cd_plot but I still can't
get multiple cd_plots into a plotting window.

Any suggestions would be greatly appreciated.


This is because cd_plot() uses the grid framework rather than the R base 
graphics system. Hence use it inside a grid viewport.


Example:

library("vcd")
pushViewport(vp <- viewport(x = 0.25, y = 0.5,
   w = 0.5, h = 1))
cd_plot(Improved ~ Age, data = Arthritis, newpage=FALSE)
popViewport()
pushViewport(vp <- viewport(x = 0.75, y = 0.5,
   w = 0.5, h = 1))
cd_plot(Improved ~ Age, data = Arthritis, newpage=FALSE)
popViewport()

Uwe Ligges






cheers
Lyndon

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


[R] a plot of stacked boxes

2009-06-19 Thread Osman Al-Radi
Hello,

I would like to create a plot composed of stacked boxes (squares or
rectangles), where the size of the box would represent the frequency of
observations based on a categorical variable (group), the color would
represent the proportion of success (binary) within that group (outcome) on
a predetermined color scale. Ideally the boxes can be stacked from the
bottom left to the top right based on size. The x and y scales are not
informative. I am experimenting with the rect() function and loops but I
wasn't able to generate an appealing graph.

Thanks

Osman

Here is simulated data set

group<-rep(c('a','b','c','d','e','f','g'),c(100,20,300,40,2,10,40))

outcome<-c(sample(c(0,1),100,rep=T,p=c(0.98,0.02)),

sample(c(0,1),20,rep=T,p=c(0.9,0.1)),

 sample(c(0,1),300,rep=T,p=c(0.99,0.01)),

  sample(c(0,1),40,rep=T,p=c(0.95,0.05)),

   sample(c(0,1),2,rep=T,p=c(0.5,0.5)),

sample(c(0,1),10,rep=T,p=c(0.9,0.1)),

 sample(c(0,1),40,rep=T,p=c(0.8,0.2)))

df<-data.frame(group=group,outcome=as.numeric(outcome))








Osman O. Al-Radi, MD, MSc, FRCSC
Staff Cardiovascular Surgeon
Co-medical director, Tissue Bank
The Hospital for Sick Children
University of Toronto, Canada

[[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] IP-Address

2009-06-19 Thread David Huffer
On Wednesday, June 17, 2009 3:33 PM, edwin wrote:

 > Sorry, David has just told my that it was a mistake in my
 > example (Thanks David). I had a wrong idea. The right idea is:
 > make a ip range, when the number increament without an gap (and
 > with maximum number: 255, see example down).
 > In case my initial example would be:
 >  162.131.58.1
 >  162.131.58.2
 >  162.131.58.3
 >  162.131.58.4
 >  162.131.58.5
 >  162.131.58.6
 > The Range is: 162.131.58.1 - 162.131.58.6
 >  162.132.58.20
 > 162.132.58.20 (no range)
 >  162.252.20.21
 > 162.252.20.21 (no range)
 >  162.254.20.22
 > 162.254.20.22 (no range)
 >  163.253.7.23
 > 163.253.7.23 (no range)
 >  163.253.20.25
 > 163.253.20.25 (no range)
 >  161.138.45.226
 > 161.138.45.226 (no range)
 > Another example: [...]

Edwin, here's a function that does what you want. it probably
doesn't return the ranges the way you'll need them, but you can
play around with that part:

  iprange <- function ( x ) {
ip.set  <- x
ip <- do.call (
  rbind
  , lapply (
ip.set
, function ( x ) {
  as.numeric (
unlist (
  strsplit (
as.character ( x )
, split = "."
, fixed = TRUE
  )
)
  )
}
  )
)
ip <- cbind (
  ip
  , ip [ , 1 ] * 256^3
+ ip [ , 2 ] * 256^2
+ ip [ , 3 ] * 256
+ ip [ , 4 ]
)
ip.set <- ip.set [ order ( ip [ , 5] ) ]
ip <- ip [ order ( ip [ , 5] ) , ]
index.start <- which ( c ( -Inf , diff ( ip [ , 5] ) ) != 1 )
index.end <- c ( index.start [-1] - 1 , tail ( index.start , 1 ) )
iprange <- cbind (
  ip.set [ index.start ]
  , ifelse ( ip.set [ index.start ] == ip.set [ index.end ] , NA , ip.set [ 
index.end ] )
)
cat ("ip addresses:\n")
cat (
  ip.set
  , sep = "\n"
)
cat ("\nip ranges:\n")
cat (
  paste (
ip.set [ index.start ]
, ifelse (
  ip.set [ index.start ] == ip.set [ index.end ]
  , "(no range)"
  , paste (
"to"
, ip.set [ index.end ]
  )
)
  )
  , sep = "\n"
)
invisible ( iprange )
  }

  test <- iprange (
c (
  "162.131.58.1" , "163.253.7.23"
  , "162.131.58.2" , "163.253.20.25"
  , "162.131.58.3" , "161.138.45.226"
  , "162.131.58.4" , "169.131.58.1"
  , "162.131.58.5" , "169.131.58.2"
  , "162.131.58.6" , "169.132.58.3"
  , "162.132.58.20" , "250.131.58.4"
  , "162.252.20.21" , "250.131.58.5"
  , "162.254.20.22" , "250.131.58.7"
)
  )

  test

HTH

--
 David
 
 -
 David Huffer, Ph.D.   Senior Statistician
 CSOSA/Washington, DC   david.huf...@csosa.gov

__
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] Fancy Ticks in Plots

2009-06-19 Thread David Winsemius


On Jun 19, 2009, at 11:58 AM, Lorenzo Isella wrote:


Dear All,
I am pretty satisfied with R for my plotting, but there are a few  
subtleties which I cannot figure out.

Consider figure 1 in the paper at the link below

http://cxnets.googlepages.com/univ_citations.pdf


Like this?

http://dsarkar.fhcrc.org/lattice/book/images/Figure_08_05_stdBW.png

See the code that the author has placed at an R-project  website:

http://lmdvr.r-forge.r-project.org/





Can I have the same kind of ticks in an R-generated figure (that is  
to say: ticks along the 4 axis, and in a log-log plot I'd like a  
larger tick for any power of 10).
I did a bit of googling, but I was not able to come across what I  
wanted.

Any suggestions/examples are welcome.
Cheers

Lorenzo



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] reducing space between tickmark labels and axes labels

2009-06-19 Thread Uwe Ligges



Eva Schultner wrote:

Hello,

Does anybody know if it is possible to reduce the spaces between axes labels 
and axes lables in boxplots?


One way is to omit them at first and put them into the desired margin 
line with a call to mtext() later on.


Uwe Ligges


 I am trying to fit several plots onto one page ( layout() ) and need 
to save as much space as possible. I have reduced margins 
(par(mar)),adjusted font size (cex) and tck, is there anything else I 
can do?

Thank you



  
	[[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] resampling the entire row

2009-06-19 Thread Chuck Cleland
On 6/19/2009 10:59 AM, Seunghee Baek wrote:
> Hi,
> For bootstrapping method, I would like to resample the entire row instead of 
> one column.
> What should I do?

iris[sample(x=nrow(iris), replace=TRUE),]

  But I would look at the boot package or other packages related to
bootstrapping.

> Thanks,
> Becky
> 
> __
> 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. 

-- 
Chuck Cleland, Ph.D.
NDRI, Inc. (www.ndri.org)
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
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] hands-on book on multivariate statistics and data-mining with R?

2009-06-19 Thread Uwe Ligges



Michael wrote:

Hi all,

I am looking for pointers to good hands-on books on multivariate
statistics and data-mining with R? So that I could learn while doing
experiments...



Most of the times it is advisable to get a good book about the 
statistical concepts (multivariate statistics or data-mining) and 
another good book about the programming language (R), if you have an 
idea how the concepts work, it is really easy to combine.


Uwe Ligges





Thanks a lot!

__
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] Leave One Out Cross Validation

2009-06-19 Thread Uwe Ligges

See the posting guide:
If you provide commented, minimal, self-contained, reproducible code 
some people may be willing to help on the list.


Best,
Uwe Ligges


muddz wrote:

Hi All,

I have been trying to get this LOO-Cross Validation method to work on R for
the past 3 weeks but have had no luck. I am hoping someone would kindly help
me. 


Essentially I want to code the LOO-Cross Validation for the 'Local Constant'
and 'Local Linear' constant estimators. I want to find optimal h, bandwidth.

Thank you very much!
-M




__
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] searching help for partial matches

2009-06-19 Thread Uwe Ligges

Double the question mark as in:

??allequal

Uwe Ligges



Steve Jaffe wrote:

The situation is that I know there is a function and know approximately what
the name is, and want to find the exact name. Is there a way of searching
for near-matches (similar to unix apropos). For example, I know there is a
function called something like allequal (or allequals or AllEquals or...).
But ?allequal, etc, return nothing, only if I remember the name can I get
help via ?all.equal. 


Thanks


__
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] reading geotiff into Splus or R

2009-06-19 Thread B. H. Braswell


Hi Scott,

Have you tried rgdal? http://cran.r-project.org/web/packages/rgdal/index.html

Rob
--
Rob Braswell
University of New Hampshire

On Jun 19, 2009, at 10:48 AM, Scott Saleska wrote:



I am looking for an easy way to import data in a GEOTIFF file into  
Splus or R.  Any suggestions?


Thanks,
Scott

Scott R. Saleska

Assistant Professor, Ecology and Evolutionary Biology
Director, PIRE Program in Amazon-Climate Interactions
University of Arizona
1041 E. Lowell St.
BioSciences West, Room 510
Tucson, AZ 85721

(520) 626-1500 (voice)
(520) 621-9190 (FAX)
sale...@email.arizona.edu

Amazon PIRE program:  http://www.eebweb.arizona.edu/pire_amazonia/
Personal web page:  http://eebweb.arizona.edu/faculty/saleska/

__
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] reading geotiff into Splus or R

2009-06-19 Thread Scott Saleska


I am looking for an easy way to import data in a GEOTIFF file into Splus or 
R.  Any suggestions?


Thanks,
Scott

Scott R. Saleska

Assistant Professor, Ecology and Evolutionary Biology
Director, PIRE Program in Amazon-Climate Interactions
University of Arizona
1041 E. Lowell St.
BioSciences West, Room 510
Tucson, AZ 85721

(520) 626-1500 (voice)
(520) 621-9190 (FAX)
sale...@email.arizona.edu

Amazon PIRE program:  http://www.eebweb.arizona.edu/pire_amazonia/
Personal web page:  http://eebweb.arizona.edu/faculty/saleska/

__
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] a plot of stacked boxes

2009-06-19 Thread Osman Al-Radi
Hello,

I would like to create a plot composed of stacked boxes (squares or
rectangles), where the size of the box would represent the frequency of
observations based on a categorical variable (group), the color would
represent the proportion of success (binary) within that group (outcome) on
a predetermined color scale. Ideally the boxes can be stacked from the
bottom left to the top right based on size. The x and y scales are not
informative. I am experimenting with the rect() function and loops but I
wasn't able to generate an appealing graph.

Thanks

Osman

Here is simulated data set

group<-rep(c('a','b','c','d','e','f','g'),c(100,20,300,40,2,10,40))

outcome<-c(sample(c(0,1),100,rep=T,p=c(0.98,0.02)),

sample(c(0,1),20,rep=T,p=c(0.9,0.1)),

 sample(c(0,1),300,rep=T,p=c(0.99,0.01)),

  sample(c(0,1),40,rep=T,p=c(0.95,0.05)),

   sample(c(0,1),2,rep=T,p=c(0.5,0.5)),

sample(c(0,1),10,rep=T,p=c(0.9,0.1)),

 sample(c(0,1),40,rep=T,p=c(0.8,0.2)))

df<-data.frame(group=group,outcome=as.numeric(outcome))








Osman O. Al-Radi, MD, MSc, FRCSC
Staff Cardiovascular Surgeon
Co-medical director, Tissue Bank
The Hospital for Sick Children
University of Toronto, Canada

[[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] paramter restriction in optim

2009-06-19 Thread laist

Hi,

I would like to know if you could help me... I need to restrict a parameter
in a problem of optimization but I don't know how to do it.

function(s){
c<-s[1]
a1<-s[2]
a2<-s[2]

return(-sum())
}

optim(...)

In fact I need to know how to specify 0<=a1<=1. I've tried but without
success

Thank you 

-- 
View this message in context: 
http://www.nabble.com/paramter-restriction-in-optim-tp24110745p24110745.html
Sent from the R help mailing list archive at Nabble.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] resampling the entire row

2009-06-19 Thread Seunghee Baek
Hi,
For bootstrapping method, I would like to resample the entire row instead of 
one column.
What should I do?

Thanks,
Becky

__
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] Fancy Ticks in Plots

2009-06-19 Thread Lorenzo Isella

Dear All,
I am pretty satisfied with R for my plotting, but there are a few 
subtleties which I cannot figure out.

Consider figure 1 in the paper at the link below

http://cxnets.googlepages.com/univ_citations.pdf

Can I have the same kind of ticks in an R-generated figure (that is to 
say: ticks along the 4 axis, and in a log-log plot I'd like a larger 
tick for any power of 10).

I did a bit of googling, but I was not able to come across what I wanted.
Any suggestions/examples are welcome.
Cheers

Lorenzo

__
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] [Repost][Off Topic] Pointers needed for breakthrough in statistics

2009-06-19 Thread Ravi Varadhan
This gives a failrly long list:

http://www.amazon.com/Books-history-Probability-Statistics/lm/R1WZ9DISAO6OGX
 

Ravi.


---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: rvarad...@jhmi.edu

Webpage:
http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h
tml

 





-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Michael
Sent: Friday, June 19, 2009 10:26 AM
To: r-help
Subject: [R] [Repost][Off Topic] Pointers needed for breakthrough in
statistics

Hi all,

Sorry for the reposting... I was advised to repost this question with more
specific title. I apologize for this off-topic question but I really need
your help -- I know there are lots of experts here.

As a lover and student of statistics, I am thinking of building a tree of
various branches of statistics and keeping track of the greatest historical
inventions/discoveries in statistics and the latest development of each
branch. The goal is to understand in what context did the great inventions
come out and then try to follow the greatest minds in terms of creating
future significant inventions/discoveries in the statistics field... This is
the "learn-from-the-greatest-minds"
approach.

Could anybody give me some pointers about existing books/articles about the
greatest inventions/discoveries in statistics? And topic list? Here the
"statistics" is in the broad sense, including data-mining, complex data-set,
large data-set, etc. We also want to talk about not only the concepts, but
also the tools and methodologies.

Thanks a lot!

__
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] Reading from Google Docs

2009-06-19 Thread Uwe Ligges
See the manual "R Installation and Administration" for information on 
how to install source packages on Windows.


Uwe Ligges

Farrel Buchinsky wrote:

After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an error
message
'tar' is not recongnized as an internal or external command, operable
program or batch file.

Should I use my 7-zip to open up the archive?
Where should I be doing this? For instance can I do it all in my
download directory or should I do it in C:\Program
Files\R\R-2.9.0\library or should I manually create C:\Program
Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will the Rcmd
INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me.

Yes, you assumed correctly. I am using Windows XP.
Farrel Buchinsky
Google Voice Tel: (412) 567-7870



On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck
wrote:


I have haven't neen following this thread but:

1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as
opposed to built source) then the first line renames it so
that its not the same name as the built file about to be created.
The second line detars it into the RGoogleDocs directory.  The third builds
the built source file, RGoogleDocs_0.2-2.tar.gz.  The fourth
installs the built source file into R.  I've assumed Windows.
If you are on Linux replace rename with mv.

rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz
tar xvfz RgoogleDocs_0.2.2-src.tar.gz
Rcmd build RGoogleDocs
Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz

or

2. if RGoogleDocs_0.2-2.tar.gz is already a built source file then you
can just issue the last of the above lines and don't need
the others.

On Thu, Jun 18, 2009 at 7:52 PM, Farrel Buchinsky wrote:

What do you mean by "cd the.directory.containing.RGoogleDocs"
Do you mean the directory where I downloaded the RGoogleDocs_0.2-2.tar.gz
to? Or do you mean that I must create a directory called RGoogleDocs

under

Library and then change to that directory?
Farrel Buchinsky
Google Voice Tel: (412) 567-7870



On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck <

ggrothendi...@gmail.com>

wrote:

Finally enter into the Windows console:

cd the.directory.containing.RGoogleDocs
Rcmd build RGoogleDocs
Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz

except replace RGoogleDocs_1.0.0.tar.gz with the filename
created by the build.


[[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] Alternate ways of finding number of occurrence of an element in a vector.

2009-06-19 Thread Allan Engelhardt
When trying out a couple of different approaches to this problem I get 
rather different answers between runs.  Anybody know why?


> library("rbenchmark")
> v<-rep(1:1000,1:1000); x<-5; benchmark(replications=200, 
columns=c("test","elapsed"), order="elapsed", which=length(which(x==v)), 
index=length(v[v==x]), sum=sum(v==x))

   test elapsed
3   sum   2.513
2 index   5.512
1 which   6.712
> v<-rep(1:1000,1:1000); x<-5; benchmark(replications=200, 
columns=c("test","elapsed"), order="elapsed", which=length(which(x==v)), 
index=length(v[v==x]), sum=sum(v==x))

   test elapsed
3   sum   2.502
2 index   3.779
1 which   6.650
> v<-rep(1:1000,1:1000); x<-5; benchmark(replications=200, 
columns=c("test","elapsed"), order="elapsed", which=length(which(x==v)), 
index=length(v[v==x]), sum=sum(v==x))

   test elapsed
2 index   3.796
3   sum   5.808
1 which   6.633

This pattern appears to repeat (so on the next two runs "sum" will win 
followed by "index" followed by "sum" twice followed by "index" ...)


Allan.




On 19/06/09 14:55, Praveen Surendran wrote:

Hi,



I have a vector "v" and would like to find the number of occurrence of
element "x" in the same.

Is there a way other than,



sum(as.integer(v==x)) or length(which(x==v))



to do the this.



I have a huge file to process and do this.  Both the above described methods
are pretty slow while dealing with a large vector.

Please have your comments.



Praveen Surendran.




[[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] Reading from Google Docs

2009-06-19 Thread Farrel Buchinsky
After issuing tar xvfz RgoogleDocs_0.2.2-src.tar.gzI am getting an error
message
'tar' is not recongnized as an internal or external command, operable
program or batch file.

Should I use my 7-zip to open up the archive?
Where should I be doing this? For instance can I do it all in my
download directory or should I do it in C:\Program
Files\R\R-2.9.0\library or should I manually create C:\Program
Files\R\R-2.9.0\library\RGoogleDocs and do it all there or will the Rcmd
INSTALL RGoogleDocs_0.2-2.tar.gz command do that for me.

Yes, you assumed correctly. I am using Windows XP.
Farrel Buchinsky
Google Voice Tel: (412) 567-7870



On Thu, Jun 18, 2009 at 20:17, Gabor Grothendieck
wrote:

> I have haven't neen following this thread but:
>
> 1. if RGoogleDocs_0.2-2.tar.gz is a source distribution (as
> opposed to built source) then the first line renames it so
> that its not the same name as the built file about to be created.
> The second line detars it into the RGoogleDocs directory.  The third builds
> the built source file, RGoogleDocs_0.2-2.tar.gz.  The fourth
> installs the built source file into R.  I've assumed Windows.
> If you are on Linux replace rename with mv.
>
> rename RGoogleDocs_0.2-2.tar.gz RgoogleDocs_0.2.2-src.tar.gz
> tar xvfz RgoogleDocs_0.2.2-src.tar.gz
> Rcmd build RGoogleDocs
> Rcmd INSTALL RGoogleDocs_0.2-2.tar.gz
>
> or
>
> 2. if RGoogleDocs_0.2-2.tar.gz is already a built source file then you
> can just issue the last of the above lines and don't need
> the others.
>
> On Thu, Jun 18, 2009 at 7:52 PM, Farrel Buchinsky wrote:
> > What do you mean by "cd the.directory.containing.RGoogleDocs"
> > Do you mean the directory where I downloaded the RGoogleDocs_0.2-2.tar.gz
> > to? Or do you mean that I must create a directory called RGoogleDocs
> under
> > Library and then change to that directory?
> > Farrel Buchinsky
> > Google Voice Tel: (412) 567-7870
> >
> >
> >
> > On Mon, Mar 2, 2009 at 22:16, Gabor Grothendieck <
> ggrothendi...@gmail.com>
> > wrote:
> >>
> >> Finally enter into the Windows console:
> >>
> >> cd the.directory.containing.RGoogleDocs
> >> Rcmd build RGoogleDocs
> >> Rcmd INSTALL RGoogleDocs_1.0.0.tar.gz
> >>
> >> except replace RGoogleDocs_1.0.0.tar.gz with the filename
> >> created by the build.
> >
>

[[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] Cannot install a package - with a funny error message

2009-06-19 Thread Uwe Ligges

What's funny with the error message?

I think it is not funny that you have not provided relevant information 
as requestes in the posting guide for R-help, e.g. on: OS, R version, 
CRAN mirror you try to use, internet connection via proxy or not, ...


Hence we cannot help.


Uwe Ligges



Alon Ben-Ari wrote:

Hello
I am trying to install the following package . I am logged in as SU  of
course.
Below is my input and output.
Any ideas?

 install.packages("kernlab")

--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
Error in m[, 1] : incorrect number of dimensions

Best,

Alon

[[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] Random number datasets help

2009-06-19 Thread Alexandre Lockhart

My other question involved formatting my output. Normally, my text file has 8 
columns, each column with 500 values before the next 8 below are generated, and 
so on until 28 are reached.   I have examined formatting issues with each 
function (cbind, sink, apply, trying matrix (only one set is output)) in my 
revised code, but am unable to achieve my wanted output file: 7 columns of 500 
generated values, four different times.  Thank you. 

a1<-c(178.07,178.28,178.08,177.74,177.04,178.17,177.58,57.71,59.6,60.92,59.48,59.32,61.59,59.94,28.9,29.82,30.73,25.68,27.93,28.98,29.76,123.48,127.27,127.8,127.2,127.13,126.71,125.5)
a2<-c(1.69,1.3,1,.18,1.53,1.31,1.35,1.83,1.56,1.12,.74,1.48,1.67,1.53,.95,.87,0.03,1.12,1.95,1.22,1.04,1.64,1.83,1,1,1.08,1.35,2.37)
sink(file='/home/lockhartag/Wim/TRP/output.txt',append=TRUE)
apply(cbind(a1, a2), 1, function(x) rnorm(500, x[1], x[2]))
sink()



> From: marc_schwa...@me.com
> To: jholt...@gmail.com
> Date: Thu, 18 Jun 2009 15:23:06 -0500
> CC: r-help@r-project.org; alexandre_geor...@hotmail.com
> Subject: Re: [R] Random number datasets help
> 
> Quite true Jim, however I focused on his request and not his code,  
> presuming that he did not realize what he was doing as a consequence  
> of the nested loops.
> 
> Perhaps Alexandre can provide clarification?
> 
> Regards,
> 
> Marc
> 
> On Jun 18, 2009, at 2:46 PM, jim holtman wrote:
> 
> > That is not what his 'for' loops are doing.  He is iterating through  
> > all
> > combinations and would have created 784.  So his problem statement  
> > did not
> > match the code that he sent.
> >
> > On Thu, Jun 18, 2009 at 2:12 PM, Marc Schwartz  
> >  wrote:
> >
> >> Alexandre did say 28 datasets, not 784 (28 * 28)
> >>
> >> Thus, either:
> >>
> >> mapply(rnorm, n = 500, mean = a1, sd = a2)
> >>
> >> or
> >>
> >> apply(cbind(a1, a2), 1, function(x) rnorm(500, x[1], x[2]))
> >>
> >>
> >> HTH,
> >>
> >> Marc Schwartz
> >>
> >> On Jun 18, 2009, at 12:51 PM, Henrique Dallazuanna wrote:
> >>
> >> Try this also:
> >>>
> >>> a <- expand.grid(a1, a2)
> >>> x <- mapply(rnorm, n = 500, mean = a[,1], sd = a[,2])
> >>>
> >>> On Thu, Jun 18, 2009 at 2:10 PM, Alexandre Lockhart <
> >>> alexandre_geor...@hotmail.com> wrote:
> >>>
> >>>
>  Hello:
> 
>  My problem is that I have a data frame of means, and a data frame  
>  of
>  standard deviations which match up to each mean.  I have been  
>  trying to
>  create 500 random numbers in a given dataset for each mean/sd
>  combination,
>  but I am only able to generate the last value in each data set to  
>  create
>  one
>  dataset (there should be 28 in all).  Examining my code, what can I
>  change
>  to generate 28 datasets based on respective mean and sds?
> 
> 
> 
>  a1<- 
>  c 
>  (178.07,178.28,178.08,177.74,177.04,178.17,177.58,57.71,59.6,60.92,59.48,59.32,61.59,59.94,28.9,29.82,30.73,25.68,27.93,28.98,29.76,123.48,127.27,127.8,127.2,127.13,126.71,125.5
>   
>  )
> 
> 
>  a2<- 
>  c 
>  (1.69,1.3,1 
>  ,. 
>  18,1.53,1.31,1.35,1.83,1.56,1.12 
>  ,. 
>  74,1.48,1.67,1.53 
>  ,.95,.87,0.03,1.12,1.95,1.22,1.04,1.64,1.83,1,1,1.08,1.35,2.37)
>  for(i in 1:length(a1))
>  for(j in 1:length(a2))
>  x<-rnorm(500,mean=a1[i],sd=a2[j])
> 
>  Thank you,
> 
>  Agl
> 
> __
> 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.

_
Insert movie times and more without leaving Hotmail®.

orial_QuickAdd_062009
[[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] Adding site id to xyplot

2009-06-19 Thread SEUNG CHEON HONG
Dear R Lists,

Can anyone help me add site IDs (site: 1~50) directly to my xyplot. I have 50 
sites and collected observations from the sites at 13 different time points. I 
want to look at the change of my observations in each site. I was able to make 
a graph using xyplot, however, I can't find how to add site IDs within the 
graph not adding them in the legend. Overall, I would like to be able to 
recognize lines matching respective site IDs.

Here is the code (source: MASS) I used below:

library(lattice)
sps <- trellis.par.get("superpose.symbol")
sps$pch <- 1:13
trellis.par.set("superpose.symbol", sps)
xyplot(CADapt~Date, data= omni.sb08, groups=Plot2,
panel = panel.superpose, type="b"
)

Thank you very much in advance!

Steve Hong

__
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] using garchFit() to fit ARMA+GARCH model with exogeneous variables

2009-06-19 Thread Zhang, Yuhan
Hello -
 
Here's what I'm trying to do. I want to fit a time series y with
ARMA(1,1) + GARCH(1,1), there are also an exogeneous variable x which I
wish to include, so the whole equation looks like:
 
y_t - \phi y_{t-1} = \sigma_t \epsilon_t + \theta \sigma_{t-1}
\epsilon_{t-1} + c x_t   where \epsilon_t are i.i.d. random
variables
 
\sigma_t^2 = omega + \alpha \sigma_{t-1}^2 + \beta y_{t-1}^2
 
 
I looked through documentation of garchFit() from the fGarch library but
didn't find a way to include exogeneous variables like x_t. How do I do
that? Thank you very much in advance!
 
Yuhan Zhang
Morgan Stanley | Fixed Income
1585 Broadway, 3rd Floor | New York, NY  10036
Phone: +1 212 761-2313
yuhan.zh...@morganstanley.com

 

--
This is not an offer (or solicitation of an offer) to bu...{{dropped:24}}

__
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] Splitting Data by Row

2009-06-19 Thread Ross Culloch

OF COURSE 

Well, i waited until 16:00 before making the first obvious mistake of the
day! 

Despite 4 hours working on the data I just didn't think! You got the
question, i just missed the obvious!

Thanks very much,

& sorry for not noticing that and trying to make life even more complicated!

R



What about adding Day or Time to the list?
Or maybe I haven't got your question.

Uwe Ligges

-- 
View this message in context: 
http://www.nabble.com/Splitting-Data-by-Row-tp24112822p24113197.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.


Re: [R] [Repost][Off Topic] Pointers needed for breakthrough in statistics

2009-06-19 Thread Tirthankar Chakravarty
You might find the articles of Stephen Stigler interesting:
http://www.stat.uchicago.edu/faculty/stigler/pubs.html

T

On Fri, Jun 19, 2009 at 4:00 PM, Juliet Hannah wrote:
> You may find the following two books useful:
>
> Lehmann, Reminiscences of a Statistician (Springer).
>
> David Salsburg, The lady testing tea.
>
> __
> 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.
>



-- 
To every ω-consistent recursive class κ of formulae there correspond
recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
belongs to Flg(κ) (where v is the free variable of r).

__
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] re ad.table() and setwd() in unix batch mode

2009-06-19 Thread Uwe Ligges



tbigdeli wrote:

I continually receive the error

Error in file(file, "r") : cannot open the connection, when running in batch
mode, but not when inputing directly into R. 


Have you given the full path name?
If not, do you start both R instances from the same working directory?

Otherwise, do you have the same credentials in both cases?

Uwe Ligges







Any ideas?

Thanks!

TB


__
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] [Repost][Off Topic] Pointers needed for breakthrough in statistics

2009-06-19 Thread Juliet Hannah
You may find the following two books useful:

Lehmann, Reminiscences of a Statistician (Springer).

David Salsburg, The lady testing tea.

__
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] Splitting Data by Row

2009-06-19 Thread Uwe Ligges



Ross Culloch wrote:

Hello fellow R users!

I wonder if someone can help with what i think should be a simple question
but i can't seem to find the answer or work it out.

My data set is as such:

Day Time ID Behaviour
1  9 A1 2
1  10A2 3
..  ....   ..
4  10   A1 10
4  11   A2  1
..  ....  ..
30 1B1 14
30 2C3 4

So basically i have data for several days, for several times, for several
IDs and for several Behaviours

What i want to do is get an activity budget for ID from these data, e.g:

data <- tapply(Behaviour,list(ID,Behaviour),length) 



What about adding Day or Time to the list?
Or maybe I haven't got your question.

Uwe Ligges



This will give me a count of the number of times an ID does a certain
behaviour for all the data, which is great - but i want to work out seasonal
and diurnal activity budgets too, therefore i need to break the data down
not just by ID but by day and time, too - I've searched on here and found
nothing i could adapt to my data - it may be that i can't see quite how the
code would work and i've overlooked something of importance!

If anyone can point me in the right direction i'd be most grateful!

Cheers,

Ross


__
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] Splitting Data by Row

2009-06-19 Thread Ross Culloch

Hello fellow R users!

I wonder if someone can help with what i think should be a simple question
but i can't seem to find the answer or work it out.

My data set is as such:

Day Time ID Behaviour
1  9 A1 2
1  10A2 3
..  ....   ..
4  10   A1 10
4  11   A2  1
..  ....  ..
30 1B1 14
30 2C3 4

So basically i have data for several days, for several times, for several
IDs and for several Behaviours

What i want to do is get an activity budget for ID from these data, e.g:

data <- tapply(Behaviour,list(ID,Behaviour),length) 

This will give me a count of the number of times an ID does a certain
behaviour for all the data, which is great - but i want to work out seasonal
and diurnal activity budgets too, therefore i need to break the data down
not just by ID but by day and time, too - I've searched on here and found
nothing i could adapt to my data - it may be that i can't see quite how the
code would work and i've overlooked something of importance!

If anyone can point me in the right direction i'd be most grateful!

Cheers,

Ross
-- 
View this message in context: 
http://www.nabble.com/Splitting-Data-by-Row-tp24112822p24112822.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.


Re: [R] [Repost][Off Topic] Pointers needed for breakthrough in statistics

2009-06-19 Thread Ravi Varadhan
Hi,

There is a three-volume series, published by Springer, called "Breakthroughs
in Statistics", edited by Kotz and Johnson.  Volume 1 is on Foundations and
Basic Theory, Volume 2 is on Methodology, and Vol 3 has miscellaneous
articles.

Ravi. 



---

Ravi Varadhan, Ph.D.

Assistant Professor, The Center on Aging and Health

Division of Geriatric Medicine and Gerontology 

Johns Hopkins University

Ph: (410) 502-2619

Fax: (410) 614-9625

Email: rvarad...@jhmi.edu

Webpage:
http://www.jhsph.edu/agingandhealth/People/Faculty_personal_pages/Varadhan.h
tml

 





-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Michael
Sent: Friday, June 19, 2009 10:26 AM
To: r-help
Subject: [R] [Repost][Off Topic] Pointers needed for breakthrough in
statistics

Hi all,

Sorry for the reposting... I was advised to repost this question with more
specific title. I apologize for this off-topic question but I really need
your help -- I know there are lots of experts here.

As a lover and student of statistics, I am thinking of building a tree of
various branches of statistics and keeping track of the greatest historical
inventions/discoveries in statistics and the latest development of each
branch. The goal is to understand in what context did the great inventions
come out and then try to follow the greatest minds in terms of creating
future significant inventions/discoveries in the statistics field... This is
the "learn-from-the-greatest-minds"
approach.

Could anybody give me some pointers about existing books/articles about the
greatest inventions/discoveries in statistics? And topic list? Here the
"statistics" is in the broad sense, including data-mining, complex data-set,
large data-set, etc. We also want to talk about not only the concepts, but
also the tools and methodologies.

Thanks a lot!

__
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] meaning of glm(value ~ .,

2009-06-19 Thread onyourmark

Thank you for the posts. 
I think that from these posts I can say that the '.' will mean that it will
draw on all the variables in data other than the one listed as the dependent
variable in the formula ('value' in this case). 
And it will also look in the global workspace (although I am not clear what
that is exactly and how far it will search).
Also, I think I can conclude that if I include the 'value' column (as I did
using '922') in data, that this will not be an issue. I was concerned that
listing it as part of data would seem to indicate that it was not the
dependent variable but rather one of the independent ones.
Thanks again.


Gavin Simpson wrote:
> 
> On Fri, 2009-06-19 at 09:24 -0400, David Winsemius wrote:
>> On Jun 19, 2009, at 9:00 AM, onyourmark wrote:
> 
>> > means and also, I see
>> >
>> > data=crs$dataset[,c(1:59,922)]
>> >
>> > I have read that the data argument is optional here
>> > "an optional data frame, list or environment (or object coercible by
>> > as.data.frame to a data frame) containing the variables in the  
>> > model. If not
>> > found in data, the variables are taken from environment(formula),  
>> > typically
>> > the environment from which glm is called"
>> >
>> > when they say "data", is that meant to include the dependent  
>> > variable as
>> > well.
>> 
>> Yes.
> 
> It has to be defined in 'data' or the environment of 'formula', so it
> depends on what the OP meant by "meant to include". You can include it
> in 'data' but don't have to.
> 
>> 
>> > In other words,
>> > in the above statement 'value' is the dependent variable and it is  
>> > also
>> > column 922 in the data set.
>> > Is this correct?
>> 
>> Yes.
> 
> No - you can't say that it is variable 922, or even any of 1:59 or 922
> for the reasons mentioned above.
> 
> set.seed(123)
> dat <- data.frame(A = rnorm(100), B = rnorm(100), C = rnorm(100))
> Y <- rpois(100, 2)
> mod <- glm(Y ~ ., data = dat[,c(1,3)], family = poisson)
> mod
> 
> If all you have is this:
> 
> mod <- glm(Y ~ ., data = dat[,c(1,3)], family = poisson)
> 
> You can't say anything more about Y than that it is either in 'dat' or
> in the environment of 'formula ', which in this case is the global
> workspace.
> 
> G
> 
>> 
>> > correct
>> > Thank you.
>> >
>> > -- 
>> 
>> 
>> 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.
> -- 
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>  Dr. Gavin Simpson [t] +44 (0)20 7679 0522
>  ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
>  Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
>  Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
>  UK. WC1E 6BT. [w] http://www.freshwaters.org.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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/meaning-of--glm%28value-%7E-.%2C-tp24110747p24112723.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.


[R] [Repost][Off Topic] Pointers needed for breakthrough in statistics

2009-06-19 Thread Michael
Hi all,

Sorry for the reposting... I was advised to repost this question with
more specific title. I apologize for this off-topic question but I
really need your help -- I know there are lots of experts here.

As a lover and student of statistics, I am thinking of building a tree
of various branches of statistics and keeping track of the greatest
historical inventions/discoveries in statistics and the latest
development of each branch. The goal is to understand in what context
did the great inventions come out and then try to follow the greatest
minds in terms of creating future significant inventions/discoveries
in the statistics field... This is the "learn-from-the-greatest-minds"
approach.

Could anybody give me some pointers about existing books/articles
about the greatest inventions/discoveries in statistics? And topic
list? Here the "statistics" is in the broad sense, including
data-mining, complex data-set, large data-set, etc. We also want to
talk about not only the concepts, but also the tools and
methodologies.

Thanks a lot!

__
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] meaning of glm(value ~ .,

2009-06-19 Thread David Winsemius
All of your points are accepted, and I also give you credit for  
reading the "formula" page better than I.



On Jun 19, 2009, at 10:08 AM, Gavin Simpson wrote:


On Fri, 2009-06-19 at 09:24 -0400, David Winsemius wrote:

On Jun 19, 2009, at 9:00 AM, onyourmark wrote:



means and also, I see

data=crs$dataset[,c(1:59,922)]

I have read that the data argument is optional here
"an optional data frame, list or environment (or object coercible by
as.data.frame to a data frame) containing the variables in the
model. If not
found in data, the variables are taken from environment(formula),
typically
the environment from which glm is called"

when they say "data", is that meant to include the dependent
variable as
well.


Yes.


It has to be defined in 'data' or the environment of 'formula', so it
depends on what the OP meant by "meant to include". You can include it
in 'data' but don't have to.




In other words,
in the above statement 'value' is the dependent variable and it is
also
column 922 in the data set.
Is this correct?


Yes.


No - you can't say that it is variable 922, or even any of 1:59 or 922
for the reasons mentioned above.

set.seed(123)
dat <- data.frame(A = rnorm(100), B = rnorm(100), C = rnorm(100))
Y <- rpois(100, 2)
mod <- glm(Y ~ ., data = dat[,c(1,3)], family = poisson)
mod

If all you have is this:

mod <- glm(Y ~ ., data = dat[,c(1,3)], family = poisson)

You can't say anything more about Y than that it is either in 'dat' or
in the environment of 'formula ', which in this case is the global
workspace.
G



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] R: JGR installation errors

2009-06-19 Thread Simon Urbanek


On Jun 19, 2009, at 10:08 ,   wrote:


It works now. Thank you.
I even succeeded in starting R by clicking on JGR icon that I placed  
on my desktop.
I wonder whether some Java or system flag that unlocks Mutex (I  
ignore what it is) has to be set somewhere ...

maybe fron the .bashrc file.
The first time I happened to get JGR running (as root) a warning  
popped up (I haven't saved it)
about a possible crash caused by Mutex being unlocked by anothe  
thread ...
I restarted JGR as regular user and that message is not printed out  
any more.
I do not know whether I can feel confident everything is fine with  
this installation ... ?





That's fine - the way JGR works is that the first callback moves form  
the start thread to the R thread hence the message, but it's safe  
since it stays in the R thread afterwards. The message is a warning in  
general but in that one case it's ok. If it occurred later after JGR  
is started, that would be something to worry about.


Cheers,
Simon



Regards,
Maura
-Messaggio originale-
Da: Simon Urbanek [mailto:simon.urba...@r-project.org]
Inviato: ven 19/06/2009 15.43
A: mau...@alice.it
Cc: stats-rosuda-de...@listserv.uni-augsburg.de; r-h...@stat.math.ethz.ch
Oggetto: Re: JGR installation errors

MAura,

On Jun 19, 2009, at 7:36 ,   wrote:

> I remember JGR installation on SuSE 10.3 as a nightmare that
> eventually I overcame with JGR designers' help.
> I have installed SuSE  11.1, latest R version and am trying to
> install JGR again.
> It is still a nightmare.
>

Well, good Linux distros offer JGR as binaries so it's one-liner to
install it ;). All other distros I use are easy to install even from
sources - SuSE seems is notoriously struggling ...

>  I have followed the guidelines on
http://jgr.markushelbig.org/JGR_on_Linux.html
> I have made sure I have the so R libraries.
> I have installed java-1.6.0-sun and its development environment.
> Following the on-line guidelines for JGR installation,
> the process fails on trying to install "rJava"   ... please see all
> the messages in the following.
> I get the same error if I try to install "rJava" in advance of JGR.
>
> Thank you very much,
> Maura
>
>
> As root:
>
> linux-326k:/home/mauede # sudo R CMD javareconf
> Java interpreter : /usr/bin/java
> Java version : 1.6.0_0
> Java home path   : /usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre
> Java compiler: /usr/bin/javac
> Java headers gen.: /usr/bin/javah
> Java archive tool: /usr/bin/jar
> Java library path: $(JAVA_HOME)/lib/amd64/server:$(JAVA_HOME)/lib/
> amd64:$(JAVA_HOME)/../lib/amd64::/usr/java/packages/lib/amd64:/usr/
> lib64:/lib64:/lib:/usr/lib
> JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -L$(JAVA_HOME)/
> lib/amd64 -L$(JAVA_HOME)/../lib/amd64 -L -L/usr/java/packages/lib/
> amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib -ljvm
> JNI cpp flags:
>

^^^ - it appears that you don't have full JDK installed properly or
it's non-standard location - R cannot find flags needed to compile
JNI. You don't have either of ${JAVA_HOME}/include, ${JAVA_HOME}/../
include, ${JAVA_HOME}/jre/include so you'll need to figure out whether
a) you just didn't install them or b) they are installed in a non-
standard location. The fix for a) is to install them, the fix for b)
is set set them using JAVA_CPPFLAGS when calling javareconf (and
report back to us to see if that's something we can add to R).

Cheers,
Simon


> Updating Java configuration in /usr/lib64/R
> Done.
>



Alice Messenger ;-) chatti anche con gli amici di Windows Live  
Messenger e tutti i telefonini TIM!

Vai su http://maileservizi.alice.it/alice_messenger/index.html?pmk=footer



__
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] result of rqss

2009-06-19 Thread David Winsemius
If you do a search on the quantreg documentation for "piecewise", the  
first hit on the pdf has code on the same page. Running that rqss fit  
call unaltered with your data produced a straight line (because the  
data only has a domain of 0-0.5) but lowering lambda lets the  
piecewise character get captured. Try:


fit <- rqss(y ~ qss(x, lambda = .05),tau = .9)
plot(fit)

On Jun 19, 2009, at 9:52 AM, Michael Hecht wrote:


Hello,

i have the following data:

x 
= 
c 
(0,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1,0.11,0.12,0.13,0.14,0.15,0.16,0.17,0.18,0.19,0.2,0.21,0.22,0.23,0.25,0.26,0.27,0.46,0.47,0.48,0.49 
)
y 
= 
c 
(0.48,0.46,0.41,0.36,0.32,0.35,0.48,0.47,0.55,0.56,0.54,0.67,0.61,0.60,0.54,0.51,0.45,0.42,0.44,0.46,0.41,0.43,0.43,0.48,0.48,0.47,0.39,0.37,0.32,0.29 
)


and tried to get piecewise linear regression. Doing a simple spline  
smoothing gives the basic shape of the expected curve:


plot(x,y)
lines(smooth.spline(x, y), lty=2, col = "red")

Now I tried to do rqss. But what I got was only a straight line and  
nothing appropriate.
No parameter change did help. Can anyone tell me what's wrong with  
this approach?


library(quantreg)
fit <- rqss(y ~ qss(x))
plot(fit)
points(x,y)
lines(smooth.spline(x, y), lty=2, col = "red")

Thank You in advance.
__


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] Need help to optimize a piece of code involving zoo objects

2009-06-19 Thread Sergey Goriatchev
Dear Gabor and Jim

I am not looking at the "recursive" method for filter()

Recursive filter with lag 1 is specified in help files as:
y[i] = x[i] + f[1]*y[i-1]

My function looks like this:
EMA[i] = K*(C[i] - EMA[i-1]) + EMA[i-1],

that is:
y[i]=EMA[i]
y[i-1]=EMA[i-1]
x[i]=C[i]

So, I modified my function to look like the recursive filter in help files:

EMA[i]/K = C[i] + EMA[i-1]*((1 - K)/K)

I will then produce a time series object of EMA[i]/K an multiply by K
to get back to EMA[i].
(I also need to get my time index correct, because init=SMA, so some
initial values of C fall away).

Do you think this is correct way to do this, or have I missed something?

Regards,
Sergey


On Fri, Jun 19, 2009 at 15:23, jim holtman wrote:
> check out 'filter' to see if it does what you want with the 'recursive'
> option.
>
> On Fri, Jun 19, 2009 at 3:33 AM, Sergey Goriatchev 
> wrote:
>>
>> Hello, everyone
>>
>> I have a long script that uses zoo objects. In this script I used
>> simple moving averages and these I can very efficiently calculate with
>> filter() functions.
>> Now, I have to use special "exponential" moving averages, and the only
>> way I could write the code was with a for-loop, which makes everything
>> extremely slow.
>> I don't know how to optimize the code, but I need to find a solution.
>> I hope someone can help me.
>>
>> The special moving average is calculated in the following way:
>>
>> EMA = ( K x ( C - P ) ) + P
>>
>> where,
>>
>> C = Current Value
>> P = Previous periods EMA    (A SMA is used for the first period's
>> calculation)
>> K = Exponential smoothing constant
>>
>> K = 2 / ( 1 + Periods )
>>
>> Below is the code with the for-loop.
>>
>> -"temp" contains C
>> -Periods is variable "j" in the for loop (so K varies)
>> - I first produce a vector of simple equally weighted moving average,
>> and use the first non-NA value to initiate the second for-loop
>>
>> x.Date <- as.Date("2003-02-01") + seq(1,1100) - 1
>> temp <- zoo(rnorm(1100, 0, 10)+100, x.Date)
>>
>> start.time <- proc.time()
>>
>> for(j in seq(5,100,by=5)){
>>
>>        #PRODUCE FAST MOVING AVERAGE
>>        #Create equally weighted MA vector (we need only the first value)
>>        smafast <- zoo(coredata(filter(coredata(temp[,1]), filter=rep(1/j,
>> j), sides=1)), order.by=time(temp))
>>
>>        #index of first non-NA value, which is the first SMA needed
>>        #which(is.na(smafast))[length(which(is.na(smafast)))]+1
>>
>>        #Calculate decay factor K
>>        #number of periods is j
>>        K <- 2/(1+j)
>>
>>        #Calculate recursively the EMA for the fast index (starting with
>> second non-NA value)
>>        for (k in
>> (which(is.na(smafast))[length(which(is.na(smafast)))]+2):length(smafast))
>> {
>>                smafast[k] <-
>> coredata(smafast[k-1])+K*(coredata(temp[k,1])-coredata(smafast[k-1]))
>>        }
>>
>>        #PRODUCE SLOW MOVING AVERAGE
>>        #Create equally weighted MA vector (we need only the first value)
>>        smaslow <- zoo(coredata(filter(coredata(temp[,1]),
>> filter=rep(1/(j*4), (j*4)), sides=1)), order.by=time(temp))
>>        K <- 2/(1+j*4)
>> #Calculate EMA
>>        for (k in
>> (which(is.na(smaslow))[length(which(is.na(smaslow)))]+2):length(smaslow))
>> {
>>                smaslow[k] <-
>> coredata(smaslow[k-1])+K*(coredata(temp[k,1])-coredata(smaslow[k-1]))
>>        }
>>
>>        #COMBINE DIFFERENCES OF FAST AND SLOW
>>        temp <-         merge(temp, ma=smafast-smaslow)
>> }
>>
>> proc.time()-start.time
>>
>> --
>> I'm not young enough to know everything. /Oscar Wilde
>> Experience is one thing you can't get for nothing. /Oscar Wilde
>> When you are finished changing, you're finished. /Benjamin Franklin
>> Tell me and I forget, teach me and I remember, involve me and I learn.
>> /Benjamin Franklin
>> Luck is where preparation meets opportunity. /George Patten
>>
>> __
>> 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.
>
>
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>



-- 
I'm not young enough to know everything. /Oscar Wilde
Experience is one thing you can't get for nothing. /Oscar Wilde
When you are finished changing, you're finished. /Benjamin Franklin
Tell me and I forget, teach me and I remember, involve me and I learn.
/Benjamin Franklin
Luck is where preparation meets opportunity. /George Patten

__
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] meaning of glm(value ~ .,

2009-06-19 Thread Gavin Simpson
On Fri, 2009-06-19 at 09:24 -0400, David Winsemius wrote:
> On Jun 19, 2009, at 9:00 AM, onyourmark wrote:

> > means and also, I see
> >
> > data=crs$dataset[,c(1:59,922)]
> >
> > I have read that the data argument is optional here
> > "an optional data frame, list or environment (or object coercible by
> > as.data.frame to a data frame) containing the variables in the  
> > model. If not
> > found in data, the variables are taken from environment(formula),  
> > typically
> > the environment from which glm is called"
> >
> > when they say "data", is that meant to include the dependent  
> > variable as
> > well.
> 
> Yes.

It has to be defined in 'data' or the environment of 'formula', so it
depends on what the OP meant by "meant to include". You can include it
in 'data' but don't have to.

> 
> > In other words,
> > in the above statement 'value' is the dependent variable and it is  
> > also
> > column 922 in the data set.
> > Is this correct?
> 
> Yes.

No - you can't say that it is variable 922, or even any of 1:59 or 922
for the reasons mentioned above.

set.seed(123)
dat <- data.frame(A = rnorm(100), B = rnorm(100), C = rnorm(100))
Y <- rpois(100, 2)
mod <- glm(Y ~ ., data = dat[,c(1,3)], family = poisson)
mod

If all you have is this:

mod <- glm(Y ~ ., data = dat[,c(1,3)], family = poisson)

You can't say anything more about Y than that it is either in 'dat' or
in the environment of 'formula ', which in this case is the global
workspace.

G

> 
> > correct
> > Thank you.
> >
> > -- 
> 
> 
> 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.
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



signature.asc
Description: This is a digitally signed message part
__
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: JGR installation errors

2009-06-19 Thread mauede
It works now. Thank you.
I even succeeded in starting R by clicking on JGR icon that I placed on my 
desktop.
I wonder whether some Java or system flag that unlocks Mutex (I ignore what it 
is) has to be set somewhere ... 
maybe fron the .bashrc file.
The first time I happened to get JGR running (as root) a warning popped up (I 
haven't saved it) 
about a possible crash caused by Mutex being unlocked by anothe thread ... 
I restarted JGR as regular user and that message is not printed out any more.
I do not know whether I can feel confident everything is fine with this 
installation ... ?

Regards,
Maura
-Messaggio originale-
Da: Simon Urbanek [mailto:simon.urba...@r-project.org]
Inviato: ven 19/06/2009 15.43
A: mau...@alice.it
Cc: stats-rosuda-de...@listserv.uni-augsburg.de; r-h...@stat.math.ethz.ch
Oggetto: Re: JGR installation errors
 
MAura,

On Jun 19, 2009, at 7:36 ,   wrote:

> I remember JGR installation on SuSE 10.3 as a nightmare that  
> eventually I overcame with JGR designers' help.
> I have installed SuSE  11.1, latest R version and am trying to  
> install JGR again.
> It is still a nightmare.
>

Well, good Linux distros offer JGR as binaries so it's one-liner to  
install it ;). All other distros I use are easy to install even from  
sources - SuSE seems is notoriously struggling ...

>  I have followed the guidelines on
> http://jgr.markushelbig.org/JGR_on_Linux.html
> I have made sure I have the so R libraries.
> I have installed java-1.6.0-sun and its development environment.  
> Following the on-line guidelines for JGR installation,
> the process fails on trying to install "rJava"   ... please see all  
> the messages in the following.
> I get the same error if I try to install "rJava" in advance of JGR.
>
> Thank you very much,
> Maura
>
>
> As root:
>
> linux-326k:/home/mauede # sudo R CMD javareconf
> Java interpreter : /usr/bin/java
> Java version : 1.6.0_0
> Java home path   : /usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre
> Java compiler: /usr/bin/javac
> Java headers gen.: /usr/bin/javah
> Java archive tool: /usr/bin/jar
> Java library path: $(JAVA_HOME)/lib/amd64/server:$(JAVA_HOME)/lib/ 
> amd64:$(JAVA_HOME)/../lib/amd64::/usr/java/packages/lib/amd64:/usr/ 
> lib64:/lib64:/lib:/usr/lib
> JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -L$(JAVA_HOME)/ 
> lib/amd64 -L$(JAVA_HOME)/../lib/amd64 -L -L/usr/java/packages/lib/ 
> amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib -ljvm
> JNI cpp flags:
>

^^^ - it appears that you don't have full JDK installed properly or  
it's non-standard location - R cannot find flags needed to compile  
JNI. You don't have either of ${JAVA_HOME}/include, ${JAVA_HOME}/../ 
include, ${JAVA_HOME}/jre/include so you'll need to figure out whether  
a) you just didn't install them or b) they are installed in a non- 
standard location. The fix for a) is to install them, the fix for b)  
is set set them using JAVA_CPPFLAGS when calling javareconf (and  
report back to us to see if that's something we can add to R).

Cheers,
Simon


> Updating Java configuration in /usr/lib64/R
> Done.
>




tutti i telefonini TIM!


[[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] Alternate ways of finding number of occurrence of an element in a vector.

2009-06-19 Thread Praveen Surendran
Hi,

 

I have a vector "v" and would like to find the number of occurrence of
element "x" in the same.

Is there a way other than,

 

sum(as.integer(v==x)) or length(which(x==v))

 

to do the this.

 

I have a huge file to process and do this.  Both the above described methods
are pretty slow while dealing with a large vector.

Please have your comments.

 

Praveen Surendran.

 


[[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] result of rqss

2009-06-19 Thread Michael Hecht
Hello,

i have the following data:

x=c(0,0.02,0.03,0.04,0.05,0.06,0.07,0.08,0.09,0.1,0.11,0.12,0.13,0.14,0.15,0.16,0.17,0.18,0.19,0.2,0.21,0.22,0.23,0.25,0.26,0.27,0.46,0.47,0.48,0.49)
y=c(0.48,0.46,0.41,0.36,0.32,0.35,0.48,0.47,0.55,0.56,0.54,0.67,0.61,0.60,0.54,0.51,0.45,0.42,0.44,0.46,0.41,0.43,0.43,0.48,0.48,0.47,0.39,0.37,0.32,0.29)

and tried to get piecewise linear regression. Doing a simple spline smoothing 
gives the basic shape of the expected curve:

plot(x,y)
lines(smooth.spline(x, y), lty=2, col = "red")

Now I tried to do rqss. But what I got was only a straight line and nothing 
appropriate.
No parameter change did help. Can anyone tell me what's wrong with this 
approach?

library(quantreg)
fit <- rqss(y ~ qss(x))
plot(fit)
points(x,y)
lines(smooth.spline(x, y), lty=2, col = "red")

Thank You in advance.
__
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://movieflat.web.de

__
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] Post-Hoc Test for Kruskal-Wallis Rank Sum Test

2009-06-19 Thread Rodrigo Aluizio
Thank you so much Gilles, that is exactly what I’m looking for.

 

Rodrigo.

 

De: LE PAPE Gilles [mailto:lepape.gil...@neuf.fr] 
Enviada em: sexta-feira, 19 de junho de 2009 10:14
Para: r.alui...@gmail.com
Assunto: Post-hoc test

 

Hi Rodrigo,

you can use the nparcomp function, library(nparcomp).

Gilles LE PAPE
AnaStats
14, rue de la Bretonnerie
37000 TOURS
Tél. 02 47 05 87 59
Courriel : lepape.gil...@neuf.fr
www.anastats.fr


[[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] Testing if all elements are equal in a vector/matrix

2009-06-19 Thread utkarshsinghal
How could I miss that... I'm feeling low :(


jim holtman wrote:
> I have wondered about this way of testing for equality:
>  
> > x <- c(1,0,3,0)
> > x[1] * length(x) == sum(x)
> [1] TRUE
> > x <- rep(1,4)
> > x[1] * length(x) == sum(x)
> [1] TRUE
> This would seem to indicate that both vectors contain the same values, 
> but not necessarily true.
>
> On Fri, Jun 19, 2009 at 8:18 AM, Petr PIKAL  > wrote:
>
> Hi
>
> utkarshsinghal  > napsal dne
> 17.06.2009 15:29:34:
>
> > I will wait for the next version-2.9.1 and presently using Petr's
> suggestion, i.e.,
> > (x[1]*length(x))==sum(x)
> > which significantly reduced the run time.
> >
> > The problem is now there might be only small differences ,say,
> of the
> order of
> > 10^-10 which I want to ignore.
> >
> > So I used:
> > isTRUE(all.equal((x[1]*length(x)),sum(x)))
> > as suggested in the documentation of all.equal.
> >
> > But this again increased the run time to five times.
> >
> > 1) Is there any faster way of doing the same?
>
> Maybe (not tested)
>
> (x[1]*length(x))==round(sum(x),10)
>
> Petr
>
> > 2) Will the function "anyDuplicated" treat almost equal values as
> duplicated
> > or not? Actually I need both the options.
> >
> >
> > Regards
> > Utkarsh
> >
> >
> >
> > Prof Brian Ripley wrote:
> > On Tue, 16 Jun 2009, Prof Brian Ripley wrote:
>
> > On Tue, 16 Jun 2009, jim holtman wrote:
>
> > I think the only way that you are going to get it to stop on the
> first
> > mismatch is to write your own function in C if you are concerned
> about
> the
> > time.  Matching on character vectors will be even more costly
> since it
> is
> > having to loop to check the equality of each character in each
> element.
> > This is one of the places it might pay to convert to factors and
> then
> the
> > comparison only uses the integer values assigned to the factors.
> >
> > Not so in a recent R: comparison of character vectors is now done by
> comparing
> > pointers in the first instance so (at least on a 32-bit
> platform) is as
> fast
> > as comparing integers.  And on x86_64 Linux:
>
> > x <- as.character(c(1,2,rep(1,1000)))
> > system.time(print(all(x[1] == x)))
> > [1] FALSE
> >   user  system elapsed
> >  0.123   0.019   0.142
>
> > system.time(xx <- as.factor(x))
> >   user  system elapsed
> >  9.874   0.284  10.159
> > system.time(print(all(xx[1] == xx)))
> > [1] FALSE
> >   user  system elapsed
> >  0.511   0.145   0.656
> >
> > Recent pre-release versions of R (e.g. 2.9.1 beta) allow
>
> > system.time(anyDuplicated(x))
> >   user  system elapsed
> >  0.034   0.078   0.113
> > system.time(anyDuplicated(xx))
> >   user  system elapsed
> >  0.037   0.076   0.113
> >
> > I'm sorry, a line got reverted here: I had edited this to say
> >
> > 'which is a C-level speedup of the sort the original poster
> seemed to be
> looking for'
>
> >
> >
> > On Tue, Jun 16, 2009 at 8:31 AM, utkarshsinghal <
> > utkarsh.sing...@global-analytics.com
> > wrote:
>
> > Hi Jim,
> >
> > What you are saying is correct. Although, my computer might not have
> same
> > speed and I am getting the following for 10M entries:
> >
> >user  system elapsed
> >   0.559   0.038   0.607
> >
> > Moreover, in the case of character vectors, it gets more than
> double.
> >
> > In my modeling, which is already highly time consuming,  I need
> to do
> check
> > this for few thousand vectors and the entries can easily be 10M
> in each
> > vector. So I am just looking for any possibilities of time
> saving.  I am
>
> > pretty sure that whenever elements are not all equal, it can be
> concluded
> > from any few entries (most of the times). It will be worth if I
> can find
> a
> > way which stops checking further the moment it find two distinct
> elements.
> >
> > Regards
> > Utkarsh
> >
> >
> >
> > jim holtman wrote:
> >
> > Just check that the first (or any other element) is equal to all the
> rest:
>
> > x = c(1,2,rep(1,1000)) # 10,000,000
> > system.time(print(all(x[1] == x)))
> > [1] FALSE
> >user  system elapsed
> >0.180.000.19
>
> >
> > This was for 10M entries.
> >
> > On Tue, Jun 16, 2009 at 7:42 AM, utkarshsinghal <
> > utkarsh.sing...@global-analytics.com
> > wrote:
>
> >
> > Hi All,
> >
> > There are several replies to the question below, but I think
>

Re: [R] How to save multiple images??

2009-06-19 Thread David Winsemius

Give them different names.

?save.image

On Jun 19, 2009, at 9:34 AM, Alex Roy wrote:


Dear all,
 How can I save multiple images in my working  
directory?? I

used save.image() but could not succeeded.

Thanks in advance

Alex



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] JGR installation errors

2009-06-19 Thread Simon Urbanek

MAura,

On Jun 19, 2009, at 7:36 ,   wrote:

I remember JGR installation on SuSE 10.3 as a nightmare that  
eventually I overcame with JGR designers' help.
I have installed SuSE  11.1, latest R version and am trying to  
install JGR again.

It is still a nightmare.



Well, good Linux distros offer JGR as binaries so it's one-liner to  
install it ;). All other distros I use are easy to install even from  
sources - SuSE seems is notoriously struggling ...



 I have followed the guidelines on
http://jgr.markushelbig.org/JGR_on_Linux.html
I have made sure I have the so R libraries.
I have installed java-1.6.0-sun and its development environment.  
Following the on-line guidelines for JGR installation,
the process fails on trying to install "rJava"   ... please see all  
the messages in the following.

I get the same error if I try to install "rJava" in advance of JGR.

Thank you very much,
Maura


As root:

linux-326k:/home/mauede # sudo R CMD javareconf
Java interpreter : /usr/bin/java
Java version : 1.6.0_0
Java home path   : /usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre
Java compiler: /usr/bin/javac
Java headers gen.: /usr/bin/javah
Java archive tool: /usr/bin/jar
Java library path: $(JAVA_HOME)/lib/amd64/server:$(JAVA_HOME)/lib/ 
amd64:$(JAVA_HOME)/../lib/amd64::/usr/java/packages/lib/amd64:/usr/ 
lib64:/lib64:/lib:/usr/lib
JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -L$(JAVA_HOME)/ 
lib/amd64 -L$(JAVA_HOME)/../lib/amd64 -L -L/usr/java/packages/lib/ 
amd64 -L/usr/lib64 -L/lib64 -L/lib -L/usr/lib -ljvm

JNI cpp flags:



^^^ - it appears that you don't have full JDK installed properly or  
it's non-standard location - R cannot find flags needed to compile  
JNI. You don't have either of ${JAVA_HOME}/include, ${JAVA_HOME}/../ 
include, ${JAVA_HOME}/jre/include so you'll need to figure out whether  
a) you just didn't install them or b) they are installed in a non- 
standard location. The fix for a) is to install them, the fix for b)  
is set set them using JAVA_CPPFLAGS when calling javareconf (and  
report back to us to see if that's something we can add to R).


Cheers,
Simon



Updating Java configuration in /usr/lib64/R
Done.



__
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] off topic but need your pointers about statistics

2009-06-19 Thread Paul Artes

I re-read the posting guide every night before going to bed.

The usefulness of this list stems partly from it being a broad church with
lots of experts. And my concern wasn't with the "off-topic" label so much as
with the slightly inspecific title (although I should have made this clear -
mea culpa). A clearer heading might have attracted more readers. In my
(personal) view none of the other lists you mention really compare to this
one (R-help), but allstat might be added also.


David Winsemius wrote:
> 
> 
> On Jun 19, 2009, at 6:36 AM, Paul Artes wrote:
> 
> [...]
>>  You should consider re-posting your most
>> interesting question with a less apologetic title - perhaps you will  
>> get a
>> larger range of replies.
>>
> You might consider (re-?) reading the Posting Guide. The OP was  
> correct in thinking this is off topic.
> There are other venues where it would not be so. There are three stats  
> newsgroups (which unlike the r-lists specifically encourage cross- 
> posting: sci.stat.math, sci.stat.edu, and sci.stat.consult and one  
> GoogleGroup, MedStats, where such a question might be on-topic.
> 
> 
> 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.
> 
> 

-- 
View this message in context: 
http://www.nabble.com/off-topic-but-need-your-pointers-about-statistics-tp24098656p24111585.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.


[R] How to save multiple images??

2009-06-19 Thread Alex Roy
Dear all,
  How can I save multiple images in my working directory?? I
used save.image() but could not succeeded.

Thanks in advance

Alex

[[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] overshoot of formula line in summary output of Sweave

2009-06-19 Thread Ben Bolker



Ken Knoblauch wrote:
> 
> Ben Bolker  ufl.edu> writes:
>> >> > Here is a toy example that illustrates the overshoot of the formula
>> >> > \documentclass[12pt]{article}
>> >> > \usepackage{geometry}
>> >> > \geometry{left=2in,right=2in}
>> >> > \begin{document}
>> >> > <>=
>> >> > op <- options(width = 65, digits = 3)
>> >> > ddataframe <- data.frame(A = 1:10,
>> >> > B = factor(letters[1:2]),
>> >> > C = factor(LETTERS[1:5]),
>> >> > S = factor(paste("S", 1:10, sep = "")),
>> >> > R = rnorm(10))
>> >> > 
>> >> > mod1 <- lm(R ~ A + B + C + S,
>> >> > ddataframe)
>> >> > summary(mod1)
>> >> > @
>> >> > \end{document}
>> >> A quick guess:  try keep.source=TRUE and format your commands
>> >> as you would like to see them appear ...
>> >>   Ben Bolker
>> > Thanks, Ben, for the response.
> 
> --- deleted text ---
> 
>> 
>> I wonder if there is a LaTeX-side solution, i.e. constructing a 
>> verbatim-like environment that breaks lines?
> 
> It sounds a bit like an oxymoron but isn't that
> more or less what Sweave does when keep.source is
> not set to TRUE, only it doesn't seem to catch the
> print-outs of these long calls.  I'll give your
> suggestion some further thought, however.
> Thanks.
> 
> Ken
> 
> 

  I don't think so.  What happens is that R's parser breaks
up the lines, and then the verbatim environment respects
whatever line-breaking it has done.  There are environments
like alltt that do variants (although alltt is not what we need
here).

  Ben

-- 
View this message in context: 
http://www.nabble.com/overshoot-of-formula-line-in-summary-output-of-Sweave-tp24053269p24111467.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.


Re: [R] meaning of glm(value ~ .,

2009-06-19 Thread David Winsemius


On Jun 19, 2009, at 9:00 AM, onyourmark wrote:



I am trying to build a glm model with many inputs.
I saw the following code in Rattle
crs$glm <- glm(value ~ ., data=crs$dataset[,c(1:59,922)],
family=binomial(link="logit"))

I am not clear about what

value ~ .


Generally the "." in a formula indicates all of the remaining  
variables without interactions.


?"formula"   # although I did not find that particular convention  
documented in a cursory review of that page .




means and also, I see

data=crs$dataset[,c(1:59,922)]

I have read that the data argument is optional here
"an optional data frame, list or environment (or object coercible by
as.data.frame to a data frame) containing the variables in the  
model. If not
found in data, the variables are taken from environment(formula),  
typically

the environment from which glm is called"

when they say "data", is that meant to include the dependent  
variable as

well.


Yes.


In other words,
in the above statement 'value' is the dependent variable and it is  
also

column 922 in the data set.
Is this correct?


Yes.


correct
Thank you.

--



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] Need help to optimize a piece of code involving zoo objects

2009-06-19 Thread jim holtman
check out 'filter' to see if it does what you want with the 'recursive'
option.

On Fri, Jun 19, 2009 at 3:33 AM, Sergey Goriatchev wrote:

> Hello, everyone
>
> I have a long script that uses zoo objects. In this script I used
> simple moving averages and these I can very efficiently calculate with
> filter() functions.
> Now, I have to use special "exponential" moving averages, and the only
> way I could write the code was with a for-loop, which makes everything
> extremely slow.
> I don't know how to optimize the code, but I need to find a solution.
> I hope someone can help me.
>
> The special moving average is calculated in the following way:
>
> EMA = ( K x ( C - P ) ) + P
>
> where,
>
> C = Current Value
> P = Previous periods EMA(A SMA is used for the first period's
> calculation)
> K = Exponential smoothing constant
>
> K = 2 / ( 1 + Periods )
>
> Below is the code with the for-loop.
>
> -"temp" contains C
> -Periods is variable "j" in the for loop (so K varies)
> - I first produce a vector of simple equally weighted moving average,
> and use the first non-NA value to initiate the second for-loop
>
> x.Date <- as.Date("2003-02-01") + seq(1,1100) - 1
> temp <- zoo(rnorm(1100, 0, 10)+100, x.Date)
>
> start.time <- proc.time()
>
> for(j in seq(5,100,by=5)){
>
>#PRODUCE FAST MOVING AVERAGE
>#Create equally weighted MA vector (we need only the first value)
>smafast <- zoo(coredata(filter(coredata(temp[,1]), filter=rep(1/j,
> j), sides=1)), order.by=time(temp))
>
>#index of first non-NA value, which is the first SMA needed
>#which(is.na(smafast))[length(which(is.na(smafast)))]+1
>
>#Calculate decay factor K
>#number of periods is j
>K <- 2/(1+j)
>
>#Calculate recursively the EMA for the fast index (starting with
> second non-NA value)
>for (k in (which(is.na(smafast))[length(which(is.na
> (smafast)))]+2):length(smafast))
> {
>smafast[k] <-
> coredata(smafast[k-1])+K*(coredata(temp[k,1])-coredata(smafast[k-1]))
>}
>
>#PRODUCE SLOW MOVING AVERAGE
>#Create equally weighted MA vector (we need only the first value)
>smaslow <- zoo(coredata(filter(coredata(temp[,1]),
> filter=rep(1/(j*4), (j*4)), sides=1)), order.by=time(temp))
>K <- 2/(1+j*4)
> #Calculate EMA
>for (k in (which(is.na(smaslow))[length(which(is.na
> (smaslow)))]+2):length(smaslow))
> {
>smaslow[k] <-
> coredata(smaslow[k-1])+K*(coredata(temp[k,1])-coredata(smaslow[k-1]))
>}
>
>#COMBINE DIFFERENCES OF FAST AND SLOW
>temp <- merge(temp, ma=smafast-smaslow)
> }
>
> proc.time()-start.time
>
> --
> I'm not young enough to know everything. /Oscar Wilde
> Experience is one thing you can't get for nothing. /Oscar Wilde
> When you are finished changing, you're finished. /Benjamin Franklin
> Tell me and I forget, teach me and I remember, involve me and I learn.
> /Benjamin Franklin
> Luck is where preparation meets opportunity. /George Patten
>
> __
> 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.
>



-- 
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] Manipulate solution of simplex

2009-06-19 Thread Jorge Ivan Velez
Dear Ana,
Are you optimizing a linear function?  If so, the simplex() function in the
boot package (see [1]) is what you are using. Using the example at ?simplex
(after loading the boot package):

res <- simplex(a = enj, A1 = fat, b1 = 13800, A2 = rbind(vitx, vity, vitz),
b2 = c(600, 300, 550), maxi = TRUE)

Then

str(res)

gives you the structure of the res object. To get the solution vector, just
type:

res$soln
#  x1   x2   x3   x4
#  0.0  0.0 13.8  0.0

HTH,

Jorge

[1]
http://astrostatistics.psu.edu/datasets/2006tutorial/html/boot/html/simplex.html


On Fri, Jun 19, 2009 at 4:51 AM, Ana Ramos  wrote:

> Hi,
>
> I need some help. I'm doing a project that demands me to obtain several
> simplex solutions and I would like to can keep the solution in a vector or
> something to be able to use it after I get it.
> The comand simplex() prints the solution but how can I keep it?
> Another alternative would be to export it to excel, how can I do this?
>
> I just see the solution and have to note it on a paper or something?
>
> Thanks
>
> Ana
>
>[[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.
>

[[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] namespace? environment? how to manage functions?

2009-06-19 Thread jim holtman
Here is the way that I do it instead of creating a package of my functions.
I 'source' the file into an environment and then attach the environment to
keep the global from being clustered:

# read my functions into a environment
.my.env <- new.env()
sys.source('c:/perf/bin/perfmon.r', envir=.my.env)
attach(.my.env)




On Thu, Jun 18, 2009 at 8:16 PM, whizvast  wrote:

>
> Hi, useRs-
>
> I have been building a set of functions over time and now my R_GlobalEnv
> becomes
> too crowded.
>
> I would like to put all my functions under the same namespace/environment.
> Ideally,
> I would like to call them using "env::func" as in C++.
>
> The following code almost do the jobs I want - except that I need to add
> "env$"
> before defining each function. I can't do that because my functions are
> saved in
> different files.
>
> Anybody has any suggestion? Thx~
>
>
> ## test code ##
> abc <- new.env()
> abc$tmpf <- function() print('hello, world!')
> attach(abc)
>
> abc$tmpf()
> tmpf()
>
>
> --
> View this message in context:
> http://www.nabble.com/namespace--environment--how-to-manage-functions--tp24100485p24100485.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.
>



-- 
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] meaning of glm(value ~ .,

2009-06-19 Thread Gavin Simpson
On Fri, 2009-06-19 at 06:00 -0700, onyourmark wrote:
> I am trying to build a glm model with many inputs.
> I saw the following code in Rattle
> crs$glm <- glm(value ~ ., data=crs$dataset[,c(1:59,922)],
> family=binomial(link="logit"))
> 
> I am not clear about what 
> 
> value ~ .

From ?formula

 There are two special interpretations of '.' in a formula.  The
 usual one is in the context of a 'data' argument of model fitting
 functions and means 'all columns not otherwise in the formula':
 see 'terms.formula'.  In the context of 'update.formula', *only*,
 it means 'what was previously in this part of the formula'.


> 
> means and also, I see 
> 
> data=crs$dataset[,c(1:59,922)] 
> 
> I have read that the data argument is optional here
> "an optional data frame, list or environment (or object coercible by
> as.data.frame to a data frame) containing the variables in the model. If not
> found in data, the variables are taken from environment(formula), typically
> the environment from which glm is called"
> 
> when they say "data", is that meant to include the dependent variable as
> well. In other words,
> in the above statement 'value' is the dependent variable and it is also
> column 922 in the data set.

The variables in the formula will be looked up within 'data' and then on
from there (that is, the environment o the formula), but you can't
assume from that code alone that column 922 is the response variable
'value' or indeed that it is any of the variables in 'data' as 'value'
could occur in the environment of the formula, which is often, but not
always, the global workspace.

HTH

G

> Is this correct?
> correct
> Thank you.
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,  [f] +44 (0)20 7679 0565
 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London  [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



signature.asc
Description: This is a digitally signed message part
__
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] batch submit

2009-06-19 Thread Wensui Liu
with emacs + ess, I can do batch submit sas code using m-x submit sas.
wondering if I can do so for r or not.
-- 
==
WenSui Liu
Blog   : statcompute.spaces.live.com
Tough Times Never Last. But Tough People Do.  - Robert Schuller

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


  1   2   >