Commit 44d6a669 by Eric Coissac

Because scaling (reducing and centering) is meaningless for linear regression we…

Because scaling (reducing and centering) is meaningless for linear regression we removed these options
parent 4f38d1a6
......@@ -107,8 +107,7 @@ pm.fit = function(covmat,y,xs,
#' @export
pm = function (formula,data, subset, weights, na.action, method = "qr",
singular.ok = TRUE, tol = 1e-07,
model = TRUE, x = TRUE, y = TRUE, A = TRUE ,
scale = TRUE, return.scale = TRUE) {
model = TRUE, x = TRUE, y = TRUE, A = TRUE) {
ret.x <- x
ret.y <- y
......@@ -168,10 +167,7 @@ pm = function (formula,data, subset, weights, na.action, method = "qr",
variances= diag(data.cov)
std.dev = sqrt(variances)
if (scale)
vars.norm = mapply(function(x,s) scale(x,scale = FALSE)/s, vars,std.dev)
else
vars.norm = as.procmod.frame(mapply(function(x) scale(x,scale = FALSE), vars))
vars.norm = as.procmod.frame(mapply(function(x) scale(x,scale = FALSE), vars))
if (is.null(w)) {
subset.w=rep(TRUE,nvars)
......@@ -192,15 +188,10 @@ pm = function (formula,data, subset, weights, na.action, method = "qr",
singular.ok = singular.ok,
tol = tol)
if (! scale) {
y.sd = std.dev[irep]
xs.sd= std.dev[seq_len(nvars)!=irep]
y.sd = std.dev[irep]
xs.sd= std.dev[seq_len(nvars)!=irep]
z$varpart = (z$coefficients * xs.sd / y.sd) ^ 2
}
else {
z$varpart = z$coefficients ^ 2
}
z$varpart = (z$coefficients * xs.sd / y.sd) ^ 2
Y = vars.norm[[irep]]
......
......@@ -548,24 +548,13 @@ partition = euk.anova[,"Sum Sq"]/sum(euk.anova[,"Sum Sq"])
names(partition)=rownames(euk.anova)
partition
```
```{r}
euk.pm = pm(euk ~ soil + climat + geo + hist,data=data,scale = FALSE)
euk.pm
```
```{r}
plot(euk.pm)
```
```{r}
euk.anova = anova(euk.pm)
euk.anova
euk.anova.w = anova(euk.pm.w)
euk.anova.w
```
```{r}
partition = euk.anova[,"Sum Sq"]/sum(euk.anova[,"Sum Sq"])
names(partition)=rownames(euk.anova)
partition = euk.anova.w[,"Sum Sq"]/sum(euk.anova.w[,"Sum Sq"])
names(partition)=rownames(euk.anova.w)
partition
```
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment