Displaying 10 results from an estimated 10 matches for "resp1".
Did you mean:
resp
2007 Oct 17
1
passing arguments to functions within functions
...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, fac1=c("a","b"), fac2=c("c","d"), fac3=c
("e","f"))
df$resp1=rnorm(length(df$fac1))
df
# define a funciton to compute mean, std error and n.
meanstderr <- function(x) c(Mean=mean(x,na.rm=TRUE),se=sqrt(var
(x,na.rm=TRUE)/length(na.omit(x))), n=length(na.omit(x)))
# what I want to wrap into a single funtction:
sumdf=with(df, summarize(X=resp1, by=llist...
2000 Apr 28
1
Using 'by()' in a function
...ever, I cannot get it to work. The problem seems to be passing the
data argument of by() as a function argument. Is this bug, or am I missing
something (or both)?
> ### Generate some test data
> Test <- vector("list",2)
> Test[[1]] <-
data.frame(Dose=rep(c(0,1),c(10,10)),Resp1=rnorm(20),Resp2=rnorm(20))
> ### The summary function
> sumfun <- function(z)
+ {
+ by(data=z,
+ INDICES=list(factor(z[,"Dose"])),
+ FUN=function(y)
+ {
+ apply(as.matrix(y[,c("Resp1","Resp2")]),2,
+ function(x)c(Mean=mean(...
2009 Feb 02
0
Using Information from the Stats4 package in base envir
...^2(b))
a0= 0; a1 = 1.5; sigmaA=4; b0=50; b1=-2; sigmaB=4; n=250; min=0; max=50;
#Generate Data from the Models
x1 = runif(n, min, max); #Explanatory variable
eA = rnorm(n, 0, sigmaA); eB = rnorm(n, 0, sigmaB);
respA = a0 +a1*x1 + eA; respB = b0 +b1*x1 + eB; #Responses
#K-Means Clustering
resp1 = c(respA, respB);#Put response into single vector for k-means
x12 = rep(x1,nummod); #Put explanatory into a single vector
data1 = data.frame(resp1, x12) #Data frame for kmeans
cluster1 = kmeans(data1, 2, nstart=25)$cluster #Obtain cluster labels
data1 = data.frame(data1 ,cluster1)#Clus...
2004 Apr 28
1
simple repeated measures model: dumb user baffled!
...little repeated measures design on my advice,
students randomised to four orders of a condition that can be N or E:
four orders used: NEEN, NENE, ENEN, ENNE, ten students in each block. I've inherited
the data (in SPSS but I can deal with that!) with variables like:
ID GENDER ORDER C1 C2 C3 C4 RESP1 RESP2 RESP3 RESP4 ...
ORDER is the order as a/b/c/d; C1:C4 has the N or E for each occasion, and
RESP1:RESP4 the response variables. (There are a number of these but
looking at each separately is justifiable theoretically).
I've had a look around the R help and some S+ books I've got and...
2011 Jul 07
2
kripp.alph error message
...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, sep=",", quote="\"")
> x
HITId Resp1 Resp2 Resp3
1 22QI9NZW6HEZ1HYZ5BYTC69GDR5NXQ none
2 24SB6BFMFFOYTBDW8Y6DKESCJWZXKU lead lead
3 26OAUC26DG678UHYAF6K4COKLOH5CG none none none
4 28RZJMJUNU8LUZB2FVWRD8D828Y0G0 tick tick both
5 29DGULF395SW1G0WU7UN2NJBHK4QCE none none none
6 2F6CCF0CP5KXKM2IXXOYK4PM...
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.
Model 2
Y_...
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
subgroup with another subgroup? Or is...
2009 May 12
1
ROCR: auc and logarithm plot
...e new to R and I have two questions regarding ROCR.
1. I have tried to understand how to extract area-under-curve value by looking at the ROCR document and googling. Still I am not sure if I am doing the right thing. Here is my code, is "auc1" the auc value?
"
pred1 <- prediction(resp1,label1)
perf1 <- performance(pred1,"tpr","fpr")
plot( perf1, type="l",col=1 )
auc1 <- performance(pred1,"auc")
auc1 <- auc1@y.values[[2]]
"
2. I have to compare two models that have very close ROCs. I'd like to have a more distinguishable...
2011 Feb 17
0
Multi-response MCMCglmm (gaussian and zapoisson)
...es between the response variables and consequently to specify completely parameterized covariance matrices.
My current model looks like this:
prior<-list(R=list(V=diag(4),nu=0.004),G=list(G1=list(V=diag(4)/4,n=4),G2=list(V=diag(4)/4,n=4),G3=list(V=diag(4)/4,n=4)))
m1<-MCMCglmm(fixed=cbind(resp1,resp2,resp3) ~
trait:(expl1 + expl2+ expl3+ expl4+ expl5...)+trait-1,
random=~us(trait):rand1+us(trait): rand1: rand2+us(trait): rand1: rand2: rand3,
rcov=~us(trait):units,family=c("gaussian","gaussian","zapoisson"),nitt=20000,burnin=5000,thin=10,prior=prior,data=dat)...
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)]))
biplot(pcaObj)
Anyone who knows how to do?
Best rageds,
Joel
_______...