Untitled

mail@pastecode.io avatar
unknown
sqlserver
a year ago
1.8 kB
5
Indexable
Never
#ASS 8
height<-c(5.2,5.4,5.7,5.8,5.9,6.1,6.2,6.5)
weight<-c(51,52,53,54,56,57,58,59)
relation<-lm(weight ~ height)
print(relation)

a<-data.frame(height=5)
result<-predict(relation,a)
print(result)

#ass 7
s_1<-c(rnorm(40,300,18.5))
#.........../n  , mean , sd
s_1
t.test(rnorm(s_1,310,0.95))

s_2<-c(rnorm(38,305,16.7))
s_2
t.test(rnorm(s_2,310,0.95))

print("Final Comparasion of two Sample :")
print(" ")
t.test(s_1,s_2,mu=310,conf.level=0.90)

#ass6
a<-c(12,34,32,56,75,30)
print(var(a))
print(sd(a))

print(quantile(a))
print(IQR(a))

#ASS 5
data<-iris
head(data)
summary(data)

#max(data$Sepal.Length, na.rm = FALSE)
median(data$Sepal.Length)
mean(data$Sepal.Length)
table(data$Sepal.Length)
mode <- max(table(data$Sepal.Length)) 
print(mode)
dim(data)

#ASS 4

percentage <- 1 - pnorm(80, 67, 13.7)
percentage_decimal <- percentage * 100

# Print the result
print(paste("Percentage of students scoring 80 or more:", percentage_decimal, "%")) 

#ASS 3

i =1
while (i <= 7) {
  ans <- dbinom(i , 20 , 0.25)
  print(ans)
  i = i+1
}

#ass 2


conditinal_pro<-function(a,b)
{
  cond=accident/follow_traffic
  print(cond)
}
accident<-50
follow_traffic<-2000+50
conditinal_pro(accident,follow_traffic)

ASS 1
print("hello")
a=5
print(a)
print(typeof(a))
var=FALSE

#list
l1=list(1,7,6)
print(l1)

#matrix
m=matrix(c(1,2,3,4),nrow=2,ncol=2,byrow = T)
print(m)

#array
arr=array(c("green","yellow"),dim=c(3,3,2))
print(arr)

#factor
fac=c("green","yellow","red","green","red","blue")
fac=factor(fac)
print(fac)

#data frame
BMI=data.frame(name=c("jon","Mark","jenny"),height=c(152,171,165),weight=c(8,9,10))
print(BMI)

#if else
a=7
if(a==7){
  print("Equals")
}else{
  print("Not equals")
}