Coder Social home page Coder Social logo

cougarstats's Introduction

CougarStats: An R Shiny App for Statistical Data Analysis

Overview

rank

CougarStats is an open-source platform-independent browser-based interface for statistical data analysis.

You can use the app on our website: https://www.cougarstats.ca/

or using our backup on Shinyapp.io server by clicking https://cougarstats.shinyapps.io/CougarStats/


Alternatively you can send a pull request to download all the files in this repository and run the app by loading global.R, ui.R, and server.R and clicking Run App. Note that the CougarStats project is not on CRAN, just on github.


CougarStats has also been Dockerized. You can pull the Docker image here by running:

docker pull mmyer/cougarstats:latest

then start the container:

docker run -dp 127.0.0.1:3838:3838 mmyer/cougarstats

and navigate to 127.0.0.1:3838 using a browser of your choice to access a copy of CougarStats running locally on your machine.

More information on Docker can be found here.


Key features

  • Calculate the descriptive statistics (ex. mean, median, mode, quartiles, IQR, standard deviation, check for potential outliers etc.)
  • Construct a Boxplot, Histogram, Stem and Leaf plot, and Scatterplot
  • Calculate the marginal, joint, union, and conditional probabilities for a contingency table
  • Calculate exact and cumulative probabilities for Binomial and Poisson distributions
  • Calculate cumulative probability for Normal distribution
  • Sample size estimation
  • Confidence interval and Hypothesis test for
    • one population mean
    • difference between two population means (independent samples)
    • population mean difference of paired populations (dependent samples)
    • one population proportion
    • difference between two population proportions
  • One-Way Analysis of Variance (ANOVA)
  • Chi-Square test of independence
  • Simple Linear Regression and Pearson Correlation Coefficient

Who is CougarStats for?

  • Students enrolled in an introductory statistics class
  • Instructors wanting to use an open-source tool in their labs

Shiny app authors

Acknowledgement: In Fall 2022 an earlier version of this interactive R Shiny app was presented as Crystal Wai's COMP 5690: Senior Computer Science Project. From June - August 2023 this project was funded by a student research grant (awarded to Michael Myer) conferred by the Faculty of Science and Technology at Mount Royal University. Starting September 2023 this project is funded by a Provost's Teaching-Learning Enhancement Grant (TLEG). Michael Myer is currently hired as a Project Assistant through this grant.

cougarstats's People

Contributors

m-myer avatar ashokkrish avatar cwai097 avatar samantha-v-brian avatar mwals360 avatar mpdwalsh avatar

Stargazers

 avatar Ibon Martínez-Arranz avatar Giovanni M Perez avatar Norman Markgraf avatar Karsten Luebke avatar

Watchers

 avatar  avatar

cougarstats's Issues

Authors tab Acknowledgement text modification

@samantha-v-brian

In the Authors tabPanel() we currently have this text:

Acknowledgement: In Fall 2022 an earlier version of this interactive R Shiny app was presented as Crystal Wai's COMP 5690: Senior Computer Science Project. From June - August 2023 this project was funded by a student research grant (awarded to Michael Myer) conferred by the Faculty of Science and Technology at Mount Royal University. Starting September 2023 this project is funded by a Provost's Teaching-Learning Enhancement Grant (TLEG). Michael Myer is currently hired as a Project Assistant through this grant.

Change it to the following

Acknowledgement: In Fall 2022 an earlier version of this interactive R Shiny app was presented as Crystal Wai's COMP 5690: Senior Computer Science Project. From June - August 2023 this project was funded by a student research grant conferred by the Faculty of Science and Technology at Mount Royal University. From September 2023 - April 2024 this project was funded by a Provost's Teaching-Learning Enhancement Grant (TLEG). Starting July 2024 this project will be funded by the Provost's Teaching-Learning Enhancement Grant (TLEG) for the 2024-2025 cycle.

Statistical Inference for One Population Standard Deviation (left panel ONLY)

@samantha-v-brian

When the user selects

image

Currently there are two parameters of interest to choose from

image

I would like to add another parameter of interest to this list and make it look like this

image

It can be achieved by the following code

                radioButtons(
                  inputId      = "popuParameter",
                  label        = strong("Parameter of Interest"),
                  choiceValues = list("Population Mean", 
                                      "Population Standard Deviation", 
                                      "Population Proportion"),
                  choiceNames  = list("Population Mean (\\( \\mu \\)) ", 
                                      "Population Standard Deviation (\\( \\sigma \\)) ", 
                                      "Population Proportion (\\( p\\))"),
                  selected     = "Population Mean", #character(0), #
                  inline       = FALSE), #,width = '1000px'),

Now suppose the user selects

image

We should have two numericInputs called

Sample Size (n)
Population Standard Deviation (σ)

Validate the above two fields:

  • Sample Size cannot be empty, it has to be a positive integer greater than zero.
  • Population Standard Deviation cannot be empty, it has to be a positive value (decimals allowed) greater than zero.

Next we will have a radio button toggle as follows

image

In the user selects Confidence Interval then display the following Confidence Level choices

image

In the user selects Hypothesis Testing then display the following

image

Followed by a numericInput for

Hypothesized Population Mean (σ0) Value

Following that have this

image

Kruskal-Wallis test

@samantha-v-brian

Under Statistical Inference when the user selects:

image

we should have a radio button toggle like this

image

Kruskal-Wallis Test Workflow

Step 1 Setting up the null and alternate hypothesis: The null hypothesis for the Kruskal-Wallis test is that there are no differences between the medians of the groups, meaning that all the groups are sampled from populations with the same distribution.

The alternate hypothesis, on the other hand, states that there is at least one group whose median is different from the medians of the other groups. In other words, it suggests that there are differences in the medians of at least one pair of groups being compared.

Step 2 Fix α.

Step 3 Instead of the ANOVA table we need a table of ranks. We covered Kruskal-Wallis tests in MATH 2444. I have posted some notes and examples here. Grab the TS-value from the kruskal.wallis() function. The test statistic formula is

image

Step 4 The critical value or P-value method.

CRITICAL-VALUE APPROACH

The critical value is dependent on two degrees of freedom which can be extracted from the ANOVA table. Draw the right-skewed Chi-squared distribution curve, identify AR and shade the RR. The test is right-sided so shade on the right side tail only. Locate the TS-value on the curve in red colour

P-VALUE APPROACH

Grab the p-value from the kruskal.wallis() function and compare it against α.

Step 5 Conclusion: If the null hypothesis is rejected then we conclude that at least two medians differ.

Sample R code for the Kruskal-Wallis Test

# Sample data
Diatoms <- c(425, 466, 440, 498)
Bacteria <- c(303, 301, 293, 328, 327, 314)
Macroalgae <- c(327, 324, 302, 312, 303)

# Kruskal-Wallis test
result <- kruskal.test(list(Diatoms, Bacteria, Macroalgae))

# Calculate the chi-square critical value for the degrees of freedom
df <- result$parameter
crit_val <- qchisq(0.05, df, lower.tail = FALSE)

# Print the results
cat("Kruskal-Wallis test:\n")
cat("Test statistic:", result$statistic, "\n")
cat("Degrees of freedom:", df, "\n")
cat("P-value:", result$p.value, "\n")
cat("Critical value at alpha = 0.05:", crit_val, "\n")

Probability Distributions: Negative binomial distribution

@mwals360

Under Probability Distributions we currently have

image

To this list add Negative Binomial and make inline = FALSE so the radio buttons are listed vertically.

Have the following numericInputs()

Number of successes (r) (Validation: Non-empty, Positive integers only, must be greater than 0)
Probability of Success (p) (Validation: Non-empty, between 0 and 1 only, inclusive)

Followed by

image

Followed by a radio button toggle

  • Failures prior to the rth success
  • Trials until (and including) the rth success

Selecting either one of the radio buttons would reveal a numericInput labelled

Number of Successes (x) (Validation: Non-empty, Positive integers only)

If the user selects

image

reveal two numericInputs labelled

Number of Successes (x1) (Validation: Non-empty, Positive integers only)
Number of Successes (x2) (Validation: Non-empty, Positive integers only)

Further validate that x1 is less than or equal to x2.

Finally we will have

image

Constructing a Pie or Bar Chart

@mwals360

image

when the parameter of interest is

image

we should have a dropdown

image

that’ll construct a pie chart and/or a bar chart for the number of successes (x) and number of failures (n - x).

The charts would look something like

image

or

image

Multiple Linear Regression (left panel ONLY)

@samantha-v-brian

The “Multiple Linear Regression” option has been removed (hidden) from the radio button input.

image

I would to bring back the radio button option called Multiple Linear Regression. When the user selects that option we ask them to upload a file

image

Once the upload is complete the user gets to select one column as a the response variable (y) and multiple columns as the explanatory variables (x1, x2, x3, ...).

image image

In the above change the dropdown header to Choose the Explanatory Variables (x1, x2, x3,...)
also change the dropdown tooltip text to Select multiple variables

Validations:

  • Make sure exactly one numeric column is selected for the response variable.
  • Make sure one or more numeric columns are selected for the explanatory variables (the response variable column is now not selectable or hidden).
image

The above should not appear for Multiple Linear Regression.

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.