Code Monkey home page Code Monkey logo

sjplot's Introduction

sjPlot - Data Visualization for Statistics in Social Science

CRAN_Status_Badge

Collection of plotting and table output functions for data visualization. Results of various statistical analyses (that are commonly used in social sciences) can be visualized using this package, including simple and cross tabulated frequencies, histograms, box plots, (generalized) linear models, mixed effects models, PCA and correlation matrices, cluster analyses, scatter plots, Likert scales, effects plots of interaction terms in regression models, constructing index or score variables and much more.

Installation

Latest development build

To install the latest development snapshot (see latest changes below), type the following commands into the R console:

library(devtools)
devtools::install_github("strengejacke/sjPlot")

Official, stable release

To install the latest stable release from CRAN, type the following command into the R console:

install.packages("sjPlot")

Documentation and examples

Please visit https://strengejacke.github.io/sjPlot/ for documentation and vignettes.

Citation

In case you want / have to cite my package, please use citation('sjPlot') for citation information. Since core functionality of package depends on the ggplot-package, consider citing this package as well.

DOI

sjplot's People

Contributors

adamryczkowski avatar amirdjv avatar borghenry avatar cbehning avatar cschwem2er avatar douglaswhitaker avatar fragla avatar franciscowilhelm avatar iago-pssjd avatar ibecav avatar januz avatar johannes-titz avatar justintimm avatar jvparidon avatar mkshaw avatar ndevln avatar sjplot avatar strengejacke avatar tappek avatar the-mad-statter avatar vkehayas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sjplot's Issues

sjt.frq outputs items in wrong order

Example:

testdata <- structure(c(7L, 8L, 8L, 7L, 7L, 7L, 8L, 7L, 7L, 7L, 7L, 8L, 7L, 
                        7L, 7L, 7L, 7L, 9L, 7L, 8L, 8L, 8L, 7L, 7L, 7L, 7L, 7L, 8L, NA, 
                        8L, 8L, 4L, 8L, 7L, 8L, 7L, 8L, 7L, 8L, 7L, 7L, 7L, 7L, 8L, 6L, 
                        8L, 7L, 7L, 8L, 7L, 7L, 7L, 8L, 8L, 7L, NA, 7L, 7L, 7L, 7L, 7L, 
                        7L, 7L, 7L, 8L, 7L, 7L, 7L, 8L, 7L, 8L, 7L, 6L, 7L, 7L, 7L, 8L, 
                        8L, 7L, 8L, 8L, 4L, 8L, 7L, 8L, 8L, 8L, 8L, 7L, 7L, 7L, 8L, 8L, 
                        8L, 9L, 8L, 8L, 8L, 7L, 7L, 4L, 8L, 8L, 4L, 5L, 7L, 8L, 4L, 6L, 
                        7L, 6L, 4L, 4L, 6L, 4L, 7L, 7L, 7L, 8L, 8L, 4L, 4L, 4L, 4L, 4L, 
                        4L, 8L, 4L, 4L, 7L, 7L, 7L, 4L, 7L, 7L, NA, 4L, 8L, 4L, 4L, 8L, 
                        4L, 8L, 4L, 8L, 7L, 7L, 8L, 6L, 8L, 4L, 8L, 8L, 7L, 8L, 7L, 8L, 
                        8L, 8L, 8L, 4L, 8L, 6L, 6L, 4L, 7L, 8L, 7L, 8L, 7L, 7L, 4L, 8L, 
                        3L, 6L, 6L, 8L, 7L, 7L, 4L, 3L, 6L, 4L, 6L, 4L, 7L, NA, 8L, 4L, 
                        4L, 8L, 6L, 8L, 8L, 7L, 8L), .Label = c("Noch Schüler", "Schule beendet ohne Abschluss", 
                                                                "Hauptschulabschluss/Volksschulabschluss", "Realschulabschluss (Mittlere Reife)", 
                                                                "Abschluss Polytechnische Oberschule 10. Klasse (vor 1965: 8. Klasse)", 
                                                                "Fachhochschulreife (Abschluss einer Fachoberschule)", "Abitur, allgemeine oder fachgebundene Hochschulreife (Gymnasium bzw. EOS)", 
                                                                "Hochschulabschluss", "Anderer Schulabschluss:"), class = "factor")

sjt.frq(testdata)

prints:

yet

table(testdata)

shows the above table is wrong:

                                                         Noch Schüler 
                                                                    0 
                                        Schule beendet ohne Abschluss 
                                                                    0 
                              Hauptschulabschluss/Volksschulabschluss 
                                                                    2 
                                  Realschulabschluss (Mittlere Reife) 
                                                                   31 
 Abschluss Polytechnische Oberschule 10. Klasse (vor 1965: 8. Klasse) 
                                                                    1 
                  Fachhochschulreife (Abschluss einer Fachoberschule) 
                                                                   13 
Abitur, allgemeine oder fachgebundene Hochschulreife (Gymnasium bzw. EOS) 
                                                                   77 
                                                   Hochschulabschluss 
                                                                   66 
                                              Anderer Schulabschluss: 
                                                                    2 

Any hints what causes this?

sjp.int(type = "emm") fails with mixed models

"emm" with lmer fails for me, if I use lmerTest I get

Error in summary(fit)$coefficients[-1, 4] : subscript out of bounds

and with plain lme4

Error in colnames<-(tmp, value = c("x", "y", "grp", "l.ci", "u.ci", :
'names' attribute [6] must be the same length as the vector [5]

Non-incremental levels and labels

Variables in my dataset do not have incremental levels (e.g. 1, 2, 5, 15, 20, 35, 99) therefore, I have problems with obtaining the right result in sjt.* functions.

Please find example code for clarification below

library(sjPlot)

### example data
example_data <- data.frame(labelled(
  c(10,20,30,10,20,30,10,99,30,20),
  c('c'=10,'b'=20,'a'=30,'NA'=99)))

names(example_data) <- 'V1'

## incorrect result (only first group is visible)
sjt.frq(example_data$V1) 

## correct results (however without labels)
sjt.frq(as.numeric(example_data$V1)) 

Error in `view_spss`、`sjt.*` with multibyte var/val labels

sample file:
https://drive.google.com/open?id=0B8FLxb6Zof5udUNnSTY4NXZvN2c&authuser=0

raw.data3 <- read_spss(
  "multibyte_char_data.sav",
  enc = "UTF-8", 
  autoAttachVarLabels = T, 
  option = "foreign")

view_spss(raw.data3, encoding = "UTF-8")

1

2

Session info ---------------------------------------------------
  setting  value                       
  version  R version 3.1.3 (2015-03-09)
  system   i386, mingw32               
  ui       RStudio (0.99.380)          
  language (EN)                        
  collate  Chinese_Taiwan.950          
  tz       Asia/Taipei  

sjp.int plot with continuous moderator

Hi, I am trying to make an interaction plot for a logit model (binary dependent variable) where both independent and moderating variable are continuous. I use meansd to get three curves for moderation. However, I keep getting the following error message:

Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels
In addition: Warning messages:
1: In mean.default(X[, name]) :
argument is not numeric or logical: returning NA
2: In mean.default(X[, name]) :
argument is not numeric or logical: returning NA

Tried to google, but still not found a proper solution. (Still rooky with R).

Any inputs? Thanks.

Error in sjp.glmer(), type ="ri.pc"

I have a model with the following formula:

model_LH<- glmer(Tipo ~ Co.2.Pr + Education + Negation + Pr.2.Pr + Typical.Action.Chain.Pos + Style*Tense +(1 + Co.2.Pr | Muestra)+ (1 + Negation | Muestra) +(1 + Typical.Action.Chain.Pos| Muestra)+ (1 | Nombrelema), data=datalh, family="binomial", control=glmerControl(optimizer="bobyqa"))

When I run
sjp.glmer(model_LH, type = "ri.pc", show.se = TRUE)

I get the following error:
Error in $<-.data.frame(*tmp*, "xbeta", value = numeric(0)) :
replacement has 0 rows, data has 2093

make sjt.int recognise I() in formulas

Really love the sjt.int() function. One suggestion I have is for sjt.int() to recognise I() in a formula.

[example is from Hayes (2013) great book about moderation (and mediation)]

h31<- lm(liking ~ protest + sexism + protest*sexism,    data=protest) 
h32<- lm(liking ~ protest + sexism + I(protest*sexism), data=protest)

sjp.int(h31) # works
sjp.int(h32) # does not work

I am using the latest version from github as of today

Package 'lme4' needed for this function to work

my model with lmer function

model_2 = lmer (systolic_BP ~ time2 + (1 + time2 | ID), REML = FALSE, data = subset_data)
summary (model_2)

I recieve the following error although "lme4" is installed and running

sjp.lmer(model_2)
Error: Package 'lme4' needed for this function to work. Please install it.

Maximum Variable Label Length on write_spss()

Hi,

When I use the write_spss function with variable.label attributes, the labels appear to export properly into the .sav, however they are cut off after 120 characters. I believe 120 characters was the limit in previous versions of SPSS, but I was wondering if there was a way to change this limit. The labels I need are somewhat lengthy survey questions, so it's important the text isn't cut off after 120 characters, and I've had trouble finding help for this issue elsewhere.

Thanks for the great package.

Actual p-values?

Hi,
Would it be possible to pull-out the actual p-value from the lm/glm result? So, when p <0.001, not <0.001, but for instance p = 0.00045637, or p = 4.56e-5?

Would be great. Or is this already possible?

Thanks!

Sander

(g)lmer related functions reporting lme4 not installed when it is installed

R version 3.2, latest sjPlot (1.8) from the repository. Following your example use of sjp.glmer(), it reports that lme4 is not installed, although lme4 is both installed and functioning:

# fit model
library(lme4)
Loading required package: Matrix
Loading required package: Rcpp
# for "dicho" function etc.
library(sjmisc)
# create binary response
sleepstudy$Reaction.dicho <- dicho(sleepstudy$Reaction, dichBy = "md")
# fit model
fit <- glmer(Reaction.dicho ~ Days + (Days | Subject),
             sleepstudy,
             family = binomial("logit"))
sjp.glmer(fit)
Error: Package 'lme4' needed for this function to work. Please install it.

cannot find function "read_spss" in the latest development snapshot

I installed the latest development snapshot.
library(devtools)
devtools::install_github("sjPlot/devel")

And then trying to load a dataset by read_spss. I got this error:
Error: could not find function "read_spss"

But ?read_spss works well.

If I reinstall the package using install.packages("sjPlot"). Everything looks fine.

Bug in sjp.frq for leading zeros

If the count of the first bar of a frequency plot is 0, wrong values are assigned to the plots.
Two reproducible examples with different results, depending on how the level order is assigned.

mydf <- data.frame(Q=c(rep("No", 5), rep("Maybe", 3)))
levels(mydf[,1]) <- c("Yes", "No", "Maybe")
sjp.frq(mydf[,1], axisLimits.y=c(0,7))

bugreport

mydf <- data.frame(Q=c(rep("No", 5), rep("Maybe", 3)))
mydf[,1] <- ordered(mydf[,1], levels=c("Yes", "No", "Maybe"))
sjp.frq(mydf[,1], axisLimits.y=c(0,7))

bugreport2

error in sjp.likert for n x 1 data frames

sjp.likert(df) returns an error if ncol(df)=1.

library(sjPlot)
set.seed(77)
df <- data.frame(Q1=factor(sample(1:4, 100, replace=TRUE)), Q2=factor(sample(1:4, 100, replace=TRUE)))
sjp.likert(df) # works fine!
sjp.likert(df[, 1, drop=FALSE]) # gives an error!

Feature request: sjt.corr: upper and lower matrix with different correlation coefficients

Would be nice if sjt.corr could display different correlation coefficients in the upper and lower triangle of the matrix. I think it is quite common to display Pearson and Spearman correlation coefficients and to do this in one matrix.

lower.tri(x, diag = FALSE) and upper.tri(x, diag = FALSE) might come in handy as mentioned here:
http://www.sthda.com/english/wiki/elegant-correlation-table-using-xtable-r-package

axisLimits.x parameter

Would it be possible to have axisLimits.x parameter in the sjp.int plot (and other plots as well)?

error in sjp.likert when data frame does not contain all possible values of likert scale

Hello Daniel,

I'm using sjp.likert function from de 'sjPlot' package, to make a series of plots of different dataframes in which their columns correspond to different questions that follow a likert format.

The exact dataframe is reproduced below:

col_1 <- c(2,1,1,5)
col_2 <- c(2,1,1,2)
col_3 <- c(2,1,1,2)
col_4 <- c(2,1,1,2)
col_5 <- c(2,1,1,5)

df <- as.data.frame(cbind(col_1,col_2,col_3,col_4,col_5))

Following the instructions of the 'sjPlot' package, I gave labels to the questions as well as to the possible answers(value labels).

question.labels <- c("Las personas de mi Equipo están calificadas adecuadamente para desempeñar su trabajo", "Mi equipo es eficiente para solucionar problemas sin perder tiempo en encontrar culpables", "Mi área busca formas de hacer los procesos de manera inteligente y eficiente", "El ambiente en mi área es generalmente bueno", "En mi Equipo tenemos una dinámica de trabajo que permite nuestro mejor desempeño")

value.labels <- c("strongly agree", "agree", "disagree", "strongly disagree", "neither agree or disagree")

Then I use the sjp.likert function to produce the plot:

sjp.likert(bbdd_mod[, lik.f2],cat.neutral = 5, axisLabels.y = items[lik.f2-7], legendLabels = labels, value.labels = "sum.outside", gridRange = 1.4)

But I get the following error:

Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 5, 3

While with the following dataframe there is no problem:

col_a <- c(2,3,1,2,2,1)
col_b <- c(2,4,2,5,2,2)
col_c <- c(2,3,2,2,2,2)
col_d <- c(2,2,1,2,2,1)
col_e <- c(3,5,1,2,2,1)

df2 <- cbind(col_a,col_b,col_c,col_d,col_e)

In df2 all the possible values are present, from 1 to 5, that is the only difference with df, in which only 1,2 and 5 are possible values. Hence I thought this could explain the error, that there are 3 possible values in the data frame while the value.labels contain 5 distinct options. But even when I take out the argument legendLabels from the function (so there is no incongruency between the actual values and all the possible labels) I still get the same error when trying to plot df.

Is there a way to solve this?

Thanks in advance

Support for survey-objects

Quick example

library(survey)
data(api)
dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)

fit1<-svyglm(sch.wide~ell+meals+mobility, design=dstrat,family = binomial(link = "logit"))
fit2<-svyglm(sch.wide~ell+meals*mobility, design=dstrat,family = binomial(link = "logit"))

sjt.glm(fit1, fit2)

possible bug in sjt.itemanalysis

Please consider the following:

> P.min <- P[1:10,1:10]
> P.min
   6036 6053 6054 6037 6055 6056 6057 6058 6059 6060
1     1    1    1    1    1    1    1    1    1    1
2     0    1    1    1    1    1    1    1    0    1
3     1    0    1    1    1    1    1    1    1    1
4     0    1    1    0    1    0    0    1    1    1
5     1    1    1    1    1    1    1    1    1    1
6     0    1    1    1    1    1    1    1    1    1
7     0    0    1    0    0    1    1    1    1    1
8     1    1    1    0    1    1    1    1    1    1
9     1    1    1    1    0    0    1    1    1    1
10    1    0    0    1    0    1    0    0    1    0

The result is

  |======================================================================| 100%
Error in gsub("      <", "<", html.table, fixed = TRUE) : 
  object 'toWrite' not found

I have attempted the same with larger tables. P.min is an arbitrary subset of a larger table (36 columns, 2466 rows).

Any clues?

Much appreciated,

  • roffe

add option `type = "predresp"` to sjp.lm(er)

To plot each single predictor of fitted model against predicted values of the outcome. May be used to check for polynomial terms, whether they fit well or not. Loess-smoothing possible, but probably no CI.

sjp.lmer new option

It might be useful to add an option to plot the sum of fixed effect and random effect. In other words, it would allow the random effect to be plotted around the fixed effect instead of just zero.

calculation of fitted values in sjp.int()

Could you check if sjp.int( , moderatorValue="minmax") calculates correctly?
Just checked the plots with the dataset in Hayes (2013), p. 232 [dataset protest is available at http://afhayes.com/introduction-to-mediation-moderation-and-conditional-process-analysis.html], however, I think you can follow without this specific dataset.
I have:

head(protest)
Source: local data frame [6 x 4]

sexism liking respappr protest
1 4.87 4.83 4.25 1
2 4.25 4.50 5.75 0
3 5.00 5.50 4.75 1
4 5.50 5.66 7.00 1
5 5.62 6.16 6.75 1
6 5.75 6.00 5.50 1

h3 <- lm(liking ~ protest + sexism + protest:sexism, data=protest)
h3
Call:
lm(formula = liking ~ protest + sexism + protest:sexism, data = protest)

Coefficients:
(Intercept) protest sexism protest:sexism
7.7062 -3.7727 -0.4725 0.8336

this should replicate the minmax calculation of sjp.int()

pro2 <- c(0,1,0,1)
sex2 <- c(rep(min(protest$sex), 2), rep(max(protest$sexism), 2))
df2 <- data.frame(protest=pro2, sexism=sex2)
df2 <- cbind(df2, pred = predict(h3, df2))

df2
protest sexism pred
1 0 2.87 6.350185
2 1 2.87 4.969828
3 0 7.00 4.398798
4 1 7.00 6.461013

compare the predicted (fitted) values to sjp.int's plot; sjp.int's maximum values seem to be off. The lines should cross each other at a value of sexim (moderator) of slightly above 4.5

sjp.int(h3, moderatorValue="minmax", showValueLabels = TRUE)

rplot

cells go up a line if the cell above is empty (view_spss)

When I used view_spss to create a variable list,
I saw that those items with 0 respondents won't shows "0" in freq and %; the empty cells were replaced by latter frequencies. In my case,
pic1

the 5th and 6th items have 0 responses, but the two cells that are supposed to 0 were replaced by later figures. Please advice. Thank you!

sessionInfo()
R version 3.1.3 (2015-03-09)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.3 (Yosemite)

`emm`

I get the following error message with type='emm':

library(lme4); library(lmerTest); library(effects); library(sjPlot)
lme4::lmer(`Short term attractiveness` ~ Cue * gFaktor_Mann  +  (1|ID_Frau), data = comb) -> m1
sjp.int(fit = m1, plevel = 1,type ="emm")

Computing approximate p-values via Wald chi-squared test...
Error in colnames<-(*tmp*, value = c("x", "y", "grp", "l.ci", "u.ci", :
'names' attribute [6] must be the same length as the vector [5]

Error when using sjp.lmer

Thank you very much for your work, this is useful.

I am trying to use sjp.glmer from the version I just installed from github. I tried your example from: http://www.r-bloggers.com/visualizing-generalized-linear-mixed-effects-models-with-ggplot-rstats-lme4/

library(sjPlot)
library(lme4)
fit <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)

simple plot

sjp.lmer(fit)

This gives me the following error:

sjp.lmer(fit)
Error in array(NA, c(J, K)) : 'dims' cannot be of length 0

Please could you advise if there is a way I could use the function?

Thank you very much
Dominik

sjp.lmer(type = 'fe.std') : object 'fit' not found and other errors

I've fitted a series of models and am looking to use your very useful package to create some diagnostic plots (thanks for writing, maintaining and updating by the way).

One of my returned models is stored in t$itt and I can plot the fixed effects without any problem, but trying to plot the standardised version of the fixed effects results in the error 'object 'fit' not found'...

sjp.lmer(t$itt, type = 'fe')
sjp.lmer(t$itt, type = 'fe.std')
Error in lme4::fixef(fit) : object 'fit' not found

Also trying to plot type = 'fe.prob' I get the following error...

sjp.lmer(t$itt, type = "fe.prob")
Error in $<-.data.frame(*tmp*, "x", value = c(2L, 1L)) :
replacement has 2 rows, data has 0

A minimal reproducible example of both of these errors can be done using the examples you kindly provide on your web-page (http://www.strengejacke.de/sjPlot/sjp.lmer/)...

data(efc)
efc$grp = as.factor(efc$e15relat)
levels(x = efc$grp) <- sji.getValueLabels(efc$e15relat)
mydf <- na.omit(data.frame(neg_c_7 = as.numeric(efc$neg_c_7),
sex = as.factor(efc$c161sex),
c12hour = as.numeric(efc$c12hour),
barthel = as.numeric(efc$barthtot),
grp = efc$grp))
mydf <- na.omit(data.frame(neg_c_7 = as.numeric(efc$neg_c_7),
sex = as.factor(efc$c161sex),
c12hour = as.numeric(efc$c12hour),
barthel = as.numeric(efc$barthtot),
grp = efc$grp))
fit2 <- lmer(neg_c_7 ~ sex + c12hour + barthel + (1|grp),
data = mydf)
sjp.lmer(fit2, type = "fe")
sjp.lmer(fit2, type = "fe.std")
Error in lme4::fixef(fit) : object 'fit' not found
sjp.lmer(fit2, type = "fe.prob")
Error in $<-.data.frame(*tmp*, "x", value = c(2L, 1L)) :
replacement has 2 rows, data has 0

I'm using the most recent update of sjPlot_1.6.8 as my sessionInfo() shows...

sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] C
attached base packages:
[1] datasets grid grDevices splines graphics utils stats
[8] methods base
other attached packages:
[1] texreg_1.34 sjPlot_1.6.8 ResourceSelection_0.2-4
[4] lme4_1.1-7 Rcpp_0.11.4 Matrix_1.1-5
[7] gridExtra_0.9.1 XML_3.98-1.1 shiny_0.11
[10] RSQLite_1.0.0 DBI_0.3.1 rms_4.2-1
[13] SparseM_1.6 reshape2_1.4.1 dplyr_0.4.1
[16] lubridate_1.3.3 knitr_1.9 Hmisc_3.14-6
[19] Formula_1.2-0 lattice_0.20-29 ggplot2_1.0.0
[22] epicalc_2.15.1.0 nnet_7.3-8 MASS_7.3-37
[25] survival_2.37-7 foreign_0.8-62
loaded via a namespace (and not attached):
[1] R6_2.0.1 RColorBrewer_1.1-2 RJSONIO_1.3-0
[4] TH.data_1.0-6 abind_1.4-0 acepack_1.3-3.3
[7] arm_1.7-07 assertthat_0.1 car_2.0-24
[10] cluster_2.0.1 coda_0.16-1 colorspace_1.2-4
[13] compiler_3.1.2 digest_0.6.8 evaluate_0.5.5
[16] formatR_1.0 gtable_0.1.2 htmltools_0.2.6
[19] httpuv_1.3.2 labeling_0.3 latticeExtra_0.6-26
[22] magrittr_1.5 memoise_0.2.1 mgcv_1.8-4
[25] mime_0.2 minqa_1.2.4 mnormt_1.5-1
[28] multcomp_1.3-8 munsell_0.4.2 mvtnorm_1.0-2
[31] nlme_3.1-119 nloptr_1.0.4 parallel_3.1.2
[34] pbkrtest_0.4-2 plyr_1.8.1 polspline_1.1.9
[37] proto_0.3-10 psych_1.5.1 quantreg_5.11
[40] rpart_4.1-8 sandwich_2.3-2 scales_0.2.4
[43] stringr_0.6.2 tools_3.1.2 xtable_1.7-4
[46] zoo_1.7-11

return plot-object as well for sjp.(g)lm when type = "vif"

According to the documentation, the return value of sjp.glm is a 'structure' with the ggplot object in the plot 'element'.

This is not true when the type is set to 'vif'. But the resulting ggplot object should be returned here as well.

what do plevel and showCI do for sjp.int with mixed models?

This was unclear to me from the docs and from the way the function behaves:
plevel does not make sense, if you permit only lme4::lmer (which does not give _p_s) and
showCI does not seem to do anything. I can share some code that I use for simple and bootstrapped CIs on predictions, if you're interested.

That concludes it, sorry for the many issues filed, really like the package, but these issues made for a discouraging experience for the student that I recommended the package to (not yet at the level to debug this sort of stuff).

documentation of 'vif' in sjp.glm

The documentation of sjp.glm says

        • ‘"vif"’ to plot Variance Inflation Factors. See details.

But there is no 'details' section.

make sjt.int/sjt.lm/sjp.lm recognise plm's within (and random) estimator

Just read that plm support has been added to sjt.int, great! It works for pooled OLS (pooling), but it does not seem to work for fixed effects ("within") nor random effects ("random").

pooled <- plm(y ~ a + b + a:b, data=pdat, model="pooling")
fe <- plm(y ~ a + b + a:b, data=pdat, model="within")
re <- plm(y ~ a + b + a:b, data=pdat, model="random")

sjp.int(pooled, plevel = 0.9) # works
sjp.int(fe, plevel = 0.9) # Error: Predictors of interaction terms (main effects) must be included as single term as well. See Note in ?sjp.int 

[same for re]

Let me know if you need further input.

Extract a data frame from table functions of sjPlot

Good morning, First all, thank for your great package.

Is it possible to extract the output of a sjPlot table function in a data.frame, for example:

library(sjmisc)
data(efc)
a<- sjt.frq(efc$e42dep)

Something like that

b<- sj-data.frame(a)

What can I do for solve the above issule?

Thank you in advance
José F. Zea

crossed random effects break type="eff"

It seems that the effects package somehow hangs, when there are two random effects. sjPlot is indirectly affected by this, and I didn't quickly find out where to lodge bugs for effects.

Add native knitr print methods

Hi.

Now use this package with knitr is not comfortable. There is native knitr print method described in the vignette: vignette('knit_print', package = 'knitr').

It would be nice if you'll realize this.

probemod package

You might want to have a look at the probemod package for printing (and calculation) of (among other) the Jason Neyman method for significant parts of the interaction. Plot is not as pretty as sjt.int's, though.

'by' argument much too small

When feeding my logistic regression model into sjp.glm I see this:

> sjp.glm(model.logreg)
Waiting for profiling to be done...
Error in seq.default(lower_lim, upper_lim, by = gridBreaksAt) : 
  'by' argument is much too small

I tried to pass several values for gridBreaksAt from 0.01 to 100000000 to no avail.

The example from the help works fine.

sjt.corr not showing p values for cor objects

Seems like sjt.corr does not display p values (nor indicates significance by asteriks) when a cor object is passed. It works with a data.frame passed. I am using version 1.8 from CRAN.

df <- as.data.frame(cbind(rnorm(10),
                          rnorm(10),
                          rnorm(10),
                          rnorm(10),
                          rnorm(10)))

# significance is indicated
sjt.corr(df) 

cor_object <- cor(df)

# significance neither indicated nor p values printed
sjt.corr(cor_object)
sjt.corr(cor_object,
         showPValues = TRUE) 

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.