[R] SNOW libraries/functions, rGenoud

2011-07-01 Thread Lui ##
Dear group,

does anybody know how to export libraries/functions to all nodes when
launching snow? I want to use a function from fBasics (dstable) for a
rGenoud optimization routine, but I fail "making the function
accessible" to the nodes created. I know how it works for variables, I
know how it works in snowfall(which cant be used in that case), but I
dont know how it culd work in snow.

Help appreciated!

Lui

__
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] SNOW libraries/functions, rGenoud

2011-07-02 Thread Lui ##
Hello Uwe,

thanks a lot!

That solved the "problem"

Have a nice weekend!
Viele  Grüße

Lui

2011/7/1 Uwe Ligges :
> See ?clusterEvalQ
>
> Uwe Ligges
>
> On 01.07.2011 16:11, Lui ## wrote:
>>
>> Dear group,
>>
>> does anybody know how to export libraries/functions to all nodes when
>> launching snow? I want to use a function from fBasics (dstable) for a
>> rGenoud optimization routine, but I fail "making the function
>> accessible" to the nodes created. I know how it works for variables, I
>> know how it works in snowfall(which cant be used in that case), but I
>> dont know how it culd work in snow.
>>
>> Help appreciated!
>>
>> Lui
>>
>> __
>> 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] parallel computing with 'foreach'

2011-07-07 Thread Lui ##
Hello Stacey,

I do not know whether my answer comes late or not, just came across
your post now. I had a similar problem...

First: You might want to think about whether to try to parallelize the
thing or not. Unless coxph takes several minutes, it is probably of no
great help to parallelize it, because there are many jobs associated
with it. All workers need to be "taught" about the environment (the
functions and variables they need to know) and some coordination work
is necessary as well. So if every for-loop takes a longer time: you
may want to use foreach, otherwise there's no great benefit
(probably).

What you could do is save only the functions you need in a separate R
file and just have the workers initialize the functions you need for
that. So you split up your source code in two parts - one containing
the functions you need in the loop later and one that controls how the
functions work together...

You can try :
##declare a function that loads only the libraries and functions
necessary inside the loop
mysource <- function(envir, filename) source("source.R")

##tell the programm to have every worker execute that function
smpopts <- list(initEnvir = mysource)

##have it executed with the foreach loop
foreach (.,.options.smp=smpopts){


Hope that helps...
Best

Lui


2011/7/1 Uwe Ligges :
> Type
>  ?foreach
> and read the whole help page - as the positng guide asked you to do before
> posting, you will find the line describing the argument ".packages".
>
> Uwe Ligges
>
>
>
> On 28.06.2011 21:17, Stacey Wood wrote:
>>
>> Hi all,
>> I would like to parallelize some R code and would like to use the
>> 'foreach'
>> package with a foreach loop.  However, whenever I call a function from an
>> enabled package outside of MASS, I get an error message that a number of
>> the
>> functions aren't recognized (even though the functions should be defined).
>> For example:
>>
>> library(foreach)
>> library(doSMP)
>> library(survival)
>> # Create the simplest test data set
>> test1<- list(time=c(4,3,1,1,2,2,3),
>>               status=c(1,1,1,0,1,1,0),
>>               x=c(0,2,1,1,1,0,0),
>>               sex=c(0,0,0,0,1,1,1))
>> # Fit a stratified model
>> coxph(Surv(time, status) ~ x + strata(sex), test1)
>>
>> w<- startWorkers()
>> registerDoSMP(w)
>> foreach(i=1:3) %dopar% {
>> # Fit a stratified model
>> fit<-coxph(Surv(time, status) ~ x + strata(sex), test1)
>> summary(fit)$coef[i]
>> }
>> stopWorkers(w)
>> Error message:
>> Error in { : task 1 failed - "could not find function "coxph""
>>
>>
>> If I call library(survival) inside the foreach loop, everything runs
>> properly.  I don't think that I should have to call the package
>> iteratively
>> inside the loop.  I would like to use a foreach loop inside code for my
>> own
>> package, but this is a problem since I can't call my own package in the
>> source code for the package itself!  Any advice would be appreciated.
>>
>> Thanks,
>> Stacey
>>
>>        [[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-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] Hclust - Number of branch operations for every element

2010-12-19 Thread Lui

Hello everybody,

I need to know how often every element in an hierarchical cluster was 
"branched" - just imagine a watering pot on the top of the hierarchical 
tree -> the leafs should get water according to the number of branches 
that lie before them.


For example:
a <- list()  # initialize empty object
a$merge <- matrix(c(-1, -2,
-3, -4,
 1,  2,
 -5,-6,
 3,4), nc=2, byrow=TRUE )
a$height <- c(1, 2, 3,4,5)
a$order <- c(1,2,3,4,5,6)
a$labels <- 1:6
class(a) <- "hclust"
plot(a)

The leaf "1" has was branched three times -> it would get 1/2^3 = 0.125 
of the "total water". Same for leaf 2.Leafs 3 and 4 would each get the 
same (0.125). Leaf 5 and 6 would get 0.25 -> Adding up to 1.

Does anybody have a clue?
Thanks a lot in advance!
Lui

__
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] Amazon AWS, RGenoud, Parallel Computing

2011-06-11 Thread Lui ##
Dear R group,

since I do only have a moderately fast MacBook and I would like to get
my results faster than within 72h per run ( :-((( ), I tried Amazon
AWS, which offers pretty fast computers via remote access. I don't
want to post any code because its several hundreds lines of code, I am
not looking for the "optimal" answer, but maybe some suggestions from
you if faced similar problems.

I did install Revolution on Windows on the amazon instance. I usually
go for the large one (8 cores, about 20 Ghz, several GB of RAM).

- I am running a financial analysis over several periods (months) in
which various CVaR calculations are made (with the rGenoud package).
The periods do depend on each other, so parallelizing that does not
work. I was quite surprised how well written all the libraries seem
for R on Mac since they seem to use my dual core on the Macbook for a
large portion of the calculations (I guess the matrix multiplications
and the like). I was a little bit astonished though, that the
performance increase on the Amazon instance (about 5 times faster than
my Macbook) was very moderate with only about a 30% decrease in
calculation time. The CPUs were about 60% in use (obviously, the code
was not written specifically for several cores).

(1) I did try to use multiple cores for the rGenoud package (snow
package) as mentioned on the excellent website
(http://sekhon.berkeley.edu/rgenoud/multiple_cpus.html) but found a
rather strange behaviour: The CPU use on the Amazon instances would
decrease to about 25% with periodic peaks. At least the first
instance/optimization rum took significant longer (several times
longer) than without explicitly including multicores in the genoud
function. The number of cores I used was usually smaller than the
number of cores I had at my service (4 of 8). So it does not seem like
I am able to improve my performance here, even though I think it is
somewhat strange...

(2) I tried to improve the performance by parallelizing the "solution
quality functions" (which are subject to minimization by rGenoud): One
was basically a sorting algorithm (CVaR), the other one just a matrix
multiplication sort of thing. Parallelizing either the composition of
the solution function (which was the sum of the CVaR and matrix
multiplication) or parallelizing the sort function (splitting up the
dataset and later uniting subsets of the solution again) did not show
any improvements: the performance was much worse - even  though all 8
CPUs were 100% idle... I do think that it has to do with all the data
management between the instances...

I am a little bit puzzled now about what I could do... It seems like
there are only very limited options for me to increase the
performance. Does anybody have experience with parallel computations
with rGenoud or parallelized sorting algorithms? I think one major
problem is that the sorting happens rather quick (only a few hundred
entries to sort), but needs to be done very frequently (population
size >2000, iterations >500), so I guess the problem with the
"housekeeping" of the parallel computation deminishes all benefits.

I tried snowfall (for #2) and the snow package (#1). I also tried the
"foreach" library - but could get it working on windows...

Suggestions with respect to operating system, Amazon AWS, or rgenoud
are highly appreciated.

Thanks a lot!

Lui

__
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] Memory(RAM) issues

2011-06-11 Thread Lui ##
Hello Abhisek,

maybe you wanna try it on just a bigger machine (I guess you are
working at a university, so I hope you do have access to them). In
case getting computing time or the like is a major issue, you may
wanna try Amazon AWS: For a few rupees (about 50-100 per hour) you can
"rent" pretty fast computers (20 Ghz, 8BG of RAM). You may want to try
out the Windows version (little bit more expensive) which is easily
accessible via remote desktop. Installing Revolution (which is free
for academic purposes) (64 Bit Version) might give you a good start.
Maybe its not a viable option in a long term view (pricing), but it
might help to get a clue whether the problem can be solved on a bigger
machine and just trying it out without a bigger hastle...

Good luck!

Lui

On Sat, Jun 11, 2011 at 7:47 AM, Abhisek Saha  wrote:
> Thanks Anupam for your inputs. I believe there are two ways to
> circumvent the issue...1> making the code more efficient 1> Increasing
> the memory in some way.The reasons why I did not paste the code are 1>
> It is long and using quite a number of functions that  I created 2>
> Secondly my intention is not to make the code more efficient if that's
> possible. Here landing into a memory problem with 2 GB RAM is natural
> as my analysis entails 1500 simulations from huge multivariate
> distributions that change after every simulation and tomorrow I may
> have to do similar analysis with 10 million observations * 20 columns.
>
> In view of above I shall be needing more memory sometime later and my
> IT friends are ready to support me for that(probably with a sandbox)
> but I am not sure whether I can install probably a servor version of R
> that can be capable of working with 8GB or so RAM. So it is more of
> technical help I need and I have no clue regarding the plausibility of
> the solution mentioned( i.e. a servor version of R that is capable of
> more memory).
>
> Regards,
> Abhisek
>
> On Sat, Jun 11, 2011 at 10:10 AM, Anupam  wrote:
>>
>> It will be helpful on this forum to use metric measures: 12 Lakh is 1.2
>> million, thus your data is 1.2 million observations x 15 variables. I do not
>> know the intricacies of R. You may have to wait for someone with that
>> knowledge to respond.
>>
>> Including some relevant portions of error messages and code in your query
>> can also help someone to respond to your message.
>>
>> Anupam.
>> -Original Message-
>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
>> Behalf Of Abhisek Saha
>> Sent: Saturday, June 11, 2011 6:25 AM
>> To: r-help@r-project.org
>> Subject: [R] Memory(RAM) issues
>>
>> Dear All,
>> I have been working with R(desktop version) in VISTA. I have the latest
>> version R 2.13.0. I have been working with few data-sets of size 12Lakh * 15
>> and my code is quite computing intensive ( applying MCMC gibbs sampler on a
>> posterior of 144 variables) that often runs into a memory issue such as
>> memory can not allocate the vector ,full size(shows to have reached
>> something like 1.5 GB) reached or something to this effect. I have a RAM of
>> 2GB.  I checked with the option like memory.size and it says a 64 bit R if
>> sat on 64 bit windows then max memory capability is 8TB.
>>
>> Now I don't have  background to understand the definitions and differences
>> between 32 and 64 bit machines and other technical requirements like servor
>> etc but it would be of great help if anyone can let me have a feel of it.
>> Could any of you tell me whether some servor version of R would resolve my
>> issue or not (I am not sure now what kind of servor my company would allow R
>> to be installed at this point ,may be linux type) and if that's the case
>> could any of you guide me about how to go about installing that onto a
>> sevor.
>>
>> Thank you,
>> Abhisek
>>
>>        [[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-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] Amazon AWS, RGenoud, Parallel Computing

2011-06-11 Thread Lui ##
Hello Mike,

thank you very much for your response!
Best to my knowledge the sort algorithm implemented in R is already
"backed by C++" code and not natively written in R. Writing the code
in C++ is not really an option either (i think rGenoud is also written
in C++). I am not sure whether there really is a "bottleneck" with
respect to the computer - I/O is pretty low, plenty of RAM left etc.
It really seems to me as if parallelizing is not easily possible or
only at high costs so that the benefits diminish through all the
coordination and handling needed...
Did anybody use rGenoud in "cluster mode" an experience sth similar?
Are quicksort packages available using multiple processors efficiently
(I didnt find any... :-( ).

I am by no means an expert on parallel processing, but is it possible,
that benefits from parallelizing a process greatly diminish if a large
set of variables/functions need to be made available and the actual
function (in this case sorting a few hundred entries) is quite short
whereas the number of times the function is called is very high!? It
was quite striking that the "first run" usually took several hours
(instead of half an hour) and the subsequent runs were much much
faster..

There is so much happening "behind the scenes" that it is a little
hard for me to tell what might help - and what will not...

Help appreciated :-)
Thank you

Lui

On Sat, Jun 11, 2011 at 4:42 PM, Mike Marchywka  wrote:
>
>
>
>
> 
>> Date: Sat, 11 Jun 2011 13:03:10 +0200
>> From: lui.r.proj...@googlemail.com
>> To: r-help@r-project.org
>> Subject: [R] Amazon AWS, RGenoud, Parallel Computing
>>
>> Dear R group,
>>
>>
> [...]
>
>> I am a little bit puzzled now about what I could do... It seems like
>> there are only very limited options for me to increase the
>> performance. Does anybody have experience with parallel computations
>> with rGenoud or parallelized sorting algorithms? I think one major
>> problem is that the sorting happens rather quick (only a few hundred
>> entries to sort), but needs to be done very frequently (population
>> size >2000, iterations >500), so I guess the problem with the
>> "housekeeping" of the parallel computation deminishes all benefits.
>>
> Your sort is part of algorithm or you have to sort results after
> getting then back out of order from async processes? One of
> my favorite anecdotes is how I used a bash sort on huge data
> file to make program run faster ( from impractical zero percent CPU
> to very fast with full CPU usage and you complain about exactly
> a lack of CPU saturation). I guess a couple of comments. First,
> if you have specialized apps you need optimized, you may want
> to write dedicated c++ code. However, this won't help if
> you don't find the bottleneck. Lack of CPU saturation could
> easily be due to "waiting for stuff" like disk IO or VM
> swap. You really ought to find the bottle neck first, it
> could be anything ( except the CPU maybe LOL). The sort
> that I used prevented VM thrashing with no change to the app
> code- the app got sorted data and so VM paging became infrequent.
> If you can specify the problem precisely you may be able to find
> a simple solution.
>
>

__
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] Hidden Markov Chains - mhsmm

2011-06-17 Thread Lui ##
Dear R-Users,

I am currently trying my luck with Hidden Markov Chains and use the
package mhsmm. I was very "shocked" to see how the initial values for
the transition matrix and probability distributions affected the
outcomes. The results were extremely different even for small changes
in the initial parameter settings. I would usually start with a "rough
guesstimate" which seemed to work quite well:

data.hsmm <- list(x=as.numeric(data),N=nrow(data))
J <- 2 # 2 Regimes
P0 <- matrix(c(0.99,0.01,0.03,0.97), nrow=J,ncol=J)
b0 <- list(mu=c(0.05,-0.05),sigma=c(0.001,0.005)) # first regime has
positive return and lwoer variance than second one; initiating values
init0 <- c(0.5,0.5) # Initial starting probabilities
startval <- hmmspec(init=init0, trans=P0, parms.emis=b0, dens.emis=dnorm.hsmm)
tryCatch(regime <- hmmfit(data.hsmm, startval,
mstep=mstep.norm,tol=1e-10),error=function(err) return(0))

Since it is a larger set of data (several different objects that are
observed) the initial values need to be chosen "across all items to be
evaluated". I did not see any difference when changing the tolerance
or making any changes to the number of "maximal iterations".

Any other package suggestions with which I may avoid this problem? How
are you choosing the "set up variables"?

Thank you very much in advance!

Lui

__
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] Hidden Markov Chains - mhsmm

2011-06-17 Thread Lui ##
Dear R-Users,

I am currently trying my luck with Hidden Markov Chains and use the
package mhsmm. I was very "shocked" to see how the initial values for
the transition matrix and probability distributions affected the
outcomes. The results were extremely different even for small changes
in the initial parameter settings. I would usually start with a "rough
guesstimate" which seemed to work quite well:

data.hsmm <- list(x=as.numeric(data),N=nrow(data))
J <- 2 # 2 Regimes
P0 <- matrix(c(0.99,0.01,0.03,0.97), nrow=J,ncol=J)
b0 <- list(mu=c(0.05,-0.05),sigma=c(0.001,0.005)) # first regime has
positive return and lwoer variance than second one; initiating values
init0 <- c(0.5,0.5) # Initial starting probabilities
startval <- hmmspec(init=init0, trans=P0, parms.emis=b0, dens.emis=dnorm.hsmm)
tryCatch(regime <- hmmfit(data.hsmm, startval,
mstep=mstep.norm,tol=1e-10),error=function(err) return(0))

Since it is a larger set of data (several different objects that are
observed) the initial values need to be chosen "across all items to be
evaluated". I did not see any difference when changing the tolerance
or making any changes to the number of "maximal iterations".

Any other package suggestions with which I may avoid this problem? How
are you choosing the "set up variables"?

Thank you very much in advance!

Lui

__
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] Hidden Markov Chains - mhsmm

2011-06-18 Thread Lui ##
Dear R-Users,

I am currently trying my luck with Hidden Markov Chains and use the
package mhsmm. I was very "shocked" to see how the initial values for
the transition matrix and probability distributions affected the
outcomes. The results were extremely different even for small changes
in the initial parameter settings. I would usually start with a "rough
guesstimate" which seemed to work quite well:

data.hsmm <- list(x=as.numeric(data),N=nrow(data))
J <- 2 # 2 Regimes
P0 <- matrix(c(0.99,0.01,0.03,0.97), nrow=J,ncol=J)
b0 <- list(mu=c(0.05,-0.05),sigma=c(0.001,0.005)) # first regime has
positive return and lwoer variance than second one; initiating values
init0 <- c(0.5,0.5) # Initial starting probabilities
startval <- hmmspec(init=init0, trans=P0, parms.emis=b0, dens.emis=dnorm.hsmm)
tryCatch(regime <- hmmfit(data.hsmm, startval,
mstep=mstep.norm,tol=1e-10),error=function(err) return(0))

Since it is a larger set of data (several different objects that are
observed) the initial values need to be chosen "across all items to be
evaluated". I did not see any difference when changing the tolerance
or making any changes to the number of "maximal iterations".

Any other package suggestions with which I may avoid this problem? How
are you choosing the "set up variables"?

Thank you very much in advance!

Lui

__
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] Memory(RAM) issues

2011-06-24 Thread Lui ##
...you should find a 64 bit Linux version here:

http://cran.r-project.org/bin/linux/



On Thu, Jun 23, 2011 at 6:04 PM, David Winsemius  wrote:
>
> On Jun 23, 2011, at 11:57 AM, Abhisek Saha wrote:
>
>> Hi Lui, Anupam and my other R-user friends,
>> Thanks  for your previous suggestions. As for my issue, it is clearly
>> RAM problem as my code is running perfectly as long as my input data
>> size is small and code has been refined a number of times to increase
>> efficiency [ by using matrix more in the context of manipulations and
>> reducing order of time complexity wherever possible]. Yet  it has
>> gotta run 2000 iterations and in each of the iterations it repeatedly
>> modifies  few [0.5 Mn * 15] tables
>>
>> After few basic investigation it seems that the problem MAY be
>> resolved if 64 bit version of R is installed in 64 bit OS as it claims
>> to be able use potentially a  8TB RAM ( for my case I think 4 GB RAM
>> may serve the purpose but 2 GB is not enough) if available.I don't
>> have any domain knowledge in IT since I hail from a statistics
>> background.  I work in a company as a statistical analyst. The IT
>> folks of my company are ready to deploy any free solution but I need
>> to tell them what software needs to be installed and what all OS
>> configurations would be required. They normally run all of the
>> applications on unix servors.
>>
>> So I need to know if any free 64 bit of R version can be installed in
>> unix servor or if not unix, may be on other servor. So hereby I
>> request my R-user friends to please let me know if any free 64 bit
>> version of R is available
>
> Yes.
>
>> that can be installed on any unix servor. If
>> that is not available is there any other FREE  solution and if
>> available, how to get that and what all configuration is required.
>
> There are a bunch of "UNIX-alike" platforms. Read the FAQ:
>
> http://cran.r-project.org/doc/FAQ/R-FAQ.html#What-machines-does-R-run-on_003f
>
> -- David.
>>
>> Awaiting your replies,
>> Regards,
>> Abhisek
>>
>> P.S. Please forward this mail to any other R-mailing list if you deem
>> it fit for any of them.
>>
>> On Sat, Jun 11, 2011 at 4:38 PM, Lui ## 
>> wrote:
>>>
>>> Hello Abhisek,
>>>
>>> maybe you wanna try it on just a bigger machine (I guess you are
>>> working at a university, so I hope you do have access to them). In
>>> case getting computing time or the like is a major issue, you may
>>> wanna try Amazon AWS: For a few rupees (about 50-100 per hour) you can
>>> "rent" pretty fast computers (20 Ghz, 8BG of RAM). You may want to try
>>> out the Windows version (little bit more expensive) which is easily
>>> accessible via remote desktop. Installing Revolution (which is free
>>> for academic purposes) (64 Bit Version) might give you a good start.
>>> Maybe its not a viable option in a long term view (pricing), but it
>>> might help to get a clue whether the problem can be solved on a bigger
>>> machine and just trying it out without a bigger hastle...
>>>
>>> Good luck!
>>>
>>> Lui
>>>
>>> On Sat, Jun 11, 2011 at 7:47 AM, Abhisek Saha  wrote:
>>>>
>>>> Thanks Anupam for your inputs. I believe there are two ways to
>>>> circumvent the issue...1> making the code more efficient 1> Increasing
>>>> the memory in some way.The reasons why I did not paste the code are 1>
>>>> It is long and using quite a number of functions that  I created 2>
>>>> Secondly my intention is not to make the code more efficient if that's
>>>> possible. Here landing into a memory problem with 2 GB RAM is natural
>>>> as my analysis entails 1500 simulations from huge multivariate
>>>> distributions that change after every simulation and tomorrow I may
>>>> have to do similar analysis with 10 million observations * 20 columns.
>>>>
>>>> In view of above I shall be needing more memory sometime later and my
>>>> IT friends are ready to support me for that(probably with a sandbox)
>>>> but I am not sure whether I can install probably a servor version of R
>>>> that can be capable of working with 8GB or so RAM. So it is more of
>>>> technical help I need and I have no clue regarding the plausibility of
>>>> the solution mentioned( i.e. a servor version of R that is capable of
>>>> more memory).
>>>>
>>>> Regards,
>>>> Abhi

[R] Truly Global Variables

2011-01-22 Thread Lui ##
Hello everybody,

I have a problem that is bothering me for  quite a while now and I
don't know the answer... I want to create global variables (out of a
function) which I can access from all other functions... But somehow
that does not work too well. Attached some code for an example:

function_called <- function (){
result = globalvariable*globalvariable
print(result)

}

function_calls <- function(){
assign("globalvariable",10,pos=-1,envir=as.environment(pos))
function_called()
}

function_calls()

I would have assumed that I will get "100" printed on my screen, but
instead it said: "Fehler in function_called() : Objekt
'globalvariable' nicht gefunden", so the function "function_called"
did not have access to the variable "globalvariable".

I would be very thankful for some help... I want to implement it in
the genetic algorithms provided by the rgenoud package and dont know
any other way to have "changing" constraints (e.g. Portfolio
optimization and covariance matrix).
Thanks in advance! Any help greatly appreciated!

Lui

__
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] Creating a list of lists / hclust elements

2011-02-07 Thread Lui ##
Dear group,

I am currently struggling with the following problem for a while:

I want to create a list whose elements consists of lists themselves.
More concise: The list elements are HCLUST objects. However, when I
try to append the HCLUST objects to my list via:

cluster_list <- append(cluster_list, HCLUSTobject)

the HCLUST object is appended - but not as an object but as its
components. So cluster_list[[1]] will not return the HCLUST object,
but the first element of the first cluster object. So the list is
appended to the list, but instead of appending "the object", its
individual components are added...

Does anybody have an idea how I can solve this?

Thanks!

Lui

__
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] Creating a list of lists / hclust elements

2011-02-07 Thread Lui ##
Hi David, I tried this one, but unfortunately it didn't solve the
problem (same result as append).
Thank you very much for your suggestion!

Lui

On Mon, Feb 7, 2011 at 5:14 PM, David Winsemius  wrote:
>
> On Feb 7, 2011, at 10:45 AM, Lui ## wrote:
>
>> Dear group,
>>
>> I am currently struggling with the following problem for a while:
>>
>> I want to create a list whose elements consists of lists themselves.
>> More concise: The list elements are HCLUST objects. However, when I
>> try to append the HCLUST objects to my list via:
>>
>> cluster_list <- append(cluster_list, HCLUSTobject)
>
> Why not?:
>
> cluster_list <- c(cluster_list, HCLUSTobject)
>
> --
> David Winsemius, MD
> West Hartford, CT
>
>

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


[R] Predictive analysis based on past data

2016-12-28 Thread Winson Lui
HI,

I have a historical dataset which tells who bought our products. This dataset 
contains ID, Age, Gender and Salary.
I have another set of data which contains the four fields above.
How should I use R to calculate the probability of purchase of each customer in 
the second dataset or whether they would buy our products (T/F)?
Should I use glm function? If yes, how should I approach this?
Thanks.

Regards,
Winson Lui
Business Analyst
M: +44 (0) 79 1714 6247
E: winson@bwinparty.com<mailto:winson@bwinparty.com>


[[alternative HTML version deleted]]

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


[R] Problem installing R 2.12.1 on Mac OS X Yosemite 10.10.5

2017-01-11 Thread Florence Lui
I'm trying to download version 2.12.1 of R in order for it to be compatible
with the version of SPSS I have on my computer (SPSS V. 20), so that I can
install the Essentials for R plugin for SPSS.

However, when I try to install this version of R, I get a popup saying it
can't be installed because it requires Mac OS X 10.5 or higher (see
attached). But I do have a higher operating system--Mac OS X Yosemite
10.10.5.

Any idea what might be wrong? Thanks for your help!
-- 
Florence Lui

[[alternative HTML version deleted]]

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