> #1 2010 1 1 1 1
> #2 2010 2 0 0 0
> #3 2010 1 0 1 1
> #4 2010 1 0 1 1
> #5 2011 2 1 1 1
> #6 2011 2 0 1 1
> #7 2011 1 0 0 0
> #8 2011 1 0 0 0
>
> A.K.
>
> - Original Message --
Hello everyone,
I have a dataset which includes the first three variables from the demo
data below (year, id and var). I need to create the new variable ans as
follows
If var=1, then for each year (where var=1), i need to create a new dummy
ans which takes the value of 1 for all corresponding id'
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 vect
Thanks Jim!
--- On Tue, 12/7/10, jim holtman wrote:
From: jim holtman
Subject: Re: [R] Help on loops
To: "Anup Nandialath"
Cc: r-help@r-project.org
Date: Tuesday, December 7, 2010, 7:47 PM
use split and lapply to make it easier. Substitute in your own
calculations since this
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
Hi Michael,
Actually I was wrong in the initial mail. rbprobitGibbs uses the Gibbs Sampler.
I think the rhierbinLogit does the Logit model which uses a Metropolis hastings
approach uses the acceptance rate and the function outputs the rejection rate
in the output list. So you are not required t
Hi Michael,
If you are using the standard logit or probit model, it is fairly easy to save
the acceptance rate after each draw. I would recommend using the "bayesm"
package as the source code is easy to manipulate. For instance in the probit
function (rbprobitGibbs), you need to include a co
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??
Tha
Dear friends,
I'm interested in obtaining bootstrapped standard errors for a model that I'm
estimating. I do realize that i can use the sample command and do the bootstrap
by hand. But I was hoping somebody can help me on how to use the "boot"
package.
The model is as follows
# Likelihood fu
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)
{
10 matches
Mail list logo