anova uses sequential sums of squares (type 1), summary adjusted sums of
squares (type 3)
Take for example the first line of each output. In summary this tests
whether vole1 is needed ASSUMING volelag and year are already in the model
(conclusion would then be: it isn't needed p=.89). Whereas in
Hi - I am trying to substitute for "the_other_y" in the code below. I want
y2 and y3 to be there when i is 1, y1 and y3 to be there when i is 2 and y1
and y2 to be there when i is 3. I'm sure it's to do with what format the
data should be in and I've tried alldata[,-i], but it fits all the colum
Simple problem - I want the ylab to automatically pick up x1 rather than
having to define x1 in the plot statement.
x1<-c(1.2,2,3);x2<-c(1,2.1,2.6)
y<-x1
plot(1:3,y, ylab="x1")
There must be a way of accessing the name x1 somehow, but unfortunately I
don't know how to search for it. Any help
There is a mixed effects e-mail list you might want to join for more in depth
discussion of these topics - you can subscribe here
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models.
In general the format for crossed effects would be
lmer(y~f1+f2+(1|r1)+(1|r2)) where f1, f2 are fixed effec
.com]
Sent: 06 July 2010 15:48
To: Paul Chatfield
Subject: Re: information reduction-database management question
Thanks Paul,
I appreciate your time and this is an interesting approach.
Unfortunately, I need it to work for all types of information, including
character data (i.e. text).
Aga
Sounds distinctly like an assignment you've been set for which we wouldn't
help. All I'll say is crossed random effects can be dealt with effectively
in lmer. See that for more.
--
View this message in context:
http://r.789695.n4.nabble.com/A-question-about-conducting-crossed-random-effects-in
If you redefine your NAs as below to be detected as some arbitrary large
number, then the code should work through. Any 5's left in your dataset can
be replaced just as easily by NAs again. Not elegant, but effective.
site <- c("s1", "s1", "s1", "s2","s2", "s2")
pref <- c(1, 2, 3, 1, 2, 3)
R1 <
Thanks again Joris - you've been very helpful J
From: Joris FA Meys [via R]
[mailto:ml-node+2267176-1824205151-120...@n4.nabble.com]
Sent: 24 June 2010 16:40
To: Paul Chatfield
Subject: Re: How to say "if error"
You could do that using the options, eg :
set.seed(1)
x &l
On a similar issue, how can you detect a warning in a loop - e.g. the
following gives a warning, so I'd like to set up code to recognise that and
then carry on in a loop
x<-rnorm(2);y<-c(1,0)
ff<-glm(y/23~x, family=binomial)
so this would be incorporated into a loop that might be
x<-rnorm(10);y
That's great. That solves it. I can work on eloquence later :) I just to
sort out that model problem:
dof<-numeric(10)
for (i in 1:10){
x<-rnorm(i-1);y<-rnorm(i-1)
cc <- try(lm(y~x), silent=T)
if(is(cc,"try-error")) {dof[i]<-NA}
else {dof[i]<-(summary(lm(rnorm(10)~rgamma(10,1,1)))$co
Thanks Roman - you're right it can do more than I thought. We're close now
to solving it I feel. Essentially I'm trying to get the code below to work.
If the condition is satisfied, it prints 2, but it doesn't save it in z. I
want it to save it even though there's an error. Perhaps you can ea
I've had a look at the conditions in base and I can't get the ones to work
I've looked at but it is all new to me.
For example, I can work the examples for tryCatch, but it won't print a
finally message for me when I apply it to my model. Even if I could get
this to work, I think it would stil
Hi - I am looping over a structural equation model for a variety of datasets.
Occasionally, the model returns an error and the loop then breaks. I'd like
to set a condition which says something like "if error, then print NAs"
rather than the loop breaking, but I don't know how to say "if error".
A simple question - I have a small dataset to read in and want to copy and
paste part from Excel and paste it into an R script file without creating
more files saving it as a .txt/.csv and then reading that in. I want to
read in 3 columns e.g.
1 2.5 3.4
1 2.3 3.1
1 2.6 3.9
2 2.9 2.8
2 2.6 2.9
2 2
Thank you â thatâs sorted it. Trying to make things too complicated! J
From: Alain Guillet-2 [via R]
[mailto:ml-node+1819104-1154170184-120...@n4.nabble.com]
Sent: 09 April 2010 10:34
To: Paul Chatfield
Subject: Re: NAs are not allowed in subscripted assignments
Maybe you can
I'm trying to assign NAs to values that satisfy certain conditions (more
complex than shown below) and it gives the right result, but breaks the loop
having done the first one viz:
new<-c(rep(5,4),6)
for (i in 1:6)
{new[new[i]>5.5][i]<-NA}
gives the correct result, though an error message appear
.nabble.com]
Sent: 25 January 2010 12:21
To: Paul Chatfield
Subject: Re: [R] Paste expression in graph title
Try this:
plot(x, y, main = bquote(R^2 == .(round(summary(lm(y ~ x))$r.squared, 3
On Mon, Jan 25, 2010 at 10:06 AM, Paul Chatfield
<[hidden email]
<http://n4.nabble.co
This was my initial attempt at creating a title on a graph of the R squared
value:
x<-rnorm(10)
y<-rnorm(10)
plot(x,y, main=paste(expression(R^2)," = ",round(summary(lm(y~
x))$r.squared, digits=3), sep=""))
I've read various other posts that say expression needs to be taken outside
the paste, bu
Am trying to produce a graph which prints out well in black and white using
ggplot2. I have the following example set up nicely, but want to shade the
red bars in one pattern and the blue in another so they print out clearly.
I tried changing colours to 1 light, 1 dark, but then the overlapping
That's solved it. Superb!
> All you probably need is to make f2 a factor (e.g., y ~ factor(f2) |
> f1). Otherwise dotplot() doesn't know which one to treat as
> categorical.
>
> -Deepayan
>
>
--
View this message in context:
http://www.nabble.com/Plotting-1-covariate%2C-3-factors-tp25789
Cheers guys that's helpful. Doug, you're right, my code for ff should have
been
for (i in 1:length(y))
{if (f1[i]=="after" & f3[i]==1) ff[i]<-"1, after"
else if(f1[i]=="after" & f3[i]==2) ff[i]<-"2, after"
else if(f1[i]=="before" & f3[i]==1) ff[i]<-"1, before"
else if(f1[i]=="before" & f3[i]==2)
I'm interested in plotting a y with an x factor as the combination of 2
factors and colour with respect to a third, which the code below does with
interaction.plot(). However, this is because I redefine the x to be 1
factor. Is there a way of getting it to plot without redefining it, and
ideally
Hi Noah - I work for the statistical services centre and could help.
Email p.s.chatfi...@rdg.ac.uk,
Paul
Noah Silverman-3 wrote:
>
> Hello,
>
> I've come up with some challenges with my process that are a bit too
> complicated for the mailing list.
>
> Is there anyone out there, prefera
The following code should do it. This assumes matrices a and x are of the
same dimension which is why you can index a as below
x[is.na(x)==TRUE]<-a[is.na(x)==TRUE]
--
View this message in context:
http://www.nabble.com/Combine-two-matricies-tp24458609p24458797.html
Sent from the R help maili
If you want to average 20% missing values then you could try it in 1 step,
viz:
sample(c(1:2, rep(NA, 2000)),100)
Otherwise, 2 steps is preferable. Use code as below:
sample(1:2,100)->kk
kk[sample(1:100,20)]<-NA
Paul
--
View this message in context:
http://www.nabble.com/ran
I'm trying to plot a graph where the axes go through 0,0, rather than around
it combined with a box round the graph, so
x<-0:10;y<-0:10
plot(x,y)
gives me a box but doesn't go through the point 0,0, but stays at a
distance.
In trying to circumvent this problem, I wrote
plot(x,y)
axis(1, pos=
I'm trying to draw an arrow with a curved shaft on the graph as a straight
one looks messy on a detailed graph. I've looked in arrows but it doesn't
seem to give an option. larrows doesn't look much more promising. I had a
look in the archive and couldn't find anything. Any thoughts?
Thanks
ogram Files). Run the program RSetReg.exe and
that's it, Tinn-R should be able to start R. When you update R repeat the
process.
Paul Chatfield wrote:
>
> Hi - I can access R from Tinn-R by going to Options->Main->Application/R
> and setting the search path, but each tim
Hi - I can access R from Tinn-R by going to Options->Main->Application/R and
setting the search path, but each time I exit Tinn-R I have to redefine the
search path. Is there no way of fixing that directory as default? I have
installed R under its default directory C:/Program Files/R/R-2.7.1 and
29 matches
Mail list logo