search for: napredict

Displaying 20 results from an estimated 20 matches for "napredict".

2009 Mar 10
1
Using napredict in prcomp
...PC1 PC2 PC3 a NA NA NA b -2.10475208 -2.315128625 -0.885197753 c 5.01177388 -1.778786252 -0.193285051 d 0.28638602 0.298315086 0.386113799 e -0.58861254 0.089498632 -0.434951813 ... Easy enough... But how do I use the "napredict" argument? Is it intended as an argument to be used in the prcomp line (as suggested in ?prcomp), or is it to be used by itself, to replace NAs in the above site score matrix (which is what I really want to do). Thank you, Alain -- Alain Paquette, Ph.D. alain.paquette at gmail.com Centr...
2012 Apr 26
0
Use scores from factor analysis and missing values factanal(), napredict(), na.omit()
...es on each of the two factors and see how they relate to the variable "trust" in the original data set. It looks like I could create a common index variable out of the rownames in each data set and then merge them, but I'm wondering if there is a less bulky way to do that perhaps via ?napredict? Thank you for your time. Yours, Simon J. Kiss ********************************* Simon J. Kiss, PhD Assistant Professor, Wilfrid Laurier University 73 George Street Brantford, Ontario, Canada N3T 2C9 Cell: +1 905 746 7606 #Sample Data mydat<-data.frame(trust=rnorm(100, mean=5, sd=2), v=rnorm(...
2014 Jan 13
1
predict.glm line 28. Please explain
...ject$linear.predictors, response = object$fitted.values, terms = predict.lm(object, se.fit = se.fit, scale = 1, type = "terms", terms = terms) ) if(!is.null(na.act)) pred <- napredict(na.act, pred) } else { pred <- predict.lm(object, newdata, se.fit, scale = 1, type = ifelse(type == "link", "response", type), terms = terms, na.action = na.action) switch(type, respo...
2005 Apr 13
3
A suggestion for predict function(s)
...ors, response = object$fitted, terms = predict.lm(object, se.fit = se.fit, scale = 1, type = "terms", terms = terms)) if (!is.null(na.act)) pred <- napredict(na.act, pred) } else { pred <- predict.lm(object, newdata, se.fit, scale = 1, type = ifelse(type == "link", "response", type), terms = terms, na.action = na.action) switch(type, response = {...
2013 Apr 18
2
Patch proposal for R style consistency (concerning deparse.c)
...inear.predictors, response = object$fitted.values, terms = predict.lm(object, se.fit=se.fit, scale = 1, type="terms", terms=terms) ) if(!is.null(na.act)) pred <- napredict(na.act, pred) } else { But the output from '> predict.glm' is not as good: if (!se.fit) { if (missing(newdata)) { pred <- switch(type, link = object$linear.predictors, response = object$fitted.values, terms = predict.lm(object,...
2002 Jan 09
1
na.action in predict.lm
...The desired output would look like: 1 2 3 4 5 6 7 -0.6161748 1.3659464 -3.2987223 1.2891959 NA 2.1753231 -3.9714629 8 9 10 -0.8349864 2.1076517 -2.3992661 I already read the help pages of na.action, options, napredict etc., but I couldn't figure out how to solve this problem. Many thanks in advance for helpful comments. Andrea -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", &qu...
2011 Jan 14
1
naresid.exclude query
...id.exclude'. Removing this line results in the behaviour I'd expected in the above example (and in a test example where `x' is a zero row matrix). Is the coded behaviour necessary for some reason? Could it be changed (so that my example produces NA)? The reason I ask is that I use `napredict' in mgcv:predict.gam, and someone complained that if he predicts using newdata that is all NA, then he doesn't get what he expected (he has a pretty good reason for doing this). Part of the problem with predict.gam in this case was my code, but once I fixed that I ran up against the abo...
2012 Feb 21
1
prior.weights and weights()
...poisson()$simulate(g,1) ## fails ## here's a new, 'safe' version of the Poisson simulate function ... simnew <- function (object, nsim) { wts <- weights(object) if (any(na.omit(wts) != 1)) warning("ignoring prior weights") ftd <- na.omit(fitted(object)) napredict(na.action(object), rpois(nsim * length(ftd), ftd)) } simnew(g,1)
2008 Sep 09
1
Addendum to wishlist bug report #10931 (factanal) (PR#12754)
...= { d <- 1/fit$uniquenesses tmp <- t(Lambda * d) sc <- t(solve(tmp %*% Lambda, tmp %*% t(zz))) }) rownames(sc) <- rownames(z) colnames(sc) <- colnames(Lambda) if(!is.null(na.act)) sc <- napredict(na.act, sc) fit$scores <- sc } if(!is.na(n.obs) && dof > 0) { fit$STATISTIC <- (n.obs - 1 - (2 * p + 5)/6 - (2 * factors)/3) * fit$criteria["objective"] fit$PVAL <- pchisq(fit$STATISTIC, dof, lower.tail = FALSE)...
2001 Aug 25
1
Missing values in glm
...stic regression with a dataset that has some missing values in the categorical response (sjukdom). These are generated 'false' values that I want predicited values for. Looking at the help, I think the correct commands to deal with these missing values are as follows: options(na.action=napredict) my.dum<-glm(sjukdom~as.factor(sex)+age+log.nrg+five.d+five2+five3+d1+d2+d3+d4+d5,na.action,family="binomial") However, I get the following error message: 'Error in as.data.frame.default(data) : can't coerce function into a data.frame' I have not been able to come up wit...
2007 Jul 25
0
Function polr and discrete ordinal scale
...eta <- drop(X %*% object$coef) cumpr <- matrix(plogis(matrix(object$zeta, n, q, byrow=T) - eta), , q) Y <- t(apply(cumpr, 1, function(x) diff(c(0, x, 1)))) dimnames(Y) <- list(dimnames(X)[[1]], object$lev) } if(!is.null(object$na.action)) Y <- napredict(object$na.action, Y) switch(type, class={ Y <- factor(max.col(Y), levels=seq(along=object$lev), labels=object$lev) }, probs={}) drop(Y) } Thank you. Géraldine LASSALLE Cemagref Unité Ecosystèmes estuariens et Poissons migrateurs amphihalins 50 avenue de...
2003 Apr 26
1
predict/residual
I am having trouble understanding the way naresid is used when using predict/residual in a new data frame. >From the example below, the NAs are displayed when predicting inside the original frame, but are dropped when applied to a new frame. ultimately I need to cbind the residuals and predictions to a dataframe. Any help would be appreciated. Thanks in advance. >
2011 Jan 28
3
how to get coefficient and scores of Principal component analysis in R?
Dear All, It might be a simple question. But I could not find the answer from function “prcomp” or “princomp”. Does anyone know what are the codes to get coefficient and scores of Principal component analysis in R? Your reply will be appreciated! Best Zunqiu [[alternative HTML version deleted]]
2012 Oct 19
1
factor score from PCA
Hi everyone, I am trying to get the factor score for each individual case from a principal component analysis, as I understand, both princomp() and prcomp() can not produce this factor score, the principal() in psych package has this option: scores=T, but after running the code, I could not figure out how to show the factor score results. Here is my code, could anyone give me some advice please?
2003 Jan 30
2
mgcv, gam
Hola! I have some problems with gam in mgcv. Firts a detail: it would be nice igf gam would accept an na.action argument, but that not the main point. I want to have a smooth term for time over a year, the same pattern repeating in succesive years. It would be natural then to impose the condition s(0)=s(12). Is this possible within mgcv? I tried to obtain this with trigonometric terms, aca:
2003 Dec 09
1
documentation fixes (cvs) (PR#5632)
...with \code{NA}s in the correct positions to + The default methods do nothing. The default method for the \code{na.exclude} + action is to pad the object with \code{NA}s in the correct positions to have the same number of rows as the original data frame. Currently \code{naresid} and \code{napredict} are identical, but Index: src/library/stats/man/nlm.Rd =================================================================== RCS file: /cvs/R/src/library/stats/man/nlm.Rd,v retrieving revision 1.1 diff -u -r1.1 nlm.Rd --- src/library/stats/man/nlm.Rd 2003/12/09 07:24:24 1.1 +++ src/library/stats/man...
2011 Feb 25
0
R 2.12.2 is released
...se m = 0. (PR#14473) ? The rendering of numbers in plotmath expressions (e.g. expression(10^2)) used the current settings for conversion to strings rather than setting the defaults, and so could be affected by what has been done before. (PR#14477) ? The methods of napredict() and naresid() for na.action = na.exclude fits did not work correctly in the very rare event that every case had been omitted in the fit. (Reported by Simon Wood.) ? weighted.residuals(drop0=TRUE) returned a vector when the residuals were a matrix (e.g. those of class...
2011 Feb 25
0
R 2.12.2 is released
...se m = 0. (PR#14473) ? The rendering of numbers in plotmath expressions (e.g. expression(10^2)) used the current settings for conversion to strings rather than setting the defaults, and so could be affected by what has been done before. (PR#14477) ? The methods of napredict() and naresid() for na.action = na.exclude fits did not work correctly in the very rare event that every case had been omitted in the fit. (Reported by Simon Wood.) ? weighted.residuals(drop0=TRUE) returned a vector when the residuals were a matrix (e.g. those of class...
2005 Jun 26
0
Factor correlations in factanal
...= { d <- 1/fit$uniquenesses tmp <- t(Lambda * d) sc <- t(solve(tmp %*% Lambda, tmp %*% t(zz))) }) rownames(sc) <- rownames(z) colnames(sc) <- colnames(Lambda) if(!is.null(na.act)) sc <- napredict(na.act, sc) fit$scores <- sc } if(!is.na(n.obs) && dof > 0) { fit$STATISTIC <- (n.obs - 1 - (2 * p + 5)/6 - (2 * factors)/3) * fit$criteria["objective"] fit$PVAL <- pchisq(fit$STATISTIC, dof, lower.tail = FALSE)...
2003 Dec 12
0
proofreading corrections (cvs) (PR#5730)
...with \code{NA}s in the correct positions to + The default methods do nothing. The default method for the \code{na.exclude} + action is to pad the object with \code{NA}s in the correct positions to have the same number of rows as the original data frame. Currently \code{naresid} and \code{napredict} are identical, but Index: src/library/stats/man/nlm.Rd =================================================================== RCS file: /cvs/R/src/library/stats/man/nlm.Rd,v retrieving revision 1.2 diff -u -r1.2 nlm.Rd --- src/library/stats/man/nlm.Rd 2003/12/11 07:16:06 1.2 +++ src/library/stats/man...