similar to: Error in model.frame: invalid variable type

Displaying 20 results from an estimated 30000 matches similar to: "Error in model.frame: invalid variable type"

2003 Dec 14
3
Problem with data conversion
Hi All: I came across the following problem while working with a dataset, and wondered if there could be a solution I sought here. My dataset consists of information on 402 individuals with the followng five variables (age,sex, status = a binary variable with levels "case" or "control", mma, dma). During data check, I found that in the raw data, the data entry
2004 Oct 11
3
logistic regression
Hello, I have a problem concerning logistic regressions. When I add a quadratic term to my linear model, I cannot draw the line through my scatterplot anymore, which is no problem without the quadratic term. In this example my binary response variable is "incidence", the explanatory variable is "sun": > model0<-glm(incidence~1,binomial) >
2006 Feb 12
1
lme, nlsList, nlsList.selfStart
Dear listers, I am trying to fit a model using nlsList() using alternately a SSfol() selfstart function or its developped equivalent formulae. This preliminary trial works well mydata<-groupedData(Conc~Tps|Organ,data=mydata) mymod1<-nls(Conc~SSfol(Dose,Tps,lKe,lKa,lCl),data=mydata) as well as a developped form: mymod2<-nls(Conc~Dose * exp(lKe+lKa-lCl) *
2002 Jun 20
1
Possible bug with glm.nb and starting values (PR#1695)
Full_Name: Ben Cooper Version: 1.5.0 OS: linux Submission from: (NULL) (134.174.187.90) The help page for glm.nb (in MASS package) says that it takes "Any other arguments for the glm() function except family" One such argument is start "starting values for the parameters in the linear predictor." However, when called with starting values glm.nb returns: Error in
2005 Aug 17
3
do glm with two data sets
I have two data sets: File1.txt: Name id1 id2 id3 ... N1 0 1 0 ... N2 0 1 1 ... N3 1 1 -1 ... ... File2.txt: Group id1 id2 id3 ... G1 1.22 1.34 2.44 ... G2 2.33 2.56 2.56 ... G3 1.56 1.99 1.46 ... ... I like to do: x1<-c(0,1,0,...) y1<-c(1.22,1.34, 2.44, ...)
2001 Aug 21
2
Problem using GLM in a loop
Hello, I am try to perform a modeling which is relevant in a strongly heteroscedastic context. So I perform a dual modeling (modeling of both mean and variance of a response) in using the following loop: jointmod <- function(formula, data, itercrit=10,devcrit=0.0001) { # # Init step # init <- glm(formula=formula,family=gaussian, data=data) response <-
2001 Dec 03
1
fitting models with the subset argument
Hi all, I'd like to fit model where the terms both are in the data.frame, mydata say, and are vectors *not in the data.frame*. >obj<-glm(y~x, data=mydata) #works >Z<-pmax(mydata$x-20,0) >(length(Z)==length(obj$y)) >[1] TRUE >update(obj,.~.+Z) #works However for some subset it doesn't works: >obj<-glm(y~x, data=mydata, subset=f==1) #works
2007 Feb 13
1
Missing variable in new dataframe for prediction
Hi, I'm using a loop to evaluate several models by taking adjacent variables from my dataframe. When i try to get predictions for new values, i get an error message about a missing variable in my new dataframe. Below is an example adapted from ?gam in mgcv package library(mgcv) set.seed(0) n<-400 sig<-2 x0 <- runif(n, 0, 1) x1 <- runif(n, 0, 1) x2 <- runif(n, 0, 1) x3 <-
2006 Sep 01
1
difference between ns and bs in predict.glm
I am fittling a spline to a variable in a regression model, I am then using the predict.glm funtion to make some predictions. When I use bs to fit the spline I don't have any problems using the predict.glm function however when I use ns I get the following error: Error in model.frame(formula, rownames, variables, varnames, extras, extranames, : variable lengths differ (found for
2007 Oct 02
1
problems with glm
I am having a couple of problems someone may be able to cast some light on. Question 1: I am making a logistic model but when i do this: glm.model = glm(as.factor(form$finished) ~ ., family=binomial, data=form[1:150000,]) I get this: Error in model.frame(formula, rownames, variables, varnames, extras, extranames, : variable lengths differ (found for 'barrier') which is
2007 Mar 07
3
possible bug in model.frame.default
Dear list, I may have found a bug in model.frame.default (called by the lm function). The problem arises in my R dev version but not in my R 2.4.0. Here is my config : > version _ platform x86_64-unknown-linux-gnu arch x86_64
2006 Feb 16
1
cv.glm function error message in a loop
Dear list, I am modelling fish distributions using the glm-function followed by the step-function, and then want to cross-validate the model via the cv.glm-function from the {boot} package. I am working on fish distributions on coral reefs. The code I have works for one fish species. Since I have 227 fishes, I wrote a loop. Now the cv.glm-function comes up with an error message: "Error in
2005 Feb 24
4
r: functions
hi all i have a function that uses two inputs, say xdata and ydata. An example is the following, simple1<-function(xdata,ydata) { ofit<-lm(ydata~xdata) list(ofit) } say i use arbitray number for xdata and ydata such that D = x1 x2 y 1 1 10 2 6 6 3 10 7 x<-D[,1:2] and y<-D[,3] if one uses these inputs and rund the program we get the following: >simple(xdata=x,ydata=y)
2004 Feb 18
2
using names() as a variable in a formula
Greetings List, I'm having some trouble with the use of the names function in a formula. Below is an example of something that works (i.e first line), and the second line is the same formula which doesn't. I want to be able to reference the column of the dataC table so I can run the variogram iteratively with a loop. > v<-variogram(A1~1,loc=~x+y, dataC) >
2006 Jun 22
2
weights in lm, glm (PR#9023)
Full_Name: James Signorovitch Version: 2.2.1 OS: WinXP Submission from: (NULL) (134.174.182.203) In the code below, fn1() and fn2() fail with the messages given in the comments. Strangely, fn2() fails for all data sets I've tried except for those with 100 rows. The same errors occur if glm() is used in place of lm(), or if R 2.1.1 is used on a unix system. Thanks for looking into this.
2006 Mar 23
2
invalid variable type in model.frame within a function
Dear expeRts, I came across the following error in using model.frame: # make a data.frame jet=data.frame(y=rnorm(10),x1=rnorm(10),x2=rnorm(10),rvar=rnorm(10)) # spec of formula mf1=y~x1+x2 # make the model.frame mf=model.frame(formula=mf1,data=jet,weights=rvar) Which gives the desired output: > mf y x1 x2 (weights) 1 0.8041254 0.1815366 0.4999551 1.4957814 2
2004 Jun 03
2
Simulating a landscape (matrix) in R
I'm trying to figure out how one might go about simulating a landscape (matrix) in R. For example if one wanted to generate a simulated landscape of precipitation values for some area (say a 100 X 100 matrix) they could generate 10,000 numbers using a random normal distribution with a mean and std. dev. and randomly allocate these generated numbers to the grid cells. However, this is too
2003 Feb 10
2
problems using lqs()
Dear List-members, I found a strange behaviour in the lqs function. Suppose I have the following data: y <- c(7.6, 7.7, 4.3, 5.9, 5.0, 6.5, 8.3, 8.2, 13.2, 12.6, 10.4, 10.8, 13.1, 12.3, 10.4, 10.5, 7.7, 9.5, 12.0, 12.6, 13.6, 14.1, 13.5, 11.5, 12.0, 13.0, 14.1, 15.1) x1 <- c(8.2, 7.6,, 4.6, 4.3, 5.9, 5.0, 6.5, 8.3, 10.1, 13.2, 12.6, 10.4, 10.8, 13.1, 13.3, 10.4, 10.5, 7.7, 10.0, 12.0,
2000 Feb 19
1
problem with glm (PR#452)
I'm having sporadic problems with glm on my alpha workstation running Compaq Tru64 UNIX V5.0 (I can't replicate the problem on my Linux PC). I have the same problem whether I use a version of R built with the native C-compiler or a version compiled with gcc. In both cases I've built with g77. I want to do some simulations with a call to glm in each rep. A simplified version would be
2003 Apr 21
3
To create a Panel and run a Pooled OLS
Dear all, I have tried to merge two cross sections (crossA and crossB) as follows, both crossA and crossB include the same variables, e.g., ID,y,x1,x2: Panel <- merge(crossA,crossB,by="ID") I have, thereafter, tried to run the following pooled OLS: OLS <- lm(Panel$y~Panel$x1+Panel$x2) and have received the following error message "Error in model.frame(formula, rownames,