j'ai trouvé mon erreur, voici les codes pour estimer les erreurs standards dans mon exemple :
Code : Tout sélectionner
> r=read.table("Rates.txt",header=T)
> head(r)
Saison Type Expl N Turn Ext
M2 V E 14.080 0.429 0.152
M2 V E 16.010 0.000 0.141
M2 V E 18.710 0.014 0.128
R V E 10.900 0.359 0.115
R V E 16.940 0.000 0.149
R V E 10.740 0.174 0.067
> e=read.table("meanestim.txt",header=T)# tableau des 24 niveau du modèle
> head(e)
Saison Type Expl
1 M1 S E
2 R S E
3 M2 S E
4 H S E
5 M1 S F
6 R S F
> attach(r)
> man=lm(cbind(log(N+1),log(Turn+1),log(Ext+1))~Expl*Type+Type*Saison +Expl:Saison)
> head(predict(man,e))
[,1] [,2] [,3]
1 2.8839757 0.11721771 0.14354318
2 1.8992944 0.33704190 0.08885256
3 3.1556707 0.18902287 0.14452104
4 3.0040852 0.03100855 0.14363425
5 2.7341254 0.26579727 0.17151655
6 3.2102525 0.24655467 0.19370166
> e1=model.matrix(~Expl*Type+Type*Saison +Expl:Saison,data=e)
> head(e1)
(Intercept) ExplF TypeS TypeV SaisonM1 SaisonM2 SaisonR ExplF:TypeS
1 1 0 1 0 1 0 0 0
2 1 0 1 0 0 0 1 0
3 1 0 1 0 0 1 0 0
4 1 0 1 0 0 0 0 0
5 1 1 1 0 1 0 0 1
6 1 1 1 0 0 0 1 1
ExplF:TypeV TypeS:SaisonM1 TypeV:SaisonM1 TypeS:SaisonM2 TypeV:SaisonM2
1 0 1 0 0 0
2 0 0 0 0 0
3 0 0 0 1 0
4 0 0 0 0 0
5 0 1 0 0 0
6 0 0 0 0 0
TypeS:SaisonR TypeV:SaisonR ExplF:SaisonM1 ExplF:SaisonM2 ExplF:SaisonR
1 0 0 0 0 0
2 1 0 0 0 0
3 0 0 0 0 0
4 0 0 0 0 0
5 0 0 1 0 0
6 1 0 0 0 1
>man1=lm(log(N+1)~Expl*Type+Type*Saison +Expl:Saison)#variable expliquée "N"
> sqrt(e1[1,]%*%vcov(man1)%*%e1[1,]) # erreur standard pour la catégorie 1 corespondant à predict(man,e)[1,1]
[,1]
[1,] 0.4676847
> sqrt(e1[2,]%*%vcov(man1)%*%e1[2,]) # erreur standard pour la catégorie 2 corespondant à predict(man,e)[2,1]
[,1]
[1,] 0.2806108
j'espère que les calculs sont statistiquement correctes,
désolé d'avoir encombré un temps le forum, je suis néanmoins preneur de remarques, corrections le cas échéant, notamment sur la façon d'automatiser le calcule.
Merci d'avance à tous, :)
Fred.