Displaying 20 results from an estimated 10000 matches similar to: "'save' saved object names instead of objects"
2010 Jun 22
5
Displaying Iteration Count
Hello,
I'm running a very long for loop that usually takes hours. For my own piece
of mind, it would be nice if I could check periodically and see which
iteration the loop is on. A line of code that told R to print the iteration
number every 100 or 200 iterations would be perfect.
Does anyone know something like this? I've never known how to print
anything within a for loop before the
2010 Aug 13
6
Equality of Vectors
Hello,
Is there a way to get a single TRUE or FALSE statement from comparing two
vectors? For example,
c(1,2,3) == c(1,2,3)
produces
TRUE TRUE TRUE
where I would like it to produce only
TRUE
for use in an if statement.
Likewise, when two vectors are not exactly identical (in all elements) I
would like a single FALSE result, as opposed to
c(1,2,3) == c(1,2,5)
TRUE TRUE FALSE
Any ideas?
2011 May 17
2
Minimum value by ID
Hello,
I have a longitudinal dataset where each individual has a different number
of entries. Thus, it is of the following structure:
x <- runif(12)
id.var <- factor(c(rep("D1",4),rep("D2",2),rep("D3",3),rep("D4",3)))
dat <- as.data.frame(x)
dat$id.var <- id.var
dat
> dat
x id.var
1 0.9611269 D1
2 0.6738606 D1
3
2011 Jul 01
2
merge function
Hello,
I'm clearly confused about the merge function. In the following
r <- merge(x,y,all.x=T,all.y=F)
my y vector has only unique values (no duplicates). So I don't understand
how this can ever generate an r which is of greater length than x.
I thought the default behavior was only matching rows are included, but
that using all.x=T included rows with unmatched x's as well. If
2011 May 29
1
Setting max. iterations for lmer
Hello,
I hate to ask a question which is directly addressed in the documentation,
but can someone please give me an example of how to change the maximum
number of iterations used by lmer. I'm having a hard time understanding
this:
control a list of control parameters. See below for details.
control
a named list of control parameters for the estimation algorithm, specifying
only
2011 Nov 09
2
Installing binaries from R-Forge
Hello,
I'm attempting to install the splm package from R-Forge.
https://r-forge.r-project.org/R/?group_id=352
The page says, "In order to successfully install the packages provided on
R-Forge, you have to switch to the most recent version of R..." It later
says "To install this package directly within R type:
install.packages("splm",
2007 Mar 07
1
Failure to run mcsamp() in package arm
Dear r-helpers,
I can run the examples on the mcsamp help page. For example:
****************************************
> M1 <- lmer (y1 ~ x + (1|group))
> (M1.sim <- mcsamp (M1))
fit using lmer,
3 chains, each with 1000 iterations (first 500 discarded)
n.sims = 1500 iterations saved
mean sd 2.5% 25% 50% 75% 97.5% Rhat n.eff
beta.(Intercept)
2012 Mar 08
1
Panel models: Fixed effects & random coefficients in plm
Hello,
I am using {plm} to estimate panel models. I want to estimate a model that
includes fixed effects for time and individual, but has a random individual
effect for the coefficient on the independent variable.
That is, I would like to estimate the model:
Y_it = a_i + a_t + B_i * X_it + e_it
Where i denotes individuals, t denotes time, X is my independent variable,
and B (beta) is the
2011 Feb 25
1
Hierarchical Power Analysis
Hello,
A colleague is trying to do a fairly complicated power analysis for a
project. The project would be evaluating random assignment to one of three
conditions within each of 8 sites. The dependent variable would be binary
(we do not care at this point whether it would be analyzed with logit or
probit).
We can simulate the data in a bunch of iterations and do analyses in each
iteration, but
2010 Apr 19
2
ecdf
Hello,
I'd like to plot an empirical cumulative distribution function, except
instead of the fraction of values < x, I'd like the fraction of values > x.
I think this can be done using the ecdf function in {Hmisc}. I installed
the package and loaded it. However, when following the example given in the
documentation, I get an error:
x <- rnorm(100)
ecdf(x,what='1-F')
2010 Mar 11
1
VAR with contemporaneous effects
Hi,
I would like to estimate a VAR of the form:
Ay_t = By_t-1 + Cy_t-2 + ... + Dx_t + e_t
Where A is a non-diagonal matrix of coefficients, B and C are matricies of
coefficients and D is a matrix of coefficients for the exogenous variables.
I don't think the package {vars} can do this because I want to include
contemporaneous cross-variable impacts.
So I want y1_t to affect y2_t and I
2013 Sep 13
1
log-log link function
Hi to every body. I would like assistance on how to implement the log-log
link function for binary response. Is there any package that implements it?
Many thanks
Endy
[[alternative HTML version deleted]]
2020 Oct 29
1
R: sim1000G
Hi,
I am using the sim1000G R package to simulate data for case/control study.
I can not figure out how to manipulate this code to be able to generate 10%
or 50% causal SNPs in R.
This is whole code provided as example on GitHub:
library(sim1000G)
vcf_file = "region-chr4-357-ANK2.vcf.gz" #nvariants = 442, ss=1000
vcf = readVCF( vcf_file, maxNumberOfVariants = 442 ,min_maf =
2005 Oct 05
1
(no subject)
hi all
why does the following not work???
this was someone elses code and i couldnt explain why it doesn't work.
m=matrix(c(0,0),2,1)
v=matrix(c(1,0,0,1),2,2)
Y=function(X1,X2,mu=m,V=v)
{
X=matrix(c(X1,X2),2,1)
a=(1/((2*pi)*sqrt(det(V))))*exp((-0.5)*(t(X-mu)%*%solve(V)%*%(X-mu)))
a[1]
}
x1=seq(-1,1)
x2=x1
Z=outer(x1,x2,FUN="Y",mu=m,V=v)
persp(x1,x2,Z)
my code:
2012 Feb 10
3
Help needed please
I have coded a time series from simulated data:
simtimeseries <- arima.sim(n=1024,list(order=c(4,0,0),ar=c(2.7607, -3.8106, 2.6535, -0.9258),sd=sqrt(1)))
#show roots are outside unit circle
plot.ts(simtimeseries, xlab="", ylab="", main="Time Series of Simulated Data")
# Yule ----------------------------------------------------------------------------
q1 <-
2008 Apr 01
4
NEW: Sociolects in R
The R translation teams have done a great job in making R usable for
people who do not have English as their mother tongue. However, even
within English speaking countries, there are groups which have trouble
with the language, and it may be valuable to support the Sociolects of
these groups too.
Thanks to a generous contribution from Lars Polifo, these features will
be made available in an
2008 Apr 18
2
using rbind() on multiple objects at once
Is there an efficient way to use rbind() with the five dataframes described
in the following example:
a <- c(1:5)
list.foo <- lapply(a, function(x) data.frame(beta=a*rnorm(10),
deta=a*rnorm(10)))
big.data.frame <- rbind(list.foo[[1]], list.foo[[2]], list.foo[[3]],
list.foo[[4]], list.foo[[5]]) #is there an easier method?
For example, I naively thought you could do something like
2010 Apr 12
1
Strange results from Multivariate Normal Density
Hello,
I'm using dmnorm from the package {mnormt} and getting strange results.
First, according to the documentation, dmnorm should return a vector of
densities, and I'm only getting one value returned (which is what I would
expect). I've been interpreting this as the joint density of all values in
the x vector (which is what I want). Should a vector of densities be
returned, and if
2012 Feb 05
1
R- Fisher Information
Dear All,
Can you help me, with the code below how do I obtain the fisher information from it.
Is my q<-replicate(1000,x) the right way to do simulation.
thank you.
x<-rweibull(100,0.8,1.5)
q<-replicate(1000,x)
z<-function(p){
beta<-p[1]
eta<-p[2]
log1<-(n*log(beta)-n*beta*log(eta)+(beta-1)*sum(log(x))-sum((x/eta)^beta))
return(-log1)
}
zz<-optim(c(0.5,0.5),z)
zz
Chris
2012 Sep 11
1
Strange result from GAMLSS
Hi Folks! Just started using the gamlss package and I tried a simple code
example (see below). Why the negative sigma?
John
> y <- rt(100, df=1)> m1<-fitDist(y, type="realline")Warning messages:1: In MLE(ll3, start = list(eta.mu = eta.mu, eta.sigma = eta.sigma, :
possible convergence problem: optim gave code=1 false convergence
(8)2: In MLE(ll4, start = list(eta.mu =