Displaying 20 results from an estimated 2000 matches similar to: "extracting F, df and r squared using "sapply"?"
2007 Feb 12
1
Trying to replicate error message in subset()
Hi, there
I am trying to replicate an error message in subset() to see what it is
that I'm doing wrong with the datasets I am trying to work with.
Essentially, I am trying to pass a string vector to subset() in order to
select a specific collection of cases (i.e., I have data for these cases in
one table, and want to select data from another table that match up with
the cases in the
2003 Jul 01
2
strange error message
Hi, there
I have a loop that is producing data, but is also generating an error message
that I can't understand.
Here's the loop and the error message:
> bio<-matrix(NA, ncol=9, nrow=366)
> W<-NULL
> M<- length(Day) #number of days iterated
>
> for (i in 1:M)
+ {
+
+
+ if (Day[i]==1) W[i] <- Wo else W[i] <- (W[i-1]+(Gr[i]/Ef))
+
+
+ C<-
2004 Jul 29
1
Kudos to the R support team
Hi there,
I just wanted to take a quick second to thank everyone who maintains this
service- just in case you don't hear it enough, there are a plethora of people
who rely on this service (as evidenced by the help archives), and even if they
don't say it, are greatly thankful for what you do here. Not only are you
providing a service to people who are learning R, but indeed helping
2004 Jul 29
3
extracting the t-statistic: just the numbers, please
Hi, there
I am quite sure there is an easy answer to this, but I am unsure how to gather
a bunch of t-statistics in an organized format.
I am trying to generate a list of t-statistics for a randomization routine. If
I try to collect a bunch of t-statistics from a run, this is what happens:
> M <- 10 ; simt <- NULL
> for(i in 1:M)
+ {
+ perm<-sample(site,replace=F)
+
+
2007 Jan 22
0
Advice on an appropriate condition for warning in a function
Hi, there
I have written a function that will allow me to calculate the variance
components for a model II (random effects) single factor ANOVA (perhaps this is
me re-inventing the wheel, but I handn't yet come across anything in R that
does this for me, but I'm sure people will let me know from this posting if
there are). The function takes as it's argument an object which holds
2011 Nov 01
1
help with unequal variances
Hello,
I have some patient data for my masters thesis with three groups (n=16, 19 &
20)
I have completed compiling the results of 7 tests, for which one of these
tests the variances are unequal.
I wish to perform an ANOVA between the three groups but for the one test
with unequal variance (<0.001 by both bartlett and levene's test) I am not
sure what to do.
I thought i would run
2003 Jun 30
0
Constructing loops in which i+1st element depends on ith
I feel greedy posting for help twice in one day- please forgive me, but the
thesis can't wait.
I have been trying to get an ?if
else? statement working in a loop I am
writing, in which I specify a variable value to 9.2 (Wo) on the first
iteration, but for subsequent iterations, to adopt a value as a function of
variables from the previous iteration.
When I comment out the ?if
else?
2007 Jan 23
1
How to evaluate an lm() object for generating warning statement in a function
Hi, there
I tried this post on R-help but did not generate any replies, so I thought
I might try the waters here since it's a more programming-based group.
I have written a function that will allow me to calculate the variance
components for a model II (random effects) single factor ANOVA (perhaps
this is
me re-inventing the wheel, but I handn't yet come across anything in R that
does
2003 Jun 30
3
if else statements in R
Hi, there
I am a grad student struggling to get my syntax right in a model I am
building in R.
I am trying to specify a variable,W, in a loop, such that on the first
iteration, it is equal to Wo, my starting value, which I have already
specified with
Wo<-9.2
On any other iteration other than the first, I want W to equal the
previous value of W in the iteration. plus an increment from
2004 Apr 01
2
modelling nested random effects with interactions in R
Hi there
Please excuse this elementary question, but I have been fumbling with this for
hours and can't seem to get it right.
I have a nested anova, with random factor "lakefac" nested within
factor "fishfac" (fixed), with an additional fixed factor "Habfac". If I
consider everything as fixed effects, it's addmittedly not the correct model,
but I can at
2007 Feb 01
2
Losing factor levels when moving variables from one context to another
Hi, there
I'm currently trying to figure out how to keep my "factor" levels for a
variable when moving it from one data frame or matrix to another.
Example below:
vec1<-(rep("10",5))
vec2<-(rep("30",5))
vec3<-(rep("80",5))
vecs<-c(vec1, vec2, vec3)
resp<-rnorm(2,15)
dat<-as.data.frame(cbind(resp, vecs))
2008 May 07
1
interpreting significance of path coefficients from sem() output
Hi there,
Quick question about the output from the sem() function in the library
of the same name.
If I am getting probabilities >0.05 for some of my estimates of path
coefficients, I'm assuming the interpretation here is that the
coefficient is not significantly different from zero, correct? In that
case, might it make sense that I should disregard path coefficients
between
2007 Apr 05
1
Indexing in anova summary output of the form: summary(aov(y ~ x1, Error = (x1/x2)))
Hi, there
I'm trying to get the value of the Mean Square from the ANOVA model
summary that comes from specifying the error term, and am wondering if
one can actually do this ( I know it's possible when using anova(lm)
objects and the like, but I'm having a tough time with it under this
framework). There does appear to be some indexing in the output of this
type, but perhaps not
2008 Jul 15
1
manipulating (extracting) data from distance matrices
Hi all,
Does anyone have any tips for extracting chunks of data from a distance matrix?
For instance, if one was interested in only a subset of distance
comparisons (i.e., that of rows 4 thru 6, and no others), is there a
simple way to pull that data out?
>From some playing around with an example (below), I've been able to
figure out that a distance matrix in R is stored as a single
2008 Jul 15
2
extracting elements from print object of Manova()
Hi there,
Does anyone know how to extract elements from the table returned by Manova()?
Using the univariate equivalent, Anova(), it's easy:
a.an<-Anova(lm(y~x1*x2))
a.an$F
This will return a vector of the F-values in order of the terms of the model.
However, a similar application using Manova():
m.an<-Manova(lm(Y~x1~x2))
m.an$F
Returns NULL. So does any attempt at calling the
2007 Jan 26
1
plotting results from tapply
Hi, there
I'm trying to plot what is returned from a call to tapply, and can't figure
out how to do it. My guess is that it has something to do with the
inclusion of row names when you ask for the values you're interested in,
but if anyone has any ideas on how to get it to work, that would be
stellar. Here's some example code:
y1<-rnorm(40, 2)
x1<-rep(1:2, each=20)
2004 Mar 04
3
Testing significance in a design with unequal but proportional sample sizes
Hi, all
I have a rather un-ideal dataset that I am trying to work with, and would
appreciate any advice you have on the matter.
I have 4 years worth of data taken at 3 depth-zones from which samples have
been taken at random. I am looking at the abundance of organism A between depth
zones and across years, and am interested in the possible interaction of
organism A distributions shifting
2003 Jul 01
1
Creating a loop that works....
Hi there,
First off, thanks to everyone who has helped me so far. Sorry to keep
pestering you all.
I'm including my code here, and I will comment down it where it is that I am
having problems figuring out how to write this damn thing.
> temper <- scan("temp2.dat", na.strings = ".", list(Day=0, Temp=0))
Read 366 records
>
> Day <- temper$Day ;
2008 Jul 06
2
Issue with postscript figures using WinAnsi encoding
Hi there,
I've hit a bump in writing postscript files with special characters in
the WinAnsi encoding on a windows machine.
Here's some sample code:
###########################################
postscript(file = "test.eps", encoding="WinAnsi.enc",
width = 3, height = 5.5, onefile = TRUE, horizontal=FALSE, family =
"sans",
title =
2008 Jul 09
2
sorting a data frame by rownames
Hi there,
I'm sure there's an easy answer to this, and I can't wait to see it.
The question: is there an easy way to sort a data frame by it's row names?
My dilemma:
I've had to pull apart a data frame, run it through a loop to do some
calculations and generate new variables, and then re-construct the chunks
back into a data frame at the end.
Doing this preserves the row