Skip to content

Problems with boot and optim

2 messages · Luke Keele, Angelo Canty

2 days later
#
Hi Luke,

I think your problem is in the function lik.hetprobit and not 
remembering that R is case sensitive so X and x are not the same.

The parameters passed in are called X, Y and Z which change for each
bootstrap dataset.  Within the function, however, your first three 
lines are
Y <- as.matrix(y)
X <- as.matrix(x)
Z <- as.matrix(z)

since x, y, z (lowercase) do not exist in the function, they are being
sought in the global workspace which remains the same for each bootstrap
dataset so that after these three lines your X, Y and Z (uppercase) take
on these values no matter what was input to the function.

Replace x, y and z in the function by X, Y and Z and it should work.

HTH, Angelo
On Tue, 21 Sep 2004, Luke Keele wrote: