Hello,
Remove ind from the calculations.
And maybe substitute length(Variable) for 1312.
And standard deviations is the square root of the variance, you are
missing the square root.
Hope this helps,
Rui Barradas
?s 17:50 de 12/04/2019, bienvenidozoma at gmail.com
escreveu:> Dear all,
> I am trying to write the script to calculate the mean and the standard
deviation without using the functions mean and standard deviations since
morning. Someone can help
>
> These scripts below are what i did but when i run and check with the
function mean and standard deviation it is not the same result
> ind<-1:number of observations
> Mean<-(1/number of observations*sum(Variable*ind))
> Standard<-(1/Number of observations-1*sum(Variable -
((1/1312*sum(Variable*ind)))))
>
> Thanks
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>