similar to: Conditional statement

Displaying 20 results from an estimated 3000 matches similar to: "Conditional statement"

2006 Feb 08
1
Simple optim - question
Hello, I want to find the parameters mu and sigma that minimize the following function. It's important, that mu and sigma are strictly positive. ----------------- optimiere = function(fmean,smean,d,x,mu,sigma) { merk = c() for (i in 1:length(d)) merk=c(merk,1/(d[i]^2)*(d[i]-1/(fmean*(1-plnorm(x[i],mu,sigma))))^2) return(sum(merk)) } ----------------- To do that I'm using the nlm
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
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
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
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"),
2009 Apr 25
5
Out of memory issue
Hi all, I am trying to run some plots on data, but when loading he CSV data file R is stopping and I am getting an out of memory error. Anyway to tweak this somehow to get it to run? Using WinXP with 4 GB RAM Tnx Bruce
2008 Apr 22
2
bootstrap for confidence intervals of the mean
d = c(0L, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, 0L, 0L, 7375L, NA, NA, 17092L, 0L, 0L, 32390L, 2326L, 22672L, 13550L, 18285L) boot.out <-boot(d, mean, R=1000, sim="permutation") Error in mean.default(data, original, ...) : 'trim' must be numeric of length one I know that I am missing something but I can't figure it out. thanks stephen -- Let's not spend our
2009 Oct 15
4
Generating a stochastic matrix with a specified second dominant eigenvalue
Hi, Given a positive integer N, and a real number \lambda such that 0 < \lambda < 1, I would like to generate an N by N stochastic matrix (a matrix with all the rows summing to 1), such that it has the second largest eigenvalue equal to \lambda (Note: the dominant eigenvalue of a stochastic matrix is 1). I don't care what the other eigenvalues are. The second eigenvalue is
2015 Apr 05
2
nutdrv_qx hangs after send: QS
Thank you for the rapid response. I will try and investigate getting answers to some of your points but I'm a little new to Solaris so I'll need some time. Glancing at the configure output, it looks like it built against v0.1.7 of libusb (yes i think that is derived from the one you mention), checking for libusb version via pkg-config... 0.1.7 found checking for libusb cflags... checking
2015 Sep 11
3
"upsmon -c fsd" cause system shutdown
hi: my testing server has two power supply and attach to two ups. one of the ups is connect to the server with usb. my upsmon.conf like below: # for two ups MONITOR ftups at localhost 1 monmaster nutmaster master MONITOR ftups at 10.1.1.2 1 monslave nutslave slave MINSUPPLIES 1 # for early shutdown NOTIFYFLAG ONBATT EXEC+WALL+SYSLOG NOTIFYFLAG ONLINE EXEC+WALL+SYSLOG NOTIFYCMD
2020 Jan 27
3
System with MGE UPS shuts down too early
On 1/25/20 10:53 AM, Georgi D. Sotirov wrote: > OK, so yesterday evening I done a real test cutting of the power to > the UPS. And it went good... the UPS supported my server for 28:50 > minutes (i.e. the expected runtime with this load), before forcing > shutdown. The batteries could still hold as charge was 30 % with about > 15 minutes run time. And the UPS did hold for
2020 Jan 24
2
System with MGE UPS shuts down too early
On January 24, 2020 6:13:31 PM GMT+02:00, "Georgi D. Sotirov" <gdsotirov at gmail.com> wrote: >OK, my UPS turned out to be older that I thought. I apparently bought >and installed it in September 2016 (not 2017 as I initially wrote). >That >makes for over 3 years of work, which is over the life expectancy of >the >batteries, Good batteries can last 4-5 years.
2020 Aug 14
4
Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)
Thanks Larry, no problem. I appreciate the input. Whenever you get a chance I’d really like to compare notes with someone who has NUT and a Synology to see why the heck mine doesn’t work! ;). I’m also using my Pi as the master like you. Thanks. Todd -- Todd Benivegna // todd at benivegna.com On Aug 14, 2020, 11:55 AM -0400, Larry Fahnoe <fahnoe at fahnoetech.com>, wrote: > On Fri, Aug
2013 Sep 11
1
Issue with slave FSD notification on Windows port of NUT
I have the latest version of the Windows port of NUT installed on my Windows?7?machine. The UPS is connected via serial cable to the Windows machine. I also have my Synology NAS (which uses NUT) connected over the local network as a slave to the Windows NUT master. The Synology slave is configured to immediately go into "safe mode" whenever an FSD or OB+LB indication is received from the
2020 Aug 14
1
Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)
On Fri, 14 Aug 2020, Todd Benivegna wrote: > https://forum.synology.com/enu/viewtopic.php?f=19&t=73960&hilit=ups+slave  > > I have the latest version of the Windows port of NUT (A UPS management package) installed on my Windows 7 machine. The UPS I am using is a > very old APC BK650M which is controlled and sends its status via a special serial cable to the Windows