Stat 8-14

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

PRACTICAL NO.

– 08
 AIM: Exercises to find the outliers in a dataset in SPSS.

 PROCEDURE:
Step:-1 : Open IBM SPSS in your PC / laptop.
Step:-2 : Define two different variables and add values to it. Make sure to add some values
that differ highly from the usual set of variables.

Step:-3 : Then click on ‘analyze’ and go to ‘explore’.

HANUMANT SINGH NEGI 23


Step:-4 : drag the variable into the other side of the task pane and click ‘ok’.

Step:-5 : This will generate the desired output.


OUTPUT:

HANUMANT SINGH NEGI 24


PRACTICAL NO. – 09

 AIM: Exercises to find the riskiest project out of two mutually exclusive projects in SPSS.
 PROCEDURE:

1) Open IBM SPSS.


2) Define two different variables and add values to them. Make sure to define a large set of
values.
3) Then select 'analyze' and go to 'crosstabs' and drag one variable set to rows and other
variable set to column.
4) Then open 'statistics' option and click check box on ‘risk'.
5) Click ok and the required risk analysis report is generated as output.

 OUTPUT:

HANUMANT SINGH NEGI 25


PRACTICAL NO. – 10
 AIM: Exercises to draw a scatter diagram, residual plots, outliers leverage and influential data
points in R.

 SOURCE CODE:
1) Scatter diagram:

OUTPUT:

2) Residual plot:
Y<- iris[,"Sepal.Width"]
X<- iris[,"Sepal.Length"]
# fit a regression model
model <- lm(Y~X)
# get list of residuals
res <- resid(model)
res
# produce residual vs. fitted plot
plot(fitted(model), res)
# add a horizontal line at 0
abline(0,0)

HANUMANT SINGH NEGI 26


3) Outliers Leverage & Influential Data Points :

OUTPUT:

HANUMANT SINGH NEGI 27


PRACTICAL NO. – 11
 AIM: Exercises to calculate correlation using R.

 SOURCE CODE:
> x <- c(12,15,18,21,27,3,2)
> y <- c(2,4,6,8,12,0,8)
> print(cor(x, y,))

 OUTPUT:
[1] 0.625399

HANUMANT SINGH NEGI 28


PRACTICAL NO. – 12
 AIM: Exercises to calculate Time Series Analysis using R.

 SOURCE CODE:
> rainfall <- c(799,174.8,865.1,1334.6,635.4,918.5,681.5,998.6,784.2,935,889.8,1261)
> rainfall <- ts(rainfall,start = c(2021,1),frequency = 12)
> plot(rainfall , main="Time Series Analysis", col='2',lwd=2)

 OUTPUT

HANUMANT SINGH NEGI 29


PRACTICAL NO. – 13
 AIM: Exercises to implement linear regression using R.

 SOURCE CODE:

HANUMANT SINGH NEGI 30


 OUTPUT:

HANUMANT SINGH NEGI 31


PRACTICAL NO. – 14
 AIM: Exercises to implement concepts of probability and distributions in R.

 SOURCE CODE:
1. Binomial Distribution :
## Coin tossed 5 times probability of getting 2 heads and probability of at most 4 heads
dbinom(x=2, size=5, prob=0.5)
plot(dbinom(x=0:10, size=5, prob=.5), xlab="No.of heads", main="Binomial
Distribution", type='l',
col='2', lwd=3)

2. Poisson Distribution :
dpois(x=2, lambda=2)
plot(dpois(x=0:20, lambda=2), xlab = "No. of observations", main = "Poisson
Distribution", type ="l" ,col='2',lwd=3)

HANUMANT SINGH NEGI 32


3. Normal Distribution :
dnorm(2,2,4)
plot(dnorm(2:30,2,4),main = "Normal Distribution",xlab = "x", type = 'l',
,col='2',lwd=3)

HANUMANT SINGH NEGI 33

You might also like