Zahoor Ahmad

 

Home

AIOU

MIU

IMCB H9

Contact

Commands set-2 in R

xx = matX[,2:3]
regY = lm(y~xx)
regY
summary(regY)
anova(regY)

x21 = c(34, 36, 30, 29, 25, 12, 45, 26, 20, 32)
y21 = c(45, 46, 48, 50, 40, 34, 66, 35, 30, 49)

xx21 = matrix(c(x21,x22), ncol2)
xx21 = matrix(c(x21,x22), ncol=2)
reg22 = lm(y21~xx21)
reg22
reg23 = lm(y21~x21+x22)
reg23

summary(reg22)
anova(reg22)
summary(reg22)$coeff

summary(reg22)$coeff[1]
summary(reg22)$coeff[2]
summary(reg22)$coeff[3]

b2 = summary(reg22)$coeff[3]
b1 = summary(reg22)$coeff[2]
b0 = summary(reg22)$coeff[1]

yest = b0 + b1 * x21 + b2*x22
yest

res22 = y21 - yest

t.test(y21, mu = 40)
test that mean of x21 and x22 are equal
t.test(x21,x22)

t.test(x21,x22, var.equal = T)

grp = rep(1:3, each = 10)

aov(c(x21, x22, y21)~grp)
mean3 = aov(c(x21, x22, y21)~grp)
summary(mean3)

die = c(1:6)
die1 = sample(die, 300, replace = T)
die2 = sample(die, 300, replace = T)

table(die1)
table(die2)

dieS = die1 + die2
table(dieS)

dieD = die1 - die2
table(dieD)

dieDa = abs(die1 - die2)
table(dieDa)

coin = c(0,1)
toss2 = sample(coin, 1000, replace = T, prob = c(.25, ,.75))
toss2 = sample(coin, 1000, replace = T, prob = c(.25, .75))

table(toss2)

die222 = sample(die, 900, replace = T, prob = c(1,2,1,2,1,2))
table(die222)

 

 

If you find any advertisement showing some indecent material please report its web address (URL) on contact page. It will help us to block such websites to show their ads in future. Sorry for inconvenience.

   

 

f