Hi Gustav,
Just change `summary(x)$coef` to `summary(x)$p.table`
I am pasting the code from the attachment.
library(gamair)
library(mgcv)
data(chicago)
library(splines)
chicago$date<-seq(from=as.Date("1987-01-01"),
to=as.Date("2000-12-31"),length=5114)
chicago$trend<-seq(dim(chicago)[1
Sorry, I just noticed that in the first line of the solution 'l' got stripped
off, it should be read as 'lapply` instead of 'apply`.
lapply(1:length(models),function(i) lapply(models[[i]],function(x)
summary(x)$p.table[2,]))[[1]] #1st list component
Thanks,
A.K.
___
HI Gustav,
If you need the combined output:
res<-lapply(1:length(models),function(i)
do.call(rbind,lapply(models[[i]],function(x)
summary(x)$coef[row.names(summary(x)$coef)%in%c("pm10","ozone","so2"),c(1:2,4)])))
names(res)<-1:length(res)
res1<-do.call(rbind,lapply(res,function(i)
{row.names(i
Hi Gustav,
Try this:
lapply(1:length(models),function(i) lapply(models[[i]],function(x)
summary(x)$coef[2,]))[[1]] #1st list component
[[1]]
# Estimate Std. Error z value Pr(>|z|) # pm10
#5.999185e-04 1.486195e-04 4.036606e+00 5.423004e-05
#[[2]]
# Estimate Std. Error z
4 matches
Mail list logo