Cette page appartient aux archives web de l'EPFL et n'est plus tenue à jour.
This page belongs to EPFL's web archive and is no longer updated.

Modèle ne contenant que le poids.

Bonjour,

 

Dans le cadre du practical 2, nous trouvons un modèle ne contenant que le poids pour la méthode forward BIC. De l'avis de tous, il s'agit d'une erreur. Voici le code qui fournit ce modèle :

 

cars.new <- cars[,-c(1:10)]

m0 <- lm(y ~ 1, data = cars)

mod.fwdBIC <- step(m0, scope = formula(cars.new) , direction="forward", k = log(82))

Merci d'avance,

Arthur

Posted by Arthur Simon Lucien Waltz on Thursday 5 December 2013 at 15:11
Comments
I guess the problem is that when you write "formula(cars.new)" you don't get the right regression formula "y ~ [...]" because it seems to me that you don't have y in your "cars.new" data frame. The easiest way to solve this would probably be using the "data.frame" command to add the response y as the first variable in your data frame. Also, make sure that you have properly transformed your response (i.e. y = 100/CityMPG).
Posted by Mikael Kuusela on Thursday 5 December 2013 at 15:48
It does work now. Thank you!
Posted by Arthur Simon Lucien Waltz on Thursday 5 December 2013 at 16:50