[R] Progress in a loop

2006-07-19 Thread Florent Bresson
Hi, I have to use a loop to perform a quite computer intensive estimation and I would like to know the progress of the loop during the process. I tried to include something like print(paste(k,date(),sep= : )) where k is the number of the iteration, but the result appears only at the end of the

[R] RE : Re: Progress in a loop

2006-07-19 Thread Florent Bresson
Thanks, it is exactly what I was looking for. Florent Bresson --- Gavin Simpson [EMAIL PROTECTED] a écrit : On Wed, 2006-07-19 at 16:12 +0200, Florent Bresson wrote: Hi, I have to use a loop to perform a quite computer intensive estimation and I would like to know the progress

[R] Producing a random bistochastic matrix

2006-10-13 Thread Florent Bresson
Hi everyone, I need some help to produce a random bistochastic matrix, that is a squared matrix of positive real numbers e_ij, with sum(e_i)=1 and sum(e_j)=1. Thanks Florent Bresson

[R] Generate a random bistochastic matrix

2006-10-16 Thread Florent Bresson
Please, I would like to generate a random bistochastic matrix, that is a squared matrix of non-negative numbers with each row and each column sum to 1, for example : .2.3.5 .6.3.1 .2 .4 .4 I don't know of to code this. Do you have any idea ? Thanks Florent Bresson

[R] Re : Generate a random bistochastic matrix

2006-10-16 Thread Florent Bresson
-preserving transformation of a vector. - Message d'origine De : Richard M. Heiberger [EMAIL PROTECTED] À : Florent Bresson [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Envoyé le : Lundi, 16 Octobre 2006, 14h58mn 13s Objet : Re: [R] Generate a random bistochastic matrix bistochastic.3x3

[R] Re : Re : Generate a random bistochastic matrix

2006-10-16 Thread Florent Bresson
. Florent Bresson - Message d'origine De : Richard M. Heiberger [EMAIL PROTECTED] À : Florent Bresson [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Envoyé le : Lundi, 16 Octobre 2006, 16h23mn 39s Objet : Re: Re : [R] Generate a random bistochastic matrix I am sorry, I can't figure out what

[R] Re : Generate a random bistochastic matrix

2006-10-16 Thread Florent Bresson
Thanks, I think it's a shrewd solution, but the problem is that it cannot generate every N*N bistochastic matrix and every cell tends to 1/N as B tends to infinity Florent Bresson - Message d'origine De : Dimitris Rizopoulos [EMAIL PROTECTED] À : Florent Bresson [EMAIL PROTECTED] Cc

[R] Re : Re : Generate a random bistochastic matrix

2006-10-16 Thread Florent Bresson
Thanks, it's perfect for my needs. - Message d'origine De : Martin Maechler [EMAIL PROTECTED] À : Florent Bresson [EMAIL PROTECTED] Cc : Richard M. Heiberger [EMAIL PROTECTED]; r-help@stat.math.ethz.ch Envoyé le : Lundi, 16 Octobre 2006, 16h29mn 47s Objet : Re: [R] Re : Generate

[R] Re : Re : Generate a random bistochastic matrix

2006-10-16 Thread Florent Bresson
). Florent Bresson - Message d'origine De : Rolf Turner [EMAIL PROTECTED] À : [EMAIL PROTECTED] Cc : r-help@stat.math.ethz.ch Envoyé le : Lundi, 16 Octobre 2006, 17h50mn 24s Objet : Re: [R] Re : Generate a random bistochastic matrix I don't think this idea has been suggested yet: (1) Form

[R] Problem with na in nls

2005-10-19 Thread Florent Bresson
I'm trying to run a nls on a subset of a data.frame. In the subset, one observation is NA. So I drop the observation but when I ask for : sm - nls(machin$revcum ~ Lc.singh(machin$popcum,p), start=list(p=c(2,3))) I get : Erreur dans parse(file, n, text, prompt) : syntax error in ~ If I put

[R] Implicit nonlinear equation

2005-10-24 Thread Florent Bresson
I can't find a commande to solve an implicit nonlinear equation. Does it exist please ? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

[R] Applying a function to a vector

2005-10-31 Thread Florent Bresson
I have defined a function to compute the value of a beta distribution of the second kind (the existing beta distribution of th stats package is the beta distribution of the first kind). It works perfectly for a single value, but I want to apply it to a vector of 22 000 values. I can use a loop for

[R] Applying a function to a vector

2005-10-31 Thread Florent Bresson
a look at: help(sapply) On Mon, 31 Oct 2005, Florent Bresson wrote: beta distribution of the second kind (the existing beta distribution of th stats package is the beta distribution of the first kind). It works perfectly for a single value, but I want to apply it to a vector of 22 000 values

Re: [R] Applying a function to a vector

2005-10-31 Thread Florent Bresson
It works really faster with mapply. I just had to change my fonction from pbeta2(z,p) with p=c(p1,p2) to pbeta2(z,p1,p2). Thanks for the tip. --- Thomas Lumley [EMAIL PROTECTED] a écrit : On Mon, 31 Oct 2005, Florent Bresson wrote: I just have a try with sapply. The problem is that my

[R] numericDeriv

2005-11-16 Thread Florent Bresson
I have to compute some standard errors using the delta method and so have to use the command numericDeriv to get the desired gradient. Befor using it on my complicated function, I've done a try with a simple exemple : x - 1:5 numericDeriv(quote(x^2),x) and i get : [1] 1 8 27 64 125 216

Re: [R] numericDeriv

2005-11-16 Thread Florent Bresson
Effectively, it's much better thanks --- Prof Brian Ripley [EMAIL PROTECTED] a écrit : On Wed, 16 Nov 2005, Florent Bresson wrote: I have to compute some standard errors using the delta method and so have to use the command numericDeriv to get the desired gradient. Befor using it on my

[R] optimization with inequalities

2005-11-28 Thread Florent Bresson
I have to estimate the following model for several group of observations : y(1-y) = p[1]*(x^2-y) + p[2]*y*(x-1) + p[3]*(x-y) with constraints : p[1]+p[3] = 1 p[1]+p[2]+p[3]+1 = 0 p[3] = 0 I use the following code : func - sum((y(1-y) - p[1]*(x^2-y) + p[2]*y*(x-1) + p[3]*(x-y))^2) estim -

[R] The gamma function and infinity

2005-12-05 Thread Florent Bresson
I have to calculate some formula like: gamma(x)/(gamma(x+y) and I observed that for relatively big values of x, R returns infinity and so cannot compute the formula. Is it possible to force R to give the real value of gamma(x) instead of Inf ? thanks

[R] Quantile function for the generalized beta distribution of the 2nd kind

2005-12-12 Thread Florent Bresson
I have succeded in defining the cdf of the generalized beta of the second kind, eg. pgbeta2 - function(quint,b,a,p1,p2) { integrate(function(x) {exp(log(a)+(a*p1-1)*log(x)-(a*p1)*log(b)-log(beta(p1,p2))-(p1+p2)*log(1+(x/b)^a))},0,quint)$value } but I'm facing problems with the quantile

Re: [R] Quantile function for the generalized beta distribution of the 2nd kind

2005-12-12 Thread Florent Bresson
the tolerances. but it doesn't work Please see the posting guide, and tell us useful information about what precisely happened. On Sun, 11 Dec 2005, Florent Bresson wrote: I have succeded in defining the cdf of the generalized beta of the second kind, eg. pgbeta2 - function(quint,b

[R] search in matrix

2005-12-29 Thread Florent Bresson
I'm dealing with a matrix like : x y z [1,] 24 1 [2,] 61 2 ... [n,] 73 1 For each row I would like to know the header of the column which corresponds to the minimum value. In the case of my matrix, I would like to obtain the following vector : z y ... z Any

[R] tapply and weighted means

2006-01-12 Thread Florent Bresson
I' m trying to compute weighted mean on different groups but it only returns NA. If I use the following data.frame truc: x y w 1 1 1 1 2 2 1 3 1 1 4 2 0 2 1 0 3 2 0 4 1 0 5 1 where x is a factor, and then use the command : tapply(truc$y,list(truc$x),wtd.mean, weights=truc$w)

[R] Subset and levels

2006-11-06 Thread Florent Bresson
Hi, I've got a very simple problem but cannot find the solution. I'm using two data frames (say X and Y) and I want to get a subset of one according to the different levels of a variable code of the other data frame. I tried something like Z-subset(X, code==levels(Y$code))(1)

[R] Kernel density output

2007-01-15 Thread Florent Bresson
Hi, I'm using the density() command for a given vector x and I would like to know how to get the estimated value of the density for each element of the vector x instead of values corresponding to points from a grid. Thanks Florent Bresson __ R

[R] Custom axis

2007-08-01 Thread Florent Bresson
Dear R users, I would like to draw a plot with a custom scale for the axis. More precisely, instead of plotting y on x, I want to plot y on a monotone function of x (for instance a*x+b). Which command and/or package should I use in order to get this result? Thanks Florent Bresson

[R] Re : Custom axis

2007-08-01 Thread Florent Bresson
by a known monotone and continuous function. Florent Bresson - Message d'origine De : [EMAIL PROTECTED] [EMAIL PROTECTED] À : Florent Bresson [EMAIL PROTECTED] Cc : r-help@stat.math.ethz.ch; [EMAIL PROTECTED] Envoyé le : Mercredi, 1 Août 2007, 12h01mn 58s Objet : Re: [R] Custom axis x