Displaying 20 results from an estimated 5000 matches similar to: "while loop problems"
2007 Apr 26
3
A coding question involving variable assignments in ifelse()
Dear List,
Below is a simple, standard loss model that takes into account the
terms of an insurance policy:
deductible <- 15
coverage.limit <- 75
insurance.threshold <- deductible + coverage.limit
tmpf <- function() {
loss <- rlnorm(rpois(1, 3), 2, 5)
sum(ifelse(loss > insurance.threshold, loss - coverage.limit,
pmin(loss, deductible)))
}
net <- replicate(1000000, tmpf())
2006 Oct 25
2
Isn''t it possible to stub / expect on :id ?
Hi all !
Running this:
@payout = stub_everything(:id => 141)
Payout.stubs(:find).with(@payout.id).returns(@payout)
Generates this warning:
./test/functional/payouts_controller_test.rb:22: warning: Object#id
will be deprecated; use Object#object_id
What am I missing ? :id is a fairly frequent method to override in
Rails-based applications.
I''m using Mocha from
2012 Jan 13
1
Portfolio Optimization
Hi,
I'm an R newbie and I've been struggling with a optimization problem for
the past couple of days now.
Here's the problem - I have a matrix of expected payouts from different
stock option strategies. Each column in my matrix represents a different
stock and each row represents the return to the strategy given a certain
market move. So the rows are not a time series of percentage
2011 Apr 16
2
superimpose graphs
Hi there,
I have a data frame DF of over 600 people's short term trade data in time
order. Below is the simplified structure of the data.
id invest payout
[1] 1 10 -1
[2] 1 33 33
[3] 1 20 -5
[4] 2 200 33
[5] 2 33 -20
[6] 3 5 -5
[7] 3 5
2011 Apr 16
1
600 people's time series
Hi there,
I have a data frame DF of over 600 people's short term trade data in time
order. Below is the super simplified structure of the data.
id invest payout
[1] 1 10 -1
[2] 1 33 33
[3] 1 20 -5
[4] 2 200 33
[5] 2 33 -20
[6] 3 5 -5
[7] 3
2011 May 12
1
extract integers from string
I have a vector with a long list of sentences that contain integers. I
would like to extract the integers in a manner such that they are
separate and manipulatable. for example:
x[i] <- "sally has 20 dollars in her pocket and 3 marbles"
x[i+1] <- "30 days ago john had a 400k house"
all sentences are different and contain a mixture of both integers and
characters.
i
2008 Dec 04
2
Ruby fun with MegaMillions
I thought I would write a lottery number generator since I have not had any
luck winning the big jackpot - http://megamillions.com/. So far, after over
1.2 million tries, I still have not hit all the numbers from yesterday: 2,
17, 22, 32, 51, 35 (last one is the mega ball).
Fun little project that and I thought others would be interested. Let me
know if you have a cleaner implementation in mind.
2001 Aug 13
5
rsync ipv6 patch merge?
On 13 Aug 2001, "William F. Maton" <wmaton@ryouko.dgim.crc.ca> wrote:
> On 13 Aug 2001, Heikki Vatiainen wrote:
>
> > The rsync daemon we use is plain 2.4.6 patched with KAME rsync patch
> > rsync-246-v6-20000907.diff.gz [1]. It looks like there is a good
> > possibility to get IPv6 merged in, since just today a rsync developer
> > was asking if
2006 Oct 28
2
Package development on Windows - latest guidance?
I would like to start building R packages under Windows XP. I
have programming experience and a minimal but working knowlege
of many Unix (-like) programming tools. The package functions
(for now) will be from R source, not C or Fortran.
I've installed Rtools, Perl, the MS hhc, and so on. I am
setting up a command shell with the correct PATH for building
packages. (The master Windows PATH
2008 Dec 03
1
nlminb: names of parameter vector not passed to objective function
Dear R developers,
I tried to use nlminb instead of optim for a current problem (fitting
parameters of a differential equation model). The PORT algorithm
converged much better than any of optim's methods and the identified
parameters are plausible. However, it took me a while before spotting
the reason of a technical problem that nlminb, in contrast to optim,
does not pass names of the
2010 Dec 10
1
Stricter read.table?
read.table gives idiosyncratic results when the input is formatted
strangely, for example:
read.table(textConnection("a'b\nc'd\n"),header=FALSE,fill=TRUE,sep="",quote="'")
=> "c'd" "a'b" "c'd"
2013 Sep 09
1
theta parameter - plm package
Hi all,
what indicates the parameter theta in the summary of a random effect
panel model estimated with the plm function?
example:
data("Produc", package = "plm")
zz <- plm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp,
model="random", data = Produc, index = c("state","year"))
summary(zz)
Effects:
var std.dev
2009 Apr 27
1
Extract one element from yahooKeystats data
I am trying to extract one particular piece of data(Float) from all
the data returned by yahooKeystats, but thus far I'm having no luck.
This is what I've got so far:
> library(fImport)
Loading required package: timeSeries
Loading required package: timeDate
> data<-yahooKeystats("IBM")
trying URL 'http://finance.yahoo.com/q/ks?s=IBM'
Content type 'text/html;
1998 Feb 19
1
R-beta: t.test
As a very new user of R, and a user of S with very
limited experience, I thought I would start humbly
with a simple t.test.
The response to the command sequence
sample <- scan()
4 5 6 7 8 9
t.test(sample,mu=20)
rather surprised me, because of the idiosyncratic
choice of a confidence interval for the mean of the
population from which the sample was drawn. I asked
my colleague Bob Henery
2011 Jul 07
2
elimination duplicate elements sampling!
Hi everyone!
I have a data frame with 1112 time series and I am going to randomly
sampling r samples for z times to compose different portfolio size(r
securities portfolio). As for r=2 and z=10000,that's:
z=10000
A=seq(1:1112)
x1=sample(A,z,replace =TRUE)
x2=sample(A,z,replace =TRUE)
M=cbind(x1,x2) # combination of 2 series
Because in a portfolio with x1[i]=x2[i],(i=1,2,...,10000) means a 1
2019 Nov 12
4
Enable Contributions Through Pull-request For LLVM
-1 -- switch to PR's
+1 -- Hal's compromise proposal (as long as I can continue to use Phab)
I agree that the documentation could be better, but I don't see that as a
justification for switching from a superior tool to an inferior one. Let's
work on the documentation first, then if there's still a compelling reason
to switch, do it then,
I share most of the concerns already
2019 Feb 24
2
SAMBA DNS interfaces set to br0
On a machine with virtual networking is enabled and two ether net
controllers eth0/192.168.1.2 and eth1/192.168.1.3 and having SAMBA smb.conf
set to:
dns interfaces = lo br0
is there a chance for:
1) The system not to boot with DNS working
2) The DNS server bounce between eth0 and eth1
3) The DNS server portion work on boot sometimes on eth0, but when software
restarted only work on eth1 or
2011 Feb 24
2
Is it a good idea/required to run winbind
We've been running a samba service for many years but have stuck using
3.0.24. Every version I tried after 3.0.24 seemed to have reliability
problems.
But if every version since 3.0.24 was broken I assume someone would have
noticed by now :-). So I'm guessing we're doing somethng idiosyncratic
and/or stupid..
The config we have is that our samba server (solaris) is getting uid/gid
2008 Apr 03
1
X11 image problem in R-2.8.0 Under development / R-2.7
I apologize if this is too obscure to reproduce, or some idiosyncratic
aspects of my system. If I create a plot, e.g.,
> plot(1:10)
I get a graphics device as expected. I then click on the 'zoom' box on
my X11 window, so the window expands to occupy the entire screen. The
plot is redrawn at the scale of the large window, but is clipped to the
'unzoomed' size. I only
2010 Nov 08
1
Unexpected behavior with cat
I am experiencing unexpected behavior with the command cat under
Window GUI builds of R version 2.12.0 (it does not seem to be an issue
in Rterm). For example if I issue the command cat(70,"\r") I get back
text that looks like Asian characters. If I highlight and copy that
text, it is the text I would regularly expect, e.g. the number 70 and
the prompt line. Highlighting the text