COST-1

#user define skewness function

us_sk<-function(x){

n<-length(x)

mean_x<-mean(x)

sd_x<-sd(x)

skew<-sum((x - mean_x)^3) / ( n * sd_x^3)

return(skew)

}


#user define kurtosis function


us_kt<-function(x){

n<-length(x)

mean_x<-mean(x)

sd_x<-sd(x)

kurt<-sum((x - mean_x)^4) / (n * sd_x^4) - 3

return(kurt)

}


#user define mean function


us_mean<-function(x)

{

s = sum(x)

l = length(x)

r = (s/l)

return(r)

}


#user define mode function


us_mode<-function(x)

{

ux<-unique(x)

mode_value<-ux[which.max(tabulate(match(x,ux)))]

return(mode_value)

}

#user define mean function


us_mean<-function(x)

{

s = sum(x)

l = length(x)

r = (s/l)

return(r)

}


#user define standard deviations

us_sd<-function(x)

{

n<-length(x)

mean_x<-mean(x)

sd_x<-sqrt(sum (( x - mean_x)^2) / (n - 1))

return(sd_x)

}


#user define variance functio

variance<-function(x)

{

n<-length(x)

mean_x<-mean(x)

vari_val<-sum((x - mean_x)^2) / (n - 1)

return(vari_val)

}


var(b)

variance(b)

Comments

Popular posts from this blog

python(BI)

(PP-7)Create a class called Numbers, which has a single class attribute called MULTIPLIER, and a constructor which takes the parameters x and y (these should all be numbers). i. Write a method called add which returns the sum of the attributes x and y. ii. Write a class method called multiply, which takes a single number parameter a and returns the product of a and MULTIPLIER. iii. Write a static method called subtract, which takes two number parameters, b and c, and returns b - c. iv. Write a method called value which returns a tuple containing the values of x and y. Make this method into a property, and write a setter and a deleter for manipulating the values of x and y.