search for: fac3

Displaying 19 results from an estimated 19 matches for "fac3".

Did you mean: fac
2008 Sep 09
1
How do I compute interactions with anova.mlm ?
...s same output as SAS anova(mlmfit, mlmfit0, M = ~ fac1 + fac2, X = ~ fac2, idata = idata, test = "Wilks") % test fac1*fac2 interaction, also works, also the same output as SAS anova(mlmfit, mlmfit0, X = ~ fac1 + fac2, idata = idata, test = "Wilks") Three Factors: fac1, fac2, fac3 mlmfit <- lm(mydata~1) mlmfit0 <- update(mlmfit, ~0) % test fac1, works, same as SAS anova(mlmfit, mlmfit0, M = ~ fac1 + fac2 + fac3, X = ~ fac2 + fac3, idata = idata, test = "Wilks") Now, I try to compute the interactions the same way, but this doesn't work: % fac1*fac2...
2011 Oct 03
1
function recode within sapply
Dear List, I am using function recode, from package car, within sapply, as follows: L3 <- LETTERS[1:3] (d <- data.frame(cbind(x = 1, y = 1:10), fac1 = sample(L3, 10, replace=TRUE), fac2 = sample(L3, 10, replace=TRUE), fac3 = sample(L3, 10, replace=TRUE))) str(d) d[, c("fac1", "fac2")] <- sapply(d[, c("fac1", "fac2")], recode, "c('A', 'B') = 'XX'", as.factor.result = TRUE) d[, "fac3"] <- recode(d[, "fac3"], "c(...
2009 May 22
1
regrouping factor levels
...quot;i","j")]<-"C" levels(fac1) print(fac1) ##second method fac2<-fac? levels(fac2)[c(1,2,3)]<-"A" levels(fac2)[c(2,3,4)]<-"B" # not c(4,5,6) levels(fac2)[c(3,4,5,6)]<-"C" # not c(7,8,9,10) levels(fac2) print(fac2) #third method fac3<-fac levels(fac3)<-list("A"=c("a","b","c"),"B"=c("d","e","f"),"C"=c("g","h","i","j")) levels(fac3) print(fac3) I first tried method 1 and had no luck with it at a...
2007 Oct 17
1
passing arguments to functions within functions
...m 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, 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:...
2002 Jun 04
2
Scaling on a data.frame
Hey, hopefully there is an easy way to solve my problem. All that i think off is lengthy and clumsy. Given a data.frame d with columns VALUE, FAC1, FAC2, FAC3. Let FAC1 be something like experiment number, so that there are exactly the same number of rows for each level of FAC1 in the data.frame. Now i would like to scale all values according to the center of its experiment. So i can apply s <- by(d[1], FAC1, scale). But i don't want to lose the...
2010 Apr 21
5
Bugs? when dealing with contrasts
..."contr.poly" > scores <- rep(seq(-2, 2), 3); scores [1] -2 -1 0 1 2 -2 -1 0 1 2 -2 -1 0 1 2 > fac <- gl(3, 5); fac [1] 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 Levels: 1 2 3 > > # I get this: > model.matrix(~ scores:fac) (Intercept) scores:fac1 scores:fac2 scores:fac3 1 1 -2 0 0 2 1 -1 0 0 3 1 0 0 0 4 1 1 0 0 5 1 2 0 0 6 1 0 -2...
2012 Nov 29
5
bootstrapped cox regression (rms package)
...function in the rms package, which at least generates confidence intervals similar to what is observed in SPSS. However, the p-values associated with each predictor in the model are not really close in many instances. Here is the code I am using: formula=Surv(months, recidivate) ~ fac1 + fac2 + fac3 + fac4 + fac5 + fac6 + fac7 + fac8 fit=cph(formula, data=temp, x=T, y=T) validate(fit, method="boot", B=9999, bw=F, type="residual", sls=0.05, aics=0,force=NULL, estimates=TRUE, pr=FALSE) out=bootcov(fit, B=9999, pr=F, coef.reps=T, loglik=F) for (i in 1:8) { print(quantile(out$b...
2012 Nov 29
0
bootstrapped cox regression in rms package (non html!)
...function in the rms package, which at least generates confidence intervals similar to what is observed in SPSS. However, the p-values associated with each predictor in the model are not really close in many instances. Here is the code I am using: formula=Surv(months, recidivate) ~ fac1 + fac2 + fac3 + fac4 + fac5 + fac6 + fac7 + fac8 fit=cph(formula, data=temp, x=T, y=T) validate(fit, method="boot", B=9999, bw=F, type="residual", sls=0.05, aics=0,force=NULL, estimates=TRUE, pr=FALSE) out=bootcov(fit, B=9999, pr=F, coef.reps=T, loglik=F) for (i in 1:8) { print(quantile(out$b...
2002 Jun 05
1
[Re: Re: Scaling on a data.frame]
Stefan Roepcke <stefan.roepcke at metagen.de> writes: > Hey, > > hopefully there is an easy way to solve my problem. > All that i think off is lengthy and clumsy. > > Given a data.frame d with columns VALUE, FAC1, FAC2, FAC3. > Let FAC1 be something like experiment number, > so that there are exactly the same number of rows for each level of FAC1 > in the data.frame. > > Now i would like to scale all values according to the center of its > experiment. > So i can apply s <- by(d[1], FAC1, scale)...
2012 May 29
1
GAM interactions, by example
...t) plot(b,pages=1) summary(b) Family: gaussian Link function: identity Formula: y ~ fac + s(x2, by = fac) + s(x0) Parametric coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.1784 0.1985 5.937 6.59e-09 *** fac2 -1.2148 0.2807 -4.329 1.92e-05 *** fac3 2.2012 0.2436 9.034 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Approximate significance of smooth terms: edf Ref.df F p-value s(x2):fac1 5.364 6.472 2.285 0.0312 * s(x2):fac2 4.523...
2004 Sep 01
1
obtaining exact p-values in mixed effects model
...hat there is rounding of the p-values to zero, if the p-value is less than about 1.0e-16. Is there a way we can obtain the exact p-values from lme without rounding? used commands: library(nlme) g<-lme(value~factor(fac1)+factor(fac2)+factor(fac1):factor(fac2),data=mydataframe,random=~1|factor(fac3)) ag<-anova(g) kind regards, R. Alberts
2010 Nov 29
1
surpressing tickmarks / labels x-as for two sets of boxplot (plotted as stacked boxplots)
...;, ??????? ylab = "individual estimates") boxplot(coefs ~ factor, data = temp, naxt="n",add = TRUE, ??????? boxwex = 0.25, at = 1:7 + 0.15, ??????? subset = experiment == "second", col = "green") axis(at=1:7,side=1,c("fac1","fac2","fac3","fac4","fac5","fac6","fac7")) legend(6,-0.5, c("experiment1", "experiment2"), ?????? fill = c("red", "green")) Does anyone know how I can surpress these labels for the second boxplot? Thanks in advance, Karin
2010 Mar 08
0
page boundaries for latex printing of summary.formula objects in Hmisc
...c) ## create an example data.frame test.df <- data.frame(sex = gl(2, 110, labels = c("Male", "Female")), fac1 = sample(gl(11, 100, labels = paste("V1 Level", 1:11))), fac2 = sample(gl(11, 100, labels = paste("V2 Level", 1:11))), fac3 = sample(gl(11, 100, labels = paste("V3 Level", 1:11))), fac4 = sample(gl(11, 100, labels = paste("V4 Level", 1:11))), fac5 = sample(gl(11, 100, labels = paste("V5 Level", 1:11))), fac6 = sample(gl(11, 100, labels = paste("V6 Level"...
2012 May 29
1
strucchange Fstats() example
...t) plot(b,pages=1) summary(b) Family: gaussian Link function: identity Formula: y ~ fac + s(x2, by = fac) + s(x0) Parametric coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.1784 0.1985 5.937 6.59e-09 *** fac2 -1.2148 0.2807 -4.329 1.92e-05 *** fac3 2.2012 0.2436 9.034 < 2e-16 *** --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Approximate significance of smooth terms: edf Ref.df F p-value s(x2):fac1 5.364 6.472 2.285 0.0312 * s(x2):fac2 4.523...
2012 Apr 26
8
understanding the FUNCTION function
Hello, I am trying to understand why the FUNCTION used in several codes, won't create the object after it finishes running the code. For instance, look at the following: Number<- function(x) {MyNumberIs<-x} When I run Number(5) Everything goes well, except that if I try to call the object MyNumberIs, I won't find it. I understand that this function can assume many parameters,
2003 Feb 14
2
factorial function
Sorry for the stupid question, but is there the factorial function in R? I tried to find it using help.search('factorial') but got nothing appropriate. Many thanks, -Serge
2004 May 12
6
Design matrix not identity
Hello again, I was too quick before. What I was looking for was a function that constructs the design (or incidence) matrix (X in a linear model) from a factor. Uwe Ligges suggested using model.matrix and this does almost what I want, but it is first necessary to construct a data variable. It also asigns ones to all rows of the first column (because this is set to be the contrast, not really what
2013 Apr 03
9
VERY odd HTTP Packet Loss
I''m running Xen 4.1.4 on Fedora 17. I have some CentOS 6 DomUs - an haproxy machine and some tomcat VMs. When clients send requests with: POST /ProposalInterface HTTP/1.1 Content-Type: text/xml Host: www.myhost.co.uk Content-Length: 2099 Expect: 100-continue Connection: Keep-Alive The "continuation" doesn''t happen. The POST is truncated at 1449 bytes, and the
2010 Aug 24
0
mlm for within subject design
...4 of the variables and can't test than 17 variables (see below). I am wondering if there is a work around this problem. Please help, Mahesh gam.object <- gam(YVAR~1, data=gam.data) step.object <-step.gam(gam.object, scope=list( "FAC1"=~1+FAC1, "FAC2"=~1+FAC2, "FAC3"=~1+FAC3, "NUM1"=~1+NUM1+ns(NUM1,df=2), "NUM2"=~1+NUM2+ns(NUM2,df=2), "NUM3"=~1+NUM3+ns(NUM3,df=2), "NUM4"=~1+NUM4+ns(NUM4,df=2), "NUM5"=~1+NUM5+ns(NUM5,df=2), "NUM6"=~1+NUM6+ns(NUM6,df=2), "NUM7"=~1+NUM7+ns(NUM7,df=2), &quo...