gwmodel

how to speed up an R for loop?

点点圈 提交于 2019-12-21 02:40:28
问题 I am running the following for loop for the gwr.basic function in the GWmodel package in R. What I need to do is to collect the mean of estimate parameter for any given bandwidth. the code looks like: library(GWmodel) data("DubVoter") #Dub.voter LARentMean = list() for (i in 20:21) { gwr.res <- gwr.basic(GenEl2004 ~ DiffAdd + LARent + SC1 + Unempl + LowEduc + Age18_24 + Age25_44 + Age45_64, data = Dub.voter, bw = i, kernel = "bisquare", adaptive = TRUE, F123.test = TRUE) a <- mean(gwr.res$SDF

how to for loop a variable inside an R functon

冷暖自知 提交于 2019-12-12 06:05:06
问题 I am a python user new to R. Right now I am dealing with the R package GWmodel. Looking at the function for the basic GWR, this looks like: gwr.res <- gwr.basic(GenEl2004 ~ DiffAdd + LARent + SC1 + Unempl + LowEduc + Age18_24 + Age25_44 + Age45_64, data = Dub.voter, bw = 100, kernel = "bisquare", adaptive = TRUE, F123.test = TRUE) What I need is to collet the mean of the estimate parameters of each variable and append it in a list for any given value of bw (bandwidth). in python terms this

how to speed up an R for loop?

天涯浪子 提交于 2019-12-03 08:42:54
I am running the following for loop for the gwr.basic function in the GWmodel package in R. What I need to do is to collect the mean of estimate parameter for any given bandwidth. the code looks like: library(GWmodel) data("DubVoter") #Dub.voter LARentMean = list() for (i in 20:21) { gwr.res <- gwr.basic(GenEl2004 ~ DiffAdd + LARent + SC1 + Unempl + LowEduc + Age18_24 + Age25_44 + Age45_64, data = Dub.voter, bw = i, kernel = "bisquare", adaptive = TRUE, F123.test = TRUE) a <- mean(gwr.res$SDF$LARent) LARentMean[i] <- a } outcome = unlist(LARentMean) > outcome [1] -0.1117668 -0.1099969 However