Displaying 20 results from an estimated 452 matches for "subj".
Did you mean:
sub
2007 Nov 13
1
TRUNCATED error with data frame
Hi ,
I am new to R.
I am trying to run a simple R script as shown below:
aov.R
------
data1<-c(49,47,46,47,48,47,41,46,43,47,46,45,48,46,47,45,49,44,44,45,42,45,45,40
,49,46,47,45,49,45,41,43,44,46,45,40,45,43,44,45,48,46,40,45,40,45,47,40)
matrix(data1, ncol= 4, dimnames = list(paste("subj", 1:12),
c("Shape1.Color1",
"Shape2.Color1", "Shape1.Color2", "Shape2.Color2")))
Hays.df<-data.frame(rt = data1,
subj=factor(rep(paste("subj", 1:12, sep=""), 4)),
shape=factor(rep(rep(c("shape1","shape2"), c(12...
2008 May 30
2
inconsistent output when using variable substitution
I am extremely puzzled by this behavior in R. I have a data frame called
Trials in which I have results from an experiment. I am trying to do a
subjects analysis, but getting weird results. Each row has 1 trial in it,
which includes a column for the subject number I get the list of subject
numbers like so:
> Subj=unique(sort(Trials$Subj))
Then I loop over them. But I get strange results. As a test, I tried the
following:
> i=1
> Sub...
2008 Sep 19
1
Type I SS and Type III SS problem
...;-c(2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2)
d<-c(2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1,2,2,1,1)
e<-c(1739,1633,1481,1837,1780,2073,1374,1629,1555,1385,1756,1522,1566,1643,
???? 1939,1615,1475,1759,1388,1483,1127,1682,1542,1247,1235,1605,1598,1718 )
KK<-data.frame(subj=as.factor(a), drug=as.factor(b), per=as.factor(c),? seqe=as.factor(d), Cmax=e)
M<- lm(Cmax ~ seqe+ subj:seqe + per + drug , data=KK)
anova(M)
drop1(M, test="F")
The result of Type I SS:
Analysis of Variance Table
Response: Cmax
????????? Df Sum Sq Mean Sq F value Pr(>F)
seqe??????...
2009 Dec 08
6
conditionally merging adjacent rows in a data frame
...i, I have a data frame and want to merge adjacent rows if some condition is
met. There's an obvious solution using a loop but it is prohibitively slow
because my data frame is large. Is there an efficient canonical solution for
that?
> head(d)
rt dur tid mood roi x
55 5523 200 4 subj 9 5
56 5523 52 4 subj 7 31
57 5523 209 4 subj 4 9
58 5523 188 4 subj 4 7
70 4016 264 5 indic 9 51
71 4016 195 5 indic 4 14
The desired result would have consecutive rows with the same roi value merged.
dur values should be added and x values averaged, other values don&...
2012 Apr 23
2
plot function creating bars instead of lines
...variables
specifying different lines were numeric, whereas in the current data frame
one of those variables (challenge) is a factor with 2 levels. Any
suggestions for getting this to plot as intended would be much appreciated.
Thank you!
************ This is meant to plot a separate line for each subject for each
challenge*************
for (subj in unique(lab.samples$subid)) {
#par(new=T)
plot.new()
par(mfrow=c(2,1))
par(mfg=c(1,1))
plot(data=lab.samples, subset=(subid==subj), cortisol ~ Sample, type='n',
main=paste('Cortisol and Amylase for subject ', as.character(subj))...
2004 Mar 19
2
for loop or Hmisc library trap.rule function syntax error
...ls, Hmisc documentation, contributed manuals, help archives, and
Internet. I am running R 1.7.1 under Windows 2000 (I will upgrade when my
imminent OS upgrade happens). My data was successfully entered and displayed
as data.df whose first row is column labels, whose subsequent rows are
separate subject results, whose 2nd to 7th columns are numeric control results
(for observations at 0, 30, 60, 90, 120, and 180 min), and whose 8th to 13th
columns are numeric treatment results. I am trying to enter the control and
test area under the curve values from the Hmisc trap.rule function into
"...
2012 Jan 06
1
lme model specification problem (Error in MEEM...)
...h
discrete levels, e.g. 1,2,4,6), and then as factor, with the latter then
accounting for the deviation from linearity.
If x contains the values 1,2,4,6, the model formula then would be y ~ x
+ as.factor(x)
A complete example is here:
library(nlme)
d <- data.frame(x=rep(c(1,2,4,6),each=2),subj=factor(rep(1:16,each=2)))
d$y <- rnorm(32) + rnorm(length(levels(d$subj)))[d$subj]
anova(lme(y~x,random=~1|subj,data=d)) ## works
anova(lme(y~as.factor(x),random=~1|subj,data=d)) ## works
anova(lme(y~x+as.factor(x),random=~1|subj,data=d)) ## fails:
# Error in MEEM(object, con...
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 <- data.frame(cbind(Subj,Item,SOA,RT))
str(priming)
'data.frame': 18 obs. of 4 va...
2008 Feb 05
1
Extracting level-1 variance from lmer()
...(Intercept)
(Intercept) 8.519916
attr(,"sc")
scale
3.215072
> VarCorr(fm)[[1]][1]
[1] 8.519916
> VarCorr(fm)[[2]][1]
Error in VarCorr(fm)[[2]] : subscript out of bounds
##########################################################
set.seed(500)
n.timepoints <- 4
n.subj.per.tx <- 20
sd.d <- 5;
sd.p <- 2;
sd.res <- 1.3
drug <- factor(rep(c("D", "P"), each = n.timepoints, times =
n.subj.per.tx))
drug.baseline <- rep( c(0,5), each=n.timepoints, times=n.subj.per.tx )
#Patient <- rep(1:(n.subj.per.tx*2), each = n.timepoints)
Pat...
2017 Aug 19
2
bootstrap subject resampling: resampled subject codes surface as list/vector indices
I'm implementing a custom bootstrap resampling procedure in R. This
procedure resamples clusters of data points obtained by different
subjects in an experiment. Since the bootstrap samples need to have the
same size as the original dataset, `target.set.size`, I select speakers
compute their data point contributions to make sure I have a set of the
right size.
set.seed(1)
target.sample.size = 1742
count.lookup = rbin...
2008 Dec 17
1
repeated measures aov with weights
Dear R-help,
I'm facing a problem with defining a repeated measures anova with
weighted data.
Here's the code to reproduce the problem:
# generate some data
seed=11
rtrep <- data.frame(rt=rnorm(100),ti=rep(1:5,20),subj=gl
(20,5,100),we=runif(100))
# model with within factor for subjects/repeated measurements, no
problem
aov(rt~ti + Error(subj/ti),data=rtrep)
#model with weights and subj as between factor, ie ignoring repeated
measures,
#again, no problem
aov(rt~ti+subj,data=rtrep,weights=we)
#combination...
2008 Sep 11
1
plot of all.effects object
...:
[1] grid stats graphics grDevices utils datasets methods
base
other attached packages:
[1] effects_1.0-12 lattice_0.17-8
loaded via a namespace (and not attached):
[1] Matrix_0.999375-11 lme4_0.999375-24 nlme_3.1-89 tools_2.7.
set.seed(500)
n.timepoints <- 4
n.subj.per.tx <- 20
sd.d <- 5;
sd.p <- 2;
sd.res <- 1.3
drug <- factor(rep(c("D", "P"), each = n.timepoints, times = n.subj.per.tx))
drug.baseline <- rep( c(0,5), each=n.timepoints, times=n.subj.per.tx )
Patient <- rep(1:(n.subj.per.tx*2), each = n.timepoints)
Pati...
2003 Dec 17
1
repeated measures aov problem
Hi all,
I have a strange problem and rigth now I can't figure out a
solution.
Trying to calculate an ANOVA with one between subject factor (group)
and one within (hemisphere). My dependent variable is source
localization (data). My N = 25.
My data.frame looks like this:
> ML.dist.stack
subj group hemisphere data
1 1 tin left 0.7460840
2 2 tin left 1.0300600
3 3 tin left 0.802...
2007 Apr 13
2
replicates in repeated ANOVA
...eriment involving noise from Maxwell, S. E. & Delaney, H. D. (1990) Designing Experiments and Analyzing Data: A model comparison perspective. Pacific Grove, CA: Brooks/Cole., which was referenced in the Baron and Li link above.
The experimental concept I'm trying to envision is 2 groups of subjects (Treat and Control), 3 subjects in each. In one session, all 6 patients from both groups are tested for reaction time by making 3 replicate tests on some hypothetical RT test (I call this the "pre" testing phase below or one could call this baseline ). In a second session (the "...
2005 Dec 01
1
LME & data with complicated random & correlational structures
...has much more programming experience, but a comparable
level of knowledge of R, has been stumped. What follows are 3 questions
pertaining to an lme() model, one on the nested hierarcy, 1 on a strategy
for a piecewise approach to the variance given I have ~24 hours of data
(sampled at 32Hz, 1hr per subject), and one on the corStruct or how to get
rid of serial dependencies before lme().
I'm analyzing skin temperature continuously recorded at 32Hz in Baseline (10
min), Testing (~5 min), and Recovery (20 min) epochs of a face recognition
experiment. Stimuli are the same in Baseline and Recovery...
2017 Aug 19
0
bootstrap subject resampling: resampled subject codes surface as list/vector indices
...eley Breathed in his "Bloom County" comic strip )
On Sat, Aug 19, 2017 at 7:39 AM, Aleksander G??wka <aglowka at stanford.edu> wrote:
> I'm implementing a custom bootstrap resampling procedure in R. This
> procedure resamples clusters of data points obtained by different subjects
> in an experiment. Since the bootstrap samples need to have the same size as
> the original dataset, `target.set.size`, I select speakers compute their
> data point contributions to make sure I have a set of the right size.
>
> set.seed(1)
> target.sample.size = 1742...
2012 Jan 13
1
plotting regression line in with lattice
#Dear All,
#I'm having a bit of a trouble here, please help me...
#I have this data
set.seed(4)
mydata <- data.frame(var = rnorm(100),
temp = rnorm(100),
subj = as.factor(rep(c(1:10),5)),
trt = rep(c("A","B"), 50))
#and this model that fits them
lm <- lm(var ~ temp * subj, data = mydata)
#i want to plot the results with lattice anf fit the regression line, predicted with my model, trough them
#to do so, I...
2007 Feb 21
3
Different gridlines per panel in xyplot
...re drawn? The challenge is that each panel
has different y-ranges (in my real example the y-ranges and y-intervals are
even more different). For example, I wish I could use the yScale list as the
h parameter in abline, but it does not work with a list.
Thanks for any help.
Rene
library(lattice)
Subj <- rep(1:4,each=3)
Time <- rep(1:3,4) + 0.1
Conc <- (1:12) + 0.1
df <- data.frame(Subj,Time,Conc)
xScale <- 1:3
yScale <- list(1:3,4:6,7:9,10:12)
xyplot(Conc ~ Time | Subj,
data = df,
layout = c(2,2),
type="b",
scales=list(
x=list(at...
2002 Oct 08
3
repeated measures help; disagreement with SPSS
Hi, all.
I have a simple design I'm comparing to output from SPSS.
the design is 1 repeated measure (session) and 1 between measure
(cond). my dependent measure is rl. here is the data I'm using (in a
data.frame):
mig <- data.frame(subj=factor(rep(subj,3)),
cond=factor(rep(cond,3)),
session=factor(c(rep(1,nsubj),rep(2,nsubj),rep(3,nsubj))),
rl)
> mig
subj cond session rl
1 401.1 NW 1 6.4081
2 402.1 NW 1 5.8861
3 500.1 NWC 1 5.3492
4 502...
2002 Oct 09
3
proc mixed vs. lme
Dear All,
Comparing linear mixed effect models in SAS and R, I found the following
discrepancy:
SAS R
random statement random subj(program); random = ~ 1 |
Subj
-2*loglik 1420.8 1439.363
random effects
variance(Intercept) 9.6033 9.604662
variance(residual) 1.1969 1.187553
the first 3 fixed effects
intercept...