Coder Social home page Coder Social logo

Comments (10)

DominiqueMakowski avatar DominiqueMakowski commented on July 21, 2024

@mooninnap good question ☺️

Currently, in report, in the case of GLMs, we used "beta" as a synonym for coefficient. This comes from the fact that betas are the symbols traditionally associated with the coefficients (see here for instance) in the mathematical formulas for regressions. "Std. beta" refers to the standardized coefficients as computed by the effectsize package.

However, I am aware that in some textbooks people have used the term "beta" to refer to the standardized coefficient. However, to my knowledge, this is an arbitrary convention which seems statistically rather confusing. I'd be interested to know more about the reasons for that denomination!

That being said, it's true that that beta might not be the optimal name, and I wonder if the APA7 finally came up with some clear guidelines regarding it. In the early stages of this package, we decided not to use "coefficients" as this doesn't apply to all cases (for instance, the beta of the intercept is not, technically, a coefficient).

from report.

chaohanch avatar chaohanch commented on July 21, 2024

@DominiqueMakowski Thank you for your response! I compared the output by standardize_parameters() in the "effectsize" package to the output by report(); I found the standardized coefficients by the "effectsize" package are the same as "beta" but not "std.beta" by report(). That's why I'm confused. Could you explain it a bit more?

Here is the output by standardize_parameters() in the "effectsize" package:

> standardize_parameters(mod.full)
          Parameter Std_Coefficient
1       (Intercept)      0.69407022
2    grammarUnGramm     -1.54836958
3    proficiencymid      0.16824769
4   proficiencyhigh      0.05134071
5 proficiencynative      0.05731125

Here is part of the output by report():

  - The effect of grammarUnGramm is negative and can be considered as very large and significant (beta = -1.55, SE = 0.14, 95% CI [-1.83, -1.27], std. beta = -1.55, p < .001).
  - The effect of proficiencymid is positive and can be considered as tiny and not significant (beta = 0.17, SE = 0.09, 95% CI [0.00, 0.34], std. beta = 0.05, p = 0.051).
  - The effect of proficiencyhigh is positive and can be considered as very small and not significant (beta = 0.05, SE = 0.10, 95% CI [-0.15, 0.25], std. beta = 0.17, p = 0.618).
  - The effect of proficiencynative is positive and can be considered as tiny and not significant (beta = 0.06, SE = 0.08, 95% CI [-0.10, 0.22], std. beta = 0.06, p = 0.480).

from report.

strengejacke avatar strengejacke commented on July 21, 2024

One convention I'm aware of is to refer to unstandardized a "B" (or "b"), and standardized are "Beta".

from report.

DominiqueMakowski avatar DominiqueMakowski commented on July 21, 2024

One convention I'm aware of is to refer to unstandardized a "B" (or "b"), and standardized are "Beta".

I've heard about this one, but that's confusing at best IMO. Unless made very explicit, referring as "something" and "std. something" seems better.*

Here is the output by standardize_parameters() in the "effectsize" package:

Mmh, intriguing, it seems like there might be an alignment issue in when the outputs of parameters and effectsize are merged πŸ˜•

from report.

strengejacke avatar strengejacke commented on July 21, 2024

Mmh, intriguing, it seems like there might be an alignment issue in when the outputs of parameters and effectsize are merged πŸ˜•

I always tend to use an extra row-ID, and always check whether sort should be set to FALSE in merge. We had these alignment issues quite for some time in model_parameters()...

from report.

DominiqueMakowski avatar DominiqueMakowski commented on July 21, 2024

effsize <- effectsize::standardize_parameters(model, method = "refit", robust = FALSE, two_sd = FALSE, centrality = centrality, ...)
effsize <- effsize[order(parameters$Parameter), ]
effsize$Parameter <- NULL
parameters <- cbind(parameters, effsize)

And yet we order by parameter πŸ€” πŸ€”

from report.

strengejacke avatar strengejacke commented on July 21, 2024

well, you retrieve the alphabetical order of parameter names from effsize. However, the order of parameter names is the same for both objects, effsize and parameters. So you actually shuffle the order of effsize, so it no longer matches the correct order.

from report.

strengejacke avatar strengejacke commented on July 21, 2024

Current behaviour:

library(easystats)
#> # Attaching packages
#> <U+2714> insight     0.8.1.1   <U+2714> bayestestR  0.5.2  
#> <U+2714> performance 0.4.4.1   <U+2714> parameters  0.5.0.1
#> <U+2714> see         0.4.0.1   <U+2714> effectsize  0.2.0  
#> <U+2714> modelbased  0.1.1     <U+2714> correlation 0.1.0  
#> <U+2714> report      0.1.0     
#> Warnings or errors in CRAN checks for package(s) 'bayestestR', 'parameters'.

data(iris)
iris$Proficiency <- as.factor(sample(1:4, nrow(iris), replace = TRUE))
levels(iris$Proficiency) <- c("low", "mid", "high", "native")

m <- lm(Sepal.Width ~ Sepal.Length + Proficiency, data= iris)

model_parameters(m)
#> Parameter            | Coefficient |   SE |        95% CI |     t |  df |      p
#> --------------------------------------------------------------------------------
#> (Intercept)          |        3.30 | 0.25 | [ 2.80, 3.80] | 13.02 | 145 | < .001
#> Sepal.Length         |       -0.06 | 0.04 | [-0.15, 0.02] | -1.52 | 145 | 0.130 
#> Proficiency [mid]    |        0.25 | 0.10 | [ 0.06, 0.43] |  2.58 | 145 | 0.011 
#> Proficiency [high]   |        0.19 | 0.10 | [-0.01, 0.38] |  1.89 | 145 | 0.061 
#> Proficiency [native] |        0.13 | 0.10 | [-0.06, 0.32] |  1.35 | 145 | 0.180

standardize_parameters(m)
#>           Parameter Std_Coefficient
#> 1       (Intercept)      -0.3057256
#> 2      Sepal.Length      -0.1233045
#> 3    Proficiencymid       0.5647469
#> 4   Proficiencyhigh       0.4249323
#> 5 Proficiencynative       0.3004431

report(m)
#> We fitted a linear model (estimated using OLS) to predict Sepal.Width with Sepal.Length and Proficiency (formula = Sepal.Width ~ Sepal.Length + Proficiency). Standardized parameters were obtained by fitting the model on a standardized version of the dataset. Effect sizes were labelled following Funder's (2019) recommendations.
#> 
#> The model explains a not significant and weak proportion of variance (R2 = 0.06, F(4, 145) = 2.37, p = 0.055, adj. R2 = 0.04). The model's intercept, corresponding to Sepal.Width = 0, Sepal.Length = 0 and Proficiency = low, is at 3.30 (SE = 0.25, 95% CI [2.80, 3.80], p < .001). Within this model:
#> 
#>   - The effect of Sepal.Length is negative and can be considered as medium and not significant (beta = -0.12, SE = 0.08, 95% CI [-0.28, 0.04], std. beta = 0.42, p = 0.130).
#>   - The effect of Proficiencymid is positive and can be considered as medium and significant (beta = 0.56, SE = 0.22, 95% CI [0.13, 1.00], std. beta = 0.56, p < .05).
#>   - The effect of Proficiencyhigh is positive and can be considered as small and not significant (beta = 0.42, SE = 0.22, 95% CI [-0.02, 0.87], std. beta = 0.30, p = 0.061).
#>   - The effect of Proficiencynative is positive and can be considered as very small and not significant (beta = 0.30, SE = 0.22, 95% CI [-0.14, 0.74], std. beta = -0.12, p = 0.180).

Created on 2020-02-25 by the reprex package (v0.3.0)

from report.

strengejacke avatar strengejacke commented on July 21, 2024

should work now:

library(easystats)
#> # Attaching packages
#> <U+2714> insight     0.8.1.1   <U+2714> bayestestR  0.5.2  
#> <U+2714> performance 0.4.4.1   <U+2714> parameters  0.5.0.1
#> <U+2714> see         0.4.0.1   <U+2714> effectsize  0.2.0  
#> <U+2714> modelbased  0.1.1     <U+2714> correlation 0.1.0  
#> <U+2714> report      0.1.0     
#> Warnings or errors in CRAN checks for package(s) 'bayestestR', 'parameters'.

data(iris)
iris$Proficiency <- as.factor(sample(1:4, nrow(iris), replace = TRUE))
levels(iris$Proficiency) <- c("low", "mid", "high", "native")

m <- lm(Sepal.Width ~ Sepal.Length + Proficiency, data= iris)

model_parameters(m)
#> Parameter            | Coefficient |   SE |        95% CI |     t |  df |      p
#> --------------------------------------------------------------------------------
#> (Intercept)          |        3.23 | 0.25 | [ 2.73, 3.72] | 12.82 | 145 | < .001
#> Sepal.Length         |       -0.05 | 0.04 | [-0.14, 0.03] | -1.32 | 145 | 0.190 
#> Proficiency [mid]    |        0.37 | 0.10 | [ 0.19, 0.56] |  3.92 | 145 | < .001
#> Proficiency [high]   |        0.24 | 0.11 | [ 0.03, 0.45] |  2.23 | 145 | 0.027 
#> Proficiency [native] |        0.13 | 0.08 | [-0.04, 0.30] |  1.54 | 145 | 0.125

standardize_parameters(m)
#>           Parameter Std_Coefficient
#> 1       (Intercept)      -0.3428907
#> 2      Sepal.Length      -0.1035683
#> 3    Proficiencymid       0.8590401
#> 4   Proficiencyhigh       0.5420976
#> 5 Proficiencynative       0.2986141

report(m)
#> We fitted a linear model (estimated using OLS) to predict Sepal.Width with Sepal.Length and Proficiency (formula = Sepal.Width ~ Sepal.Length + Proficiency). Standardized parameters were obtained by fitting the model on a standardized version of the dataset. Effect sizes were labelled following Funder's (2019) recommendations.
#> 
#> The model explains a significant and weak proportion of variance (R2 = 0.11, F(4, 145) = 4.70, p = 0.001, adj. R2 = 0.09). The model's intercept, corresponding to Sepal.Width = 0, Sepal.Length = 0 and Proficiency = low, is at 3.23 (SE = 0.25, 95% CI [2.73, 3.72], p < .001). Within this model:
#> 
#>   - The effect of Sepal.Length is negative and can be considered as very small and not significant (beta = -0.05, SE = 0.04, 95% CI [-0.14, 0.03], std. beta = -0.10, p = 0.190).
#>   - The effect of Proficiencymid is positive and can be considered as large and significant (beta = 0.37, SE = 0.10, 95% CI [0.19, 0.56], std. beta = 0.86, p < .001).
#>   - The effect of Proficiencyhigh is positive and can be considered as medium and significant (beta = 0.24, SE = 0.11, 95% CI [0.03, 0.45], std. beta = 0.54, p < .05).
#>   - The effect of Proficiencynative is positive and can be considered as small and not significant (beta = 0.13, SE = 0.08, 95% CI [-0.04, 0.30], std. beta = 0.30, p = 0.125).

Created on 2020-02-25 by the reprex package (v0.3.0)

from report.

chaohanch avatar chaohanch commented on July 21, 2024

I updated the package but "beta" by report() still matches "std.beta" by standardize_parameters(). Here is what I got:

library(easystats)
# # Attaching packages
# βœ” insight     0.8.1.1   βœ” bayestestR  0.5.2  
# βœ” performance 0.4.4.1   βœ” parameters  0.5.0.1
# βœ” see         0.4.0.1   βœ” effectsize  0.2.0  
# βœ” modelbased  0.1.1     βœ” report      0.1.0  
# Warnings or errors in CRAN checks for package(s) 'bayestestR', 'parameters'.


data(iris)
iris$Proficiency <- as.factor(sample(1:4, nrow(iris), replace = TRUE))
levels(iris$Proficiency) <- c("low", "mid", "high", "native")

m <- lm(Sepal.Width ~ Sepal.Length + Proficiency, data= iris)

model_parameters(m)
# Parameter            | Coefficient |   SE |        95% CI |     t |  df |      p
# --------------------------------------------------------------------------------
#   (Intercept)          |        3.36 | 0.26 | [ 2.84, 3.88] | 12.78 | 145 | < .001
# Sepal.Length         |       -0.06 | 0.04 | [-0.15, 0.02] | -1.43 | 145 | 0.156 
# Proficiency [mid]    |        0.09 | 0.11 | [-0.12, 0.30] |  0.87 | 145 | 0.387 
# Proficiency [high]   |        0.08 | 0.10 | [-0.11, 0.28] |  0.82 | 145 | 0.411 
# Proficiency [native] |        0.07 | 0.10 | [-0.12, 0.26] |  0.76 | 145 | 0.446 

standardize_parameters(m)
# Parameter Std_Coefficient
# 1       (Intercept)      -0.1353245
# 2      Sepal.Length      -0.1174270
# 3    Proficiencymid       0.2091567
# 4   Proficiencyhigh       0.1863652
# 5 Proficiencynative       0.1693196

report(m)
# We fitted a linear model (estimated using OLS) to predict Sepal.Width with Sepal.Length and Proficiency (formula = Sepal.Width ~ Sepal.Length + Proficiency). Standardized parameters were obtained by fitting the model on a standardized version of the dataset. Effect sizes were labelled following Funder's (2019) recommendations.
# 
# The model explains a not significant and weak proportion of variance (R2 = 0.02, F(4, 145) = 0.78, p = 0.543, adj. R2 = -0.01). The model's intercept, corresponding to Sepal.Width = 0, Sepal.Length = 0 and Proficiency = low, is at 3.36 (SE = 0.26, 95% CI [2.84, 3.88], p < .001). Within this model:
#   
#   - The effect of Sepal.Length is negative and can be considered as very small and not significant (beta = -0.12, SE = 0.08, 95% CI [-0.28, 0.05], std. beta = 0.19, p = 0.156).
# - The effect of Proficiencymid is positive and can be considered as small and not significant (beta = 0.21, SE = 0.24, 95% CI [-0.27, 0.69], std. beta = 0.21, p = 0.387).
# - The effect of Proficiencyhigh is positive and can be considered as very small and not significant (beta = 0.19, SE = 0.23, 95% CI [-0.26, 0.63], std. beta = 0.17, p = 0.411).
# - The effect of Proficiencynative is positive and can be considered as very small and not significant (beta = 0.17, SE = 0.22, 95% CI [-0.27, 0.61], std. beta = -0.12, p = 0.446).

from report.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.