Commit 4f38d1a6 by Eric Coissac

Version scaled / not scaled is know working but useless

parent f703a1bc
......@@ -27,14 +27,9 @@ NULL
for (i in seq_len(ndots))
if (! is.null(dots[[i]])) nactualdots=nactualdots+1
print(nactualdots)
data = vector(mode="list", nvars + nactualdots)
names= character(nvars + nactualdots)
print(length(data))
for (i in seq_len(nvars)) {
data[[i]]=variables[[i]]
names[i]=varnames[i]
......@@ -46,7 +41,7 @@ NULL
if (nchar(dotnames[i]) + 3 > 256)
stop(sprintf("overlong names in '%s'",dotnames[i]))
buf=paste('(',dotnames[i],')',sep="")
data[nvars + j]=dots[[i]]
data[nvars + j]=dots[i]
names[nvars + j]=buf
j=j+1
}
......@@ -222,8 +217,6 @@ model.procmod.default = function (formula,
subset <- eval(substitute(subset), data, env)
print(extranames)
data = .modelprocmodframe(formula, rownames,
variables,varnames,
extras, extranames,
......
......@@ -177,7 +177,6 @@ pm = function (formula,data, subset, weights, na.action, method = "qr",
subset.w=rep(TRUE,nvars)
}
else {
print(w)
sw = sqrt(w)
vars.norm = as.procmod.frame(lapply(vars.norm, function(v) v * sw))
......@@ -193,19 +192,19 @@ pm = function (formula,data, subset, weights, na.action, method = "qr",
singular.ok = singular.ok,
tol = tol)
if (scale)
z$varpart = z$coefficients^2
if (! scale) {
y.sd = std.dev[irep]
xs.sd= std.dev[seq_len(nvars)!=irep]
z$varpart = (z$coefficients * xs.sd / y.sd) ^ 2
}
else {
data.cor = mcor(vars.norm)
anova = pm.fit(data.cor,
y = irep, xs = seq_len(nvars)!=irep,
singular.ok = singular.ok,
tol = tol)$coefficients
z$varpart = anova^2
z$varpart = z$coefficients ^ 2
}
Y = vars.norm[[irep]]
Xs= vars.norm[-irep]
Xs= vars.norm[seq_len(nvars)!=irep]
Ymean <- colMeans(Y)
Xmeans<- lapply(Xs,colMeans)
......
......@@ -534,66 +534,35 @@ euk.pm.w
plot(euk.pm.w)
```
```{r}
W=1/rowSums(euk.pm.w$residuals^2)
W=W/max(W)
euk.pm.w = pm(euk ~ soil + climat + geo + hist,data=data,weights = W)
euk.pm.w
```
```{r}
plot(euk.pm.w)
```
```{r}
W=1/rowSums(euk.pm.w$residuals^2)
W=W/max(W)
euk.pm.w = pm(euk ~ soil + climat + geo + hist,data=data,weights = W)
euk.pm.w
```
finaly the analysis of the variance corresponding to this model
```{r}
plot(euk.pm.w)
euk.anova = anova(euk.pm)
euk.anova
```
Partition of the variance among the factors
```{r}
W=1/rowSums(euk.pm.w$residuals^2)
W=W/max(W)
euk.pm.w = pm(euk ~ soil + climat + geo + hist,data=data,weights = W)
euk.pm.w
```
```{r}
plot(euk.pm.w)
partition = euk.anova[,"Sum Sq"]/sum(euk.anova[,"Sum Sq"])
names(partition)=rownames(euk.anova)
partition
```
```{r}
W=1/rowSums(euk.pm.w$residuals^2)
W=W/max(W)
euk.pm.w = pm(euk ~ soil + climat + geo + hist,data=data,weights = W)
euk.pm.w
euk.pm = pm(euk ~ soil + climat + geo + hist,data=data,scale = FALSE)
euk.pm
```
```{r}
plot(euk.pm.w)
plot(euk.pm)
```
finaly the analysis of the variance corresponding to this model
```{r}
euk.anova = anova(euk.pm)
euk.anova
```
Partition of the variance among the factors
```{r}
partition = euk.anova[,"Sum Sq"]/sum(euk.anova[,"Sum Sq"])
names(partition)=rownames(euk.anova)
......
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