similar to: using predict method with an offset

Displaying 20 results from an estimated 3000 matches similar to: "using predict method with an offset"

2009 Feb 25
2
[R] length 1 offset in glm (& lm)
This post about length 1 offsets on R help seems to have been ignored (sorry deleted original email - is there a way to continue thread in this case?) https://stat.ethz.ch/pipermail/r-help/2009-February/189352.html It does seem to be a bug, in that glm does not behave as documented. In fact the same bug applies to lm as well. I don't think the suggested fix works though - Y isn't
2010 Jul 16
1
I need help making a data.fame comprised of selected columns of an original data frame.
I must have missed something simple, but still, i don't know what. I obtained my basic data as follows: x <- sprintf("SELECT m_id,sale_date,YEAR(sale_date) AS sale_year,WEEK(sale_date) AS sale_week,return_type,0.0001 + DATEDIFF(return_date,sale_date) AS elapsed_time FROM `merchants2`.`risk_input` WHERE DATEDIFF(return_date,sale_date) IS NOT NULL") moreinfo <- dbGetQuery(con,
2010 Jul 16
1
Troubles with DBI's dbWriteTable in RMySQL
I am feeling rather dumb right now. I created what I thought was a data.frame as follows: aaa <- lapply(split(moreinfo,list(moreinfo$m_id),drop = TRUE), fun_m_id) m_id_default_res <- do.call(rbind, aaa) print("==========================================") m_id_default_res print("==========================================") ndf <- m_id_default_res[, c('mid',
2013 Jun 18
1
install a package made using bioconductor package pdInfoBuilder
Dear maintainer, I used bioconductor package, pdInfoBuilder, to make a microarray platform annotation package. I named this package, pd.pdinfo.gpl11164.ndf.txt. This "self-made package" is to be used with oligo package. Prior to using oligo package, I need to install the annotation package, pd.pdinfo.gpl11164.ndf.txt, and cannot just copy it to the library tree. I tried using the
2009 Apr 16
2
Translate the elements of a dataframe
The second beginner question. I want to create a new dataframe, where each element of the original dataframe is translated to 1 if it was "+", to 0 if it was "-" to -1 otherwise. I could do with: Lines <- "a b c d + - + + + + + - + 1 - '+ ' - + + + + N - +" DF <-
2019 Aug 30
3
inconsistent handling of factor, character, and logical predictors in lm()
Dear R-devel list members, I've discovered an inconsistency in how lm() and similar functions handle logical predictors as opposed to factor or character predictors. An "lm" object for a model that includes factor or character predictors includes the levels of a factor or unique values of a character predictor in the $xlevels component of the object, but not the FALSE/TRUE values
2005 Aug 15
1
error in predict glm (new levels cause problems)
Dear R-helpers, I try to perform glm's with negative binomial distributed data. So I use the MASS library and the commands: model_1 = glm.nb(response ~ y1 + y2 + ...+ yi, data = data.frame) and predict(model_1, newdata = data.frame) So far, I think everything should be ok. But when I want to perform a glm with a subset of the data, I run into an error message as soon as I want to predict
2009 Feb 23
0
length 1 offset in glm
Hi, I'm trying to use an offset with glm. According to the glm man page offset ... This should be NULL or a numeric vector of length either one or equal to the number of cases. ... but with the following example, I get an error if the offset is of length 1 c1 <- structure(list(Contr = c(0.028, 0.043, 0.064, 0.097, 0.146, 0.219 + ), Correct = c(34L, 57L, 94L, 152L, 160L, 160L),
2009 May 31
1
Error:non-numeric argument in my function
Hello! I have a function: zywnoscCalosc<- function( jedzenie, n1, n2, n3, n4, d1, d2, d3, d4 ) { ndf <- data.frame(nn1=n1,nn2=n2,nn3=n3,nn4=n4) ddf <- data.frame(dd1=d1,dd2=d2,dd3=d3,dd4=d4) for (i in 1:length(n1)){ wekt_n = ndf[i,] wekt_n_ok = wekt_n[!is.na(wekt_n)] dl_n = length(wekt_n_ok) wynik = (1*wekt_n_ok)/(1*dl_n) } } and I get an error like this: Error in 1 * wekt_n_ok :
2013 Apr 03
5
Can package plyr also calculate the mode?
I am trying to replicate the SAS proc univariate in R. I got most of the stats I needed for a by grouping in a data frame using: all1 <- ddply(all,"ACT_NAME", summarise, mean=mean(COUNTS), sd=sd(COUNTS), q25=quantile(COUNTS,.25),median=quantile(COUNTS,.50), q75=quantile(COUNTS,.75), q90=quantile(COUNTS,.90), q95=quantile(COUNTS,.95), q99=quantile(COUNTS,.99) )
2009 Jun 02
2
What do you think about my function?
Hello, I want to know what do you think about my function. I know that it isn't briliant :/ but what do you think? What I should do that my function will be better? (now is very slow and not ideal, sometimes I also get a mistake!) ########## My function ############################################# dzieci<-transform(dzieci, zywnosc=0) zywnoscCalosc<- function( jedzenie, sklep, n1, n2,
2009 Nov 12
1
Transforming a dataframe into a response/predictor matrix
I currently have a data frame whose rows correspond to each student and whose columns are different variables for the student, as shown below: Lastname Firstname CATALOG_NBR Email StudentID EMPLID Start 1 alastname afirstname 1213 *@uark.edu 10295236 # 12/2/2008 2 anotherlastname anotherfirstname 1213 **@uark.edu ## 10295236 9/3/2008 Xattempts Q1
2008 Jun 19
1
PrettyR (describe)
#is there a way to get NA in the table of descriptive statistics instead of the function stopping Thank you in advance #data x.f <- structure(list(Site = structure(c(9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L, 9L), .Label = c("BC", "HC", "RM119", "RM148", "RM179", "RM185",
2008 Dec 03
1
function qt can fails if ndf < 1 (PR#13364)
Full_Name: Gerard Torrent Version: R version 2.8.0 (2008-10-20) OS: Linux 2.6.27.5-41.fc9.x86_64 #1 SMP Submission from: (NULL) (85.52.227.233) In some cases qt complains about NaNs and don't gives the correct result: > qt(0.1,, 0.1) [1] NaN Warning message: In qt(p, df, lower.tail, log.p) : NaNs produced But the result can be found: > pt(-1.60443e+06, 0.1) [1] 0.09999997 If I
2011 May 18
1
Need expert help with model.matrix
Dear experts: Is it possible to create a new function based on stats:::model.matrix.default so that an alternative factor coding is used when the function is called instead of the default factor coding? Basically, I'd like to reproduce the results in 'mat' below, without having to explicitly specify my desired factor coding (identity matrices) in the 'contrasts.arg'. dd
2010 Sep 24
1
How to change the lengend in a DA figure
Dear all: I have encountered a problem recently: I used to plot figure, and using code "main="......", xlab=".....",ylab="....." to change the legend. But recently I was using R to perform Discriminant Function analysis, and I want to change the group names also add a title to the figure, but I am not sure how to make it work, could you please help me with my
2019 Aug 31
2
inconsistent handling of factor, character, and logical predictors in lm()
Dear Abby, > On Aug 30, 2019, at 8:20 PM, Abby Spurdle <spurdle.a at gmail.com> wrote: > >> I think that it would be better to handle factors, character predictors, and logical predictors consistently. > > "logical predictors" can be regarded as categorical or continuous (i.e. 0 or 1). > And the model matrix should be the same, either way. I think that
2013 Feb 12
0
error message from predict.coxph
In one particular situation predict.coxph gives an error message. Namely: stratified data, predict='expected', new data, se=TRUE. I think I found the error but I'll leave that to you to decide. Thanks, Chris ######## CODE library(survival) set.seed(20121221) nn <- 10 # sample size in each group lambda0 <- 0.1 # event rate in group 0 lambda1 <- 0.2 # event rate in group 1
2011 Jan 11
5
A question on dummy variable
Dear all, I would like to ask one question related to statistics, for specifically on defining dummy variables. As of now, I have come across 3 different kind of dummy variables (assuming I am working with Seasonal dummy, and number of season is 4): > dummy1 <- diag(4) > for(i in 1:3) dummy1 <- rbind(dummy1, diag(4)) > dummy1 <- dummy1[,-4] > > dummy2 <- dummy1 >
2012 Oct 22
2
Problem installing ndf library
Hello, I am a new user of R and Linux (debian squeeze), and I am trying to install the ncdf library. First I don't know wich is the best to use (ncdf or ncdf4), But not matter the one I tried to install, it always failled. I try to find a solution to this common problem on the web, but I never find the good way to solve it. I hope you could help me I try many things during two days and now I