Displaying 20 results from an estimated 24 matches for "anup_nandialath".
2007 Apr 12
3
Random Sequence
Dear Friends,
I'm trying to generate a sequence of 100 observations
with either a 1 or -1. In other words the sequence
should look something like this.
y = 1 1 -1 1 -1 -1 -1 1 1 ......
Can somebody please give me some direction on how I
can do this in R.
Thanks
Anup
____________________________________________________________________________________
Don't get soaked. Take a
2007 Jul 06
1
row index
Dear Friends,
Suppose I have a vector as follows
RI Value
1 10
2 11
3 8
4 4
6 12
I would like a function which returns the"row index number" for the minimum value of VALUE. Can somebody please give me some direction on how I can do this. In effect I'm trying to find a comparable function for the GAUSS command "minindc"
>From the GAUSS Manual
2007 Jul 24
1
Passing equations as arguments
Friends,
I'm trying to pass an equation as an argument to a function. The idea is as follows. Let us say i write an independent function
Ideal Situation:
ifunc <- function(x)
{
return((x*x)-2)
}
mainfunc <- function(a,b)
{
evala <- ifunc(a)
evalb <- ifunc(b)
if (evala>evalb){return(evala)}
else
return(evalb)
}
Now I want to try and write this entire program in a single
2007 Sep 08
1
Problem with the aggregate command
Dear friends,
I have a data set with 23 columns and 38000 rows. It is a panel running from the years 1991 through 2005. I want to aggregate the data and get the medians of each of the 23 columns for each of the years. In other words my output should be like this
Year Median
1991 123
1992 145
1993 132
etc.
The sample lines of code to do this operation is
set1 <-
2007 May 30
2
control axis
I have an outlier that I would still like to display, but would prefer to
shorten the axis. For example, display 0% - 40%, and 90% - 100%. Is this
possible? I am using an xyplot.
Thanks
Murray
--
Murray Pung
Statistician, Datapharm Australia Pty Ltd
0404 273 283
[[alternative HTML version deleted]]
2007 Aug 19
1
Creating a data set within a function
Dear Friends,
I'm trying to find if there is a way to automate creation of the design matrix. Suppose we are interested in say running an autoregressive model. The user inputs the following data
myfunAR <- function(y, order)
{.....
......
}
now here y is the data series and order represents the level of the process. In other words if order=2 then we have an AR (2) process. Now it is easy
2007 Jun 04
1
Help with conditional lagging of data
Dear Friends,
I have some data with three columns named ID, Year and Measure X. I need to create a column which gives me a lag for each ID (note not a continous lag), but a lag conditional on the id and the given year. Please find below a sample of the data
Input file sample
ID Year X
AB12 2000 100
AB12 2001 120
AB12 2002 140
AB12 2003 80
BL14 2000 180
BL14
2010 Dec 07
1
Help on loops
Dear R-helpers,
I have a basic question on using loops.
I have a panel data set with different variables measured for "n" firms over "t" time periods. A snapshot of the data is given below
id t X1 X2
1 1 4 3
1 2 9 2
1 3 7 3
1 4 6 6
2 1 6 4
2 2 5 3
2 3 1 1
3 1 9 6
3 2 5 5
thus total
2007 Apr 18
2
Data Manipulation using R
Dear Friends,
I have data set with around 220,000 rows and 17 columns. One of the columns is an id variable which is grouped from 1000 through 9000. I need to perform the following operations.
1) Remove all the observations with id's between 6000 and 6999
I tried using this method.
remdat1 <- subset(data, ID<6000)
remdat2 <- subset(data, ID>=7000)
donedat <- rbind(remdat1,
2007 Aug 21
2
Partial comparison in string vector
...y/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
------------------------------
Message: 15
Date: Sun, 19 Aug 2007 12:13:42 -0700 (PDT)
From: Anup Nandialath <anup_nandialath at yahoo.com>
Subject: [R] Creating a data set within a function
To: r-help at stat.math.ethz.ch
Message-ID: <247229.81515.qm at web53311.mail.re2.yahoo.com>
Content-Type: text/plain
Dear Friends,
I'm trying to find if there is a way to automate creation of the design
matrix. Suppose...
2007 Jun 24
2
matlab/gauss code in R
...Fax: 416.864.6057
>
>
>
> ------------------------------
>
> Message: 16
> Date: Fri, 22 Jun 2007 09:58:39 -0400
> From: "Kuhn, Max" <Max.Kuhn en pfizer.com>
> Subject: Re: [R] Data consistency checks in functions
> To: "Anup Nandialath" <anup_nandialath en yahoo.com>,
> <r-help en stat.math.ethz.ch>
> Message-ID:
> <71257D09F114DA4A8E134DEAC70F25D308B9745C en groamrexm03.amer.pfizer.com>
> Content-Type: text/plain; charset="us-ascii"
>
> Anup,
>
> There are two ways to pass argum...
2007 Feb 25
3
Random Integers
Hi all,
Is there an R function to generate random integers? Thanks in advance.
Sincerely
Anup
---------------------------------
Now that's room service! Choose from over 150,000 hotels
[[alternative HTML version deleted]]
2007 Aug 16
0
Help with optimization using GENOUD
Dear Friends,
I have been trying to learn how to use the derivative free optimization algorithms implemented in the package RGENOUD by Mebane and Sekhon. However, it does not seem to work for reasons best described as my total ignorance. If anybody has experience using this package, it would be really helpful if you can point out where I'm making a mistake.
Thanks in advance
Anup
Sample
2007 Aug 21
1
Random Sampling from a Matrix
Dear Friends,
I have a matrix of size 5000 X 20. The first two columns are indicator variables taking the value of either 0 or 1. Let us call the first two columns Y1 and Y2.
I need to randomly sample 1000 rows with all the associated columns, in other words my new matrix should be of size 1000 X 20. I realize that using this command
newmat <- mainmat[sample(1000,replace=F),]
achieves
2007 Nov 21
1
Is there a simpler way to do this?
Dear Friends,
My objective is to do element wise multiplication of two vectors. For example suppose I have
a <- (1,1,1)
b <- (2,4)
My output should be (2,4,2,4,2,4). I managed to write it down with loops as follows
r <- c(1,1,1)
l <- c(2,4)
x <- 1
for (j in 1:3)
{
for (i in 1:2)
{
new[x,] <- r[j]*l[i]
x <- x+1
}
}
Is there a simpler solution to
2008 Mar 14
1
Rejection sampling to draw from distributions
Dear friends,
Please find below the code that I have employed for a rejection sampler to draw from asymmetric laplace distributions. I was wondering if this code can be written more efficiently? Are there more efficient ways of drawing random numbers from asymmetric laplace distributions??
Thanks in advance for your help and have a great weekend.
Regards
Anup
2010 Dec 09
1
Constraints when sampling from a distribution
Dear R-helpers,
My question is related to how to impose constraints when when sampling from a distribution.
For example, suppose I'm sampling a vector from a multivariate normal distribution
vbeta <- 100*diag(2)
mbeta <- c(1,1)
ans <- beta <- c(rmvnorm(1,mbeta,vbeta))
ans will thus be a vector with two elements.
My question is how do I place a restriction on one of the
2007 May 18
1
Bootstrapped standard errors
Dear Friends,
I'm trying to learn to how to get Bootstrapped standard errors for estimated coefficients from a regression.
For instance suppose I have the following model
logitmodel <- glm (y~X1+X2+X3, family=binomial(link="logit"))
beta <- logitmodel$coef
can somebody please guide me on how to use the package boot to obtain bootstrapped SE's for the associated betas.
2007 May 25
0
Scale mixture of normals
Dear Friends,
Is there an R package which implements regression
models with error distributions following a scale
mixture of normals?
Thanks
Anup
2007 Jun 25
0
Random numbers from skewed distributions
Dear Friends,
I was wondering if there is any package to get random numbers from the Burr 10 distribution. I checked the rmutil and actuar package. Both seems to implement the Burr 12 distribution.
thanks in advance
Regards
Anup
---------------------------------
[[alternative HTML version deleted]]