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

Having some trouble runnign report with lm #56

Closed
ConnorEsterwood opened this issue Dec 4, 2019 · 15 comments
Closed

Having some trouble runnign report with lm #56

ConnorEsterwood opened this issue Dec 4, 2019 · 15 comments

Comments

@ConnorEsterwood
Copy link

I'm utilizing R studio and trying to run "report" on the following code to summarize the output in plain text.

lm.out <- lm(time ~ year, data=Q2_Data)

report(lm.out)

Utilizing this, I then see the following error:

Error in UseMethod("format_value") : no applicable method for 'format_value' applied to an object of class "NULL"

The data I'm utilizing this for is open source as I am experimenting with this package and I've attached it here for reference.

olympics copy.sav.zip

Let me know if there is something I'm doing wrong here. I'm fairly new to the R world so it could be entirely on my side but I thought if anyone would know it would be you guys :)

@gorkang
Copy link

gorkang commented Dec 17, 2019

The same error appears when running the example shown in the README:

lm(Sepal.Length ~ Petal.Length + Species, data=iris) %>%
  report() %>%
  to_table() 

Error in UseMethod("format_value") :
no applicable method for 'format_value' applied to an object of class "NULL"

@Paul-Yuchao-Dong
Copy link

Same result here running the glm. I was prompted to install effectsize package first. But this problem persisted after restarting R and RStudio.

library(tidyverse)
library(report)

model <- glm(vs ~ mpg + cyl, data = mtcars, family = "binomial") 
report(model)
#> Waiting for profiling to be done...
#> Error in UseMethod("format_value"): no applicable method for 'format_value' applied to an object of class "NULL"

Created on 2020-01-17 by the reprex package (v0.3.0.9001)

@sedufau
Copy link

sedufau commented Jan 30, 2020

Solved it by by installing parameters and loading it (https://github.com/easystats/parameters)
install.packages("parameters")
# easystats libraries
library(parameters)
library(report)

@glennalthor
Copy link

I'm also getting this error, installing parameters didn't help.

My code:

glm1 <- glm(any_vis ~ q2 + q3 + q4 + q5 + q6 + q7,
family="binomial",
data = dat)
summary(glm1)
report(glm1)

Error: Waiting for profiling to be done...
Error in UseMethod("format_value") :
no applicable method for 'format_value' applied to an object of class "NULL"

@glennalthor
Copy link

I was able to resolve this by installing the entire easystats suite.

@Paul-Yuchao-Dong
Copy link

I was able to resolve this by installing the entire easystats suite as well. the sequence I used was to install the suite then install report, and it worked.

@strengejacke
Copy link
Member

Sorry for the inconvenience, but this is simply due to the "project planning" and the order of package development (see, e.g., this presentation: https://github.com/easystats/easystats/blob/master/presentations/ludecke_2019_02_Hamburg_RUG/1902%20Hamburg%20RUG%20easystats.pdf).

We started by developing the low-level packages and then build up our easystats-suite by focussing on packages on the next level and so on. Thus, as some packages are still not fixed in their api and function design etc. is changing, the "higher level" packages like report, which are not yet on CRAN, will probably cause troubles every now and then.

For instance, some functions that used to be in the parameters package, were now re-implemented in the effectsize package. This had a strong impact on report (see #50).

Maybe we can have a more or less stable working version by the mid of this year, but I don't want to promise any deadline here.

@Paul-Yuchao-Dong
Copy link

@strengejacke thank you and your team for this great package. I personally like report the most because it interprets the r outputs into human language, compare and contrast that with the output of summary, it helped one learn stats rather quickly.

Though my programming ability is rather limited, I still like to try to help you to make report work better with the lower level package. Let me take a look at the issue list and contribution guidelines.

@glennalthor
Copy link

No need for apologies, you have done an amazing job with this wonderful series of packages!!! Report in particular is simply amazing.

@DominiqueMakowski
Copy link
Member

the good news is that now the focus will shift back to report as all the other necessary "ingredients" are getting ready and stable 👨‍🍳

Also, I should now finally have some time to fix the existing functionalities of this package in the next few days ☺️

stay tuned and thanks for your support and patience!

@strengejacke
Copy link
Member

Should be fixed now (at current master branch), if you use table_long() or table_short().

library(report)
library(magrittr)
data(iris)

lm(Sepal.Length ~ Petal.Length + Species, data=iris) %>%
  report() %>%
  table_long() 
#> Parameter         | Coefficient |   SE | CI_low | CI_high |     t | df_error |    p | Std_Coefficient |    Fit
#> --------------------------------------------------------------------------------------------------------------
#> (Intercept)       |        1.50 | 0.19 |   1.12 |    1.87 |  7.93 |      146 | 0.00 |            1.50 |       
#> Petal.Length      |        1.93 | 0.14 |   1.66 |    2.20 | 13.96 |      146 | 0.00 |            1.93 |       
#> Speciesversicolor |       -1.93 | 0.23 |  -2.40 |   -1.47 | -8.28 |      146 | 0.00 |           -1.93 |       
#> Speciesvirginica  |       -2.56 | 0.33 |  -3.21 |   -1.90 | -7.74 |      146 | 0.00 |           -2.56 |       
#>                   |             |      |        |         |       |          |      |                 |       
#> AIC               |             |      |        |         |       |          |      |                 | 106.23
#> BIC               |             |      |        |         |       |          |      |                 | 121.29
#> R2                |             |      |        |         |       |          |      |                 |   0.84
#> R2 (adj.)         |             |      |        |         |       |          |      |                 |   0.83
#> RMSE              |             |      |        |         |       |          |      |                 |   0.33

lm(Sepal.Length ~ Petal.Length + Species, data=iris) %>%
  report() %>%
  table_short() 
#> Parameter         | Coefficient | CI_low | CI_high |    p | Std_Coefficient |  Fit
#> ----------------------------------------------------------------------------------
#> (Intercept)       |        1.50 |   1.12 |    1.87 | 0.00 |            1.50 |     
#> Petal.Length      |        1.93 |   1.66 |    2.20 | 0.00 |            1.93 |     
#> Speciesversicolor |       -1.93 |  -2.40 |   -1.47 | 0.00 |           -1.93 |     
#> Speciesvirginica  |       -2.56 |  -3.21 |   -1.90 | 0.00 |           -2.56 |     
#>                   |             |        |         |      |                 |     
#> R2                |             |        |         |      |                 | 0.84
#> R2 (adj.)         |             |        |         |      |                 | 0.83

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

@strengejacke
Copy link
Member

oh, and ofcourse report() only:

lm(Sepal.Length ~ Petal.Length + Species, data=iris) %>%
  report()
#> We fitted a linear model (estimated using OLS) to predict Sepal.Length with Petal.Length and Species (formula = Sepal.Length ~ Petal.Length + Species). 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 substantial proportion of variance (R2 = 0.84, F(3, 146) = 249.40, p < .001, adj. R2 = 0.83). The model's intercept, corresponding to Sepal.Length = 0, Petal.Length = 0 and Species = setosa, is at 3.68 (SE = 0.11, 95% CI [3.47, 3.89], p < .001). Within this model:
#> 
#>   - The effect of Petal.Length is positive and can be considered as very large and significant (beta = 1.93, SE = 0.14, 95% CI [1.66, 2.20], std. beta = 1.93, p < .001).
#>   - The effect of Speciesversicolor is negative and can be considered as very large and significant (beta = -1.93, SE = 0.23, 95% CI [-2.40, -1.47], std. beta = -1.93, p < .001).
#>   - The effect of Speciesvirginica is negative and can be considered as very large and significant (beta = -2.56, SE = 0.33, 95% CI [-3.21, -1.90], std. beta = -2.56, p < .001).

@zen-juen
Copy link

zen-juen commented May 4, 2020

Hi there,
It seems like I'm encountering similar report() issues as were mentioned previously in this issue.

report_participants(df_final, sex="Gender")

#Error in UseMethod("format_value") : 
 no applicable method for 'format_value' applied to an object of class "NULL"

I've tried re-installing report() and with report(iris) but am still encountering the same problems, will appreciate any help I can get! :)

@sielerjm
Copy link

sielerjm commented Jan 26, 2022

I'm also encountering a similar problem. I installed easystats collection after installing report individually. I tried reinstalling report separately, but no luck so far.

The issue appears to be situational. I can run a simple linear model with no problems using report(), but with a glm I get the error (see below). The response variable data is between 0 and 1 (eg. 0.00, 0.102, ... .899, 1.00), and the explanatory variables are categorical. Running a similar linear model, but with a different response variables works fine. I suspect it's something with the GLM() and the response variable data type. I'll continue testing to see if I figure out the root of the issue.

glm( formula = "Alpha.Score ~ Diet",
                      data = subset(dt.alphaPlus.T0.melt, Alpha.Metric == "Observed"),
                      family = "quasibinomial") %>% report::report()
Error in UseMethod("format_value") : 
no applicable method for 'format_value' applied to an object of class "NULL"

Update 1:

Based on @bwiernik comment in #220, I reran the tests and it appears the issue is indeed with "quasibinomial" family (see image).

Screen Shot 2022-01-26 at 13 34 49

@bwiernik
Copy link
Contributor

Please move further discussion to the new issue. This is a different problem

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

No branches or pull requests

10 participants