#on recupere des donnees : pertes de poids au cours du temps library(MASS) attach(wtloss) help(wtloss) # voir la forme plot(Days,Weight,type="p",ylab="Poids (kg)") #On tente un regression avec un modele puissance : # poids = b0 + b1*2^(-t/th) wtloss.st<-c(b0 = 90, b1 = 95, th = 120) wtloss.md <- Weight ~ b0 + b1*2^(-Days/th) #c'est la fonction nls (non-linear least square) wtloss.fm <- nls(wtloss.md, start=wtloss.st, trace=TRUE) summary(wtloss.fm) wt<-seq(0, 255, by = 1) lines(wt,predict(wtloss.fm, list(Days = wt)))