Показать сообщение отдельно
  #1  
Старый 30.06.2017, 15:16
John Zaicev
Guest
 
Сообщений: n/a
По умолчанию На каком языке этот код?

John Zaicev написал(а) к All в Jun 17 14:39:15 по местному времени:

[√] Приветствую, All !

library(xtable)
library(openintro)
data(marioKart)
toss <- which(marioKart$totalPr > 80)
keep <- c("totalPr", "cond", "stockPhoto", "duration", "wheels", "shipSp")
d <- marioKart[-toss, keep]
d$stockPhoto <- (d$stockPhoto == "yes") + 0
d$cond <- (d$cond == "new") + 0
thisOne <- names(d) == "cond"
names(d)[thisOne] <- "condNew"
d$shipSp <- as.character(d$shipSp)
these <- d$shipSp %in% c("firstClass", "priority", "parcel", "media")
d$shipSp[these] <- "usps"
these <- d$shipSp %in% c("ups3Day", "upsGround")
d$shipSp[these] <- "ups"
these <- d$shipSp %in% c("other", "standard")
d$shipSp[these] <- "unknown"
d$shipSp <- as.factor(d$shipSp)
d <- d[,-which(colnames(d) == "shipSp")]

summary(lm(totalPr ~ ., d))
summary(lm(totalPr ~ condNew + stockPhoto + duration + wheels, d))
xtable(summary(lm(totalPr ~ condNew + stockPhoto + wheels, d)))
xtable(summary(fit <- lm(totalPr ~ condNew + wheels, d)))


fit1 <- lm(totalPr ~ duration + cond + stockPhoto + wheels, d)
fit2 <- lm(totalPr ~ cond + stockPhoto + wheels, d)
anova(fit1, fit2)

fit1 <- lm(totalPr ~ cond + stockPhoto, d)
fit2 <- lm(totalPr ~ stockPhoto, d)
anova(fit1, fit2)

Вроде бы ничего не забыл...
[√] До скорого, All !

▌║▐║│║▌║││║║ /http://adf.ly/1Y63НZ/
2║5080▌244║0 /P2Pirates@Mail.ru_/ _DreamLand laboratory

--- Моему первому компьютеру 9371 день (или 302 месяца)
Ответить с цитированием