0% found this document useful (0 votes)
15 views

Lab Checkup Notes 2 - Google Docs

stats lab skills

Uploaded by

upender
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Lab Checkup Notes 2 - Google Docs

stats lab skills

Uploaded by

upender
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

‭Lab skills check 2: Labs 5, 6, and 7‬

‭Lab 5: R Skills‬
‭●‬ ‭How to execute a command‬
‭○‬ ‭Highlight it and push control enter ( it should pop up in r console) example: v1‬
‭<- c(1,2,3,4,5)‬
‭■‬ ‭This creates a vector in R’s memory‬
‭○‬ ‭You can then “call” this vector by typing “v1” and click enter‬
‭■‬ ‭This is a new “object”‬
‭○‬ ‭Type “objects()” and click enter and you will see a list of vectors you have‬
‭creator ex: v1 and v2‬
‭●‬ ‭Using “scan” function‬
‭○‬ ‭Type: v3 <- scan() and push enter‬
‭○‬ ‭A number 1 with a colon will appear, input numbers for 1-10 and push enter‬
‭twice when you get to 11‬
‭○‬ ‭Now when you call “v3” these 10 numbers will appear‬
‭●‬ ‭Histogram‬
‭○‬ ‭Type “hist(v4)”‬
‭○‬ ‭Should appear in “plots” on the right side‬

‭Lab 6: Hypothesis Testing using one sample T-Test‬


‭●‬ ‭Descriptive statistics‬
‭○‬ ‭Put all data in column #1‬
Analyze‬‭>‬‭
‭○‬ ‭Click on‬‭ Descriptive Statistics‬‭>‬‭
Descriptives‬
‭.‬
car‬‭and move it into the variables‬‭window.‬
‭○‬ ‭Select the variable‬‭
Options‬
‭○‬ ‭Click‬‭ ‭, uncheck "Minimum" and "Maximum," and check "S. E. Mean."‬
Continue‬‭and then‬‭
‭○‬ ‭Click‬‭ OK‬‭to generate the descriptive statistics.‬

‭-Hypothesis Testing: One-Sample T-Test‬

‭●‬ ‭Formulating Hypotheses:‬


‭1.‬ ‭Null hypothesis (H0H_0H0​): The mean is equal to the claimed value.‬
‭2.‬ ‭Alternative hypothesis (H1H_1H1​): The mean is different from the claimed‬
‭value (two-tailed test).‬
‭●‬ ‭Running the Test:‬
Analyze‬‭>‬‭
‭1.‬ ‭Click‬‭ Compare Means‬‭>‬‭
One-Sample T-Test‬
‭.‬
car‬‭into the "Test Variables" field.‬
‭2.‬ ‭Move‬‭
‭3.‬ ‭In "Test Value," input the claimed mean (e.g., 22).‬
Options‬
‭4.‬ ‭Click‬‭ Continue‬‭and then‬‭
‭, ensure confidence level is 95%, click‬‭ OK‬
‭.‬
‭●‬ ‭Interpreting Output:‬
‭1.‬ ‭Look at the t-value, degrees of freedom (df), and p-value (Sig. 2-tailed).‬
‭2.‬ ‭Compare the p-value to α=0.05\alpha = 0.05α=0.05:‬
‭■‬ ‭If p less than 0.05, reject the null hypothesis‬
‭■‬ ‭If p is greater than fail to reject‬

‭Errors:‬

‭●‬ ‭Type I error (α\alphaα): Rejecting null when it's true.‬


‭●‬ ‭Type II error (β\betaβ): Failing to reject null when it's false.‬

‭Types of tests:‬

‭●‬ ‭One tailed= alternative hypothesis specifies a direction‬


‭○‬ ‭Ex: H1​:μ<22 (mean mileage is less than 22).‬
‭●‬ ‭Two tailed = alternative hypothesis does not specify a direction‬
‭○‬ ‭Ex: H1​:μ=22 (mean mileage is different from 22, either greater or less).‬

‭Using R to understand probability density factors:‬

pnorm‬‭function calculates cumulative probabilities‬‭for scores based on a‬‭normal‬


‭The‬‭
‭distribution‬‭. You can apply it to:‬

‭●‬ ‭Standard normal distributions (‬‭


mean = 0, sd = 1‬
‭)‬
‭●‬ ‭Other distributions by specifying different mean (‬‭
x‬‭) and standard deviation (‬‭
y)‬
‭●‬ ‭
Cumulative probability of 1 in a standard normal distribution‬

pnorm(1, mean = 0, sd = 1)‬


To find cumulative probability for a‬‭


‭ negative score‬‭
(below‬
the mean):‬

‭■‬ ‭
Change 1 to -1 : pnorm(-1, mean = 0, sd = 1)‬
To calculate the probability‬‭
‭ between two scores‬
: Subtract‬

the smaller cumulative probability from the larger‬

‭■‬ ‭
pnorm(1, mean = 0, sd = 1) - pnorm(-1, mean = 0, sd =‬
1)‬

‭●‬ ‭
Calculate confidence interval for a mean‬

Use the‬‭
‭ scan()‬‭
function to input values one by one.‬

Press‬‭
‭ [Enter]‬‭
after each score, and‬‭
[Enter]‬‭
twice to finish.‬

‭■‬ ‭
Example input:‬‭
12, 20, 34, 45, 34, 36, 37, 50, 11, 32,‬
29‬
‭ .‬

‭○‬ ‭
Print data to verify‬
‭■‬ ‭
my_data‬
‭○‬ ‭
Find how many scores in my data set‬
‭■‬ ‭
length(my_data)‬
‭○‬ ‭
Calculate the 95% confidence interval around the mean‬
‭■‬ ‭
Use t.test function‬
‭■‬ ‭
t.test(my_data, conf.level = 0.95)‬
‭●‬ ‭
Perform a one sample t test‬
‭○‬ ‭
Replace‬‭
mu‬‭
with the hypothesized mean:‬
‭■‬ ‭
Code: t.test(my_data, mu = hypothesized_mean)‬

Look at the‬‭
‭ p-value‬
:‬

‭●‬ ‭
If‬‭
p < 0.05‬
: Reject the null hypothesis (significant difference).‬

‭●‬ ‭
If‬‭
p ≥ 0.05‬
: Fail to reject the null hypothesis (no significant‬

difference).‬

‭Study Guide:‬

‭Use SPSS to obtain z scores‬


‭○‬ ‭Enter Data‬‭:‬
‭●‬ ‭Input IQ scores into a column and name the variable "IQ."‬

‭Compute Variable‬‭:‬
‭●‬ ‭Go to‬‭Transform‬‭>‬‭Compute Variable‬‭.‬
PROBAB‬
‭●‬ ‭In‬‭Target Variable‬‭, type‬‭ ‭.‬

‭Select Function‬‭:‬

‭●‬ ‭Under‬‭Function group‬‭, choose‬‭CDF & Noncentral CDF‬‭.‬


‭●‬ ‭Select‬‭Cdf.Normal‬‭and move it to‬‭Numeric Expression‬‭.‬

‭Set Parameters‬‭:‬

?‬‭with‬‭
‭●‬ ‭Replace the first‬‭ IQ‬
‭.‬
?‬‭with‬‭
‭●‬ ‭Replace the second‬‭ 100‬‭(mean).‬
?‬‭with‬‭
‭●‬ ‭Replace the third‬‭ 15‬‭(standard deviation).‬

‭Confirm Syntax‬‭:‬

CDF.NORMAL(IQ,100,15)‬
‭●‬ ‭Ensure it reads‬‭ ‭.‬
‭●‬ ‭Click‬‭OK‬‭.‬

‭Change Decimal Precision‬‭:‬

PROBAB‬‭in the Data View.‬


‭●‬ ‭Double-click‬‭
‭●‬ ‭Adjust‬‭Decimals‬‭to desired precision (e.g., 4).‬

‭Calculate Probability Between Scores‬‭:‬

‭●‬ ‭Compute cumulative probabilities for scores (e.g., 83 and 112).‬


‭●‬ ‭Subtract cumulative probability of 83 from that of 112.‬

‭Use Independent Sample T-Test:‬

‭Prepare Data:‬

‭●‬ ‭Ensure your dependent variable (e.g., scores) is in one column, and your grouping‬
‭variable (e.g., group labels) is in another.‬

‭Remove Any Split Files:‬

‭●‬ ‭Go to Data > Split File.‬


‭●‬ ‭Select Analyze all cases, do not create groups, then run the command.‬
‭Access T-Test Function:‬

‭●‬ ‭Go to Analyze > Compare Means > Independent Samples T-Test.‬

‭Assign Variables:‬

‭●‬ ‭Move your dependent variable to Test Variables.‬


‭●‬ ‭Move your grouping variable to Grouping Variable.‬

‭Define Groups:‬

‭●‬ ‭Click Define Groups, input the codes for each group (e.g., 1 for Group 1, 2 for Group‬
‭2), and click Continue.‬

‭Run Test:‬

‭●‬ ‭Click Paste to generate syntax (optional), then execute the test.‬

‭Review Output:‬

‭●‬ ‭Check Levene's Test to assess equal variances (Sig. > 0.05 means variances are‬
‭equal).‬
‭●‬ ‭Interpret the t-test results for t-value, df, and p-value (Sig. 2-tailed).‬

‭Paired Sample T Test‬

‭Open Data:‬

‭●‬ ‭Ensure two related variables (e.g., scores for two conditions) are in two separate‬
‭columns, with rows representing individual participants.‬

‭Access Paired Samples T-Test:‬

‭●‬ ‭Go to Analyze > Compare Means > Paired Samples T-Test.‬

‭Select Variables:‬

‭●‬ ‭Assign one column to Variable 1 and the other column to Variable 2.‬

‭Set Confidence Interval (Optional):‬


‭●‬ ‭Click Options, adjust the confidence interval if needed (e.g., change to 99%), then‬
‭click Continue.‬

‭Run Test:‬

‭●‬ ‭Click Paste to generate syntax (optional), then execute the test.‬

‭Interpret Output:‬

‭●‬ ‭Check the paired correlation to confirm relatedness between variables.‬


‭●‬ ‭Examine the paired samples test for the t-value, p-value, and confidence interval.‬

‭One way multiple group ANOVA‬

‭Create Variables:‬

‭●‬ ‭In the Variable View tab:‬


response‬‭for scores).‬
‭○‬ ‭Create one column for the dependent variable (e.g.,‬‭
group‬‭for the‬
‭○‬ ‭Create another column for the independent variable (e.g.,‬‭
‭group or category).‬

‭Enter Data:‬

‭●‬ ‭Switch to the Data View tab.‬


‭●‬ ‭Enter the dependent variable's values in the first column (e.g., scores).‬
1‬
‭●‬ ‭Enter the corresponding group/category labels (e.g.,‬‭ 2‭,‬‬‭
‭,‬‭ 3‬
‭) in the second column.‬

‭Run the One-Way ANOVA:‬

‭●‬ ‭Go to Analyze > Compare Means > One-Way ANOVA.‬


response‬
‭●‬ ‭Move the dependent variable (e.g.,‬‭ ‭) into‬‭the Dependent List.‬
group‬
‭●‬ ‭Move the independent variable (e.g.,‬‭ ‭) into the‬‭Factor.‬

‭Add Post Hoc Tests (Optional):‬

‭●‬ ‭Click on Post Hoc, select Tukey for equal variances or Games-Howell for unequal‬
‭variances.‬
‭●‬ ‭Click Continue.‬

‭Run Analysis:‬
‭●‬ ‭Click OK to execute.‬

‭Interpret Results:‬

‭●‬ ‭Check the ANOVA table in the output for the F-value and p-value.‬
‭●‬ ‭If significant, use post hoc tests to identify specific group differences.‬

You might also like