Bonjour,

Je réalise une méta-analyse en nutrition animale et je souhaite obtenir une réponse à une variation de nutriment sur les performances de croissance des animaux. La réponse selon la biblio est curvilinéaire plateau de la forme : Performance=a+b.(1-exp(-c.(nutriment-d))).
Voici un exemple de jeu de données :

codage nutriment perf
d 1,09 19,06
a 0,94 20
a 0,8 15
b 1,2 20,42
b 1,04 20,07
b 0,88 18
c 1,31 21,5
c 1,14 22,44
c 0,96 20,5
a 1,05 21,31
d 1,15 20,71
d 1,25 21,6
e 1,05 20,71
e 1,15 21,80
e 1,25 21,5
f 1,05 20,44
f 1,15 21,44
f 1,25 21,4

Sans prendre en compte la structure des données à l’aide du code suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
 
library(MASS)
library(minpack.lm)
mod02<-nlsLM(perf~a+b*(1-exp(-c*(nutriment-d))),data=data,start=list(a=-333,b=355,c=5,d=0),trace=TRUE)
mod02
plot(mod02)
summary(mod02)
J’obtiens une réponse très satisfaisante :
Nom : Rplot.png
Affichages : 220
Taille : 6,5 Ko

Cependant quand j’ajoute dans mon modèle la variable codage (variable qualitative d’intérêt) :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 
mod03<-nlsLM(perf~codage+a+b*(1-exp(-c*(nutriment-d))),start=list(a=-330,b=360,c=-9,d=0.3),data=data, trace=TRUE)
J’obtiens l’erreur suivante :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
 
It.    0, RSS =        nan, Par. =       -330        360         -9        0.3
It.    1, RSS = 4.73876e-85, Par. =       -330        360         -9        0.3
Error in numericDeriv(form[[3L]], names(ind), env) : 
  Valeur manquante ou infinie obtenue au cours du calcul du modèle
In addition: Warning messages:
1: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
2: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
3: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
4: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
5: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
6: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
7: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
8: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
It.    0, RSS =        nan, Par. =       -330        360         -9        0.3
It.    1, RSS = 4.73876e-85, Par. =       -330        360         -9        0.3
Error in numericDeriv(form[[3L]], names(ind), env) : 
  Valeur manquante ou infinie obtenue au cours du calcul du modèle
In addition: Warning messages:
1: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
2: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
3: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
4: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
5: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
6: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
7: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
8: In Ops.factor(codage, a) : ‘+’ not meaningful for factors
Auriez-vous une solution pour faire tourner ce modèle et obtenir les coefficients pour chacun des codages et les paramètres a, b, c et d ?

Je vous en remercie par avance,

Cordialement,

Pierre