Error message for calculating the variance of my beta

I want to calculate the variance of my beta, I am typing in this command, however i am getting the error message 'subscript indices must either be real positive integers or logical', 'Attempted to access (0.0686532); index must be a positive integer or logical'
My command is
var(b)=inv(xcl'*xcl)sqrt(sigma_r)

1 comentario

Vivek Selvam
Vivek Selvam el 8 de Nov. de 2013
Editada: Vivek Selvam el 8 de Nov. de 2013
You are using var as an array variable. So the index (b) have to be positive integer.

Iniciar sesión para comentar.

 Respuesta aceptada

Wayne King
Wayne King el 8 de Nov. de 2013
Editada: Wayne King el 8 de Nov. de 2013
You don't make assignments like this in MATLAB
var(b) = sqrt(2);
For example, this will produce the error you observe:
b = randn(100,1);
var(b) = sqrt(2);
To calculate the variance of your beta, create a variable:
varbeta = inv(xcl'*xcl)*sqrt(sigma_r);

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 8 de Nov. de 2013

Comentada:

el 8 de Nov. de 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by