Last active
June 6, 2017 01:46
-
-
Save drsimonj/5b2cfc428fce350676db5dc77c059052 to your computer and use it in GitHub Desktop.
Revisions
-
drsimonj revised this gist
Jun 6, 2017 . 1 changed file with 11 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,4 +33,14 @@ gamlss:::predict.gamlss(fit, newdata = d[1:5,]) d <- d[1:10,] gamlss:::predict.gamlss(fit, newdata = d[1:5,]) rm(d) gamlss:::predict.gamlss(fit, newdata = d[1:5,]) # predict for Generalized Linear Models omits missing values unless data is explicitly added d <- datasets::iris d[1,1] <- NA a <- predict(stats::glm(Species=="setosa" ~ ., data = d)) b <- predict(stats::glm(Species=="setosa" ~ ., data = d), newdata = d) length(a) length(b) sum(is.na(a)) sum(is.na(b)) -
drsimonj revised this gist
May 17, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,5 +32,5 @@ fit <- gamlss::gamlss(vs ~ hp + wt, data = d, family = gamlss.dist::BI()) gamlss:::predict.gamlss(fit, newdata = d[1:5,]) d <- d[1:10,] gamlss:::predict.gamlss(fit, newdata = d[1:5,]) rm(d) gamlss:::predict.gamlss(fit, newdata = d[1:5,]) -
drsimonj revised this gist
May 17, 2017 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,5 +32,5 @@ fit <- gamlss::gamlss(vs ~ hp + wt, data = d, family = gamlss.dist::BI()) gamlss:::predict.gamlss(fit, newdata = d[1:5,]) d <- d[1:10,] gamlss:::predict.gamlss(fit, newdata = d[1:5,]) d <- NULL gamlss:::predict.gamlss(fit, newdata = d[1:5,]) -
drsimonj revised this gist
May 17, 2017 . No changes.There are no files selected for viewing
-
drsimonj revised this gist
May 17, 2017 . 1 changed file with 11 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,4 +23,14 @@ predict(fit)$class d <- d[1:3, ] predict(fit)$class rm(d) predict(fit)$class # Generalized Additive Models for Location Scale and Shape (gamlss from gamlss package) # searches for original data in global environment when predicting new data d <- datasets::mtcars[1:20,] fit <- gamlss::gamlss(vs ~ hp + wt, data = d, family = gamlss.dist::BI()) gamlss:::predict.gamlss(fit, newdata = d[1:5,]) d <- d[1:10,] gamlss:::predict.gamlss(fit, newdata = d[1:5,]) rm(d) gamlss:::predict.gamlss(fit, newdata = d[1:5,]) -
drsimonj revised this gist
May 3, 2017 . 1 changed file with 10 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,4 +14,13 @@ d <- datasets::airquality fit <- lme4::lmer(Ozone ~ Wind + (Wind | Month), d) nrow(d) length(lme4:::predict.merMod(fit)) length(lme4:::predict.merMod(fit, newdata = d)) ## predict for Linear Discriminant Analysis (lda from MASS package) searches for object in global environment d <- iris[c(1:5, 51:55, 101:105),] fit <- MASS::lda(Species ~ ., d) predict(fit)$class d <- d[1:3, ] predict(fit)$class rm(d) predict(fit)$class -
drsimonj revised this gist
May 3, 2017 . 1 changed file with 8 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,4 +7,11 @@ predict(d) ## predict for Principal Components (prcomp) can't recreate new variables defined in formula fit <- prcomp(~.*., mtcars[1:25, ]) predict(fit, mtcars[26:32,]) ## predict for Linear Mixed Effects Model (lmer from lme4 package) doesn't match when data omitted or included as `newdata` d <- datasets::airquality fit <- lme4::lmer(Ozone ~ Wind + (Wind | Month), d) nrow(d) length(lme4:::predict.merMod(fit)) length(lme4:::predict.merMod(fit, newdata = d)) -
drsimonj revised this gist
May 3, 2017 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,3 +4,7 @@ fit <- aov(hp ~ am * cyl, d) predict(fit) d <- NULL predict(d) ## predict for Principal Components (prcomp) can't recreate new variables defined in formula fit <- prcomp(~.*., mtcars[1:25, ]) predict(fit, mtcars[26:32,]) -
drsimonj renamed this gist
May 3, 2017 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
drsimonj created this gist
May 3, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ ## predict for Analysic of Variance (aov) searches for object in global environment d <- datasets::mtcars fit <- aov(hp ~ am * cyl, d) predict(fit) d <- NULL predict(d)