Displaying 2 results from an estimated 2 matches for "testx2".
Did you mean:
test2
2013 Nov 08
1
Different output from lm() and lmPerm lmp() if categorical variables are included in the analysis
...from package lmPerm
According to help(lmp): "This function will behave identically to lm()
if the following parameters are set: perm="", seq=TRUE,
center=FALSE.")
But not in the case of including categorical variables:
require(lmPerm)
set.seed(42)
testx1 <- rnorm(100,10,5)
testx2 <- c(rep("a",50),rep("b",50))
testy <- 5*testx1 + 3 + runif(100,-20,20)
test <- data.frame(x1=testx1,x2=
testx2,y=testy)
atest <- lm(y ~ x1*x2,data=test)
aptest <- lmp(y ~ x1*x2,data=test,perm = "", seqs = TRUE, center = FALSE)
summary(atest)
Call:
lm(f...
2011 Jul 09
3
Using str() in a function.
...d a large number of things; none do what I want.
> GG<- c(1,2,3)
# This one ignores the str().
> testX <- function(X) {return(summary(X)); str(X)}
> testX(GG)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.0 1.5 2.0 2.0 2.5 3.0
# So does this one.
> testX2 <- function(X) {return(summary(X)); return(str(X))}
> testX2(GG)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.0 1.5 2.0 2.0 2.5 3.0
# On the other hand, this one ignores the summary()
> testX3 <- function(X) {summary(X); return(str(X))}
> testX3(GG)
n...