R2: R2

Description Usage Arguments Value Examples

View source: R/r-squer.R

Description

Berechnung der R-Quadrats Achtung es gibt noch die Funktion caret::R2 die Probleme macht

Cox und Snell R2: [ 0.2 = akzeptabel, 0.4 = gut ] Nagelkerke R2: [ 0.2 = akzeptabel, 0.4 = gut, 0.5 = sehr gut] McFaddens R2: [ 0.2 = akzeptabel, 0.4 = gut ] (see pscl::pR2)

Marginal and conditional r-squared for lme objects

For mixed-effects models, R2 can be categorized into two types. Marginal R2 represents the variance explained by fixed factors

Conditional R2is interpreted as variance explained by both fixed and random factors (i.e. the entire model).

MuMIn::r.squaredGLMM(x, ...) Pseudo-R-squared for Generalized Mixed-Effect models

For mixed-effects models, R² comes in two types: marginal and conditional.

Marginal R² represents the variance explained by the fixed effects.

Conditional R² is interpreted as a variance explained by the entire model, including both fixed and random effects.

for R2.lme an lme model (usually fit using lme This method extracts the variance for fixed and random effects, as well as residuals, and calls rsquared.glmm

Marginal and conditional r-squared for merMod objects

This method extracts the variance for fixed and random effects, residuals, and the fixed effects for the null model (in the case of Poisson family), and calls rsquared.glmm

an merMod model (usually fit using lme4::lmer, lme4::glmer,lmerTest::lmer, blme::blmer, blme::bglmer, etc)

Marginal and conditional r-squared for glmm given fixed and random variances

This function is based on Nakagawa and Schielzeth (2013). It returns the marginal and conditional r-squared, as well as the AIC for each glmm. Users should call the higher-level generic "r.squared", or implement a method for the corresponding class to get varF, varRand and the family from the specific object

return A data frame with "Class", "Family", "Marginal", "Conditional", and "AIC" columns

glm:

McFadden: McFadden's pseudo r-squared

r2ML: Cox & Snell, Maximum likelihood pseudo r-squared

r2CU: Nagelkerke Cragg and Uhler's pseudo r-squared

R2: The RMSE is the square root of the variance of the residuals. Compute the root mean squared error (see sigma)

sigma: Residual standard error RMSE: Root Mean Square Error RMSE.lmerModLmerTest sjstats::rmse(x)

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
R2(x, ...)

## S3 method for class 'lm'
R2(x, ...)

## S3 method for class 'glm'
R2(x, ...)

## S3 method for class 'polr'
R2(x, ...)

## S3 method for class 'mlm'
R2(x, ...)

## S3 method for class 'merMod'
R2(x, ...)

## S3 method for class 'lme'
R2(x, ...)

RMSE(x, ...)

## Default S3 method:
RMSE(x, ...)

## S3 method for class 'mlm'
RMSE(x, ...)

## S3 method for class 'lmerModLmerTest'
RMSE(x, ...)

## S3 method for class 'lmerMod'
RMSE(x, ...)

Arguments

x

fit-Objekt lm glm

...

weitere Objekte nicht benutzt

varF

fot glmm Variance of fixed effects

varRand

fot glmm Variance of random effects

varResid

fot glmm Residual variance. Only necessary for "gaussian" family

family

fot glmm family of the glmm (currently works with gaussian, binomial and poisson)

link

fot glmm model link function. Working links are: gaussian: "identity" (default); binomial: "logit" (default), "probit"; poisson: "log" (default), "sqrt"

mdl.aic

fot glmm The model's AIC

mdl.class

fot glmm The name of the model's class

null.fixef

fot glmm Numeric vector containing the fixed effects of the null model. Only necessary for "poisson" family

Value

ein dataframe-Objekt.

Examples

1
2
3
4
5
6
7
fit1<-lm(chol1~chol0, hyper)
summary(fit1)$r.squared
R2(fit1)



require(nlme)

stp4/stp25stat documentation built on Sept. 17, 2021, 2:03 p.m.