similar to: Vectorising and loop (was Re: optim "a log-likelihood function")

Displaying 20 results from an estimated 2000 matches similar to: "Vectorising and loop (was Re: optim "a log-likelihood function")"

2003 Oct 21
5
run R under linux
Dear all, Our department uses the linux system and we are not allowed to submit job directly. We must make a batch to submit through "qmon". so, I make a foo.sh file, which only contains one line: nohup R --vanilla < foo.txt > foo.results foo is all my codes. It is a simulation of 200 times. I set the seed at the beginning. It is to estimate the success probability, which is
2004 Oct 16
7
sapply and loop
Dear all, I am doing 200 times simulation. For each time, I generate a matrix and define some function on this matrix to get a 6 dimension vector as my results. As the loop should be slow, I generate 200 matrice first, and save them into a list named ma, then I define zz<-sapply(ma, myfunction) To my surprise, It almost costs me the same time to get my results if I directly use a loop
2004 Oct 16
7
sapply and loop
Dear all, I am doing 200 times simulation. For each time, I generate a matrix and define some function on this matrix to get a 6 dimension vector as my results. As the loop should be slow, I generate 200 matrice first, and save them into a list named ma, then I define zz<-sapply(ma, myfunction) To my surprise, It almost costs me the same time to get my results if I directly use a loop
2003 Oct 10
3
command line limit under unix?
Dear all, I have made my testing program to run successfully under unix in the background. However, my simulation work does not work. I read the foo.results file, I found it only have part of my code and not any output I want. Is there any line limit? My code is nearly 400 line. I can cut some of them, but I want to know whether there is any limit or exactly the number of limit is. Thanks.
2004 Oct 19
0
Question on Rprof(); was: Re: sapply and loop
Yes. It should have something to do with read/write permissions, but it is not clear how it happens. I can write file to C drive using R. I usually write my results matrix to a txt file in C drive. For Rprof(), the boot.out file can be created, but only with one line sample.interval=20000 The situation is the same even if I specify the directory to the D drive,where I have the full
2004 Sep 29
2
optim "a log-likelihood function"
Hello, i know that i have to use optim, but i'm confused how its possible maximize the sum over all l[i] and get the optimized max(LL), r and alpha? LL <- function(trans,time){ for(i in 1:length(trans){ l[i] <- log(lgamma(r+trans[i] - gamma(r+1)*(alpha/alpha+t[i]))**r)*(t[i]/alpha+t[i]))**trans[i] } return(sum(l)) } i'm confused how i have to set r and alpha and i
2003 Dec 19
1
iterative proportional fitting
Dear all, I wonder if there are some function or package in R which can do the iterative proportional fitting. In the exponential model f(y1,...yn)=exp(a'yi+b'(yi*yj)+.....+c'(y1*...*yn)+constance), instead of the canonical parameters, I use maginal probability instead of a and log odds ratio instead of b. and for the order higher than 3, I use the canonical way or even assume
2009 Dec 15
3
RFC: lchoose() vs lfactorial() etc
lgamma(x) and lfactorial(x) are defined to return ln|Gamma(x)| {= log(abs(gamma(x)))} or ln|Gamma(x+1)| respectively. Unfortunately, we haven't chosen the analogous definition for lchoose(). So, currently > lchoose(1/2, 1:10) [1] -0.6931472 -2.0794415 NaN -3.2425924 NaN -3.8869494 [7] NaN -4.3357508 NaN -4.6805913 Warning message: In
2008 Feb 27
1
dhyper, phyper (PR#10853)
Aloha all, I know too little about what I'm about to write and hope I'm not wasting your time. For a class I'm teaching in archaeological data analysis, I'm trying to put together a routine that calculates the so-called Petersen index and, especially, confidence intervals for the index. This was introduced to archaeologists by N.R.J. Fieller and A. Turner in an article
2011 Feb 11
3
How can we make a vector call a function element-wise efficiently?
Hello I have a time-comsuming program which need to simplify, I have tested the annotated program as follow: > #define function which will be call > calsta <- function(c, n=100000) + { + i <- seq(from=0, length=c) + logx <- lchoose(NT-n, CT-i) + lchoose(n, i) + logmax <- max(logx) + logmax + log(sum(exp(logx - logmax))) + } > CT=6000 #assignment to CT >
2009 Jan 17
2
DierckxSpline segfault
I've just encountered a segfault when using DierckxSpline::percur function. Below is the minimal example which triggers the error: --- library(DierckxSpline) x <- 1:10 y <- rep(0, 10) pspline <- percur(x, y) --- *** caught segfault *** address (nil), cause 'memory not mapped' Traceback: 1: .Fortran("percur", iopt = as.integer(iopt), m = as.integer(m), x =
2006 Apr 10
1
does samba support multiple domains?crucial issue for ISP company
Hi samba users, we are an ISP companies running proxy, so the domains we need to work on are large amount, keeping increasing, and moreover belonging to different companies. so whether samba supports multiple domains is an important issue for us to decide whether to adopt samba with proxy. i googled online and found some notion that samba doesnt support multiple domains unless multiple instances
2003 Jan 11
2
beta-binomial
Does anyone have R functions or library to fit a beta-binomial distribution with glm? Thanks.
2009 Oct 16
2
what's the R code for wavelet decomposition (Haar transformation)?
Dear all, Using R function "dwt", it seems that I cannot specify the wavelet transformation like Haar. What's the R code for wavelet decomposition which allows me to specify Haar wavelet transformation? Of course, if it can include "db2", that is even better. In general, I want an R function like matlab code "dwt". Thanks in advance! Zhen Li
2011 Feb 12
1
how to improve the precison of this calculation?
Hello T I want to order some calculation "result", there will be lots of "result" that need to calculate and order PS: the "result" is just a intermediate varible and ordering them is the very aim # problem: # For fixed NT and CT, and some pair (c,n). order the pair by corresponding result # c and n are both random variable CT<-6000 #assignment to CT
2002 Apr 22
2
lattice help
I'm new to lattice and can't figure out what the problem is with the following example: ######################### > library(lattice) Loading required package: grid Attaching package `lattice': The following object(s) are masked _by_ .GlobalEnv : xyplot The following object(s) are masked from package:base : levels > test.data <- data.frame(x=rnorm(100), +
2006 May 22
2
sort the values of members and obtain their ranks within groups
Dear all, I would like to sort the values of "member" for each group, and obtain a variable to indicate its rank within the group. For example, we have original dataset as follows: df <- data.frame(group = c(rep(1, 3), rep(5, 3)), member = c(30, 10, 22, 21, 44, 15)) group member 1 1 30 2 1 10 3 1 22 4 5 21 5 5 44 6 5 15 After
2011 May 04
1
two-way group mean prediction in survreg with three factors
I'm fitting a regression model for censored data with three categorical predictors, say A, B, C. My final model based on the survreg function is Surv(..) ~ A*(B+C). I know the three-way group mean estimates can be computed using the predict function. But is there any way to obtain two-way group mean estimates, say estimated group mean for (A1, B1)-group? The sample group means don't
2005 Jan 05
2
Status of Windows builds for libvorbis/libogg
Hi all, I've just done a quick check of the libvorbis Visual C++ 6.0 project on Windows, and am happy to say that both libvorbis and libogg build fine. (Theora isn't quite so lucky -- see the theora-dev mailing list for details on that.) There are two suggestions I can make, though: 1. To build properly, the directories must be checked out with certain names, and in paths
2004 Oct 14
0
plotmath in underlined style; was: Re: [R] Underline in expression(). (PR#7286)
In order not to forget it (I have not got any answer so far) ... Uwe Ligges -------- Original Message -------- Subject: plotmath in underlined style; was: Re: [R] Underline in expression(). Date: Sun, 26 Sep 2004 18:50:02 +0200 From: Uwe Ligges <ligges@statistik.uni-dortmund.de> Organization: Fachbereich Statistik, Universitaet Dortmund To: John Janmaat <jajanmaat@netscape.net>,