Please write the code for R-Studio. This question is involving R-Studio codes I
ID: 3295966 • Letter: P
Question
Please write the code for R-Studio.
This question is involving R-Studio codes
I have an excel file with two variables: fitness and body size.
Please write a code to
Predict the confidence intervals of fitness scores for sheep with a body size of 10 kg and 12 kg .
fitness body.size 4 6.37354619 3 7.18364332 2 6.16437139 14 8.5952808 5 7.32950777 2 6.17953162 2 7.48742905 5 7.73832471 8 7.57578135 4 6.69461161 12 8.51178117 6 7.38984324 3 6.37875942 2 4.78530011 3 8.12493092 0 6.95506639 5 6.98380974 3 7.94383621 5 7.8212212 6 7.59390132 12 7.918977317 5 7.7821363 4 7.07456498 15.0106483 6 7.61982575 4 6.94387126 4 6.84420449 15.52924762 2 6.52184995 5 7.41794156Explanation / Answer
>n #sample size
#for fitness score for sheep with a body size of 10 kg
now, we want data from excel sheet so use following command
>data= read.table(file.choose(),header=TRUE) #choose data excel file and open
>data
> y=data[,1]
.> x=data[,2]
> v1=var(x)
>sig1=sqrt(v1)
> n=length(x)
>Lower.limit=(10-(qnorm(0.95)*(sig1/sqrt(n)))
>Upper.limit=(10+(qnorm(0.95)*(sig1/sqrt(n)))
#for fitness score for sheep with a body size of 12 kg
> v2=var(x)
>sig2=sqrt(v2)
>Lower.limit=(12-(qnorm(0.95)*(sig2/sqrt(n)))
>Upper.limit=(12+(qnorm(0.95)*(sig2/sqrt(n)))