library(speedglm)
df <- data.frame(y = numeric(30), x = numeric(30), weights = numeric(30))
df$y <- c(5,3,8,3,8,9,3,1,3,5,6,7,8,9,1,4,3,2,4,7,2,5,9,2,3,1,4,5,5,7)
df$x <- c(7,5,3,6,8,9,5,3,1,2,3,6,9,6,3,8,9,0,7,5,3,1,2,3,4,9,7,5,3,2)
df$weights <- c(.3,.4,.6,.8,.4,.3,.4,.9,.6,.7,.4,.1,.2,.3,.6,.3,.7,.5,.3,.1,.5,.9,.6,.1,.2,.1,.5,.3,.9,.6)
lmModel <- lm(y ~ x, data = df)
summary(lmModel)
speedLmModel <- speedlm(y ~ x, data = df)
summary(speedLmModel)
So far, identical output.
lmModel2 <- lm(y ~ x, data = df, weights = weights)
summary(lmModel2)
speedLmModel2 <- speedlm(y ~ x, data = df, weights = df$weights)
summary(speedLmModel2)
The error I am getting is
> speedLmModel2 <- speedlm(y ~ x, data = df, weights = df$weights) Error in switch(method, eigen = { : EXPR must be a length 1 vector
From ‘speedglm’ package's documentation,
weights: the same of function lm, but it must be specified as data$weights
Any help please?