Displaying 20 results from an estimated 20000 matches similar to: "How to remove index from list after split?"
2006 Feb 20
1
Extracting variance components from lmer
Hi All.
I need a bit of help extracting the residual error variance from the VarCorr
structure from lmer.
#Here's a 2-way random effects model
lmer.1 <- lmer(rating ~ (1|person)+(1|rater), data = dat)
#Get the structure
vc.fit <- VarCorr(lmer.1)
#results in.....
$person
1 x 1 Matrix of class "dpoMatrix"
(Intercept)
(Intercept) 0.7755392
$rater
1 x 1 Matrix
2007 May 11
1
Create an AR(1) covariance matrix
Hi All.
I need to create a first-order autoregressive covariance matrix
(AR(1)) for a longitudinal mixed-model simulation. I can do this
using nested "for" loops but I'm trying to improve my R coding
proficiency and am curious how it might be done in a more elegant
manner.
To be clear, if there are 5 time points then the AR(1) matrix is 5x5
where the diagonal is a constant
2006 Feb 01
1
Scatterplot color options in CAR package?
Hi All.
I'd like to change the default plotting colors used to construct a
scatterplot with regression line in the CAR package.
So,
scatterplot(y~pred,smooth=FALSE, xlab="X", ylab="Y", lwd=2)
If I change the palette (e.g., palette(ranbow(6)), I can change the color of
the lines and points.
However, the axes and labels remain in black (i.e., the first color in the
2008 May 06
2
NLS plinear question
Hi All.
I've run into a problem with the plinear algorithm in nls that is confusing
me.
Assume the following reaction time data over 15 trials for a single unit.
Trials are coded from 0-14 so that the intercept represents reaction time in
the first trial.
trl RT
0 1132.0
1 630.5
2 1371.5
3 704.0
4 488.5
5 575.5
6 613.0
7 824.5
8 509.0
9
2009 Feb 24
1
replace zeros in a block diagonal matrix with small random values?
Hi All.
Imagine you have a large block diagonal matrix. I'd like to replace
the zeros in this matrix with small random (runif) numbers. Any ideas
for a simple and efficient way to do this?
Best regards,
Rick DeShon
2011 Feb 09
2
Generate multivariate normal data with a random correlation matrix
Hi All.
I'd like to generate a sample of n observations from a k dimensional
multivariate normal distribution with a random correlation matrix.
My solution:
The lower (or upper) triangle of the correlation matrix has
n.tri=(d/2)(d+1)-d entries.
Take a uniform sample of n.tri possible correlations (runi(n.tr,-.99,.99)
Populate a triangle of the matrix with the sampled correlations
Mirror the
2008 Jan 25
1
nlsList (nlme) error
Hi All.
I'm trying to run nlsList an getting an error that makes no sense to
me. I have accuracy and reaction time data over many trials for each
person (id)
When I use nlsList code that is virtually identical to the example in
the doc file I get the following error. I've tried everything I could
think of and can't get around it. Any ideas what I'm doing wrong?
**************
2007 May 16
1
lmer error confusion
Hi All.
I'm trying to run a simple model from Baayan, Davidson, & Bates and getting
a confusing error message. Any ideas what I'm doing wrong here?
# Here's the data.....
Subj <- factor(rep(1:3,each=6))
Item <- factor(rep(1:3,6))
SOA <- factor(rep(0:1,3,each=3))
RT <-
c(466,520,502,475,494,490,516,566,577,491,544,526,484,529,539,470,511,528)
priming
2010 Feb 26
1
split function
Hi,
I am using split function and wonder how to add the factor to the splitted
results.
#Example
n <- 3; nn <- 10
g <- factor(round(n * stats::runif(n * nn))) #factor
x <- rnorm(n * nn) + sqrt(as.numeric(g)) #value
xg <- split(x, g)
xg
$`0`
[1] 0.82513702 -0.03911584 2.32955347 0.36745335 1.75572642 2.65461438
0.41675829
$`1`
[1] 0.8583493 2.4264804 -0.3622378
2006 Feb 13
1
Help scoring a matrix of item responses
Hi All.
I'm new to R and trying to learn the data manipulation routines. At the
moment, this is the one that has me stumped.
Imagine n test takers provide responses to k multiple choice items. The
result is a (n+1) x k matrix of responses where the first row of the matrix
is a correct answer key.
How could you transform the raw item responses into 1s (correct response)
and 0s (incorrect
2007 Dec 03
1
Efficient computation of average covariance matrix over a list
Hi All.
I would like to compute a separate covariance matrix for a set of variables
for each of the levels of a factor and then compute the average covariance
matrix over the factor levels. I can loop through this computation but I
need to perform the calculation for a large number of levels and am looking
for something more elegant. To be concrete....
u <- 3
n <- 10
x <-
2007 Jan 28
2
nnet question
Hello,
I use nnet to do prediction for a continuous variable.
after that, I calculate correlation coefficient between predicted value and
real observation.
I run my code(see following) several time, but I get different correlation
coefficient each time.
Anyone know why?
In addition, How to calculate prediction accuracy for prediction of
continuous variable?
Aimin
thanks,
> m.nn.omega
2003 Mar 28
2
Rsync error main.c
Rsync Ver: 2.5.5
OS: HPUX-11
Hello List,
I'm using rsync with ssh with this command line:
rsync -avz -e ssh some_file user-b@hostname-b:/home/user-b
Which does work, however I get the following error output:
rsync error: protocol incompatibility (code 2) at main.c(578)
Since the file does transfer, is the error output just some sort of bug? I
looked in the maillist archives, and I found
2008 Apr 10
1
memory issues with 1.1.rc4 (now it's PAM)
Hi!
I'm running 1.1rc4 on a system and this happens occasionally:
--8<--
mail.info; dovecot: auth(default): client in: AUTH 1 PLAIN service=imap lip=NN.NN.NN.NN rip=NNN.NN.NNN.NN lport=143
mail.info; dovecot: auth-worker(default): pam(XXXXXXXXXXXX,NNN.NN.NNN.NN): lookup service=imap
kern.alert; kernel: grsec: From NN.NN.NN.NN: denied resource overstep by requesting
2003 Jan 29
2
substitute, eval and hastables
I have the following problem. I have an automatically generated named
list with "stringified" names:
a <- list("A"=..., "B"=..., "C"=..., )
then I want to refer to the elements of the list, stored as an vector
of names:
nn <- c("A", "B", "C"), so that I could get list elements like
a$nn[1], a$nn[2], etc. Obviously it
2012 Sep 06
2
choose() function returning anomalous results (zero instead of one)
Hello,
(Apologies for length, wanted to get all the relevant detail in that I know
of).
I've been having a lot of trouble with some code for an inventory analysis
problem I was doing, and finally came to the conclusion that it appears
that choose() is returning incorrect values. Specifically:
-------------
Browse[1]> nn
[1] 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3
2007 Feb 28
4
Help: CallerID Name not being sent on outbound PRI trunk
Outbound calls on my Telus PRI aren't taking the Name portion of the
callerID. I've looked at the logs, and it is being set (see below), but
the PRI debug output doesn't show the name being sent anywhere. As a
result, received calls always display from Unknown (or just the number).
Is there some config that I've missed somewhere?
I'm running NI-1 (Telus says NI-2 doesn't
2012 Feb 04
1
combining data structures
Group
It's unlikely I'm trying this the best way, but I'm trying to create a
data structure from elements like
nNode = 2
nn = vector("list",nNode)
nn[[1]] = list(Node = "1", Connect.up = c(NULL), Connect.down = c(2,3))
nn[[2]] = list(Node = "2", Connect.up = c(1), Connect.down = c(4,5))
.... #( and eventually many more nodes)
NodeList =
2005 Sep 13
1
possible bug in model.matrix
Is this a bug, or have I misunderstood the proper use of lm?
Thanks,
Whit
code:
x <- rnorm(50)
y <- matrix(as.logical(round(runif(100),0)),ncol=2)
NROW(x)==NROW(y)
lm(x~y)
> x <- rnorm(50)
> y <- matrix(as.logical(round(runif(100),0)),ncol=2)
> NROW(x)==NROW(y)
[1] TRUE
> lm(x~y)
Error in "[[<-.data.frame"(`*tmp*`, nn, value = c(2, 1, 2, 1, 1, 1, 2,
:
2006 Aug 07
1
mathematica -> r (gamma function + integration)
Dear R-list,
I try to transform a mathematica script to R.
#######relevant part of the Mathematica script
(* p_sv *)
dd = NN (DsD - DD^2);
lownum = NN (L-DD)^2;
upnum = NN (H-DD)^2;
low = lownum/(2s^2);
up = upnum/(2s^2);
psv = NIntegrate[1/(s^NN) Exp[-dd/(2s^2)]
(Gamma[1/2,0,up] + Gamma[1/2,0,low]),{s,sL,sH},
MinRecursion->3];
PSV = psv/Sqrt[2NN];
Print["------------- Results