Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOD_summary improvements #33

Closed
Deleetdk opened this issue Jan 27, 2017 · 1 comment
Closed

MOD_summary improvements #33

Deleetdk opened this issue Jan 27, 2017 · 1 comment
Assignees

Comments

@Deleetdk
Copy link
Owner

Deleetdk commented Jan 27, 2017

Add more useful features to this.

                        Beta   SE CI.lower CI.upper
SIRE: White             0.00   NA       NA       NA
SIRE: African_American  0.27 0.18    -0.08     0.63
SIRE: American_Indian   0.31 0.46    -0.59     1.22
SIRE: Asian             0.30 0.17    -0.03     0.63
SIRE: Hispanic         -0.31 0.09    -0.48    -0.14
SIRE: Multi_ethnic      0.08 0.11    -0.13     0.29
SIRE: No data          -0.12 0.42    -0.94     0.70
SIRE: Other             0.17 0.25    -0.33     0.67
SIRE: Pacific_Islander -0.45 0.27    -0.97     0.07
European                0.15 0.06     0.04     0.26
African                -0.33 0.05    -0.44    -0.23

[[1]]$meta
            N            R2       R2 adj. R2 10-fold cv 
      1369.00          0.17          0.16          0.15 

Meta should give the outcome variable.

So we can remember what it is. If meta is a numeric vector, need to change it to a data frame. Might break some code.

Attach lm model object

The original lm fit should be attached. This also attaches the data.

Eta

Etas should be calculated so as to better summarize the categorical variables. Etas are redundant when models have no categorical variables, but for consistent output, should have a parameter that forces them to always be included.

An alternative is to add a class and change the print function to only print eta when model has categorical variables. Seems more fancy.

@Deleetdk Deleetdk self-assigned this Jan 27, 2017
@Deleetdk
Copy link
Owner Author

All three are now added.

> #fit two models with iris data, one with normal and one with standardized data
> fit1 = lm("Sepal.Length ~ Sepal.Width + Petal.Length", iris)
> fit2 = lm("Sepal.Length ~ Sepal.Width + Petal.Length", iris %>% df_standardize())
Skipped Species because it is a factor.
> #then summarize the two models
> MOD_summary(fit1, standardize = F) #unstd. data, don't std. betas
  |============================================================================================================================| 100%
Model coefficients
             Beta    SE CI.lower CI.upper
Sepal.Width  0.60 0.069     0.46     0.73
Petal.Length 0.47 0.017     0.44     0.51


Model meta-data
       outcome   N   R2 R2-adj. R2-cv
1 Sepal.Length 150 0.84    0.84  0.82


Etas from analysis of variance
              eta eta.part
Sepal.Width  0.28     0.58
Petal.Length 0.91     0.92
> MOD_summary(fit1, standardize = T) #unstd. data, then std. betas
  |============================================================================================================================| 100%
Model coefficients
             Beta    SE CI.lower CI.upper
Sepal.Width  0.31 0.036     0.24     0.39
Petal.Length 1.01 0.036     0.93     1.08


Model meta-data
       outcome   N   R2 R2-adj. R2-cv
1 Sepal.Length 150 0.84    0.84  0.82


Etas from analysis of variance
              eta eta.part
Sepal.Width  0.28     0.58
Petal.Length 0.91     0.92

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant