RATS procedures: loop and dec function
RATS procedures: loop and dec function
This may be a very basic question but I wish create a 100x1 vector (I name it "temp") that has the values of draws from standard normal distribution using a loop. Here is an attempt that I made but I am not sure if I am declaring the correct type to start with. Further, how do I compute the average and standard deviation of "temp" and show these statistics in the output window?
dec vect temp(100)
do i = 1,100
compute temp(i) = %ran(1)
end do i
%mean(temp)
%sqrt(%variance(temp))
dec vect temp(100)
do i = 1,100
compute temp(i) = %ran(1)
end do i
%mean(temp)
%sqrt(%variance(temp))
Re: RATS procedures: loop and dec function
Thank you for your reply. I have run the above code and obtained the following error "## Unassigned 117 >>>>disp %mean(<<<<" Could you kindly tell me what this error means? Thanks.
Re: RATS procedures: loop and dec function
Is there a reason you want a VECTOR rather than a SERIES?
set temp 1 100 = %ran(1.0)
stats temp
would give you the mean, variance and and more. For computing those for a VECTOR, you would use %AVG(temp) to compute the mean and %COV(temp,temp) to compute the variance.
set temp 1 100 = %ran(1.0)
stats temp
would give you the mean, variance and and more. For computing those for a VECTOR, you would use %AVG(temp) to compute the mean and %COV(temp,temp) to compute the variance.