Displaying 20 results from an estimated 1100 matches similar to: "Using 'by()' in a function"
2012 Nov 21
0
Two way manova
Hello everyone,
I would like to perform a 2-way manova test, but I'm having some issues.
I implemented like this
Y<-cbind(Resp1,Resp2,Resp3,....,Respn)
model<-manova(Y "tilda" FactorA*FactorB)
summary.aov(model)
1. I don't know at what level I have to do the Type I error correction. Is
it on p-values returned by "summary.aov(model)? Or is it when I compare each
2011 Feb 17
0
Multi-response MCMCglmm (gaussian and zapoisson)
Dear MCMCglmm users,
I am currently struggling with the specification of a proper prior and model formula for a multi-response MCMCglmm with two of the three response variables being Gaussian and the third being za-poisson. The model includes several fixed effects and three nested random effects.
In general, I would prefer to fit a model with a fixed effect of trait and suppressed intercept for
2006 Aug 10
1
How to fit bivaraite longitudinal mixed model ?
Hi
Is there any way to fit a bivaraite longitudinal mixed model using R. I have
a data set with col names
resp1 (Y_ij1), resp2 (Y_ij2), timepts (t_ij), unit(i)
j=1,2,..,m and i=1,2,..n.
I want to fit the following two models
Model 1
Y_ij1, Y_ij2 | U_i = u_i ~ N(alpha + u_i + beta1*t_ij, Sigma)
U_i ~ iid N(0, sigu^2)
Sigma = bivariate AR structure
alpha and beta are vectors of order 2.
2011 Jul 07
2
kripp.alph error message
Hi! I fairly new to R, have only done pretty basic things so far, so this may
be a very basic question..... But I did search the forums and didn't see a
solution....
I'm trying to get going with kripp.alpha(). I'm loading data from a file,
like this:
> library(irr)
Loading required package: lpSolve
> x <- read.table("foo", comment.char="#", header=TRUE,
2004 Apr 28
1
simple repeated measures model: dumb user baffled!
I am in the process of transferring from an old version of S+ to using
R having used a variety of other packages in the past. I'm hugely
impressed with R but it has an excellent but depressing habit of exposing
that I'm not a professional statistician and has done so again.
Someone has run a nice little repeated measures design on my advice,
students randomised to four orders of a
2009 Nov 04
2
PCA with tow response variables
Hi all,
I'm new to PCA in R, so this might be a basical thing, but I cannot find anything on the net about it.
I need to make a PCA plot with two response variables (df$resp1 and df$resp2) against eight metabolites (df$met1, df$met2, ...) and I don't have a clue how to do... and I've only used the simplest PCAs before, like this:
pcaObj=prcomp(t(df[idx, c(40:47)]))
2005 Jan 25
1
"spx_word16_t *" is incompatible with parameter of type "float *"
Hi,
I am bring SPEEX up on Analog Device's Blackfin (using Visual DSP++ tool set). The floating point was too slow on this fixed-point processor so I am going for the integer version.
The floating point library build was very clean, but when I build with FIXED_POINT defined, the compiler exits when it find this discrepancy in \libspeex\cb_search.c :
".\libspeex\cb_search.c",
2007 Oct 17
1
passing arguments to functions within functions
Dear R Users,
I am trying to write a wrapper around summarize and xYplot from Hmisc
and am having trouble understanding how to pass arguments from the
function I am writing to the nested functions.
There must be a way, but I have not been able to figure it out.
An example is below.
Any advice would be greatly appreciated.
Thanks, Dan
# some example data
df=expand.grid(rep=1:4,
2006 Dec 02
2
nonlinear quantile regression
Hello, I?m with a problem in using nonlinear quantile regression, the
function nlrq.
I want to do a quantile regression o nonlinear function in the form
a*log(x)-b, the coefficients ?a? and ?b? is my objective. I try to use the
command:
funx <- function(x,a,b){
res <- a*log(x)-b
res
}
Dat.nlrq <- nlrq(y ~ funx(x, a, b), data=Dat, tau=0.25, trace=TRUE)
But a can?t solve de problem,
2011 Mar 18
1
PREDICTIONS from a PIECEWISE LINEAR (mixed) MODEL: THEY AIN'T LINEAR BETWEEN BREAK POINTS!!
I Dears,
if that wouldn't take u too much effort I'd like to ask for a swift opinion:
I have a alinear (mixed effect) model that I wish to run as a piecewise one.
When I predict the values Iget quite some odds and disturbing results:
The predicted stright line after the break point is not straight at all,
instead behaves like if it was a hig order polynomial or something
similar!!!!
I
2009 Feb 02
0
Using Information from the Stats4 package in base envir
Hi. Thank you very much in advance for your help.
I have generated data from two simple linear models and used k-means
clustering (stats4) to identify two clusters in the generated data.
Next, I would like to do simple linear regression for each separate
cluster. I can do this if I first use the cluster labels to define
two separate data frames with the subset function.
However, I would
2007 Dec 10
2
bug in by.data.frame, R-2.6.1 (PR#10506)
by() fails for 1-column matrices and dataframes:
X <- data.frame(a=1:10)
g <- gl(2,5)
by(X, g, colMeans)
Suggested fix:
--- by-old.R 2007-12-10 15:26:22.501086600 +0100
+++ by.R 2007-12-10 15:25:58.390477200 +0100
@@ -26,7 +26,7 @@
IND[[1]] <- INDICES
names(IND) <- deparse(substitute(INDICES))[1]
} else IND <- INDICES
- FUNx <-
2006 Oct 30
2
[LLVMdev] "fork" and "sync" for LLVM thread support - any comments?
Dear all,
Recently I've wanted to add support for threads to LLVM (motivated by
OpenMP, more or less), but before jumping in and implementing anything,
I thought it might be a good idea to describe what I have in mind and
ask for comments. Hence this email - if anyone has any comments, I'd be
very glad to hear them.
WHAT I'M PROPOSING:
The addition of two instructions - fork
2000 Apr 28
0
using by() in a function
I have a fix to by.data.frame() that works for my example. Can anyone see a
problem with this?
The old code has:
> get("by.data.frame",3)
function (data, INDICES, FUN, ...)
{
### code skipped to save space
ans <- eval(substitute(tapply(1:nrow(data), IND, FUNx)), ### The problem
seems to be here
data)
attr(ans, "call") <- match.call()
class(ans)
2010 Sep 13
2
value returned by by()
Hi,
I noticed that by() returns an object of class 'by', regardless of what
its argument 'simplify' is. ?by says that it always returns a list if
simplify=FALSE, yet by.data.frame shows:
---<--------------------cut here---------------start------------------->---
function (data, INDICES, FUN, ..., simplify = TRUE)
{
if (!is.list(INDICES)) {
IND <-
2008 Apr 15
1
by inconsistently strips class - with fix
summary:
The function 'by' inconsistently strips class from the data to which
it is applied.
quick reason:
tapply strips class when simplify is set to TRUE (the default) due to
the class stripping behaviour of unlist.
quick answer:
This can be fixed by invoking tapply with simplify=FALSE, or changing
tapply to use do.call(c instead of unlist
executable example:
2010 May 19
0
how to remove interactions of factor with continuous var
I need to remove certain interactions and keep only the one between the second level of the factor and the continuous var t2
bin4 <- glm(resp2~ t*t2+c5.vrm,data=dfa,family="quasibinomial")
> summary(bin4)
Call:
glm(formula = resp2 ~ t * t2 + c5.vrm, family = "quasibinomial",
data = dfa)
Deviance Residuals:
Min 1Q Median 3Q Max
-6.5464
2000 Jan 31
1
Is there a "by()" function in R like in S?
Hallo R-users,
I'm a R (release 0.65) novice, but have read some about S. Is there a
similar function in R like the S function "by()" ?
This function groups data typically from a matrix by a variable and
applies a function on the grouped data. Example in S:
> by(data, year, summary)
where "data" is a matrix containing the variable "year". After grouping
2011 Jul 12
1
LOESS function Newton optimization
I have a question about running an optimization function on an existing LOESS
function defined in R. I have a very large dataset (1 million observations)
and have run a LOESS regression. Now, I want to run a Newton-Raphson
optimization to determine the point at which the slope change is the
greatest.
I am relatively new to R and have tried several permutations of the maxNR
and nlm functions with
2003 Feb 11
3
Problems with Rcmd check on Win 2000 & rw1062
When I run Rcmd check on a package on my Windows 2000 machine, I get a
series of error messages like the following:
* checking generic/method consistency ...c:\DOCUME~1\R5018~1.WOO\LOCALS~1\Temp/R
utils138414013: cannot open c:DOCUME~1R5018~1.WOOLOCALS~1Temp/Rin138408157: no s
uch file
It looks as if a Windows style path to the temp directory is not being interpreted correctly, with backslashes