[R] arrow on contour line

2024-01-10 Thread Deepankar Basu
Hello, I am drawing contour lines for a function of 2 variables at one level of the value of the function and want to include a small arrow in any direction of increase of the function. Is there some way to do that? Below is an example that creates the contour lines. How do I add one small arrow

Re: [R] variable name question

2011-10-09 Thread Deepankar Basu
Thanks for both comments. Indeed the sep = "" is needed. On Sun, Oct 9, 2011 at 9:43 PM, Rolf Turner wrote: > On 10/10/11 04:53, R. Michael Weylandt wrote: > > > > Try this: >> >> for (i in 1990:2009) { >> varName = paste("pci", i, collapse = "") >> assign(varName, log(get(varName)) >>

[R] variable name question

2011-10-09 Thread Deepankar Basu
Hi All, This is surely an easy question but somehow I am not being able to get it. I am using R 2.13.2 and have a data set where variable names like this appear: pci1990, pci1991, ... , pci2009. "pci1990" has data on per capita income for 1990, "pci1991" has data on per capita income for 1991,

[R] data management question

2008-05-08 Thread Deepankar Basu
Hi all, I have a data management question. I am using an panel dataset read into R as a dataframe, call it "ex". The variables in "ex" are: id year x id: a character string which identifies the unit year: identifies the time period x: the variable of interest (which might contain NAs). Here

Re: [R] speeding up likelihood computation

2007-12-03 Thread Deepankar Basu
S[N1,i] <- 0 > >} > > > >} > > that can be done without loops, but without data, it is hard to > determine. Run Rprof and see what summary.Rprof shows to indicate > where to focus on. > > On Dec 2, 2007 12:49 PM, DEEPANKAR BASU

Re: [R] speeding up likelihood computation

2007-12-03 Thread Deepankar Basu
S[N1,i] <- 0 > >} > > > >} > > that can be done without loops, but without data, it is hard to > determine. Run Rprof and see what summary.Rprof shows to indicate > where to focus on. > > On Dec 2, 2007 12:49 PM, DEEPANKAR BASU <[EMA

[R] speeding up likelihood computation

2007-12-02 Thread DEEPANKAR BASU
R Users: I am trying to estimate a model of fertility behaviour using birth history data with maximum likelihood. My code works but is extremely slow (because of several for loops and my programming inefficiencies); when I use the genetic algorithm to optimize the likelihood function, it takes

Re: [R] C++ and R interface

2007-11-06 Thread Deepankar Basu
Thanks for the help. On Tue, 2007-11-06 at 14:48 -0200, Alberto Monteiro wrote: > Deepankar Basu wrote: > > > > I am trying to do an ML estimation in R. My likelihood function has > > several nested loops and so it takes a lot of time (days when I use the > > genetic

[R] C++ and R interface

2007-11-06 Thread Deepankar Basu
Hi All, I am trying to do an ML estimation in R. My likelihood function has several nested loops and so it takes a lot of time (days when I use the genetic algorithm for optimization) for the optimization to finish. Unable to avoid loops, I am thinking of writing the likelihood function in C++ and

Re: [R] finding birth position

2007-10-26 Thread Deepankar Basu
gt; > that you want? These are the numeric values of where the boys occur. > > > > > x.m > > b1 b2 b3 b4 b5 b6 > > [1,] 1 2 1 2 NA NA > > [2,] 2 2 NA NA NA NA > > [3,] 1 2 1 1 1 NA > > [4,] 2 1 NA NA NA NA > > [5,] 1 NA NA NA NA NA > >

[R] finding birth position

2007-10-25 Thread Deepankar Basu
Hi All, I have data on the sequence of births for families with completed fertility cycle (in a data frame); the relevant variables are called b1, b2, b3, b4, b5, b6 and record the birth of the first, second, ..., sixth child. So, b1=1 if the first birth is male, b1=2 if the first birth is femal

[R] how to loop over a group of variables?

2007-10-24 Thread DEEPANKAR BASU
Hi All, I have a data frame with a group of variables named b1, b2, b3, ..., b18. These variables take the value 1, 2 or NA. For each observation, I want to do some computation by looping over the values for the group of variables: b1 to b18. In STATA I would do: forval i=1/18 { --- use b`i'