# aa

slide Regression and Multivariate Factor Cluster Discriminant

https://www.springer.com/journal/180
Computational Statistics Journal

https://www.springer.com/journal/10651
Environmental and Ecological statistics

https://www.springer.com/journal/13253
Journal of Agricultural, Biological and Environmental Statistics

https://www.springer.com/journal/11222
statistics and computing

Journal of Business & Economic Statistics

https://www.sciencedirect.com/journal/computational-statistics-and-data-analysis
Computational Statistics and Data Analysis

http://www.pakjs.com/
Pakistan journal of statistics

https://pjsor.com/pjsor
Pakistan journal of operation and statistics

Time series analysis (series) – YouTube

for data: https://github.com/ritvikmath/Time-Series-Analysis

V14.16 – Testing Mediation in SPSS – Example 1 – YouTube

set.seed(9850)
df = data.frame(cat=rep(c(“S”,”M”,”T”),c(3000,4000,3000)),
ht=c(rnorm(3000, mean=100, sd=5),
rnorm(4000, mean=140, sd=5),
rnorm(3000, mean=170, sd=5)))
tail(df)
mean(df\$ht)
table(df\$cat)
var(df\$ht)
sd(df\$ht)
aggregate(df\$ht ~ df\$cat, FUN=mean)
aggregate(ht~cat,df,function(s)
c(mean=mean(s),sd=sd(s),n=length(s)))

#### Generating 1000 SRS, size n=50,

set.seed(9850)
xbar = apply(replicate(1000, sample(df\$ht, 50)),2, FUN=mean)
mean(xbar)
var(xbar)
sd(xbar)
sigmasq_xbar = ((var(df\$ht) * (length(df\$ht) – 1)) / length(df\$ht)) / 50
sigmasq_xbar_hat = var(xbar)

##### proportional stratified RS using category for strata

table(df\$cat) / nrow(df) * 50
xbarStrat = NA
set.seed(9850)
for (i in 1:1000) {xbarStrat[i] = mean( c(df[sample(3000, 15), “ht”], df[sample(3001:7000, 20), “ht”], df[sample(7001:10000, 15), “ht”] )) }
mean(xbarStrat)
var(xbarStrat)

Systematic sampling
Make a list of 5000 last name, generate 500 normally distributed random numbers
having mean 65 and sd 5, make a dataframe using 500 last names and randomly selected
500 randomly selected weight. select 100 samples using systematic sampling method.
find the population mean and sample mean compare it.

#make this example reproducible
set.seed(1)
#create simple function to generate random last names
randomNames <- function(n = 5000) {
do.call(paste0, replicate(5, sample(LETTERS, n, TRUE), FALSE))}
#create data frame
df <- data.frame(last_name = randomNames(500),gpa = rnorm(500, mean=82, sd=3))
#define function to obtain systematic sample
obtain_sys <- function(N,n){
k = ceiling(N/n)
r = sample(1:k, 1)
seq(r, r + k*(n-1), k)}

#obtain systematic sample
sys_sample_df = df[obtain_sys(nrow(df), 100), ]
sys_sample_df

Next example
install.packages(“TeachingSampling”)
library(TeachingSampling)
P <- c(“Mon-8”, “Tues-4”, “Wed-4”, “Thurs-6”, “Fri-7″,”Sat-45″,”Sun-34″,”Mon-21”, “Tues-11″,”Wed-34″,”Thurs-16″,”Fri-10″,”Sat-17″,”Sun-19”)
#systematic sample from a population of 14 with every 2nd included from the populaion P
systematic_sample <- S.SY(14,2)
systematic_sample
P[systematic_sample]