Displaying 20 results from an estimated 400 matches similar to: "Simple optim - question"
2009 Nov 16
2
Conditional statement
Dear useRs,
I wrote a function that simulates a stochastic model in discrete time.
The problem is that the stochastic parameters should not be negative and sometimes they happen to be.
How can I conditionate it to when it draws a negative number, it transforms into zero in that time step?
Here is the function:
stochastic_prost <- function(Fmean, Fsd, Smean, Ssd, f, s, n, time, out=FALSE,
2016 Apr 03
1
apply mean function to a subset of data
Here are several ways to get there, but your original loop is fine once it is corrected:
> for (i in 1:2) smean[i] <- mean(toy$diam[toy$group==i][1:nsel[i]])
> smean
[1] 0.271489 1.117015
Using sapply() to hide the loop:
> smean <- sapply(1:2, function(x) mean((toy$diam[toy$group==x])[1:nsel[x]]))
> smean
[1] 0.271489 1.117015
Or use head()
> smean <- sapply(1:2,
2016 Apr 02
0
apply mean function to a subset of data
Hi Pedro,
This may not be much of an improvement, but it was a challenge.
selvec<-as.vector(matrix(c(nsel,unlist(by(toy$diam,toy$group,length))-nsel),
ncol=2,byrow=TRUE))
TFvec<-rep(c(TRUE,FALSE),length.out=length(selvec))
toynsel<-rep(TFvec,selvec)
by(toy[toynsel,]$diam,toy[toynsel,]$group,mean)
Jim
On 4/3/16, Pedro Mardones <mardones.p at gmail.com> wrote:
> Dear all;
>
2016 Apr 02
3
apply mean function to a subset of data
Dear all;
This must have a rather simple answer but haven't been able to figure it
out: I have a data frame with say 2 groups (group 1 & 2). I want to select
from group 1 say "n" rows and calculate the mean; then select "m" rows from
group 2 and calculate the mean as well. So far I've been using a for loop
for doing it but when it comes to a large data set is
2004 Dec 03
1
Difficulty implementing "scales" in a lattice plot
Hello all,
I am rather new to lattice and have a simple question regarding formatting text labels on the axes. I have looked through my own archive on lattice notes, searched and examined 30 or so hits on Dr. Baron's search site, looked through my MASS book, my Data Analysis and Graphics Using R book, R news articles, and I have in my hand the lattice package instructions and have read and
2005 Jan 31
2
ML-Fit for truncated distributions
Hello,
maybe that my Question is a "beginner"-Question, but up to now, my research
didn't bring any useful result.
I'm trying to fit a distribution (e.g. lognormal) to a given set of data
(ML-Estimation). I KNOW about my data that there is a truncation for all
data below a well known threshold. Is there an R-solution for an
ML-estimation for this kind of data-problem? As
2011 Dec 15
1
How to open files that contain "0"
Hi all,
How can I set open files that contain values of Zero =0?
These are valid values for the parameters I need to evaluate.
I have tried CSV and tab formats.
Trying XL Connect and/or XLConnectJars dies not seem to work to open
Excel files so I am at a loss on how to get the data into a DF.
Sample of data with 0 values:
Filename Dur TBC Fmax Fmin Fmean Fc S1 Sc Pmc
g8221843.13#
2007 Apr 21
0
possible bug in xYplot and smean.cl.normal
I'm using R (2.4.1) and Hmisc (3.3-1), and I'd like to plot confidence
intervals using xYplot and smean.cl.normal (or smean.cl.boot) from Hmisc.
You can do that using the summarize() to produce a new data.frame and then
plot with xYplot, or by specifying method=smean.cl.normal in the xYplot.
Both produce very similar graphs in all trivial examples I've tried, but not
in the attached
2007 Dec 12
6
namespace problem / 1.1beta11
Hi all,
actually I got a problem with the namespaces in dovecot 1.1 beta11. It occured after purging index files and resynch via imapsync. Dovecot complains about "Unknown namespace", though it worked with versions before. I cannot comfirm for 1.1beta10, but I surely know 1.1beta9 worked with these settings.
Example:
From Folder [INBOX/Trash]
To Folder [___________]
To Folder
2018 Apr 17
2
iterative read - write
Hi all,
I would like to set up an iterative read & write sequence to avoid
reading and writing each file one at a time.
Hundreds of data sets to re-calculate.? The code I have works well
individually, but would like to set up an iterative read, calculate and
write changing the input and output file names each iteration.
I? think I have read that there is an R? feature using
2009 Apr 26
6
Memory issues in R
How do people deal with R and memory issues?
I have tried using gc() to see how much memory is used at each step.
Scanned Crawley R-Book and all other R books I have available and the FAQ
on-line but no help really found.
Running WinXP Pro (32 bit) with 4 GB RAM.
One SATA drive pair is in RAID 0 configuration with 10000 MB allocated as
virtual memory.
I do have another machine
2016 Dec 20
2
NUT Client shuts down when performing runtime calibration on APC UPS
Hello,
I am using an APC UPS (Smart-UPS 2200 RM) to secure my SAN. The SAN runs on FreeBSD 9.1-RELEASE-p5 and is using NUT 2.6.5 version 2. Since the UPS has also a Network card AP9630 I am using the snmp-ups driver to connect the SAN to the UPS for signaling.
Last week I need to change the battery pack and then I needed to perform a runtime calibration. I used the web interface of the AP9630
2005 Mar 12
1
MLE for two random variables
Hello,
I've the following setting:
(1) Data from a source without truncation (x)
(2) Data from an other source with left-truncation at threshold u (xu)
I have to fit a model on these these two sources, thereby I assume that both
are "drawn" from the same distribution (eg lognormal). In a MLE I would sum
the densities and maximize. The R-Function could be:
2015 Jan 20
2
[LLVMdev] [ LLI / MCJIT] re-initializing of lli ...
Hi Armin,
Argument parsing isn't handled by the JIT. This sounds like you're making
redundant calls to cl::ParseCommandLineOptions ?
Deleting the ExecutionEngine and any RTDyldMemoryManager instances that
you've created should be enough to reset the JIT.
Cheers,
Lang.
On Tue, Jan 20, 2015 at 12:38 PM, Armin Steinhoff <armin at steinhoff.de>
wrote:
>
> Hi,
>
>
2017 Jan 10
0
NUT Client shuts down when performing runtime calibration on APC UPS
On Jan 9, 2017, at 9:46 AM, Merk - Oliver <oliver.merk at pecon.biz> wrote:
>
> I then connected to my QNAP and set the UPS settings on the web interface to "Shutdown server if power loss is 5 min", the UPS is configured to an SNMP-Connection with its IP-address. Started runtime calibration and after 5min. the QNAP NAS has shut down. But before that I connected via SSH on
2012 Nov 12
2
[LLVMdev] getPointerToGlobal() / MCJIT
Hi all,
are there any plans to correct/implement the "getPointerToGlobal()"
method for accessing global variables that are emitted by MCJIT?
(see for details the unit test of MCJIT)
Best Regards
Armin
2017 Jan 11
3
NUT Client shuts down when performing runtime calibration on APC UPS
I've setup nas4free (latest version 11.0.0.4, which has NUT 2.7.4) in a VM and configured it via webinterface to my APC UPS and set "shutdown mode" to "UPS goes on battery" with a timer of 30s. Then I started runtime calibration on the UPS and after 30s nas4free has shut down! I think this is not the correct behavior, since the status was "OB CAL". The system
2015 Jan 18
4
[LLVMdev] New JIT APIs
> From: Armin Steinhoff [mailto:armin at steinhoff.de]
> Subject: Re: [LLVMdev] New JIT APIs
> is
> delete EE; // execution engine
> llvm_shutdown();
> sufficient ?
AFAICT, llvm_shutdown() must not be called unless you reach a point where LLVM will not be used again by the process (e.g., termination), as it destroys statically allocated objects. We delete the
2012 Oct 13
2
[LLVMdev] Dynamically loading native code generated from LLVM IR
Daniel,
I didn't find the MCJIT directory under unitests/ExecutionEngine ...
there is only a directory called JIT.
You mean this directory ?
Many thanks
--Armin
Malea, Daniel wrote:
> Take a look at the MCJIT unit tests under unittests/ExecutionEngine/MCJIT
>
> The MCJITTestBase class does the majority of the interactions with the LLVM API you're referring to.
>
>
2002 May 23
2
crosstabulation of means
Hello, I am trying to print a crosttabulation of mean,sd,n for a
continuous variable crossclassified by anoother/s grouping variables. I
came up with:
xtab2 <- function(x,g1,g2) {
funy <- function(z)
list(mean(z,na.rm=T),sd(z,na.rm=T),length(z))
aa <- by(x,list(g1,g2),funy)
bb <- matrix(unlist(aa),nrow=3
,dimnames=list(c("mean","sd","n"),