Title: | CSU Channel Islands R Tools |
---|---|
Description: | An R package containing functions for statistics courses at CSUCI. |
Authors: | c( person("Isaac", "Quintanilla Salinas", role = c("aut","cre"), email = "[email protected]", comment = c(ORCID = "0000-0002-1137-4310")) ) |
Maintainer: | Isaac Quintanilla Salinas <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.4.0 |
Built: | 2025-02-02 06:12:01 UTC |
Source: | https://github.com/inqs909/csucistats |
Obtain the adjusted R-Squared Value from a Linear Model
ar2(object)
ar2(object)
object |
An R object that is a 'formula' or contains the results of the 'lm' function. |
The regression coefficients demonstrates how a set of predictor variables will affect the outcome of interest.
b(object, index = NULL, data = NULL)
b(object, index = NULL, data = NULL)
object |
An R object that is a formula or contains the results of the 'lm' function. |
index |
Index indicating which coefficients to obtain. |
data |
A data frame when the object is a formula. |
Obtain the Bottom X Percents
bottom(x, probs)
bottom(x, probs)
x |
Vector |
probs |
Probability |
Obtain Frequencies and Proportions for a Categorical Variable
cat_stats(x, y = NULL, prop = "all", df = FALSE, tbl_df = FALSE, digits = 4)
cat_stats(x, y = NULL, prop = "all", df = FALSE, tbl_df = FALSE, digits = 4)
x |
Vector |
y |
Vector for Cross-tabulations. |
prop |
Character indicating what type of proportions to provide. Defaults to "all". |
df |
Logical indicating to provide a tibble for cross tabulations with table proportions. |
tbl_df |
Logical indicating if you need a df for a single variable for a pie chart or other things. |
digits |
number of decimal places to round |
Obtain Descriptive Statistics from a data frame.
descriptive(df)
descriptive(df)
df |
An R data frame used for further analysis. |
Extract the F Statistic
f(object)
f(object)
object |
An R object that is a 'formula' or contains the results of the 'lm' function. |
Install R packages used for Math 201
install_m201()
install_m201()
Install ggplots and other plotting packages
install_plots()
install_plots()
Repeat a task numerous times
iterate(expr, sim)
iterate(expr, sim)
expr |
Expression to be evaluated multiple times. |
sim |
The number of times to evaluate an the expression. |
Obtain the middle X Percent
middle(x, probs)
middle(x, probs)
x |
Vector |
probs |
Probability |
Obtain Numerical Statistics for a Continuous Variable by a Categorical Variable
num_by_cat_stats(df, num, cat)
num_by_cat_stats(df, num, cat)
df |
An R data frame used for further analysis. |
num |
Name of the numerical variable found in the data frame |
cat |
Name of the categorical variable found in the data frame |
Obtain Numerical Statistics for a Continuous Variable
num_stats(x, tbl = TRUE, digits = 3)
num_stats(x, tbl = TRUE, digits = 3)
x |
A numerical or integer vector. |
tbl |
A logical indicating whether to return a tibble or not, defaults to TRUE. |
digits |
number of decimal places to round |
Compute the proportions of observing a value from a 2 by 2 continguency table
props(x, y, yval, diff = FALSE)
props(x, y, yval, diff = FALSE)
x |
grouping variable |
y |
outcome of interest |
yval |
category of interest from outcome of interest |
diff |
Obtain the difference in proportions. Default is FALSE. |
Obtain the R-Squared Value from a Linear Model
r2(object)
r2(object)
object |
An R object that is a 'formula' or contains the results of the 'lm' function. |
Sample a data frame with replacement
resample(df)
resample(df)
df |
Data frame to be sampled with replacement |
Extract Residuals and Influential Measures from and 'lm' object
resid_df(object)
resid_df(object)
object |
An R object that contains the results of the 'lm' function. |
Reorder the data of a vector
shuffle(x)
shuffle(x)
x |
A vector to be shuffle the order of the values. |
Compute the sum of error squared for an R object
sse(object, data = NULL)
sse(object, data = NULL)
object |
An R object that is a 'formula' or contains the results of the 'lm' function. |
data |
A data frame when the object is a formula. |
Obtain the top X Percent
top(x, probs)
top(x, probs)
x |
Vector |
probs |
Probability |
A simulated dataset about unicorns used for teaching purposes.
unicorn_data
unicorn_data
A data frame with 750 rows and 15 variables:
A unique id number
age in years
The gender of the unicorn (Female, Male, Non-Binary, Genderfluid, Agender)
Color (White, Black, Gray, Brown, Pink, Gold, Silver
What type of unicorn is it? (Rainbow, Jewel, Ember, Ruvas)
What type of horn is it? (Opal or Aquamarine)
Length of the horn (inches)
Strength of the Horn (pascals)
Weight in pounds
Unicorn's overal health (1-10)
How Personal is the unicorn?
How magical is the unicorn?
How elusive is the unicorn?
How gentle is the unicorn?
How connected to nature is the unicorn?
csucistats csucistats R package.
Creates a Unicorn Data Set from simulated models.
unicorns(n)
unicorns(n)
n |
Number of unicorns used |