search for: nobs

Displaying 20 results from an estimated 200 matches for "nobs".

Did you mean: jobs
2013 May 01
1
Trouble with methods() after loading gdata package.
....lm* deviance.lm* dfbeta.lm* [9] dfbetas.lm* drop1.lm* dummy.coef.lm* effects.lm* [13] extractAIC.lm* family.lm* formula.lm* hatvalues.lm [17] influence.lm* kappa.lm labels.lm* logLik.lm* [21] model.frame.lm model.matrix.lm nobs.lm* plot.lm [25] predict.lm print.lm proj.lm* qr.lm* [29] residuals.lm rstandard.lm rstudent.lm simulate.lm* [33] summary.lm variable.names.lm* vcov.lm* Non-visible functions are asterisked > > library(gdata) gdata: read.xls...
2012 Apr 24
1
nobs.glm
Hi all, The nobs method of (MASS:::polr class) takes into account of weight, but nobs method of glm does not. I wonder what is the rationale of such design behind nobs.glm. Thanks in advance. Best Regards. > library(MASS) > house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing) >...
2012 Jan 20
1
nobs() and logLik()
Dear all, I am studying a bit the various support functions that exist for extracting information from fitted model objects. From the help files it is not completely clear to me whether the number returned by nobs() should be the same as the "nobs" attribute of the object returned by logLik(). If so, then there is a slight inconsistency in the methods for 'nls' objects with logLik.nls() taking zero weights into account while nobs.nls() does not. Admittedly, the help page of nobs() state...
2013 Feb 18
1
nobs() with glm(family="poisson")
Hi! The nobs() method for glm objects always returns the number of cases with non-null weights in the data, which does not correspond to the number of observations for Poisson regression/log-linear models, i.e. when family="poisson" or family="quasipoisson". This sounds dangerous since nobs...
2003 Sep 27
2
CI on median
Dear friends, I'm probably wrong but is there anything better than bootstrap to get a confidence interval of the median from a population with unspecified distribution ? Best wishes Troels Ring, Aalborg, Denmark
2003 Nov 13
1
creating a "report" table from a set of lists
...wing... I've got a list (returned from a function) and I would like to "cbind()" the lists together to create a "cross tab" report or simply bind them together somehow the function returns a list that looks like the following: > all$BM $species [1] "BM" $vbar.nobs [1] 3 $vbar.sum [1] 54.05435 $count.nobs [1] 20 $basal.area [1] 26 $expf [1] 5.339182 > so there are different variable types in the list (meaning I can't use cbind?) to create a table with more than one column for stringing together multiple species. I tried to use rbind and got similar r...
2013 Apr 25
1
lsfit: Error in formatting error message
Hi, in R-3.0 I get the following error when calling lsfit with more observations than variables, which seems to come from an error in the formatting of the error message (note that this was not happening in 2.15.3): > nobs <- 5; nvar <- 6; lsfit(matrix(runif(nobs*nvar), ncol=nvar), runif(nobs), intercept=FALSE) Error in sprintf(ngettext(nry, "%d response", "%d responses"), ", ", ngettext(ncx, : invalid format '%d'; use format %s for character objects > traceback() 3:...
2018 Jul 20
3
Should there be a confint.mlm ?
It seems that confint.default returns an empty data.frame for objects of class mlm. For example: ``` nobs <- 20 set.seed(1234) # some fake data datf <- data.frame(x1=rnorm(nobs),x2=runif(nobs),y1=rnorm(nobs),y2=rnorm(nobs)) fitm <- lm(cbind(y1,y2) ~ x1 + x2,data=datf) confint(fitm) # returns: 2.5 % 97.5 % ``` I have seen proposed workarounds on stackoverflow and elsewhere, but suspect th...
2008 Dec 23
1
quotation problem/dataframe names as function input argument.
...ne help me with the following problem? Many thanks in advance. # Problem Description: # I want to write functions which take a (character) vector of dataframe names as input argument. # For example, I want to extract the number of observations from a number of dataframes. # I tried the following: nobs.fun <- function (dframe.vec) { nobs.vec <- array(NA,c(length(dframe.vec),1)) for (i in 1:length(dframe.vec)) { nobs.vec[i] <- dim(dframe.vec[i])[1] } return(nobs.vec) } # To show the problem, I create a fake dataframe and store its name (i.e., dframe.1) # in a ve...
2007 Sep 26
2
AIC questions
In accordance with Venables and Ripley, SAS documentation and other sources AIC with sigma^2 unknown is calculated as: AIC = -2LL + 2* #parameters = n log(RSS/n) + 2p For the fitness data: (http://support.sas.com/ctx/samples/index.jsp?sid=927), SAS gets an AIC of 64.534 with model oxygen = runtime. (SAS STAT User's Guide. Chapter 61. pp 3956, the REG Procedure). This value of AIC accords
2011 Mar 27
1
run function on subsets of matrix
I was wondering if it is possible to do the following in a smarter way. I want get the mean value across the columns of a matrix, but I want to do this on subrows of the matrix, given by some vector(same length as the the number of rows). Something like nObs<- 6 nDim <- 4 m <- matrix(rnorm(nObs*nDim),ncol=nDim) fac<-sample(1:(nObs/2),nObs,rep=T) ##loop trough different 'factor' levels for (i in unique(fac)) print(apply(m[fac==i,],2,mean)) Now, the problem is that if a value in 'fac' only occurs once, the 'a...
2007 Dec 05
1
Information criteria for kmeans
Hello, how is, for example, the Schwarz criterion is defined for kmeans? It should be something like: k <- 2 vars <- 4 nobs <- 100 dat <- rbind(matrix(rnorm(nobs, sd = 0.3), ncol = vars), matrix(rnorm(nobs, mean = 1, sd = 0.3), ncol = vars)) colnames(dat) <- paste("var",1:4) (cl <- kmeans(dat, k)) schwarz <- sum(cl$withinss)+ vars*k*log(nobs) Thanks for your help, Serguei _______...
2002 Feb 27
1
Bug in glm.fit? (PR#1331)
...oting has occured. So I deleted that line. That's all for now. Thanks for the great package and I hope that this bug report will be useful. Cheers, Berwin ========================= original glm.fit ========================= 1 glm.fit <- 2 function (x, y, weights = rep(1, nobs), start = NULL, etastart = NULL, 3 mustart = NULL, offset = rep(0, nobs), family = gaussian(), 4 control = glm.control(), intercept = TRUE) 5 { 6 x <- as.matrix(x) 7 xnames <- dimnames(x)[[2]] 8 ynames <- names(y) 9 conv <- FALSE 10...
2005 Jun 20
1
(no subject)
...s a YoYo = unstable = changes from positive to negative. So, if I codify the visits with codes 1,2,4,8 if present at year 1,2,3,4 and similarly the tests positive I get the last2 list codifying the test code corresponding to the visits patterns possible, similarly the last1 list 20 here means NULL nobs <- 400 # visits 0 1 2 3 4 5 6 7 8 9 last1 <- list((20),(1),(2),c(3,2),(4),c(5,4),c(6,4),c(7,6,4),(8),c(9,8), # visits 10 11 12 13 14 15 c(10,8),c(11,10,8),c(12,8),c(13,12,8),c(14,12,8),c(15,14,12,8))...
2011 Feb 28
0
lme error message: Error in getGroups.data.frame(dataMix, groups) :
...34 4 16.2311097 35 4 -2.5781897 36 4 -3.0167290 37 4 -0.1119353 38 4 1.1983126 39 4 -8.8212143 40 4 3.8895263 my code: library(nlme) # Define essential constants. # Number of subject studied. NSubs <- 4 # Number of observations per subject. NObs <- 10 # Between study SD tau <- 4 # Within study SD. sigma <- 8 # END Define essential constants. # Define between subject variation between <- matrix(nrow=10,ncol=1) between <- rnorm(NSubs,0,tau) between # END Define between subject variation. # Define within subject varation....
2005 Oct 16
1
BIC doesn't work for glm(family=binomial()) (PR#8208)
Full_Name: Ju-Sung Lee Version: 2.2.0 OS: Windows XP Submission from: (NULL) (66.93.61.221) BIC() requires the attribute $nobs from the logLik object but the logLik of a glm(formula,family=binomial()) object does not include $nobs. Adding attr(obj,'nobs') = value, seems to allow BIC() to work. Reproducing the problem: library(nmle); BIC(logLik(glm(1~1,family=binomial())));
2007 Sep 28
2
plot graph with error bars trouble
Hi, I have a data set like this: Mutant Rep Time OD 02H02 1 0 0.029 02H02 2 0 0.029 02H02 3 0 0.023 02H02 1 8 0.655 02H02 2 8 0.615 02H02 3 8 0.557 02H02 1 12 1.776 02H02 2 12 1.859 02H02 3 12 1.668 02H02 1 16 3.379 02H02 2 16 3.726 02H02 3 16 3.367 306 1 0 0.033 306 2
2003 Oct 27
3
expanding factor with NA
I have a factor (with "n" observations and "k" levels), with only "nobs" < n of the observations not missing. I would like to produce a (n x k) model matrix with treatment contrasts for this factor, with rows of NAs placeholding the missing observations. If I use model.matrix() I get back a (nobs x k) matrix. Is there an easy way to get the (n x k) without c...
2010 Jan 21
2
Problems completely reading in a "large" sized data set
...containing variable names. I am trying to get this into R as a dataset for analysis. z<-"Data/media1y.txt" f=file(zz,'r') # open the file rl = readLines(f,1) # Read the first line colnames<-strsplit(rl, '\t') p = length(colnames[[1]]) # counte the number of columns nobs<-450932 close(f) Using: d1<-matrix(scan(zz,skip=1,sep="\t",fill=TRUE,what=rep("character",p), nlines=nobs),ncol=p,nrow=nobs, byrow=TRUE, dimnames=list(NULL,colnames[[1]])) produces the error Read 5761719 items Warning message: In matrix(scan(zz, skip = 1, sep = "\t&...
2008 Jan 24
2
testing coeficients of glm
...ovariance matrix of the estimated parameters from glm. but perhaps there is a direct solution in one of the packages. i know how to solve this particular problem (i wrote it below) but i'm curious about the covariance matrix of coefficient as it seems to be important. the R code example : ### nObs <- 10 cl <- as.factor( sample(c(1,2,3),nObs,replace=TRUE) ) y <- rnorm(nObs) model <- glm(y ~ cl) b <- model$coefficients H <- c(1,1,-1) # we want to test H0: Hb = 0 ### the following code will NOT run unless we can compute covModelCoeffs #the mean of Hb is mu = H %*% model$co...