Help for coding

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Help for coding

bienvenidozoma@gmail.com
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]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Help for coding

Rui Barradas
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, [hidden email] 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]]
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.