concept test in category R

appears as: tests, test, tests, The test, test
R in Action, Third Edition

This is an excerpt from Manning's book R in Action, Third Edition.

In this section, we’ll look at frequency and contingency tables from categorical variables, along with tests of independence, measures of association, and methods for graphically displaying results. We’ll be using functions in the basic installation, along with functions from the vcd and gmodels packages. In the following examples, assume that A, B, and C represent categorical variables.

Listing 7.14 Correlation matrix and tests of significance via corr.test()
> library(psych)
> corr.test(states, use="complete")
 
Call:corr.test(x = states, use = "complete")
Correlation matrix
           Population Income Illiteracy Life Exp Murder HS Grad
Population       1.00   0.21       0.11    -0.07   0.34   -0.10   
Income           0.21   1.00      -0.44     0.34  -0.23    0.62
Illiteracy       0.11  -0.44       1.00    -0.59   0.70   -0.66
Life Exp        -0.07   0.34      -0.59     1.00  -0.78    0.58
Murder           0.34  -0.23       0.70    -0.78   1.00   -0.49
HS Grad         -0.10   0.62      -0.66     0.58  -0.49    1.00
 
Sample Size
[1] 50
 
Probability value
           Population Income Illiteracy Life Exp Murder HS Grad
Population       0.00   0.15       0.46     0.64   0.01     0.5    
Income           0.15   0.00       0.00     0.02   0.11     0.0
Illiteracy       0.46   0.00       0.00     0.00   0.00     0.0
Life Exp         0.64   0.02       0.00     0.00   0.00     0.0
Murder           0.01   0.11       0.00     0.00   0.00     0.0
HS Grad          0.50   0.00       0.00     0.00   0.00     0.0

In this chapter, you’ll learn how to conduct power analyses for a variety of statistical tests, including tests of proportions, t-tests, chi-square tests, balanced one-way ANOVA, tests of correlations, and linear models. Because power analysis applies to hypothesis testing situations, we’ll start with a brief review of null hypothesis significance testing (NHST). Then we’ll review conducting power analyses within R, focusing primarily on the pwr package. Finally, we’ll consider other approaches to power analysis available with R.

Practical Data Science with R, Second Edition

This is an excerpt from Manning's book Practical Data Science with R, Second Edition.

Finally, the model is put into operation. In many organizations, this means the data scientist no longer has primary responsibility for the day-to-day operation of the model. But you still should ensure that the model will run smoothly and won’t make disastrous unsupervised decisions. You also want to make sure that the model can be updated as its environment changes. And in many situations, the model will initially be deployed in a small pilot program. The test might bring out issues that you didn’t anticipate, and you may have to adjust the model accordingly. We’ll discuss model deployment in chapter 11.

Figure 4.12. Splitting data into training and test (or training, calibration, and test) sets
Listing 4.12. Splitting into test and training using a random group mark
set.seed(25643)                                      #1
customer_data$gp <- runif(nrow(customer_data))       #2
customer_test <- subset(customer_data, gp <= 0.1)    #3
customer_train <- subset(customer_data, gp > 0.1)    #4

dim(customer_test)
## [1] 7463   16

dim(customer_train)
## [1] 65799    16

Some care must be taken in running an A/B test. It’s important that the A and B groups be run at the same time. This helps defend the test from any potential confounding effects that might be driving their own changes in conversion rate (hourly effects, source-of-traffic effects, day-of-week effects, and so on). Also, you need to know that differences you’re measuring are in fact due to the change you’re proposing and not due to differences in the control and test infrastructures. To control for infrastructure, you should run a few A/A tests (tests where you run the same experiment in both A and B).

R in Action, Second Edition: Data analysis and graphics with R

This is an excerpt from Manning's book R in Action, Second Edition: Data analysis and graphics with R.

In this section, we’ll look at frequency and contingency tables from categorical variables, along with tests of independence, measures of association, and methods for graphically displaying results. We’ll be using functions in the basic installation, along with functions from the vcd and gmodels packages. In the following examples, assume that A, B, and C represent categorical variables.

Listing 7.16. Correlation matrix and tests of significance via corr.test()
> library(psych) > corr.test(states, use="complete") Call:corr.test(x = states, use = "complete") Correlation matrix Population Income Illiteracy Life Exp Murder HS Grad Population 1.00 0.21 0.11 -0.07 0.34 -0.10 Income 0.21 1.00 -0.44 0.34 -0.23 0.62 Illiteracy 0.11 -0.44 1.00 -0.59 0.70 -0.66 Life Exp -0.07 0.34 -0.59 1.00 -0.78 0.58 Murder 0.34 -0.23 0.70 -0.78 1.00 -0.49 HS Grad -0.10 0.62 -0.66 0.58 -0.49 1.00 Sample Size [1] 50 Probability value Population Income Illiteracy Life Exp Murder HS Grad Population 0.00 0.15 0.46 0.64 0.01 0.5 Income 0.15 0.00 0.00 0.02 0.11 0.0 Illiteracy 0.46 0.00 0.00 0.00 0.00 0.0 Life Exp 0.64 0.02 0.00 0.00 0.00 0.0 Murder 0.01 0.11 0.00 0.00 0.00 0.0 HS Grad 0.50 0.00 0.00 0.00 0.00 0.0

Now you can apply the test:

Figure 9.3. Tukey HSD tests provided by the multcomp package